SMF For Free Support Forum
Signup For Free Forum
November 20, 2008, 06:49:55 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: [Code] Spoiler Tag  (Read 1697 times)
0 Members and 1 Guest are viewing this topic.
Agent Moose
Moderator
*****
Offline Offline

Posts: 666


Do not PM me for Code Support or Request


View Profile
« on: January 03, 2008, 05:11:23 pm »

Add this to your headers:
Code:
<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:
<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.  Smiley

Preview: http://codepreview.smfforfree3.com/index.php/topic,3.0.html
« Last Edit: January 08, 2008, 02:35:37 pm by Agent Moose » Logged



SMC Code Index - The best Code Index for all your Needs!  Includes a bunch of codes not on Support.[/cen
clown
SMF For Free Newbie
*
Offline Offline

Posts: 8


View Profile
« Reply #1 on: January 07, 2008, 08:46:32 pm »

Forum Url: http://http://califarapnetrefugees.sm.smfforfree4.com
it wont work for my forum Sad
« Last Edit: January 12, 2008, 03:13:45 pm by clown » Logged
Coreeeey
SMF For Free Sr. Member
*
Offline Offline

Posts: 311



View Profile WWW
« Reply #2 on: January 07, 2008, 09:00:33 pm »

Add this to your headers:
Code:
<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 » Logged

TheWarzone1
SMF For Free Full Member
*
Offline Offline

Posts: 110


View Profile
« 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.
Logged

Smackdown! vs RAW 2008 CAW forum...
http://cawsrus.smfforfree4.com/index.php
Phoebe Jordan
SMF For Free Member
*
Offline Offline

Posts: 42


View Profile WWW
« 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:
<script src='http://romancereadersandwritersf.smfforfree4.com/jquery.js'></script>

Footer
Code:
<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?
Logged

3lf-ครรครรเภ
SMF For Free Full Member
*
Offline Offline

Posts: 108



View Profile
« Reply #5 on: June 13, 2008, 03:31:42 pm »

would it be possible to use the current jQuery for this code?
Logged

WoW-Guy
SMF For Free Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #6 on: July 04, 2008, 03:16:53 pm »

Ti work... Werry,Werry good Grin
Logged
Jitoa
SMF For Free Newbie
*
Offline Offline

Posts: 13



View Profile
« Reply #7 on: July 05, 2008, 07:55:44 pm »

Wont work for me either.
Logged


Pages: [1]
  Print  
 
Jump to:  

cheap low cost web hosting reviews

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 0.237 seconds with 17 queries.