MyBB Community Forums

Full Version: Spoiler use issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Basically what i was trying to do is be able to put a spoiler directly on my portal page and not in a thread. The purpose of this is to be able to show a livestream on the portal page but have it hidden until a user wants to see it so it doesn't take up the whole page. I have the basic spoiler plugin allowing me to use a spoiler with
[spoiler][/spoiler]
in a post but this will not work directly in the theme

'#\[spoiler\](.*?)\[\/spoiler\]#si','<div><div class="shead">Spoiler: <input type="button" value="Show" onclick="if(this.value == \'Show\'){if(this.parentNode.parentNode.getElementsByTagName(\'div\')[1].innerHTML == \'\'){this.parentNode.parentNode.getElementsByTagName(\'div\')[1].innerHTML = \''.str_replace(chr(10),'\\n',str_replace(chr(13),'\\r',str_replace('\\','\\\\',htmlspecialchars(preg_replace('#(.*?)\[spoiler\](.*?)\[\/spoiler\](.*?)#si','$2',$m))))).'\';this.parentNode.parentNode.getElementsByTagName(\'div\')[1].style.display = \'block\';this.value = \'Hide\';}else{this.parentNode.parentNode.getElementsByTagName(\'div\')[1].style.display = \'block\';this.value = \'Hide\';}}else{this.parentNode.parentNode.getElementsByTagName(\'div\')[1].style.display = \'none\';this.value = \'Show\';}" /></div><div class="sbody" style="display: none;"></div></div>',$m);

When i add this code to the template it produces a spoiler on the portal but there is no way to put the content i want to put inside the spoiler into this code

I am looking to hide the following code in the spoiler
https://download-ssl.xbox.com/content/mgs/liveplayer/production/xblflow/amp-ch1/xblplayer/player.html?content=live1&amp;playerId=XBLMedia

Any help would be greatly appreciated
do you want to use it directly on portal template ? try below code
<div class="shead">Spoiler: <a id="show_id" onclick="document.getElementById('spoiler_id').style.display=''; document.getElementById('show_id').style.display='none';" class="link"><input type="button" value="Show"></input></a><span id="spoiler_id" style="display: none"><a onclick="document.getElementById('spoiler_id').style.display='none'; document.getElementById('show_id').style.display='';" class="link"><input type="button" value="Hide"</input></a><br>https://download-ssl.xbox.com/content/mgs/liveplayer/production/xblflow/amp-ch1/xblplayer/player.html?content=live1&amp;playerId=XBLMedia</span></div>