diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index 9fd22a5a7d..8cb0e3bfc8 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -7187,7 +7187,7 @@ body.interim-login { .interim-login #login { padding: 0; - margin: 25px auto 20px; + margin: 5px auto 20px; } .interim-login.login h1 a { diff --git a/wp-includes/css/wp-auth-check.css b/wp-includes/css/wp-auth-check.css index 6a4c56f597..f51017b59f 100644 --- a/wp-includes/css/wp-auth-check.css +++ b/wp-includes/css/wp-auth-check.css @@ -24,10 +24,10 @@ overflow: hidden; top: 40px; bottom: 20px; - max-height: 435px; + max-height: 415px; width: 380px; margin: 0 0 0 -190px; - padding: 0; + padding: 30px 0 0; background-color: #fbfbfb; -webkit-border-radius: 3px; border-radius: 3px; @@ -40,7 +40,7 @@ } #wp-auth-check-wrap #wp-auth-check-form { - background: url('../images/wpspin-2x.gif') no-repeat center center; + background: url(../images/wpspin-2x.gif) no-repeat center center; background-size: 16px 16px; height: 100%; } @@ -52,10 +52,19 @@ } #wp-auth-check-wrap .wp-auth-check-close { - bottom: 10px; - display: none; position: absolute; - right: 30px; + top: 8px; + right: 8px; + height: 14px; + width: 14px; + cursor: pointer; + background-image: url(../images/uploader-icons.png); + background-repeat: no-repeat; + background-position: -100px 0; +} + +#wp-auth-check-wrap .wp-auth-check-close:focus { + outline: 1px dotted #888; } #wp-auth-check-wrap .wp-auth-fallback-expired { @@ -65,7 +74,7 @@ #wp-auth-check-wrap .wp-auth-fallback { font-size: 14px; line-height: 21px; - padding: 10px 25px; + padding: 0 25px; display: none; } @@ -74,3 +83,12 @@ display: block; } +@media print, + (-o-min-device-pixel-ratio: 5/4), + (-webkit-min-device-pixel-ratio: 1.25), + (min-resolution: 120dpi) { + #wp-auth-check-wrap .wp-auth-check-close { + background-image: url(../images/uploader-icons-2x.png); + background-size: 134px 15px; + } +} diff --git a/wp-includes/functions.php b/wp-includes/functions.php index eb9715d463..856f657b2f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3943,6 +3943,7 @@ function wp_auth_check_html() {
'1' ) ); - return array_merge( $response, array( 'wp-auth-check' => '1' ) ); + return array_merge( $response, array( 'wp-auth-check' => 'show' ) ); } /** @@ -4018,4 +4018,4 @@ function _canonical_charset( $charset ) { return 'ISO-8859-1'; return $charset; -} \ No newline at end of file +} diff --git a/wp-includes/js/wp-auth-check.js b/wp-includes/js/wp-auth-check.js index aa2b1ddcb0..21b3c96750 100644 --- a/wp-includes/js/wp-auth-check.js +++ b/wp-includes/js/wp-auth-check.js @@ -1,6 +1,6 @@ // Interim login dialog (function($){ - var wrap, check, scheduleTimeout; + var wrap, check, next; function show() { var parent = $('#wp-auth-check'), form = $('#wp-auth-check-form'), noframe = wrap.find('.wp-auth-fallback-expired'), frame, loaded = false; @@ -32,7 +32,7 @@ if ( body && body.hasClass('interim-login-success') ) hide(); else - parent.css( 'max-height', height + 60 + 'px' ); + parent.css( 'max-height', height + 40 + 'px' ); } else if ( ! body || ! body.length ) { // Catch "silent" iframe origin exceptions in WebKit after another page is loaded in the iframe wrap.addClass('fallback'); @@ -74,49 +74,34 @@ } wrap.fadeOut( 200, function() { - wrap.addClass('hidden').css('display', '').find('.wp-auth-check-close').css('display', ''); + wrap.addClass('hidden').css('display', ''); $('#wp-auth-check-frame').remove(); }); } function schedule() { - check = false; - window.clearTimeout( scheduleTimeout ); - scheduleTimeout = window.setTimeout( function(){ check = 1; }, 300000 ); // 5 min. + var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180; // in seconds, default 3 min. + next = ( new Date() ).getTime() + ( interval * 1000 ); } $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) { - if ( check === 2 ) + if ( data['wp-auth-check'] ) { schedule(); - if ( data['wp-auth-check'] && wrap.hasClass('hidden') ) { - show(); - } else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') ) { - hide(); + if ( data['wp-auth-check'] == 'show' && wrap.hasClass('hidden') ) + show(); + else if ( data['wp-auth-check'] != 'show' && ! wrap.hasClass('hidden') ) + hide(); } + }).on( 'heartbeat-send.wp-auth-check', function( e, data ) { + if ( ( new Date() ).getTime() > next ) + data['wp-auth-check'] = 1; }).ready( function() { schedule(); wrap = $('#wp-auth-check-wrap'); wrap.find('.wp-auth-check-close').on( 'click', function(e) { hide(); }); - // Bind later - $( document ).on( 'heartbeat-send.wp-auth-check', function( e, data ) { - var i, empty = true; - // Check if something is using heartbeat. If yes, trigger the logged out check too. - for ( i in data ) { - if ( data.hasOwnProperty( i ) ) { - empty = false; - break; - } - } - - if ( check || ! empty ) - data['wp-auth-check'] = 1; - - if ( check ) - check = 2; - }); }); }(jQuery)); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index c8ac6c66d5..300fea9874 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -113,6 +113,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 ); did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array( 'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'), + 'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ), ) ); $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );