豆沙绿护眼模式Plus

改网页背景色为豆沙绿

Versão de: 23/02/2023. Veja: a última versão.

// ==UserScript==
// @name         豆沙绿护眼模式Plus
// @version      2.0
// @description  改网页背景色为豆沙绿
// @author       ChatGPT定制
// @run-at       document-start
// @match        *://*/*
// @grant        none
// @namespace https://greasyfork.org/users/452911
// ==/UserScript==

function background() {
let elementList = document.querySelectorAll('*');
for(let i = 0; i< elementList.length; i++){   
  if(!(elementList[i].matches('.swiper-slide') || 
elementList[i].matches('.swiper-slide *') ||
elementList[i].matches('.video *') ||
elementList[i].matches('.tag *'))){
        let srcBgColor = window.getComputedStyle(elementList[i]).backgroundColor;
        let splitArray = srcBgColor.match(/[\d\.]+/g);
        let r = parseInt(splitArray[0], 10),
        g = parseInt(splitArray[1], 10),
        b = parseInt(splitArray[2], 10);
        if(r > 150 && g > 150 && b > 150) {
            elementList[i].style.backgroundColor='#C7EDCC';
        }
    }
}
// 更改链接颜色
let links = document.querySelectorAll("a[href^='http']:not(.button)");
for (let i = 0; i < links.length; i++) {
    links[i].style.color = "#40933C";
    links[i].style.textDecoration = "none";
}
}
background();
window.setTimeout(background,50);
let observer = new MutationObserver(function(mutations) {
window.setTimeout(background,250);
window.setTimeout(background,500);
});
observer.observe(document.body, {
childList: true,
subtree: true
});