Post by Todge on Apr 19, 2011 10:48:55 GMT -8
This will give you 'inline' spoilers, that is, the spoiler will be a part of the text itself.
Put it in Global Footer..
Edit the CSS at the top of the code to change the colors and styles of the spoilers.
Put it in Global Footer..
<style type="text/css">
<!--
.spoiler { color: black; font-weight: bold; cursor: pointer; }
.hidden { display: none; color: blue; }
-->
</style>
<script type="text/javascript">
<!--
/*
Inline Spoiler tags by Todge
Copyright © 2011
Please keep this header intact
Global or Board Footer
*/
var spButton = 'http://images.proboards.com/new/shocked.gif';
// Add spoiler button to posting page..
function addspoil()
{
var bname = prompt("what would you like the spoiler to be called?","Spoiler");
add('[spoiler='+bname+']','[/spoiler]');
return;
}
if(document.postForm)
{
var spb = document.createElement('a');
spb.innerHTML = '<img src="'+spButton+'" border="0">';
spb.href = 'javascript:addspoil()';
document.postForm.color.parentNode.appendChild(spb);
}
// Find and create spoilers..
if(pb_action.match(/(display|preview|(modify)?post|search2)/) )
{
var posts = document.getElementsByTagName('font');
for(p=0; p<posts.length; p++)
{
if(posts[p].innerHTML.match(/google_ad_section_start/) || (posts[p].size == '1' && pb_action.match(/preview|(modify)?post/)))
{
if(document.postForm)
{
var qPost = document.postForm.message.value;
}
var spCell = '<font class="spoiler" onclick="this.style.display=\'none\'; this.nextSibling.style.display=\'inline\';">[$1]</font>';
spCell += '<font class="hidden"><font style="cursor: pointer" onclick="this.parentNode.style.display=\'none\';';
spCell += ' this.parentNode.previousSibling.style.display=\'inline\';">*</font>';
posts[p].innerHTML = posts[p].innerHTML.replace(/\[spoiler=(([^\[\]])+)*\]/g,spCell).replace(/\[\/spoiler\]/g,'</font></font>');
if(document.postForm)
{
document.postForm.message.value = qPost;
}
}}}
// -->
</script>
Edit the CSS at the top of the code to change the colors and styles of the spoilers.