[dev] Spoiler BBcode Mod

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
elfy
Registered User
Posts: 25
Joined: Sat Jan 05, 2002 5:42 am
Location: Poland

[dev] Spoiler BBcode Mod

Post by elfy »

Hi,

I need this functionality on my own board but link to download in topic http://www.phpbb.com/phpBB/viewtopic.php?t=11012 is broken so I have created my own version.

That was very easy. Maybe some other people also need that on their boards so enjoy ;-)

Code: Select all

#################################################################
## MOD Title: Spoiler BBcode Mod
## MOD Author: elfy < elfy@tolkien.com.pl > (Marek Sliwinski) http://www.tolkien.com.pl 
## MOD Description: adds a spoiler tag to your forum
##              Text between spoiler tags is invisible till you highlight this block of text.
## MOD Version: 1.0.0
## 
## Installation Level: easy
## Installation Time: 3 Minutes
## Files To Edit: bbcode.tpl, 
##                bbcode.php
## Included Files: (n/a)
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
##############################################################
## Authors Notes: tested with phpBB2 ver 2.0.1
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#

// [b] and [/b] for bolding text   
$text = str_replace("[b:$uid]", $bbcode_tpl['b_open'], $text);
$text = str_replace("[/b:$uid]", $bbcode_tpl['b_close'], $text);
#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin 'SPOILER BBcode MOD'
// [spoiler] and [/spoiler] for spoiler-text   
$text = str_replace("[spoiler:$uid]", $bbcode_tpl['spoiler_open'], $text);
$text = str_replace("[/spoiler:$uid]", $bbcode_tpl['spoiler_close'], $text);
// End 'SPOILER BBcode MOD'

#
#-----[ FIND ]------------------------------------------
#

// [b] and [/b] for bolding text.
$text = preg_replace("#\[b\](.*?)\[/b\]#si", "[b:$uid]\\1[/b:$uid]", $text);
#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin 'SPOILER BBcode MOD'
// [spoiler] and [/spoiler] for setting spoiler-text
$text = preg_replace("#\[spoiler\](.*?)\[/spoiler\]#si", "[spoiler:$uid]\\1[/spoiler:$uid]", $text);
// End 'SPOILER BBcode MOD'
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
#
#
#-----[ FIND ]------------------------------------------
#

<!-- BEGIN b_open --><span style="font-weight: bold"><!-- END b_open -->
<!-- BEGIN b_close --></span><!-- END b_close -->
#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- BEGIN spoiler_open --><br><b>spoiler:</b><br><span style="color: EFEFEF"><!-- END spoiler_open -->
<!-- BEGIN spoiler_close --></span><br><!-- END spoiler_close -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Adds-on ;-)
1) if you don't want invisible spoiler you have to change this line:

Code: Select all

<!-- BEGIN spoiler_open --><br><b>spoiler:</b><br><span style="color: EFEFEF">
change "color: EFEFEF" to "color: your_spoiler_color"

2)if you don't use subSilver template and you want use "invisible mode" for spoiler then you have to check file templates/your_template/theme_info.cfg
Find

Code: Select all

[0]['tr_color1']
there is background color value for your posts.
Change value in my mod "color: EFEFEF" to "color: your_post_background_color"

I think that's all folks :-)

Greetz

[modedit] updated header to latest mod template [/modedit]
Without_Boundaries
Registered User
Posts: 75
Joined: Sat Jul 20, 2002 6:35 pm
Location: England
Contact:

Post by Without_Boundaries »

o0o. I'll go see if EasyMod can install it. If it can't then I'll try to make it so it does :D
Without_Boundaries
Registered User
Posts: 75
Joined: Sat Jul 20, 2002 6:35 pm
Location: England
Contact:

Post by Without_Boundaries »

Wow!
Works really well. I'll go add it to the EasyMod compatible MODs zip. :)
elfy
Registered User
Posts: 25
Joined: Sat Jan 05, 2002 5:42 am
Location: Poland

Post by elfy »

nice :)
Narc0sis
Registered User
Posts: 662
Joined: Tue Apr 09, 2002 12:59 am
Contact:

Post by Narc0sis »

works great, even made a button for it on my forum
LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

--Big note: this is my old code, please read this post a bit down for full functionality (with buttons!)--

I have modified elfy's code a bit to work with multiple row colors, as well as inside of quotes. Elfy said I could release my changes, and this has been tested on 2.0.2/2.0.3, so it should work. If anyone has problems, go ahead and mention them.

Code: Select all

#################################################################
## MOD Title: Spoiler BBcode Mod
## MOD Author: elfy < elfy@tolkien.com.pl > (Marek Sliwinski) http://www.tolkien.com.pl
##             LifeIsPain < brian@orvp.net > (Brian Evans)
## MOD Description: adds a spoiler tag to your forum
##              Text between spoiler tags is invisible till you highlight this block of text.
## MOD Version: 1.1.0
##
## Installation Level: easy
## Installation Time: 3 Minutes
## Files To Edit: templates/subSilver/bbcode.tpl,
##                includes/bbcode.php
##                templates/subSilver/subSilver.css
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes: tested with phpBB2 ver 2.0.2/2.0.3
##   Modified to always hide the text, not just on odd numbered posts
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]------------------------------------------
#
// [b] and [/b] for bolding text   
$text = str_replace("[b:$uid]", $bbcode_tpl['b_open'], $text);
$text = str_replace("[/b:$uid]", $bbcode_tpl['b_close'], $text);

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Begin 'SPOILER BBcode MOD'
// [spoiler] and [/spoiler] for spoiler-text   
$text = str_replace("[spoiler:$uid]", $bbcode_tpl['spoiler_open'], $text);
$text = str_replace("[/spoiler:$uid]", $bbcode_tpl['spoiler_close'], $text);
// End 'SPOILER BBcode MOD'

#
#-----[ FIND ]------------------------------------------
#
// [b] and [/b] for bolding text.
$text = preg_replace("#\[b\](.*?)\[/b\]#si", "[b:$uid]\\1[/b:$uid]", $text);

#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin 'SPOILER BBcode MOD'
// [spoiler] and [/spoiler] for setting spoiler-text
$text = preg_replace("#\[spoiler\](.*?)\[/spoiler\]#si", "[spoiler:$uid]\\1[/spoiler:$uid]", $text);
// End 'SPOILER BBcode MOD'

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl

#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN b_open --><span style="font-weight: bold"><!-- END b_open -->
<!-- BEGIN b_close --></span><!-- END b_close -->

#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- BEGIN spoiler_open --><span class="spoil"><!-- END spoiler_open -->
<!-- BEGIN spoiler_close --></span><!-- END spoiler_close -->

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.css

#
#-----[ FIND ]------------------------------------------
#
/* Main table cell colours and backgrounds */
td.row1   { background-color: #EFEFEF; }
td.row2   { background-color: #DEE3E7; }
td.row3   { background-color: #D1D7DC; }

#
#-----[ AFTER, ADD ]------------------------------------------
#
/* These lines are for the spoiler mod, each row must
  have the color changed to match the background */
td.row1 span.spoil { color: #EFEFEF; }
td.row2 span.spoil { color: #DEE3E7; }
td.row3 span.spoil { color: #D1D7DC; }
td.quote span.spoil { color: #FAFAFA; }

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
If you are not using subSilver colors, make sure that the colors for span.spoil are the same as the background-color of the corresponding section. Spoiler will not work in Opera, but will in IE 5+, NS 4.7+, and Mozilla at least 1.0+, I haven't tested it on any others. If you have users that use Opera, it won't work, because opera simply inverses the color (I think) but it changes the background and the foreground to be the same color. Otherwise, enjoy.

Also, make sure you reload the .css file, or come in fresh with your browser, otherwise it won't have the style sheet code loaded.
Last edited by LifeIsPain on Thu May 29, 2003 6:57 am, edited 1 time in total.
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.
SilverSnake8
Registered User
Posts: 41
Joined: Mon Oct 14, 2002 1:42 pm
Location: Cranston, RI, USA
Contact:

Post by SilverSnake8 »

i'm using LifeIsPain's code but my css refuses to reload :evil: :?

what do i do?
Image
Yea, so I don't like Bush! :P

"Before you criticize someone, walk a mile in his shoes.
That way, if he gets angry, he'll be a mile away ... and barefoot."
LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

If you hold down shift when you hit reload, just about every browser will do a full reload of the page and all of the contents inside. Otherwise, you have to wait a day (as is the case with most css changes)
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.
SilverSnake8
Registered User
Posts: 41
Joined: Mon Oct 14, 2002 1:42 pm
Location: Cranston, RI, USA
Contact:

Post by SilverSnake8 »

that didn't work ... i even loaded it on a computer that had NEVER been to my site and it would not load correctly :? !! and yes i'm sure the new code is uploaded ... http://members.lycos.co.uk/rbk1986/BigB ... subRed.css that's the url of my css file ... it's there
Image
Yea, so I don't like Bush! :P

"Before you criticize someone, walk a mile in his shoes.
That way, if he gets angry, he'll be a mile away ... and barefoot."
LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

ok, I will update my mod, but I figured out the problem.... I wrote the mod without thinking that people would still be using the css template imbedded in the overall_header.tpl file. So I will add a bit more to my instructions for this. Basically, you will use less bandwidth if you follow the instructions:

open up templates/subBilver/overall_header.tpl (use your style name for subsilver though).

change: <!-- link rel="stylesheet" href="templates/subSilver/subSilver.css" type="text/css" -->
to: <link rel="stylesheet" href="templates/subSilver/subSilver.css" type="text/css">

this will uncomment the style sheet and use this.

next delete everything from <style type="text/css"> to </style> after this, save changes, upload, and watch a drop in bandwidth, as well as be able to use the spoiler code.

----------

If you want to waste bandwidth (you won't delete the css code from overall_header.tpl) modify the code a bit.

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tp;

#
#-----[ FIND ]------------------------------------------
#
/* Main table cell colours and backgrounds */
td.row1	{ background-color: {T_TR_COLOR1}; }
td.row2	{ background-color: {T_TR_COLOR2}; }
td.row3	{ background-color: {T_TR_COLOR3}; }

#
#-----[ AFTER, ADD ]------------------------------------------
#
/* These lines are for the spoiler mod, each row must
  have the color changed to match the background */
td.row1   span.spoil { color: {T_TR_COLOR1}; }
td.row2   span.spoil { color: {T_TR_COLOR2}; }
td.row3   span.spoil { color: {T_TR_COLOR3}; }
td.quote  span.spoil { color: {T_TD_COLOR1}; }
But I say do the first method....
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.
User avatar
auron8785
Registered User
Posts: 243
Joined: Wed Mar 06, 2002 1:28 am
Contact:

Post by auron8785 »

i think that the spoiler mod on phpbbhacks is better cause it give you the button upove when posting a message
Live life to the fullest...
Dont forget who you are...
You'll never know until you walk in their shoes...
LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

I could put on the button, but just because it has that doesn't mean it is better....
The phpbbhacks one DOES NOT actually put the text color to the background color of the row, mine is the only one that does. This just works better with the multi bbcode mod you can put on. If you want a button, I can do that though, but don't say that for all purposes, the bbcode mod on hacs is better, because it just makes a very noticable block there. Mine also works for quotes...
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.
xie
Registered User
Posts: 17
Joined: Thu Jan 30, 2003 10:52 pm

Post by xie »

If my background is a fade, then can it be made to use a span code to "highlight'' the text, oh say black, and change the font color to black?

EDIT: It looks like I can just add that field to the SPAN code, so I will try that.
beeurd
Registered User
Posts: 34
Joined: Wed Mar 20, 2002 12:23 am
Location: A Galaxy Far, Far Away...
Contact:

Post by beeurd »

Cool, This would be really handy on my site :D
Dogbreath
Registered User
Posts: 4
Joined: Mon May 26, 2003 6:20 pm
Location: LV-426
Contact:

Post by Dogbreath »

Ok, installed. Now, how do I go about using it? I can make a button for it, but how do I make it work?
Locked

Return to “[2.0.x] MODs in Development”