mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
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:
parent
c81508dc43
commit
8789532eb8
@ -1,13 +1,13 @@
|
|||||||
|
/* global wpColorPickerL10n:true */
|
||||||
( function( $, undef ){
|
( function( $, undef ){
|
||||||
|
|
||||||
// html stuff
|
// html stuff
|
||||||
var _before = '<a tabindex="0" class="wp-color-result" />',
|
var _before = '<a tabindex="0" class="wp-color-result" />',
|
||||||
_after = '<div class="wp-picker-holder" />',
|
_after = '<div class="wp-picker-holder" />',
|
||||||
_wrap = '<div class="wp-picker-container" />',
|
_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
|
// jQuery UI Widget constructor
|
||||||
var ColorPicker = {
|
ColorPicker = {
|
||||||
options: {
|
options: {
|
||||||
defaultColor: false,
|
defaultColor: false,
|
||||||
change: false,
|
change: false,
|
||||||
@ -19,8 +19,8 @@
|
|||||||
// bail early for unsupported Iris.
|
// bail early for unsupported Iris.
|
||||||
if ( ! $.support.iris )
|
if ( ! $.support.iris )
|
||||||
return;
|
return;
|
||||||
var self = this;
|
var self = this,
|
||||||
var el = self.element;
|
el = self.element;
|
||||||
|
|
||||||
$.extend( self.options, el.data() );
|
$.extend( self.options, el.data() );
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
// Set up HTML structure, hide things
|
// Set up HTML structure, hide things
|
||||||
el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
|
el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
|
||||||
self.wrap = el.parent();
|
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.pickerContainer = $( _after ).insertAfter( el );
|
||||||
self.button = $( _button );
|
self.button = $( _button );
|
||||||
|
|
||||||
@ -69,9 +69,9 @@
|
|||||||
|
|
||||||
// close picker when you click outside it
|
// close picker when you click outside it
|
||||||
if ( self.toggler.hasClass( 'wp-picker-open' ) )
|
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
|
else
|
||||||
$( "body" ).off( 'click', self._bodyListener );
|
$( 'body' ).off( 'click', self._bodyListener );
|
||||||
});
|
});
|
||||||
|
|
||||||
self.element.change(function( event ) {
|
self.element.change(function( event ) {
|
||||||
@ -114,9 +114,9 @@
|
|||||||
// $("#input").wpColorPicker('color', '#bada55') to set
|
// $("#input").wpColorPicker('color', '#bada55') to set
|
||||||
color: function( newColor ) {
|
color: function( newColor ) {
|
||||||
if ( newColor === undef )
|
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') returns the current default color
|
||||||
//$("#input").wpColorPicker('defaultColor', newDefaultColor) to set
|
//$("#input").wpColorPicker('defaultColor', newDefaultColor) to set
|
||||||
@ -126,7 +126,7 @@
|
|||||||
|
|
||||||
this.options.defaultColor = newDefaultColor;
|
this.options.defaultColor = newDefaultColor;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$.widget( 'wp.wpColorPicker', ColorPicker );
|
$.widget( 'wp.wpColorPicker', ColorPicker );
|
||||||
}( jQuery ) );
|
}( jQuery ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user