Make WordPress Core

Changeset 52228


Ignore:
Timestamp:
11/20/2021 02:48:08 AM (19 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Wrap some long lines in js/_enqueues/admin/post.js per the JS coding standards for better readability.

See #53359.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/post.js

    r52225 r52228  
    136136     */
    137137    window.WPRemoveThumbnail = function(nonce){
    138         $.post(ajaxurl, {
    139             action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
    140         },
     138        $.post(
     139            ajaxurl, {
     140                action: 'set-post-thumbnail',
     141                post_id: $( '#post_ID' ).val(),
     142                thumbnail_id: -1,
     143                _ajax_nonce: nonce,
     144                cookie: encodeURIComponent( document.cookie )
     145            },
    141146            /**
    142147             * Handle server response
     
    145150             */
    146151            function(str){
    147             if ( str == '0' ) {
    148                 alert( __( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
    149             } else {
    150                 WPSetThumbnailHTML(str);
    151             }
    152         }
     152                if ( str == '0' ) {
     153                    alert( __( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
     154                } else {
     155                    WPSetThumbnailHTML(str);
     156                }
     157            }
    153158        );
    154159    };
     
    208213                            alt: '',
    209214                            src: received.lock_error.avatar_src,
    210                             srcset: received.lock_error.avatar_src_2x ? received.lock_error.avatar_src_2x + ' 2x' : undefined
     215                            srcset: received.lock_error.avatar_src_2x ?
     216                                received.lock_error.avatar_src_2x + ' 2x' :
     217                                undefined
    211218                        } );
    212219                        wrap.find('div.post-locked-avatar').empty().append( avatar );
     
    667674
    668675        // Sync checked items between "All {taxonomy}" and "Most used" lists.
    669         $('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on( 'click', 'li.popular-category > label input[type="checkbox"]', function() {
    670             var t = $(this), c = t.is(':checked'), id = t.val();
    671             if ( id && t.parents('#taxonomy-'+taxonomy).length )
    672                 $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
    673         });
     676        $('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on(
     677            'click',
     678            'li.popular-category > label input[type="checkbox"]',
     679            function() {
     680                var t = $(this), c = t.is(':checked'), id = t.val();
     681                if ( id && t.parents('#taxonomy-'+taxonomy).length )
     682                    $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
     683            }
     684        );
    674685
    675686    }); // End cats.
     
    750761
    751762            attemptedDate = new Date( aa, mm - 1, jj, hh, mn );
    752             originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val() );
    753             currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() );
     763            originalDate = new Date(
     764                $('#hidden_aa').val(),
     765                $('#hidden_mm').val() -1,
     766                $('#hidden_jj').val(),
     767                $('#hidden_hh').val(),
     768                $('#hidden_mn').val()
     769            );
     770            currentDate = new Date(
     771                $('#cur_aa').val(),
     772                $('#cur_mm').val() -1,
     773                $('#cur_jj').val(),
     774                $('#cur_hh').val(),
     775                $('#cur_mn').val()
     776            );
    754777
    755778            // Catch unexpected date problems.
    756             if ( attemptedDate.getFullYear() != aa || (1 + attemptedDate.getMonth()) != mm || attemptedDate.getDate() != jj || attemptedDate.getMinutes() != mn ) {
     779            if (
     780                attemptedDate.getFullYear() != aa ||
     781                (1 + attemptedDate.getMonth()) != mm ||
     782                attemptedDate.getDate() != jj ||
     783                attemptedDate.getMinutes() != mn
     784            ) {
    757785                $timestampdiv.find('.timestamp-wrap').addClass('form-invalid');
    758786                return false;
     
    821849
    822850            // Show or hide the "Save Draft" button.
    823             if ( $('option:selected', postStatus).val() == 'private' || $('option:selected', postStatus).val() == 'publish' ) {
     851            if (
     852                $('option:selected', postStatus).val() == 'private' ||
     853                $('option:selected', postStatus).val() == 'publish'
     854            ) {
    824855                $('#save-post').hide();
    825856            } else {
     
    9951026        revert_e = $el.html();
    9961027
    997         buttons.html( '<button type="button" class="save button button-small">' + __( 'OK' ) + '</button> <button type="button" class="cancel button-link">' + __( 'Cancel' ) + '</button>' );
     1028        buttons.html(
     1029            '<button type="button" class="save button button-small">' + __( 'OK' ) + '</button> ' +
     1030            '<button type="button" class="cancel button-link">' + __( 'Cancel' ) + '</button>'
     1031        );
    9981032
    9991033        // Save permalink changes.
     
    10511085        slug_label = __( 'URL Slug' );
    10521086
    1053         $el.html( '<label for="new-post-slug" class="screen-reader-text">' + slug_label + '</label><input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" spellcheck="false" />' ).children( 'input' ).on( 'keydown', function( e ) {
     1087        $el.html(
     1088            '<label for="new-post-slug" class="screen-reader-text">' + slug_label + '</label>' +
     1089            '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" spellcheck="false" />'
     1090        ).children( 'input' ).on( 'keydown', function( e ) {
    10541091            var key = e.which;
    10551092            // On [Enter], just save the new slug, don't save the post.
     
    12251262        // Key [S] has code 83.
    12261263        if ( event.which === 83 ) {
    1227             if ( event.shiftKey || event.altKey || ( isMac && ( ! event.metaKey || event.ctrlKey ) ) || ( ! isMac && ! event.ctrlKey ) ) {
     1264            if (
     1265                event.shiftKey ||
     1266                event.altKey ||
     1267                ( isMac && ( ! event.metaKey || event.ctrlKey ) ) ||
     1268                ( ! isMac && ! event.ctrlKey )
     1269            ) {
    12281270                return;
    12291271            }
Note: See TracChangeset for help on using the changeset viewer.