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
Youtube Spoiler Fancy Details »»
Youtube Spoiler Fancy
Version: 1.00, by SharpShotGif SharpShotGif is offline
Developer Last Online: Jun 2016 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 4.2.x Rating:
Released: 01-25-2016 Last Update: 01-25-2016 Installs: 6
Template Edits
Re-useable Code  
No support by the author.

What this does
This code will turn all of your Youtube embed code into fancy spoiler that users can click to open and close to view the Youtube video.

Screenshots




INSTALL

Please back up your "bbcode_video" code before making any edits so you can restore if mistakes happen.


IMAGES
Upload the images to your images folder

YT_open.jpg
YT_close.jpg


CODE
In admincp ? Styles & Templates ? Style Manager ? Edit Templates ? BB Code Layout Templates ? bbcode_video

Find: line 8
HTML Code:
<vb:elseif condition="$provider == 'youtube'" />
Find and replace: line 9
HTML Code:
<iframe title="YouTube video player" width="640" height="360" src="//www.youtube.com/embed/{vb:raw code}?wmode={vb:raw wmode}" frameborder="0" allowfullscreen></iframe>
With: line 9
HTML Code:
<div style="padding-top:4px;padding-right:4px;">
	<div>
		<img name="YouTube Spoiler" type="image" src="images/YT_open.jpg" 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.src = 'images/YT_close.jpg'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = '';this.src = 'images/YT_open.jpg'; }">
	</div>
	<div style="margin: 0px; padding:0px;">
		<div style="display: none;">
			<iframe title="YouTube video player" width="640" height="360" src="//www.youtube.com/embed/{vb:raw code}?wmode={vb:raw wmode}" frameborder="0" allowfullscreen></iframe>
		</div>
	</div>
</div>
Save and reload - I recommend you tick the "Save in Template History?" so you can undo any changes at a later date or if an mistake has happened.

I have included the code and images in the attachment.

Just to clarify this does not help with page load times.

This is my first post if I have made any mistakes please let me know.

Download Now

File Type: zip YTS.zip (459.7 KB, 21 views)

Show Your Support

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

Comments
  #2  
Old 01-26-2016, 11:54 AM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why though? It is adding another barrier between the user and the content. If you added usergroup permissions or something it may be worthwhile.
Reply With Quote
  #3  
Old 01-26-2016, 12:17 PM
SharpShotGif SharpShotGif is offline
 
Join Date: Dec 2015
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It helps keeps the posts smaller so less scrolling. I find if we have a text heave posts with some YouTube videos it just needless makes the page longer. I also think it makes the posts look more cleaner and tidy.
Reply With Quote
Благодарность от:
RichieBoy67
  #4  
Old 01-26-2016, 12:23 PM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That makes sense and even better if it decreases page load times. Have you tested that? That would be a major reason to use it for sure.

Thanks!
Reply With Quote
  #5  
Old 01-26-2016, 12:25 PM
SharpShotGif SharpShotGif is offline
 
Join Date: Dec 2015
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry it still loads the contents inside the div so it does not lower the load times. It just a simple "display: none" though I would like to find a better way to do it so it does improve load times.
Reply With Quote
  #6  
Old 01-26-2016, 10:06 PM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Richie There is a way to do it that I posted about a long time ago. This page that I gtmetrix tested has 5 youtube videos on it.
http://www.video-game-chat.com/forum...-hcbailly.html
https://gtmetrix.com/reports/www.vid...t.com/8Hr54EAo
http://www.webpagetest.org/result/160127_74_D6/

Here's the js I use.
http://www.video-game-chat.com/youtube.js
Reply With Quote
2 благодарности(ей) от:
RichieBoy67, SharpShotGif
  #7  
Old 01-27-2016, 09:28 AM
SharpShotGif SharpShotGif is offline
 
Join Date: Dec 2015
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After some digging I used this tutorial to help with loading times and it has a big impact. Its worth spending the time putting on.

http://www.skipser.com/p/2/p/youtube...ogle-plus.html
Reply With Quote
  #8  
Old 01-29-2016, 02:19 AM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SharpShotGif View Post
After some digging I used this tutorial to help with loading times and it has a big impact. Its worth spending the time putting on.

http://www.skipser.com/p/2/p/youtube...ogle-plus.html
Did you add the following code in your headincludes or postbit? You saw a notable difference?

PHP Code:
<script type="text/javascript">optimizeYouTubeEmbeds()</script
Reply With Quote
  #9  
Old 01-29-2016, 12:50 PM
SharpShotGif SharpShotGif is offline
 
Join Date: Dec 2015
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added that in my footer.

Yes a huge difference I have set up 2 pages to show you.

With iframe replace code

Without code

I also noticed a bug with this code if you have 2 or more of the same video on the page it will load/change the top most video first even if you click on the bottom one.
Reply With Quote
  #10  
Old 01-29-2016, 12:55 PM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's not a vbulletin page you linked to. You also didn't mention which style template you used.
Reply With Quote
Благодарность от:
RichieBoy67
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 12:50 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07437 seconds
  • Memory Usage 2,324KB
  • Queries Executed 24 (?)
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
  • (3)bbcode_html
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • 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
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete