Make WordPress Core

Changeset 26067


Ignore:
Timestamp:
11/09/2013 09:28:27 PM (11 years ago)
Author:
nacin
Message:

Avoid JSHint errors in color-picker.js. One var, single quotes, add missing semicolon, declare wpColorPickerL10n as global.

props jorbin.
fixes #25877.

File:
1 edited

Legend:

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

    r23443 r26067  
     1/* global wpColorPickerL10n:true */
    12( function( $, undef ){
    23
     
    56        _after = '<div class="wp-picker-holder" />',
    67        _wrap = '<div class="wp-picker-container" />',
    7         _button = '<input type="button" class="button button-small hidden" />';
    8 
     8        _button = '<input type="button" class="button button-small hidden" />',
    99    // jQuery UI Widget constructor
    10     var ColorPicker = {
     10        ColorPicker = {
    1111        options: {
    1212            defaultColor: false,
     
    2020            if ( ! $.support.iris )
    2121                return;
    22             var self = this;
    23             var el = self.element;
     22            var self = this,
     23                el = self.element;
    2424
    2525            $.extend( self.options, el.data() );
     
    3030            el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
    3131            self.wrap = el.parent();
    32             self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( "title", wpColorPickerL10n.pick ).attr( "data-current", wpColorPickerL10n.current );
     32            self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
    3333            self.pickerContainer = $( _after ).insertAfter( el );
    3434            self.button = $( _button );
     
    7070                // close picker when you click outside it
    7171                if ( self.toggler.hasClass( 'wp-picker-open' ) )
    72                     $( "body" ).on( 'click', { wrap: self.wrap, toggler: self.toggler }, self._bodyListener );
     72                    $( 'body' ).on( 'click', { wrap: self.wrap, toggler: self.toggler }, self._bodyListener );
    7373                else
    74                     $( "body" ).off( 'click', self._bodyListener );
     74                    $( 'body' ).off( 'click', self._bodyListener );
    7575            });
    7676
     
    115115        color: function( newColor ) {
    116116            if ( newColor === undef )
    117                 return this.element.iris( "option", "color" );
     117                return this.element.iris( 'option', 'color' );
    118118
    119             this.element.iris( "option", "color", newColor );
     119            this.element.iris( 'option', 'color', newColor );
    120120        },
    121121        //$("#input").wpColorPicker('defaultColor') returns the current default color
     
    127127            this.options.defaultColor = newDefaultColor;
    128128        }
    129     }
     129    };
    130130
    131131    $.widget( 'wp.wpColorPicker', ColorPicker );
Note: See TracChangeset for help on using the changeset viewer.