X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/138998bbd8f7a1ac38b2f1eacbdf7cd522be4b13..HEAD:/wp-admin/js/color-picker.js diff --git a/wp-admin/js/color-picker.js b/wp-admin/js/color-picker.js index 96f55dae..807ff2a1 100644 --- a/wp-admin/js/color-picker.js +++ b/wp-admin/js/color-picker.js @@ -17,7 +17,33 @@ hide: true, palettes: true, width: 255, - mode: 'hsv' + mode: 'hsv', + type: 'full', + slider: 'horizontal' + }, + _createHueOnly: function() { + var self = this, + el = self.element, + color; + + // hide input + el.hide(); + // max saturated color for hue to be obvious + color = 'hsl(' + el.val() + ', 100, 50)'; + + el.iris( { + mode: 'hsl', + type: 'hue', + hide: false, + color: color, + change: function( event, ui ) { + if ( $.isFunction( self.options.change ) ) { + self.options.change.call( this, event, ui ); + } + }, + width: self.options.width, + slider: self.options.slider + } ); }, _create: function() { // bail early for unsupported Iris. @@ -30,6 +56,11 @@ $.extend( self.options, el.data() ); + // hue-only gets created differently + if ( self.options.type === 'hue' ) { + return self._createHueOnly(); + } + // keep close bound so it can be attached to a body listener self.close = $.proxy( self.close, self ); @@ -141,7 +172,6 @@ if ( newColor === undef ) { return this.element.iris( 'option', 'color' ); } - this.element.iris( 'option', 'color', newColor ); }, //$("#input").wpColorPicker('defaultColor') returns the current default color