Advertise Here

Author Topic: [Code] Spoiler Tag  (Read 11327 times)

0 Members and 1 Guest are viewing this topic.

Offline Agent Moose

  • Moderator
  • *****
  • Posts: 836
  • Do not PM me for Code Support or Request
    • View Profile

  • Total Badges: 32
    Badges: (View All)
    Search Level 6 Tenth year Anniversary Nineth year Anniversary Eighth year Anniversary
[Code] Spoiler Tag
« on: January 03, 2008, 05:11:23 pm »
Add this to your headers:
Code: [Select]
<script src='http://FORUM_URL.smfforfreeX.com/jquery.js'></script>Where FORUM_URL, replace with your own forum URL.
Where X, replace with your server number.

Footers
Code: [Select]
<script>
b = document.getElementsByTagName("div");
for(x=0;x<b.length;x++){
if(b[x].className=="post" && b[x].innerHTML.match(/\[spoiler\](.*)\[\/spoiler\]/i)){
b[x].innerHTML = b[x].innerHTML.replace("[spoiler]"+RegExp.$1+"[/spoiler]","<div><div><a href='javascript:void(0)' onclick='$(this).parent().next().toggle()'>(Click to Show/Hide Spoiler)</a></div><div style='display:none' id='spoiler'>"+RegExp.$1+"</div></div>");
};};
</script>

Just place [spoiler]YOUR TEXT HERE[/spoiler] to create the spoiler.  :)

Preview: http://codepreview.smfforfree3.com/index.php/topic,3.0.html
« Last Edit: January 08, 2008, 02:35:37 pm by Agent Moose »
Check out Revolution X's Brand new Code Index!

Offline clown

  • SMF For Free Newbie
  • *
  • Posts: 8
    • View Profile

  • Total Badges: 9
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 First Post
Re: [Code] Spoiler Tag
« Reply #1 on: January 07, 2008, 08:46:32 pm »
Forum Url: http://http://califarapnetrefugees.sm.smfforfree4.com
it wont work for my forum :(
« Last Edit: January 12, 2008, 03:13:45 pm by clown »

Offline Coreeeey

  • SMF For Free Sr. Member
  • *
  • Posts: 307
    • View Profile
    • Forum Evolve

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Spoiler Tag
« Reply #2 on: January 07, 2008, 09:00:33 pm »
Add this to your headers:
Code: [Select]
<script src='http://FORUM_URL.smfforfreeX.com/jquery.js'></script>
Where FORUM_URL, replace with your own forum URL.
Where X, replace with your server number.

Was doing some testing and realized that the header code needs to be there. Agent Moose might want to add that.
« Last Edit: January 07, 2008, 09:04:08 pm by Coreeeey »

Offline TheWarzone1

  • SMF For Free Full Member
  • *
  • Posts: 129
    • View Profile

  • Total Badges: 25
    Badges: (View All)
    Nineth year Anniversary Eighth year Anniversary Linux User Mobile User Level 5
Re: [Code] Spoiler Tag
« Reply #3 on: April 10, 2008, 02:00:58 pm »
i have a question...
is there a way to modify this code so i can have 2 spoilers in a single post. i tried it with this one but it puts them both together.

Offline Phoebe Jordan

  • SMF For Free Member
  • *
  • Posts: 42
    • View Profile
    • Romance Readers & Writers Forum

  • Total Badges: 12
    Badges: (View All)
    Apple User Topic Starter Combination Level 2 Level 1
Re: [Code] Spoiler Tag
« Reply #4 on: April 16, 2008, 09:45:08 pm »
Forum Url: http://romancereadersandwritersf.smfforfree4.com
It won't work for me either. Here is what I put:

Header
Code: [Select]
<script src='http://romancereadersandwritersf.smfforfree4.com/jquery.js'></script>
Footer
Code: [Select]
<script>
b = document.getElementsByTagName("div");
for(x=0;x<b.length;x++){
if(b[x].className=="post" && b[x].innerHTML.match(/\[spoiler\](.*)\[\/spoiler\]/i)){
b[x].innerHTML = b[x].innerHTML.replace("[spoiler]"+RegExp.$1+"[/spoiler]","<div><div><a href='javascript:void(0)' onclick='$(this).parent().next().toggle()'>(Click to Show/Hide Spoiler)</a></div><div style='display:none' id='spoiler'>"+RegExp.$1+"</div></div>");
};};
</script>

I have other codes in the header and the footer. Is that what may have caused the spolier tag not to work?

Offline 3lf-ครรครรเภ

  • SMF For Free Full Member
  • *
  • Posts: 106
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Spoiler Tag
« Reply #5 on: June 13, 2008, 03:31:42 pm »
would it be possible to use the current jQuery for this code?

Offline WoW-Guy

  • SMF For Free Newbie
  • *
  • Posts: 2
    • View Profile

  • Total Badges: 8
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 First Post
Re: [Code] Spoiler Tag
« Reply #6 on: July 04, 2008, 03:16:53 pm »
Ti work... Werry,Werry good ;D

Offline Lolsant

  • SMF For Free Newbie
  • *
  • Posts: 5
    • View Profile

  • Total Badges: 8
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 First Post
Re: [Code] Spoiler Tag
« Reply #7 on: March 09, 2009, 02:09:20 pm »
It dosent work with severall Spoilers. Please fix?

Example :
[spoiler]Going To Work[/spoiler]
[spoiler]OMG.. I forgot my watch..[/spoiler]



It only takes the first [spoiler] and last [/spoiler].

It shows up with :
Going To Work[/spoiler]
[spoiler]OMG.. I forgot my watch..[/spoiler]
.


Please, somehow.. Try to FIX?  :buck2:
I need it :coolsmiley:


-Lolsant

Offline Agent Moose

  • Moderator
  • *****
  • Posts: 836
  • Do not PM me for Code Support or Request
    • View Profile

  • Total Badges: 32
    Badges: (View All)
    Search Level 6 Tenth year Anniversary Nineth year Anniversary Eighth year Anniversary
Re: [Code] Spoiler Tag
« Reply #8 on: March 09, 2009, 04:59:10 pm »
I have tried to fix this before, and I never could.

Sorry.
Check out Revolution X's Brand new Code Index!

Offline thebeastown

  • SMF For Free Member
  • *
  • Posts: 65
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Spoiler Tag
« Reply #9 on: March 10, 2009, 10:55:35 am »
for what you use?  :-\

Offline jm112366

  • SMF For Free Newbie
  • *
  • Posts: 15
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Search Apple User Topic Starter Combination Level 2
Re: [Code] Spoiler Tag
« Reply #10 on: December 06, 2010, 11:16:00 am »
how do i no what my server number is?

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [Code] Spoiler Tag
« Reply #11 on: December 06, 2010, 03:02:28 pm »
Your URL would be this:

yoursite.smfforfree#.com

the # is your server number ;)
<--- Donate to SMF For Free! :D

Offline jm112366

  • SMF For Free Newbie
  • *
  • Posts: 15
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Search Apple User Topic Starter Combination Level 2
Re: [Code] Spoiler Tag
« Reply #12 on: December 07, 2010, 10:10:08 am »
oh i gotcha. thanks!

Offline Hakam J.

  • SMF For Free Member
  • *
  • Posts: 56
    • View Profile
    • The Gaming World

  • Total Badges: 9
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 50 Posts
Re: [Code] Spoiler Tag
« Reply #13 on: December 29, 2010, 08:23:25 am »
Oh yes.   Just in-case no one wont understand the "X" for the server number, if your using SMFForFree (1), then remove the X!  But for 2, 3, and 4, you may want to replace the X with your SMF For Free server number.

Hakam J.,
« Last Edit: December 31, 2010, 11:59:31 pm by Hakam J. »

Offline bird

  • SMF For Free Full Member
  • *
  • Posts: 131
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Fourth year Anniversary 100 Posts Third year Anniversary Level 3 50 Posts
Re: [Code] Spoiler Tag
« Reply #14 on: October 04, 2012, 07:37:23 am »
is this working as Tag Cloud?

 

Related Topics

  Subject / Started by Replies Last post
21 Replies
7075 Views
Last post August 28, 2007, 09:49:44 pm
by simply sibyl