Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
BBCode - Custom Spoiler Details »»
BBCode - Custom Spoiler
Version: 1.01, by orange gold orange gold is offline
Developer Last Online: Sep 2011 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.1.0 Rating:
Released: 12-23-2010 Last Update: Never Installs: 44
 
No support by the author.

*Update released! In the new code the button will automatically adjust it's width to tightly fit all the text in the title.. You don't have to worry about keeping your title small anymore! enjoy!

If you like this you may also like the image preview spoiler for large images

I have seen spoiler code before but I am not sure if there is any spoiler code 4.0 for a custom spoiler where you can enter the text that appear on the button (ex. Click to view hidden message) and also show what is on the inside...

Here is my code I made:
** There is a known glitch where in the button title if you put the following symbol in the name ' then it will not work... If anyone can fix this please let me know because I have tried.. Other than that, the code works fine!

Enjoy! (Screenshots below)

Title:
Code:
Spoiler
BBCode Tag Name:
Code:
spoiler
Replacement:
Code:
<div>
    <div class="pre-spoiler">
    <input type="button" value="  {option}  " style="font-size:14px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('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.value = '{option}';}">
    </div>
    <div>
        <div class="spoiler" style="display: none;"><div style="border: 1px solid ;">{param}</div></div>
    </div>
</div>
Example:
Code:
[spoiler=enter your title here]enter your text here[/spoiler]
Description:
Code:
Shows and hides text with the click of a button.
(Glitch: In the button title... do not use this symbol ' )
Use Option:
Code:
Yes.
Leave everything else default... Let me know what you think..

Screenshots

File Type: png Screen shot 2010-12-24 at 3.43.54 AM.png (11.2 KB, 0 views)
File Type: png Screen shot 2010-12-24 at 3.44.00 AM.png (12.8 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 12-26-2010, 01:21 AM
orange gold orange gold is offline
 
Join Date: Dec 2007
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OH!!! Okay!

Here is the new replacement code (150px also...) All you need to do is edit the code where it says "***URL HERE***" and change it to the full URL of the image.

Replacement:
Code:
<div>
    <div class="pre-spoiler">
    <button style="background-image:url(***URL HERE***);width:150px;font-size:14px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('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.value = '{option}';}">{option}</button>
    </div>
    <div>
        <div class="spoiler" style="display: none;"><div style="border: 1px solid ;">{param}</div></div>
    </div>
</div>
Reply With Quote
  #13  
Old 12-26-2010, 01:34 AM
Antidepresiv Antidepresiv is offline
 
Join Date: Dec 2010
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, it displays an image, but when i click on expand colapse, it gives me this message

Vbulletin message
"Invalid Action Specified"

And the spoiler image goes over the spoiler text... :/
Reply With Quote
  #14  
Old 12-26-2010, 01:39 AM
orange gold orange gold is offline
 
Join Date: Dec 2007
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm.. Give me some time, I fear I will have to use the Z-Index to make the text be ontop.. I hate the Z-index haha..
Also.. I do not know what the error is... I will take a look at it later.. I have to go now.. Please hold
Reply With Quote
  #15  
Old 12-26-2010, 01:44 AM
Antidepresiv Antidepresiv is offline
 
Join Date: Dec 2010
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OKy dude, and i have to sleep now, its 5am here.. :/ i will respond tomorrow, and once again, thank you so much for you'r help, you are the best..

Anti Out! xD
Reply With Quote
  #16  
Old 12-26-2010, 02:03 AM
orange gold orange gold is offline
 
Join Date: Dec 2007
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fixed it!

Same thing.. replace the ***URL HERE*** (You will have to scroll over in the code box below to find it)
This will work!

new Replacement code:

Code:
<div>
    <div class="pre-spoiler">
    <input type="button" value="{option}" style="width:150px;font-size:14px;margin:0px;padding:0px;background-image:url(***URL HERE***)" onclick="if (this.parentNode.parentNode.getElementsByTagName('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.value = '{option}';}">
    </div>
    <div>
        <div class="spoiler" style="display: none;"><div style="border: 1px solid ;">{param}</div></div>
    </div>
</div>
Reply With Quote
  #17  
Old 12-26-2010, 10:19 AM
Antidepresiv Antidepresiv is offline
 
Join Date: Dec 2010
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeap, this works, but the image isn't aligned in the field, it's way off.. And the image is the same size 150px.. How can i center the image in the field.. i tried with some positioning, but it doesnt work.. :/ Once again THANK YOU!
Reply With Quote
  #18  
Old 12-26-2010, 10:44 AM
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Posts: 1,196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed using original code (image not needed for me).

Would like to see the symbol ' glitch fixed though

4.1 PL2
Reply With Quote
  #19  
Old 12-26-2010, 10:53 AM
Antidepresiv Antidepresiv is offline
 
Join Date: Dec 2010
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I figured it out, anyway, dunno what it is, but if you have an image lets say 150x30, the spoiler width and height must me smaller than the image size, for example 145x26, and then everthing is centered.. But if you put it in the same size, it wont be..

Thanks again for you'r help dude..

Best Regards,
Antidepresiv
Reply With Quote
  #20  
Old 12-27-2010, 12:57 PM
orange gold orange gold is offline
 
Join Date: Dec 2007
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think that's because the image was probably a rectangle and the button is a curved rectangle so the curves extend past the px size... Anyways, glad you go it working!
Wish you the best!
Reply With Quote
  #21  
Old 01-07-2011, 06:30 AM
The Rocketeer's Avatar
The Rocketeer The Rocketeer is offline
 
Join Date: Jun 2010
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

do you also have strike through ? thanks
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:29 AM.


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.04560 seconds
  • Memory Usage 2,325KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (8)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete