wp/wp-admin/js/post.js
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   341 			$(this).find('.wp-tab-first').trigger( 'focus' );
   341 			$(this).find('.wp-tab-first').trigger( 'focus' );
   342 			e.preventDefault();
   342 			e.preventDefault();
   343 		}
   343 		}
   344 	}).filter(':visible').find('.wp-tab-first').trigger( 'focus' );
   344 	}).filter(':visible').find('.wp-tab-first').trigger( 'focus' );
   345 
   345 
   346 	// Set the heartbeat interval to 15 seconds if post lock dialogs are enabled.
   346 	// Set the heartbeat interval to 10 seconds if post lock dialogs are enabled.
   347 	if ( wp.heartbeat && $('#post-lock-dialog').length ) {
   347 	if ( wp.heartbeat && $('#post-lock-dialog').length ) {
   348 		wp.heartbeat.interval( 15 );
   348 		wp.heartbeat.interval( 10 );
   349 	}
   349 	}
   350 
   350 
   351 	// The form is being submitted by the user.
   351 	// The form is being submitted by the user.
   352 	$submitButtons = $submitpost.find( ':submit, a.submitdelete, #post-preview' ).on( 'click.edit-post', function( event ) {
   352 	$submitButtons = $submitpost.find( ':submit, a.submitdelete, #post-preview' ).on( 'click.edit-post', function( event ) {
   353 		var $button = $(this);
   353 		var $button = $(this);
   430 				return value + '?t=' + ( new Date() ).getTime();
   430 				return value + '?t=' + ( new Date() ).getTime();
   431 			});
   431 			});
   432 		}
   432 		}
   433 
   433 
   434 		$previewField.val('');
   434 		$previewField.val('');
   435 	});
       
   436 
       
   437 	// This code is meant to allow tabbing from Title to Post content.
       
   438 	$('#title').on( 'keydown.editor-focus', function( event ) {
       
   439 		var editor;
       
   440 
       
   441 		if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
       
   442 			editor = typeof tinymce != 'undefined' && tinymce.get('content');
       
   443 
       
   444 			if ( editor && ! editor.isHidden() ) {
       
   445 				editor.focus();
       
   446 			} else if ( $textarea.length ) {
       
   447 				$textarea.trigger( 'focus' );
       
   448 			} else {
       
   449 				return;
       
   450 			}
       
   451 
       
   452 			event.preventDefault();
       
   453 		}
       
   454 	});
   435 	});
   455 
   436 
   456 	// Auto save new posts after a title is typed.
   437 	// Auto save new posts after a title is typed.
   457 	if ( $( '#auto_draft' ).val() ) {
   438 	if ( $( '#auto_draft' ).val() ) {
   458 		$( '#title' ).on( 'blur', function() {
   439 		$( '#title' ).on( 'blur', function() {
   676 		$('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on(
   657 		$('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on(
   677 			'click',
   658 			'click',
   678 			'li.popular-category > label input[type="checkbox"]',
   659 			'li.popular-category > label input[type="checkbox"]',
   679 			function() {
   660 			function() {
   680 				var t = $(this), c = t.is(':checked'), id = t.val();
   661 				var t = $(this), c = t.is(':checked'), id = t.val();
   681 				if ( id && t.parents('#taxonomy-'+taxonomy).length )
   662 				if ( id && t.parents('#taxonomy-'+taxonomy).length ) {
   682 					$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
   663 					$('input#in-' + taxonomy + '-' + id + ', input[id^="in-' + taxonomy + '-' + id + '-"]').prop('checked', c);
       
   664 					$('input#in-popular-' + taxonomy + '-' + id).prop('checked', c);
       
   665 				}
   683 			}
   666 			}
   684 		);
   667 		);
   685 
   668 
   686 	}); // End cats.
   669 	}); // End cats.
   687 
   670