Changeset 26067
- Timestamp:
- 11/09/2013 09:28:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/color-picker.js
r23443 r26067 1 /* global wpColorPickerL10n:true */ 1 2 ( function( $, undef ){ 2 3 … … 5 6 _after = '<div class="wp-picker-holder" />', 6 7 _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" />', 9 9 // jQuery UI Widget constructor 10 varColorPicker = {10 ColorPicker = { 11 11 options: { 12 12 defaultColor: false, … … 20 20 if ( ! $.support.iris ) 21 21 return; 22 var self = this ;23 varel = self.element;22 var self = this, 23 el = self.element; 24 24 25 25 $.extend( self.options, el.data() ); … … 30 30 el.addClass( 'wp-color-picker' ).hide().wrap( _wrap ); 31 31 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 ); 33 33 self.pickerContainer = $( _after ).insertAfter( el ); 34 34 self.button = $( _button ); … … 70 70 // close picker when you click outside it 71 71 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 ); 73 73 else 74 $( "body").off( 'click', self._bodyListener );74 $( 'body' ).off( 'click', self._bodyListener ); 75 75 }); 76 76 … … 115 115 color: function( newColor ) { 116 116 if ( newColor === undef ) 117 return this.element.iris( "option", "color");117 return this.element.iris( 'option', 'color' ); 118 118 119 this.element.iris( "option", "color", newColor );119 this.element.iris( 'option', 'color', newColor ); 120 120 }, 121 121 //$("#input").wpColorPicker('defaultColor') returns the current default color … … 127 127 this.options.defaultColor = newDefaultColor; 128 128 } 129 } 129 }; 130 130 131 131 $.widget( 'wp.wpColorPicker', ColorPicker );
Note: See TracChangeset
for help on using the changeset viewer.