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