mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 06:38:42 +02:00
git-svn-id: http://core.svn.wordpress.org/trunk@24742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1.7 KiB
JavaScript
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)); |