mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-10 18:37:58 +01:00
Logged out warnings: by default run the logged-out check every 3 min. Tag along if something else is using heartbeat. See #23295
git-svn-id: http://core.svn.wordpress.org/trunk@24271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7583005842
commit
1114e817c2
@ -1,6 +1,6 @@
|
|||||||
// Interim login dialog
|
// Interim login dialog
|
||||||
(function($){
|
(function($){
|
||||||
var wrap;
|
var wrap, check, timeout;
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
var parent = $('#wp-auth-check'), form = $('#wp-auth-check-form'), noframe = wrap.find('.wp-auth-fallback-expired'), frame, loaded = false;
|
var parent = $('#wp-auth-check'), form = $('#wp-auth-check-form'), noframe = wrap.find('.wp-auth-fallback-expired'), frame, loaded = false;
|
||||||
@ -69,19 +69,41 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function schedule() {
|
||||||
|
check = false;
|
||||||
|
window.clearTimeout( timeout );
|
||||||
|
timeout = window.setTimeout( function(){ check = true; }, 180000 ); // 3 min.
|
||||||
|
}
|
||||||
|
|
||||||
$( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
|
$( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
|
||||||
|
if ( check )
|
||||||
|
schedule();
|
||||||
|
|
||||||
if ( data['wp-auth-check'] && wrap.hasClass('hidden') ) {
|
if ( data['wp-auth-check'] && wrap.hasClass('hidden') ) {
|
||||||
show();
|
show();
|
||||||
} else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') && ! wrap.data('logged-in') ) {
|
} else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') && ! wrap.data('logged-in') ) {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
}).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
|
|
||||||
data['wp-auth-check'] = 1;
|
|
||||||
}).ready( function() {
|
}).ready( function() {
|
||||||
wrap = $('#wp-auth-check-wrap').data('logged-in', 0);
|
schedule();
|
||||||
|
wrap = $('#wp-auth-check-wrap').data( 'logged-in', 0 );
|
||||||
wrap.find('.wp-auth-check-close').on( 'click', function(e) {
|
wrap.find('.wp-auth-check-close').on( 'click', function(e) {
|
||||||
hide();
|
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;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
Loading…
Reference in New Issue
Block a user