PDA

View Full Version : Add-On Releases - Custom Title Spoiler Button (Smooth Version)


GamBun
08-06-2010, 10:00 PM
This Mod supports all 3X Versions - 4.2.x Versions!
Due to the demands, I have created a new version of spoilers. The greatest complaint I received HERE (https://vborg.vbsupport.ru/showthread.php?t=207408), was the framing of the actual spoiler. So gone is the "ugly" box! It is really quite easy to remove, but I understand that coding can be confusing/foreign to some people, this is why, I am releasing a clean, "NO BOX" version. I will still support those who want the box, for the 3X version, until the migration of everyone to the 4.X.x is made completely mandatory.

Spoilers may be used as intended, in all Blog posts, forum posts, & published article content (CMS) to hide hints/cheats. I will not support it anywhere else outside of POSTING AREAS.

It's really easy. Just log into the AdminCP=>Custom BBCodes=>Add New BB Code

Then do this:

Title: Spoiler
BB Code Tag Name: Spoiler

Replacement: <div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px; width:852; height:26"><right><font color="red"><b>&nbsp;</b></font></right>
<input type="button" value="Spoiler about {option}" style="font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName(' div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '{option}'; }">
</div>
<div>
<div style="display: none;">
{param}
</div>
</div>
</div>

Example: Hidden Content Here...

Description: Creates a button that hides/shows spoiler messages.

use {option}: Click Yes (Note: some have found they need to set this option to "No" due to personal styling, but in most cases it should be "Yes").

add the path to your "spoiler" icon (feel free to use the icon I added at the bottom of this post.. just right click on it to download it to your computer) The image would go in your forums images/editor directory.

Remove tag if empty: Click "Yes"

...leave the rest at "No"

Click "Save" button & that is it!

The code will then be:

Hidden Content Here...

This also works to nested spoilers as well!

Nested Code Example:

Hidden Content Here...2nd Hidden Nested content Here...


>>LIVE EXAMPLE<< (http://www.g20z.com/showthread.php?5) (You can test there without signing up, if you want to see how it works).

It also works for the CMS suites! >>LIVE EXAMPLE<< (http://www.g20z.com/content.php?116) (Please feel free to post comments & give it a try!)

ENJOY! :D

Please Note: if for any reason this spoiler system breaks when converting from 3X to 4.0 upgrade. Just go to BB Code manager & delete it, go through the process of adding it again, as given above. Doing this will not make you lose any forum content as long as you use the the same code (i.e. if you modified the code I gave you, then you will have to do the same again for it to work as you want). Doing this will force the new version to read the BB code properly.

Juggernaut
08-07-2010, 03:26 AM
Great work man :D

GamBun
08-07-2010, 04:26 PM
Thanks! :)

myarmy
08-20-2010, 04:09 AM
nice one... thanks!

Zombo
08-21-2010, 09:19 AM
does not work on 4.0.6

GamBun
08-23-2010, 04:28 PM
Actually, it does. Where are you having the problem?

Afsoul
08-29-2010, 01:16 PM
This is what I need... Thank you very much :D

angeljs
05-27-2011, 09:15 PM
Exactly what I was looking for and working perfectly, thanks :)

GE-Tom
10-07-2011, 06:19 AM
Work great with 4.1.6. Thanks a lot. Easy to customize. Installed.

I adapted it slightly.

Spoiler close: http://s3.imgimg.de/uploads/customspoilerclose1ab7c7a1jpg.jpg
Spoiler open: http://s3.imgimg.de/uploads/customspoileropen11dea0dajpg.jpg

<div style="margin-top:5px; margin-buttom:5px;">
<div class="smallfont" style="margin-bottom:-1px; width:852; height:26"><right><font color="red"><b>&nbsp;</b></font></right>
<input type="button" value="Spoiler: {option}" style="color: #4E4E4E; background-color: #EAEAEA; border: 1px solid #CECECE; border-radius: 3px 3px 3px 3px; font-size: 11px; font-weight: bold; margin-top: 10px; padding: 5px;" onClick="if (this.parentNode.parentNode.getElementsByTagName(' div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Spoiler: Inhalt verbergen'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Spoiler: {option}'; }">
</div>
<div>
<div style="display: none; background-color: #EAEAEA; border: 1px solid #CECECE; border-radius: 3px 3px 3px 3px; padding: 10px;">
{param}
</div>
</div>
</div>

But i think its better to outsource the css code.

GamBun
10-14-2011, 02:48 PM
Nice GE-Tom! :)

ShackMaster
10-31-2011, 03:11 PM
Doesn't work for me on 4.1.4 ... It does not hide the spoiler... just shows tags.

ShackMaster
10-31-2011, 03:19 PM
If I change Use {option} to "No" it works fine.

MJJUltimate
04-03-2012, 06:45 PM
If I change Use {option} to "No" it works fine.

Same here, I could only get it to work by disabling that option. Now it works fine :)

GamBun
06-20-2012, 10:51 AM
@ ShackMaster & MJJUltimate - This may be from personal styling to your site. In most cases it should be "Yes." I have added this bit of info in case others have the same issues. Enjoy the spoilers. :)

hamdanikcung
02-19-2013, 04:25 AM
doesnot work in mobile ?

GamBun
03-11-2013, 08:26 AM
doesnot work in mobile ?

Not all mobile devices are set up to accept code such as this. I hope it changes down the road though. Sorry.

GamBun
03-11-2013, 08:45 AM
doesnot work in mobile ?

Not all mobile devices are set up to accept code such as this, or perhaps not right away. For example: You may have to check things like if your javavscripting to see if it's up-to-date for whatever browser you are using. Try this to see if it helps. I hope things become more uniform/consistent down the road with devices, but that will likely be a long time from now. So it might really be more the device might not support the code. When I shared this code, I was really meant for full website forums/suites, so that even large things like even videos can be hidden.

WorldCraft
03-12-2013, 02:03 AM
It doesn't work on the mobile theme because the buttons there get an extra div, thus rendering the javascript unable to select the right elements. This would be a relatively easy fix, if only <vb:if>'s were allowed in custom bbcode...

zaimbat
03-13-2013, 09:04 PM
This works great, thank you. Is there a way to make the button appear also in the Quick Reply box? I only see it if I go to the Advanced mode.

GamBun
08-07-2013, 02:25 AM
doesnot work in mobile ?

No. This was originally created for forums and CMS. Some moble devices do not support this spoiler code. Sorry! :rolleyes:

@ zaimbat ~ Your answer is HERE! (https://vborg.vbsupport.ru/showthread.php?t=155068&highlight=Quick+Reply+add+button) or... >>This<< (https://vborg.vbsupport.ru/member.php?u=271420) may also help

smirkley
08-10-2013, 05:34 PM
I like !

Just noticed the spoiler text shows up in the What's New page though.

And search results alt txt.

GamBun
08-10-2013, 08:44 PM
Are you meaning not parsing? or... Usually BB code doesn't show in news feeds at all (i.e. Hidden content might show with missing BB Code). Is that what you mean?
I did a test at my site to show you what I get...
Original Posts Followed by News Feeds:

smirkley
08-10-2013, 11:10 PM
Yes, bbcode doesnt show in feeds. But the hidden content does.

In whats new
In alt text in search results, if in first post.

I realize this is how it works, and I dont think it is really fixable since it is a bbcode hide feature.

smirkley
08-11-2013, 03:40 AM
I think a poster using spoiler tag will just need to make sure they type enough txt above the spoiler so the txt fills the alt txt and whats new txt area, with the bbcode well below.

Like I said, I like this. But if you figure out a solution, I will just like it even more. :)

smirkley
08-17-2013, 06:44 PM
I like this,... is it supposed to popup a javascript prompt when you click an icon?

How can I make it just drop the code and a user can fill in the text areas?

GamBun
08-24-2013, 07:26 PM
I like this,... is it supposed to popup a javascript prompt when you click an icon?

How can I make it just drop the code and a user can fill in the text areas?

You should have a pop up for a title to name your spoiler... i.e. to tell what the spoiler is for (attached screen shot about this). Once that is posted, then you can place inside what you want to hide. Is this what you mean? Also, are you seeing the spoiler button icon? If you click on that, it posts the code for you, you just need to add in the details to make that post personal to the needs of the moment. If you still have problems, send me the details or PM me the details to look at your site to see what is going on.

IggyP
02-13-2014, 11:04 PM
i assume this works for vb5? being simple and all...anyone tried it?

im wondering how hard it would be to put usergroup permissions on a tag like this? like for the button to work and show the txt...

Xen Chaotik
03-10-2014, 05:02 AM
I am not very good with the coding. How could I widen the tag? Any help is appreciated. :)

GamBun
03-27-2014, 04:31 PM
I am not very good with the coding. How could I widen the tag? Any help is appreciated. :)

I'm not sure what you are talking about changing. Could you give me a screen shot? I'll do my best to help.

GamBun
03-27-2014, 04:33 PM
i assume this works for vb5? being simple and all...anyone tried it?

im wondering how hard it would be to put usergroup permissions on a tag like this? like for the button to work and show the txt...
Yes, I do not personally use Version 5, but it is light code so should work fine for your needs. Just please note again that spoilers are not supported for mobile.