February 22, 2020, 07:33:10 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
Author Topic: Spoiler Tag "V3"  (Read 467 times)
Optimistic & Creative
Global Moderator
Global Moderator
Offline Offline

Posts: 929

View Profile
Badges: (View All)
« 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
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.

var b = document.getElementsByTagName("div");
//Created by Agent Moose (smcodes.smfforfree3.com)
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>");
Report Spam   Logged

Global Mod, (sort of) at your service.


Share on Facebook Share on Twitter

Offline Offline

Gender: Male
Posts: 539

View Profile WWW
Badges: (View All)
« 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
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