wp/wp-admin/js/comment.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     9  *
     9  *
    10  * @since 2.5.0
    10  * @since 2.5.0
    11  *
    11  *
    12  * @param {jQuery} $ The jQuery object.
    12  * @param {jQuery} $ The jQuery object.
    13  */
    13  */
    14 jQuery(document).ready( function($) {
    14 jQuery( function($) {
    15 
    15 
    16 	postboxes.add_postbox_toggles('comment');
    16 	postboxes.add_postbox_toggles('comment');
    17 
    17 
    18 	var $timestampdiv = $('#timestampdiv'),
    18 	var $timestampdiv = $('#timestampdiv'),
    19 		$timestamp = $( '#timestamp' ),
    19 		$timestamp = $( '#timestamp' ),
    27 	 * @listens $edittimestamp:click
    27 	 * @listens $edittimestamp:click
    28 	 *
    28 	 *
    29 	 * @param {Event} event The event object.
    29 	 * @param {Event} event The event object.
    30 	 * @return {void}
    30 	 * @return {void}
    31 	 */
    31 	 */
    32 	$edittimestamp.click( function( event ) {
    32 	$edittimestamp.on( 'click', function( event ) {
    33 		if ( $timestampdiv.is( ':hidden' ) ) {
    33 		if ( $timestampdiv.is( ':hidden' ) ) {
    34 			// Slide down the form and set focus on the first field.
    34 			// Slide down the form and set focus on the first field.
    35 			$timestampdiv.slideDown( 'fast', function() {
    35 			$timestampdiv.slideDown( 'fast', function() {
    36 				$( 'input, select', $timestampwrap ).first().focus();
    36 				$( 'input, select', $timestampwrap ).first().trigger( 'focus' );
    37 			} );
    37 			} );
    38 			$(this).hide();
    38 			$(this).hide();
    39 		}
    39 		}
    40 		event.preventDefault();
    40 		event.preventDefault();
    41 	});
    41 	});
    47 	 *
    47 	 *
    48 	 * @param {Event} event The event object.
    48 	 * @param {Event} event The event object.
    49 	 * @return {void}
    49 	 * @return {void}
    50 	 */
    50 	 */
    51 
    51 
    52 	$timestampdiv.find('.cancel-timestamp').click( function( event ) {
    52 	$timestampdiv.find('.cancel-timestamp').on( 'click', function( event ) {
    53 		// Move focus back to the Edit link.
    53 		// Move focus back to the Edit link.
    54 		$edittimestamp.show().focus();
    54 		$edittimestamp.show().trigger( 'focus' );
    55 		$timestampdiv.slideUp( 'fast' );
    55 		$timestampdiv.slideUp( 'fast' );
    56 		$('#mm').val($('#hidden_mm').val());
    56 		$('#mm').val($('#hidden_mm').val());
    57 		$('#jj').val($('#hidden_jj').val());
    57 		$('#jj').val($('#hidden_jj').val());
    58 		$('#aa').val($('#hidden_aa').val());
    58 		$('#aa').val($('#hidden_aa').val());
    59 		$('#hh').val($('#hidden_hh').val());
    59 		$('#hh').val($('#hidden_hh').val());
    68 	 * @listens .save-timestamp:click
    68 	 * @listens .save-timestamp:click
    69 	 *
    69 	 *
    70 	 * @param {Event} event The event object.
    70 	 * @param {Event} event The event object.
    71 	 * @return {void}
    71 	 * @return {void}
    72 	 */
    72 	 */
    73 	$timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
    73 	$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
    74 		var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
    74 		var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
    75 			newD = new Date( aa, mm - 1, jj, hh, mn );
    75 			newD = new Date( aa, mm - 1, jj, hh, mn );
    76 
    76 
    77 		event.preventDefault();
    77 		event.preventDefault();
    78 
    78 
    94 				.replace( '%5$s', ( '00' + mn ).slice( -2 ) ) +
    94 				.replace( '%5$s', ( '00' + mn ).slice( -2 ) ) +
    95 				'</b> '
    95 				'</b> '
    96 		);
    96 		);
    97 
    97 
    98 		// Move focus back to the Edit link.
    98 		// Move focus back to the Edit link.
    99 		$edittimestamp.show().focus();
    99 		$edittimestamp.show().trigger( 'focus' );
   100 		$timestampdiv.slideUp( 'fast' );
   100 		$timestampdiv.slideUp( 'fast' );
   101 	});
   101 	});
   102 });
   102 });