Edit File: jquery.minicolors.min.js
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,h,d){a instanceof String&&(a=String(a));for(var c=a.length,f=0;f<c;f++){var k=a[f];if(h.call(d,k,f,a))return{i:f,v:k}}return{i:-1,v:void 0}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,h,d){a!=Array.prototype&&a!=Object.prototype&&(a[h]=d.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a}; $jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,h,d,c){if(h){d=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var f=a[c];f in d||(d[f]={});d=d[f]}a=a[a.length-1];c=d[a];h=h(c);h!=c&&null!=h&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:h})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6-impl","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(a){return $jscomp.SYMBOL_PREFIX+(a||"")+$jscomp.symbolCounter_++}; $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var h=0;return $jscomp.iteratorPrototype(function(){return h<a.length?{done:!1,value:a[h++]}:{done:!0}})}; $jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.iteratorFromArray=function(a,h){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var d=0,c={next:function(){if(d<a.length){var f=d++;return{value:h(f,a[f]),done:!1}}c.next=function(){return{done:!0,value:void 0}};return c.next()}};c[Symbol.iterator]=function(){return c};return c}; $jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a){return a})}},"es6-impl","es3"); (function(a){function h(b,e){var g=a('<div class="minicolors" />'),q=a.minicolors.defaults,l;if(!b.data("minicolors-initialized")){e=a.extend(!0,{},q,e);g.addClass("minicolors-theme-"+e.theme).toggleClass("minicolors-with-opacity",e.opacity);void 0!==e.position&&a.each(e.position.split(" "),function(){g.addClass("minicolors-position-"+this)});q="rgb"===e.format?e.opacity?"25":"20":e.keywords?"11":"7";b.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",e).prop("size", q).wrap(g).after('<div class="minicolors-panel minicolors-slider-'+e.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>');e.inline||b.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'); b.on("focus.minicolors blur.minicolors keydown.minicolors keyup.minicolors paste.minicolors",function(e){var g=e.type;if("focus"===g)c(b);else if("blur"===g){if(e=b.data("minicolors-settings"),b.data("minicolors-initialized")){g=e.keywords?a.map(e.keywords.split(","),function(b){return a.trim(b.toLowerCase())}):[];if(""!==b.val()&&-1<a.inArray(b.val().toLowerCase(),g))var q=b.val();else g=v(b.val())?y(b.val(),!0):(g=z(b.val(),!0))?w(g):null,q=null===g?e.defaultValue:"rgb"===e.format?e.opacity?y("rgba("+ g.r+","+g.g+","+g.b+","+b.attr("data-opacity")+")"):y("rgb("+g.r+","+g.g+","+g.b+")"):C(g);g=e.opacity?b.attr("data-opacity"):1;"transparent"===q.toLowerCase()&&(g=0);b.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",g);b.val(q);""===b.val()&&b.val(E(e.defaultValue,!0));b.val(B(b.val(),e.letterCase))}}else if("keydown"===g)switch(e.which){case 9:f();break;case 13:case 27:f(),b.blur()}else if("keyup"===g||"paste"===g)"keyup"===g?t(b,!0):setTimeout(function(){t(b,!0)},1)}).closest(".minicolors").on("mousedown.minicolors touchstart.minicolors", ".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(b){if(1===b.which){b.preventDefault();var e=a(this),g=document.body.contains(this)?document:top.document;k(e,b,!0);a(g).on("mousemove.minicolors touchmove.minicolors",function(b){k(e,b)}).one("mouseup.minicolors touchend.minicolors",function(){a(g).off("mousemove.minicolors touchmove.minicolors")})}}).on("click.minicolors",".minicolors-swatches li",function(b){b.preventDefault();var e=a(this);b=e.parents(".minicolors").find(".minicolors-input"); e=e.data("swatch-color");u(b,e,F(e));t(b)}).find(".minicolors-input-swatch").on("click mousedown.minicolors touchstart.minicolors",function(g){if("click"===g.type)e.inline||b.focus();else if(1===g.which)c(b);else return;g.preventDefault()});q=b.parent().find(".minicolors-panel");q.on("selectstart",function(){return!1}).end();if(e.swatches&&0!==e.swatches.length){q.addClass("minicolors-with-swatches");var h=a('<ul class="minicolors-swatches"></ul>').appendTo(q);for(l=0;l<e.swatches.length;++l){if("object"=== a.type(e.swatches[l])){q=e.swatches[l].name;var d=e.swatches[l].color}else q="",d=e.swatches[l];var H=d;d=v(d)?y(d,!0):w(z(d,!0));a('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color" title="'+q+'"></span></li>').appendTo(h).data("swatch-color",H).find(".minicolors-swatch-color").css({backgroundColor:C(d),opacity:d.a});e.swatches[l]=d}}e.inline&&b.parent().addClass("minicolors-inline");t(b,!1);b.data("minicolors-initialized",!0)}}function d(b){var e=b.parent();b.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"); e.before(b).remove()}function c(b){var e=b.parent(),g=e.find(".minicolors-panel"),q=b.data("minicolors-settings"),l=document.body.contains(b[0])?document:top.document;!b.data("minicolors-initialized")||b.prop("disabled")||e.hasClass("minicolors-inline")||e.hasClass("minicolors-focus")||(f(),e.addClass("minicolors-focus"),g.animate?g.stop(!0,!0).fadeIn(q.showSpeed,function(){q.show&&q.show.call(b.get(0))}):(g.show(),q.show&&q.show.call(b.get(0))),a(l).on("mousedown.minicolors touchstart.minicolors", function(b){1===b.which&&0===a(b.target).closest(".minicolors,.minicolors_wrapper").length&&(a(this).off("mousemove.minicolors touchmove.minicolors mousedown.minicolors touchstart.minicolors mouseup.minicolors touchend.minicolors"),f(this),l=null)}))}function f(b){a(".minicolors-focus",b).each(function(){var b=a(this),g=b.find(".minicolors-input"),q=b.find(".minicolors-panel"),l=g.data("minicolors-settings");q.animate?q.fadeOut(l.hideSpeed,function(){l.hide&&l.hide.call(g.get(0));b.removeClass("minicolors-focus")}): (q.hide(),l.hide&&l.hide.call(g.get(0)),b.removeClass("minicolors-focus"))})}function k(b,e,g){var a=b.parents(".minicolors").find(".minicolors-input"),l=a.data("minicolors-settings"),h=b.find("[class$=-picker]"),d=b.offset().left,c=b.offset().top,m=Math.round(e.pageX-d),f=Math.round(e.pageY-c);g=g?l.animationSpeed:0;e.originalEvent.changedTouches&&(m=e.originalEvent.changedTouches[0].pageX-d,f=e.originalEvent.changedTouches[0].pageY-c);0>m&&(m=0);0>f&&(f=0);m>b.width()&&(m=b.width());f>b.height()&& (f=b.height());b.parent().is(".minicolors-slider-wheel")&&h.parent().is(".minicolors-grid")&&(d=75-m,c=75-f,e=Math.sqrt(d*d+c*c),d=Math.atan2(c,d),0>d&&(d+=2*Math.PI),75<e&&(e=75,m=75-75*Math.cos(d),f=75-75*Math.sin(d)),m=Math.round(m),f=Math.round(f));f={top:f+"px"};b.is(".minicolors-grid")&&(f.left=m+"px");h.animate?h.stop(!0).animate(f,g,l.animationEasing,function(){n(a,b)}):(h.css(f),n(a,b))}function n(b,e){function g(b,e){if(!b.length||!e)return null;var a=b.offset().left;var g=b.offset().top; return{x:a-e.offset().left+b.outerWidth()/2,y:g-e.offset().top+b.outerHeight()/2}}var a=b.val();var l=b.attr("data-opacity");var d=b.parent();var h=b.data("minicolors-settings");var c=d.find(".minicolors-input-swatch");var f=d.find(".minicolors-grid");var k=d.find(".minicolors-slider"),t=d.find(".minicolors-opacity-slider");var r=f.find("[class$=-picker]");var n=k.find("[class$=-picker]"),v=t.find("[class$=-picker]");r=g(r,f);n=g(n,k);v=g(v,t);if(e.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(h.control){case "wheel":a= f.width()/2-r.x;d=f.height()/2-r.y;f=Math.sqrt(a*a+d*d);a=Math.atan2(d,a);0>a&&(a+=2*Math.PI);75<f&&(f=75,r.x=69-75*Math.cos(a),r.y=69-75*Math.sin(a));l=p(f/.75,0,100);c=p(180*a/Math.PI,0,360);r=p(100-Math.floor(n.y*(100/k.height())),0,100);a=x({h:c,s:l,b:r});k.css("backgroundColor",x({h:c,s:l,b:100}));break;case "saturation":c=p(parseInt(r.x*(360/f.width()),10),0,360);l=p(100-Math.floor(n.y*(100/k.height())),0,100);r=p(100-Math.floor(r.y*(100/f.height())),0,100);a=x({h:c,s:l,b:r});k.css("backgroundColor", x({h:c,s:100,b:r}));d.find(".minicolors-grid-inner").css("opacity",l/100);break;case "brightness":c=p(parseInt(r.x*(360/f.width()),10),0,360);l=p(100-Math.floor(r.y*(100/f.height())),0,100);r=p(100-Math.floor(n.y*(100/k.height())),0,100);a=x({h:c,s:l,b:r});k.css("backgroundColor",x({h:c,s:l,b:100}));d.find(".minicolors-grid-inner").css("opacity",1-r/100);break;default:c=p(360-parseInt(n.y*(360/k.height()),10),0,360),l=p(Math.floor(r.x*(100/f.width())),0,100),r=p(100-Math.floor(r.y*(100/f.height())), 0,100),a=x({h:c,s:l,b:r}),f.css("backgroundColor",x({h:c,s:100,b:100}))}l=h.opacity?parseFloat(1-v.y/t.height()).toFixed(2):1;u(b,a,l)}else c.find("span").css({backgroundColor:a,opacity:l}),D(b,a,l)}function u(b,e,a){var g=b.parent(),d=b.data("minicolors-settings"),g=g.find(".minicolors-input-swatch");d.opacity&&b.attr("data-opacity",a);if("rgb"===d.format){e=v(e)?y(e,!0):w(z(e,!0));a=""===b.attr("data-opacity")?1:p(parseFloat(b.attr("data-opacity")).toFixed(2),0,1);if(isNaN(a)||!d.opacity)a=1;e= 1>=b.minicolors("rgbObject").a&&e&&d.opacity?"rgba("+e.r+", "+e.g+", "+e.b+", "+parseFloat(a)+")":"rgb("+e.r+", "+e.g+", "+e.b+")"}else v(e)&&(e=G(e)),e=B(e,d.letterCase);b.val(e);g.find("span").css({backgroundColor:e,opacity:a});D(b,e,a)}function t(b,e){var g;var d=b.parent();var c=b.data("minicolors-settings");var h=d.find(".minicolors-input-swatch");var f=d.find(".minicolors-grid"),k=d.find(".minicolors-slider");var m=d.find(".minicolors-opacity-slider");var t=f.find("[class$=-picker]"),n=k.find("[class$=-picker]"), r=m.find("[class$=-picker]");if(v(b.val())){var u=G(b.val());(g=p(parseFloat(F(b.val())).toFixed(2),0,1))&&b.attr("data-opacity",g)}else u=B(z(b.val(),!0),c.letterCase);u||(u=B(E(c.defaultValue,!0),c.letterCase));g=I(u);var A=c.keywords?a.map(c.keywords.split(","),function(b){return a.trim(b.toLowerCase())}):[];A=""!==b.val()&&-1<a.inArray(b.val().toLowerCase(),A)?B(b.val()):v(b.val())?y(b.val()):u;e||b.val(A);if(c.opacity){var w=""===b.attr("data-opacity")?1:p(parseFloat(b.attr("data-opacity")).toFixed(2), 0,1);isNaN(w)&&(w=1);b.attr("data-opacity",w);h.find("span").css("opacity",w);m=p(m.height()-m.height()*w,0,m.height());r.css("top",m+"px")}"transparent"===b.val().toLowerCase()&&h.find("span").css("opacity",0);h.find("span").css("backgroundColor",u);switch(c.control){case "wheel":d=p(Math.ceil(.75*g.s),0,f.height()/2);h=g.h*Math.PI/180;c=p(75-Math.cos(h)*d,0,f.width());m=p(75-Math.sin(h)*d,0,f.height());t.css({top:m+"px",left:c+"px"});m=150-g.b/(100/f.height());""===u&&(m=0);n.css("top",m+"px"); k.css("backgroundColor",x({h:g.h,s:g.s,b:100}));break;case "saturation":c=p(5*g.h/12,0,150);m=p(f.height()-Math.ceil(g.b/(100/f.height())),0,f.height());t.css({top:m+"px",left:c+"px"});m=p(k.height()-g.s*(k.height()/100),0,k.height());n.css("top",m+"px");k.css("backgroundColor",x({h:g.h,s:100,b:g.b}));d.find(".minicolors-grid-inner").css("opacity",g.s/100);break;case "brightness":c=p(5*g.h/12,0,150);m=p(f.height()-Math.ceil(g.s/(100/f.height())),0,f.height());t.css({top:m+"px",left:c+"px"});m=p(k.height()- g.b*(k.height()/100),0,k.height());n.css("top",m+"px");k.css("backgroundColor",x({h:g.h,s:g.s,b:100}));d.find(".minicolors-grid-inner").css("opacity",1-g.b/100);break;default:c=p(Math.ceil(g.s/(100/f.width())),0,f.width()),m=p(f.height()-Math.ceil(g.b/(100/f.height())),0,f.height()),t.css({top:m+"px",left:c+"px"}),m=p(k.height()-g.h/(360/k.height()),0,k.height()),n.css("top",m+"px"),f.css("backgroundColor",x({h:g.h,s:100,b:100}))}b.data("minicolors-initialized")&&D(b,A,w)}function D(b,a,g){var e= b.data("minicolors-settings"),d=b.data("minicolors-lastChange"),c;if(!d||d.value!==a||d.opacity!==g){b.data("minicolors-lastChange",{value:a,opacity:g});if(e.swatches&&0!==e.swatches.length){d=v(a)?y(a,!0):w(a);var f=-1;for(c=0;c<e.swatches.length;++c)if(d.r===e.swatches[c].r&&d.g===e.swatches[c].g&&d.b===e.swatches[c].b&&d.a===e.swatches[c].a){f=c;break}b.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected");-1!==f&&b.parent().find(".minicolors-swatches .minicolors-swatch").eq(c).addClass("selected")}e.change&& (e.changeDelay?(clearTimeout(b.data("minicolors-changeTimeout")),b.data("minicolors-changeTimeout",setTimeout(function(){e.change.call(b.get(0),a,g)},e.changeDelay))):e.change.call(b.get(0),a,g));b.trigger("change").trigger("input")}}function A(b){var e=a(b).attr("data-opacity");v(a(b).val())?b=y(a(b).val(),!0):(b=z(a(b).val(),!0),b=w(b));if(!b)return null;void 0!==e&&a.extend(b,{a:parseFloat(e)});return b}function J(b,e){var g=a(b).attr("data-opacity");if(v(a(b).val()))var d=y(a(b).val(),!0);else d= z(a(b).val(),!0),d=w(d);if(!d)return null;void 0===g&&(g=1);return e?"rgba("+d.r+", "+d.g+", "+d.b+", "+parseFloat(g)+")":"rgb("+d.r+", "+d.g+", "+d.b+")"}function B(b,a){return"uppercase"===a?b.toUpperCase():b.toLowerCase()}function z(b,a){b=b.replace(/^#/g,"");if(!b.match(/^[A-F0-9]{3,6}/ig)||3!==b.length&&6!==b.length)return"";3===b.length&&a&&(b=b[0]+b[0]+b[1]+b[1]+b[2]+b[2]);return"#"+b}function y(b,a){var e=b.replace(/[^\d,.]/g,"").split(",");e[0]=p(parseInt(e[0],10),0,255);e[1]=p(parseInt(e[1], 10),0,255);e[2]=p(parseInt(e[2],10),0,255);void 0!==e[3]&&(e[3]=p(parseFloat(e[3],10),0,1));return a?void 0!==e[3]?{r:e[0],g:e[1],b:e[2],a:e[3]}:{r:e[0],g:e[1],b:e[2]}:"undefined"!==typeof e[3]&&1>=e[3]?"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")":"rgb("+e[0]+", "+e[1]+", "+e[2]+")"}function E(b,e){return v(b)?y(b):z(b,e)}function p(b,e,a){b<e&&(b=e);b>a&&(b=a);return b}function v(b){return(b=b.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===b.length?!0:!1}function F(b){return(b= b.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i))&&6===b.length?b[4]:"1"}function G(b){return(b=b.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===b.length?"#"+("0"+parseInt(b[1],10).toString(16)).slice(-2)+("0"+parseInt(b[2],10).toString(16)).slice(-2)+("0"+parseInt(b[3],10).toString(16)).slice(-2):""}function C(b){var e=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];a.each(e,function(b, a){1===a.length&&(e[b]="0"+a)});return"#"+e.join("")}function x(b){var e=C,a,d;var c=Math.round(b.h);var f=Math.round(255*b.s/100);b=Math.round(255*b.b/100);if(0===f)c=a=d=b;else{var f=(255-f)*b/255,h=c%60*(b-f)/60;360===c&&(c=0);60>c?(c=b,d=f,a=f+h):120>c?(a=b,d=f,c=b-h):180>c?(a=b,c=f,d=f+h):240>c?(d=b,c=f,a=b-h):300>c?(d=b,a=f,c=f+h):360>c?(c=b,a=f,d=b-h):d=a=c=0}return e({r:Math.round(c),g:Math.round(a),b:Math.round(d)})}function I(b){b=w(b);var a={h:0,s:0,b:0},d=Math.max(b.r,b.g,b.b),c=d-Math.min(b.r, b.g,b.b);a.b=d;a.s=0!==d?255*c/d:0;a.h=0!==a.s?b.r===d?(b.g-b.b)/c:b.g===d?2+(b.b-b.r)/c:4+(b.r-b.g)/c:-1;a.h*=60;0>a.h&&(a.h+=360);a.s*=100/255;a.b*=100/255;0===a.s&&(a.h=360);return a}function w(b){b=parseInt(-1<b.indexOf("#")?b.substring(1):b,16);return{r:b>>16,g:(b&65280)>>8,b:b&255}}a.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1, position:"bottom",show:null,showSpeed:100,theme:"default",swatches:[]}};a.extend(a.fn,{minicolors:function(b,e){switch(b){case "destroy":return a(this).each(function(){d(a(this))}),a(this);case "hide":return f(),a(this);case "opacity":if(void 0===e)return a(this).attr("data-opacity");a(this).each(function(){t(a(this).attr("data-opacity",e))});return a(this);case "rgbObject":return A(a(this),"rgbaObject"===b);case "rgbString":case "rgbaString":return J(a(this),"rgbaString"===b);case "settings":if(void 0=== e)return a(this).data("minicolors-settings");a(this).each(function(){var b=a(this).data("minicolors-settings")||{};d(a(this));a(this).minicolors(a.extend(!0,b,e))});return a(this);case "show":return c(a(this).eq(0)),a(this);case "value":if(void 0===e)return a(this).val();a(this).each(function(){"object"===typeof e&&null!==e?(void 0!==e.opacity&&a(this).attr("data-opacity",p(e.opacity,0,1)),e.color&&a(this).val(e.color)):a(this).val(e);t(a(this))});return a(this);default:return"create"!==b&&(e=b), a(this).each(function(){h(a(this),e)}),a(this)}}})})(jQuery); (function(a){window.themifyColorManager={colorSwatches:{},initilized:!1,init:function(){if(!this.initilized){for(var a=Object.keys(themifyCM.colors),d=a.length,c=0;c<d;c++)this.colorSwatches[a[c]]=themifyCM.colors[a[c]];this.initilized=!0}},toRgba:function(a){return a.color.replace("rgb","rgba").replace(")",","+a.opacity+")")},toColorsArray:function(){for(var a=[],d=Object.keys(this.colorSwatches),c=d.length-1;0<=c;--c)a.push(this.toRgba(this.colorSwatches[d[c]]));a.length||(a=["#FFF"]);return a}, initColorPicker:function(){var a=window.top.document.querySelector(".minicolors-focus .minicolors-panel");if(null===a.querySelector(".tb_swatches_container")){var d=document.createDocumentFragment(),c=document.createElement("div");c.className="tb_swatches_container";d.appendChild(c);c.addEventListener("click",this.initClick.bind(this));c.appendChild(a.querySelector(".minicolors-swatches"));for(var f=d.querySelectorAll(".minicolors-swatch"),k=Object.keys(this.colorSwatches),k=k.reverse(),n=f.length- 1;0<=n;--n){if(!k.length){f[n].parentNode.removeChild(f[n]);break}var u=document.createElement("span");u.className="tb_delete_swatch ti-close";f[n].appendChild(u);u="undefined"!==typeof this.colorSwatches[k[n]].uid?this.colorSwatches[k[n]].uid:this.UID()+n;f[n].dataset.uid=this.colorSwatches[k[n]].uid=u}f=document.createElement("div");f.className="tb_add_swatch ti-plus";c.appendChild(f);f=document.createElement("div");f.className="tb_cm_dropdown_icon ti-import";f.setAttribute("tabIndex","-1");f.appendChild(this.makeImportExportDropdown()); c.appendChild(f);a.appendChild(d);"undefined"!==typeof SimpleBar&&new SimpleBar(a.querySelector(".minicolors-swatches"))}},makeImportExportDropdown:function(){var a=document.createElement("div");a.className="tb_cm_dropdown";var d=document.createElement("ul"),c=document.createElement("li");c.className="tb_cm_import";c.innerText=themifyCM.labels["import"];d.appendChild(c);c=document.createElement("li");c.className="tb_cm_export";c.innerText=themifyCM.labels["export"];d.appendChild(c);a.appendChild(d); return a},UID:function(){return(Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)).substring(0,5)},initClick:function(a){a.preventDefault();var d=a.target,c=d.classList;c.contains("tb_delete_swatch")?this.deleteSwatch(a):c.contains("tb_add_swatch")?this.addSwatch():c.contains("tb_cm_export")?(d.parentNode.parentNode.parentNode.blur(),document.location.assign(themifyCM.exportColorsURL)):c.contains("tb_cm_import")&&(d.parentNode.parentNode.parentNode.blur(),this.importColors("colors"))}, importColors:function(h){var d=window.top.document.getElementsByClassName("themify_cm_input");d.length?(d=d[0],d.dataset.type=h):(d=document.createElement("input"),d.type="file",d.dataset.type=h,d.className="themify_cm_input",d.addEventListener("change",function(d){var c=d.target.files[0],h=new FormData,n=d.target.dataset.type;h.append("file",c,c.name);h.append("action","themify_import_colors");h.append("tb_load_nonce",themifyCM.nonce);h.append("type",n);a.ajax({url:themifyCM.ajax_url,type:"POST", data:h,cache:!1,dataType:"json",processData:!1,contentType:!1,success:function(a){if("SUCCESS"===a.status)if("colors"===n){themifyColorManager.colorSwatches=a.colors;var d=window.top.document.querySelectorAll(".tb_swatches_container .minicolors-swatch");for(var c=d.length-1;0<=c;--c)d[c].parentNode.removeChild(d[c]);d=Object.keys(themifyColorManager.colorSwatches);var f=d.length;for(c=0;c<f;c++)themifyColorManager.addSwatchHtml(themifyColorManager.colorSwatches[d[c]].color,themifyColorManager.colorSwatches[d[c]].opacity, d[c])}else if("gradients"===n){var h=ThemifyBuilderCommon.Lightbox.$lightbox.find(".tb_gradient_container").first().data("themifyGradient");f=Object.keys(themifyCM.gradients);for(c=f.length-1;0<=c;--c)h.removeSwatch(f[c]);themifyCM.gradients=a.colors;d=Object.keys(themifyCM.gradients);f=d.length;for(c=0;c<f;c++)h.addSwatch(themifyCM.gradients[d[c]])}alert(a.msg)}})}));d.click()},deleteSwatch:function(a){a.preventDefault();a.stopPropagation();a=a.target.parentNode.dataset.uid;for(var d=window.top.document.querySelectorAll('[data-uid="'+ a+'"]'),c=d.length-1;0<=c;--c)d[c].parentNode.removeChild(d[c]);delete this.colorSwatches[a];this.updateColorSwatches("colors")},updateColorSwatches:function(h){a.ajax({type:"POST",url:themifyCM.ajax_url,dataType:"json",data:{action:"themify_save_colors",type:h,tb_load_nonce:themifyCM.nonce,colors:"colors"===h?this.colorSwatches:themifyCM.gradients}})},addSwatch:function(){var a=window.top.document.querySelector(".minicolors-focus .minicolors-input"),d=this.hex2Rgb(a.value),a=a.dataset.opacity,c= !1;if(null===d)return!1;for(var f=Object.keys(this.colorSwatches),k=f.length-1;0<=k;--k)if(this.colorSwatches[f[k]].color.replace(/\s/g,"")===d&&parseFloat(this.colorSwatches[f[k]].opacity)===parseFloat(a)){c=!0;break}c||(c=this.UID(),this.addSwatchHtml(d,a,c),this.colorSwatches[c]={color:d,opacity:a,uid:c},this.updateColorSwatches("colors"))},addSwatchHtml:function(a,d,c){function f(c){var f=document.createElement("li");f.className="minicolors-swatch minicolors-sprite";f.dataset.uid=c;f.dataset.swatchColor= a.replace(")",", "+d+")").replace("rgb","rgba");c=document.createElement("span");c.className="minicolors-swatch-color";c.style.backgroundColor=a;c.style.opacity=d;f.appendChild(c);c=document.createElement("span");c.className="tb_delete_swatch ti-close";f.appendChild(c);return f}for(var h=window.top.document.querySelectorAll(".tb_swatches_container .minicolors-swatches .simplebar-content"),h=0===h.length?window.top.document.querySelectorAll(".tb_swatches_container .minicolors-swatches"):h,n=h.length- 1;0<=n;--n)h[n].insertBefore(f(c),h[n].firstChild);h=null},hex2Rgb:function(a){return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?"rgb("+parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)+")":null}};window.themifyColorManager.init()})(jQuery,window,document);
Back to File Manager