- md5
- e4e84e2f31361641bd8fa91d53a3b86c
- sha1
- 3fef7753e7604b290454f01a7287fcae8b1e0887
- sha256
- a1aa391388f18ba50a8addcf9ae66277a358851aaebc7a6e5f1c391fd69950d1
window.wp=window.wp||{},function(C){function e(){var n,o,e,r,i,a,t,c,u,f=this,s="undefined"!=typeof pagenow?pagenow:"",w="undefined"!=typeof ajaxurl?ajaxurl:"",d=0,h={},l=0,p=0,b=!0,m=-1,v=null;function g(e){return e?parseInt((new Date).getTime()/1e3):(new Date).getTime()}function y(e){var t,n=e.src;if(!n||!/^https?:\/\//.test(n)||(t=window.location.origin||window.location.protocol+"//"+window.location.host,0===n.indexOf(t)))try{if(e.contentWindow.document)return 1}catch(e){}}function x(e,t){var n;if(e){switch(e){case"abort":break;case"timeout":n=!0;break;case"parsererror":case"error":case"empty":case"unknown":2<++p&&(n=!0)}(n=503==t&&!1===v?!0:n)&&!f.hasConnectionError()&&(v=!0,C(document).trigger("heartbeat-connection-lost",[e,t]))}else f.hasConnectionError()?(p=0,v=!1,C(document).trigger("heartbeat-connection-restored")):null===v&&(v=!1)}function k(){var e,t,n={},o=!0,a="object"==typeof window.heartbeatSettings?window.heartbeatSettings.nonce:"";for(t in d=g(),e=C.extend({},h),h={},C(document).trigger("heartbeat-send",[e]),e)if(e.hasOwnProperty(t)){o=!1;break}if(o&&!f.hasConnectionError())return i=!1,void T();n.data=e,n.interval=r/1e3,n._nonce=a,n.action="heartbeat",n.screen_id=s,n.has_focus=b,i=!0,f.xhr=C.ajax({url:w,type:"post",timeout:3e4,data:n,dataType:"json"}).done(function(e,t,n){var o;return e?(f.hasConnectionError()&&x(),void(e.nonces_expired?C(document).trigger("heartbeat-nonces-expired"):(e.heartbeat_interval&&(o=e.heartbeat_interval,delete e.heartbeat_interval),f.tick(e,t,n),o&&f.interval.call(f,o)))):x("empty")}).always(function(){i=!1,T()}).fail(function(e,t,n){x(t||"unknown",e.status),f.error(e,t,n)})}function T(){var e=g()-d,t=r;n&&(b?0<l&&a&&(t=a,l--):t=1e5,window.clearTimeout(o),e<t?o=window.setTimeout(function(){n&&k()},t-e):k())}function j(){window.clearTimeout(u),window.clearTimeout(m),u=m=0,b=!1}function _(){window.clearTimeout(u),window.clearTimeout(m),u=m=0,t=g(),b||(b=!0,window.clearTimeout(o),i||T())}function I(){c=!1,C(document).off(".wp-heartbeat-active"),C("iframe").each(function(e,t){y(t)&&C(t.contentWindow).off(".wp-heartbeat-active")}),_()}this.hasConnectionError=function(){return!!v},"object"==typeof window.heartbeatSettings&&(e=C.extend({},window.heartbeatSettings),w=e.ajaxurl||w,delete e.ajaxurl,delete e.nonce,r=e.interval||15,delete e.interval,r<15?r=15:60<r&&(r=60),r*=1e3,s=s||e.screenId||"front",delete e.screenId,C.extend(this,e)),C(window).on("blur.wp-heartbeat-focus",function(e){!function n(){C("iframe").each(function(e,t){y(t)&&(C.data(t,"wp-heartbeat-focus")||(C.data(t,"wp-heartbeat-focus",1),C(t.contentWindow).on("focus.wp-heartbeat-focus",function(e){_()}).on("blur.wp-heartbeat-focus",function(e){n(),m=window.setTimeout(function(){j()},500)})))})}(),u=window.setTimeout(function(){j()},500)}).on("focus.wp-heartbeat-focus",function(){C("iframe").each(function(e,t){y(t)&&(C.removeData(t,"wp-heartbeat-focus"),C(t.contentWindow).off(".wp-heartbeat-focus"))}),_()}),window.setInterval(function(){3e5<(t?g()-t:0)&&b&&j(),c||(C(document).on("mouseover.wp-heartbeat-active keyup.wp-heartbeat-active",function(){I()}),C("iframe").each(function(e,t){y(t)&&C(t.contentWindow).on("mouseover.wp-heartbeat-active keyup.wp-heartbeat-active",function(){I()})}),c=!0)},3e4),C(document).ready(function(){n=!0,d=g(),T()}),this.hasFocus=function(){return b},this.interval=function(e,t){var n;if(t=(t=parseInt(t,10)||30)<1||30<t?30:t,e){switch(e){case"fast":n=5,l=t;break;case"slow":n=60,l=0;break;case"long-polling":return r=0;default:n=15,l=0}e=1e3*n<r,a=0<l?1e3*n:(r=1e3*n,0),e&&T()}return b?a?a/1e3:r/1e3:120},this.enqueue=function(e,t,n){return!!e&&((!n||!this.isQueued(e))&&(h[e]=t,!0))},this.isQueued=function(e){if(e)return h.hasOwnProperty(e)},this.dequeue=function(e){e&&delete h[e]},this.getQueuedItem=function(e){if(e)return this.isQueued(e)?h[e]:void 0}}C.extend(e.prototype,{tick:function(e,t,n){C(document).trigger("heartbeat-tick",[e,t,n])},error:function(e,t,n){C(document).trigger("heartbeat-error",[e,t,n])}}),wp.heartbeat=new e}(jQuery);
The same content is in 6 releases, WordPress 3.7.36 to 3.7.41. See them all, or every version of this file.