知乎过滤盐选广告

过滤知乎首页盐选广告

  1. // ==UserScript==
  2. // @name 知乎过滤盐选广告
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 过滤知乎首页盐选广告
  6. // @author azuremistake
  7. // @match https://www.zhihu.com/
  8. // @icon https://www.google.com/s2/favicons?domain=zhihu.com
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function filter() {
  17. let cards = document.querySelectorAll('div.Card.TopstoryItem.TopstoryItem-isRecommend');
  18.  
  19. cards.forEach((card) => {
  20. let text = card.innerText;
  21. if (text.includes('本回答节选自盐选专栏') ||
  22. text.includes('本内容版权为知乎及版权方所有')) {
  23. card.style.display = 'none';
  24. }
  25. });
  26. }
  27.  
  28. filter();
  29.  
  30. let observer = new MutationObserver(filter);
  31. observer.observe(document.body, {
  32. childList: true,
  33. subtree: true
  34. });
  35.  
  36. })();

QingJ © 2025

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