Make WordPress Core

Changeset 26198


Ignore:
Timestamp:
11/15/2013 05:01:34 AM (11 years ago)
Author:
nacin
Message:

Fix JSHint errors in tags.js.

props atimmer.
fixes #26009.

File:
1 edited

Legend:

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

    r23444 r26198  
     1/* global ajaxurl, wpAjax, tagsl10n, showNotice, validateForm */
     2
    13jQuery(document).ready(function($) {
    24
    3     $('#the-list').on('click', '.delete-tag', function(e){
     5    $( '#the-list' ).on( 'click', '.delete-tag', function() {
    46        var t = $(this), tr = t.parents('tr'), r = true, data;
    57        if ( 'undefined' != showNotice )
     
    3032        var form = $(this).parents('form');
    3133
    32         if ( !validateForm( form ) )
     34        if ( ! validateForm( form ) )
    3335            return false;
    3436
    3537        $.post(ajaxurl, $('#addtag').serialize(), function(r){
     38            var res, parent, term, indent, i;
     39
    3640            $('#ajax-response').empty();
    37             var res = wpAjax.parseAjaxResponse(r, 'ajax-response');
     41            res = wpAjax.parseAjaxResponse( r, 'ajax-response' );
    3842            if ( ! res || res.errors )
    3943                return;
    4044
    41             var parent = form.find('select#parent').val();
     45            parent = form.find( 'select#parent' ).val();
    4246
    4347            if ( parent > 0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
    44                 $('.tags #tag-' + parent).after( res.responses[0].supplemental['noparents'] ); // As the parent exists, Insert the version with - - - prefixed
     48                $( '.tags #tag-' + parent ).after( res.responses[0].supplemental.noparents ); // As the parent exists, Insert the version with - - - prefixed
    4549            else
    46                 $('.tags').prepend( res.responses[0].supplemental['parents'] ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
     50                $( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
    4751
    4852            $('.tags .no-items').remove();
     
    5054            if ( form.find('select#parent') ) {
    5155                // Parents field exists, Add new term to the list.
    52                 var term = res.responses[1].supplemental;
     56                term = res.responses[1].supplemental;
    5357
    5458                // Create an indent for the Parent field
    55                 var indent = '';
    56                 for ( var i = 0; i < res.responses[1].position; i++ )
     59                indent = '';
     60                for ( i = 0; i < res.responses[1].position; i++ )
    5761                    indent += '&nbsp;&nbsp;&nbsp;';
    5862
    59                 form.find('select#parent option:selected').after('<option value="' + term['term_id'] + '">' + indent + term['name'] + '</option>');
     63                form.find( 'select#parent option:selected' ).after( '<option value="' + term.term_id + '">' + indent + term.name + '</option>' );
    6064            }
    6165
Note: See TracChangeset for help on using the changeset viewer.