User:Ilikecomputers/cosmos.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 6:
document.querySelectorAll('table').forEach(function (e) {
if (e.nextElementSibling && e.nextElementSibling.nodeName === 'UL') {
var sibling = e.nextElementSibling;
if (sibling.childNodes[0].childNodes[0].nodeName === 'UL') {
sibling.childNodes[0].classList.add('nodoublebullet');
}
}
})
document.styleSheets[0].insertRule(".nodoublebullet::marker {content: ''}");
 
//combines the function of the toggle spoiler and spoiler hover gadgets
//hover over spoilers to reveal them, they'll disappear after the cursor leaves the box
//click on spoilers to permanently reveal them, then click on them again to hide them
//also fixes hyperlinks in spoilers visible by default in the cosmos skin
document.querySelectorAll('a').forEach(function (e) { if (e.parentNode.classList.contains('spoiler')) e.style.color = 'white' });
function changeLinksColor(showLink, element) {
document.querySelectorAll('.spoiler').forEach(function (e) {
eelement.childNodes.forEach(function (f) {
e.classList.remove('spoilerhidden'); //this fidgety hack removes the !important colour rule added by the spoilerhidden class
e if (f.style.colornodeName === 'whiteA';) {
f.style.color = showLink ? 'rgb(6, 69, 173)' : 'white';
e.addEventListener('mouseover', function () {
}
e.childNodes.forEach(function (f) {
});
if (f.nodeName === 'A') {
}
f.style.color = 'rgb(6, 69, 173)';
document.querySelectorAll('.spoiler').forEach(function (e) {
}
e.classList.remove('spoilerhidden'); //this fidgety hack removes the !important colour rule added by the spoilerhidden class
});
e.style.color = 'blackwhite';
e.addEventListener('mouseover', function () {
});
changeLinksColor(true, e);
e.addEventListener('mouseout', function () {
e.style.color = 'whiteblack';
});
e.childNodes.forEach(function (f) {
e.addEventListener('mouseout', function () {
if (f.nodeName === 'A') {
fe.style.color = 'white';
if (!e.classList.contains('spoilerRevealed')) {
}
} changeLinksColor(false, e);
})
})
e.addEventListener('click', function () {
if (e.classList.contains('spoilerRevealed')) {
if (e.classList.removecontains('spoilerRevealed');) {
e.classList.addremove('spoilerRevealed');
} else {
e.classList.add('spoilerRevealed');
e.classList.add('spoilerRevealed');
}
})
})
})
document.styleSheets[0].insertRule(".spoilerRevealed {color: black !important}");
document.styleSheets[0].insertRule(".spoilerspoilerRevealed {cursorcolor: pointerblack !important}");
document.styleSheets[0].insertRule(".spoilerRevealedspoiler {colorcursor: black !importantpointer}");