V2EX助手

V2EX助手,将v2ex.com的帖子超链接改为新窗口打开

当前为 2016-09-13 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         V2EX助手
// @namespace    http://zhihaofans.com
// @version      0.4.0
// @description  V2EX助手,将v2ex.com的帖子超链接改为新窗口打开
// @author       zhihaofans
// @match        http*://www.v2ex.com/*
// @grant        none
// @icon		 https://www.v2ex.com/static/img/icon_rayps_64.png
// ==/UserScript==
$(document).ready(function(){
	var nowurl=location.pathname;
	if(nowurl=="/" || nowurl.substr(0,6)=="/?tab=" || nowurl.substr(0,4)=="/go/" ){
		$("span.item_title a").attr("target","_blank");
	}
	if(nowurl.substr(0,3)=="/t/"){
		$("a[rel=nofollow]").attr("target","_blank");
		$(".inner a").attr("target","_blank");
		$(".inner:first a").removeAttr("target");
		var lzname=$(".header .gray a").text();
		var replynum=$("div.cell[id^=r_] strong a").length;
		console.log(replynum);
		for(var aa=0;aa<replynum;aa++){
			console.log($("div.cell[id^=r_]:eq("+aa+") strong a").text());
			if($("div.cell[id^=r_]:eq("+aa+") strong a").text()==lzname){
				$("div.cell[id^=r_]:eq("+aa+") strong").html($("div.cell[id^=r_]:eq("+aa+") strong").html()+"&nbsp;[楼主]");
			}
		}
	}
});