V2EX助手

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

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

  1. // ==UserScript==
  2. // @name V2EX助手
  3. // @namespace http://zhihaofans.com
  4. // @version 0.4.0
  5. // @description V2EX助手,将v2ex.com的帖子超链接改为新窗口打开
  6. // @author zhihaofans
  7. // @match http*://www.v2ex.com/*
  8. // @grant none
  9. // @icon https://www.v2ex.com/static/img/icon_rayps_64.png
  10. // ==/UserScript==
  11. $(document).ready(function(){
  12. var nowurl=location.pathname;
  13. if(nowurl=="/" || nowurl.substr(0,6)=="/?tab=" || nowurl.substr(0,4)=="/go/" ){
  14. $("span.item_title a").attr("target","_blank");
  15. }
  16. if(nowurl.substr(0,3)=="/t/"){
  17. $("a[rel=nofollow]").attr("target","_blank");
  18. $(".inner a").attr("target","_blank");
  19. $(".inner:first a").removeAttr("target");
  20. var lzname=$(".header .gray a").text();
  21. var replynum=$("div.cell[id^=r_] strong a").length;
  22. console.log(replynum);
  23. for(var aa=0;aa<replynum;aa++){
  24. console.log($("div.cell[id^=r_]:eq("+aa+") strong a").text());
  25. if($("div.cell[id^=r_]:eq("+aa+") strong a").text()==lzname){
  26. $("div.cell[id^=r_]:eq("+aa+") strong").html($("div.cell[id^=r_]:eq("+aa+") strong").html()+"&nbsp;[楼主]");
  27. }
  28. }
  29. }
  30. });