1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
(function(f){var d,b,e;function a(){var j=f("#wp-auth-check"),k=f("#wp-auth-check-form"),h=d.find(".wp-auth-fallback-expired"),l,i=false;if(k.length){f(window).on("beforeunload.wp-auth-check",function(m){m.originalEvent.returnValue=window.authcheckL10n.beforeunload});l=f('<iframe id="wp-auth-check-frame" frameborder="0">').attr("title",h.text());l.load(function(o){var n,m;i=true;try{m=f(this).contents().find("body");n=m.height()}catch(o){d.addClass("fallback");k.remove();h.focus();return}if(n){if(m&&m.hasClass("interim-login-success")){n+=35;j.find(".wp-auth-check-close").show();d.data("logged-in",1);setTimeout(function(){c()},3000)}j.css("max-height",n+60+"px")}}).attr("src",k.data("src"));f("#wp-auth-check-form").append(l)}d.removeClass("hidden");if(l){l.focus();setTimeout(function(){if(!i){d.addClass("fallback");k.remove();h.focus()}},5000)}else{h.focus()}}function c(){f(window).off("beforeunload.wp-auth-check");d.fadeOut(200,function(){d.addClass("hidden").css("display","").find(".wp-auth-check-close").css("display","");f("#wp-auth-check-frame").remove()})}function g(){b=false;window.clearTimeout(e);e=window.setTimeout(function(){b=1},180000)}f(document).on("heartbeat-tick.wp-auth-check",function(i,h){if(b===2){g()}if(h["wp-auth-check"]&&d.hasClass("hidden")){a()}else{if(!h["wp-auth-check"]&&!d.hasClass("hidden")&&!d.data("logged-in")){c()}}}).ready(function(){g();d=f("#wp-auth-check-wrap").data("logged-in",0);d.find(".wp-auth-check-close").on("click",function(h){c()});f(document).on("heartbeat-send.wp-auth-check",function(l,k){var h,j=true;for(h in k){if(k.hasOwnProperty(h)){j=false;break}}if(b||!j){k["wp-auth-check"]=1}if(b){b=2}})})}(jQuery)); |