1
dgbauer
New Spoiler Tag Hack!
  • 2006/3/25 9:54

  • dgbauer

  • Just popping in

  • Posts: 5

  • Since: 2005/11/12


There was many requests for a [spoiler] tag on my site, and after searching the internet fruitlessly for a hack that would allow me to add a spoiler tag, I decided to do it myself. I would like to post my results for everyone to use if you would like.

Go here for a demo

First, open (xoopsroot)/class/module.textsanitizer.php and find this:
// [/rhl]
$patterns[] = "/[q[color=000000]u[/color]ote]/sU";
$replacements[] = _QUOTEC.'
';
//$replacements[] = 'Quote: 
';
$patterns[] = "/[/quote]/sU";
$replacements[] = '
';


In my XOOPS 2.2.3a Final version of this file, it was lines 223 through 227 (Editing with Dreamweaver)

After that, add this:
//Start Spoilers Hack - By Don Bauer
$patterns[] = "/[spoiler]/sU";
$replacements[] = 'Spoiler: 
';
$patterns[] = "/[/spoiler]/sU";
$replacements[] = '
';
//End Spoilers Hack - By Don Bauer


But you aren't done!!! You need to add the new CSS code to your theme's style.css theme! So next, open (xoopsroot)/themes/(yourtheme)/style.css and find the div.xoopsQuote block (this is mine, yours can, and probably will look different):
div.xoopsQuote background#FFFFFF; border: 1px inset #000080; font-family: "Courier New",Courier,monospace; padding: 0px 6px 6px 6px;}


After that, add your new div.xoopsSpoiler block (this is mine):
div.xoopsSpoiler background#000000; color:#000000; border: 1px inset #000080; font-family: "Courier New",Courier,monospace; padding: 0px 6px 6px 6px;}


Ass you can see, all I did to this CSS block for div.xoopsSpoiler was change background: #FFFFFF; to background: #000000; and I added in color: #000000; after that.

This will make a black block with black text, but you can change that to whatever you want, just make sure that the background and the color values are exactly the same!


I would recommend copying and pasting your div.xoopsQuote block and just adding in the 'color: #000000'; and changing the color after 'background:' to '#000000'.

That's it!

Please use at your own risk as I hold no responsibility for damages done because of your use of this hack. I have tested with XOOPS 2.2.3a Final.

Enjoy!

2
ladon
Re: New Spoiler Tag Hack!
  • 2006/3/25 13:43

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Hi, thanks for sharing this great hack. I made a some hacks there as well. You can make pretty much everything you want.

I wanted an edit tag so I added the following:

$patterns[] = "/[edit]/sU";
        
$replacements[] = 'EDIT: ';
        
$patterns[] = "/[/edit]/sU";
        
$replacements[] = '
'
;


Which displays as the following: click. For this example you don't need to add anything to the .css file.
I am the BEST.......... at overstating things! - Resized Image

3
iHackCode
Re: New Spoiler Tag Hack!

ok today after seeing the spoiler hack you made I went looking online for another spoiler hack..

so i made this hack from invision to a XOOPS hack

Example Post

i've been working on it. on and off during the day. but so far i can only do one spoiler per post. so ill work on it more tomorrow. i might have forgotten something.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

4
dgbauer
Re: New Spoiler Tag Hack!
  • 2006/3/26 9:55

  • dgbauer

  • Just popping in

  • Posts: 5

  • Since: 2005/11/12


Any chance that you will have (or even already do) code available for that soon? I am really impressed and interested with your modification there! If so, you can e-mail it to me at: dgbauerbauerboxcom (avoiding spam bots)

I may be able to help with your problem on not being able to have more than one in a post.

5
svaha
Re: New Spoiler Tag Hack!
  • 2006/3/26 11:26

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


Quote:

ladon wrote:
Hi, thanks for sharing this great hack. I made a some hacks there as well. You can make pretty much everything you want.

I wanted an edit tag so I added the following:

$patterns[] = "/[edit]/sU";
        
$replacements[] = 'EDIT: ';
        
$patterns[] = "/[/edit]/sU";
        
$replacements[] = '
'
;


Which displays as the following: click. For this example you don't need to add anything to the .css file.

Thanks for sharing this hack ladon, very nice site you have there, I like layout and content, do you have rss feeds?

6
iHackCode
Re: New Spoiler Tag Hack!

Quote:

dgbauer wrote:
Any chance that you will have (or even already do) code available for that soon? I am really impressed and interested with your modification there! If so, you can e-mail it to me at: (avoiding spam bots)

I may be able to help with your problem on not being able to have more than one in a post.

Core Hack: Spoiler Tag

http://www.bandit-x.net/BX%20Spoiler%20Hack.txt
here is the link to the image for the editor.
http://www.bandit-x.net/html/images/spoiler.gif
multiple spoiler tags in one post

And the Disclaimer.. Backup Your Scripts And Stuff.. And This $&^%&Disclaimer!@@!$. So i wont be hunted down if something bad happens or something. And i havent uploaded this version to my site yet. this is what i had on my computer locally.. the variable names and the smarty variables are a bit different then the one i got on my site. so i gotta change the one on my site still.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

7
dgbauer
Re: New Spoiler Tag Hack!
  • 2006/3/26 22:22

  • dgbauer

  • Just popping in

  • Posts: 5

  • Since: 2005/11/12


Very cool! I will try this with my site tonight, but just for safety sake, what version of XOOPS are you using? (Or at least what version did you test this with?)

8
iHackCode
Re: New Spoiler Tag Hack!

oops. dgbauer just informed me that i put the wrong location for a file in the text file.

line 142 should say "Open: yoursite/class/xoopsform/formdhtmltextarea.php"

updated..


--mar 27-2006
update. edited xoops.css new version

this was changed/edited to.
.spoilertop{
    
background#E4EAF2;
    
border1px dotted #000;
    
border-left4px solid #8394B2;
    
color#000;
    
font-weightbold;
    
font-size10px;
    
margin8px auto 0 auto;
    
padding3px;
        
cursor:pointer;
        
cursor:hand;

}

and

this. for the editor. to show a hand when you mouse over the icon.
<img onclick='javascript:xoopsCodeSpoiler("".$this->getName()."", "".htmlspecialchars(_ENTERSPOILER, ENT_QUOTES)."");' onmouseover='style.cursor="hand";style.cursor="pointer"' src='".XOOPS_URL."/images/spoiler.gif' alt='spoiler'/><br />n";


link to updated text file. (same location/name as the original . just updated)
Spoiler Hack.TXT
--
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

9
iHackCode
Re: New Spoiler Tag Hack!

i updated it a week or two ago. Example Post
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

10
marcionline
Re: New Spoiler Tag Hack!

I have made a new spoiler tag (adapted from BB Code) and I would like to share

$patterns[] = "/[spoiler](.*)[/spoiler]/sU";
$replacements[] = 'Spoiler: div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" />
\1
';


Just add the code to function xoopsCodeDecode in file class/module.textsanitizer.php and then make a test with [spoiler]Teste![/spoiler].




My Xoops site: http://www.mistershare.org

Login

Who's Online

177 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 177


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits