知乎、简书、CSDN、掘金、51CTO、infoq链接直接跳转

去除知乎、简书、CSDN、掘金、51CTO、infoq链接跳转提示,点击链接直接跳转网页

  1. // ==UserScript==
  2. // @name 知乎、简书、CSDN、掘金、51CTO、infoq链接直接跳转
  3. // @namespace https://gf.qytechs.cn/
  4. // @version 0.8
  5. // @description 去除知乎、简书、CSDN、掘金、51CTO、infoq链接跳转提示,点击链接直接跳转网页
  6. // @author Derek
  7. // @match https://*.zhihu.com/*
  8. // @match https://*.csdn.net/*
  9. // @match https://*.jianshu.com/*
  10. // @match https://*.juejin.cn/*
  11. // @match https://*.51cto.com/*
  12. // @match https://*.infoq.cn/*
  13. // @grant none
  14. // @require https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.5.1/jquery.min.js
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. function getRealHref(href) {
  19. try {
  20. if (href.startsWith(`https://link.zhihu.com/?target=`)) {
  21. let href_real = href.split(`?target=`)[1];
  22. return decodeURIComponent(href_real);
  23. } else if (href.startsWith(`https://link.jianshu.com?t=`)) {
  24. let href_real = href.split(`?t=`)[1];
  25. return decodeURIComponent(href_real);
  26. } else if (href.startsWith(`https://links.jianshu.com/go?to=`)) {
  27. let href_real = href.split(`go?to=`)[1];
  28. return decodeURIComponent(href_real);
  29. } else if (href.startsWith(`https://link.juejin.cn?target=`)) {
  30. let href_real = href.split(`?target=`)[1];
  31. return decodeURIComponent(href_real);
  32. } else {
  33. return href;
  34. }
  35. } catch (e) {
  36. return href;
  37. }
  38. }
  39.  
  40. (function () {
  41. window.topen = window.open;
  42. window.open = (a, b) => {
  43. if (a.startsWith("https://link.csdn.net?target=")) {
  44. a = a.replace(/https\:\/\/link\.csdn\.net\?target\=/g, '');
  45. window.topen(decodeURIComponent(a), b);
  46. } else if (a.startsWith("https://blog.51cto.com/transfer?")) {
  47. a = a.replace(/https\:\/\/blog\.51cto\.com\/transfer\?/g, '');
  48. window.topen(decodeURIComponent(a), b);
  49. } else if (a.startsWith("https://www.infoq.cn/link?target=")) {
  50. a = a.replace(/https\:\/\/www\.infoq\.cn\/link\?target\=/g, '');
  51. window.topen(decodeURIComponent(a), b);
  52. } else {
  53. window.topen(a, b);
  54. }
  55. }
  56. setInterval(() => {
  57. //对新出现的内容,每 1.5s 刷新一次a标签的链接
  58. let a = $(`a`);
  59. for (let i = 0; i < a.length; i++) {
  60. let cur_a = a.eq(i);
  61. let cur_href = cur_a.attr(`href`);
  62. if (cur_href) {
  63. cur_a.attr(`href`, getRealHref(cur_href));
  64. }
  65. }
  66. }, 1500);
  67. })();

QingJ © 2025

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