vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=155)
-   -   Spoiler Tag (https://vborg.vbsupport.ru/showthread.php?t=113776)

King Kovifor 04-21-2006 10:00 PM

Spoiler Tag
 
Title: Spoiler
Tag: spoiler
Replacement:
HTML Code:

<div class="fieldset">
<table class="tborder" cellpadding="5" cellspacing="0" border="0" width="100%" align="center">
<tr>
  <td class="tcat" colspan="3"><a style="float:right" href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="button" value="Show/Hide" /></a>Spoilers!</td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="">
<td class="alt1" align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>

Example: [spoiler=example]This is Hidden![/spoiler]
Use Option: Yes
Image: Leave Blank

Q. Why do I have to "use option"?
A. This will solve a bug when not using it. In the first coding it wasn't used, but it would only collapse the first usage of "[spoiler][/spoiler]" in the thread. Using option in the code allowed to to specify which usage of the tags to collapse.

Bugs: It's open by default! I'm working on getting it closed by default.

Shack Networks 04-22-2006 07:44 PM

This shows up the hidden text on mouseover of the topic title in showthreads and on forumhome.

jj 04-22-2006 11:24 PM

Nice option code :)

style="display:none;"

will do the hide job :)

finn snor 04-23-2006 07:31 AM

Where do i insert that html ?

King Kovifor 04-23-2006 03:10 PM

When you add the bbcode, there is a section for "Replacement" place it there.

King Kovifor 04-23-2006 03:11 PM

Quote:

Originally Posted by Shack Networks
This shows up the hidden text on mouseover of the topic title in showthreads and on forumhome.

Not sure how to do it...

jj:

style="display:none;"

that'll do what?

InsaneContender 05-06-2006 12:00 AM

Quote:

Originally Posted by King Kovifor
Not sure how to do it...

jj:

style="display:none;"

that'll do what?

Code:

<div class="fieldset">
<table class="tborder" cellpadding="5" cellspacing="0" border="0" width="100%" align="center">
<tr>
  <td class="tcat" colspan="3"><a style="float:right" href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="button" value="Show/Hide" /></a>Spoilers!</td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="display:none;">
<td class="alt1" align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>

Change it to that. It will be closed by default.

SCRIPT3R 05-12-2006 04:04 PM

any updates to this one?

Danny W 06-08-2006 04:07 PM

I noticed if you have more than 1 spoiler on a page the buttons only open the first one.

Mythotical 08-06-2006 07:39 AM

King Kovifor is away for the week, I will try to fix that problem.

King Kovifor 08-06-2006 12:50 PM

Quote:

Originally Posted by Danny W
I noticed if you have more than 1 spoiler on a page the buttons only open the first one.

The spoiler tag should include:

[spoiler=SOMEUNIQUE_ID]and it'll collapse for all of them[/spoiler]

dartho 08-07-2006 05:05 AM

I changed this ever so slight for my own uses - still all the original code.

I've called the code JOKE
Code:

<div class="fieldset">
<table class="tborder" cellpadding="5" cellspacing="0" border="0" width="100%" align="center">
<tr>
  <td class="tcat" colspan="3"><a style="float:right" href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="button" value="Click Me" /></a>{option}</td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="display:none;">
<td class="alt1" align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>

So bascially it shows the joke, and you click the "Click Me" button to show the punch line :)

Nice Hack - Thanks!!

King Kovifor 08-16-2006 12:59 PM

Quote:

Originally Posted by dartho
I changed this ever so slight for my own uses - still all the original code.

I've called the code JOKE
Code:

<div class="fieldset">
<table class="tborder" cellpadding="5" cellspacing="0" border="0" width="100%" align="center">
<tr>
  <td class="tcat" colspan="3"><a style="float:right" href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="button" value="Click Me" /></a>{option}</td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="display:none;">
<td class="alt1" align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>

So bascially it shows the joke, and you click the "Click Me" button to show the punch line :)

Nice Hack - Thanks!!

It's for your use. And if you want to change it to be used with jokes. Go right a head.

ArchEnemy 08-25-2006 02:19 PM

Thank you for that code (the joke one too). I find it useful to set the title of the hidden field, but would be even nicer when it would use a default name when nothing was specified. :)

When you add class="button", the button comes in the css style. Looks better.
Code:

<input type="button" class="button"
Ok, after some testing, ... another variation of the code above. It creates a box with a textlink (option), which opens and closes the box. So this one is without any additional ugly buttons.

Code:

<div class="fieldset">
<table class="tborder" cellpadding="5" cellspacing="0" border="0" width="100%" align="center">
<tr>
  <td class="tcat" colspan="3"><a style="float:left" href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="hidden" value="{option}" />{option}</a><br></a></td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="display:none;">
<td class="alt1" align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>


sbrum 09-04-2006 03:19 PM

Quote:

Originally Posted by King Kovifor
The spoiler tag should include:

[spoiler=SOMEUNIQUE_ID]and it'll collapse for all of them[/spoiler]

This does not work for me either. Sometimes the first button opens the second spoiler.

sbrum 09-04-2006 03:21 PM

Quote:

Originally Posted by sbrum
This does not work for me either. Sometimes the first button opens the second spoiler.

Sorry, its working now.

Disasterpiece 07-19-2007 07:30 PM

Hi

I wanted to use the option param, so the user could use this for his own text on the button.

so when he uses [spoil=hideMe]xyz[/spoil] then, the Button says "hideMe".

i'm looking for a better way for the unique id. creating a random id would be perfect, but i don't think this is possible in html. any solution?

King Kovifor 07-19-2007 07:41 PM

If you install the multi option hack somewhere here on the forum, you could change this up to be [spoil=hideMe|uniqueID]xyz[/spoil]. I'm not sure how you'd do the HTML, since I've never used the hack, but I know it exists.

Adrian Schneider 07-19-2007 07:50 PM

The unique identifier should be generated by PHP (hash, microtime, etc).

Then you could do [spoiler]HE DIES IN THE END![/spoiler] or if you want ... [spoiler=WARNING]HE DIES IN THE END[/spoiler] which would replace the default caption.

Just an idea to simplify the use. :)

Disasterpiece 07-19-2007 08:08 PM

Yeah, im kind of a noob in php, i can only html ^^

so, this is my modified code:
Code:

<div class="fieldset">
<table cellpadding="5" cellspacing="0" border="0" align="center">
<tr>
  <td colspan="3" align="center"><a href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="button" value="{option}" /></a></td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="display:none;">
<td align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>

i used the option param for the button's value AND the spoiler id. works in 80%; when users use different values for the buttons, but i wanted to use it in the signature. So there would be many buttons with the same id.

is it possible to use php code in the code field? when yes, could you give me the php code for creating a random number? would be great :D

King Kovifor 07-19-2007 08:52 PM

Quote:

Originally Posted by SirAdrian (Post 1295983)
The unique identifier should be generated by PHP (hash, microtime, etc).

Then you could do [spoiler]HE DIES IN THE END![/spoiler] or if you want ... [spoiler=WARNING]HE DIES IN THE END[/spoiler] which would replace the default caption.

Just an idea to simplify the use. :)

How could I do that within the BBCode Manager?

daboogas94e 08-07-2007 09:29 PM

i can't seem to get the spoiler tags working at all

King Kovifor 08-10-2007 11:46 PM

Quote:

Originally Posted by daboogas94e (Post 1312221)
i can't seem to get the spoiler tags working at all

What do you have in the BBCode Manager?

smokey 11-25-2007 11:44 PM

Quote:

Originally Posted by Disasterpiece (Post 1295996)
is it possible to use php code in the code field? when yes, could you give me the php code for creating a random number? would be great :D

Here's a quick fix.

Create a plugin, for the hook location choose postbit_display_complete and paste the following php code in the box:

PHP Code:

$this->post['message'] = preg_replace('/\{rand_string\}/i',rand(0,32768),$this->post['message']); 

The above code will change {rand_string} in a post to a random number (making it unique).

In the spoiler bbcode you created, find both:

Code:

spoiler_{option}
Replace both with:

Code:

spoiler_{rand_string}
Also I replaced "Spoiler!" in the header to "Spoiler for {option}". Just a suggestion to all.

Thanks for the bbcode btw, it was a great idea!

TheoMessinis 02-02-2008 12:28 PM

Thank you! Great spoiler! :D

mikkitine 03-28-2008 12:39 PM

Quote:

Originally Posted by Disasterpiece (Post 1295996)
Yeah, im kind of a noob in php, i can only html ^^

so, this is my modified code:
Code:

<div class="fieldset">
<table cellpadding="5" cellspacing="0" border="0" align="center">
<tr>
  <td colspan="3" align="center"><a href="#top" onclick="return toggle_collapse('spoiler_{option}')"><input type="button" value="{option}" /></a></td>
</tr>
<tbody id="collapseobj_spoiler_{option}" style="display:none;">
<td align="$stylevar[left]" valign="top">{param}</td>
</tbody>
</table>
</div>

i used the option param for the button's value AND the spoiler id. works in 80%; when users use different values for the buttons, but i wanted to use it in the signature. So there would be many buttons with the same id.

is it possible to use php code in the code field? when yes, could you give me the php code for creating a random number? would be great :D

Quote:

Originally Posted by smokey (Post 1389405)
Here's a quick fix.

Create a plugin, for the hook location choose postbit_display_complete and paste the following php code in the box:

PHP Code:

$this->post['message'] = preg_replace('/\{rand_string\}/i',rand(0,32768),$this->post['message']); 

The above code will change {rand_string} in a post to a random number (making it unique).

In the spoiler bbcode you created, find both:

Code:

spoiler_{option}
Replace both with:

Code:

spoiler_{rand_string}
Also I replaced "Spoiler!" in the header to "Spoiler for {option}". Just a suggestion to all.

Thanks for the bbcode btw, it was a great idea!

I combined both of your suggestions and the result was still unchanged. Spoiler tags with the same option only open the first spoiler. In fact, spoiler tags with a different option still only open the first spoiler.

scottevtv 05-16-2009 03:52 PM

The tag begins as "Spoiler about...", and then if the user clicks and cicks again the "Spoiler about" text is gone. This was a bit confusing.


All times are GMT. The time now is 04:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01253 seconds
  • Memory Usage 1,821KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_code_printable
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (27)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete