- md5
- f280e3eca3326672aadc6034a88865e7
- sha1
- 1684735887bc59b5a48c1ff47d4cf6706d18f29d
- sha256
- 6c79e5bcb86802bc2ca91663e539113cd004f5ab54e8c4a74fcd8552932b4bb8
!function(t){var s=function(s,e){this.select=t(s),this.options=t.extend({},t.fn.simplecolors.defaults,e),this.select.hide();var o="";t("option",this.select).each(function(){var s=t(this),e=s.val();if("-"==s.text())o+="<br />";else{var n="simplecolors-swatch";"none"==e&&(n+=" nocolor",e="transparent"),s.attr("selected")&&(n+=" active"),o+='<span class="'+n+'"><span style="background-color: '+e+';" tabindex="0"></span></span>'}});var n=this.select.val(),i="simplecolors-swatch";"none"==n&&(i+=" nocolor",n="transparent"),this.icon=t('<span class="'+i+'"><span style="background-color: '+n+';" tabindex="0"></span></span>').insertAfter(this.select),this.icon.on("click",t.proxy(this.show,this)),this.panel=t('<span class="simplecolors-panel"></span>').appendTo(document.body),this.panel.html(o),this.panel.on("click",t.proxy(this.click,this)),t(document).on("mousedown",t.proxy(this.hide,this)),this.panel.on("mousedown",t.proxy(this.mousedown,this))};s.prototype={constructor:s,show:function(){var t=this.icon.offset();switch(this.select.attr("data-position")){case"top":this.panel.css({left:t.left-7,top:t.top-this.panel.outerHeight()-1});break;case"bottom":this.panel.css({left:t.left-7,top:t.top+this.icon.outerHeight()});break;case"left":this.panel.css({left:t.left-this.panel.outerWidth(),top:t.top-(this.panel.outerHeight()-this.icon.outerHeight())/2-1});break;case"right":default:this.panel.css({left:t.left+this.icon.outerWidth(),top:t.top-(this.panel.outerHeight()-this.icon.outerHeight())/2-1})}this.panel.show(this.options.delay)},hide:function(){"none"!=this.panel.css("display")&&this.panel.hide(this.options.delay)},click:function(s){var e=t(s.target);if(1===e.length&&"span"===e[0].nodeName.toLowerCase()){var o="",n="",i="";e.parent().hasClass("nocolor")?(o="none",n="transparent",i="nocolor"):n=o=this.rgb2hex(e.css("background-color")),e.parent().siblings().removeClass("active"),e.parent().addClass("active"),this.icon.removeClass("nocolor").addClass(i),this.icon.find("span").css("background-color",n),this.hide(),this.select.val(o).change()}},mousedown:function(t){t.stopPropagation(),t.preventDefault()},rgb2hex:function(t){function s(t){return("0"+parseInt(t,10).toString(16)).slice(-2)}var e=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);return null===e?t:"#"+s(e[1])+s(e[2])+s(e[3])}},t.fn.simplecolors=function(e){return this.each(function(){var o=t(this),n=o.data("simplecolors"),i="object"==typeof e&&e;n||o.data("simplecolors",n=new s(this,i)),"string"==typeof e&&n[e]()})},t.fn.simplecolors.Constructor=s,t.fn.simplecolors.defaults={delay:0}}(jQuery);
No other release has this exact content. See every version of this file.