mirror of
https://github.com/WordPress/WordPress.git
synced 2024-08-19 20:33:00 +02:00
git-svn-id: http://core.svn.wordpress.org/trunk@24534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1.8 KiB
JavaScript
1 line
1.8 KiB
JavaScript
(function(f){var e,c,h,a;function b(){var k=f("#wp-auth-check"),l=f("#wp-auth-check-form"),i=e.find(".wp-auth-fallback-expired"),m,j=false;if(l.length){f(window).on("beforeunload.wp-auth-check",function(n){n.originalEvent.returnValue=window.authcheckL10n.beforeunload});m=f('<iframe id="wp-auth-check-frame" frameborder="0">').attr("title",i.text());m.load(function(p){var o,n;j=true;try{n=f(this).contents().find("body");o=n.height()}catch(p){e.addClass("fallback");l.remove();i.focus();return}if(o){if(n&&n.hasClass("interim-login-success")){o+=35;k.find(".wp-auth-check-close").show();e.data("logged-in",1);a=setTimeout(function(){d()},3000)}k.css("max-height",o+60+"px")}}).attr("src",l.data("src"));f("#wp-auth-check-form").append(m)}e.removeClass("hidden");if(m){m.focus();setTimeout(function(){if(!j){e.addClass("fallback");l.remove();i.focus()}},5000)}else{i.focus()}}function d(){f(window).off("beforeunload.wp-auth-check");window.clearTimeout(a);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","").find(".wp-auth-check-close").css("display","");f("#wp-auth-check-frame").remove()})}function g(){c=false;window.clearTimeout(h);h=window.setTimeout(function(){c=1},300000)}f(document).on("heartbeat-tick.wp-auth-check",function(j,i){if(c===2){g()}if(i["wp-auth-check"]&&e.hasClass("hidden")){b()}else{if(!i["wp-auth-check"]&&!e.hasClass("hidden")&&!e.data("logged-in")){d()}}}).ready(function(){g();e=f("#wp-auth-check-wrap").data("logged-in",0);e.find(".wp-auth-check-close").on("click",function(i){d()});f(document).on("heartbeat-send.wp-auth-check",function(m,l){var j,k=true;for(j in l){if(l.hasOwnProperty(j)){k=false;break}}if(c||!k){l["wp-auth-check"]=1}if(c){c=2}})})}(jQuery)); |