修改超链接等白色标签显示问题
食用方式: 自己建立一个新脚本
// ==UserScript==
// @name 视觉模式--衬线字体和纸墨模式
// @name:zh-CN 视觉模式--衬线字体和纸墨模式
// @name:en EyesCareMode
// @version 0.1
// @description 视觉--衬线字体和纸墨模式
// @description:en Easy EyesCare Mode, Reduce luminance for 10%
// @author RunningCheese
// @namespace https://www.runningcheese.com
// @license MIT
// @match *://*/*
// @icon data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"%3E%3Cpath fill="currentColor" d="M12 21q-1.65 0-2.825-1.175Q8 18.65 8 17H5q-.825 0-1.413-.587Q3 15.825 3 15q0-3.5 2.3-6.037Q7.6 6.425 11 6.05V3h2v3.05q3.4.375 5.7 2.913Q21 11.5 21 15q0 .825-.587 1.413Q19.825 17 19 17h-3q0 1.65-1.175 2.825Q13.65 21 12 21Zm-7-6h14q0-2.9-2.05-4.95Q14.9 8 12 8q-2.9 0-4.95 2.05Q5 12.1 5 15Zm7 4q.825 0 1.413-.587Q14 17.825 14 17h-4q0 .825.588 1.413Q11.175 19 12 19Zm0-2Z"%2F%3E%3C%2Fsvg%3E
// ==/UserScript==
(function() {
var i, c, color,aNum;
var s = (document.getElementsByTagName('head')[0] || document.body).appendChild(document.createElement('style'));
var t = document.createTextNode('p, div, font, blockquote { font-family: "PT Serif", Georgia, serif !important; }');
s.appendChild(t);
aNum = document.querySelectorAll('*') //获取所有类型的标签
for(i = 0;i<aNum.length;i++){
c = window.getComputedStyle(aNum,null);
c=c.color.replace(/\s*/g,""); // 去除空格
if(c=='rgb(255,255,255)'||c=='#fff'||c=='white'){
aNum.style.color = '#000'
}
}
})();
(function() {
function getRGBColor(node, prop) {
var rgb = getComputedStyle(node, null).getPropertyValue(prop);
var r, g, b;
if (/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)) {
r = parseInt(RegExp.$1, 10);
g = parseInt(RegExp.$2, 10);
b = parseInt(RegExp.$3, 10);
return [r / 255, g / 255, b / 255];
}
return rgb;
}
R(document.documentElement);
function R(n) {
var i, x, color,aNum,c,sNum;
if (n.nodeType == Node.ELEMENT_NODE && n.tagName.toLowerCase() != 'input' && n.tagName.toLowerCase() != 'select' && n.tagName.toLowerCase != 'textarea') {
for (i = 0; x = n.childNodes; ++i) R(x);
color = getRGBColor(n, 'background-color');
if ((typeof(color) != 'string' && color[0] + color[1] + color[2] >= 1) || (n == document.documentElement && color == 'transparent')) {
n.style.backgroundColor = '#EDEBE8';
n.style.setProperty('background-color', '#EDEBE8', 'important');
}
}
}
})(); |