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

1 line
1.7 KiB
JavaScript

(function(f){var e,b,d;function a(){var j=f("#wp-auth-check"),k=f("#wp-auth-check-form"),h=e.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){e.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+40+"px")}}else{if(!m||!m.length){e.addClass("fallback");j.css("max-height","");k.remove();h.focus()}}}).attr("src",k.data("src"));f("#wp-auth-check-form").append(l)}e.removeClass("hidden");if(l){l.focus();setTimeout(function(){if(!i){e.addClass("fallback");k.remove();h.focus()}},10000)}else{h.focus()}}function c(){f(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)}e.fadeOut(200,function(){e.addClass("hidden").css("display","");f("#wp-auth-check-frame").remove()})}function g(){var h=parseInt(window.authcheckL10n.interval,10)||180;d=(new Date()).getTime()+(h*1000)}f(document).on("heartbeat-tick.wp-auth-check",function(i,h){if("wp-auth-check" in h){g();if(!h["wp-auth-check"]&&e.hasClass("hidden")){a()}else{if(h["wp-auth-check"]&&!e.hasClass("hidden")){c()}}}}).on("heartbeat-send.wp-auth-check",function(i,h){if((new Date()).getTime()>d){h["wp-auth-check"]=true}}).ready(function(){g();e=f("#wp-auth-check-wrap");e.find(".wp-auth-check-close").on("click",function(h){c()})})}(jQuery));