WordPress/wp-admin/js/color-picker.min.js
Bot (Assets) 6e798324e9 New develop.svn.wordpress.org repository based on the old core.svn repository.
* All WordPress files move to a src/ directory.
 * New task runner (Grunt), configured to copy a built WordPress to build/.
 * svn:ignore and .gitignore for Gruntfile.js, wp-config.php, and node.js.
 * Remove Akismet external from develop.svn. Still exists in core.svn.
 * Drop minified files from src/. The build process will now generate these.

props koop.
see #24976.

and see http://wp.me/p2AvED-1AI.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-07 05:49:02 +00:00

1 line
2.4 KiB
JavaScript

!function(a,b){var c='<a tabindex="0" class="wp-color-result" />',d='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',f='<input type="button" class="button button-small hidden" />',g={options:{defaultColor:!1,change:!1,clear:!1,hide:!0,palettes:!0},_create:function(){if(a.support.iris){var b=this,g=b.element;a.extend(b.options,g.data()),b.initialValue=g.val(),g.addClass("wp-color-picker").hide().wrap(e),b.wrap=g.parent(),b.toggler=a(c).insertBefore(g).css({backgroundColor:b.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),b.pickerContainer=a(d).insertAfter(g),b.button=a(f),b.options.defaultColor?b.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString):b.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),g.wrap('<span class="wp-picker-input-wrap" />').after(b.button),g.iris({target:b.pickerContainer,hide:!0,width:255,mode:"hsv",palettes:b.options.palettes,change:function(c,d){b.toggler.css({backgroundColor:d.color.toString()}),a.isFunction(b.options.change)&&b.options.change.call(this,c,d)}}),g.val(b.initialValue),b._addListeners(),b.options.hide||b.toggler.click()}},_addListeners:function(){var b=this;b.toggler.click(function(c){c.stopPropagation(),b.element.toggle().iris("toggle"),b.button.toggleClass("hidden"),b.toggler.toggleClass("wp-picker-open"),b.toggler.hasClass("wp-picker-open")?a("body").on("click",{wrap:b.wrap,toggler:b.toggler},b._bodyListener):a("body").off("click",b._bodyListener)}),b.element.change(function(c){var d=a(this),e=d.val();(""===e||"#"===e)&&(b.toggler.css("backgroundColor",""),a.isFunction(b.options.clear)&&b.options.clear.call(this,c))}),b.toggler.on("keyup",function(a){(13===a.keyCode||32===a.keyCode)&&(a.preventDefault(),b.toggler.trigger("click").next().focus())}),b.button.click(function(c){var d=a(this);d.hasClass("wp-picker-clear")?(b.element.val(""),b.toggler.css("backgroundColor",""),a.isFunction(b.options.clear)&&b.options.clear.call(this,c)):d.hasClass("wp-picker-default")&&b.element.val(b.options.defaultColor).change()})},_bodyListener:function(a){a.data.wrap.find(a.target).length||a.data.toggler.click()},color:function(a){return a===b?this.element.iris("option","color"):(this.element.iris("option","color",a),void 0)},defaultColor:function(a){return a===b?this.options.defaultColor:(this.options.defaultColor=a,void 0)}};a.widget("wp.wpColorPicker",g)}(jQuery);