屏蔽网页上的图片

屏蔽网页上所有的图片,方便摸鱼

  1. // ==UserScript==
  2. // @name 屏蔽网页上的图片
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description 屏蔽网页上所有的图片,方便摸鱼
  6. // @match *://*/*
  7. // @grant none
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // 创建一个 MutationObserver 实例
  15. const observer = new MutationObserver(function(mutations) {
  16. mutations.forEach(function(mutation) {
  17. // 获取到所有的 img 标签
  18. const images = mutation.target.getElementsByTagName('img');
  19. // 将所有的 img 标签隐藏
  20. for (let i = 0; i < images.length; i++) {
  21. images[i].style.display = 'none';
  22. }
  23. });
  24. });
  25.  
  26. // 开始监听 body 节点,用于处理 js 新加载出来的图片
  27. observer.observe(document.body, { childList: true, subtree: true });
  28. })();

QingJ © 2025

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