User:Scholar596440/timeless.js: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
if (node.tagName !== "IMG") { |
if (node.tagName !== "IMG") { |
||
style |
style["background-color"] = "#080818"; |
||
} |
} |
||
Revision as of 07:32, 29 June 2021
function list(obj) {
var total = [];
for (var i = 0; i < obj.length; i++) {
total.push(obj[i]);
}
return total;
}
function concatf(a, c) {
return a.concat(c);
}
function children(n) {
return [n].concat(list(n.children).map(children).reduce(concatf, []));
}
function all() {
return children(document.querySelector("body"));
}
function style(node) {
var style = {
"color": "white",
"font-family": "monospace",
};
if (node.tagName !== "IMG") {
style["background-color"] = "#080818";
}
if (node.style["border-color"] === node.style.background && node.tagName !== "button") {
style["border-color"] = style.background;
}
if (node.tagName === "A") {
style.color = "#BBBBFF";
}
if (["mw-site-navigation", "mw-related-navigation", "p-logo-text", "mw-searchButton", "searchButton", "siteSub"].includes(node.id)) {
node.remove();
}
return style;
}
function mod(i) {
for (var key in style(i)) {
i.style[key] = style(i)[key];
}
}
all().forEach(mod);