geke hand
E Z B O A R D
Spoiler Tag

<< updated: 5/6/2003

Summary: Script which provides your board's users with a "spoiler tag".

Details:

By adapting an existing ezCode via javascript, we can create the much-needed "spoiler tag".

To make a spoiler tag, creat a new link to http://spoiler with the LINK ezCode:

[link=spoiler]This is my spoiler[/link]

The script provided will look for those spoiler links and transform them into a "show spoilers" link and a hidden block of text.

HEAD: (box #1)

<style type="text/css">
div.spoiler { display: none; }
a.spoiler { text-decoration: underline; }
</style>

HEAD Notes:

This controls what the spoiler tag looks like ... div.spoiler should always have "display: none" in it but could also have text formatting, borders, etc... which will not show up until you click "show spoilers". a.spoiler controls how the "show spoilers" link itself looks.

FOOTER: (box #4)

<script type="text/javascript">
/* SPOILER TAG */
for ( sl=0; sl < document.links.length; sl++ ) {
if ( document.links[sl].href == "http://spoiler" || document.links[sl].href == "http://spoiler/" ) {
oSpoiler = document.createElement("div");
oSpoiler.id = "spoiler" + sl;
oSpoiler.className = "spoiler";
oSpoiler.innerHTML = document.links[sl].innerHTML;
oShowSpoiler = document.createElement("a");
oShowSpoiler.className = "spoiler";
oShowSpoiler.innerHTML = "show spoiler";
oShowSpoiler.href="javascript:void(document.getElementById('spoiler" + sl + "').style.display='block')";
document.links[sl].parentNode.insertBefore(oSpoiler, document.links[sl]);
oSpoiler.parentNode.removeChild(document.links[sl]);
oSpoiler.parentNode.insertBefore(oShowSpoiler, oSpoiler);
}
}
/* END SPOILER TAG */
</script>

History:

5/6/2003 - first version

Credits:

phalen180

E Z B O A R D

design by G E K E . N E T
best viewed in 1024x768 screen resolution using a standards compliant browser
logo based on a public domain drawing of a hand making the sign of the cross, no disrespect is intended
all other contents and code copyright © 2002-2005 jonathan cook

Valid HTML 4.01! Valid CSS!