Edit File by line
/home/barbar84/public_h.../wp-admin/js
File: comment.js
/**
[0] Fix | Delete
* @output wp-admin/js/comment.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
/* global postboxes */
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Binds to the document ready event.
[7] Fix | Delete
*
[8] Fix | Delete
* @since 2.5.0
[9] Fix | Delete
*
[10] Fix | Delete
* @param {jQuery} $ The jQuery object.
[11] Fix | Delete
*/
[12] Fix | Delete
jQuery(document).ready( function($) {
[13] Fix | Delete
[14] Fix | Delete
postboxes.add_postbox_toggles('comment');
[15] Fix | Delete
[16] Fix | Delete
var $timestampdiv = $('#timestampdiv'),
[17] Fix | Delete
$timestamp = $( '#timestamp' ),
[18] Fix | Delete
stamp = $timestamp.html(),
[19] Fix | Delete
$timestampwrap = $timestampdiv.find( '.timestamp-wrap' ),
[20] Fix | Delete
$edittimestamp = $timestampdiv.siblings( 'a.edit-timestamp' );
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Adds event that opens the time stamp form if the form is hidden.
[24] Fix | Delete
*
[25] Fix | Delete
* @listens $edittimestamp:click
[26] Fix | Delete
*
[27] Fix | Delete
* @param {Event} event The event object.
[28] Fix | Delete
* @return {void}
[29] Fix | Delete
*/
[30] Fix | Delete
$edittimestamp.on( 'click', function( event ) {
[31] Fix | Delete
if ( $timestampdiv.is( ':hidden' ) ) {
[32] Fix | Delete
// Slide down the form and set focus on the first field.
[33] Fix | Delete
$timestampdiv.slideDown( 'fast', function() {
[34] Fix | Delete
$( 'input, select', $timestampwrap ).first().trigger( 'focus' );
[35] Fix | Delete
} );
[36] Fix | Delete
$(this).hide();
[37] Fix | Delete
}
[38] Fix | Delete
event.preventDefault();
[39] Fix | Delete
});
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* Resets the time stamp values when the cancel button is clicked.
[43] Fix | Delete
*
[44] Fix | Delete
* @listens .cancel-timestamp:click
[45] Fix | Delete
*
[46] Fix | Delete
* @param {Event} event The event object.
[47] Fix | Delete
* @return {void}
[48] Fix | Delete
*/
[49] Fix | Delete
[50] Fix | Delete
$timestampdiv.find('.cancel-timestamp').on( 'click', function( event ) {
[51] Fix | Delete
// Move focus back to the Edit link.
[52] Fix | Delete
$edittimestamp.show().trigger( 'focus' );
[53] Fix | Delete
$timestampdiv.slideUp( 'fast' );
[54] Fix | Delete
$('#mm').val($('#hidden_mm').val());
[55] Fix | Delete
$('#jj').val($('#hidden_jj').val());
[56] Fix | Delete
$('#aa').val($('#hidden_aa').val());
[57] Fix | Delete
$('#hh').val($('#hidden_hh').val());
[58] Fix | Delete
$('#mn').val($('#hidden_mn').val());
[59] Fix | Delete
$timestamp.html( stamp );
[60] Fix | Delete
event.preventDefault();
[61] Fix | Delete
});
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* Sets the time stamp values when the ok button is clicked.
[65] Fix | Delete
*
[66] Fix | Delete
* @listens .save-timestamp:click
[67] Fix | Delete
*
[68] Fix | Delete
* @param {Event} event The event object.
[69] Fix | Delete
* @return {void}
[70] Fix | Delete
*/
[71] Fix | Delete
$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
[72] Fix | Delete
var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
[73] Fix | Delete
newD = new Date( aa, mm - 1, jj, hh, mn );
[74] Fix | Delete
[75] Fix | Delete
event.preventDefault();
[76] Fix | Delete
[77] Fix | Delete
if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) {
[78] Fix | Delete
$timestampwrap.addClass( 'form-invalid' );
[79] Fix | Delete
return;
[80] Fix | Delete
} else {
[81] Fix | Delete
$timestampwrap.removeClass( 'form-invalid' );
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
$timestamp.html(
[85] Fix | Delete
wp.i18n.__( 'Submitted on:' ) + ' <b>' +
[86] Fix | Delete
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
[87] Fix | Delete
wp.i18n.__( '%1$s %2$s, %3$s at %4$s:%5$s' )
[88] Fix | Delete
.replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) )
[89] Fix | Delete
.replace( '%2$s', parseInt( jj, 10 ) )
[90] Fix | Delete
.replace( '%3$s', aa )
[91] Fix | Delete
.replace( '%4$s', ( '00' + hh ).slice( -2 ) )
[92] Fix | Delete
.replace( '%5$s', ( '00' + mn ).slice( -2 ) ) +
[93] Fix | Delete
'</b> '
[94] Fix | Delete
);
[95] Fix | Delete
[96] Fix | Delete
// Move focus back to the Edit link.
[97] Fix | Delete
$edittimestamp.show().trigger( 'focus' );
[98] Fix | Delete
$timestampdiv.slideUp( 'fast' );
[99] Fix | Delete
});
[100] Fix | Delete
});
[101] Fix | Delete
[102] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function