V2EX.js

V2EX助手

  1. // ==UserScript==
  2. // @name V2EX.js
  3. // @namespace https://github.com/zhihaofans
  4. // @version 0.6.2
  5. // @description V2EX助手
  6. // @author zhihaofans
  7. // @match https://www.v2ex.com/*
  8. // @match https://v2ex.com/*
  9. // @grant none
  10. // @icon https://www.v2ex.com/static/img/icon_rayps_64.png
  11. // ==/UserScript==
  12. $(document).ready(function() {
  13. //搜索改为百度
  14. $("#Search form").submit(function() {
  15. var q = $("#q");
  16. if (q.val() !== "") {
  17. var url = "https://www.baidu.com/s?wd=site:v2ex.com%20" + q.val();
  18. if (navigator.userAgent.indexOf('iPad') > -1 || navigator.userAgent.indexOf('iPod') > -1 || navigator.userAgent.indexOf('iPhone') > -1) {
  19. location.href = url;
  20. } else {
  21. window.open(url, "_blank");
  22. }
  23. return false;
  24. } else {
  25. return false;
  26. }
  27. });
  28. var nowurl = location.pathname;
  29. //超链接改为新标签打开
  30. if (nowurl == "/" || nowurl.substr(0, 6) == "/?tab=" || nowurl.substr(0, 4) == "/go/" || nowurl == "/recent") {
  31. $("span.item_title a").attr("target", "_blank");
  32. }
  33. //楼主标记
  34. if (nowurl.substr(0, 3) == "/t/") {
  35. $("a[rel=nofollow]").attr("target", "_blank");
  36. $(".inner a").attr("target", "_blank");
  37. $(".inner:first a").removeAttr("target");
  38. var lzname = $(".header .gray a").text();
  39. var replynum = $("div.cell[id^=r_] strong a").length;
  40. for (var aa = 0; aa < replynum; aa++) {
  41. // console.log($("div.cell[id^=r_]:eq("+aa+") strong a").text());
  42. if ($("div.cell[id^=r_]:eq(" + aa + ") strong a").text() == lzname) {
  43. $("div.cell[id^=r_]:eq(" + aa + ") strong").html($("div.cell[id^=r_]:eq(" + aa + ") strong").html() + "&nbsp;[楼主]");
  44. }
  45. }
  46. }
  47. //屏蔽右侧广告
  48. $("#Rightbar .box .sidebar_compliance").parent().hide();
  49. //原搜索删除
  50. $("#Search form").removeAttr("onsubmit");
  51. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址