wp/wp-includes/js/wp-auth-check.js
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    14 			$(window).on( 'beforeunload.wp-auth-check', function(e) {
    14 			$(window).on( 'beforeunload.wp-auth-check', function(e) {
    15 				e.originalEvent.returnValue = window.authcheckL10n.beforeunload;
    15 				e.originalEvent.returnValue = window.authcheckL10n.beforeunload;
    16 			});
    16 			});
    17 
    17 
    18 			frame = $('<iframe id="wp-auth-check-frame" frameborder="0">').attr( 'title', noframe.text() );
    18 			frame = $('<iframe id="wp-auth-check-frame" frameborder="0">').attr( 'title', noframe.text() );
    19 			frame.load( function() {
    19 			frame.on( 'load', function() {
    20 				var height, body;
    20 				var height, body;
    21 
    21 
    22 				loaded = true;
    22 				loaded = true;
       
    23 				// Remove the spinner to avoid unnecessary CPU/GPU usage.
       
    24 				form.removeClass( 'loading' );
    23 
    25 
    24 				try {
    26 				try {
    25 					body = $(this).contents().find('body');
    27 					body = $(this).contents().find('body');
    26 					height = body.height();
    28 					height = body.height();
    27 				} catch(e) {
    29 				} catch(e) {
    44 					form.remove();
    46 					form.remove();
    45 					noframe.focus();
    47 					noframe.focus();
    46 				}
    48 				}
    47 			}).attr( 'src', form.data('src') );
    49 			}).attr( 'src', form.data('src') );
    48 
    50 
    49 			$('#wp-auth-check-form').append( frame );
    51 			form.append( frame );
    50 		}
    52 		}
    51 
    53 
    52 		$( 'body' ).addClass( 'modal-open' );
    54 		$( 'body' ).addClass( 'modal-open' );
    53 		wrap.removeClass('hidden');
    55 		wrap.removeClass('hidden');
    54 
    56 
    73 
    75 
    74 		// When on the Edit Post screen, speed up heartbeat after the user logs in to quickly refresh nonces
    76 		// When on the Edit Post screen, speed up heartbeat after the user logs in to quickly refresh nonces
    75 		if ( typeof adminpage !== 'undefined' && ( adminpage === 'post-php' || adminpage === 'post-new-php' ) &&
    77 		if ( typeof adminpage !== 'undefined' && ( adminpage === 'post-php' || adminpage === 'post-new-php' ) &&
    76 			typeof wp !== 'undefined' && wp.heartbeat ) {
    78 			typeof wp !== 'undefined' && wp.heartbeat ) {
    77 
    79 
       
    80 			$(document).off( 'heartbeat-tick.wp-auth-check' );
    78 			wp.heartbeat.connectNow();
    81 			wp.heartbeat.connectNow();
    79 		}
    82 		}
    80 
    83 
    81 		wrap.fadeOut( 200, function() {
    84 		wrap.fadeOut( 200, function() {
    82 			wrap.addClass('hidden').css('display', '');
    85 			wrap.addClass('hidden').css('display', '');