However, my version of the MOD adds the ability to view the "hidden spoiler text" by simply moving the cursor over the text, without having to select it.
I will post a demo of this shortly or maybe a few screenshots if I cannot host a demo board.
I would like to acknowledge elfy for his original code which meant that I could write this MOD. Thanks.
EDIT:I have changed the title of this MOD to avoid any confusion with others
Code: Select all
#################################################################
## MOD Title: Spoiler BBcode MOD++
## MOD Author: cheesypeanut < simonpitfield@frogpspawn.org > (Simon Pitfield) http://www.frogspawn.org
## MOD Description: Adds a spoiler BBcode to your forum, which reveals the hidden text onmouseover.
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: bbcode.tpl,
## bbcode.php,
## 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 v2.0.8 - in Opera 7.51, Internet Explorer 6.02, Mozilla 1.7
##
##############################################################
## 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="spoiler" onmouseover="this.style.color='#FFFFFF';" onmouseout="this.style.color=this.style.backgroundColor='#000000'"><!-- END spoiler_open -->
<!-- BEGIN spoiler_close --></span><!-- END spoiler_close -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.css
#
#-----[ FIND ]------------------------------------------
#
/* This is the outline round the main forum tables */
.forumline { background-color: white; border: 0px black solid; }
#
#-----[ AFTER, ADD ]------------------------------------------
#
/* BBcode Spoiler MOD++ - by cheesypeanut */
.spoiler { color: black; text-decoration: none; background-color: black; font-weight: normal; }
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
PLEASE NOTE IF YOU ARE USING A NON-DEFAULT THEME YOU WILL HAVE TO ADD THIS SMALL PIECE OF CODE BELOW, OBVIOUSLY REPLACING "subSilver" WITH THE NAME OF YOUR THEME.
Thanks to cherokee red, Schwpz and beggers for the heads-up.
Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
/* This is the outline round the main forum tables */
.forumline{ background-color: {T_TD_COLOR2}; border: 2px {T_TH_COLOR2} solid; }
#
#-----[ AFTER, ADD ]------------------------------------------
#
/* BBcode Spoiler MOD++ - by cheesypeanut */
.spoiler { color: black; text-decoration: none; background-color: black; font-weight: normal; }
If you would like to add a button to insert the BBcode alongside the default BBcode buttons you must first install [2.0.6] Multiple BBCode MOD. It is very quick and easy. You must then install the code below on your board.
Code: Select all
#
# IMPORTANT: you MUST first install the latest version of the Multi Quick BBCode Mod (1.2.1+).
# This can be found here: http://www.phpbb.com/phpBB/viewtopic.php?t=145513
#
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
'L_EMPTY_MESSAGE' => $lang['Empty_message'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
'L_BBCODE_6_HELP' => $lang['bbcode_6_help'],
#
#-----[ FIND ]---------------------------------
#
$EMBB_keys = array(''
$EMBB_widths = array(''
$EMBB_values = array(''
#
#-----[ IN-LINE FIND ]---------------------------------
#
$EMBB_keys = array(''
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
,'6'
#
#-----[ IN-LINE FIND ]---------------------------------
#
$EMBB_widths = array(''
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
,'55'
#
#-----[ IN-LINE FIND ]---------------------------------
#
$EMBB_values = array(''
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
,'Spoiler'
#
#-----[ OPEN ]------------------------------------------
# You need to do this for all of your installed template styles
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
f_help = "{L_BBCODE_F_HELP}";
#
#-----[ AFTER, ADD ]------------------------------------------
#
n6_help = "{L_BBCODE_6_HELP}";
#
#-----[ FIND ]---------------------------------
#
# NOTE: the actual line to find is MUCH longer, containing all the bbcode tags
#
bbtags = new Array(
#
#-----[ IN-LINE FIND ]---------------------------------
#
'[url]','[/url]'
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
,'[spoiler]','[/spoiler]'
#
#-----[ OPEN ]------------------------------------------
# You need to do this for all installed languages
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
# Full line in English is: $lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';
#
$lang['bbcode_f_help'] =
#
#-----[ AFTER, ADD ]------------------------------------------
# You need to do this for all installed languages
#
$lang['bbcode_6_help'] = 'Spoiler text: [spoiler]this is the spoiler text[/spoiler] (alt+6)';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
If you run into any problems, let me know via e-mail or reply to this post and I will do my best to sort you out.
Peace out