MyBB Community Forums

Full Version: No spoilers seem to work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
I was originally using the 'advanced secure spoiler' mod plugin and it was working fine, until one day it stopped working for some unknown reason. I thought it was a problem with the plugin, so I tried various other similar ones, but none of them worked either. The problem is that they just won't open.

Here is a link to a thread on my site, where a test spoiler is used: http://stanbase.com/showthread.php?tid=7...2#pid27072

When you click 'show', nothing happens. Undecided I'm beginning to think I've accidently deleted some of the script/code somewhere along the line? I'm clueless as to what's gone wrong here.

I would appreciate any help. Thanks Toungue
You don't have to use a plugin just go to ACP > Configuration > MyCode
then press add new MyCode. For the title put Spoiler and for regular expression put this code
\[spoiler\](.*?)\[/spoiler\]
and for the replacement put this code
<div style="margin:20px; margin-top:5px"><div class="quotetitle"><b>Spoiler:</b> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" /></div><div class="quotecontent"><div style="display: none;">$1</div></div></div>
Done that, but it still doesn't open when you click 'show' Undecided
The code works... it shows the spoiler... but they just wont open to show the content inside them in posts. This is a real problem now, does anyone have any more clues... Undecided
It DOES work, I use it. It's just not working for you, so let's investigate why it's not working for you.

1 Did you edit your .quotecontent or .quotetitle classes or the general div element in your CSS?
2 Are you SURE that your javascript is turned on ?
3 Create a topic on your forum that uses the spoiler
4 Link us to that topic
Is javascript enabled on your browser?
Try with different browsers.
(2012-04-18, 09:41 PM)xexes255 Wrote: [ -> ]It DOES work, I use it. It's just not working for you, so let's investigate why it's not working for you.

1 Did you edit your .quotecontent or .quotetitle classes or the general div element in your CSS?
2 Are you SURE that your javascript is turned on ?
3 Create a topic on your forum that uses the spoiler
4 Link us to that topic

1. A few times.
2. Yep. It's not just me, it's all the users on the site.
3. http://stanbase.com/showthread.php?tid=7...2#pid26802

Doesn't work in Chrome or IE. It's not the browser. I'm sure it's in the CSS somewhere along the line that doesn't let the Javascript work properly?
I am having a similar problem - it is happening on the MYBB default theme as well as my site theme.

However - it is NOT happening on my localhost or my other test site on the same server. This makes me think there is a plugin conflict, but I am not sure where or what. I cannot "just disable plugins" as then my site will stop working and I will not be able to view the pages to see if the spoiler tag works as a mycode.

I am on mybb 1.6.7

This is the function from my plugin file:

function spoiler_run($message)
{
	// Assign pattern and replace values.
	$pattern = array("#\[spoiler=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/spoiler\](\r\n?|\n?)#si", "#\[spoiler\](.*?)\[\/spoiler\](\r\n?|\n?)#si");

	$replace = array("<div><div class=\"spoiler_header\">$1 <a href=\"javascript:void(0);\" onclick=\"javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='(Click to View)';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='(Click to Hide)';}\">(Click to View)</a></div><div class=\"spoiler_body\" style=\"display: none;\">$2</div></div>", "<div><div class=\"spoiler_header\">Spoiler <a href=\"javascript:void(0);\" onclick=\"javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='(Click to View)';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='(Click to Hide)';}\">(Click to View)</a></div><div class=\"spoiler_body\" style=\"display: none;\">$1</div></div>");

	while(preg_match($pattern[0], $message) or preg_match($pattern[1], $message))
	{
		$message = preg_replace($pattern, $replace, $message);
	}
	$find = array(
		"#<div class=\"spoiler_body\">(\r\n?|\n?)#",
		"#(\r\n?|\n?)</div>#"
	);

	$replace = array(
		"<div class=\"spoiler_body\">",
		"</div>"
	);
	$message = preg_replace($find, $replace, $message);
	return $message;
}
Even when I don't use a plugin, the spoilers still do not open. That's what's confusing me.

As LeeFish also said, I don't think it's the server and disabling the plugin won't solve anything.
Pages: 1 2 3 4