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

props jorbin.
fixes #25877.

Built from https://develop.svn.wordpress.org/trunk@26067


git-svn-id: http://core.svn.wordpress.org/trunk@25987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-11-09 21:29:09 +00:00
parent c81508dc43
commit 8789532eb8
1 changed files with 12 additions and 12 deletions

View File

@ -1,13 +1,13 @@
/* global wpColorPickerL10n:true */
( function( $, undef ){
// html stuff
var _before = '<a tabindex="0" class="wp-color-result" />',
_after = '<div class="wp-picker-holder" />',
_wrap = '<div class="wp-picker-container" />',
_button = '<input type="button" class="button button-small hidden" />';
_button = '<input type="button" class="button button-small hidden" />',
// jQuery UI Widget constructor
var ColorPicker = {
ColorPicker = {
options: {
defaultColor: false,
change: false,
@ -19,8 +19,8 @@
// bail early for unsupported Iris.
if ( ! $.support.iris )
return;
var self = this;
var el = self.element;
var self = this,
el = self.element;
$.extend( self.options, el.data() );
@ -29,7 +29,7 @@
// Set up HTML structure, hide things
el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
self.wrap = el.parent();
self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( "title", wpColorPickerL10n.pick ).attr( "data-current", wpColorPickerL10n.current );
self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
self.pickerContainer = $( _after ).insertAfter( el );
self.button = $( _button );
@ -69,9 +69,9 @@
// close picker when you click outside it
if ( self.toggler.hasClass( 'wp-picker-open' ) )
$( "body" ).on( 'click', { wrap: self.wrap, toggler: self.toggler }, self._bodyListener );
$( 'body' ).on( 'click', { wrap: self.wrap, toggler: self.toggler }, self._bodyListener );
else
$( "body" ).off( 'click', self._bodyListener );
$( 'body' ).off( 'click', self._bodyListener );
});
self.element.change(function( event ) {
@ -114,9 +114,9 @@
// $("#input").wpColorPicker('color', '#bada55') to set
color: function( newColor ) {
if ( newColor === undef )
return this.element.iris( "option", "color" );
return this.element.iris( 'option', 'color' );
this.element.iris( "option", "color", newColor );
this.element.iris( 'option', 'color', newColor );
},
//$("#input").wpColorPicker('defaultColor') returns the current default color
//$("#input").wpColorPicker('defaultColor', newDefaultColor) to set
@ -126,7 +126,7 @@
this.options.defaultColor = newDefaultColor;
}
}
};
$.widget( 'wp.wpColorPicker', ColorPicker );
}( jQuery ) );