WordPress/wp-includes/js/wp-auth-check.min.js

1 line
1.8 KiB
JavaScript
Raw Normal View History

(function(e){var d,b,g;function a(){var j=e("#wp-auth-check"),k=e("#wp-auth-check-form"),h=d.find(".wp-auth-fallback-expired"),l,i=false;if(k.length){e(window).on("beforeunload.wp-auth-check",function(m){m.originalEvent.returnValue=window.authcheckL10n.beforeunload});l=e('<iframe id="wp-auth-check-frame" frameborder="0">').attr("title",h.text());l.load(function(o){var n,m;i=true;try{m=e(this).contents().find("body");n=m.height()}catch(o){d.addClass("fallback");j.css("max-height","");k.remove();h.focus();return}if(n){if(m&&m.hasClass("interim-login-success")){c()}else{j.css("max-height",n+60+"px")}}else{if(!m||!m.length){d.addClass("fallback");j.css("max-height","");k.remove();h.focus()}}}).attr("src",k.data("src"));e("#wp-auth-check-form").append(l)}d.removeClass("hidden");if(l){l.focus();setTimeout(function(){if(!i){d.addClass("fallback");k.remove();h.focus()}},10000)}else{h.focus()}}function c(){e(window).off("beforeunload.wp-auth-check");if(typeof adminpage!="undefined"&&(adminpage=="post-php"||adminpage=="post-new-php")&&typeof wp!="undefined"&&wp.heartbeat){wp.heartbeat.interval("fast",1)}d.fadeOut(200,function(){d.addClass("hidden").css("display","").find(".wp-auth-check-close").css("display","");e("#wp-auth-check-frame").remove()})}function f(){b=false;window.clearTimeout(g);g=window.setTimeout(function(){b=1},300000)}e(document).on("heartbeat-tick.wp-auth-check",function(i,h){if(b===2){f()}if(h["wp-auth-check"]&&d.hasClass("hidden")){a()}else{if(!h["wp-auth-check"]&&!d.hasClass("hidden")){c()}}}).ready(function(){f();d=e("#wp-auth-check-wrap");d.find(".wp-auth-check-close").on("click",function(h){c()});e(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));