/*! wp-color-picker-alpha - Version 1.0 * Copyright (c) 2017 Elegant Themes; Licensed under the GPLv2 license. * This is modified version made by Elegant Themes based on the work covered by the following copyright: * wp-color-picker-alpha - Version: 1.1 * https://github.com/23r9i0/wp-color-picker-alpha * Copyright (c) 2015 Sergio P.A. (23r9i0); Licensed under the GPLv2 license. */ !function(t){var i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",o='',e='
',r='',a='',n='',s='';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);if(this.error)return"";if(t.length<6)for(var i=6-t.length-1;i>=0;i--)t="0"+t;return"#"+t},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_create:function(){if(t.support.iris){var l=this,c=l.element;t.extend(l.options,c.data()),l.close=t.proxy(l.close,l),l.initialValue=c.val(),c.addClass("wp-color-picker").hide().wrap(r),l.wrap=c.parent(),l.toggler=t(o).insertBefore(c).css({backgroundColor:l.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),l.pickerContainer=t(e).insertAfter(c),l.button=t(a),l.close_button=t(n),l.options.defaultColor?l.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString):l.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),c.wrap('').after(l.button),l.options.diviColorpicker&&(l.close_button.html(s),c.after(l.close_button)),c.iris({target:l.pickerContainer,hide:l.options.hide,width:l.options.width,height:l.options.height,diviColorpicker:l.options.diviColorpicker,mode:l.options.mode,palettes:l.options.palettes,change:function(o,e){l.options.alpha?(l.toggler.css({"background-image":"url("+i+")"}).html(""),l.toggler.find("span").css({width:"100%",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"3px","border-bottom-left-radius":"3px",background:e.color.toString()})):l.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(l.options.change)&&l.options.change.call(this,o,e)}}),c.val(l.initialValue),l._addListeners(),l.options.hide||l.toggler.click()}},_addListeners:function(){var i=this;i.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),i.toggler.click(function(){i.toggler.hasClass("wp-picker-open")?i.close():i.open()}),i.element.change(function(o){var e=t(this),r=e.val();(""===r||i.element.hasClass("iris-error"))&&(i.options.alpha?(i.toggler.css("backgroundColor",""),i.toggler.find("span").css("backgroundColor","")):i.toggler.css("backgroundColor",""),t.isFunction(i.options.clear)&&i.options.clear.call(this,o))}),i.toggler.on("keyup",function(t){(13===t.keyCode||32===t.keyCode)&&(t.preventDefault(),i.toggler.trigger("click").next().focus())}),i.button.click(function(o){var e=t(this);e.hasClass("wp-picker-clear")?(i.element.val(""),i.options.alpha?(i.toggler.css("backgroundColor",""),i.toggler.find("span").css("backgroundColor","")):i.toggler.css("backgroundColor",""),t.isFunction(i.options.clear)&&i.options.clear.call(this,o)):e.hasClass("wp-picker-default")&&i.element.val(i.options.defaultColor).change()}),i.close_button.click(function(t){t.preventDefault(),i.close()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),"undefined"!=typeof this.options.alpha&&this.options.alpha){var i=this,o=i.element,e=' ',r=t(e).appendTo(i.picker.find(".iris-picker-inner")),a=r.find(".iris-slider-offset-alpha"),n={aContainer:r,aSlider:a};i.options.defaultWidth=o.width(),(i._color._alpha<1||1!=i._color.toString().indexOf("rgb"))&&o.width(parseInt(i.options.defaultWidth+100)),t.each(n,function(t,o){i.controls[t]=o}),i.controls.square.css({"margin-right":"0"});var s=i.picker.width()-i.controls.square.width()-20,l=s/6,c=s/2-l;t.each(["aContainer","strip"],function(t,o){i.controls[o].width(c).css({"margin-left":l+"px"})}),i._initControls(),i._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this,i=t.controls;i.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(i,o){t._color._alpha=parseFloat(o.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,o=t.element;if(this.options.alpha){var e=t.controls,r=parseInt(100*t._color._alpha),a=t._color.toRgb(),n=["rgb("+a.r+","+a.g+","+a.b+") 0%","rgba("+a.r+","+a.g+","+a.b+", 0) 100%"],s=t.options.defaultWidth,l=t.picker.closest(".wp-picker-container").find(".wp-color-result");if(e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+i+")"}),l.hasClass("wp-picker-open"))if(e.aSlider.slider("value",r),t._color._alpha<1){var c=e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)");e.strip.attr("style",c),o.width(parseInt(s+100))}else o.width(s)}var p=o.data("reset-alpha")||!1;p&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()})},_addInputListeners:function(t){var i=this,o=700,e=function(o){var e=new Color(t.val()),r=t.val();t.removeClass("iris-error"),e.error?""!==r&&t.addClass("iris-error"):e.toString()!==i._color.toString()&&("keyup"===o.type&&r.match(/^[0-9a-fA-F]{3}$/)||i._setOption("color",e.toString()))};t.on("change",e).on("keyup",i._debounce(e,o)),i.options.hide&&t.one("focus",function(){i.show()})},_dimensions:function(i){var o,e,r,a,n=this,s=n.options,l=n.controls,c=l.square,p=n.picker.find(".iris-strip"),h="77.5%",d="12%",g=20,u=s.border?s.width-g:s.width,f=t.isArray(s.palettes)?s.palettes.length:n._palettes.length;return i&&(c.css("width",""),p.css("width",""),n.picker.css({width:"",height:""})),h=u*(parseFloat(h)/100),d=u*(parseFloat(d)/100),o=s.border?h+g:h,s.diviColorpicker?(c.width(s.width).height(s.height),o=s.height):c.width(h).height(h),p.height(h).width(d),n.picker.css({width:s.width,height:o}),s.palettes?(e=2*h/100,a=h-(f-1)*e,r=a/f,n.picker.find(".iris-palette").each(function(i){var o=0===i?0:e;t(this).css({width:r,height:r,marginLeft:o})}),n.picker.css("paddingBottom",r+e),void p.height(r+e+h)):n.picker.css("paddingBottom","")}})}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});