1/* 2 Name: YouTubePopUp 3 Description: jQuery plugin to display YouTube or Vimeo video in PopUp, responsive and retina, easy to use. 4 Version: 1.0.1 5 Plugin URL: http://wp-time.com/youtube-popup-jquery-plugin/ 6 Written By: Qassim Hassan 7 Twitter: @QQQHZ 8 Websites: wp-time.com | qass.im | wp-plugins.in 9 Dual licensed under the MIT and GPL licenses: 10 http://www.opensource.org/licenses/mit-license.php 11 http://www.gnu.org/licenses/gpl.html 12 Copyright (c) 2016 - Qassim Hassan 13*/ 14 15(function ( $ ) { 16 17 $.fn.YouTubePopUp = function(options) { 18 19 var YouTubePopUpOptions = $.extend({ 20 autoplay: 1 21 }, options ); 22 23 $(this).on('click', function (e) { 24 25 var youtubeLink = $(this).attr("href"); 26 27 if( youtubeLink.match(/(youtube.com)/) ){ 28 var split_c = "v="; 29 var split_n = 1; 30 } 31 32 if( youtubeLink.match(/(youtu.be)/) || youtubeLink.match(/(vimeo.com\/)+[0-9]/) ){ 33 var split_c = "/"; 34 var split_n = 3; 35 } 36 37 if( youtubeLink.match(/(vimeo.com\/)+[a-zA-Z]/) ){ 38 var split_c = "/"; 39 var split_n = 5; 40 } 41 42 var getYouTubeVideoID = youtubeLink.split(split_c)[split_n]; 43 44 var cleanVideoID = getYouTubeVideoID.replace(/(&)+(.*)/, ""); 45 46 if( youtubeLink.match(/(youtu.be)/) || youtubeLink.match(/(youtube.com)/) ){ 47 var videoEmbedLink = "https://www.youtube.com/embed/"+cleanVideoID+"?autoplay="+YouTubePopUpOptions.autoplay+""; 48 } 49 50 if( youtubeLink.match(/(vimeo.com\/)+[0-9]/) || youtubeLink.match(/(vimeo.com\/)+[a-zA-Z]/) ){ 51 var videoEmbedLink = "https://player.vimeo.com/video/"+cleanVideoID+"?autoplay="+YouTubePopUpOptions.autoplay+""; 52 } 53 54 $("body").append('<div class="YouTubePopUp-Wrap YouTubePopUp-animation"><div class="YouTubePopUp-Content"><span class="YouTubePopUp-Close"></span><iframe src="'+videoEmbedLink+'" allowfullscreen></iframe></div></div>'); 55 56 if( $('.YouTubePopUp-Wrap').hasClass('YouTubePopUp-animation') ){ 57 setTimeout(function() { 58 $('.YouTubePopUp-Wrap').removeClass("YouTubePopUp-animation"); 59 }, 600); 60 } 61 62 $(".YouTubePopUp-Wrap, .YouTubePopUp-Close").click(function(){ 63 $(".YouTubePopUp-Wrap").addClass("YouTubePopUp-Hide").delay(515).queue(function() { $(this).remove(); }); 64 }); 65 66 e.preventDefault(); 67 68 }); 69 70 $(document).keyup(function(e) { 71 72 if ( e.keyCode == 27 ){ 73 $('.YouTubePopUp-Wrap, .YouTubePopUp-Close').click(); 74 } 75 76 }); 77 78 }; 79 80}( jQuery ));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.