User:Scholar596440/timeless.js: Difference between revisions
Appearance
Content deleted Content added
No edit summary Tag: Reverted |
No edit summary |
||
(12 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
return [n].concat(list(n.children).map(children).reduce(concatf, [])); |
return [n].concat(list(n.children).map(children).reduce(concatf, [])); |
||
} |
} |
||
function all() { |
|||
return children(document.querySelector("body")); |
|||
⚫ | |||
function style(node) { |
function style(node) { |
||
var style = { |
var style = { |
||
backgroundColor: '#101018', |
|||
"background": /*"#080818"*/"white", |
|||
fontSize: 'calc(1.02*' + window.getComputedStyle(node).fontSize + ')', |
|||
color: 'white', |
|||
fontFamily: 'monospace', |
|||
}; |
}; |
||
if (node.style[ |
if (node.style['border-color'] === node.style.background && node.tagName !== 'button') { |
||
style[ |
style['border-color'] = style.background; |
||
} |
} |
||
if (node.tagName === |
if (node.tagName === 'A') { |
||
style.color = |
style.color = '#BBBBFF'; |
||
} |
} |
||
if ([ |
if (['mw-site-navigation', 'mw-related-navigation', 'p-logo-text', 'mw-searchButton', 'searchButton', 'siteSub', 'content-bottom-stuff', 'mw-footer-container'].includes(node.id)) { |
||
node.remove(); |
node.remove(); |
||
⚫ | |||
if (node.id === 'mw-content') { |
|||
style['margin-left'] = 0; |
|||
} |
} |
||
Line 48: | Line 48: | ||
} |
} |
||
Array.from(document.querySelectorAll('*')).forEach(mod); |
Latest revision as of 04:09, 11 May 2023
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 style(node) {
var style = {
backgroundColor: '#101018',
fontSize: 'calc(1.02*' + window.getComputedStyle(node).fontSize + ')',
color: 'white',
fontFamily: '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', 'siteSub', 'content-bottom-stuff', 'mw-footer-container'].includes(node.id)) {
node.remove();
}
if (node.id === 'mw-content') {
style['margin-left'] = 0;
}
return style;
}
function mod(i) {
for (var key in style(i)) {
i.style[key] = style(i)[key];
}
}
Array.from(document.querySelectorAll('*')).forEach(mod);