Greasy Fork 还支持 简体中文。

Filter remover

用于去除网页灰色滤镜

  1. // ==UserScript==
  2. // @name Filter remover
  3. // @version 1.13
  4. // @namespace filter.404
  5. // @license GNU General Public License v3.0
  6. // @description 用于去除网页灰色滤镜
  7. // @author eduarte
  8. // @match http://*/*
  9. // @match https://*/*
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. //
  14. // 没有真相的致哀是对牺牲者的亵渎
  15. // 一个阻止人们自发纪念活动的政府,更没有资格搞什么「公祭日」
  16. // 我们需要这种带着反思的具体的悼念,希望将来某天,除了反思,还有追责
  17. //
  18.  
  19. (function() {
  20. 'use strict';
  21. let style = document.createElement('style');
  22. style.innerHTML = "*, html, body{filter: none !important; -webkit-filter: none !important; -moz-filter: none !important; background-blend-mode: normal !important}";
  23. document.body.appendChild(style);
  24. let imgs = document.getElementsByTagName("img")
  25. for (let index in imgs) {
  26. if (imgs[index].getAttribute) {
  27. if (imgs[index].getAttribute("src") !== null) {
  28. imgs[index].setAttribute("src", imgs[index].getAttribute("src").replace("_gray", ""));
  29. }
  30. if (imgs[index].getAttribute("data-src") !== null) {
  31. imgs[index].setAttribute("data-src", imgs[index].getAttribute("data-src").replace("_gray", ""));
  32. }
  33. }
  34. }
  35. const removeFilter = () => {
  36. document.documentElement.style.setProperty('filter', 'none', 'important');
  37. document.body.style.setProperty('filter', 'none', 'important');
  38. // weibo
  39. let elems = document.querySelectorAll("[class*='gray']")
  40. for (let index in elems) {
  41. if (elems[index].getAttribute) {
  42. let classVal = elems[index].getAttribute("class");
  43. elems[index].setAttribute("class", classVal.replace("gray", ""));
  44. }
  45. }
  46. }
  47. let patience = 20;
  48. let interval;
  49. window.onload = () => {
  50. interval = setInterval(() => {
  51. if (document.querySelectorAll("[class*='gray']").length > 0) {
  52. removeFilter();
  53. patience = 20
  54. };
  55. patience--;
  56. if (patience === 0) clearInterval(interval);
  57. }, 100);
  58. }
  59. })();