wp/wp-admin/js/comment.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     1 /**
     1 /**
     2  * @output wp-admin/js/comment.js
     2  * @output wp-admin/js/comment.js
     3  */
     3  */
     4 
     4 
     5 /* global postboxes, commentL10n */
     5 /* global postboxes */
     6 
     6 
     7 /**
     7 /**
     8  * Binds to the document ready event.
     8  * Binds to the document ready event.
     9  *
     9  *
    10  * @since 2.5.0
    10  * @since 2.5.0
    25 	 * Adds event that opens the time stamp form if the form is hidden.
    25 	 * Adds event that opens the time stamp form if the form is hidden.
    26 	 *
    26 	 *
    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 	 * @returns {void}
    30 	 * @return {void}
    31 	 */
    31 	 */
    32 	$edittimestamp.click( function( event ) {
    32 	$edittimestamp.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() {
    44 	 * Resets the time stamp values when the cancel button is clicked.
    44 	 * Resets the time stamp values when the cancel button is clicked.
    45 	 *
    45 	 *
    46 	 * @listens .cancel-timestamp:click
    46 	 * @listens .cancel-timestamp:click
    47 	 *
    47 	 *
    48 	 * @param {Event} event The event object.
    48 	 * @param {Event} event The event object.
    49 	 * @returns {void}
    49 	 * @return {void}
    50 	 */
    50 	 */
    51 
    51 
    52 	$timestampdiv.find('.cancel-timestamp').click( function( event ) {
    52 	$timestampdiv.find('.cancel-timestamp').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().focus();
    66 	 * Sets the time stamp values when the ok button is clicked.
    66 	 * Sets the time stamp values when the ok button is clicked.
    67 	 *
    67 	 *
    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 	 * @returns {void}
    71 	 * @return {void}
    72 	 */
    72 	 */
    73 	$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
    73 	$timestampdiv.find('.save-timestamp').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 
    82 		} else {
    82 		} else {
    83 			$timestampwrap.removeClass( 'form-invalid' );
    83 			$timestampwrap.removeClass( 'form-invalid' );
    84 		}
    84 		}
    85 
    85 
    86 		$timestamp.html(
    86 		$timestamp.html(
    87 			commentL10n.submittedOn + ' <b>' +
    87 			wp.i18n.__( 'Submitted on:' ) + ' <b>' +
    88 			commentL10n.dateFormat
    88 			/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
       
    89 			wp.i18n.__( '%1$s %2$s, %3$s at %4$s:%5$s' )
    89 				.replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) )
    90 				.replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) )
    90 				.replace( '%2$s', parseInt( jj, 10 ) )
    91 				.replace( '%2$s', parseInt( jj, 10 ) )
    91 				.replace( '%3$s', aa )
    92 				.replace( '%3$s', aa )
    92 				.replace( '%4$s', ( '00' + hh ).slice( -2 ) )
    93 				.replace( '%4$s', ( '00' + hh ).slice( -2 ) )
    93 				.replace( '%5$s', ( '00' + mn ).slice( -2 ) ) +
    94 				.replace( '%5$s', ( '00' + mn ).slice( -2 ) ) +