From bdb5954d279cd5988d8f2dbba53a7b12557142d6 Mon Sep 17 00:00:00 2001 From: Olivier Giulieri Date: Thu, 29 Dec 2016 00:21:35 -0800 Subject: [PATCH] Version 3.3.0. --- bower.json | 13 ++++++------- css/demo.css | 4 ++-- css/evol-colorpicker.css | 4 ++-- index.html | 4 ++-- js/evol-colorpicker.js | 6 +++--- js/evol-colorpicker.min.js | 6 +++--- package.json | 15 ++++++++------- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bower.json b/bower.json index 8954669..7d2654e 100644 --- a/bower.json +++ b/bower.json @@ -1,23 +1,22 @@ { "name": "evol-colorpicker", - "version": "3.2.6", + "version": "3.3.0", "description": "jQuery UI widget for web color picking which looks like the one in Microsoft Office 2010.", "homepage": "http://evoluteur.github.io/colorpicker/", "main": "js/evol-colorpicker.min.js", - "authors": [ - { "name": "Olivier Giulieri", "homepage": "https://github.com/evoluteur" } - ], + "authors": "Olivier Giulieri (https://evoluteur.github.io/)", "license": "MIT", "keywords": [ "colorpicker", "color", "picker", "palette", - "input", "jquery", "jquery-ui", - "widget", "ui", - "web" + "widget", + "web", + "input", + "form" ] } diff --git a/css/demo.css b/css/demo.css index 2303278..2069d93 100644 --- a/css/demo.css +++ b/css/demo.css @@ -1,6 +1,6 @@ /* - evol-colorpicker 3.2.6 - (c) 2016 Olivier Giulieri + evol-colorpicker 3.3.0 + (c) 2017 Olivier Giulieri http://evoluteur.github.io/colorpicker/ */ body { diff --git a/css/evol-colorpicker.css b/css/evol-colorpicker.css index 622f7cf..69209f6 100644 --- a/css/evol-colorpicker.css +++ b/css/evol-colorpicker.css @@ -1,6 +1,6 @@ /* - evol-colorpicker 3.2.6 - (c) 2016 Olivier Giulieri + evol-colorpicker 3.3.0 + (c) 2017 Olivier Giulieri http://evoluteur.github.io/colorpicker/ */ .evo-pop { diff --git a/index.html b/index.html index 648bd8b..5f1d821 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@

GitHub

-

evol-colorpicker (currently v3.2.6) is a web color picker which looks like the one in Microsoft Office 2010. +

evol-colorpicker (currently v3.3.0) is a web color picker which looks like the one in Microsoft Office 2010. It can be used inline or as a popup bound to a text box. It is a full jQuery UI widget, supporting various configurations and themes.

@@ -222,7 +222,7 @@


Download, documentation, and source code are available at GitHub under the MIT license.



- + diff --git a/js/evol-colorpicker.js b/js/evol-colorpicker.js index 088fc24..442fb76 100755 --- a/js/evol-colorpicker.js +++ b/js/evol-colorpicker.js @@ -1,9 +1,9 @@ /* - evol-colorpicker 3.2.6 + evol-colorpicker 3.3.0 ColorPicker widget for jQuery UI https://github.com/evoluteur/colorpicker - (c) 2016 Olivier Giulieri + (c) 2017 Olivier Giulieri * Depends: * jquery.ui.core.js @@ -68,7 +68,7 @@ var _idx=0, $.widget( "evol.colorpicker", { - version: '3.2.6', + version: '3.3.0', options: { color: null, // example:'#31859B' diff --git a/js/evol-colorpicker.min.js b/js/evol-colorpicker.min.js index bd8e4de..3154534 100755 --- a/js/evol-colorpicker.min.js +++ b/js/evol-colorpicker.min.js @@ -1,6 +1,6 @@ /* - evol-colorpicker 3.2.6 - (c) 2016 Olivier Giulieri + evol-colorpicker 3.3.0 + (c) 2017 Olivier Giulieri http://evoluteur.github.io/colorpicker/ */ -!function(a,b){var c=0,d=window.navigator.userAgent,e=d.indexOf("MSIE ")>0,f=e?"-ie":"",g=!e&&(/mozilla/.test(d.toLowerCase())&&!/webkit/.test(d.toLowerCase())),h=[],i=["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],j=["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09","7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"],k=["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],l=[["003366","336699","3366cc","003399","000099","0000cc","000066"],["006666","006699","0099cc","0066cc","0033cc","0000ff","3333ff","333399"],["669999","009999","33cccc","00ccff","0099ff","0066ff","3366ff","3333cc","666699"],["339966","00cc99","00ffcc","00ffff","33ccff","3399ff","6699ff","6666ff","6600ff","6600cc"],["339933","00cc66","00ff99","66ffcc","66ffff","66ccff","99ccff","9999ff","9966ff","9933ff","9900ff"],["006600","00cc00","00ff00","66ff99","99ffcc","ccffff","ccccff","cc99ff","cc66ff","cc33ff","cc00ff","9900cc"],["003300","009933","33cc33","66ff66","99ff99","ccffcc","ffffff","ffccff","ff99ff","ff66ff","ff00ff","cc00cc","660066"],["333300","009900","66ff33","99ff66","ccff99","ffffcc","ffcccc","ff99cc","ff66cc","ff33cc","cc0099","993399"],["336600","669900","99ff33","ccff66","ffff99","ffcc99","ff9999","ff6699","ff3399","cc3399","990099"],["666633","99cc00","ccff33","ffff66","ffcc66","ff9966","ff6666","ff0066","d60094","993366"],["a58800","cccc00","ffff00","ffcc00","ff9933","ff6600","ff0033","cc0066","660033"],["996633","cc9900","ff9900","cc6600","ff3300","ff0000","cc0000","990033"],["663300","996600","cc3300","993300","990000","800000","993333"]],m="#0000ffff",n=function(a){var b=a.toString(16);return 1==b.length&&(b="0"+b),b},o=function(a){return n(Number(a))},p=function(a){var b=n(a);return b+b+b},q=function(a){if(a.length>10){var b=1+a.indexOf("("),c=a.indexOf(")"),d=a.substring(b,c).split(",");return["#",o(d[0]),o(d[1]),o(d[2])].join("")}return a};a.widget("evol.colorpicker",{version:"3.2.6",options:{color:null,customTheme:null,showOn:"both",hideButton:!1,displayIndicator:!0,transparentColor:!1,history:!0,defaultPalette:"theme",strings:"Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet."},_active:!1,_create:function(){var b=this;switch(this._paletteIdx="theme"==this.options.defaultPalette?1:2,this._id="evo-cp"+c++,this._enabled=!0,this.options.showOn=this.options.hideButton?"focus":this.options.showOn,this.element.get(0).tagName){case"INPUT":var d=this.options.color,h=this.element,i=("focus"===this.options.showOn?"":"evo-pointer ")+"evo-colorind"+(g?"-ff":f)+(this.options.hideButton?" evo-hidden-button":""),j="";this._isPopup=!0,this._palette=null;var k=h.val();null!==d?d!=k&&h.val(d).change():""!==k&&(d=this.options.color=k),d===m?i+=" evo-transparent":j=null!==d?"background-color:"+d:"",h.addClass("colorPicker "+this._id).wrap('
').after('
').on("keyup onpaste",function(c){var d=a(this).val();d!=b.options.color&&b._setValue(d,!0)});var l=this.options.showOn;"both"!==l&&"focus"!==l||h.on("focus",function(){b.showPalette()}),"both"!==l&&"button"!==l||h.next().on("click",function(a){return a.stopPropagation(),b.showPalette(),!1});break;default:this._isPopup=!1,this._palette=this.element.html(this._paletteHTML()).attr("aria-haspopup","true"),this._bindColors()}if(this.options.history&&(d&&this._add2History(d),this.options.initialHistory)){var n=this.options.initialHistory;for(var o in n)this._add2History(n[o])}},_paletteHTML:function(){var a=this._paletteIdx=Math.abs(this._paletteIdx),b=this.options,c=b.strings.split(","),d='
"+this["_paletteHTML"+a]()+'
'+c[1+a]+"";return b.history&&(d+=''+c[5]+""),d+="
",b.displayIndicator&&(d+=this._colorIndHTML(this.options.color)+this._colorIndHTML("")),d+="
"},_colorIndHTML:function(a){var b=e?"evo-colorbox-ie ":"",c="";return a?a===m?b+="evo-transparent":c="background-color:"+a:c="display:none",'
'+(a?a:"")+"
"},_paletteHTML1:function(){var a,b=this.options,c=b.strings.split(","),d='
':'">',h='',l=''+h+c[0]+"";if(b.customTheme)for(a=0,ml=b.customTheme.length;a",e||(l+=''),l+='',a=0;a<10;a++)l+=d+j[a]+g;for(var m=1;m<4;m++)for(l+='',a=0;a<10;a++)l+=d+j[10*m+a]+g;for(l+='',a=40;a<50;a++)l+=d+j[a]+g;for(l+=""+h,b.transparentColor&&(l+='
'),l+=c[1]+"",a=0;a<10;a++)l+=d+k[a]+g}return l+="
"},_paletteHTML2:function(){for(var a,b,c='
':'">',g='',h="
",i='
',j=0,k=l.length;j';var n="";for(i+=g,a=255;a>10;a-=10)i+=c+p(a)+d,a-=10,n+=c+p(a)+d;return i+=h+g+n+h+"
"},_switchPalette:function(b){if(this._enabled){var c,d,e,f=this.options,g=f.strings.split(",");if(a(b).hasClass("evo-hist")){var i='
'+g[5]+'
';if(0===h.length)i+="

 "+g[6]+"

";else for(var j=h.length-1;j>-1;j--)9===h[j].length?f.transparentColor&&(i+='
'):i+='
';i+="
",c=-this._paletteIdx,d=i,e=g[4]}else this._paletteIdx<0?(c=-this._paletteIdx,this._palette.find(".evo-hist").show()):c=2==this._paletteIdx?1:2,d=this["_paletteHTML"+c](),e=g[c+1],this._paletteIdx=c;this._paletteIdx=c;var k=this._palette.find(".evo-more").prev().html(d).end().children().eq(0).html(e);c<0&&k.next().hide()}},_downOrUpPositioning:function(){for(var a=this.element,b=0;null!==a&&b<100;){if("visible"!=a.css("overflow")){var c=this._palette.offset().top+this._palette.height(),d=a.offset().top+a.height(),e=this._palette.offset().top-this._palette.height()-this.element.outerHeight(),f=a.offset().top,g=c>d&&e>f;g?this._palette.css({bottom:this.element.outerHeight()+"px"}):this._palette.css({bottom:"auto"});break}if("HTML"==a[0].tagName)break;a=a.offsetParent(),b++}},showPalette:function(){if(this._enabled&&(this._active=!0,a(".colorPicker").not("."+this._id).colorpicker("hidePalette"),null===this._palette)){this._palette=this.element.next().after(this._paletteHTML()).next().on("click",function(a){return a.stopPropagation(),!1}),this._bindColors();var b=this;this._isPopup&&(this._downOrUpPositioning(),a(document.body).on("click."+b._id,function(a){a.target!=b.element.get(0)&&b.hidePalette()}).on("keyup."+b._id,function(a){27===a.keyCode&&b.hidePalette()}))}return this},hidePalette:function(){if(this._isPopup&&this._palette){a(document.body).off("click."+this._id);var b=this;this._palette.off("mouseover click","td,.evo-transparent").fadeOut(function(){b._palette.remove(),b._palette=b._cTxt=null}).find(".evo-more a").off("click")}return this},_bindColors:function(){var b=this,c=this.options,d=this._palette.find("div.evo-color"),e=c.history?"td,.evo-cHist>div":"td";c.transparentColor&&(e+=",.evo-transparent"),this._cTxt1=d.eq(0).children().eq(0),this._cTxt2=d.eq(1).children().eq(0),this._palette.on("click",e,function(c){if(b._enabled){var d=a(this);b._setValue(d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17))),b._active=!1}}).on("mouseover",e,function(c){if(b._enabled){var d=a(this),e=d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17));b.options.displayIndicator&&b._setColorInd(e,2),b._active&&b.element.trigger("mouseover.color",e)}}).find(".evo-more a").on("click",function(){b._switchPalette(this)})},val:function(a){return"undefined"==typeof a?this.options.color:(this._setValue(a),this)},_setValue:function(a,b){a=a.replace(/ /g,""),this.options.color=a,this._isPopup?(b||this.hidePalette(),this._setBoxColor(this.element.val(a).change().next(),a)):this._setColorInd(a,1),this.options.history&&this._paletteIdx>0&&this._add2History(a),this.element.trigger("change.color",a)},_setColorInd:function(a,b){var c=this["_cTxt"+b];this._setBoxColor(c,a),c.next().html(a)},_setBoxColor:function(a,b){b===m?a.addClass("evo-transparent").removeAttr("style"):a.removeClass("evo-transparent").attr("style","background-color:"+b)},_setOption:function(a,b){"color"==a?this._setValue(b,!0):this.options[a]=b},_add2History:function(a){for(var b=h.length,c=0;c27&&h.shift(),h.push(a)},clear:function(){this.hidePalette().val("")},enable:function(){var a=this.element;return this._isPopup?a.removeAttr("disabled"):a.css({opacity:"1","pointer-events":"auto"}),"focus"!==this.options.showOn&&this.element.next().addClass("evo-pointer"),a.removeAttr("aria-disabled"),this._enabled=!0,this},disable:function(){var a=this.element;return this._isPopup?a.attr("disabled","disabled"):(this.hidePalette(),a.css({opacity:"0.3","pointer-events":"none"})),"focus"!==this.options.showOn&&this.element.next().removeClass("evo-pointer"),a.attr("aria-disabled","true"),this._enabled=!1,this},isDisabled:function(){return!this._enabled},destroy:function(){a(document.body).off("click."+this._id),this._palette&&(this._palette.off("mouseover click","td,.evo-cHist>div,.evo-transparent").find(".evo-more a").off("click"),this._isPopup&&this._palette.remove(),this._palette=this._cTxt=null),this._isPopup&&this.element.next().off("click").remove().end().off("focus").unwrap(),this.element.removeClass("colorPicker "+this.id).empty(),a.Widget.prototype.destroy.call(this)}})}(jQuery); \ No newline at end of file +!function(a,b){var c=0,d=window.navigator.userAgent,e=d.indexOf("MSIE ")>0,f=e?"-ie":"",g=!e&&(/mozilla/.test(d.toLowerCase())&&!/webkit/.test(d.toLowerCase())),h=[],i=["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],j=["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09","7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"],k=["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],l=[["003366","336699","3366cc","003399","000099","0000cc","000066"],["006666","006699","0099cc","0066cc","0033cc","0000ff","3333ff","333399"],["669999","009999","33cccc","00ccff","0099ff","0066ff","3366ff","3333cc","666699"],["339966","00cc99","00ffcc","00ffff","33ccff","3399ff","6699ff","6666ff","6600ff","6600cc"],["339933","00cc66","00ff99","66ffcc","66ffff","66ccff","99ccff","9999ff","9966ff","9933ff","9900ff"],["006600","00cc00","00ff00","66ff99","99ffcc","ccffff","ccccff","cc99ff","cc66ff","cc33ff","cc00ff","9900cc"],["003300","009933","33cc33","66ff66","99ff99","ccffcc","ffffff","ffccff","ff99ff","ff66ff","ff00ff","cc00cc","660066"],["333300","009900","66ff33","99ff66","ccff99","ffffcc","ffcccc","ff99cc","ff66cc","ff33cc","cc0099","993399"],["336600","669900","99ff33","ccff66","ffff99","ffcc99","ff9999","ff6699","ff3399","cc3399","990099"],["666633","99cc00","ccff33","ffff66","ffcc66","ff9966","ff6666","ff0066","d60094","993366"],["a58800","cccc00","ffff00","ffcc00","ff9933","ff6600","ff0033","cc0066","660033"],["996633","cc9900","ff9900","cc6600","ff3300","ff0000","cc0000","990033"],["663300","996600","cc3300","993300","990000","800000","993333"]],m="#0000ffff",n=function(a){var b=a.toString(16);return 1==b.length&&(b="0"+b),b},o=function(a){return n(Number(a))},p=function(a){var b=n(a);return b+b+b},q=function(a){if(a.length>10){var b=1+a.indexOf("("),c=a.indexOf(")"),d=a.substring(b,c).split(",");return["#",o(d[0]),o(d[1]),o(d[2])].join("")}return a};a.widget("evol.colorpicker",{version:"3.3.0",options:{color:null,customTheme:null,showOn:"both",hideButton:!1,displayIndicator:!0,transparentColor:!1,history:!0,defaultPalette:"theme",strings:"Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet."},_active:!1,_create:function(){var b=this;switch(this._paletteIdx="theme"==this.options.defaultPalette?1:2,this._id="evo-cp"+c++,this._enabled=!0,this.options.showOn=this.options.hideButton?"focus":this.options.showOn,this.element.get(0).tagName){case"INPUT":var d=this.options.color,h=this.element,i=("focus"===this.options.showOn?"":"evo-pointer ")+"evo-colorind"+(g?"-ff":f)+(this.options.hideButton?" evo-hidden-button":""),j="";this._isPopup=!0,this._palette=null;var k=h.val();null!==d?d!=k&&h.val(d).change():""!==k&&(d=this.options.color=k),d===m?i+=" evo-transparent":j=null!==d?"background-color:"+d:"",h.addClass("colorPicker "+this._id).wrap('
').after('
').on("keyup onpaste",function(c){var d=a(this).val();d!=b.options.color&&b._setValue(d,!0)});var l=this.options.showOn;"both"!==l&&"focus"!==l||h.on("focus",function(){b.showPalette()}),"both"!==l&&"button"!==l||h.next().on("click",function(a){return a.stopPropagation(),b.showPalette(),!1});break;default:this._isPopup=!1,this._palette=this.element.html(this._paletteHTML()).attr("aria-haspopup","true"),this._bindColors()}if(this.options.history&&(d&&this._add2History(d),this.options.initialHistory)){var n=this.options.initialHistory;for(var o in n)this._add2History(n[o])}},_paletteHTML:function(){var a=this._paletteIdx=Math.abs(this._paletteIdx),b=this.options,c=b.strings.split(","),d='
"+this["_paletteHTML"+a]()+'
'+c[1+a]+"";return b.history&&(d+=''+c[5]+""),d+="
",b.displayIndicator&&(d+=this._colorIndHTML(this.options.color)+this._colorIndHTML("")),d+="
"},_colorIndHTML:function(a){var b=e?"evo-colorbox-ie ":"",c="";return a?a===m?b+="evo-transparent":c="background-color:"+a:c="display:none",'
'+(a?a:"")+"
"},_paletteHTML1:function(){var a,b=this.options,c=b.strings.split(","),d='
':'">',h='',l=''+h+c[0]+"";if(b.customTheme)for(a=0,ml=b.customTheme.length;a",e||(l+=''),l+='',a=0;a<10;a++)l+=d+j[a]+g;for(var m=1;m<4;m++)for(l+='',a=0;a<10;a++)l+=d+j[10*m+a]+g;for(l+='',a=40;a<50;a++)l+=d+j[a]+g;for(l+=""+h,b.transparentColor&&(l+='
'),l+=c[1]+"",a=0;a<10;a++)l+=d+k[a]+g}return l+="
"},_paletteHTML2:function(){for(var a,b,c='
':'">',g='',h="
",i='
',j=0,k=l.length;j';var n="";for(i+=g,a=255;a>10;a-=10)i+=c+p(a)+d,a-=10,n+=c+p(a)+d;return i+=h+g+n+h+"
"},_switchPalette:function(b){if(this._enabled){var c,d,e,f=this.options,g=f.strings.split(",");if(a(b).hasClass("evo-hist")){var i='
'+g[5]+'
';if(0===h.length)i+="

 "+g[6]+"

";else for(var j=h.length-1;j>-1;j--)9===h[j].length?f.transparentColor&&(i+='
'):i+='
';i+="
",c=-this._paletteIdx,d=i,e=g[4]}else this._paletteIdx<0?(c=-this._paletteIdx,this._palette.find(".evo-hist").show()):c=2==this._paletteIdx?1:2,d=this["_paletteHTML"+c](),e=g[c+1],this._paletteIdx=c;this._paletteIdx=c;var k=this._palette.find(".evo-more").prev().html(d).end().children().eq(0).html(e);c<0&&k.next().hide()}},_downOrUpPositioning:function(){for(var a=this.element,b=0;null!==a&&b<100;){if("visible"!=a.css("overflow")){var c=this._palette.offset().top+this._palette.height(),d=a.offset().top+a.height(),e=this._palette.offset().top-this._palette.height()-this.element.outerHeight(),f=a.offset().top,g=c>d&&e>f;g?this._palette.css({bottom:this.element.outerHeight()+"px"}):this._palette.css({bottom:"auto"});break}if("HTML"==a[0].tagName)break;a=a.offsetParent(),b++}},showPalette:function(){if(this._enabled&&(this._active=!0,a(".colorPicker").not("."+this._id).colorpicker("hidePalette"),null===this._palette)){this._palette=this.element.next().after(this._paletteHTML()).next().on("click",function(a){return a.stopPropagation(),!1}),this._bindColors();var b=this;this._isPopup&&(this._downOrUpPositioning(),a(document.body).on("click."+b._id,function(a){a.target!=b.element.get(0)&&b.hidePalette()}).on("keyup."+b._id,function(a){27===a.keyCode&&b.hidePalette()}))}return this},hidePalette:function(){if(this._isPopup&&this._palette){a(document.body).off("click."+this._id);var b=this;this._palette.off("mouseover click","td,.evo-transparent").fadeOut(function(){b._palette.remove(),b._palette=b._cTxt=null}).find(".evo-more a").off("click")}return this},_bindColors:function(){var b=this,c=this.options,d=this._palette.find("div.evo-color"),e=c.history?"td,.evo-cHist>div":"td";c.transparentColor&&(e+=",.evo-transparent"),this._cTxt1=d.eq(0).children().eq(0),this._cTxt2=d.eq(1).children().eq(0),this._palette.on("click",e,function(c){if(b._enabled){var d=a(this);b._setValue(d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17))),b._active=!1}}).on("mouseover",e,function(c){if(b._enabled){var d=a(this),e=d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17));b.options.displayIndicator&&b._setColorInd(e,2),b._active&&b.element.trigger("mouseover.color",e)}}).find(".evo-more a").on("click",function(){b._switchPalette(this)})},val:function(a){return"undefined"==typeof a?this.options.color:(this._setValue(a),this)},_setValue:function(a,b){a=a.replace(/ /g,""),this.options.color=a,this._isPopup?(b||this.hidePalette(),this._setBoxColor(this.element.val(a).change().next(),a)):this._setColorInd(a,1),this.options.history&&this._paletteIdx>0&&this._add2History(a),this.element.trigger("change.color",a)},_setColorInd:function(a,b){var c=this["_cTxt"+b];this._setBoxColor(c,a),c.next().html(a)},_setBoxColor:function(a,b){b===m?a.addClass("evo-transparent").removeAttr("style"):a.removeClass("evo-transparent").attr("style","background-color:"+b)},_setOption:function(a,b){"color"==a?this._setValue(b,!0):this.options[a]=b},_add2History:function(a){for(var b=h.length,c=0;c27&&h.shift(),h.push(a)},clear:function(){this.hidePalette().val("")},enable:function(){var a=this.element;return this._isPopup?a.removeAttr("disabled"):a.css({opacity:"1","pointer-events":"auto"}),"focus"!==this.options.showOn&&this.element.next().addClass("evo-pointer"),a.removeAttr("aria-disabled"),this._enabled=!0,this},disable:function(){var a=this.element;return this._isPopup?a.attr("disabled","disabled"):(this.hidePalette(),a.css({opacity:"0.3","pointer-events":"none"})),"focus"!==this.options.showOn&&this.element.next().removeClass("evo-pointer"),a.attr("aria-disabled","true"),this._enabled=!1,this},isDisabled:function(){return!this._enabled},destroy:function(){a(document.body).off("click."+this._id),this._palette&&(this._palette.off("mouseover click","td,.evo-cHist>div,.evo-transparent").find(".evo-more a").off("click"),this._isPopup&&this._palette.remove(),this._palette=this._cTxt=null),this._isPopup&&this.element.next().off("click").remove().end().off("focus").unwrap(),this.element.removeClass("colorPicker "+this.id).empty(),a.Widget.prototype.destroy.call(this)}})}(jQuery); \ No newline at end of file diff --git a/package.json b/package.json index 408b94f..bab618b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "evol-colorpicker", - "version": "3.2.6", + "version": "3.3.0", "description": "jQuery UI widget for web color picking which looks like the one in Microsoft Office 2010.", "copyright": "(c) 2017 Olivier Giulieri", "homepage": "http://evoluteur.github.io/colorpicker/", - "author": "Olivier Giulieri (https://github.com/evoluteur)", + "author": "Olivier Giulieri (https://evoluteur.github.io/)", "license": "MIT", "repository": { "type": "git", @@ -18,10 +18,10 @@ "jquery-ui": "~1.10.5" }, "devDependencies": { - "grunt": "~0.4.5", - "grunt-contrib-jshint": "~0.11.0", - "grunt-contrib-uglify": "~0.7.0", - "grunt-contrib-less": "~1.0.0" + "grunt": "~1.0.1", + "grunt-contrib-jshint": "~1.1.0", + "grunt-contrib-uglify": "~2.0.0", + "grunt-contrib-less": "~1.4.0" }, "keywords": [ "colorpicker", @@ -33,7 +33,8 @@ "jquery", "jquery-ui", "ui", - "web" + "web", + "office" ], "main": "js/evol-colorpicker.js" }