1/** 2 * Media by Jegtheme 3 */ 4(function ($) { 5 "use strict"; 6 7 $.youtube_parser = function (url) { 8 var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/, 9 match = url.match(regExp); 10 11 if (match && match[7].length === 11) { 12 return match[7]; 13 } 14 window.alert("Url Incorrect"); 15 }; 16 17 $.vimeo_parser = function (url) { 18 var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/, 19 match = url.match(regExp); 20 21 if (match) { 22 return match[2]; 23 } 24 // check if using https 25 regExp = /https:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/; 26 match = url.match(regExp); 27 28 if (match) { 29 return match[2]; 30 } 31 window.alert("not a vimeo url"); 32 }; 33 34 $.type_video_youtube = function (ele, autoplay, repeat) { 35 var youtube_id = $.youtube_parser($(ele).attr('data-src')), 36 additionalstring = '', 37 iframe = ''; 38 if (repeat) { 39 additionalstring += ( autoplay === true ) ? "autoplay=1&" : ""; 40 additionalstring += (repeat === true ) ? "loop=1&playlist=" + youtube_id : ""; 41 iframe = '<iframe width="700" height="500" src="//www.youtube.com/v/' + youtube_id + '?version=3&' + additionalstring + 'showinfo=0&theme=light&autohide=1&rel=0&wmode=opaque" frameborder="0" allowfullscreen></iframe>'; 42 } else { 43 additionalstring += ( autoplay === true ) ? "autoplay=1&" : ""; 44 iframe = '<iframe width="700" height="500" src="//www.youtube.com/embed/' + youtube_id + '?' + additionalstring + 'showinfo=0&theme=light&autohide=1&rel=0&wmode=opaque" frameborder="0" allowfullscreen></iframe>'; 45 } 46 $('.jeg_video_container', ele).append(iframe); 47 }; 48 49 $.type_video_vimeo = function (ele, autoplay, repeat) { 50 var vimeo_id = $.vimeo_parser($(ele).attr('data-src')), 51 additionalstring = ''; 52 additionalstring += ( autoplay === true ) ? "autoplay=1&" : ""; 53 additionalstring += (repeat === true ) ? "loop=1&" : ""; 54 var iframe = '<iframe src="//player.vimeo.com/video/' + vimeo_id + '?' + additionalstring + 'title=0&byline=0&portrait=0" width="700" height="500" frameborder="0" mozallowfullscreen webkitallowfullscreen allowfullscreen></iframe>'; 55 $('.jeg_video_container', ele).append(iframe); 56 }; 57 58 $.type_soundcloud = function (ele) { 59 var soundcloudurl = $(ele).attr('data-src'), 60 iframe = '<iframe src="https://w.soundcloud.com/player/?url=' + encodeURIComponent(soundcloudurl) + '" width="700" height="500" frameborder="0"></iframe>'; 61 $('.jeg_video_container', ele).append(iframe); 62 }; 63 64 $.type_audio = function (ele) { 65 var musicmp3 = '', 66 musicogg = ''; 67 68 if ($(ele).data('mp3') !== '') { 69 musicmp3 = "<source type='audio/mpeg' src='" + $(ele).data('mp3') + "' />"; 70 } 71 72 if ($(ele).data('ogg') !== '') { 73 musicogg = "<source type='audio/ogg' src='" + $(ele).data('ogg') + "' />"; 74 } 75 76 var audio = "<audio preload='none' style='width: 100%; visibility: hidden;' controls='controls'>" + musicmp3 + musicogg + "</audio>"; 77 78 $(ele).append(audio); 79 80 var settings = {}; 81 82 if (typeof _wpmejsSettings !== 'undefined') { 83 settings = _wpmejsSettings; 84 } 85 86 settings.success = function (mejs) { 87 var autoplay, loop; 88 89 if ('flash' === mejs.pluginType) { 90 autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; 91 loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop; 92 93 autoplay && mejs.addEventListener('canplay', function () { 94 mejs.play(); 95 }, false); 96 97 loop && mejs.addEventListener('ended', function () { 98 mejs.play(); 99 }, false); 100 } 101 }; 102 103 $(ele).find('audio').mediaelementplayer(settings); 104 }; 105 106 $.type_video_html5 = function (ele, autoplay, options, container) { 107 var cover = $(ele).data('cover'); 108 109 options.pauseOtherPlayers = false;
110 111 var videomp4 = '', videowebm = '', videoogg = '', themesurl = ''; 112 113 if ($(ele).data('mp4') !== '') { 114 videomp4 = "<source type='video/mp4' src='" + $(ele).data('mp4') + "' />"; 115 } 116 117 if ($(ele).data('webm') !== '') { 118 videowebm = "<source type='video/webm' src='" + $(ele).data('webm') + "' />"; 119 } 120 121 if ($(ele).data('ogg') !== '') { 122 videoogg = "<source type='video/ogg' src='" + $(ele).data('ogg') + "' />"; 123 } 124 125 var preload = autoplay ? "preload='auto'" : "preload='none'", 126 object = "<object width='100%' height='100%' type='application/x-shockwave-flash' data='" + themesurl + "/public/mediaelementjs/flashmediaelement.swf'>" + 127 "<param name='movie' value='" + themesurl + "/public/mediaelementjs/flashmediaelement.swf' />" + 128 "<param name='flashvars' value='controls=true&file=" + $(ele).data('mp4') + "' />" + 129 "<img src='" + cover + "' alt='No video playback capabilities' title='No video playback capabilities' />" + 130 "</object>"; 131 var iframe = "<video id='player' style='width:100%;height:100%;' width='100%' height='100%' poster='" + cover + "' controls='controls' " + preload + ">" + 132 videomp4 + videowebm + videoogg + object + 133 "</video>"; 134 135 $(container, ele).append(iframe); 136 if (autoplay) { 137 options.success = function (mediaElement) { 138 if (mediaElement.pluginType === 'flash') { 139 mediaElement.addEventListener('canplay', function () { 140 mediaElement.play(); 141 }, false); 142 } else { 143 mediaElement.play(); 144 } 145 }; 146 } 147 148 $(ele).find('video').mediaelementplayer(options); 149 }; 150 151 $.do_media_render = function(container) { 152 // youtube 153 if ($(container).find("[data-type='youtube']").length) { 154 $(container).find("[data-type='youtube']").each(function () { 155 var autoplay = $(this).data('autoplay'), 156 repeat = $(this).data('repeat'); 157 $.type_video_youtube($(this), autoplay, repeat); 158 }); 159 } 160 161 // vimeo 162 if ($(container).find("[data-type='vimeo']").length) { 163 $(container).find("[data-type='vimeo']").each(function () { 164 var autoplay = $(this).data('autoplay'), 165 repeat = $(this).data('repeat'); 166 $.type_video_vimeo($(this), autoplay, repeat); 167 }); 168 } 169 170 // sound cloud 171 if ($(container).find("[data-type='soundcloud']").length) { 172 $(container).find("[data-type='soundcloud']").each(function () { 173 $.type_soundcloud($(this)); 174 }); 175 } 176 177 // audio 178 if ($(container).find("[data-type='audio']").length) { 179 $(container).find("[data-type='audio']").each(function () { 180 $.type_audio($(this)); 181 }); 182 } 183 184 // html 5 video 185 if ($(container).find("video").length) { 186 $(container).find('video').each(function () { 187 if (!not_elementor_bg_video(this)) { 188 $(this).mediaelementplayer(); 189 } 190 }); 191 } 192 }; 193 194 $.fn.jvideo_background = function () { 195 function jeg_resizevideobg(container) { 196 var size = calculate_container(container.parents('.jeg_block_container'), 'zoom'); 197 198 container.css({ 199 'height': size[0], 200 'width': size[1], 201 'left': size[2] + "px", 202 'top': size[3] + "px", 203 'max-width': 'inherit' 204 }); 205 } 206 207 function calculate_container(container, mode) { 208 var nh, nw, nt, nl; 209 210 var w = 16, 211 h = 9; 212 213 var r = ( h / w ), 214 wh = $(container).height(), 215 ww = $(container).width(), 216 wr = wh / ww; 217 218 var resizeWidth = function () { 219 nw = ww; 220 nh = ww * r; 221 nl = ( ww - nw ) / 2; 222 nt = ( wh - nh ) / 2; 223 224 return [nh, nw, nl, nt]; 225 }; 226 227 var resizeHeight = function () { 228 nw = wh / r; 229 nh = wh; 230 nl = ( ww - nw ) / 2; 231 nt = ( wh - nh ) / 2; 232 return [nh, nw, nl, nt]; 233 }; 234 235 var resizenoupscale = function () { 236 nw = w; 237 nh = h; 238 nl = ( ww - nw ) / 2; 239 nt = ( wh - nh ) / 2; 240 return [nh, nw, nl, nt]; 241 }; 242 243 if (mode === 'fit') { 244 if (wr > r) { 245 return resizeWidth(); 246 } 247 return resizeHeight(); 248 } 249 250 if (mode === 'zoom') { 251 if (wr > r) { 252 return resizeHeight(); 253 } 254 return resizeWidth(); 255 } 256 257 if (mode === 'fitNoUpscale') { 258 if (h > wh || w > ww) { 259 return $.new_get_image_container_size(img, container, "fit"); 260 } 261 262 return resizenoupscale(); 263 } 264 } 265 266 $(this).each(function () { 267 var element = $(this), 268 wrapper = element.parent('.jeg_videowrapper'), 269 container = element.get(0), 270 youtubeid = element.data('youtubeid'); 271 272 new YT.Player(container, { 273 width: "100%", 274 height: "100%", 275 videoId: youtubeid, 276 playerVars: { 277 playlist: youtubeid, 278 iv_load_policy: 3, 279 enablejsapi: 1, 280 disablekb: 1, 281 autoplay: 1, 282 controls: 0, 283 showinfo: 0, 284 rel: 0, 285 loop: 1, 286 wmode: "transparent" 287 }, 288 events: { 289 onReady: function (event) { 290 event.target.mute().setLoop(!0) 291 } 292 } 293 }), jeg_resizevideobg(wrapper), jQuery(window).bind("resize", function () { 294 jeg_resizevideobg(wrapper) 295 }); 296 }); 297 }; 298})(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.