Make WordPress Core

Ticket #41065: comment.js.patch

File comment.js.patch, 2.0 KB (added by jipmoors, 7 years ago)

Documented comment.js

  • src/wp-admin/js/comment.js

    diff --git src/wp-admin/js/comment.js src/wp-admin/js/comment.js
    index d194148f60..206ffa669b 100644
     
    11/* global postboxes, commentL10n */
     2
     3/**
     4 * @summary Binds to the document ready event.
     5 *
     6 * @since 2.5.0
     7 *
     8 * @param {jQuery} $ The jQuery object.
     9 */
    210jQuery(document).ready( function($) {
    311
    412        postboxes.add_postbox_toggles('comment');
    jQuery(document).ready( function($) { 
    917                $timestampwrap = $timestampdiv.find( '.timestamp-wrap' ),
    1018                $edittimestamp = $timestampdiv.siblings( 'a.edit-timestamp' );
    1119
     20        /**
     21         * @summary Adds event that opens the time stamp form if the form is hidden.
     22         *
     23         * @listens $edittimestamp:click
     24         *
     25         * @param {Event} event The event object.
     26         * @returns {void}
     27         */
    1228        $edittimestamp.click( function( event ) {
    1329                if ( $timestampdiv.is( ':hidden' ) ) {
     30                        // Slide down the form and sets focus on the first field.
    1431                        $timestampdiv.slideDown( 'fast', function() {
    1532                                $( 'input, select', $timestampwrap ).first().focus();
    1633                        } );
    jQuery(document).ready( function($) { 
    1936                event.preventDefault();
    2037        });
    2138
     39        /**
     40         * @summary Resets the time stamp values when the cancel button is clicked.
     41         *
     42         * @listens .cancel-timestamp:click
     43         *
     44         * @param {Event} event The event object.
     45         * @returns {void}
     46         */
     47
    2248        $timestampdiv.find('.cancel-timestamp').click( function( event ) {
    2349                // Move focus back to the Edit link.
    2450                $edittimestamp.show().focus();
    jQuery(document).ready( function($) { 
    3258                event.preventDefault();
    3359        });
    3460
     61        /**
     62         * @summary Sets the time stamp values when the ok button is clicked.
     63         *
     64         * @listens .save-timestamp:click
     65         *
     66         * @param {Event} event The event object.
     67         * @returns {void}
     68         */
    3569        $timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
    3670                var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
    3771                        newD = new Date( aa, mm - 1, jj, hh, mn );