Jump to content

User:Ilikecomputers/common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 16:
document.styleSheets[0].insertRule(".nodoublebullet::marker {content: ''}");
 
/* SPOILER ENHANCER SUITE
//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
//clickhover onover spoilers to permanently reveal them, thenthey'll clickdisappear onafter themthe againcursor toleaves hidethe thembox
click on spoilers to permanently reveal them, then click on them again to hide them
//also adds a custom "Show all spoilers" button (only tested on vector 2022)
 
//also fixes hyperlinks in spoilers visible by default in the cosmos skin
//also adds a custom "Show all spoilers" button (only tested on vector 2022)
allows you to toggle all spoilers with Ctrl + Shift + S
//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) { // deals with hyperlinks inside spoilers
element.childNodes.forEach(function (f) {
if (f.nodeName === 'A') {
Line 42 ⟶ 46:
toggleSpoilers.textContent = spoilersRevealed ? "Hide all spoilers" : "Show all spoilers";
}
//allows toggling of spoilers with Ctrl + Shift + S
document.body.addEventListener('keydown', function (e) {
if (e.shiftKey && e.ctrlKey && e.key === 'S') {
toggleAllSpoilers();
}
});
//the "show all spoilers" button, and elements needed to make it fit into the vector 2022 skin
var toggleSpoilers = document.createElement('a');
toggleSpoilers.textContent = "Show all spoilers";
Cookies help us deliver our services. By using our services, you agree to our use of cookies.