Jump to content

User:Scholar596440/timeless.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Scholar596440 (talk | contribs) at 07:01, 19 June 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
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 = {
		"background": "#080818",
		"color": "white",
		"font-family": "monospace",
	};
	
	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"].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);