Make WordPress Core

Changeset 26287


Ignore:
Timestamp:
11/20/2013 11:11:01 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Fix JSHint errors in widgets.js.

props jorbin.
fixes #26127.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/widgets.js

    r26285 r26287  
    2929
    3030        $(document.body).bind('click.widgets-toggle', function(e){
    31             var target = $(e.target), css = { 'z-index': 100 }, widget, inside, w;
     31            var target = $(e.target),
     32                css = { 'z-index': 100 },
     33                widget, inside, targetWidth, widgetWidth, margin;
    3234
    3335            if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) {
     
    6971        sidebars.children('.widget').each(function() {
    7072            wpWidgets.appendTitle(this);
    71             if ( $('p.widget-error', this).length )
     73            if ( $('p.widget-error', this).length ) {
    7274                $('a.widget-action', this).click();
     75            }
    7376        });
    7477
     
    8588            },
    8689            stop: function() {
    87                 if ( rem )
     90                if ( rem ) {
    8891                    $(rem).hide();
     92                }
    8993
    9094                rem = '';
     
    103107            },
    104108            stop: function(e,ui) {
    105                 if ( ui.item.hasClass('ui-draggable') && ui.item.data('draggable') )
     109                if ( ui.item.hasClass('ui-draggable') && ui.item.data('draggable') ) {
    106110                    ui.item.draggable('destroy');
     111                }
    107112
    108113                if ( ui.item.hasClass('deleting') ) {
     
    140145                var sender = $(ui.sender);
    141146
    142                 if ( !$(this).is(':visible') || this.id.indexOf('orphaned_widgets') > -1 )
     147                if ( ! $(this).is(':visible') || this.id.indexOf('orphaned_widgets') > -1 ) {
    143148                    sender.sortable('cancel');
     149                }
    144150
    145151                if ( sender.attr('id').indexOf('orphaned_widgets') > -1 && !sender.children('.widget').length ) {
     
    162168                $('div.widget-placeholder').hide();
    163169
    164                 if ( ui.draggable.hasClass('ui-sortable-helper') )
     170                if ( ui.draggable.hasClass('ui-sortable-helper') ) {
    165171                    $('#removing-widget').show().children('span')
    166172                    .html( ui.draggable.find('div.widget-title').children('h4').html() );
     173                }
    167174            },
    168175            out: function(e,ui) {
     
    207214                    selectSidebar.find('.widgets-chooser-selected').removeClass( 'widgets-chooser-selected' );
    208215                    $(this).addClass( 'widgets-chooser-selected' );
    209                 } )
     216                } );
    210217            }
    211218        });
     
    237244
    238245    saveOrder : function(sb) {
    239         if ( sb )
     246        if ( sb ) {
    240247            $('#' + sb).closest('div.widgets-holder-wrap').find('.spinner').css('display', 'inline-block');
     248        }
    241249
    242250        var a = {
     
    247255
    248256        $('div.widgets-sortables').each( function() {
    249             if ( $(this).sortable )
     257            if ( $(this).sortable ) {
    250258                a['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(',');
     259            }
    251260        });
    252261
     
    267276        };
    268277
    269         if ( del )
     278        if ( del ) {
    270279            a.delete_widget = 1;
     280        }
    271281
    272282        data += '&' + $.param(a);
     
    276286
    277287            if ( del ) {
    278                 if ( !$('input.widget_number', widget).val() ) {
     288                if ( ! $('input.widget_number', widget).val() ) {
    279289                    id = $('input.widget-id', widget).val();
    280290                    $('#available-widgets').find('input.widget-id').each(function(){
    281                         if ( $(this).val() === id )
     291                        if ( $(this).val() === id ) {
    282292                            $(this).closest('div.widget').show();
     293                        }
    283294                    });
    284295                }
     
    300311                }
    301312            }
    302             if ( order )
     313            if ( order ) {
    303314                wpWidgets.saveOrder();
     315            }
    304316        });
    305317    },
     
    308320        var title = $('input[id*="-title"]', widget).val() || '';
    309321
    310         if ( title )
     322        if ( title ) {
    311323            title = ': ' + title.replace(/<[^<>]+>/g, '').replace(/</g, '&lt;').replace(/>/g, '&gt;');
     324        }
    312325
    313326        $(widget).children('.widget-top').children('.widget-title').children()
Note: See TracChangeset for help on using the changeset viewer.