Brand New Spoiler Code

New BBCodes, tips and tricks, hacks and MODs for the BBCode system

Re: Brand New Spoiler Code

Postby japankaizen » 05 Jan 2008, 00:26

I am sorry. I don't know much about coding. Where am I suppose to put that code to activate spoiler on my forum?? :blush: :blush:
japankaizen    
Crewman
Crewman
 
Posts: 7
Joined: 04 Jan 2008, 12:07
Gender: Male


Re: Brand New Spoiler Code

Postby stitch626 » 05 Jan 2008, 01:23

japankaizen wrote:I am sorry. I don't know much about coding. Where am I suppose to put that code to activate spoiler on my forum?? :blush: :blush:


Hi there japankaizen,
It's real easy. Just go to your ACP--->Posting and on that very first page you will see a button to the left called "Add a new BBCode" Click it. In the BBcode usage box (top Box) enter the following code.
Code: Select all
[spoiler]{TEXT}[/spoiler]

Then in the "HTML Replacement" box (lower box) enter this code:
Spoiler:
<div style="padding: 3px; background-color: #FFFFFF; border: 1px solid #d8d8d8; font-size: 1em;"><div style="text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; font-weight: bold; display: block;"><span 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.innerHTML = '<b>Spoiler: </b><a href=\'#\' onClick=\'return false;\'>hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Spoiler: </b><a href=\'#\' onClick=\'return false;\'>show</a>'; }" /><b>Spoiler: </b><a href="#" onClick="return false;">show</a></span></div><div class="quotecontent"><div style="display: none;">{TEXT}</div></div></div>


In the help line box you can add a short description for your users so when they hover their mouse over the bbcode button they will get a brief description of what it does.
Then lastly you have the option of showing the button on the posting page.

Good Luck
User avatar
stitch626    
STG Moderator Leader
STG Moderator Leader
 
Posts: 3185
Joined: 08 Feb 2007, 20:47
Location: Michigan
Favorite Team: Detroit Red Wings
Gender: Male
phpBB Knowledge: 7

Re: Brand New Spoiler Code

Postby japankaizen » 06 Jan 2008, 15:14

Thank you very much for your clear explanation. :good: It works perfect.. :yahoo:
japankaizen    
Crewman
Crewman
 
Posts: 7
Joined: 04 Jan 2008, 12:07
Gender: Male

Re: Brand New Spoiler Code

Postby Sithnar » 30 Jan 2008, 04:17

Sniper_E wrote:teenpspjunkie,

Just replace your word "blah" to {TEXT2}
Code: Select all
[spoiler={TEXT2}]{Text}[/spoiler]
And in the HTML Replacement replace the word "Spoiler" to {TEXT2}
Code: Select all
<div style="padding: 3px; background-color: #FFFFFF; border: 1px solid #d8d8d8; font-size: 1em;"><div style="text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; font-weight: bold; display: block;"><span 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.innerHTML = '<b>{TEXT2}: </b><a href=\'#\' onClick=\'return false;\'>hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Spoiler: </b><a href=\'#\' onClick=\'return false;\'>show</a>'; }" /><b>Spoiler: </b><a href="#" onClick="return false;">show</a></span></div><div class="quotecontent"><div style="display: none;">{TEXT}</div></div></div>



Sniper i tried this but it didnt work. i had to change {TEXT} to {TEXT1} to make it work.

just thought you might like to know :)
Sithnar - Head Nerd @ DarkLord's Realm
User avatar
Sithnar    
Supporter
Supporter
 
Posts: 367
Joined: 15 Jan 2008, 10:42
Location: England
Gender: Male
phpBB Knowledge: 5

Re: Brand New Spoiler Code

Postby beggers » 31 Jan 2008, 23:44

Just to throw in my two cents, I prefer a mouseover spoiler because it eliminates any need for clicking. The spoiler section is black until you move your mouse to it, upon which the text appears in white on the black background. Move your mouse away and it disappears again. This is one I converted to phpBB3 from my old forum.

This code has a major advantage in that you can use it on individual words or phrases within a sentence without introducing line breaks, etc. Works on IE and Firefox.

BBCode usage
Code: Select all
[spoiler]{TEXT}[/spoiler]

HTML replacement
Code: Select all
<SPAN style="background-color:#000000;color:#000000" onmouseover="this.style.color='#FFFFFF';" onmouseout="this.style.color=this.style.backgroundColor='#000000'">{TEXT}</span>

Help line
Code: Select all
[spoiler]{TEXT}[/spoiler] hides a section of text until touched by mouse
User avatar
beggers    
Supporter
Supporter
 
Posts: 166
Joined: 25 Jan 2008, 23:46
Favorite Team: Oakland Raiders
Gender: Male
phpBB Knowledge: 4

Re: Brand New Spoiler Code

Postby Sithnar » 01 Feb 2008, 02:30

nice idea! could be a pain if your copying something tho, but i like it :thumbsup:
Sithnar - Head Nerd @ DarkLord's Realm
User avatar
Sithnar    
Supporter
Supporter
 
Posts: 367
Joined: 15 Jan 2008, 10:42
Location: England
Gender: Male
phpBB Knowledge: 5

Re: Brand New Spoiler Code

Postby G Unit » 13 Aug 2008, 11:46

ElbertF wrote:Sorry to hijack your thread, but I perfected your code.. This one uses CSS (and proSilver markup-style) so it adapts to the style and is simpler.

Code: Select all
<dl class="codebox"><dt>Spoiler: <a href="javascript: void(0);" onClick="var spoiler = this.parentNode.parentNode.getElementsByTagName('dd')[0]; if ( spoiler.style.display == 'none' ) { spoiler.style.display = 'block'; this.innerHTML = 'hide'; } else { spoiler.style.display = 'none'; this.innerHTML = 'show'; };">show</a></dt><dd style="display: none;">{TEXT}</dd></dl>


This one is better for me... I have a dark themed board, and the original one shows up as a white box with white text in the spoiler... this one looks just like the code bbcode :D
http://www.pubplayinkillas.com/, a DOD:S and COD4 Team.
G Unit    
Crewman
Crewman
 
Posts: 3
Joined: 01 May 2008, 18:28
Gender: Male

Re: Brand New Spoiler Code

Postby Sniper_E » 13 Aug 2008, 11:51

Yea, when you guys are sprucing this up.... make sure it works in both prosilver and subsilver2.... or I will be looking for you! :club:

I'll try this later to see who I need to find. Image
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: Brand New Spoiler Code

Postby relaxed4u » 15 Sep 2009, 13:28

patrikStar wrote:Example:
http://gfx-pros.com/phpBB3rc1/viewtopic.php?f=3&t=4

BB Usage:
Code: Select all
[spoiler]{TEXT}[/spoiler]





Works perfectly with phpbb ver.3.0.5 CABlack Style !

I create a little modification for my style: change backgroun color, etc...

thank you
User avatar
relaxed4u    
Crewman
Crewman
 
Posts: 8
Joined: 30 Jun 2009, 05:31
Favorite Team: F.C. Barcelona
Gender: Male

Previous

Return to BBCode System

Who is online

Users browsing this forum: No registered users and 6 guests