March 28, 2024, 09:06:43 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to Revolution X, where Coding meets Graphics.
 
  Home Help Search Arcade Affiliates Staff List Calendar Members Login Register  

Spoiler Tag "V3"

Pages: [1]   Go Down
  Print  
Author Topic: Spoiler Tag "V3"  (Read 652 times)
0 Members and 1 Guest are viewing this topic.
Exilis
Optimistic & Creative
Global Moderator
Global Moderator
Offline Offline

Posts: 929


View Profile
Badges: (View All)
Tenth year Anniversary Linux User Combination
« on: September 12, 2009, 04:59:47 pm »

This spoiler tag is like the others, for a more in-depth explanation go to one of those. I just quickly modded it because it was requested by Andrew.
Basically, this code is much like V2- in V2, the user would type in
[spoiler=Hello]Secret[/spoiler]
and it would show the text "Hello" as a link, and when clicked would reveal the text "Secret".

In V3, the code above ([spoiler=Hello]Secret[/spoiler]) would show the text "(show)" as a link, and under it would be "Hello" in italics, when (show) was clicked on it would reveal "Secret".

I hope you get where I'm going with this;
Preview is here.

Code:
<script>
var b = document.getElementsByTagName("div");
//Created by Agent Moose (smcodes.smfforfree3.com)
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 + "]" + RegExp.$2 + "[/spoiler]","<div><div><a href='javascript:void(0)' onclick='$(this).parent().next().toggle()'>(show)<br /></a><i>" + RegExp.$1 + "</i></div><div style='display:none' id='spoiler'>" + RegExp.$2 + "</div></div>");
};};
</script>
Report Spam   Logged

Global Mod, (sort of) at your service.

http://twitter.com/timothyaveni

Share on Facebook Share on Twitter

Andrew
Exclusive
Exclusive
Offline Offline

Gender: Male
Posts: 539



View Profile WWW
Badges: (View All)
Combination Topic Starter Poll Voter
« Reply #1 on: September 12, 2009, 06:06:08 pm »

Thanks a ton for making this Exilis!

Ill add it as soon as EzPortal wants to work on my forum.  Afro
Report Spam   Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy