网页变黑白

把网页变成黑白色

  1. // ==UserScript==
  2. // @name 网页变黑白
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description 把网页变成黑白色
  6. // @author luzhiyuan
  7. // @match *://*.jd.com/*
  8. // @match *://*.taobao.com/*
  9. // @match *://*.tmall.com/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. addNewStyle("*{-webkit-filter: grayscale(100%)}")
  15. })();
  16.  
  17. function addNewStyle(newStyle) {
  18. console.log("👴 add new style:", newStyle)
  19. var styleElement = document.getElementById('styles_js');
  20.  
  21. if (!styleElement) {
  22. styleElement = document.createElement('style');
  23. styleElement.type = 'text/css';
  24. styleElement.id = 'styles_js';
  25. document.getElementsByTagName('head')[0].appendChild(styleElement);
  26. }
  27.  
  28. styleElement.appendChild(document.createTextNode(newStyle));
  29. }

QingJ © 2025

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