Color

去除灰色,恢复彩色

  1. // ==UserScript==
  2. // @name Color
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 去除灰色,恢复彩色
  6. // @author Joye-bot
  7. // @license GPL-3.0 License
  8. // @match *://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15.  
  16. // Your code here...
  17. let style = document.createElement("style");
  18. style.innerHTML = "* {filter: none !important;}";
  19. document.head.appendChild(style);
  20.  
  21. let url = window.location.href;
  22.  
  23. // 去百度
  24. function remove_class(name) {
  25. let index = document.getElementsByClassName(name);
  26. for (let i = 0; i < index.length; i++) {
  27. index[i].classList.remove(name);
  28. }
  29. }
  30.  
  31. remove_class('gray');
  32. remove_class('big-event-gray');
  33.  
  34. if (url.match(/https:\/\/www.baidu.com\/$/)) {
  35. document.getElementById("s_lg_img").setAttribute("src", "https://www.baidu.com/img/flexible/logo/pc/index.png");
  36. document.getElementById("s_lg_img_new").setAttribute("src", "https://www.baidu.com/img/flexible/logo/pc/index.png");
  37. document.getElementById("su").style.setProperty("background-color", "#4e6ef2", "important");
  38.  
  39. if (document.getElementsByClassName("index-logo-src").length === 1) {
  40. document.getElementsByClassName("index-logo-src")[0].setAttribute("src", "https://www.baidu.com/img/flexible/logo/pc/result.png");
  41. document.getElementsByClassName("index-logo-peak")[0].setAttribute("src", "https://www.baidu.com/img/flexible/logo/pc/result.png");
  42. document.getElementsByClassName("index-logo-srcnew")[0].setAttribute("src", "https://www.baidu.com/img/flexible/logo/pc/result.png");
  43. }
  44. if (document.getElementById("logo")) {
  45. document.getElementById("logo").getElementsByTagName("a")[0].getElementsByTagName("img")[0].setAttribute("src", "https://www.baidu.com/img/flexible/logo/logo_web.png");
  46. }
  47. }
  48.  
  49. if (url.match(/https:\/\/m.baidu.com\/$/)) {
  50. document.getElementById("logo").getElementsByTagName("a")[0].getElementsByTagName("img")[0].setAttribute("src", "https://www.baidu.com/img/flexible/logo/logo_web.png");
  51. }
  52.  
  53. })();