Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated minified JS

  • Loading branch information...
commit e1e20990e1e3bfe3dfd8866871caca1b450e09a4 1 parent 22a37f5
@claviska authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  jquery.minicolors.min.js
View
3  jquery.minicolors.min.js
@@ -5,4 +5,5 @@
*
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
- */jQuery&&function(e){function t(t,n){var r=e('<div class="minicolors" />'),i=e.minicolors.defaults;if(t.data("minicolors-initialized"))return;n=e.extend(!0,{},i,n);r.addClass("minicolors-theme-"+n.theme).toggleClass("minicolors-with-opacity",n.opacity);n.position!==undefined&&e.each(n.position.split(" "),function(){r.addClass("minicolors-position-"+this)});t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",n).prop("size",7).wrap(r).after('<div class="minicolors-panel minicolors-slider-'+n.control+'">'+'<div class="minicolors-slider">'+'<div class="minicolors-picker"></div>'+"</div>"+'<div class="minicolors-opacity-slider">'+'<div class="minicolors-picker"></div>'+"</div>"+'<div class="minicolors-grid">'+'<div class="minicolors-grid-inner"></div>'+'<div class="minicolors-picker"><div></div></div>'+"</div>"+"</div>");if(!n.inline){t.after('<span class="minicolors-swatch"><span class="minicolors-swatch-color"></span></span>');t.next(".minicolors-swatch").on("click",function(e){e.preventDefault();t.focus()})}t.parent().find(".minicolors-panel").on("selectstart",function(){return!1}).end();n.inline&&t.parent().addClass("minicolors-inline");u(t,!1);t.data("minicolors-initialized",!0)}function n(e){var t=e.parent();e.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input");t.before(e).remove()}function r(e){var t=e.parent(),n=t.find(".minicolors-panel"),r=e.data("minicolors-settings");if(!e.data("minicolors-initialized")||e.prop("disabled")||t.hasClass("minicolors-inline")||t.hasClass("minicolors-focus"))return;i();t.addClass("minicolors-focus");n.stop(!0,!0).fadeIn(r.showSpeed,function(){r.show&&r.show.call(e.get(0))})}function i(){e(".minicolors-focus").each(function(){var t=e(this),n=t.find(".minicolors-input"),r=t.find(".minicolors-panel"),i=n.data("minicolors-settings");r.fadeOut(i.hideSpeed,function(){i.hide&&i.hide.call(n.get(0));t.removeClass("minicolors-focus")})})}function s(e,t,n){var r=e.parents(".minicolors").find(".minicolors-input"),i=r.data("minicolors-settings"),s=e.find("[class$=-picker]"),u=e.offset().left,a=e.offset().top,f=Math.round(t.pageX-u),l=Math.round(t.pageY-a),c=n?i.animationSpeed:0,h,p,d,v;if(t.originalEvent.changedTouches){f=t.originalEvent.changedTouches[0].pageX-u;l=t.originalEvent.changedTouches[0].pageY-a}f<0&&(f=0);l<0&&(l=0);f>e.width()&&(f=e.width());l>e.height()&&(l=e.height());if(e.parent().is(".minicolors-slider-wheel")&&s.parent().is(".minicolors-grid")){h=75-f;p=75-l;d=Math.sqrt(h*h+p*p);v=Math.atan2(p,h);v<0&&(v+=Math.PI*2);if(d>75){d=75;f=75-75*Math.cos(v);l=75-75*Math.sin(v)}f=Math.round(f);l=Math.round(l)}e.is(".minicolors-grid")?s.stop(!0).animate({top:l+"px",left:f+"px"},c,i.animationEasing,function(){o(r,e)}):s.stop(!0).animate({top:l+"px"},c,i.animationEasing,function(){o(r,e)})}function o(e,t){function n(e,t){var n,r;if(!e.length||!t)return null;n=e.offset().left;r=e.offset().top;return{x:n-t.offset().left+e.outerWidth()/2,y:r-t.offset().top+e.outerHeight()/2}}var r,i,s,o,u,f,l,h=e.val(),d=e.attr("data-opacity"),v=e.parent(),g=e.data("minicolors-settings"),y=v.find(".minicolors-swatch"),b=v.find(".minicolors-grid"),w=v.find(".minicolors-slider"),E=v.find(".minicolors-opacity-slider"),S=b.find("[class$=-picker]"),x=w.find("[class$=-picker]"),T=E.find("[class$=-picker]"),N=n(S,b),C=n(x,w),k=n(T,E);if(t.is(".minicolors-grid, .minicolors-slider")){switch(g.control){case"wheel":o=b.width()/2-N.x;u=b.height()/2-N.y;f=Math.sqrt(o*o+u*u);l=Math.atan2(u,o);l<0&&(l+=Math.PI*2);if(f>75){f=75;N.x=69-75*Math.cos(l);N.y=69-75*Math.sin(l)}i=p(f/.75,0,100);r=p(l*180/Math.PI,0,360);s=p(100-Math.floor(C.y*(100/w.height())),0,100);h=m({h:r,s:i,b:s});w.css("backgroundColor",m({h:r,s:i,b:100}));break;case"saturation":r=p(parseInt(N.x*(360/b.width()),10),0,360);i=p(100-Math.floor(C.y*(100/w.height())),0,100);s=p(100-Math.floor(N.y*(100/b.height())),0,100);h=m({h:r,s:i,b:s});w.css("backgroundColor",m({h:r,s:100,b:s}));v.find(".minicolors-grid-inner").css("opacity",i/100);break;case"brightness":r=p(parseInt(N.x*(360/b.width()),10),0,360);i=p(100-Math.floor(N.y*(100/b.height())),0,100);s=p(100-Math.floor(C.y*(100/w.height())),0,100);h=m({h:r,s:i,b:s});w.css("backgroundColor",m({h:r,s:i,b:100}));v.find(".minicolors-grid-inner").css("opacity",1-s/100);break;default:r=p(360-parseInt(C.y*(360/w.height()),10),0,360);i=p(Math.floor(N.x*(100/b.width())),0,100);s=p(100-Math.floor(N.y*(100/b.height())),0,100);h=m({h:r,s:i,b:s});b.css("backgroundColor",m({h:r,s:100,b:100}))}e.val(c(h,g.letterCase))}if(t.is(".minicolors-opacity-slider")){g.opacity?d=parseFloat(1-k.y/E.height()).toFixed(2):d=1;g.opacity&&e.attr("data-opacity",d)}y.find("SPAN").css({backgroundColor:h,opacity:d});a(e,h,d)}function u(e,t){var n,r,i,s,o,u,f,l=e.parent(),d=e.data("minicolors-settings"),v=l.find(".minicolors-swatch"),y=l.find(".minicolors-grid"),b=l.find(".minicolors-slider"),w=l.find(".minicolors-opacity-slider"),E=y.find("[class$=-picker]"),S=b.find("[class$=-picker]"),x=w.find("[class$=-picker]");n=c(h(e.val(),!0),d.letterCase);n||(n=c(h(d.defaultValue,!0),d.letterCase));r=g(n);t||e.val(n);if(d.opacity){i=e.attr("data-opacity")===""?1:p(parseFloat(e.attr("data-opacity")).toFixed(2),0,1);isNaN(i)&&(i=1);e.attr("data-opacity",i);v.find("SPAN").css("opacity",i);o=p(w.height()-w.height()*i,0,w.height());x.css("top",o+"px")}v.find("SPAN").css("backgroundColor",n);switch(d.control){case"wheel":u=p(Math.ceil(r.s*.75),0,y.height()/2);f=r.h*Math.PI/180;s=p(75-Math.cos(f)*u,0,y.width());o=p(75-Math.sin(f)*u,0,y.height());E.css({top:o+"px",left:s+"px"});o=150-r.b/(100/y.height());n===""&&(o=0);S.css("top",o+"px");b.css("backgroundColor",m({h:r.h,s:r.s,b:100}));break;case"saturation":s=p(5*r.h/12,0,150);o=p(y.height()-Math.ceil(r.b/(100/y.height())),0,y.height());E.css({top:o+"px",left:s+"px"});o=p(b.height()-r.s*(b.height()/100),0,b.height());S.css("top",o+"px");b.css("backgroundColor",m({h:r.h,s:100,b:r.b}));l.find(".minicolors-grid-inner").css("opacity",r.s/100);break;case"brightness":s=p(5*r.h/12,0,150);o=p(y.height()-Math.ceil(r.s/(100/y.height())),0,y.height());E.css({top:o+"px",left:s+"px"});o=p(b.height()-r.b*(b.height()/100),0,b.height());S.css("top",o+"px");b.css("backgroundColor",m({h:r.h,s:r.s,b:100}));l.find(".minicolors-grid-inner").css("opacity",1-r.b/100);break;default:s=p(Math.ceil(r.s/(100/y.width())),0,y.width());o=p(y.height()-Math.ceil(r.b/(100/y.height())),0,y.height());E.css({top:o+"px",left:s+"px"});o=p(b.height()-r.h/(360/b.height()),0,b.height());S.css("top",o+"px");y.css("backgroundColor",m({h:r.h,s:100,b:100}))}e.data("minicolors-initialized")&&a(e,n,i)}function a(e,t,n){var r=e.data("minicolors-settings"),i=e.data("minicolors-lastChange");if(!i||i.hex!==t||i.opacity!==n){e.data("minicolors-lastChange",{hex:t,opacity:n});if(r.change)if(r.changeDelay){clearTimeout(e.data("minicolors-changeTimeout"));e.data("minicolors-changeTimeout",setTimeout(function(){r.change.call(e.get(0),t,n)},r.changeDelay))}else r.change.call(e.get(0),t,n);e.trigger("change").trigger("input")}}function f(t){var n=h(e(t).val(),!0),r=b(n),i=e(t).attr("data-opacity");if(!r)return null;i!==undefined&&e.extend(r,{a:parseFloat(i)});return r}function l(t,n){var r=h(e(t).val(),!0),i=b(r),s=e(t).attr("data-opacity");if(!i)return null;s===undefined&&(s=1);return n?"rgba("+i.r+", "+i.g+", "+i.b+", "+parseFloat(s)+")":"rgb("+i.r+", "+i.g+", "+i.b+")"}function c(e,t){return t==="uppercase"?e.toUpperCase():e.toLowerCase()}function h(e,t){e=e.replace(/[^A-F0-9]/ig,"");if(e.length!==3&&e.length!==6)return"";e.length===3&&t&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);return"#"+e}function p(e,t,n){e<t&&(e=t);e>n&&(e=n);return e}function d(e){var t={},n=Math.round(e.h),r=Math.round(e.s*255/100),i=Math.round(e.b*255/100);if(r===0)t.r=t.g=t.b=i;else{var s=i,o=(255-r)*i/255,u=(s-o)*(n%60)/60;n===360&&(n=0);if(n<60){t.r=s;t.b=o;t.g=o+u}else if(n<120){t.g=s;t.b=o;t.r=s-u}else if(n<180){t.g=s;t.r=o;t.b=o+u}else if(n<240){t.b=s;t.r=o;t.g=s-u}else if(n<300){t.b=s;t.g=o;t.r=o+u}else if(n<360){t.r=s;t.g=o;t.b=s-u}else{t.r=0;t.g=0;t.b=0}}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}}function v(t){var n=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];e.each(n,function(e,t){t.length===1&&(n[e]="0"+t)});return"#"+n.join("")}function m(e){return v(d(e))}function g(e){var t=y(b(e));t.s===0&&(t.h=360);return t}function y(e){var t={h:0,s:0,b:0},n=Math.min(e.r,e.g,e.b),r=Math.max(e.r,e.g,e.b),i=r-n;t.b=r;t.s=r!==0?255*i/r:0;t.s!==0?e.r===r?t.h=(e.g-e.b)/i:e.g===r?t.h=2+(e.b-e.r)/i:t.h=4+(e.r-e.g)/i:t.h=-1;t.h*=60;t.h<0&&(t.h+=360);t.s*=100/255;t.b*=100/255;return t}function b(e){e=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:e>>16,g:(e&65280)>>8,b:e&255}}e.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",hide:null,hideSpeed:100,inline:!1,letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default"}};e.extend(e.fn,{minicolors:function(s,o){switch(s){case"destroy":e(this).each(function(){n(e(this))});return e(this);case"hide":i();return e(this);case"opacity":if(o===undefined)return e(this).attr("data-opacity");e(this).each(function(){u(e(this).attr("data-opacity",o))});return e(this);case"rgbObject":return f(e(this),s==="rgbaObject");case"rgbString":case"rgbaString":return l(e(this),s==="rgbaString");case"settings":if(o===undefined)return e(this).data("minicolors-settings");e(this).each(function(){var t=e(this).data("minicolors-settings")||{};n(e(this));e(this).minicolors(e.extend(!0,t,o))});return e(this);case"show":r(e(this).eq(0));return e(this);case"value":if(o===undefined)return e(this).val();e(this).each(function(){u(e(this).val(o))});return e(this);default:s!=="create"&&(o=s);e(this).each(function(){t(e(this),o)});return e(this)}}});e(document).on("mousedown.minicolors touchstart.minicolors",function(t){e(t.target).parents().add(t.target).hasClass("minicolors")||i()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var n=e(this);t.preventDefault();e(document).data("minicolors-target",n);s(n,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var n=e(document).data("minicolors-target");n&&s(n,t)}).on("mouseup.minicolors touchend.minicolors",function(){e(this).removeData("minicolors-target")}).on("mousedown.minicolors touchstart.minicolors",".minicolors-swatch",function(t){var n=e(this).parent().find(".minicolors-input");t.preventDefault();r(n)}).on("focus.minicolors",".minicolors-input",function(){var t=e(this);if(!t.data("minicolors-initialized"))return;r(t)}).on("blur.minicolors",".minicolors-input",function(){var t=e(this),n=t.data("minicolors-settings");if(!t.data("minicolors-initialized"))return;t.val(h(t.val(),!0));t.val()===""&&t.val(h(n.defaultValue,!0));t.val(c(t.val(),n.letterCase))}).on("keydown.minicolors",".minicolors-input",function(t){var n=e(this);if(!n.data("minicolors-initialized"))return;switch(t.keyCode){case 9:i();break;case 13:case 27:i();n.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=e(this);if(!t.data("minicolors-initialized"))return;u(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=e(this);if(!t.data("minicolors-initialized"))return;setTimeout(function(){u(t,!0)},1)})}(jQuery);
+ */
+jQuery&&function(a){function b(b,c){var d=a('<div class="minicolors" />'),e=a.minicolors.defaults;b.data("minicolors-initialized")||(c=a.extend(!0,{},e,c),d.addClass("minicolors-theme-"+c.theme).toggleClass("minicolors-with-opacity",c.opacity),void 0!==c.position&&a.each(c.position.split(" "),function(){d.addClass("minicolors-position-"+this)}),b.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",c).prop("size",7).wrap(d).after('<div class="minicolors-panel minicolors-slider-'+c.control+'">'+'<div class="minicolors-slider">'+'<div class="minicolors-picker"></div>'+"</div>"+'<div class="minicolors-opacity-slider">'+'<div class="minicolors-picker"></div>'+"</div>"+'<div class="minicolors-grid">'+'<div class="minicolors-grid-inner"></div>'+'<div class="minicolors-picker"><div></div></div>'+"</div>"+"</div>"),c.inline||(b.after('<span class="minicolors-swatch"><span class="minicolors-swatch-color"></span></span>'),b.next(".minicolors-swatch").on("click",function(a){a.preventDefault(),b.focus()})),b.parent().find(".minicolors-panel").on("selectstart",function(){return!1}).end(),c.inline&&b.parent().addClass("minicolors-inline"),h(b,!1),b.data("minicolors-initialized",!0))}function c(a){var b=a.parent();a.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),b.before(a).remove()}function d(a){var b=a.parent(),c=b.find(".minicolors-panel"),d=a.data("minicolors-settings");!a.data("minicolors-initialized")||a.prop("disabled")||b.hasClass("minicolors-inline")||b.hasClass("minicolors-focus")||(e(),b.addClass("minicolors-focus"),c.stop(!0,!0).fadeIn(d.showSpeed,function(){d.show&&d.show.call(a.get(0))}))}function e(){a(".minicolors-focus").each(function(){var b=a(this),c=b.find(".minicolors-input"),d=b.find(".minicolors-panel"),e=c.data("minicolors-settings");d.fadeOut(e.hideSpeed,function(){e.hide&&e.hide.call(c.get(0)),b.removeClass("minicolors-focus")})})}function f(a,b,c){var m,n,o,p,d=a.parents(".minicolors").find(".minicolors-input"),e=d.data("minicolors-settings"),f=a.find("[class$=-picker]"),h=a.offset().left,i=a.offset().top,j=Math.round(b.pageX-h),k=Math.round(b.pageY-i),l=c?e.animationSpeed:0;b.originalEvent.changedTouches&&(j=b.originalEvent.changedTouches[0].pageX-h,k=b.originalEvent.changedTouches[0].pageY-i),0>j&&(j=0),0>k&&(k=0),j>a.width()&&(j=a.width()),k>a.height()&&(k=a.height()),a.parent().is(".minicolors-slider-wheel")&&f.parent().is(".minicolors-grid")&&(m=75-j,n=75-k,o=Math.sqrt(m*m+n*n),p=Math.atan2(n,m),0>p&&(p+=2*Math.PI),o>75&&(o=75,j=75-75*Math.cos(p),k=75-75*Math.sin(p)),j=Math.round(j),k=Math.round(k)),a.is(".minicolors-grid")?f.stop(!0).animate({top:k+"px",left:j+"px"},l,e.animationEasing,function(){g(d,a)}):f.stop(!0).animate({top:k+"px"},l,e.animationEasing,function(){g(d,a)})}function g(a,b){function c(a,b){var c,d;return a.length&&b?(c=a.offset().left,d=a.offset().top,{x:c-b.offset().left+a.outerWidth()/2,y:d-b.offset().top+a.outerHeight()/2}):null}var d,e,f,g,h,j,k,m=a.val(),o=a.attr("data-opacity"),p=a.parent(),r=a.data("minicolors-settings"),s=p.find(".minicolors-swatch"),t=p.find(".minicolors-grid"),u=p.find(".minicolors-slider"),v=p.find(".minicolors-opacity-slider"),w=t.find("[class$=-picker]"),x=u.find("[class$=-picker]"),y=v.find("[class$=-picker]"),z=c(w,t),A=c(x,u),B=c(y,v);if(b.is(".minicolors-grid, .minicolors-slider")){switch(r.control){case"wheel":g=t.width()/2-z.x,h=t.height()/2-z.y,j=Math.sqrt(g*g+h*h),k=Math.atan2(h,g),0>k&&(k+=2*Math.PI),j>75&&(j=75,z.x=69-75*Math.cos(k),z.y=69-75*Math.sin(k)),e=n(j/.75,0,100),d=n(180*k/Math.PI,0,360),f=n(100-Math.floor(A.y*(100/u.height())),0,100),m=q({h:d,s:e,b:f}),u.css("backgroundColor",q({h:d,s:e,b:100}));break;case"saturation":d=n(parseInt(z.x*(360/t.width()),10),0,360),e=n(100-Math.floor(A.y*(100/u.height())),0,100),f=n(100-Math.floor(z.y*(100/t.height())),0,100),m=q({h:d,s:e,b:f}),u.css("backgroundColor",q({h:d,s:100,b:f})),p.find(".minicolors-grid-inner").css("opacity",e/100);break;case"brightness":d=n(parseInt(z.x*(360/t.width()),10),0,360),e=n(100-Math.floor(z.y*(100/t.height())),0,100),f=n(100-Math.floor(A.y*(100/u.height())),0,100),m=q({h:d,s:e,b:f}),u.css("backgroundColor",q({h:d,s:e,b:100})),p.find(".minicolors-grid-inner").css("opacity",1-f/100);break;default:d=n(360-parseInt(A.y*(360/u.height()),10),0,360),e=n(Math.floor(z.x*(100/t.width())),0,100),f=n(100-Math.floor(z.y*(100/t.height())),0,100),m=q({h:d,s:e,b:f}),t.css("backgroundColor",q({h:d,s:100,b:100}))}a.val(l(m,r.letterCase))}b.is(".minicolors-opacity-slider")&&(o=r.opacity?parseFloat(1-B.y/v.height()).toFixed(2):1,r.opacity&&a.attr("data-opacity",o)),s.find("SPAN").css({backgroundColor:m,opacity:o}),i(a,m,o)}function h(a,b){var c,d,e,f,g,h,j,k=a.parent(),o=a.data("minicolors-settings"),p=k.find(".minicolors-swatch"),s=k.find(".minicolors-grid"),t=k.find(".minicolors-slider"),u=k.find(".minicolors-opacity-slider"),v=s.find("[class$=-picker]"),w=t.find("[class$=-picker]"),x=u.find("[class$=-picker]");switch(c=l(m(a.val(),!0),o.letterCase),c||(c=l(m(o.defaultValue,!0),o.letterCase)),d=r(c),b||a.val(c),o.opacity&&(e=""===a.attr("data-opacity")?1:n(parseFloat(a.attr("data-opacity")).toFixed(2),0,1),isNaN(e)&&(e=1),a.attr("data-opacity",e),p.find("SPAN").css("opacity",e),g=n(u.height()-u.height()*e,0,u.height()),x.css("top",g+"px")),p.find("SPAN").css("backgroundColor",c),o.control){case"wheel":h=n(Math.ceil(.75*d.s),0,s.height()/2),j=d.h*Math.PI/180,f=n(75-Math.cos(j)*h,0,s.width()),g=n(75-Math.sin(j)*h,0,s.height()),v.css({top:g+"px",left:f+"px"}),g=150-d.b/(100/s.height()),""===c&&(g=0),w.css("top",g+"px"),t.css("backgroundColor",q({h:d.h,s:d.s,b:100}));break;case"saturation":f=n(5*d.h/12,0,150),g=n(s.height()-Math.ceil(d.b/(100/s.height())),0,s.height()),v.css({top:g+"px",left:f+"px"}),g=n(t.height()-d.s*(t.height()/100),0,t.height()),w.css("top",g+"px"),t.css("backgroundColor",q({h:d.h,s:100,b:d.b})),k.find(".minicolors-grid-inner").css("opacity",d.s/100);break;case"brightness":f=n(5*d.h/12,0,150),g=n(s.height()-Math.ceil(d.s/(100/s.height())),0,s.height()),v.css({top:g+"px",left:f+"px"}),g=n(t.height()-d.b*(t.height()/100),0,t.height()),w.css("top",g+"px"),t.css("backgroundColor",q({h:d.h,s:d.s,b:100})),k.find(".minicolors-grid-inner").css("opacity",1-d.b/100);break;default:f=n(Math.ceil(d.s/(100/s.width())),0,s.width()),g=n(s.height()-Math.ceil(d.b/(100/s.height())),0,s.height()),v.css({top:g+"px",left:f+"px"}),g=n(t.height()-d.h/(360/t.height()),0,t.height()),w.css("top",g+"px"),s.css("backgroundColor",q({h:d.h,s:100,b:100}))}a.data("minicolors-initialized")&&i(a,c,e)}function i(a,b,c){var d=a.data("minicolors-settings"),e=a.data("minicolors-lastChange");e&&e.hex===b&&e.opacity===c||(a.data("minicolors-lastChange",{hex:b,opacity:c}),d.change&&(d.changeDelay?(clearTimeout(a.data("minicolors-changeTimeout")),a.data("minicolors-changeTimeout",setTimeout(function(){d.change.call(a.get(0),b,c)},d.changeDelay))):d.change.call(a.get(0),b,c)),a.trigger("change").trigger("input"))}function j(b){var c=m(a(b).val(),!0),d=t(c),e=a(b).attr("data-opacity");return d?(void 0!==e&&a.extend(d,{a:parseFloat(e)}),d):null}function k(b,c){var d=m(a(b).val(),!0),e=t(d),f=a(b).attr("data-opacity");return e?(void 0===f&&(f=1),c?"rgba("+e.r+", "+e.g+", "+e.b+", "+parseFloat(f)+")":"rgb("+e.r+", "+e.g+", "+e.b+")"):null}function l(a,b){return"uppercase"===b?a.toUpperCase():a.toLowerCase()}function m(a,b){return a=a.replace(/[^A-F0-9]/gi,""),3!==a.length&&6!==a.length?"":(3===a.length&&b&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),"#"+a)}function n(a,b,c){return b>a&&(a=b),a>c&&(a=c),a}function o(a){var b={},c=Math.round(a.h),d=Math.round(255*a.s/100),e=Math.round(255*a.b/100);if(0===d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360===c&&(c=0),60>c?(b.r=f,b.b=g,b.g=g+h):120>c?(b.g=f,b.b=g,b.r=f-h):180>c?(b.g=f,b.r=g,b.b=g+h):240>c?(b.b=f,b.r=g,b.g=f-h):300>c?(b.b=f,b.g=g,b.r=g+h):360>c?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}}function p(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1===b.length&&(c[a]="0"+b)}),"#"+c.join("")}function q(a){return p(o(a))}function r(a){var b=s(t(a));return 0===b.s&&(b.h=360),b}function s(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!==d?255*e/d:0,b.h=0!==b.s?a.r===d?(a.g-a.b)/e:a.g===d?2+(a.b-a.r)/e:4+(a.r-a.g)/e:-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b}function t(a){return a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16),{r:a>>16,g:(65280&a)>>8,b:255&a}}a.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",hide:null,hideSpeed:100,inline:!1,letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default"}},a.extend(a.fn,{minicolors:function(f,g){switch(f){case"destroy":return a(this).each(function(){c(a(this))}),a(this);case"hide":return e(),a(this);case"opacity":return void 0===g?a(this).attr("data-opacity"):(a(this).each(function(){h(a(this).attr("data-opacity",g))}),a(this));case"rgbObject":return j(a(this),"rgbaObject"===f);case"rgbString":case"rgbaString":return k(a(this),"rgbaString"===f);case"settings":return void 0===g?a(this).data("minicolors-settings"):(a(this).each(function(){var b=a(this).data("minicolors-settings")||{};c(a(this)),a(this).minicolors(a.extend(!0,b,g))}),a(this));case"show":return d(a(this).eq(0)),a(this);case"value":return void 0===g?a(this).val():(a(this).each(function(){h(a(this).val(g))}),a(this));default:return"create"!==f&&(g=f),a(this).each(function(){b(a(this),g)}),a(this)}}}),a(document).on("mousedown.minicolors touchstart.minicolors",function(b){a(b.target).parents().add(b.target).hasClass("minicolors")||e()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(b){var c=a(this);b.preventDefault(),a(document).data("minicolors-target",c),f(c,b,!0)}).on("mousemove.minicolors touchmove.minicolors",function(b){var c=a(document).data("minicolors-target");c&&f(c,b)}).on("mouseup.minicolors touchend.minicolors",function(){a(this).removeData("minicolors-target")}).on("mousedown.minicolors touchstart.minicolors",".minicolors-swatch",function(b){var c=a(this).parent().find(".minicolors-input");b.preventDefault(),d(c)}).on("focus.minicolors",".minicolors-input",function(){var b=a(this);b.data("minicolors-initialized")&&d(b)}).on("blur.minicolors",".minicolors-input",function(){var b=a(this),c=b.data("minicolors-settings");b.data("minicolors-initialized")&&(b.val(m(b.val(),!0)),""===b.val()&&b.val(m(c.defaultValue,!0)),b.val(l(b.val(),c.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(b){var c=a(this);if(c.data("minicolors-initialized"))switch(b.keyCode){case 9:e();break;case 13:case 27:e(),c.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var b=a(this);b.data("minicolors-initialized")&&h(b,!0)}).on("paste.minicolors",".minicolors-input",function(){var b=a(this);b.data("minicolors-initialized")&&setTimeout(function(){h(b,!0)},1)})}(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.