FANDOM


/**/

/*
*/
var toggle = {};
toggle["generic"] = 'spoiler';
toggle["clue"] = 'clue';
toggle["quest"] = 'reward';
function showSpoiler(link)
{
var spoilerContainer = link.parentNode.parentNode;
var spoiler = getSpoiler(spoilerContainer);
if(spoiler != null)
{
var toggleButton = getToggle(spoilerContainer);
var buttonType = "generic";
if (toggleButton.className.indexOf("clue") != -1)
{
buttonType = "clue";
}
else if(toggleButton.className.indexOf("quest") != -1)
{
buttonType = "quest";
}
if(spoiler.style.display == "none")
{
spoiler.style.display = "inline-block";
toggleButton.innerHTML = '[hide ' +toggle[buttonType]+']';
}
else
{
spoiler.style.display = "none";
toggleButton.innerHTML = '[show ' +toggle[buttonType]+']';
}
}
}
 
function getSpoiler(container)
{
var spoilerDivs = container.getElementsByTagName("div");
for (var divIndex in spoilerDivs)
{
if(spoilerDivs[divIndex].className == "spoiler")
{
return spoilerDivs[divIndex];
}
}
return null;
}
 
function getToggle(container)
{
var spoilerDivs = container.getElementsByTagName("div");
for (var divIndex in spoilerDivs)
{
if(spoilerDivs[divIndex].className.indexOf("spoilerToggle") != -1)
{
return spoilerDivs[divIndex];
}
}
return null;
}
 
function linkSpoilers()
{
var divs = document.getElementsByTagName("div");
for (var ndx in divs)
{
if(divs[ndx].className.indexOf("spoilerToggle") != -1)
{
divs[ndx].setAttribute("onclick", "showSpoiler(this);");
}
}
}
addOnloadHook(linkSpoilers);
/*
*/