Modifications for phpBB3.
Try the Mods here and share Your own Mods
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support
Post
by all4phone » 12 Dec 2011, 08:40
Title: jQuery Spoiler
Description: Spoiler for long descriptions
Autor: liptonace
[minor changes by FTH & all4phone]
BBCode usage:
HTML replacement:
Code: Select all
<div style="margin:5px; margin-top:5px; border: 1px solid #3bbfe7;" class="codebox">
<div style="height:22px; text-align: center;"><strong>PhpBB3BBCodes Spoiler:</strong>
<input type="button" class="changevalue" value="{L_EXPAND_VIEW}" style="width:100px; font-size:10px; margin:0px; padding:0px;" onclick="$(this).parents('.codebox').find('.content').toggle('slow');"></div>
<div class="content" style="display: none; background-color:#e6e6e6; padding: 5px;">{TEXT}</div></div>
Helpline:
Code: Select all
Spoiler for long descriptions: [spoiler]text[/spoiler]
Example:
Code: Select all
[spoiler]hidden text :) :D[/spoiler]
necessary edits :
Open: styles/your_style/template/overall_header.html
Find:
Before add :
Code: Select all
<script type="text/javascript">
// <![CDATA[
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery-latest.min.js"><\/script>');
// ]]>
</script>
<script type="text/javascript">
$("document").ready(
function()
{
$("input.changevalue").toggle(
function()
{
$(this).val('{L_COLLAPSE_VIEW}');
},
function()
{
$(this).val('{L_EXPAND_VIEW}');
}
);
}
);
</script>
NOTE: This spoiler uses the jQuery library. It is your responsibility to ensure adding this BBCode does not cause any conflicts with other jQuery related BBCodes/MODs on your board. jQuery should never be included on a page more than once.
Demo:
http://youtu.be/8mS1STsRBhM
Last edited by all4phone on 28 Dec 2011, 20:14, edited 3 times in total.
Post
by Blackwolf » 12 Dec 2011, 11:21
Screenshot please?
Post
by FTH » 12 Dec 2011, 16:56
HTML Replacement :
Code: Select all
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$("document").ready(
function()
{
$("input.changevalue").toggle(
function()
{
$(this).val('{L_COLLAPSE_VIEW}');
},
function()
{
$(this).val('{L_EXPAND_VIEW}');
}
);
}
);
</script>
<div style="margin:5px; margin-top:5px; border: 1px solid #3bbfe7;" class="codebox">
<div style="height:22px; text-align: center;"><strong>Spoiler:</strong>
<input type="button" class="changevalue" value="{L_EXPAND_VIEW}" style="width:85px; font-size:10px; margin:0px; padding:0px;" onclick="$(this).parents('.codebox').find('.content').toggle('slow');"></div>
<div class="content" style="display: none; background-color:#e6e6e6; padding: 5px;">{TEXT}</div></div>
it's not better just to do it ? With this code, not need to modify overall_header and language/en.common.php
Demo :
http://graphogames.fr/demo/viewtopic.php?p=1#p1
Post
by doktornotor » 12 Dec 2011, 17:00
FTH wrote: it's not better just to do it ? With this code, not need to modify overall_header and language/en.common.php
Letting people inject jQuery or
$("document").ready()
at any time via BBCode does not sound like the best idea around.
Post
by FTH » 12 Dec 2011, 17:05
yeah exactly, i didn't think to that , thanks doktornotor for this suggest
Post
by all4phone » 12 Dec 2011, 18:52
Blackwolf wrote: Screenshot please?
Demo added to first post.
FTH wrote:
$(this).val('{L_COLLAPSE_VIEW}');
},
function()
{
$(this).val('{L_EXPAND_VIEW}');
FTH wrote: it's not better just to do it ? With this code, not need to modify [edited] language/en.common.php
very good idea, thanks for that, first post updated
.
Post
by Oyabun1 » 19 Dec 2011, 11:07
I'd suggest replacing the line of code at the top of the add in for
styles/your_style/template/overall_header.html Code: Select all
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
with
Code: Select all
<script type="text/javascript">
// <![CDATA[
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery-latest.min.js"><\/script>');
// ]]>
</script>
That should then only load the jQuery library if it is not already loaded, thus minimising the chance of multiple inclusions.
It's not my code I just found it somewhere and it may be useful, especially because a number of MODs and BBCodes now use the jQuery library.
Post
by all4phone » 28 Dec 2011, 20:16
First post updated.
@Oyabun1 , this is a beautiful idea, tested, many thanks for that mate
Post
by master412160 » 15 Jan 2012, 10:29
Would it be somehow possible to add a cookie to store if the last click of a user was if the spoiler was HIDE or SHOW?
Then this would be really a neat spoiler to have.
Post
by Jessica » 21 Mar 2012, 19:18
always wanted a jQuery spoiler *added*