Greasy Fork is available in English.

知乎免登录

并且去掉链接跳转。

  1. // ==UserScript==
  2. // @name 知乎免登录
  3. // @description 并且去掉链接跳转。
  4. // @author Damn
  5. // @namespace incast.info
  6. // @run-at document-start
  7. // @include http://*.zhihu.com/*
  8. // @include https://*.zhihu.com/*
  9. // @match http://*.zhihu.com/*
  10. // @match https://*.zhihu.com/*
  11. // @date 18/12/2016
  12. // @version 2.0.4
  13. // ==/UserScript==
  14.  
  15. if(location.href=="https://www.zhihu.com/"){location.href="https://www.zhihu.com/explore";}
  16. document.addEventListener('DOMContentLoaded',proceed());
  17. var mo=new MutationObserver(function(){proceed();});
  18. mo.observe(document,{'childList':true,'subtree':true});
  19. function proceed(){
  20. (function(){
  21. if(document.body){
  22. function treat(that){
  23. var targets = document.querySelectorAll(that);
  24. if(targets.length>0){
  25. [].forEach.call(targets,function(node){
  26. node.style.display="none";
  27. console.log(that);
  28. });
  29. }
  30. }
  31. treat("div.zm-editable-editor-wrap");
  32. treat("div.zu-editable-editor-wrap");
  33. treat("ul.topnav-noauth");
  34. treat("#SidebarSignFlow");
  35. treat("#zu-top-add-question");
  36. treat("#zh-top-nav-topic");
  37. treat("#zh-footer");
  38. treat("div.DownloadApp");
  39. treat("button[class^='_CommentItem']:not([class^='_CommentItem_openConversations'])");
  40. if(document.querySelectorAll('a.zu-button-more').length>0){document.querySelectorAll('a.zu-button-more')[0].outerHTML="<hr>";}
  41. [].forEach.call(document.querySelectorAll('a[href="/"]'),function(node){node.href="/explore";});
  42. [].forEach.call(document.querySelectorAll('div.conpulsory-login-mask'),function(node){node.parentNode.style.height="";node.style.display='none';});
  43. [].forEach.call(document.querySelectorAll('a.external'),function(node){if(node.href.indexOf("target")>0){node.href=decodeURIComponent(node.href.slice(node.href.indexOf("target")+7));}});
  44. [].forEach.call(document.querySelectorAll('a.meta-item'),function(node){if(node.innerHTML.indexOf('添加评论')>0){node.outerHTML='<label class="meta-item">暂无评论</label>';} if((node.className.indexOf('toggle-comment')<0)*(node.className.indexOf('answer-date-link')<0)){node.style.display='none';}});
  45. [].forEach.call(document.querySelectorAll('a.action-item'),function(node){if(node.className.indexOf('js-toggleCommentBox')<0){node.style.display='none';}});
  46. [].forEach.call(document.querySelectorAll('button[class^="FeedbackButton"]'),function(node){node.parentNode.style.display='none';});
  47. [].forEach.call(document.querySelectorAll('button[class^="follow-button"]'),function(node){node.parentNode.style.display='none';});
  48. [].forEach.call(document.querySelectorAll('#SidebarSignFlow'),function(node){node.parentNode.style.display='none';});
  49. [].forEach.call(document.querySelectorAll('div.zm-comment-ft'),function(node){[].forEach.call(node.childNodes,function(cht){if(cht.nodeName=="A"){cht.style.display='none';}});});
  50. }
  51. })()
  52. }
  53.