User:Tierrie/global.js

var showspoilers = true;

var hasClass = (function { var reCache = {}; return function (element, className) { return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); }; });

function showSpoilers { var Divs= document.getElementsByTagName("div"); for (i=0;i<Divs.length;i++) { if (hasClass(Divs[i], "splrico")) { Divs[i].childNodes[0].childNodes[1].style.display = "none"; Divs[i].nextSibling.style.display = "block"; } }  document.cookie="showspoilers=1"; }

function hideSpoilers { var Divs= document.getElementsByTagName("div"); for (i=0;i<Divs.length;i++) { if (hasClass(Divs[i], "splrico")) { Divs[i].childNodes[0].childNodes[1].style.display = "block"; Divs[i].nextSibling.style.display = "none"; } }  document.cookie="showspoilers=0"; }

function toggleSpoilers { showspoilers = !showspoilers; if(showspoilers) showSpoilers; else hideSpoilers; } function initSpoilers { var Divs= document.getElementsByTagName("div"); for (i=0;i-1&&document.cookie.charAt(cookiePos+13)==1){ showspoilers=1; showSpoilers; } else { showspoilers=0; hideSpoilers; } }

var spoilers = true; function loadSpoilers { if(spoilers) initSpoilers; }

addOnloadHook(loadSpoilers);