1/* 2 Name: YouTubePopUp (Premium) 3 Description: jQuery plugin to display YouTube, Vimeo, and MP4 video in a pop-up. Responsive, retina ready, and easy to use. 4 Version: 1.1.1 5 Written By: Alobaidi 6 Live Demo: https://wp-plugins.in/VP-Live-Demos 7 Copyright 2020 Alobaidi (email: [email protected]) 8*/ 9 10(function ( $ ) { 11 12 $.fn.YouTubePopUp = function(options) { 13 14 var YouTubePopUpOptions = $.extend({ 15 autoplay: 1 16 }, options ); 17 18 19 function vpConvertHextToRGBA(hex,opacity){ 20 hex = hex.replace('#',''); 21 r = parseInt(hex.substring(0,2), 16); 22 g = parseInt(hex.substring(2,4), 16); 23 b = parseInt(hex.substring(4,6), 16); 24 25 result = 'rgba('+r+','+g+','+b+','+opacity/100+')'; 26 return result; 27 } 28 29 30 $(this).on('click', function (e) { 31 32 var youtubeLink = $(this).attr("href"); 33 34 var startingTime = $(this).attr('data-time'); 35 36 var endingTime = $(this).attr('data-endtime'); 37 38 var disIV = $(this).attr('data-iv'); 39 40 var widthSize = $(this).attr('data-width'); 41 42 var heightSize = $(this).attr('data-height'); 43 44 var overlayColor = $(this).attr('data-overlay'); 45 46 var relVideos = $(this).attr('data-relvid'); 47 48 var disControls = $(this).attr('data-controls'); 49 50 var disWrap = $(this).attr('data-dwrap'); 51 52 var dataSoundCloud = $(this).attr('data-soundcloud'); 53 54 var videoType = ' vp-vt-youtube'; 55 56 var yt_rel_exten = $(this).attr("wpt-video-p"); 57 58 if( overlayColor ){ 59 var get_overlay_color = vpConvertHextToRGBA(overlayColor, 80); 60 var set_overlay_style = ' background-color: '+get_overlay_color+' !important;'; 61 if( overlayColor == '#ffffff' ){ 62 var vpDarkIcon = ' vp-dark-ci'; 63 var vpDarkBG = ' vp-dark-bg'; 64 }else{ 65 var vpDarkIcon = ''; 66 var vpDarkBG = ''; 67 } 68 }else{ 69 if( video_popup_general_settings.o_color ){ 70 if( video_popup_general_settings.o_color == '#ffffff' ){ 71 var vpDarkIcon = ' vp-dark-ci'; 72 var vpDarkBG = ' vp-dark-bg'; 73 }else{ 74 var vpDarkIcon = ''; 75 var vpDarkBG = ''; 76 } 77 var get_overlay_color = vpConvertHextToRGBA(video_popup_general_settings.o_color, 80); 78 var set_overlay_style = ' background-color: '+get_overlay_color+' !important;'; 79 }else{ 80 var set_overlay_style = null; 81 var vpDarkIcon = ''; 82 var vpDarkBG = ''; 83 } 84 } 85 86 if( relVideos || $(this).hasClass('vp-dr') || yt_rel_exten == 1 ){ 87 var relVidParam = '&rel=0'; 88 }else{ 89 var relVidParam = '&rel=1'; 90 } 91 92 if( disControls ){ 93 var disControlsParam = '&controls=0'; 94 }else{ 95 var disControlsParam = '&controls=1'; 96 } 97 98 if( disIV ){ 99 var disIVParam = '&iv_load_policy=3'; 100 }else{ 101 var disIVParam = '&iv_load_policy=1'; 102 } 103 104 if ( youtubeLink.match(/(youtube.com)/) || youtubeLink.match(/(youtu.be)/) || youtubeLink.match(/(vimeo.com)/) ) { 105 106 if( youtubeLink.match(/(youtube.com)/) ){ 107 var split_c = "v="; 108 var split_n = 1; 109 } 110 111 if( youtubeLink.match(/(youtu.be)/) || youtubeLink.match(/(vimeo.com\/)+[0-9]/) ){ 112 var split_c = "/"; 113 var split_n = 3; 114 } 115 116 if( youtubeLink.match(/(vimeo.com\/)+[a-zA-Z]/) ){ 117 var split_c = "/"; 118 var split_n = 5; 119 } 120 121 var getYouTubeVideoID = youtubeLink.split(split_c)[split_n]; 122 123 var cleanVideoID = getYouTubeVideoID.replace(/(&)+(.*)/, ""); 124 125 if( youtubeLink.match(/(youtu.be)/) || youtubeLink.match(/(youtube.com)/) ){ 126 if( startingTime ){ 127 var getTime = '&start='+startingTime+''; 128 }else{ 129 var getTime = '&start=0'; 130 } 131 132 if( endingTime ){ 133 var getEndTime = '&end='+endingTime+''; 134 }else{ 135 var getEndTime = ''; 136 } 137 var videoEmbedLink = "https://www.youtube.com/embed/"+cleanVideoID+"?autoplay="
137+YouTubePopUpOptions.autoplay+relVidParam+getTime+disControlsParam+getEndTime+disIVParam+""; 138 var iframe_element = '<iframe src="'+videoEmbedLink+'" allow="autoplay" allowfullscreen></iframe>'; 139 } 140 141 if( youtubeLink.match(/(vimeo.com\/)+[0-9]/) || youtubeLink.match(/(vimeo.com\/)+[a-zA-Z]/) ){ 142 var videoEmbedLink = "https://player.vimeo.com/video/"+cleanVideoID+"?autoplay="+YouTubePopUpOptions.autoplay+""; 143 var iframe_element = '<iframe src="'+videoEmbedLink+'" allow="autoplay" allowfullscreen></iframe>'; 144 var videoType = ' vp-vt-vimeo'; 145 } 146 147 }else{ 148 if( dataSoundCloud ){ 149 var data_embed_sc = $(this).attr('data-embedsc'); 150 var iframe_element = '<iframe src="'+data_embed_sc+'" allow="autoplay" allowfullscreen></iframe>'; 151 var videoType = ' vp-vt-soundcloud'; 152 }else{ 153 if( YouTubePopUpOptions.autoplay == 1 ){ 154 var locally_options = 'controls autoplay controlsList="nodownload"'; 155 }else{ 156 var locally_options = 'controls controlsList="nodownload"'; 157 } 158 var iframe_element = '<video '+locally_options+'><source src="'+youtubeLink+'" type="video/mp4"></video>'; 159 var videoType = ' vp-vt-locally'; 160 } 161 } 162 163 if( widthSize ){ 164 var getWidthSize = widthSize; 165 }else{ 166 if( video_popup_general_settings.width_s ){ 167 var getWidthSize = video_popup_general_settings.width_s; 168 }else{ 169 var getWidthSize = '880'; 170 } 171 } 172 173 if( heightSize ){ 174 var getHeightSize = heightSize; 175 }else{ 176 if( video_popup_general_settings.height_s ){ 177 var getHeightSize = video_popup_general_settings.height_s; 178 }else{ 179 var getHeightSize = '440'; 180 } 181 } 182 183 if( disWrap || $(this).hasClass('vp-dw') || video_popup_general_settings.r_border ){ 184 var disWrapClass = ' vp-flex-no-border'; 185 }else{ 186 var disWrapClass = ''; 187 } 188 189 $("body").append('<div style="display:none;'+set_overlay_style+'" class="YouTubePopUp-Wrap VideoPopUpWrap"></div>'); 190 191 $(".VideoPopUpWrap").fadeIn(300); 192 193 $(".VideoPopUpWrap").append('<div class="Video-PopUp-Content"><div style="max-width:'+getWidthSize+'px; height:'+getHeightSize+'px;" class="vp-flex'+vpDarkBG+disWrapClass+videoType+'"><span class="YouTubePopUp-Close'+vpDarkIcon+'"></span>'+iframe_element+'</div></div>'); 194 195 196 $(".YouTubePopUp-Wrap, .YouTubePopUp-Close").click(function(){ 197 $(".YouTubePopUp-Wrap").fadeOut(300).delay(325).queue(function() { $(this).remove(); }); 198 }); 199 200 $('.vp-flex, .vp-flex *').click(function(e){ 201 e.stopPropagation(); 202 }); 203 204 e.preventDefault(); 205 206 }); 207 208 $(document).keyup(function(e) { 209 210 if ( e.keyCode == 27 ){ 211 $('.YouTubePopUp-Close').click(); 212 } 213 214 }); 215 216 }; 217 218}( 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.