ZhiHuLink

直接访问知乎外链

  1. // ==UserScript==
  2. // @name ZhiHuLink
  3. // @namespace https://github.com/Cacivy/utils/blob/master/GreasyFork/ZhiHuLink.js
  4. // @version 0.8
  5. // @description 直接访问知乎外链
  6. // @author Cacivy
  7. // @match https://*.zhihu.com/*
  8. // @include https://*.zhihu.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. // Your code here...
  15. var loading = false;
  16. redirect();
  17. setInterval(function() {
  18. redirect();
  19. }, 3000);
  20.  
  21. function redirect() {
  22. if (!loading) {
  23. loading = true;
  24. var links = document.querySelectorAll("a[href*='//link.zhihu.com']");
  25. var href;
  26. var length = links.length;
  27. for (var i = 0; i < length; i++) {
  28. href = links[i].getAttribute('href');
  29. if (href) {
  30. links[i].setAttribute('href', unescape(href.split('target=')[1]));
  31. }
  32. }
  33. loading = false;
  34. }
  35. }
  36. })();

QingJ © 2025

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