wp/wp-admin/js/common.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    53 
    53 
    54 /**
    54 /**
    55  * Deprecate all properties on an object.
    55  * Deprecate all properties on an object.
    56  *
    56  *
    57  * @since 5.5.1
    57  * @since 5.5.1
       
    58  * @since 5.6.0 Added the `version` parameter.
    58  *
    59  *
    59  * @param {string} name       The name of the object, i.e. commonL10n.
    60  * @param {string} name       The name of the object, i.e. commonL10n.
    60  * @param {object} l10nObject The object to deprecate the properties on.
    61  * @param {object} l10nObject The object to deprecate the properties on.
       
    62  * @param {string} version    The version of WordPress that deprecated the property.
    61  *
    63  *
    62  * @return {object} The object with all its properties deprecated.
    64  * @return {object} The object with all its properties deprecated.
    63  */
    65  */
    64 function deprecateL10nObject( name, l10nObject ) {
    66 function deprecateL10nObject( name, l10nObject, version ) {
    65 	var deprecatedObject = {};
    67 	var deprecatedObject = {};
    66 
    68 
    67 	Object.keys( l10nObject ).forEach( function( key ) {
    69 	Object.keys( l10nObject ).forEach( function( key ) {
    68 		var prop = l10nObject[ key ];
    70 		var prop = l10nObject[ key ];
    69 		var propName = name + '.' + key;
    71 		var propName = name + '.' + key;
    70 
    72 
    71 		if ( 'object' === typeof prop ) {
    73 		if ( 'object' === typeof prop ) {
    72 			Object.defineProperty( deprecatedObject, key, { get: function() {
    74 			Object.defineProperty( deprecatedObject, key, { get: function() {
    73 				deprecatedProperty( propName, '5.5.0', prop.alternative );
    75 				deprecatedProperty( propName, version, prop.alternative );
    74 				return prop.func();
    76 				return prop.func();
    75 			} } );
    77 			} } );
    76 		} else {
    78 		} else {
    77 			Object.defineProperty( deprecatedObject, key, { get: function() {
    79 			Object.defineProperty( deprecatedObject, key, { get: function() {
    78 				deprecatedProperty( propName, '5.5.0', 'wp.i18n' );
    80 				deprecatedProperty( propName, version, 'wp.i18n' );
    79 				return prop;
    81 				return prop;
    80 			} } );
    82 			} } );
    81 		}
    83 		}
    82 	} );
    84 	} );
    83 
    85 
    97 	dismiss: '',
    99 	dismiss: '',
    98 	collapseMenu: '',
   100 	collapseMenu: '',
    99 	expandMenu: ''
   101 	expandMenu: ''
   100 };
   102 };
   101 
   103 
   102 window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n );
   104 window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n, '5.5.0' );
   103 
   105 
   104 /**
   106 /**
   105  * Removed in 5.5.0, needed for back-compatibility.
   107  * Removed in 5.5.0, needed for back-compatibility.
   106  *
   108  *
   107  * @since 3.3.0
   109  * @since 3.3.0
   109  */
   111  */
   110 window.wpPointerL10n = window.wpPointerL10n || {
   112 window.wpPointerL10n = window.wpPointerL10n || {
   111 	dismiss: ''
   113 	dismiss: ''
   112 };
   114 };
   113 
   115 
   114 window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n );
   116 window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n, '5.5.0' );
   115 
   117 
   116 /**
   118 /**
   117  * Removed in 5.5.0, needed for back-compatibility.
   119  * Removed in 5.5.0, needed for back-compatibility.
   118  *
   120  *
   119  * @since 4.3.0
   121  * @since 4.3.0
   127 	cancel: '',
   129 	cancel: '',
   128 	ariaShow: '',
   130 	ariaShow: '',
   129 	ariaHide: ''
   131 	ariaHide: ''
   130 };
   132 };
   131 
   133 
   132 window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n );
   134 window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n, '5.5.0' );
   133 
   135 
   134 /**
   136 /**
   135  * Removed in 5.5.0, needed for back-compatibility.
   137  * Removed in 5.5.0, needed for back-compatibility.
   136  *
   138  *
   137  * @since 4.9.6
   139  * @since 4.9.6
   146 	emailSent: '',
   148 	emailSent: '',
   147 	noExportFile: '',
   149 	noExportFile: '',
   148 	exportError: ''
   150 	exportError: ''
   149 };
   151 };
   150 
   152 
   151 window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n );
   153 window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n, '5.5.0' );
   152 
   154 
   153 /**
   155 /**
   154  * Removed in 5.5.0, needed for back-compatibility.
   156  * Removed in 5.5.0, needed for back-compatibility.
   155  *
   157  *
   156  * @since 3.6.0
   158  * @since 3.6.0
   158  */
   160  */
   159 window.authcheckL10n = {
   161 window.authcheckL10n = {
   160 	beforeunload: ''
   162 	beforeunload: ''
   161 };
   163 };
   162 
   164 
   163 window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n );
   165 window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n, '5.5.0' );
   164 
   166 
   165 /**
   167 /**
   166  * Removed in 5.5.0, needed for back-compatibility.
   168  * Removed in 5.5.0, needed for back-compatibility.
   167  *
   169  *
   168  * @since 2.8.0
   170  * @since 2.8.0
   171 window.tagsl10n = {
   173 window.tagsl10n = {
   172 	noPerm: '',
   174 	noPerm: '',
   173 	broken: ''
   175 	broken: ''
   174 };
   176 };
   175 
   177 
   176 window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n );
   178 window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n, '5.5.0' );
   177 
   179 
   178 /**
   180 /**
   179  * Removed in 5.5.0, needed for back-compatibility.
   181  * Removed in 5.5.0, needed for back-compatibility.
   180  *
   182  *
   181  * @since 2.5.0
   183  * @since 2.5.0
   196 	warnCommentChanges: '',
   198 	warnCommentChanges: '',
   197 	docTitleComments: '',
   199 	docTitleComments: '',
   198 	docTitleCommentsCount: ''
   200 	docTitleCommentsCount: ''
   199 };
   201 };
   200 
   202 
   201 window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n );
   203 window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n, '5.5.0' );
   202 
   204 
   203 /**
   205 /**
   204  * Removed in 5.5.0, needed for back-compatibility.
   206  * Removed in 5.5.0, needed for back-compatibility.
   205  *
   207  *
   206  * @since 2.5.0
   208  * @since 2.5.0
   212 	termSelected: '',
   214 	termSelected: '',
   213 	termAdded: '',
   215 	termAdded: '',
   214 	termRemoved: ''
   216 	termRemoved: ''
   215 };
   217 };
   216 
   218 
   217 window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n );
   219 window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n, '5.5.0' );
   218 
   220 
   219 /**
   221 /**
   220  * Removed in 5.5.0, needed for back-compatibility.
   222  * Removed in 5.5.0, needed for back-compatibility.
   221  *
   223  *
   222  * @since 3.5.0
   224  * @since 3.5.0
   229 	defaultAriaLabel: '',
   231 	defaultAriaLabel: '',
   230 	pick: '',
   232 	pick: '',
   231 	defaultLabel: ''
   233 	defaultLabel: ''
   232 };
   234 };
   233 
   235 
   234 window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n );
   236 window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n, '5.5.0' );
   235 
   237 
   236 /**
   238 /**
   237  * Removed in 5.5.0, needed for back-compatibility.
   239  * Removed in 5.5.0, needed for back-compatibility.
   238  *
   240  *
   239  * @since 2.7.0
   241  * @since 2.7.0
   241  */
   243  */
   242 window.attachMediaBoxL10n = window.attachMediaBoxL10n || {
   244 window.attachMediaBoxL10n = window.attachMediaBoxL10n || {
   243 	error: ''
   245 	error: ''
   244 };
   246 };
   245 
   247 
   246 window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n );
   248 window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n, '5.5.0' );
   247 
   249 
   248 /**
   250 /**
   249  * Removed in 5.5.0, needed for back-compatibility.
   251  * Removed in 5.5.0, needed for back-compatibility.
   250  *
   252  *
   251  * @since 2.5.0
   253  * @since 2.5.0
   274 	saveAlert: '',
   276 	saveAlert: '',
   275 	savingText: '',
   277 	savingText: '',
   276 	permalinkSaved: ''
   278 	permalinkSaved: ''
   277 };
   279 };
   278 
   280 
   279 window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n );
   281 window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n, '5.5.0' );
   280 
   282 
   281 /**
   283 /**
   282  * Removed in 5.5.0, needed for back-compatibility.
   284  * Removed in 5.5.0, needed for back-compatibility.
   283  *
   285  *
   284  * @since 2.7.0
   286  * @since 2.7.0
   290 	notitle: '',
   292 	notitle: '',
   291 	comma: '',
   293 	comma: '',
   292 	saved: ''
   294 	saved: ''
   293 };
   295 };
   294 
   296 
   295 window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n );
   297 window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n, '5.5.0' );
   296 
   298 
   297 /**
   299 /**
   298  * Removed in 5.5.0, needed for back-compatibility.
   300  * Removed in 5.5.0, needed for back-compatibility.
   299  *
   301  *
   300  * @since 2.7.0
   302  * @since 2.7.0
   304 	plugin_information: '',
   306 	plugin_information: '',
   305 	plugin_modal_label: '',
   307 	plugin_modal_label: '',
   306 	ays: ''
   308 	ays: ''
   307 };
   309 };
   308 
   310 
   309 window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n );
   311 window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n, '5.5.0' );
   310 
   312 
   311 /**
   313 /**
   312  * Removed in 5.5.0, needed for back-compatibility.
   314  * Removed in 5.5.0, needed for back-compatibility.
   313  *
   315  *
   314  * @since 3.0.0
   316  * @since 3.0.0
   319 	warnDeleteMenu: '',
   321 	warnDeleteMenu: '',
   320 	saveAlert: '',
   322 	saveAlert: '',
   321 	untitled: ''
   323 	untitled: ''
   322 };
   324 };
   323 
   325 
   324 window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n );
   326 window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n, '5.5.0' );
   325 
   327 
   326 /**
   328 /**
   327  * Removed in 5.5.0, needed for back-compatibility.
   329  * Removed in 5.5.0, needed for back-compatibility.
   328  *
   330  *
   329  * @since 2.5.0
   331  * @since 2.5.0
   332 window.commentL10n = window.commentL10n || {
   334 window.commentL10n = window.commentL10n || {
   333 	submittedOn: '',
   335 	submittedOn: '',
   334 	dateFormat: ''
   336 	dateFormat: ''
   335 };
   337 };
   336 
   338 
   337 window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n );
   339 window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n, '5.5.0' );
   338 
   340 
   339 /**
   341 /**
   340  * Removed in 5.5.0, needed for back-compatibility.
   342  * Removed in 5.5.0, needed for back-compatibility.
   341  *
   343  *
   342  * @since 2.9.0
   344  * @since 2.9.0
   347 	saving: '',
   349 	saving: '',
   348 	error: '',
   350 	error: '',
   349 	done: ''
   351 	done: ''
   350 };
   352 };
   351 
   353 
   352 window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n );
   354 window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' );
   353 
   355 
   354 /**
   356 /**
   355  * Removed in 3.3.0, needed for back-compatibility.
   357  * Removed in 3.3.0, needed for back-compatibility.
   356  *
   358  *
   357  * @since 2.7.0
   359  * @since 2.7.0
   378 	 *
   380 	 *
   379 	 * @return {void}
   381 	 * @return {void}
   380 	 */
   382 	 */
   381 	init : function() {
   383 	init : function() {
   382 		var that = this;
   384 		var that = this;
   383 		$('.hide-column-tog', '#adv-settings').click( function() {
   385 		$('.hide-column-tog', '#adv-settings').on( 'click', function() {
   384 			var $t = $(this), column = $t.val();
   386 			var $t = $(this), column = $t.val();
   385 			if ( $t.prop('checked') )
   387 			if ( $t.prop('checked') )
   386 				that.checked(column);
   388 				that.checked(column);
   387 			else
   389 			else
   388 				that.unchecked(column);
   390 				that.unchecked(column);
   479 		n = parseInt( $t.attr('colspan'), 10 ) + diff;
   481 		n = parseInt( $t.attr('colspan'), 10 ) + diff;
   480 		$t.attr('colspan', n.toString());
   482 		$t.attr('colspan', n.toString());
   481 	}
   483 	}
   482 };
   484 };
   483 
   485 
   484 $document.ready(function(){columns.init();});
   486 $( function() { columns.init(); } );
   485 
   487 
   486 /**
   488 /**
   487  * Validates that the required form fields are not empty.
   489  * Validates that the required form fields are not empty.
   488  *
   490  *
   489  * @since 2.9.0
   491  * @since 2.9.0
   496 	return !$( form )
   498 	return !$( form )
   497 		.find( '.form-required' )
   499 		.find( '.form-required' )
   498 		.filter( function() { return $( ':input:visible', this ).val() === ''; } )
   500 		.filter( function() { return $( ':input:visible', this ).val() === ''; } )
   499 		.addClass( 'form-invalid' )
   501 		.addClass( 'form-invalid' )
   500 		.find( ':input:visible' )
   502 		.find( ':input:visible' )
   501 		.change( function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
   503 		.on( 'change', function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
   502 		.length;
   504 		.length;
   503 };
   505 };
   504 
   506 
   505 // Stub for doing better warnings.
   507 // Stub for doing better warnings.
   506 /**
   508 /**
   567 	init: function() {
   569 	init: function() {
   568 		this.element = $('#screen-meta');
   570 		this.element = $('#screen-meta');
   569 		this.toggles = $( '#screen-meta-links' ).find( '.show-settings' );
   571 		this.toggles = $( '#screen-meta-links' ).find( '.show-settings' );
   570 		this.page    = $('#wpcontent');
   572 		this.page    = $('#wpcontent');
   571 
   573 
   572 		this.toggles.click( this.toggleEvent );
   574 		this.toggles.on( 'click', this.toggleEvent );
   573 	},
   575 	},
   574 
   576 
   575 	/**
   577 	/**
   576 	 * Toggles the screen meta options panel.
   578 	 * Toggles the screen meta options panel.
   577 	 *
   579 	 *
   613 		 * @since 3.2.0
   615 		 * @since 3.2.0
   614 		 *
   616 		 *
   615 		 * @return {void}
   617 		 * @return {void}
   616 		 */
   618 		 */
   617 		panel.slideDown( 'fast', function() {
   619 		panel.slideDown( 'fast', function() {
   618 			panel.focus();
   620 			panel.trigger( 'focus' );
   619 			button.addClass( 'screen-meta-active' ).attr( 'aria-expanded', true );
   621 			button.addClass( 'screen-meta-active' ).attr( 'aria-expanded', true );
   620 		});
   622 		});
   621 
   623 
   622 		$document.trigger( 'screen:options:open' );
   624 		$document.trigger( 'screen:options:open' );
   623 	},
   625 	},
   655  *
   657  *
   656  * @param {Event} e The event object.
   658  * @param {Event} e The event object.
   657  *
   659  *
   658  * @return {void}
   660  * @return {void}
   659  */
   661  */
   660 $('.contextual-help-tabs').delegate('a', 'click', function(e) {
   662 $('.contextual-help-tabs').on( 'click', 'a', function(e) {
   661 	var link = $(this),
   663 	var link = $(this),
   662 		panel;
   664 		panel;
   663 
   665 
   664 	e.preventDefault();
   666 	e.preventDefault();
   665 
   667 
   794 
   796 
   795 	// If input had focus give it back with cursor right after appended text.
   797 	// If input had focus give it back with cursor right after appended text.
   796 	if ( permalinkStructureFocused && $permalinkStructure[0].setSelectionRange ) {
   798 	if ( permalinkStructureFocused && $permalinkStructure[0].setSelectionRange ) {
   797 		newSelectionStart = ( permalinkStructureValue.substr( 0, selectionStart ) + textToAppend ).length;
   799 		newSelectionStart = ( permalinkStructureValue.substr( 0, selectionStart ) + textToAppend ).length;
   798 		$permalinkStructure[0].setSelectionRange( newSelectionStart, newSelectionStart );
   800 		$permalinkStructure[0].setSelectionRange( newSelectionStart, newSelectionStart );
   799 		$permalinkStructure.focus();
   801 		$permalinkStructure.trigger( 'focus' );
   800 	}
   802 	}
   801 } );
   803 } );
   802 
   804 
   803 $document.ready( function() {
   805 $( function() {
   804 	var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions,
   806 	var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions,
   805 		lastClicked = false,
   807 		lastClicked = false,
   806 		pageInput = $('input.current-page'),
   808 		pageInput = $('input.current-page'),
   807 		currentPage = pageInput.val(),
   809 		currentPage = pageInput.val(),
   808 		isIOS = /iPhone|iPad|iPod/.test( navigator.userAgent ),
   810 		isIOS = /iPhone|iPad|iPod/.test( navigator.userAgent ),
  1090 	function makeNoticesDismissible() {
  1092 	function makeNoticesDismissible() {
  1091 		$( '.notice.is-dismissible' ).each( function() {
  1093 		$( '.notice.is-dismissible' ).each( function() {
  1092 			var $el = $( this ),
  1094 			var $el = $( this ),
  1093 				$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' );
  1095 				$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' );
  1094 
  1096 
       
  1097 			if ( $el.find( '.notice-dismiss' ).length ) {
       
  1098 				return;
       
  1099 			}
       
  1100 
  1095 			// Ensure plain text.
  1101 			// Ensure plain text.
  1096 			$button.find( '.screen-reader-text' ).text( __( 'Dismiss this notice.' ) );
  1102 			$button.find( '.screen-reader-text' ).text( __( 'Dismiss this notice.' ) );
  1097 			$button.on( 'click.wp-dismiss-notice', function( event ) {
  1103 			$button.on( 'click.wp-dismiss-notice', function( event ) {
  1098 				event.preventDefault();
  1104 				event.preventDefault();
  1099 				$el.fadeTo( 100, 0, function() {
  1105 				$el.fadeTo( 100, 0, function() {
  1212 				return false;
  1218 				return false;
  1213 			});
  1219 			});
  1214 	});
  1220 	});
  1215 
  1221 
  1216 	/**
  1222 	/**
       
  1223 	 * Marries a secondary control to its primary control.
       
  1224 	 *
       
  1225 	 * @param {jQuery} topSelector    The top selector element.
       
  1226 	 * @param {jQuery} topSubmit      The top submit element.
       
  1227 	 * @param {jQuery} bottomSelector The bottom selector element.
       
  1228 	 * @param {jQuery} bottomSubmit   The bottom submit element.
       
  1229 	 * @return {void}
       
  1230 	 */
       
  1231 	function marryControls( topSelector, topSubmit, bottomSelector, bottomSubmit ) {
       
  1232 		/**
       
  1233 		 * Updates the primary selector when the secondary selector is changed.
       
  1234 		 *
       
  1235 		 * @since 5.7.0
       
  1236 		 *
       
  1237 		 * @return {void}
       
  1238 		 */
       
  1239 		function updateTopSelector() {
       
  1240 			topSelector.val($(this).val());
       
  1241 		}
       
  1242 		bottomSelector.on('change', updateTopSelector);
       
  1243 
       
  1244 		/**
       
  1245 		 * Updates the secondary selector when the primary selector is changed.
       
  1246 		 *
       
  1247 		 * @since 5.7.0
       
  1248 		 *
       
  1249 		 * @return {void}
       
  1250 		 */
       
  1251 		function updateBottomSelector() {
       
  1252 			bottomSelector.val($(this).val());
       
  1253 		}
       
  1254 		topSelector.on('change', updateBottomSelector);
       
  1255 
       
  1256 		/**
       
  1257 		 * Triggers the primary submit when then secondary submit is clicked.
       
  1258 		 *
       
  1259 		 * @since 5.7.0
       
  1260 		 *
       
  1261 		 * @return {void}
       
  1262 		 */
       
  1263 		function triggerSubmitClick(e) {
       
  1264 			e.preventDefault();
       
  1265 			e.stopPropagation();
       
  1266 
       
  1267 			topSubmit.trigger('click');
       
  1268 		}
       
  1269 		bottomSubmit.on('click', triggerSubmitClick);
       
  1270 	}
       
  1271 
       
  1272 	// Marry the secondary "Bulk actions" controls to the primary controls:
       
  1273 	marryControls( $('#bulk-action-selector-top'), $('#doaction'), $('#bulk-action-selector-bottom'), $('#doaction2') );
       
  1274 
       
  1275 	// Marry the secondary "Change role to" controls to the primary controls:
       
  1276 	marryControls( $('#new_role'), $('#changeit'), $('#new_role2'), $('#changeit2') );
       
  1277 
       
  1278 	/**
  1217 	 * Shows row actions on focus of its parent container element or any other elements contained within.
  1279 	 * Shows row actions on focus of its parent container element or any other elements contained within.
  1218 	 *
  1280 	 *
  1219 	 * @return {void}
  1281 	 * @return {void}
  1220 	 */
  1282 	 */
  1221 	$( '#wpbody-content' ).on({
  1283 	$( '#wpbody-content' ).on({
  1231 			// the .row-actions div gets hidden in transit in some browsers (ahem, Firefox).
  1293 			// the .row-actions div gets hidden in transit in some browsers (ahem, Firefox).
  1232 			transitionTimeout = setTimeout( function() {
  1294 			transitionTimeout = setTimeout( function() {
  1233 				focusedRowActions.removeClass( 'visible' );
  1295 				focusedRowActions.removeClass( 'visible' );
  1234 			}, 30 );
  1296 			}, 30 );
  1235 		}
  1297 		}
  1236 	}, '.has-row-actions' );
  1298 	}, '.table-view-list .has-row-actions' );
  1237 
  1299 
  1238 	// Toggle list table rows on small screens.
  1300 	// Toggle list table rows on small screens.
  1239 	$( 'tbody' ).on( 'click', '.toggle-row', function() {
  1301 	$( 'tbody' ).on( 'click', '.toggle-row', function() {
  1240 		$( this ).closest( 'tr' ).toggleClass( 'is-expanded' );
  1302 		$( this ).closest( 'tr' ).toggleClass( 'is-expanded' );
  1241 	});
  1303 	});
  1242 
  1304 
  1243 	$('#default-password-nag-no').click( function() {
  1305 	$('#default-password-nag-no').on( 'click', function() {
  1244 		setUserSetting('default_password_nag', 'hide');
  1306 		setUserSetting('default_password_nag', 'hide');
  1245 		$('div.default-password-nag').hide();
  1307 		$('div.default-password-nag').hide();
  1246 		return false;
  1308 		return false;
  1247 	});
  1309 	});
  1248 
  1310 
  1251 	 *
  1313 	 *
  1252 	 * @param {Event} e The event object.
  1314 	 * @param {Event} e The event object.
  1253 	 *
  1315 	 *
  1254 	 * @return {void}
  1316 	 * @return {void}
  1255 	 */
  1317 	 */
  1256 	$('#newcontent').bind('keydown.wpevent_InsertTab', function(e) {
  1318 	$('#newcontent').on('keydown.wpevent_InsertTab', function(e) {
  1257 		var el = e.target, selStart, selEnd, val, scroll, sel;
  1319 		var el = e.target, selStart, selEnd, val, scroll, sel;
  1258 
  1320 
  1259 		// After pressing escape key (keyCode: 27), the tab key should tab out of the textarea.
  1321 		// After pressing escape key (keyCode: 27), the tab key should tab out of the textarea.
  1260 		if ( e.keyCode == 27 ) {
  1322 		if ( e.keyCode == 27 ) {
  1261 			// When pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them.
  1323 			// When pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them.
  1310 		 *
  1372 		 *
  1311 		 * The form closest to the pageInput is the post-filter form.
  1373 		 * The form closest to the pageInput is the post-filter form.
  1312 		 *
  1374 		 *
  1313 		 * @return {void}
  1375 		 * @return {void}
  1314 		 */
  1376 		 */
  1315 		pageInput.closest('form').submit( function() {
  1377 		pageInput.closest('form').on( 'submit', function() {
  1316 			/*
  1378 			/*
  1317 			 * action = bulk action dropdown at the top of the table
  1379 			 * action = bulk action dropdown at the top of the table
  1318 			 * action2 = bulk action dropdow at the bottom of the table
       
  1319 			 */
  1380 			 */
  1320 			if ( $('select[name="action"]').val() == -1 && $('select[name="action2"]').val() == -1 && pageInput.val() == currentPage )
  1381 			if ( $('select[name="action"]').val() == -1 && pageInput.val() == currentPage )
  1321 				pageInput.val('1');
  1382 				pageInput.val('1');
  1322 		});
  1383 		});
  1323 	}
  1384 	}
  1324 
  1385 
  1325 	/**
  1386 	/**
  1326 	 * Resets the bulk actions when the search button is clicked.
  1387 	 * Resets the bulk actions when the search button is clicked.
  1327 	 *
  1388 	 *
  1328 	 * @return {void}
  1389 	 * @return {void}
  1329 	 */
  1390 	 */
  1330 	$('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function () {
  1391 	$('.search-box input[type="search"], .search-box input[type="submit"]').on( 'mousedown', function () {
  1331 		$('select[name^="action"]').val('-1');
  1392 		$('select[name^="action"]').val('-1');
  1332 	});
  1393 	});
  1333 
  1394 
  1334 	/**
  1395 	/**
  1335 	 * Scrolls into view when focus.scroll-into-view is triggered.
  1396 	 * Scrolls into view when focus.scroll-into-view is triggered.
  1626 				$adminbar.find( '.hover' ).removeClass( 'hover' );
  1687 				$adminbar.find( '.hover' ).removeClass( 'hover' );
  1627 
  1688 
  1628 				$wpwrap.toggleClass( 'wp-responsive-open' );
  1689 				$wpwrap.toggleClass( 'wp-responsive-open' );
  1629 				if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
  1690 				if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
  1630 					$(this).find('a').attr( 'aria-expanded', 'true' );
  1691 					$(this).find('a').attr( 'aria-expanded', 'true' );
  1631 					$( '#adminmenu a:first' ).focus();
  1692 					$( '#adminmenu a:first' ).trigger( 'focus' );
  1632 				} else {
  1693 				} else {
  1633 					$(this).find('a').attr( 'aria-expanded', 'false' );
  1694 					$(this).find('a').attr( 'aria-expanded', 'false' );
  1634 				}
  1695 				}
  1635 			} );
  1696 			} );
  1636 
  1697 
  1643 				$( this ).parent( 'li' ).toggleClass( 'selected' );
  1704 				$( this ).parent( 'li' ).toggleClass( 'selected' );
  1644 				event.preventDefault();
  1705 				event.preventDefault();
  1645 			});
  1706 			});
  1646 
  1707 
  1647 			self.trigger();
  1708 			self.trigger();
  1648 			$document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
  1709 			$document.on( 'wp-window-resized.wp-responsive', this.trigger.bind( this ) );
  1649 
  1710 
  1650 			// This needs to run later as UI Sortable may be initialized later on $(document).ready().
  1711 			// This needs to run later as UI Sortable may be initialized later on $(document).ready().
  1651 			$window.on( 'load.wp-responsive', this.maybeDisableSortables );
  1712 			$window.on( 'load.wp-responsive', this.maybeDisableSortables );
  1652 			$document.on( 'postbox-toggled', this.maybeDisableSortables );
  1713 			$document.on( 'postbox-toggled', this.maybeDisableSortables );
  1653 
  1714 
  1826 	 */
  1887 	 */
  1827 	function aria_button_if_js() {
  1888 	function aria_button_if_js() {
  1828 		$( '.aria-button-if-js' ).attr( 'role', 'button' );
  1889 		$( '.aria-button-if-js' ).attr( 'role', 'button' );
  1829 	}
  1890 	}
  1830 
  1891 
  1831 	$( document ).ajaxComplete( function() {
  1892 	$( document ).on( 'ajaxComplete', function() {
  1832 		aria_button_if_js();
  1893 		aria_button_if_js();
  1833 	});
  1894 	});
  1834 
  1895 
  1835 	/**
  1896 	/**
  1836 	 * Get the viewport width.
  1897 	 * Get the viewport width.
  1915 	aria_button_if_js();
  1976 	aria_button_if_js();
  1916 
  1977 
  1917 	$document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
  1978 	$document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
  1918 
  1979 
  1919 	// Set initial focus on a specific element.
  1980 	// Set initial focus on a specific element.
  1920 	$( '.wp-initial-focus' ).focus();
  1981 	$( '.wp-initial-focus' ).trigger( 'focus' );
  1921 
  1982 
  1922 	// Toggle update details on update-core.php.
  1983 	// Toggle update details on update-core.php.
  1923 	$body.on( 'click', '.js-update-details-toggle', function() {
  1984 	$body.on( 'click', '.js-update-details-toggle', function() {
  1924 		var $updateNotice = $( this ).closest( '.js-update-details' ),
  1985 		var $updateNotice = $( this ).closest( '.js-update-details' ),
  1925 			$progressDiv = $( '#' + $updateNotice.data( 'update-details' ) );
  1986 			$progressDiv = $( '#' + $updateNotice.data( 'update-details' ) );
  1945  * On the "Update plugin/theme from uploaded zip" screen, once the upload has expired,
  2006  * On the "Update plugin/theme from uploaded zip" screen, once the upload has expired,
  1946  * hides the "Replace current with uploaded" button and displays a warning.
  2007  * hides the "Replace current with uploaded" button and displays a warning.
  1947  *
  2008  *
  1948  * @since 5.5.0
  2009  * @since 5.5.0
  1949  */
  2010  */
  1950 $document.ready( function( $ ) {
  2011 $( function( $ ) {
  1951 	var $overwrite, $warning;
  2012 	var $overwrite, $warning;
  1952 
  2013 
  1953 	if ( ! $body.hasClass( 'update-php' ) ) {
  2014 	if ( ! $body.hasClass( 'update-php' ) ) {
  1954 		return;
  2015 		return;
  1955 	}
  2016 	}