PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | assets/js/beat.min.js +1 -1 1.10 → trunk View file →
@@ -1 +1 @@
1 -window.imagify=window.imagify||{},function(a,b,c,d){var e=function(){function e(){return(new Date).getTime()}function f(a){var b,d=a.src;if(d&&/^https?:\/\//.test(d)&&(b=c.location.origin?c.location.origin:c.location.protocol+"//"+c.location.host,0!==d.indexOf(b)))return!1;try{if(a.contentWindow.document)return!0}catch(a){}return!1}function g(){B.hasFocus&&!document.hasFocus()?l():!B.hasFocus&&document.hasFocus()&&m()}function h(a,b){var d;if(a){switch(a){case"abort":break;case"timeout":d=!0;break;case"error":if(503===b&&B.hasConnected){d=!0;break}case"parsererror":case"empty":case"unknown":B.errorcount++,B.errorcount>2&&B.hasConnected&&(d=!0)}d&&!q()&&(B.connectionError=!0,A.trigger("imagifybeat-connection-lost",[a,b]),c.wp.hooks&&c.wp.hooks.doAction("imagifybeat.connection-lost",a,b))}}function i(){B.hasConnected=!0,q()&&(B.errorcount=0,B.connectionError=!1,A.trigger("imagifybeat-connection-restored"),c.wp.hooks&&c.wp.hooks.doAction("imagifybeat.connection-restored"))}function j(){var b,d;B.connecting||B.suspend||(B.lastTick=e(),d=a.extend({},B.queue),B.queue={},A.trigger("imagifybeat-send",[d]),c.wp.hooks&&c.wp.hooks.doAction("imagifybeat.send",d),b={data:d,interval:B.tempInterval?B.tempInterval/1e3:B.mainInterval/1e3,_nonce:"object"==typeof c.imagifybeatSettings?c.imagifybeatSettings.nonce:"",action:"imagifybeat",screen_id:B.screenId,has_focus:B.hasFocus},"customize"===B.screenId&&(b.wp_customize="on"),B.connecting=!0,B.xhr=a.ajax({url:B.url,type:"post",timeout:6e4,data:b,dataType:"json"}).always(function(){B.connecting=!1,k()}).done(function(a,b,d){var e;if(!a)return void h("empty");i(),a.nonces_expired&&(A.trigger("imagifybeat-nonces-expired"),c.wp.hooks&&c.wp.hooks.doAction("imagifybeat.nonces-expired")),a.imagifybeat_interval&&(e=a.imagifybeat_interval,delete a.imagifybeat_interval),a.imagifybeat_nonce&&"object"==typeof c.imagifybeatSettings&&(c.imagifybeatSettings.nonce=a.imagifybeat_nonce,delete a.imagifybeat_nonce),A.trigger("imagifybeat-tick",[a,b,d]),c.wp.hooks&&c.wp.hooks.doAction("imagifybeat.tick",a,b,d),e&&u(e)}).fail(function(a,b,d){h(b||"unknown",a.status),A.trigger("imagifybeat-error",[a,b,d]),c.wp.hooks&&c.wp.hooks.doAction("imagifybeat.error",a,b,d)}))}function k(){var a=e()-B.lastTick,b=B.mainInterval;B.suspend||(!B.hasFocus&&B.suspendEnabled?b=12e4:B.countdown>0&&B.tempInterval&&(b=B.tempInterval,--B.countdown<1&&(B.tempInterval=0)),B.minimalInterval&&b<B.minimalInterval&&(b=B.minimalInterval),c.clearTimeout(B.beatTimer),a<b?B.beatTimer=c.setTimeout(function(){j()},b-a):j())}function l(){B.hasFocus=!1}function m(){B.userActivity=e(),B.suspend=!1,B.hasFocus||(B.hasFocus=!0,k())}function n(){B.userActivityEvents=!1,A.off(".imagifybeat-active"),a("iframe").each(function(b,c){f(c)&&a(c.contentWindow).off(".imagifybeat-active")}),m()}function o(){var b=B.userActivity?e()-B.userActivity:0;b>3e5&&B.hasFocus&&l(),B.suspendEnabled&&b>6e5&&(B.suspend=!0),B.userActivityEvents||(A.on("mouseover.imagifybeat-active keyup.imagifybeat-active touchend.imagifybeat-active",function(){n()}),a("iframe").each(function(b,c){f(c)&&a(c.contentWindow).on("mouseover.imagifybeat-active keyup.imagifybeat-active touchend.imagifybeat-active",function(){n()})}),B.userActivityEvents=!0)}function p(){return B.hasFocus}function q(){return B.connectionError}function r(){B.lastTick=0,k()}function s(){B.suspendEnabled=!1}function t(){B.suspendEnabled=!0}function u(a,b){var c,d=B.tempInterval?B.tempInterval:B.mainInterval;if(a){switch(a){case"fast":case 5:c=5e3;break;case 15:c=15e3;break;case 30:c=3e4;break;case 60:c=6e4;break;case 120:c=12e4;break;case"long-polling":return B.mainInterval=0,0;default:c=B.originalInterval}B.minimalInterval&&c<B.minimalInterval&&(c=B.minimalInterval),5e3===c?(b=parseInt(b,10)||30,b=b<1||b>30?30:b,B.countdown=b,B.tempInterval=c):(B.countdown=0,B.tempInterval=0,B.mainInterval=c),c!==d&&k()}return B.tempInterval?B.tempInterval/1e3:B.mainInterval/1e3}function v(){return u(B.originalInterval)}function w(a,b,c){return!!a&&((!c||!this.isQueued(a))&&(B.queue[a]=b,!0))}function x(a){if(a)return B.queue.hasOwnProperty(a)}function y(a){a&&delete B.queue[a]}function z(a){if(a)return this.isQueued(a)?B.queue[a]:d}var A=a(b),B={suspend:!1,suspendEnabled:!0,screenId:"",url:"",lastTick:0,queue:{},mainInterval:60,tempInterval:0,originalInterval:0,minimalInterval:0,countdown:0,connecting:!1,connectionError:!1,errorcount:0,hasConnected:!1,hasFocus:!0,userActivity:0,userActivityEvents:!1,checkFocusTimer:0,beatTimer:0};return function(){var b,d,f,h;"string"==typeof c.pagenow&&(B.screenId=c.pagenow),"string"==typeof c.ajaxurl&&(B.url=c.ajaxurl),"object"==typeof c.imagifybeatSettings&&(b=c.imagifybeatSettings,!B.url&&b.ajaxurl&&(B.url=b.ajaxurl),b.interval&&(B.mainInterval=b.interval,B.mainInterval<15?B.mainInterval=15:B.mainInterval>120&&(B.mainInterval=120)),b.minimalInterval&&(b.minimalInterval=parseInt(b.minimalInterval,10),B.minimalInterval=b.minimalInterval>0&&b.minimalInterval<=600?1e3*b.minimalInterval:0),B.minimalInterval&&B.mainInterval<B.minimalInterval&&(B.mainInterval=B.minimalInterval),B.screenId||(B.screenId=b.screenId||"front"),"disable"===b.suspension&&s()),B.mainInterval=1e3*B.mainInterval,B.originalInterval=B.mainInterval,void 0!==document.hidden?(d="hidden",h="visibilitychange",f="visibilityState"):void 0!==document.msHidden?(d="msHidden",h="msvisibilitychange",f="msVisibilityState"):void 0!==document.webkitHidden&&(d="webkitHidden",h="webkitvisibilitychange",f="webkitVisibilityState"),d&&(document[d]&&(B.hasFocus=!1),A.on(h+".imagifybeat",function(){"hidden"===document[f]?(l(),c.clearInterval(B.checkFocusTimer)):(m(),document.hasFocus&&(B.checkFocusTimer=c.setInterval(g,1e4)))})),document.hasFocus&&(B.checkFocusTimer=c.setInterval(g,1e4)),a(c).on("unload.imagifybeat",function(){B.suspend=!0,B.xhr&&4!==B.xhr.readyState&&B.xhr.abort()}),c.setInterval(o,3e4),A.ready(function(){B.lastTick=e(),k()})}(),{hasFocus:p,connectNow:r,disableSuspend:s,enableSuspend:t,interval:u,resetInterval:v,hasConnectionError:q,enqueue:w,dequeue:y,isQueued:x,getQueuedItem:z}};c.imagify.beat=new e}(jQuery,document,window);
1 +window.imagify=window.imagify||{},function(I,h,w){w.imagify.beat=new function(){var e,n,t,i,a=I(h),o={suspend:!1,suspendEnabled:!0,screenId:"",url:"",lastTick:0,queue:{},mainInterval:60,tempInterval:0,originalInterval:0,minimalInterval:0,countdown:0,connecting:!1,connectionError:!1,errorcount:0,hasConnected:!1,hasFocus:!0,userActivity:0,userActivityEvents:!1,checkFocusTimer:0,beatTimer:0};function r(){return(new Date).getTime()}function c(e){var n,t=e.src;if(!t||!/^https?:\/\//.test(t)||(n=w.location.origin||w.location.protocol+"//"+w.location.host,0===t.indexOf(n)))try{if(e.contentWindow.document)return 1}catch(e){}}function s(){o.hasFocus&&!document.hasFocus()?d():!o.hasFocus&&document.hasFocus()&&v()}function u(e,n){var t;if(e){switch(e){case"abort":break;case"timeout":t=!0;break;case"error":if(503===n&&o.hasConnected){t=!0;break}case"parsererror":case"empty":case"unknown":o.errorcount++,2<o.errorcount&&o.hasConnected&&(t=!0)}t&&!b()&&(o.connectionError=!0,a.trigger("imagifybeat-connection-lost",[e,n]),w.wp.hooks)&&w.wp.hooks.doAction("imagifybeat.connection-lost",e,n)}}function m(){var e;o.connecting||o.suspend||(o.lastTick=r(),e=I.extend({},o.queue),o.queue={},a.trigger("imagifybeat-send",[e]),w.wp.hooks&&w.wp.hooks.doAction("imagifybeat.send",e),e={data:e,interval:o.tempInterval?o.tempInterval/1e3:o.mainInterval/1e3,_nonce:"object"==typeof w.imagifybeatSettings?w.imagifybeatSettings.nonce:"",action:"imagifybeat",screen_id:o.screenId,has_focus:o.hasFocus},"customize"===o.screenId&&(e.wp_customize="on"),o.connecting=!0,o.xhr=I.ajax({url:o.url,type:"post",timeout:6e4,data:e,dataType:"json"}).always(function(){o.connecting=!1,l()}).done(function(e,n,t){var i;e?(o.hasConnected=!0,b()&&(o.errorcount=0,o.connectionError=!1,a.trigger("imagifybeat-connection-restored"),w.wp.hooks)&&w.wp.hooks.doAction("imagifybeat.connection-restored"),e.nonces_expired&&(a.trigger("imagifybeat-nonces-expired"),w.wp.hooks)&&w.wp.hooks.doAction("imagifybeat.nonces-expired"),e.imagifybeat_interval&&(i=e.imagifybeat_interval,delete e.imagifybeat_interval),e.imagifybeat_nonce&&"object"==typeof w.imagifybeatSettings&&(w.imagifybeatSettings.nonce=e.imagifybeat_nonce,delete e.imagifybeat_nonce),a.trigger("imagifybeat-tick",[e,n,t]),w.wp.hooks&&w.wp.hooks.doAction("imagifybeat.tick",e,n,t),i&&p(i)):u("empty")}).fail(function(e,n,t){u(n||"unknown",e.status),a.trigger("imagifybeat-error",[e,n,t]),w.wp.hooks&&w.wp.hooks.doAction("imagifybeat.error",e,n,t)}))}function l(){var e=r()-o.lastTick,n=o.mainInterval;o.suspend||(!o.hasFocus&&o.suspendEnabled?n=12e4:0<o.countdown&&o.tempInterval&&(n=o.tempInterval,o.countdown--,o.countdown<1)&&(o.tempInterval=0),o.minimalInterval&&n<o.minimalInterval&&(n=o.minimalInterval),w.clearTimeout(o.beatTimer),e<n?o.beatTimer=w.setTimeout(function(){m()},n-e):m())}function d(){o.hasFocus=!1}function v(){o.userActivity=r(),o.suspend=!1,o.hasFocus||(o.hasFocus=!0,l())}function f(){o.userActivityEvents=!1,a.off(".imagifybeat-active"),I("iframe").each(function(e,n){c(n)&&I(n.contentWindow).off(".imagifybeat-active")}),v()}function g(){var e=o.userActivity?r()-o.userActivity:0;3e5<e&&o.hasFocus&&d(),o.suspendEnabled&&6e5<e&&(o.suspend=!0),o.userActivityEvents||(a.on("mouseover.imagifybeat-active keyup.imagifybeat-active touchend.imagifybeat-active",function(){f()}),I("iframe").each(function(e,n){c(n)&&I(n.contentWindow).on("mouseover.imagifybeat-active keyup.imagifybeat-active touchend.imagifybeat-active",function(){f()})}),o.userActivityEvents=!0)}function b(){return o.connectionError}function y(){o.suspendEnabled=!1}function p(e,n){var t,i=o.tempInterval||o.mainInterval;if(e){switch(e){case"fast":case 5:t=5e3;break;case 15:t=15e3;break;case 30:t=3e4;break;case 60:t=6e4;break;case 120:t=12e4;break;case"long-polling":return o.mainInterval=0;default:t=o.originalInterval}5e3===(t=o.minimalInterval&&t<o.minimalInterval?o.minimalInterval:t)?(n=parseInt(n,10)||30,o.countdown=n=n<1||30<n?30:n,o.tempInterval=t):(o.countdown=0,o.tempInterval=0,o.mainInterval=t),t!==i&&l()}return o.tempInterval?o.tempInterval/1e3:o.mainInterval/1e3}return"string"==typeof w.pagenow&&(o.screenId=w.pagenow),"string"==typeof w.ajaxurl&&(o.url=w.ajaxurl),"object"==typeof w.imagifybeatSettings&&(e=w.imagifybeatSettings,!o.url&&e.ajaxurl&&(o.url=e.ajaxurl),e.interval&&(o.mainInterval=e.interval,o.mainInterval<15?o.mainInterval=15:120<o.mainInterval&&(o.mainInterval=120)),e.minimalInterval&&(e.minimalInterval=parseInt(e.minimalInterval,10),o.minimalInterval=0<e.minimalInterval&&e.minimalInterval<=600?1e3*e.minimalInterval:0),o.minimalInterval&&o.mainInterval<o.minimalInterval&&(o.mainInterval=o.minimalInterval),o.screenId||(o.screenId=e.screenId||"front"),"disable"===e.suspension)&&y(),o.mainInterval=1e3*o.mainInterval,o.originalInterval=o.mainInterval,void 0!==document.hidden?(n="hidden",i="visibilitychange",t="visibilityState"):void 0!==document.msHidden?(n="msHidden",i="msvisibilitychange",t="msVisibilityState"):void 0!==document.webkitHidden&&(n="webkitHidden",i="webkitvisibilitychange",t="webkitVisibilityState"),n&&(document[n]&&(o.hasFocus=!1),a.on(i+".imagifybeat",function(){"hidden"===document[t]?(d(),w.clearInterval(o.checkFocusTimer)):(v(),document.hasFocus&&(o.checkFocusTimer=w.setInterval(s,1e4)))})),document.hasFocus&&(o.checkFocusTimer=w.setInterval(s,1e4)),I(w).on("unload.imagifybeat",function(){o.suspend=!0,o.xhr&&4!==o.xhr.readyState&&o.xhr.abort()}),w.setInterval(g,3e4),a.ready(function(){o.lastTick=r(),l()}),{hasFocus:function(){return o.hasFocus},connectNow:function(){o.lastTick=0,l()},disableSuspend:y,enableSuspend:function(){o.suspendEnabled=!0},interval:p,resetInterval:function(){return p(o.originalInterval)},hasConnectionError:b,enqueue:function(e,n,t){return!!e&&!(t&&this.isQueued(e)||(o.queue[e]=n,0))},dequeue:function(e){e&&delete o.queue[e]},isQueued:function(e){if(e)return Object.prototype.hasOwnProperty.call(o.queue,e)},getQueuedItem:function(e){return e&&this.isQueued(e)?o.queue[e]:void 0}}}}(jQuery,document,window);