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

1 line
1.7 KiB
JavaScript
Raw Normal View History

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