Docs: Add documentation for `wp-admin/js/comment.js`.

Props ireneyoast, andizer, jipmoors.
Fixes #41065.
Built from https://develop.svn.wordpress.org/trunk@40913


git-svn-id: http://core.svn.wordpress.org/trunk@40763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2017-06-15 13:02:40 +00:00
parent 3abb3087df
commit c569080cd1
2 changed files with 35 additions and 1 deletions

View File

@ -1,4 +1,12 @@
/* global postboxes, commentL10n */ /* global postboxes, commentL10n */
/**
* @summary Binds to the document ready event.
*
* @since 2.5.0
*
* @param {jQuery} $ The jQuery object.
*/
jQuery(document).ready( function($) { jQuery(document).ready( function($) {
postboxes.add_postbox_toggles('comment'); postboxes.add_postbox_toggles('comment');
@ -9,8 +17,17 @@ jQuery(document).ready( function($) {
$timestampwrap = $timestampdiv.find( '.timestamp-wrap' ), $timestampwrap = $timestampdiv.find( '.timestamp-wrap' ),
$edittimestamp = $timestampdiv.siblings( 'a.edit-timestamp' ); $edittimestamp = $timestampdiv.siblings( 'a.edit-timestamp' );
/**
* @summary Adds event that opens the time stamp form if the form is hidden.
*
* @listens $edittimestamp:click
*
* @param {Event} event The event object.
* @returns {void}
*/
$edittimestamp.click( function( event ) { $edittimestamp.click( function( event ) {
if ( $timestampdiv.is( ':hidden' ) ) { if ( $timestampdiv.is( ':hidden' ) ) {
// Slide down the form and set focus on the first field.
$timestampdiv.slideDown( 'fast', function() { $timestampdiv.slideDown( 'fast', function() {
$( 'input, select', $timestampwrap ).first().focus(); $( 'input, select', $timestampwrap ).first().focus();
} ); } );
@ -19,6 +36,15 @@ jQuery(document).ready( function($) {
event.preventDefault(); event.preventDefault();
}); });
/**
* @summary Resets the time stamp values when the cancel button is clicked.
*
* @listens .cancel-timestamp:click
*
* @param {Event} event The event object.
* @returns {void}
*/
$timestampdiv.find('.cancel-timestamp').click( function( event ) { $timestampdiv.find('.cancel-timestamp').click( function( event ) {
// Move focus back to the Edit link. // Move focus back to the Edit link.
$edittimestamp.show().focus(); $edittimestamp.show().focus();
@ -32,6 +58,14 @@ jQuery(document).ready( function($) {
event.preventDefault(); event.preventDefault();
}); });
/**
* @summary Sets the time stamp values when the ok button is clicked.
*
* @listens .save-timestamp:click
*
* @param {Event} event The event object.
* @returns {void}
*/
$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels $timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(), var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
newD = new Date( aa, mm - 1, jj, hh, mn ); newD = new Date( aa, mm - 1, jj, hh, mn );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-alpha-40912'; $wp_version = '4.9-alpha-40913';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.