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

1 line
1.7 KiB
JavaScript

!function(h){var d,t;function i(){h(window).off("beforeunload.wp-auth-check"),"undefined"==typeof adminpage||"post-php"!==adminpage&&"post-new-php"!==adminpage||"undefined"==typeof wp||!wp.heartbeat||(h(document).off("heartbeat-tick.wp-auth-check"),wp.heartbeat.connectNow()),d.fadeOut(200,function(){d.addClass("hidden").css("display",""),h("#wp-auth-check-frame").remove(),h("body").removeClass("modal-open")})}function n(){var e=parseInt(window.authcheckL10n.interval,10)||180;t=(new Date).getTime()+1e3*e}h(document).on("heartbeat-tick.wp-auth-check",function(e,a){"wp-auth-check"in a&&(n(),!a["wp-auth-check"]&&d.hasClass("hidden")?function(){var e,t=h("#wp-auth-check"),n=h("#wp-auth-check-form"),c=d.find(".wp-auth-fallback-expired"),o=!1;n.length&&(h(window).on("beforeunload.wp-auth-check",function(e){e.originalEvent.returnValue=window.authcheckL10n.beforeunload}),(e=h('<iframe id="wp-auth-check-frame" frameborder="0">').attr("title",c.text())).on("load",function(){var e,a;o=!0,n.removeClass("loading");try{e=(a=h(this).contents().find("body")).height()}catch(e){return d.addClass("fallback"),t.css("max-height",""),n.remove(),void c.focus()}e?a&&a.hasClass("interim-login-success")?i():t.css("max-height",e+40+"px"):a&&a.length||(d.addClass("fallback"),t.css("max-height",""),n.remove(),c.focus())}).attr("src",n.data("src")),n.append(e)),h("body").addClass("modal-open"),d.removeClass("hidden"),e?(e.focus(),setTimeout(function(){o||(d.addClass("fallback"),n.remove(),c.focus())},1e4)):c.focus()}():a["wp-auth-check"]&&!d.hasClass("hidden")&&i())}).on("heartbeat-send.wp-auth-check",function(e,a){(new Date).getTime()>t&&(a["wp-auth-check"]=!0)}).ready(function(){n(),(d=h("#wp-auth-check-wrap")).find(".wp-auth-check-close").on("click",function(){i()})})}(jQuery);