vendor: 4,468 bytes, lines 1-8
1/** 2 * Featherlight - ultra slim jQuery lightbox 3 * Version 1.2.3 - http://noelboss.github.io/featherlight/ 4 * 5 * Copyright 2015, Noël Raoul Bossart (http://www.noelboss.com) 6 * MIT Licensed. 7**/ 8!function(a){"use strict";function b(a,c){if(!(this instanceof b)){var d=new b(a,c);return d.open(),d}this.id=b.id++,this.setup(a,c),this.chainCallbacks(b._callbackChain)}if("undefined"==typeof a)return void("console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery."));var c=[],d=function(b){return c=a.grep(c,function(a){return a!==b&&a.$instance.closest("body").length>0})},e=function(a,b){var c={},d=new RegExp("^"+b+"([A-Z])(.*)");for(var e in a){var f=e.match(d);if(f){var g=(f[1]+f[2].replace(/([A-Z])/g,"-$1")).toLowerCase();c[g]=a[e]}}return c},f={keyup:"onKeyUp",resize:"onResize"},g=function(c){a.each(b.opened().reverse(),function(){return c.isDefaultPrevented()||!1!==this[f[c.type]](c)?void 0:(c.preventDefault(),c.stopPropagation(),!1)})},h=function(c){if(c!==b._globalHandlerInstalled){b._globalHandlerInstalled=c;var d=a.map(f,function(a,c){return c+"."+b.prototype.namespace}).join(" ");a(window)[c?"on":"off"](d,g)}};b.prototype={constructor:b,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"✕",loading:"",otherClose:null,beforeOpen:a.noop,beforeContent:a.noop,beforeClose:a.noop,afterOpen:a.noop,afterContent:a.noop,afterClose:a.noop,onKeyUp:a.noop,onResize:a.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(b,c){"object"!=typeof b||b instanceof a!=!1||c||(c=b,b=void 0);var d=a.extend(this,c,{target:b}),e=d.resetCss?d.namespace+"-reset":d.namespace,f=a(d.background||['<div class="'+e+"-loading "+e+'">','<div class="'+e+'-content">','<span class="'+e+"-close-icon "+d.namespace+'-close">',d.closeIcon,"</span>",'<div class="'+d.namespace+'-inner">'+d.loading+"</div>","</div>","</div>"].join("")),g="."+d.namespace+"-close"+(d.otherClose?","+d.otherClose:"");return d.$instance=f.clone().addClass(d.variant),d.$instance.on(d.closeTrigger+"."+d.namespace,function(b){var c=a(b.target);("background"===d.closeOnClick&&c.is("."+d.namespace)||"anywhere"===d.closeOnClick||c.closest(g).length)&&(b.preventDefault(),d.close())}),this},getContent:function(){var b=this,c=this.constructor.contentFilters,d=function(a){return b.$currentTarget&&b.$currentTarget.attr(a)},e=d(b.targetAttr),f=b.target||e||"",g=c[b.type];if(!g&&f in c&&(g=c[f],f=b.target&&e),f=f||d("href")||"",!g)for(var h in c)b[h]&&(g=c[h],f=b[h]);if(!g){var i=f;if(f=null,a.each(b.contentFilters,function(){return g=c[this],g.test&&(f=g.test(i)),!f&&g.regex&&i.match&&i.match(g.regex)&&(f=i),!f}),!f)return"console"in window&&window.console.error("Featherlight: no content filter found "+(i?' for "'+i+'"':" (no target specified)")),!1}return g.process.call(b,f)},setContent:function(b){var c=this;return(b.is("iframe")||a("iframe",b).length>0)&&c.$instance.addClass(c.namespace+"-iframe"),c.$instance.removeClass(c.namespace+"-loading"),c.$instance.find("."+c.namespace+"-inner").slice(1).remove().end().replaceWith(a.contains(c.$instance[0],b[0])?"":b),c.$content=b.addClass(c.namespace+"-inner"),c},open:function(b){var d=this;if(d.$instance.hide().appendTo(d.root),!(b&&b.isDefaultPrevented()||d.beforeOpen(b)===!1)){b&&b.preventDefault();var e=d.getContent();if(e)return c.push(d),h(!0),d.$instance.fadeIn(d.openSpeed),d.beforeContent(b),a.when(e).always(function(a){d.setContent(a),d.afterContent(b)}).then(d.$instance.promise()).done(function(){d.afterOpen(b)})}return d.$instance.detach(),a.Deferred().reject().promise()},close:function(b){var c=this,e=a.Deferred();return c.beforeClose(b)===!1?e.reject():(0===d(c).length&&h(!1),c.$instance.fadeOut(c.closeSpeed,function(){c.$instance.detach(),c.afterClose(b),e.resolve()})),e.promise()},chainCallbacks:function(b){for(var c in b)this[c]=a.proxy(b[c],this,a.proxy(this[c],this))}},a.extend(b,{id:0,autoBind:"[data-featherlight]",defaults:b.prototype,contentFilters:{jquery:{regex:/^[#.]\w/,test:function(b){return b instanceof a&&b},process:function(b){return a(b).clone(!0)}},image:{regex:/\.(png|jpg|jpeg|gif|tiff|bmp)(\?\S*)?$/i,process:function(b){var c=this,d=a.Deferred(),e=new Image,f=a('<img src="'+b+'" alt="" class="'+c.namespace+'-image" />');
8return e.onload=function(){f.naturalWidth=e.width,f.naturalHeight=e.height,d.resolve(f)},e.onerror=function(){d.reject(f)},e.src=b,d.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(b){return a(b)}},ajax:{regex:/./,process:function(b){var c=a.Deferred(),d=a("<div></div>").load(b,function(a,b){"error"!==b&&c.resolve(d.contents()),c.fail()});return c.promise()}},iframe:{process:function(b){var c=new a.Deferred,d=a("<iframe/>").hide().attr("src",b).css(e(this,"iframe")).on("load",function(){c.resolve(d.show())}).appendTo(this.$instance.find("."+this.namespace+"-content"));return c.promise()}},text:{process:function(b){return a("<div>",{text:b})}}},functionAttributes:["beforeOpen","afterOpen","beforeContent","afterContent","beforeClose","afterClose"],readElementConfig:function(b,c){var d=this,e=new RegExp("^data-"+c+"-(.*)"),f={};return b&&b.attributes&&a.each(b.attributes,function(){var b=this.name.match(e);if(b){var c=this.value,g=a.camelCase(b[1]);if(a.inArray(g,d.functionAttributes)>=0)c=new Function(c);else try{c=a.parseJSON(c)}catch(h){}f[g]=c}}),f},extend:function(b,c){var d=function(){this.constructor=b};return d.prototype=this.prototype,b.prototype=new d,b.__super__=this.prototype,a.extend(b,this,c),b.defaults=b.prototype,b},attach:function(b,c,d){var e=this;"object"!=typeof c||c instanceof a!=!1||d||(d=c,c=void 0),d=a.extend({},d);var f=d.namespace||e.defaults.namespace,g=a.extend({},e.defaults,e.readElementConfig(b[0],f),d);return b.on(g.openTrigger+"."+g.namespace,g.filter,function(f){var h=a.extend({$source:b,$currentTarget:a(this)},e.readElementConfig(b[0],g.namespace),e.readElementConfig(this,g.namespace),d);new e(c,h).open(f)}),b},current:function(){var a=this.opened();return a[a.length-1]||null},opened:function(){var b=this;return d(),a.grep(c,function(a){return a instanceof b})},close:function(){var a=this.current();return a?a.close():void 0},_onReady:function(){var b=this;b.autoBind&&(b.attach(a(document),{filter:b.autoBind}),a(b.autoBind).filter("[data-featherlight-filter]").each(function(){b.attach(a(this))}))},_callbackChain:{onKeyUp:function(a,b){return 27===b.keyCode?(this.closeOnEsc&&this.$instance.find("."+this.namespace+"-close:first").click(),!1):a(b)},onResize:function(a,b){if(this.$content.naturalWidth){var c=this.$content.naturalWidth,d=this.$content.naturalHeight;this.$content.css("width","").css("height","");var e=Math.max(c/parseInt(this.$content.parent().css("width"),10),d/parseInt(this.$content.parent().css("height"),10));e>1&&this.$content.css("width",""+c/e+"px").css("height",""+d/e+"px")}return a(b)},afterContent:function(a,b){var c=a(b);return this.onResize(b),c}}}),a.featherlight=b,a.fn.featherlight=function(a,c){return b.attach(this,a,c)},a(document).ready(function(){b._onReady()})}(jQuery); 9 10//----------------------------------------------- 11//banner light window common functions. 12function setCookie_BannerLightWindow(cname, cvalue, extime) { 13 var d = new Date(); d.setTime(d.getTime() + (extime)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires; 14}//End of function setCookie 15function getCookie_BannerLightWindow(cname) { 16 var name = cname + "="; var ca = document.cookie.split(';'); 17 for(var i=0; i<ca.length; i++) { var c = ca[i]; 18 while (c.charAt(0)==' ') c = c.substring(1); 19 if (c.indexOf(name) == 0) return c.substring(name.length, c.length); 20 } return ""; 21}//End of function getCookie 22 23function timer_banner() { 24 count_banner=count_banner-1; 25 if (count_banner <= 0) { 26 clearInterval(counter_banner); //counter ended, do something here 27 jQuery('.featherlight-close-wait-msg').css('display', 'none'); jQuery('.featherlight-close-icon').css('display', 'block'); jQuery('.featherlight-close-icon').html('Close Window [X] '); 28 return; 29 } document.getElementById("close_wait_timer").innerHTML=count_banner; 30}//End of function timer 31 32function isMeJWPlayerScript(scriptElem){ 33 if (scriptElem) { if (scriptElem.search(/content\.jwplatform\.com/ig) > 0) { return true; } } return false; 34}//End of function isMeJWPlayerScript 35 36function windowSize_bannerLightWindow() { 37 //isJWPlayerBanner is global variable. 38 if (isJWPlayerBanner) { //if jwplayer then only do this. for regular images it already doing. 39 var windowWidth_bannerLightWindow_resize = jQuery(window).width(); //retrieve current window width 40 if (windowWidth_bannerLightWindow_resize <= mobileScreenWidthCheck) { //to check into mobile. 41 jQuery('.featherlight-inner').css('width', (windowWidth_bannerLightWindow_resize - 30) +'px'); 42 } else { jQuery('.featherlight-inner').css('width', '550px'); /*for regular browser of pc.*/ } 43 }//End of if (isJWPlayerBanner) 44}//End of function windowSize_bannerLightWindow 45//----------------------------------------------- 46 47//*********************************************************************************************************** 48 49//WPB-3597 50//DFP Video vast url separate functions..... 51function bannerAjaxLoad_bannerLightWindow_DFPVideoTag( trigger_time, ext_allowed, is_ext, videoTagID, videoDFPTag, skipDFPVal, uniqueIndexVal) { 52 if(ext_allowed==1 && is_ext==0){ console.log('external traffic condition... false'); return false; } 53 //------------------------------- //WD-508 set cookie to check no of hits refresh and if reach then dis
53play light window and then clear cookie again. 54 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); 55 if (noOfHits) { noOfHits = parseInt(noOfHits) + 1; setCookie_BannerLightWindow('bannerLightWindowHits', noOfHits ,365*24*60*60*1000); } else { setCookie_BannerLightWindow('bannerLightWindowHits', 1 ,365*24*60*60*1000); } 56 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); //after set again get. 57 if (noOfHits >= refresh_hits) { setCookie_BannerLightWindow('bannerLightWindowHits', 0 ,365*24*60*60*1000); } else { console.log('bannerLightWindowHits condition false...'); return false; } 58 if(trigger_time>0){ expTimeCookie = getCookie_BannerLightWindow('bannerLightWindowExpTime'); console.log('Trigger time >> '+ trigger_time + ' : ' + expTimeCookie ); if(expTimeCookie!=''){ console.log('bannerLightWindowExpTime condition false...'); return false; } } 59 setCookie_BannerLightWindow('bannerLightWindowExpTime', 0 ,trigger_time*60*1000); 60 //-------------------------------- 61 //setTimeout(openLightWindow_DFPVideoTag, 1000, videoTagID, videoDFPTag, skipDFPVal); 62 //jQuery('#banner-ajax-div-bannerLightWindow').html('<div style="height:300px;width:600px;" class="banner-loading-div-class"><br /><br /> <br /><br /></div>'); 63 64 var urlVal = '/wp-content/plugins/wpb-banner-light-window/dfp_video_tag_ajax.php?bannerDFPVideoAjax=true'; 65 urlVal = urlVal+'&http_prefix='+httpSiteVal+'&WPBC_URI='+wpbcPlugUrl+'&uniqueIndex='+uniqueIndexVal+'&MY_VIDEO='+videoTempUrl+'&MY_VIDEO_POSTER='+videoPosterUrl+'&ads_video='+videoDFPTag+'&dfp_video_ad_skip_x_sec='+skipDFPVal; 66 urlVal = urlVal+'&width='+lightWindowWidth+'&height='+lightWindowHeight+'&mute='+vastPlaybackMute+'&randAjax='+Math.random(); 67 68 setTimeout(openLightWindow_DFPVideoTag, 1000, videoTagID, videoDFPTag, skipDFPVal, urlVal); 69}//End of function bannerAjaxLoad_bannerLightWindow_DFPVideoTag 70 71function closeLightWindow_DFPVideoTag() { 72 jQuery.featherlight.close(); 73} 74 75function openLightWindow_DFPVideoTag(videoTagID, videoDFPTag, skipDFPVal, urlVal) { 76 var lightWinWidthVal = 640; 77 if (lightWindowWidth) { lightWinWidthVal = lightWindowWidth; } 78 79 var lightWinHeightVal = 390; 80 if (lightWindowHeight) { lightWinHeightVal = lightWindowHeight; } 81 82 //--------------------------- 83 //mobile check : WPB-3852 84 var w_doc = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || document.body.offsetWidth; 85 var h_doc = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || document.body.offsetHeight; 86 87 if (w_doc < lightWinWidthVal) { 88 lightWinWidthVal = w_doc - 20; 89 lightWinHeightVal = 250; 90 } 91 92 if (navigator.userAgent.match(/iPhone/i) || 93 navigator.userAgent.match(/iPad/i) || 94 navigator.userAgent.match(/Android/i)) { 95 } 96 //--------------------------- 97 98 //-------------------------------------------open lightwindow start----------------------------------------- 99 var configuration = ({ 100 afterOpen: function(event){ 101 jQuery('.featherlight-inner').attr('allow', 'autoplay'); //iframe of light window. 102 jQuery('.featherlight-inner').attr('allowfullscreen', true); 103 104 jQuery('.featherlight-close-icon').css('width', '160px'); 105 jQuery('.featherlight-close-icon').parent().prepend('<span class="featherlight-close-wait-msg">You can continue in <span id="close_wait_timer">'+count_banner+'</span> seconds</span><br />'); 106 jQuery('.featherlight-close-wait-msg').css('width', '240px'); jQuery('.featherlight').css('background-color', 'rgba(0, 0, 0, 0.8)'); 107 108 counter_banner=setInterval(timer_banner, 1000); 109 }, 110 beforeOpen: function(event) { 111 112 }, closeOnClick : false, closeIcon : '', 113 afterClose: function(event) { 114 115 }, 116 loading:'Loading.....', 117 //iframe need to play video vast url into light window. 118 iframe: urlVal, iframeMaxWidth: '100%', iframeWidth: lightWinWidthVal, iframeHeight: lightWinHeightVal 119 }); 120 121 try { 122 jQuery.featherlight('.banner_light_window_ajaxcontent', configuration); 123 //jQuery.featherlight({iframe: urlVal, iframeMaxWidth: '100%', iframeWidth: 630, iframeHeight: 380}); 124 } catch(e) { } 125 //-------------------------------------------open lightwindow end----------------------------------------- 126}//End of function openLightWindow_DFPVideoTag 127 128//*********************************************************************************************************** 129//DFP Banners separate functions..... 130function bannerAjaxLoad_bannerLightWindow_DFPBanner( trigger_time, ext_allowed, is_ext, bannerId_DFP, bannerBinSlug_DFP, bannerDFPTag ) { 131 if(ext_allowed==1 && is_ext==0){ console.log('external traffic condition... false'); return false; } 132 //------------------------------- //WD-508 set cookie to check no of hits refresh and if reach then dis
132play light window and then clear cookie again. 133 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); 134 if (noOfHits) { noOfHits = parseInt(noOfHits) + 1; setCookie_BannerLightWindow('bannerLightWindowHits', noOfHits ,365*24*60*60*1000); } else { setCookie_BannerLightWindow('bannerLightWindowHits', 1 ,365*24*60*60*1000); } 135 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); //after set again get. 136 if (noOfHits >= refresh_hits) { setCookie_BannerLightWindow('bannerLightWindowHits', 0 ,365*24*60*60*1000); } else { console.log('bannerLightWindowHits condition false...'); return false; } 137 if(trigger_time>0){ expTimeCookie = getCookie_BannerLightWindow('bannerLightWindowExpTime'); console.log('Trigger time >> '+ trigger_time + ' : ' + expTimeCookie ); if(expTimeCookie!=''){ console.log('bannerLightWindowExpTime condition false...'); return false; } } 138 setCookie_BannerLightWindow('bannerLightWindowExpTime', 0 ,trigger_time*60*1000); 139 140 //jQuery('#banner-ajax-div-bannerLightWindow').html('<div style="height:200px;width:600px;" class="banner-loading-div-class"><br /><br /> <br /><br /></div>'); 141 142 var urlVal = '/wp-content/plugins/wpb-banner-light-window/dfp_banners_ajax.php?bannerDFPBannerAjax=true'; 143 urlVal = urlVal+'&dfp_location='+bannerBinSlug_DFP+'&dfp_bannerbin_id='+bannerId_DFP+'&siteId='+advSiteId; 144 urlVal = urlVal+'&ads_dfp='+bannerDFPTag; 145 urlVal = urlVal+'&width='+lightWindowWidth+'&height='+lightWindowHeight+'&randAjax='+Math.random(); 146 147 setTimeout(openLightWindow_DFPBanner, 1000, urlVal); 148}//End of function bannerAjaxLoad_bannerLightWindow_DFPBanner 149 150function resizeIFrameToFitContent( iFrame ) { 151 var widthVal = jQuery('.featherlight iframe').contents().find("iframe").width(); 152 var heightVal = jQuery('.featherlight iframe').contents().find("iframe").height(); 153 if (widthVal && widthVal != 'undefined' && widthVal != null) { 154 widthVal = parseInt(widthVal) + 40; 155 jQuery('.featherlight iframe').width( widthVal ); 156 jQuery('.featherlight-content').width( widthVal ); 157 } 158 159 if (heightVal && heightVal != 'undefined' && heightVal != null) { 160 heightVal = parseInt(heightVal) + 60; 161 var heightVal_iframe = parseInt(heightVal); 162 var heightVal_div = parseInt(heightVal) + 30; 163 jQuery('.featherlight iframe').height( heightVal_iframe ); 164 jQuery('.featherlight-content').height( heightVal_div ); 165 } 166}//End of function resizeIFrameToFitContent 167 168function openLightWindow_DFPBanner(urlVal) { 169 var lightWinWidthVal = 640; 170 if (lightWindowWidth) { lightWinWidthVal = lightWindowWidth; } 171 172 var lightWinHeightVal = 200; 173 if (lightWindowHeight) { lightWinHeightVal = lightWindowHeight; } 174 //-------------------------------------------open lightwindow start----------------------------------------- 175 var configuration = ({ 176 afterOpen: function(event){ 177 jQuery('.featherlight-close-icon').css('width', '160px'); 178 jQuery('.featherlight-close-icon').parent().prepend('<span class="featherlight-close-wait-msg">You can continue in <span id="close_wait_timer">'+count_banner+'</span> seconds</span><br />'); 179 jQuery('.featherlight-close-wait-msg').css('width', '240px'); jQuery('.featherlight').css('background-color', 'rgba(0, 0, 0, 0.8)'); 180 181 counter_banner=setInterval(timer_banner, 1000); 182 //bannerCode_ForLightWindow = jQuery('.banner-light-window-ajax-div-class').html(); 183 }, 184 beforeOpen: function(event) { 185 186 }, closeOnClick : false, closeIcon : '', 187 afterClose: function(event) { 188 189 }, 190 loading:'Loading.....', 191 iframe: urlVal, iframeMaxWidth: '100%', iframeWidth: lightWinWidthVal, iframeHeight: lightWinHeightVal 192 }); 193 194 try { 195 //jQuery('.banner-light-window-ajax-div-class').show(); 196 jQuery.featherlight('.banner_light_window_ajaxcontent', configuration); 197 if (lightWindowWidth) { 198 //if set from backend then no need to adjust automatic. 199 } 200 else { 201 setTimeout( resizeIFrameToFitContent , 7000 ); 202 } 203 } catch(e) { } 204 //-------------------------------------------open lightwindow end----------------------------------------- 205}//End of function openLightWindow_DFPBanner 206 207//*********************************************************************************************************** 208//WPB-3862 209function bannerAjaxLoad_bannerLightWindow_VideoPreroll( trigger_time, ext_allowed, is_ext, videoPrerollPlaylistId, isMobile ) { 210 if(ext_allowed==1 && is_ext==0){ console.log('external traffic condition... false'); return false; } 211 //------------------------------- //WD-508 set cookie to check no of hits refresh and if reach then dis
211play light window and then clear cookie again. 212 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); 213 if (noOfHits) { noOfHits = parseInt(noOfHits) + 1; setCookie_BannerLightWindow('bannerLightWindowHits', noOfHits ,365*24*60*60*1000); } else { setCookie_BannerLightWindow('bannerLightWindowHits', 1 ,365*24*60*60*1000); } 214 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); //after set again get. 215 if (noOfHits >= refresh_hits) { setCookie_BannerLightWindow('bannerLightWindowHits', 0 ,365*24*60*60*1000); } else { console.log('bannerLightWindowHits condition false...'); return false; } 216 if(trigger_time>0){ expTimeCookie = getCookie_BannerLightWindow('bannerLightWindowExpTime'); console.log('Trigger time >> '+ trigger_time + ' : ' + expTimeCookie ); if(expTimeCookie!=''){ console.log('bannerLightWindowExpTime condition false...'); return false; } } 217 setCookie_BannerLightWindow('bannerLightWindowExpTime', 0 ,trigger_time*60*1000); 218 219 //jQuery('#banner-ajax-div-bannerLightWindow').html('<div style="height:200px;width:600px;" class="banner-loading-div-class"><br /><br /> <br /><br /></div>'); 220 var urlVal = '/wp-content/plugins/wpb-banner-light-window/video_preroll_playlist_ajax.php?bannerVideoPrerollAjax=true'; 221 urlVal = urlVal+'&videoPrerollPlaylistId='+videoPrerollPlaylistId+'&siteId='+advSiteId+'&isMobile='+isMobile; 222 urlVal = urlVal+'&width='+lightWindowWidth+'&height='+lightWindowHeight+'&randAjax='+Math.random(); 223 224 setTimeout(openLightWindow_VideoPreroll, 500, urlVal, isMobile); 225}//End of function bannerAjaxLoad_bannerLightWindow_VideoPreroll 226 227function openLightWindow_VideoPreroll(urlVal, isMobile) { 228 var lightWinWidthVal = 610; 229 if (lightWindowWidth) { lightWinWidthVal = lightWindowWidth; } 230 231 var lightWinHeightVal = 360; 232 if (isMobile == '1' || isMobile == 1) { 233 lightWinHeightVal = 190; 234 } 235 if (lightWindowHeight) { lightWinHeightVal = lightWindowHeight; } 236 //-------------------------------------------open lightwindow start----------------------------------------- 237 var configuration = ({ 238 afterOpen: function(event){ 239 jQuery('.featherlight-close-icon').css('width', '160px'); 240 jQuery('.featherlight-close-icon').parent().prepend('<span class="featherlight-close-wait-msg">You can continue in <span id="close_wait_timer">'+count_banner+'</span> seconds</span><br />'); 241 jQuery('.featherlight-close-wait-msg').css('width', '250px'); jQuery('.featherlight').css('background-color', 'rgba(0, 0, 0, 0.8)'); 242 counter_banner=setInterval(timer_banner, 1000); 243 }, 244 beforeOpen: function(event) { 245 246 }, closeOnClick : false, closeIcon : '', 247 afterClose: function(event) { 248 249 }, 250 loading:'Loading.....', 251 iframe: urlVal, iframeMaxWidth: '100%', iframeWidth: lightWinWidthVal, iframeHeight: lightWinHeightVal 252 }); 253 254 try { 255 jQuery.featherlight('.banner_light_window_ajaxcontent', configuration); 256 } catch(e) { } 257 //-------------------------------------------open lightwindow end----------------------------------------- 258}//End of function openLightWindow_DFPBanner 259 260// ====================================================================== 261// WPB-6424 262const expirationTime_BannerLight = 24 * 60 * 60 * 1000; // 1 day 263// Check if 'usedBanners' and its timestamp are stored in localStorage 264function checkUsedBannersExpiration() { 265 const storedTimestamp = localStorage.getItem('usedBannersTimestamp'); 266 if (storedTimestamp) { 267 const currentTime = Date.now(); 268 const timeDifference = currentTime - parseInt(storedTimestamp); 269 // If the data is older than the expiration time, clear 'usedBanners' from localStorage 270 if (timeDifference > expirationTime_BannerLight) { 271 console.log('usedBanners data has expired. Clearing...'); 272 localStorage.removeItem('usedBanners'); 273 localStorage.removeItem('usedBannersTimestamp'); // Remove the timestamp as well 274 } 275 } 276} 277// Function to store 'usedBanners' with a timestamp 278function storeUsedBanners(usedBanners) { 279 const currentTime = Date.now(); 280 localStorage.setItem('usedBanners', JSON.stringify(usedBanners)); // Store the usedBanners 281 localStorage.setItem('usedBannersTimestamp', currentTime.toString()); // Store the current timestamp 282} 283function pickup_banner_one_by_one(bannerId, data_available_arr_lightwindow) { 284 // Check for expiration when the page loads 285 checkUsedBannersExpiration(); 286 287 // Initialize or update 'usedBanners' on page load 288 var usedBanners = JSON.parse(localStorage.getItem('usedBanners')) || []; 289 290 // If no usedBanners data or it's expired, initialize it 291 if (usedBanners.length === 0) { 292 //console.log('Initializing new usedBanners data'); 293 usedBanners = []; 294 storeUsedBanners(usedBanners); // Store the empty array and timestamp 295 } 296 297 // Check if there are still available banners left to choose 298 var availableBanners = data_available_arr_lightwindow.filter(id => !usedBanners.includes(id)); 299 300 // If there are no available banners, reset the used banners 301 if (availableBanners.length === 0) { 302 //console.log('All banners used, resetting...'); 303 usedBanners = []; 304 availableBanners = data_available_arr_lightwindow.slice(); 305 } 306 307 // Pick a random bannerId from the remaining available banners 308 var randomIndex = Math.floor(Math.random() * availableBanners.length); 309 bannerId = availableBanners[randomIndex]; 310 311 // Add the selected bannerId to the used banners list 312 usedBanners.push(bannerId); 313 314 // Store the updated usedBanners and timestamp in localStorage 315 storeUsedBanners(usedBanners); 316 317 //console.log('>>> bannerId : '+bannerId); 318 return bannerId; 319} 320// ====================================================================== 321 322//--------------------------func start---------------------------------- 323function bannerAjaxLoad_bannerLightWindow(bannerId, dataAvailable, bannerInstance, bannerBinSlug, bannerBinId, trigger_time, ext_allowed, is_ext, chk_this) { console.log('trigger banner lightwindow...'); 324 if(ext_allowed==1 && is_ext==0){ console.log('external traffic condition... false'); return false; } 325 //------------------------------- //WD-508 set cookie to check no of hits refresh and if reach then dis
325play light window and then clear cookie again. 326 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); 327 if (noOfHits) { noOfHits = parseInt(noOfHits) + 1; setCookie_BannerLightWindow('bannerLightWindowHits', noOfHits ,365*24*60*60*1000); } else { setCookie_BannerLightWindow('bannerLightWindowHits', 1 ,365*24*60*60*1000); } 328 noOfHits = getCookie_BannerLightWindow('bannerLightWindowHits'); //after set again get. 329 if (noOfHits >= refresh_hits) { setCookie_BannerLightWindow('bannerLightWindowHits', 0 ,365*24*60*60*1000); } else { console.log('bannerLightWindowHits condition false...'); return false; } 330 if(trigger_time>0){ expTimeCookie = getCookie_BannerLightWindow('bannerLightWindowExpTime'); console.log('Trigger time >> '+ trigger_time + ' : ' + expTimeCookie ); if(expTimeCookie!=''){ console.log('bannerLightWindowExpTime condition false...'); return false; } } 331 setCookie_BannerLightWindow('bannerLightWindowExpTime', 0 ,trigger_time*60*1000); 332 //-------------------------------- 333 // WPB-6424 334 var index_banner_lightwindow = 0; 335 var data_available_arr_lightwindow = new Array(); 336 if (dataAvailable) { 337 data_available_arr_lightwindow = dataAvailable.split(","); 338 } 339 if (data_available_arr_lightwindow.length > 0) { 340 try { // use localStorage js things to give one by one banner on each refresh. 341 bannerId = pickup_banner_one_by_one(bannerId, data_available_arr_lightwindow); 342 } 343 catch(e) { // js to pickup random 344 console.log('here in catch banner light window........'); 345 index_banner_lightwindow = Math.floor(Math.random() * data_available_arr_lightwindow.length); 346 bannerId = data_available_arr_lightwindow[index_banner_lightwindow]; 347 } 348 } 349 var urlVal = advPlugUrl + 'advertise-ajax.php?bannerAjax=true&callFromFile=ajax-reload.php&bannerLightWindow=true&bannerId='+bannerId+'&dataAvailable='+dataAvailable+'&bannerInstance='+bannerInstance+'&siteId='+advSiteId+'&bannerBinSlug='+bannerBinSlug+'&bannerbinId='+bannerBinId+'&_wpnonce='+chk_this; 350 351 jQuery('#banner-ajax-div-bannerLightWindow').html('<div style="height:200px;width:250px;" class="banner-loading-div-class"><br /><br /> <br /><br /></div>'); //console.log('banner lightwindow url : '+urlVal); 352 jQuery.ajax({ type: "GET", url: urlVal, async: true, 353 success: function(data) { isJWPlayerBanner = false; //global variable. 354 if (data) { var isJWPlayerBannerCodePosition = data.search(/content\.jwplatform\.com/ig); if(isJWPlayerBannerCodePosition > 0) { isJWPlayerBanner = true; } 355 var isSimpleBannerImageCodePosition = data.search(/cloudfront.net/ig); if(isSimpleBannerImageCodePosition > 0) { isSimpleBannerImage = true; } 356 var isYoutubeBannerCodePosition = data.search(/youtube.com/ig); if(isYoutubeBannerCodePosition > 0) { isYoutubeBanner = true; } 357 } jQuery('#banner-ajax-div-bannerLightWindow').html(data); 358 if (data) { 359 if (isJWPlayerBanner) { //Now, get the id from the script tag. 360 divBannerContObj = document.getElementById('banner-ajax-div-bannerLightWindow'); var scripts = divBannerContObj.getElementsByTagName("script") 361 for (var i = 0; i < scripts.length; ++i) { 362 if( isMeJWPlayerScript(scripts[i].src)) { jwPlayerScriptSrcBanner = scripts[i].src; 363 if (jwPlayerScriptSrcBanner) { 364 var filenameJwPlayer = jwPlayerScriptSrcBanner.substring(jwPlayerScriptSrcBanner.lastIndexOf('/')+1); 365 if (filenameJwPlayer) { fileNameArr = filenameJwPlayer.split('.'); jwPlayerIdBanner = fileNameArr[0]; } 366 } } 367 }//End of for (var i = 0; i < scripts.length; ++i) 368 setTimeout(openLightWindow, 2000, data, isJWPlayerBanner); //2 second delay. 369 } else { 370 if (isSimpleBannerImage || isYoutubeBanner) { setTimeout(openLightWindow, 1000, data, isJWPlayerBanner); /*1 second delay.*/ } 371 else { setTimeout(openLightWindow, 5000, data, isJWPlayerBanner); /*5 second delay. some dalay for DFP text banner code. */ } 372 } 373 }//End of if (data) 374 }//End of success function. 375 }) .done( function( data ) { /*openLightWindow(); // Handles successful responses only */ }) 376}//End of function bannerAjaxLoad_bannerLightWindow 377//--------------------------func end---------------------------------- 378 379function openLightWindow(htmlResponse, isJWPlayerParam) { 380 isJWPlayerBanner = isJWPlayerParam; //if (isJWPlayerParam) { return; /*if donot want to check jwplayer. */ } 381 //-------------------------------------------open lightwindow start----------------------------------------- 382 var configuration = ({ 383 afterOpen: function(event){ jQuery('.featherlight-close-icon').css('width', '160px'); 384 jQuery('.featherlight-close-icon').parent().prepend('<span class="featherlight-close-wait-msg">You can continue in <span id="close_wait_timer">'+count_banner+'</span> seconds</span>'); 385 if (isJWPlayerParam) { //both are global variable. windowWidth_bannerLightWindow and mobileScreenWidthCheck 386 if (windowWidth_bannerLightWindow <= mobileScreenWidthCheck) { //to check into mobile. 387 jQuery('.featherlight-content').prepend('<span class="featherlight-please-wait-msg">
387Loading JW Player, Please Wait.....</span><span> </span>'); //added one more span to display close button properly into google chrome device window f12 388 } else { jQuery('.featherlight-content').prepend('<span class="featherlight-please-wait-msg">Loading JW Player, Please Wait.....</span>'); } 389 } 390 jQuery('.featherlight-close-wait-msg').css('width', '240px'); jQuery('.featherlight').css('background-color', 'rgba(0, 0, 0, 0.8)'); 391 counter_banner=setInterval(timer_banner, 1000); bannerCode_ForLightWindow = jQuery('.banner-light-window-ajax-div-class').html(); 392 if (bannerCode_ForLightWindow) { jQuery('.banner-light-window-ajax-div-class').html(''); //make banner div empty. 393 if (isJWPlayerParam) { if (windowWidth_bannerLightWindow <= mobileScreenWidthCheck) { //to check into mobile. 394 jQuery('.featherlight-inner').css('width', (windowWidth_bannerLightWindow - 30) +'px'); 395 } else { jQuery('.featherlight-inner').css('width', '550px'); /* windowWidth_bannerLightWindow = 1583 , for regular pc. */ } 396 }//End of if (isJWPlayerParam) 397 jQuery('.featherlight-inner').html(bannerCode_ForLightWindow); //set content from banner div to light window div. 398 if (isJWPlayerParam) { //after getting palyer into lightwindow, on click just play and banner link redirect. 399 jQuery('.featherlight-content').find('.banner-bg').click(function(){ 400 if (jwPlayerIdBanner) { var divIdJwPlayer = jwPlayerIdBanner.replace("-", "_"); var fullJwPlayerId = "botr_"+divIdJwPlayer+"_div"; jwplayer(fullJwPlayerId).play(true); //jwplayer("botr_d150HAW4_fO6ZMgVT_div").play(true); //checked by adding static. 401 this.remove(); } 402 }); 403 }//End of if (isJWPlayerParam) 404 var res_bannerLightWindow = bannerCode_ForLightWindow.match(/bannerbin cache file is not found./gi); 405 if (res_bannerLightWindow == 'bannerbin cache file is not found.') { jQuery('.featherlight-inner').html('Sorry, it did not find banner bin cache file. Please regenerate it by editing Banner Bin from the backend.'); } 406 } else { jQuery('.banner-light-window-ajax-div-class').html(''); /*make banner div empty.*/ } 407 if (isJWPlayerParam) { setTimeout(function(){ jQuery('.featherlight-please-wait-msg').css('display', 'none'); /*jQuery('.featherlight-close-icon').css('top', -5);*/ }, 3000); /*3 seconds wait message only for jw player because its taking time to load. */ } 408 }, 409 beforeOpen: function(event){ if (isJWPlayerParam) { bannerCode_ForLightWindow = jQuery('.banner-light-window-ajax-div-class').html(); } else { bannerCode_ForLightWindow = jQuery('.banner-light-window-ajax-div-class').html(); /*get banner div value and store into variable. */ } 410 }, closeOnClick : false, closeIcon : '', 411 afterClose: function(event) { if (isSurveyPage) { //WD-1114 //document.getElementById('jplayeriframe').contentWindow.playVid(); //if in iframe. 412 jQuery("#jquery_jplayer_1").jPlayer("play"); jQuery("#play-btn").addClass("hidden"); jQuery("#pause-btn").removeClass("hidden"); 413 }//End of if (isSurveyPage) 414 } 415 }); 416 try { jQuery.featherlight('.banner_light_window_ajaxcontent', configuration); /*if featherlight window got then only call.*/ } catch(e) { //jQuery.featherlight is not a function -- e.message, sometimes got this. so, called callBannerLightWindow() fun again. 417 if (isJWPlayerParam) { //in case , if we want to do something more code only for jwplayer text banner. //bannerCode_ForLightWindow = jQuery('#botr_d150HAW4_fO6ZMgVT_div_wrapper').html(); 418 bannerCode_ForLightWindow = jQuery('.banner-light-window-ajax-div-class').html(); 419 } else { bannerCode_ForLightWindow = jQuery('.banner-light-window-ajax-div-class').html(); /*first get code and store into js variable.*/ } //jQuery('.banner-light-window-ajax-div-class').html(''); //make banner div empty. 420 /*if (!isJWPlayerParam) {*/ callBannerLightWindow(); //send ajax request again, in case if featherlight is not loaded proplery and we are into cache condtion. /*}*/ 421 } 422 //-------------------------------------------open lightwindow end----------------------------------------- 423}//End of function openLightWindow 424 425//***********************************************************************************************************
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.