!function(a,b){function c(){function a(){"undefined"!=typeof _wpmejsSettings&&(c=b.extend(!0,{},_wpmejsSettings)),c.classPrefix="mejs-",c.success=c.success||function(a){var b,c;a.rendererName&&-1!==a.rendererName.indexOf("flash")&&(b=a.attributes.autoplay&&"false"!==a.attributes.autoplay,c=a.attributes.loop&&"false"!==a.attributes.loop,b&&a.addEventListener("canplay",function(){a.play()},!1),c&&a.addEventListener("ended",function(){a.play()},!1))},c.customError=function(a,b){if(-1!==a.rendererName.indexOf("flash")||-1!==a.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-video"]+""},b(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!b(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(c)}var c={};return{initialize:a}}a.wp=a.wp||{},a.wp.mediaelement=new c,b(a.wp.mediaelement.initialize)}(window,jQuery); (function($){ $.fn.DiviVideoLightbox=function(options){ var DiviVideoLightboxOptions=$.extend({ autoplay:1 }, options); $(this).on('click', function(e){ var localfile=true; var videoLink=$(this).attr("href"); var videowidth='100'; if(typeof $(this).attr('data-widthpercent')!=="undefined"){ videowidth=$(this).attr("data-widthpercent"); } var videoloop=''; if(typeof $(this).attr('data-videoloop')!=="undefined"){ videoloop=$(this).attr("data-videoloop"); } var videolightboxredirect=''; var videolightboxredirectnewwindow=''; if(typeof $(this).attr('videolightboxredirect')!=="undefined"){ videolightboxredirect=$(this).attr("videolightboxredirect"); videolightboxredirectnewwindow=$(this).attr("videolightboxredirectnewwindow"); } if(videoLink.match(/(youtube.com)/)){ var split_c="v="; var split_n=1; localfile=false; } if(videoLink.match(/(youtu.be)/)||videoLink.match(/(vimeo.com\/)+[0-9]/)){ var split_c="/"; var split_n=3; localfile=false; } if(videoLink.match(/(vimeo.com\/)+[a-zA-Z]/)){ var split_c="/"; var split_n=5; localfile=false; } var getYouTubeVideoID=''; var cleanVideoID=''; if(localfile==false){ getYouTubeVideoID=videoLink.split(split_c)[split_n]; cleanVideoID=getYouTubeVideoID.replace(/(&)+(.*)/, ""); } var videolooping=''; if(videoLink.match(/(youtu.be)/)||videoLink.match(/(youtube.com)/)){ if(videoloop=='on'){ videolooping="&loop=1&playlist="+cleanVideoID; } var videoEmbedLink="https://www.youtube.com/embed/"+cleanVideoID+"?autoplay="+DiviVideoLightboxOptions.autoplay+videolooping+"&rel=0"; }else if(videoLink.match(/(vimeo.com\/)+[0-9]/)||videoLink.match(/(vimeo.com\/)+[a-zA-Z]/)){ if(videoloop=='on'){ videolooping='&loop=1'; } var videoEmbedLink="https://player.vimeo.com/video/"+cleanVideoID+"?autoplay="+DiviVideoLightboxOptions.autoplay+videolooping; }else{ localfile=true; var autoplayflag=''; if(DiviVideoLightboxOptions.autoplay==1){ autoplayflag='autoplay'; } if(videoloop=='on'){ videolooping=' loop="loop" '; } var videoEmbedLink=''; } if(localfile){ $("body").append('
'+videoEmbedLink+'
'); $('.VideoPopUp-Content').css('width',videowidth+'%'); }else{ $("body").append('
'); } if(typeof $(this).attr('data-bgcolor')!=="undefined"){ var s=$(this).attr("data-bgcolor"); var rgbatest=s.substring(0, 4); if(rgbatest!=='rgba'){ var patt=/^#([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})$/; var matches=patt.exec(s); var rgb="rgba("+parseInt(matches[1], 16)+","+parseInt(matches[2], 16)+","+parseInt(matches[3], 16)+",0.8)"; }else{ var rgb=s; } $('.VideoPopUp-Wrap').css('background-color',rgb); } if($('.VideoPopUp-Wrap').hasClass('VideoPopUp-animation')){ setTimeout(function(){ $('.VideoPopUp-Wrap').removeClass("VideoPopUp-animation"); }, 600); } $(".VideoPopUp-Wrap, .VideoPopUp-Close").click(function(e){ $(".VideoPopUp-Wrap").addClass("VideoPopUp-Hide").delay(515).queue(function(){ $(this).remove(); if(videolightboxredirect!=''){ window.open(videolightboxredirect, videolightboxredirectnewwindow); }}); }); $(".VideoPopUp-Content").click(function(e){ e.stopPropagation(); }); e.preventDefault(); }); $(document).keyup(function(e){ if(e.keyCode==27){ $('.VideoPopUp-Wrap, .VideoPopUp-Close').click(); }}); };}(jQuery)); jQuery(function(){ jQuery("a.videolightbox").DiviVideoLightbox({ autoplay:0 }); jQuery("a.videolightboxautoplay").DiviVideoLightbox(); }); jQuery(document).ready(function($){ if($("a.poponload").length){ var onloadlightbox=$(document).find("a.poponload"); onloadlightbox.click(); } if($("a.poponexit").length){ var onexitlightbox=$(document).find("a.poponexit"); var popexited=false; $(document).mousemove(function(e){ if(e.pageY <=5){ if(popexited==false){ popexited=true; onexitlightbox.click(); }} }); } if($("a.poponscroll").length){ var onscrolllightbox=$(document).find("a.poponscroll"); var popscrollpercent=$(document).find("a.poponscroll").attr("data-poponscroll"); var popscrolled=false; $(document).scroll(function(e){ var scrollAmount=$(window).scrollTop(); var documentHeight=$(document).height(); var windowHeight=$(window).height(); var scrollPercent=(scrollAmount /(documentHeight - windowHeight)) * 100; var roundScroll=Math.round(scrollPercent); if(scrollPercent>=popscrollpercent){ if(popscrolled==false){ popscrolled=true; onscrolllightbox.click(); }} }); } if($("a.popontime").length){ var ontimelightbox=$(document).find("a.popontime"); var time=$(document).find("a.popontime").attr("data-popontime"); setTimeout(function(){ ontimelightbox.click(); }, time); } if($("a.videolightboxtriggered").length){ var popupids=new Array(); var rows=document.querySelectorAll('.videolightboxtriggered').length; for(i=0; i < rows; i++){ popupids[i]=$(document).find(".videolightboxtriggered").eq(i).attr("videolightid"); } $("a, input, img, div, span, textarea, select, ul, li, button").click(function(e){ for(var i=0; i < popupids.length; i++){ if($(this).hasClass(popupids[i])){ var popupid="[videolightid='"+popupids[i]+"']"; var popup=$(popupid); var localfile=true; var videoLink=popup.attr("href"); var autoplayoption=0; if(popup.hasClass("videolightboxautoplay")){ autoplayoption=1; } var videolightboxredirect=''; var videolightboxredirectnewwindow=''; if(typeof popup.attr('videolightboxredirect')!=="undefined"){ videolightboxredirect=popup.attr("videolightboxredirect"); videolightboxredirectnewwindow=popup.attr("videolightboxredirectnewwindow"); } var videowidth='100'; if(typeof popup.attr('data-widthpercent')!=="undefined"){ videowidth=popup.attr("data-widthpercent"); } var videoloop=''; if(typeof $(this).attr('data-videoloop')!=="undefined"){ videoloop=$(this).attr("data-videoloop"); } if(videoLink.match(/(youtube.com)/)){ var split_c="v="; var split_n=1; localfile=false; } if(videoLink.match(/(youtu.be)/)||videoLink.match(/(vimeo.com\/)+[0-9]/)){ var split_c="/"; var split_n=3; localfile=false; } if(videoLink.match(/(vimeo.com\/)+[a-zA-Z]/)){ var split_c="/"; var split_n=5; localfile=false; } var getYouTubeVideoID=''; var cleanVideoID=''; if(localfile==false){ getYouTubeVideoID=videoLink.split(split_c)[split_n]; cleanVideoID=getYouTubeVideoID.replace(/(&)+(.*)/, ""); } var videolooping=''; if(videoLink.match(/(youtu.be)/)||videoLink.match(/(youtube.com)/)){ if(videoloop=='on'){ videolooping='&loop=1'; } var videoEmbedLink="https://www.youtube.com/embed/"+cleanVideoID+"?autoplay="+autoplayoption+videolooping+"&rel=0"; }else if(videoLink.match(/(vimeo.com\/)+[0-9]/)||videoLink.match(/(vimeo.com\/)+[a-zA-Z]/)){ if(videoloop=='on'){ videolooping='&loop=1'; } var videoEmbedLink="https://player.vimeo.com/video/"+cleanVideoID+"?autoplay="+autoplayoption+videolooping; }else{ localfile=true; var autoplayflag=''; if(autoplayoption==1){ autoplayflag='autoplay'; } if(videoloop=='on'){ videolooping=' loop="loop" '; } var videoEmbedLink=''; } if(localfile){ $("body").append('
'+videoEmbedLink+'
'); }else{ $("body").append('
'); } if(typeof popup.attr('data-bgcolor')!=="undefined"){ var s=popup.attr("data-bgcolor"); var rgbatest=s.substring(0, 4); if(rgbatest!=='rgba'){ var patt=/^#([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})$/; var matches=patt.exec(s); var rgb="rgba("+parseInt(matches[1], 16)+","+parseInt(matches[2], 16)+","+parseInt(matches[3], 16)+",0.8)"; }else{ var rgb=s; } $('.VideoPopUp-Wrap').css('background-color',rgb); } if($('.VideoPopUp-Wrap').hasClass('VideoPopUp-animation')){ setTimeout(function(){ $('.VideoPopUp-Wrap').removeClass("VideoPopUp-animation"); }, 600); } $(".VideoPopUp-Wrap, .VideoPopUp-Close").click(function(e){ $(".VideoPopUp-Wrap").addClass("VideoPopUp-Hide").delay(515).queue(function(){ $(this).remove(); if(videolightboxredirect!=''){ window.open(videolightboxredirect, videolightboxredirectnewwindow); }}); }); $(".VideoPopUp-Content").click(function(e){ e.stopPropagation(); }); $(document).keyup(function(e){ if(e.keyCode==27){ $('.VideoPopUp-Wrap, .VideoPopUp-Close').click(); }}); e.preventDefault(); }} }); }});