svgedit/editor/jgraduate/jpicker-1.0.12.min.js

1 line
31 KiB
JavaScript

(function(e,a){var d=function(t,k){var o=this,j=t.find("img"),B=0,A=100,s=100,z=0,w=100,r=100,q=0,p=0,m,n=function(x){var y=t.offset();m={left:y.left+parseInt(t.css("border-left-width")),top:y.top+parseInt(t.css("border-top-width"))};u(x);o.draw();e(document).bind("mousemove",l).bind("mouseup",h);x.stopPropagation();x.preventDefault();return false;},l=function(x){u(x);o.draw();x.stopPropagation();x.preventDefault();return false;},h=function(x){e(document).unbind("mouseup",h).unbind("mousemove",l);x.stopPropagation();x.preventDefault();return false;},u=function(E){var C=E.pageX-m.left,x=E.pageY-m.top,D=t.w,y=t.h;if(C<0){C=0;}else{if(C>D){C=D;}}if(x<0){x=0;}else{if(x>y){x=y;}}o.set_X(((C/D)*s)+B);o.set_Y(((x/y)*r)+z);e.isFunction(o.valuesChanged)&&o.valuesChanged(o);};e.extend(true,o,{settings:k,valuesChanged:e.isFunction(arguments[2])&&arguments[2]||null,get_X:function(){return q;},set_X:function(x){x=Math.floor(x);if(q==x){return;}if(x<B){x=B;}else{if(x>A){x=A;}}q=x;},get_Y:function(){return p;},set_Y:function(x){x=Math.floor(x);if(p==x){return;}if(x<z){x=z;}else{if(x>w){x=w;}}p=x;},set_RangeX:function(y,x){if(B==y&&A==x){return;}if(y>x){return;}B=y;A=x;s=A-B;},set_RangeY:function(y,x){if(z==y&&w==x){return;}if(y>x){return;}z=y;w=x;r=w-z;},draw:function(){var D=0,x=0,F=t.w,C=t.h,E=j.w,y=j.h;if(s>0){if(q==A){D=F;}else{D=Math.floor((q/s)*F);}}if(r>0){if(p==w){x=C;}else{x=Math.floor((p/r)*C);}}if(E>F){D=(F>>1)-(E>>1);}else{D-=E>>1;}if(y>C){x=(C>>1)-(y>>1);}else{x-=y>>1;}j.css({left:D+"px",top:x+"px"});},destroy:function(){e(document).unbind("mouseup",h).unbind("mousemove",l);t.unbind("mousedown",n);t=null;j=null;o.valuesChanged=null;}});var v=o.settings;j.src=v.arrow&&v.arrow.image;j.w=v.arrow&&v.arrow.width||j.width();j.h=v.arrow&&v.arrow.height||j.height();t.w=v.map&&v.map.width||t.width();t.h=v.map&&v.map.height||t.height();t.bind("mousedown",n);o.draw();e.isFunction(o.valuesChanged)&&o.valuesChanged(o);},b=function(m){var l=this,w=function(A){if(A.target.value==""){return;}if(!u.get_R()){s.red.val(0);}if(!u.get_G()){s.green.val(0);}if(!u.get_B()){s.blue.val(0);}if(!u.get_A()){s.alpha.val(100);}q(A);l.setValuesFromHsva();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},p=function(A){if(A.target.value==""){return;}if(!u.get_H()){s.hue.val(0);}if(!u.get_S()){s.saturation.val(0);}if(!u.get_V()){s.value.val(0);}if(!u.get_A()){s.alpha.val(100);}o(A);l.setValuesFromRgba();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},r=function(A){if(A.target.value==""){return;}if(!u.get_R()){s.red.val(0);}if(!u.get_G()){s.green.val(0);}if(!u.get_B()){s.blue.val(0);}if(!u.get_H()){s.hue.val(0);}if(!u.get_S()){s.saturation.val(0);}if(!u.get_V()){s.value.val(0);}y(A);l.setValuesFromRgba();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},t=function(A){if(A.target.value==""){l.setValuesFromRgba();}e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},k=function(A){if(A.target.value==""){l.setValuesFromHsva();}e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},x=function(A){if(A.target.value==""){s.alpha.val(100);}e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},z=function(A){v(A);l.setValuesFromHex();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},j=function(A){if(A.target.value==""){l.setValuesFromHex();}},o=function(D){if(!n(D)){return D;}var C=h(s.red.val(),0,255),B=h(s.green.val(),0,255),A=h(s.blue.val(),0,255);s.red.val(C!=null?C:"");s.green.val(B!=null?B:"");s.blue.val(A!=null?A:"");},y=function(B){if(!n(B)){return B;}var A=h(s.alpha.val(),0,100);s.alpha.val(A!=null?A:"");},q=function(D){if(!n(D)){return D;}var A=h(s.hue.val(),0,360),B=h(s.saturation.val(),0,100),C=h(s.value.val(),0,100);s.hue.val(A!=null?A:"");s.saturation.val(B!=null?B:"");s.value.val(C!=null?C:"");},v=function(A){if(!n(A)){return A;}s.hex.val(s.hex.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,8));},n=function(A){switch(A.keyCode){case 9:case 16:case 29:case 37:case 38:case 40:return false;case"c".charCodeAt():case"v".charCodeAt():if(A.ctrlKey){return false;}}return true;},h=function(C,B,A){if(C==""||isNaN(C)){return B;}if(C>A){return A;}if(C<B){return B;}return C;};e.extend(true,l,{color:new f(),fields:{hue:m.find(".jPicker_HueText"),saturation:m.find(".jPicker_SaturationText"),value:m.find(".jPicker_BrightnessText"),red:m.find(".jPicker_RedText"),green:m.find(".jPicker_GreenText"),blue:m.find(".jPicker_BlueText"),hex:m.find(".jPicker_HexText"),alpha:m.find(".jPicker_AlphaText")},valuesChanged:e.isFunction(arguments[1])&&arguments[1]||null,bindedHexKeyUp:function(A){z(A);},setValuesFromRgba:function(){u.fromRgba(s.red.val(),s.green.val(),s.blue.val(),s.alpha.val());var B=u.get_Rgba(),A=u.get_H(),C=u.get_S(),D=u.get_V(),E=u.get_A();s.hex.val(B!=null?B:"");s.hue.val(A!=null?A:"");s.saturation.val(C!=null?C:"");s.value.val(D!=null?D:"");s.alpha.val(E!=null?E:"");},setValuesFromHsva:function(){u.fromHsva(s.hue.val(),s.saturation.val(),s.value.val(),s.alpha.val());var B=u.get_Rgba(),E=u.get_R(),C=u.get_G(),A=u.get_B(),D=u.get_A();s.hex.val(B!=null?B:"");s.red.val(E!=null?E:"");s.green.val(C!=null?C:"");s.blue.val(A!=null?A:"");s.alpha.val(D!=null?D:"");},setValuesFromHex:function(){u.fromHex(s.hex.val());var C=u.get_Rgba(),H=u.get_R(),F=u.get_G(),A=u.get_B(),G=u.get_A(),B=u.get_H(),D=u.get_S(),E=u.get_V();s.red.val(H!=null?H:"");s.green.val(F!=null?F:"");s.blue.val(A!=null?A:"");s.alpha.val(G!=null?G:"");s.hue.val(B!=null?B:"");s.saturation.val(D!=null?D:"");s.value.val(E!=null?E:"");},destroy:function(){s.hue.add(s.saturation).add(s.value).unbind("keyup",events.hsvKeyUp).unbind("blur",t);s.red.add(s.green).add(s.blue).unbind("keyup",events.rgbKeyUp).unbind("blur",k);s.alpha.unbind("keyup",alphaKeyUp).unbind("blur",x);s.hex.unbind("keyup",z);s=null;u=null;l.valuesChanged=null;}});var s=l.fields,u=l.color;s.hue.add(s.saturation).add(s.value).bind("keyup",w).bind("blur",t);s.red.add(s.green).add(s.blue).bind("keyup",p).bind("blur",k);s.alpha.bind("keyup",r).bind("blur",x);s.hex.bind("keyup",z).bind("blur",j);if(s.hex.val()!=""){u.fromHex(s.hex.val());l.setValuesFromHex();}};e.jPicker={List:[],Color:function(q){var m=this,j,l,n,o,k,t,p;e.extend(true,m,{get_R:function(){return j;},get_G:function(){return l;},get_B:function(){return n;},get_A:function(){return o;},get_Rgba:function(){return j!=null&&l!=null&&n!=null&&o!=null?g.rgbaToHex({r:j,g:l,b:n,a:o}):null;},get_Hex:function(){var h=m.get_Rgba();return h&&h.substring(0,6)||null;},get_H:function(){return k;},get_S:function(){return t;},get_V:function(){return p;},get_Hsv:function(){return{h:k,s:t,v:p};},fromRgba:function(v,s,h,u){j=v;l=s;n=h;o=u;var r=g.rgbToHsv({r:v,g:s,b:h});k=r.h;t=r.s;p=r.v;},fromHsva:function(h,s,u,v){k=h;t=s;p=u;o=v;var r=g.hsvToRgb({h:h,s:s,v:u});j=r.r;l=r.g;n=r.b;},fromHex:function(s){if(s==null||s==""){j=null;l=null;n=null;o=null;k=null;t=null;p=null;return;}var r=g.hexToRgba(s);j=r.r;l=r.g;n=r.b;o=r.a;var h=g.rgbToHsv({r:r.r,g:r.g,b:r.b});k=h.h;t=h.s;p=h.v;}});if(q){if(q.hex!=null&&q.hex!=""){m.fromHex(q.hex);}else{if(!isNaN(q.r)){m.fromRgba(q.r,q.g,q.b,q.a||100);}else{if(!isNaN(q.h)){m.fromHsva(q.h,q.s,q.v,q.a||100);}}}}},ColorMethods:{hexToRgba:function(m){m=this.validateHex(m);if(m==""){return{r:null,g:null,b:null,a:null};}var l="00",k="00",h="00",j="100";if(m.length==6){m+="ff";}if(m.length>6){l=m.substring(0,2);k=m.substring(2,4);h=m.substring(4,6);j=m.substring(6,m.length);}else{if(m.length>4){l=m.substring(4,m.length);m=m.substring(0,4);}if(m.length>2){k=m.substring(2,m.length);m=m.substring(0,2);}if(m.length>0){h=m.substring(0,m.length);}}return{r:this.hexToInt(l),g:this.hexToInt(k),b:this.hexToInt(h),a:Math.floor((this.hexToInt(j)*100)/255)};},validateHex:function(h){h=h.toLowerCase().replace(/[^a-f0-9]/g,"");if(h.length>8){h=h.substring(0,8);}return h;},rgbaToHex:function(h){return this.intToHex(h.r)+this.intToHex(h.g)+this.intToHex(h.b)+this.intToHex(Math.floor((h.a*255)/100));},intToHex:function(j){var h=Math.floor(j).toString(16);if(h.length==1){h=("0"+h);}return h.toLowerCase();},hexToInt:function(h){return parseInt(h,16);},rgbToHsv:function(l){var o=l.r/255,n=l.g/255,j=l.b/255,k={h:0,s:0,v:0},m=0,h=0,p;if(o>=n&&o>=j){h=o;m=n>j?j:n;}else{if(n>=j&&n>=o){h=n;m=o>j?j:o;}else{h=j;m=n>o?o:n;}}k.v=h;k.s=h?(h-m)/h:0;if(!k.s){k.h=0;}else{p=h-m;if(o==h){k.h=(n-j)/p;}else{if(n==h){k.h=2+(j-o)/p;}else{k.h=4+(o-n)/p;}}k.h=parseInt(k.h*60);if(k.h<0){k.h+=360;}}k.s=Math.floor(k.s*100);k.v=Math.floor(k.v*100);return k;},hsvToRgb:function(n){var r={r:0,g:0,b:0,a:100},m=n.h,x=n.s,u=n.v;if(x==0){if(u==0){r.r=r.g=r.b=0;}else{r.r=r.g=r.b=Math.floor(u*255/100);}}else{if(m==360){m=0;}m/=60;x=x/100;u=u/100;var l=Math.floor(m),o=m-l,k=u*(1-x),j=u*(1-(x*o)),w=u*(1-(x*(1-o)));switch(l){case 0:r.r=u;r.g=w;r.b=k;break;case 1:r.r=j;r.g=u;r.b=k;break;case 2:r.r=k;r.g=u;r.b=w;break;case 3:r.r=k;r.g=j;r.b=u;break;case 4:r.r=w;r.g=k;r.b=u;break;case 5:r.r=u;r.g=k;r.b=j;break;}r.r=Math.floor(r.r*255);r.g=Math.floor(r.g*255);r.b=Math.floor(r.b*255);}return r;}}};var f=e.jPicker.Color,c=e.jPicker.List,g=e.jPicker.ColorMethods;e.fn.jPicker=function(j){var h=arguments;return this.each(function(){var w=e(this),y=e.extend(true,{},e.fn.jPicker.defaults,j);if(w.get(0).nodeName.toLowerCase()=="input"){e.extend(true,y,{window:{bindToInput:true,expandable:true,input:w}});if(g.validateHex(w.val())){y.color.active=new f({hex:w.val(),a:y.color.active.get_A()});y.color.current=new f({hex:w.val(),a:y.color.active.get_A()});}}if(y.window.expandable){w.after('<span class="jPicker_Picker"><span class="jPicker_Color">&nbsp;</span><span class="jPicker_Alpha">&nbsp;</span><span class="jPicker_Icon" title="Click To Open Color Picker">&nbsp;</span><span class="jPicker_Container">&nbsp;</span></span>');}else{y.window.liveUpdate=false;}var U=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,ay=null,av=null,au=null,T=null,S=null,R=null,Q=null,P=null,O=null,V=null,aa=null,aA=null,ak=null,am=null,ao=null,I=null,aw=null,G=null,Y=null,az=null,M=null,L=null,at=null,aq=null,A=null,l=null,J=null,ap=null,ab=null,ai=null,o=null,m=null,C=null,u=null,an=function(aE){K.active=az.color;var aF=K.active,aG=q.clientPath,aD=aF.get_Hex(),aC=function(aH){ad(aH,100);aH.css({backgroundColor:"transparent",backgroundPosition:"0px 0px",filter:""});};aC(ay);aC(av);aC(au);aC(T);aC(S);aC(R);aC(Q);aC(P);aC(O);aa.add(aA).add(ak).add(am).add(ao).add(I).removeAttr("checked");switch(aE){case"h":aa.attr({checked:true});ay.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});av.css({backgroundColor:"transparent"});x(av,-256);ad(av,100);x(Q,-256);ad(O,0);break;case"s":aA.attr({checked:true});x(ay,-512);x(av,-768);z(R,aF.get_Hex());x(Q,-512);ad(O,0);break;case"v":ak.attr({checked:true});z(ay,"000000");x(av,-1024);R.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});x(Q,-768);ad(O,0);break;case"r":am.attr({checked:true});x(av,-1536);x(ay,-1280);x(Q,-1024);x(R,-1280);x(S,-1536);x(T,-1792);ad(O,0);break;case"g":ao.attr({checked:true});x(av,-2048);x(ay,-1792);x(Q,-2048);x(R,-2304);x(S,-2560);x(T,-2816);ad(O,0);break;case"b":I.attr({checked:true});x(av,-2560);x(ay,-2304);x(Q,-3072);x(R,-3328);x(S,-3584);x(T,-3840);ad(O,0);break;case"a":aw.attr({checked:true});x(ay,-512);x(av,-768);ad(av,0);z(R,aF.get_Hex());ad(Q,0);ad(P,0);ad(O,100);break;default:throw ("Invalid Mode");break;}switch(aE){case"h":G.set_RangeX(0,100);G.set_RangeY(0,100);Y.set_RangeY(0,360);break;case"s":case"v":case"a":G.set_RangeX(0,360);G.set_RangeY(0,100);Y.set_RangeY(0,100);break;case"r":case"g":case"b":G.set_RangeX(0,255);G.set_RangeY(0,255);Y.set_RangeY(0,255);break;}K.mode=aE;v();G.draw();Y.draw();ah();if(aj.expandable&&aj.liveUpdate){o.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});ad(m,100-aF.get_A());if(aj.bindToInput){aj.input.val(aF.get_Rgba()||"").css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent",color:aF.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aF);},n=function(){v();G.draw();Y.draw();ah();K.active=az.color;var aD=K.active;if(aj.expandable&&aj.liveUpdate){var aC=aD.get_Hex();o.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(m,100-aD.get_A());if(aj.bindToInput){aj.input.val(az.fields.hex.val()||"").css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent",color:aD.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aD);},B=function(){if(!az||!G||!Y){return;}K.active=az.color;var aC=az.fields,aE=K.active;switch(K.mode){case"h":aC.saturation.val(G.get_X());aC.value.val(100-G.get_Y());if(aE.get_H()==null){aC.hue.val(0);}break;case"s":case"a":aC.hue.val(G.get_X());aC.value.val(100-G.get_Y());if(aE.get_S()==null){aC.saturation.val(0);}break;case"v":aC.hue.val(G.get_X());aC.saturation.val(100-G.get_Y());if(aE.get_V()==null){aC.value.val(0);}break;case"r":aC.green.val(255-G.get_Y());aC.blue.val(G.get_X());if(aE.get_R()==null){aC.red.val(0);}break;case"g":aC.red.val(255-G.get_Y());aC.blue.val(G.get_X());if(aE.get_G()==null){aC.green.val(0);}break;case"b":aC.red.val(G.get_X());aC.green.val(255-G.get_Y());if(aE.get_B()==null){aC.blue.val(0);}break;}if(aE.get_A()==null){aC.alpha.val(100);az.setValuesFromHsva();v();Y.draw();}switch(K.mode){case"h":case"s":case"v":case"a":az.setValuesFromHsva();break;case"r":case"g":case"b":az.setValuesFromRgba();break;}ah();if(aj.expandable&&aj.liveUpdate){var aD=aE.get_Hex();o.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});ad(m,100-aE.get_A());if(aj.bindToInput){aj.input.val(aE.get_Rgba()||"").css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent",color:aE.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},al=function(){if(!az||!G||!Y){return;}K.active=az.color;var aC=az.fields,aE=K.active;switch(K.mode){case"h":aC.hue.val(360-Y.get_Y());if(aE.get_S()==null){aC.saturation.val(0);}if(aE.get_V()==null){aC.value.val(0);}break;case"s":aC.saturation.val(100-Y.get_Y());if(aE.get_H()==null){aC.hue.val(0);}if(aE.get_V()==null){aC.value.val(0);}break;case"v":aC.value.val(100-Y.get_Y());if(aE.get_H()==null){aC.hue.val(0);}if(aE.get_S()==null){aC.saturation.val(0);}break;case"r":aC.red.val(255-Y.get_Y());if(aE.get_G()==null){aC.green.val(0);}if(aE.get_B()==null){aC.blue.val(0);}break;case"g":aC.green.val(255-Y.get_Y());if(aE.get_R()==null){aC.red.val(0);}if(aE.get_B()==null){aC.blue.val(0);}break;case"b":aC.blue.val(255-Y.get_Y());if(aE.get_R()==null){aC.red.val(0);}if(aE.get_G()==null){aC.green.val(0);}break;case"a":aC.alpha.val(100-Y.get_Y());if(aE.get_R()==null){aC.red.val(0);}if(aE.get_G()==null){aC.green.val(0);}if(aE.get_B()==null){aC.blue.val(0);}break;}if(aE.get_A()==null){aC.alpha.val(100);}switch(K.mode){case"h":case"s":case"v":az.setValuesFromHsva();break;case"r":case"g":case"b":case"a":az.setValuesFromRgba();break;}ah();if(aj.expandable&&aj.liveUpdate){var aD=aE.get_Hex();o.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});ad(m,100-aE.get_A());if(aj.bindToInput){aj.input.val(aE.get_Rgba()||"").css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent",color:aE.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},v=function(){K.active=az.color;var aF=0,aE=K.active;switch(w.settings.color.mode){case"h":aF=360-aE.get_H();break;case"s":aF=100-aE.get_S();break;case"v":aF=100-aE.get_V();break;case"r":aF=255-aE.get_R();break;case"g":aF=255-aE.get_G();break;case"b":aF=255-aE.get_B();break;case"a":aF=100-aE.get_A();break;}Y.set_Y(aF);var aD=0,aC=0;switch(w.settings.color.mode){case"h":aD=aE.get_S();aC=100-aE.get_V();break;case"s":case"a":aD=aE.get_H();aC=100-aE.get_V();break;case"v":aD=aE.get_H();aC=100-aE.get_S();break;case"r":aD=aE.get_B();aC=255-aE.get_G();break;case"g":aD=aE.get_B();aC=255-aE.get_R();break;case"b":aD=aE.get_R();aC=255-aE.get_G();break;}G.set_X(aD);G.set_Y(aC);},ah=function(){aB();ar();Z();},aB=function(){try{var aC=az.color.get_Hex();A.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(A,az.color.get_A());}catch(aD){}},ar=function(){if(!K||!az){return;}K.active=az.color;var aC=K.active;switch(K.mode){case"h":z(ay,new f({h:aC.get_H(),s:100,v:100}).get_Hex());break;case"s":case"a":ad(av,100-aC.get_S());break;case"v":ad(av,aC.get_V());break;case"r":ad(av,aC.get_R()/255*100);break;case"g":ad(av,aC.get_G()/255*100);break;case"b":ad(av,aC.get_B()/255*100);break;}ad(au,100-aC.get_A());},Z=function(){if(!K||!az){return;}K.active=az.color;var aG=K.active;switch(K.mode){case"h":ad(P,100-aG.get_A());break;case"s":var aH=new f({h:aG.get_H(),s:100,v:aG.get_V()});z(R,aH.get_Hex());ad(P,100-aG.get_A());break;case"v":var aJ=new f({h:aG.get_H(),s:aG.get_S(),v:100});z(R,aJ.get_Hex());ad(P,100-aG.get_A());break;case"r":case"g":case"b":var aI=0,aK=0;if(K.mode=="r"){aI=aG.get_B();aK=aG.get_G();}else{if(K.mode=="g"){aI=aG.get_B();aK=aG.get_R();}else{if(K.mode=="b"){aI=aG.get_R();aK=aG.get_G();}}}var aC=aI/255*100,aF=aK/255*100,aE=(255-aI)/255*100,aD=(255-aK)/255*100;ad(T,aD>aE?aE:aD);ad(S,aD>aC?aC:aD);ad(R,aF>aC?aC:aF);ad(Q,aF>aE?aE:aF);ad(P,100-aG.get_A());break;case"a":z(R,aG.get_Hex());break;}},z=function(aC,aD){aC.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});},t=function(aC,aD){aC.css({backgroundImage:"url("+aD+")"});},x=function(aC,aD){aC.css({backgroundPosition:"0px "+aD+"px"});},ad=function(aD,aC){aD.css({visibility:aC>0?"visible":"hidden"});if(aC>0&&aC<100){aD.css({opacity:aC/100});}else{if(aC==0||aC==100){aD.css({opacity:""});}}},E=function(){az.fields.hex.val(K.current.get_Rgba()||"");az.setValuesFromHex();e.isFunction(az.valuesChanged)&&az.valuesChanged(az);},D=function(aC){an(aC.target.value);},ae=function(){E();},s=function(){E();aj.expandable&&w.hide();e.isFunction(w.cancelCallback)&&w.cancelCallback(K.active);},X=function(){var aD=K.active;K.current=new f({hex:aD.get_Rgba()});var aC=aD.get_Hex();l.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(l,az.color.get_A());if(aj.expandable){o.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(m,100-aD.get_A());if(aj.bindToInput){aj.input.val(aD.get_Rgba()||"").css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent",color:aD.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.commitCallback)&&w.commitCallback(aD);},p=function(){X();aj.expandable&&w.hide();},ag=function(){w.show();},W=function(aE){var aC=aj.element,aD=aj.page;M=parseInt(V.css("left"));L=parseInt(V.css("top"));at=aE.pageX;aq=aE.pageY;e(document).bind("mousemove",k).bind("mouseup",r);aE.stopPropagation();aE.preventDefault();return false;},k=function(aC){V.css({left:M-(at-aC.pageX)+"px",top:L-(aq-aC.pageY)+"px"});aC.stopPropagation();aC.preventDefault();return false;},r=function(aC){e(document).unbind("mousemove",k).unbind("mouseup",r);aC.stopPropagation();aC.preventDefault();return false;},F=function(aC){az.fields.hex.val(w.settings.window.input.val());az.bindedHexKeyUp(aC);},H=function(aC){az.fields.hex.val(new f({hex:e(this).attr("title")}).get_Rgba()||"");az.setValuesFromHex();e.isFunction(az.valuesChanged)&&az.valuesChanged(az);};e.extend(true,w,{id:w.attr("id"),settings:y,color:null,icon:null,commitCallback:e.isFunction(h[1])&&h[1]||null,liveCallback:e.isFunction(h[2])&&h[2]||null,cancelCallback:e.isFunction(h[3])&&h[3]||null,show:function(){if(document.all){var aD=false;for(i=0;i<c.length;i++){if(aD){c[i].color.add(c[i].icon).css({display:"none"});}if(c[i].id==w.id){aD=true;}}}K.current=new f({hex:K.active.get_Rgba()});var aC=K.active.get_Hex();l.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(l,K.active.get_A());V.css({display:"block"});v();},hide:function(){if(document.all){var aC=false;for(i=0;i<c.length;i++){if(aC){c[i].color.add(c[i].icon).css({display:"block"});}if(c[i].id==w.id){aC=true;}}}V.css({display:"none"});},destroy:function(){if(aj.expandable){C=V.find(".jPicker_Icon").unbind("click",ag);}if(aj.bindToInput){aj.input.unbind("keyup",F).unbind("change",F);}aa.add(aA).add(ak).add(am).add(ao).add(I).unbind("click",D);l.unbind("click",ae);ab.unbind("click",s);ap.unbind("click",p);if(aj.expandable){u.unbind("mousedown",W);}V.find(".jPicker_QuickColor").unbind("click",H);aa=null;aA=null;ak=null;am=null;ao=null;I=null;aw=null;ay=null;av=null;au=null;T=null;S=null;R=null;Q=null;P=null;O=null;J=null;A=null;l=null;ap=null;ab=null;ai=null;w.color=null;w.icon=null;G.destroy();G=null;Y.destroy();Y=null;az.destroy();az=null;w.commitCallback=null;w.cancelCallback=null;w.liveCallback=null;V.html("");for(i=0;i<c.length;i++){if(c[i].id==w.id){c.splice(i,1);}}}});var q=w.settings.images,aj=w.settings.window,af=w.settings.localization,K=w.settings.color;V=aj.expandable?w.next().find(".jPicker_Container"):w;if(aj.expandable){V.css({left:aj.position.x=="left"?"-526px":aj.position.x=="center"?"-259px":aj.position.x=="right"?"0px":aj.position.x=="screenCenter"?((e(document).width()>>1)-259)-w.next().offset().left+"px":aj.position.x,position:"absolute",top:aj.position.y=="top"?"-350px":aj.position.y=="center"?"-158px":aj.position.y=="bottom"?"25px":aj.position.y});}if((typeof(K.active)).toString().toLowerCase()=="string"){K.active=new f({hex:K.active});}V.html('<table class="jPicker_table"><tbody>'+(aj.expandable?'<tr><td class="jPicker_MoveBar" colspan="6">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="jPicker_Title">'+(aj.title||af.text.title)+'</h2><div class="jPicker_ColorMap"><span class="jPicker_ColorMap_l1">&nbsp;</span><span class="jPicker_ColorMap_l2">&nbsp;</span><span class="jPicker_ColorMap_l3">&nbsp;</span><img src="'+q.clientPath+q.colorMap.arrow.file+'" class="jPicker_ColorMap_Arrow"/></div></td><td rowspan="9"><div class="jPicker_ColorBar"><span class="jPicker_ColorBar_l1">&nbsp;</span><span class="jPicker_ColorBar_l2">&nbsp;</span><span class="jPicker_ColorBar_l3">&nbsp;</span><span class="jPicker_ColorBar_l4">&nbsp;</span><span class="jPicker_ColorBar_l5">&nbsp;</span><span class="jPicker_ColorBar_l6">&nbsp;</span><img src="'+q.clientPath+q.colorBar.arrow.file+'" class="jPicker_ColorBar_Arrow"/></div></td><td colspan="3" class="jPicker_Preview">'+af.text.newColor+'<div class="jPicker_NewCurrent"><span class="jPicker_Active" title="'+af.tooltips.colors.newColor+'">&nbsp;</span><span class="jPicker_Current" title="'+af.tooltips.colors.currentColor+'">&nbsp;</span></div>'+af.text.currentColor+'</td><td rowspan="9" class="jPicker_OkCancel"><input type="button" class="jPicker_Ok" value="'+af.text.ok+'" title="'+af.tooltips.buttons.ok+'"/><input type="button" class="jPicker_Cancel" value="'+af.text.cancel+'" title="'+af.tooltips.buttons.cancel+'"/><hr/><div class="jPicker_Grid">&nbsp;</div></td></tr><tr><td><input type="radio" class="jPicker_HueRadio" id="jPicker_Hue_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="h" title="'+af.tooltips.hue.radio+'"/></td><td><label for="jPicker_Hue_'+c.length+'" title="'+af.tooltips.hue.radio+'">H:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_HueText" value="'+K.active.get_H()+'" title="'+af.tooltips.hue.textbox+'"/> &deg;</td></tr><tr><td><input type="radio" class="jPicker_SaturationRadio" id="jPicker_Saturation_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="s" title="'+af.tooltips.saturation.radio+'"/></td><td><label for="jPicker_Saturation_'+c.length+'" title="'+af.tooltips.saturation.radio+'">S:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_SaturationText" value="'+K.active.get_S()+'" title="'+af.tooltips.saturation.textbox+'"/> %</td></tr><tr><td><input type="radio" class="jPicker_BrightnessRadio" id="jPicker_Brightness_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="v" title="'+af.tooltips.brightness.radio+'"/><br/><br/></td><td><label for="jPicker_Brightness_'+c.length+'" title="'+af.tooltips.brightness.radio+'">B:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_BrightnessText" value="'+K.active.get_V()+'" title="'+af.tooltips.brightness.textbox+'"/> %</td></tr><tr><td><input type="radio" class="jPicker_RedRadio" id="jPicker_Red_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="r" title="'+af.tooltips.red.radio+'"/></td><td><label for="jPicker_Red_'+c.length+'" title="'+af.tooltips.red.radio+'">R:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_RedText" value="'+K.active.get_R()+'" title="'+af.tooltips.red.textbox+'"/></td></tr><tr><td><input type="radio" class="jPicker_GreenRadio" id="jPicker_Green_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="g" title="'+af.tooltips.green.radio+'"/></td><td><label for="jPicker_Green_'+c.length+'" title="'+af.tooltips.green.radio+'">G:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_GreenText" value="'+K.active.get_G()+'" title="'+af.tooltips.green.textbox+'"/></td></tr><tr><td><input type="radio" class="jPicker_BlueRadio" id="jPicker_Blue_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="b" title="'+af.tooltips.blue.radio+'"/></td><td><label for="jPicker_Blue_'+c.length+'" title="'+af.tooltips.blue.radio+'">B:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_BlueText" value="'+K.active.get_B()+'" title="'+af.tooltips.blue.textbox+'"/></td></tr><tr><td><input type="radio" class="jPicker_AlphaRadio" id="jPicker_Alpha_'+c.length+'" name="jPicker_Mode_'+c.length+'" value="a" title="'+af.tooltips.alpha.radio+'"/></td><td><label for="jPicker_Alpha_'+c.length+'" title="'+af.tooltips.alpha.radio+'">A:</label></td><td class="jPicker_Text"><input type="text" class="jPicker_AlphaText" value="'+K.active.get_A()+'" title="'+af.tooltips.alpha.textbox+'"/> %</td></tr><tr><td class="jPicker_HexCol"><label for="jPicker_Hex_'+c.length+'" title="'+af.tooltips.hex.textbox+'">#:</label></td><td class="jPicker_EnterHex" colspan="2"><input type="text" class="jPicker_HexText" id="jPicker_Hex_'+c.length+'" value="'+K.active.get_Rgba()+'" title="'+af.tooltips.hex.textbox+'"/></td></tr></tbody></table>');aa=V.find(".jPicker_HueRadio");aA=V.find(".jPicker_SaturationRadio");ak=V.find(".jPicker_BrightnessRadio");am=V.find(".jPicker_RedRadio");ao=V.find(".jPicker_GreenRadio");I=V.find(".jPicker_BlueRadio");aw=V.find(".jPicker_AlphaRadio");ay=V.find(".jPicker_ColorMap_l1");av=V.find(".jPicker_ColorMap_l2");au=V.find(".jPicker_ColorMap_l3");T=V.find(".jPicker_ColorBar_l1");S=V.find(".jPicker_ColorBar_l2");R=V.find(".jPicker_ColorBar_l3");Q=V.find(".jPicker_ColorBar_l4");P=V.find(".jPicker_ColorBar_l5");O=V.find(".jPicker_ColorBar_l6");J=V.find(".jPicker_NewCurrent");var ac=K.active.get_Hex();A=V.find(".jPicker_Active").css({backgroundColor:ac&&ac.length==6?"#"+ac:"transparent"});l=V.find(".jPicker_Current").css({backgroundColor:ac&&ac.length==6?"#"+ac:"transparent"});ap=V.find(".jPicker_Ok");ab=V.find(".jPicker_Cancel");ai=V.find(".jPicker_Grid");w.color=e(".Picker_Color");w.icon=e(".jPicker_Icon");az=new b(V,n);G=new d(V.find(".jPicker_ColorMap"),{map:{width:q.colorMap.width,height:q.colorMap.height},arrow:{image:q.clientPath+q.colorMap.arrow.file,width:q.colorMap.arrow.width,height:q.colorMap.arrow.height}},B);Y=new d(V.find(".jPicker_ColorBar"),{map:{width:q.colorBar.width,height:q.colorBar.height},arrow:{image:q.clientPath+q.colorBar.arrow.file,width:q.colorBar.arrow.width,height:q.colorBar.arrow.height}},al);t(ay,q.clientPath+"Maps.png");t(av,q.clientPath+"Maps.png");t(au,q.clientPath+"map-opacity.png");t(T,q.clientPath+"Bars.png");t(S,q.clientPath+"Bars.png");t(R,q.clientPath+"Bars.png");t(Q,q.clientPath+"Bars.png");t(P,q.clientPath+"bar-opacity.png");t(O,q.clientPath+"AlphaBar.png");t(J,q.clientPath+"preview-opacity.png");if(aj.expandable){o=w.next().find(".jPicker_Color").css({backgroundColor:ac&&ac.length==6?"#"+ac:"transparent"});m=w.next().find(".jPicker_Alpha");t(m,q.clientPath+"bar-opacity.png");ad(m,100-K.active.get_A());C=w.next().find(".jPicker_Icon").css({backgroundImage:"url("+q.clientPath+q.picker.file+")"}).bind("click",ag);if(aj.bindToInput){aj.input.bind("keyup",F).bind("change",F);}}aa.add(aA).add(ak).add(am).add(ao).add(I).add(aw).bind("click",D);l.bind("click",ae);ab.bind("click",s);ap.bind("click",p);if(aj.expandable){u=V.find(".jPicker_MoveBar").bind("mousedown",W);}if(K.quickList&&K.quickList.length>0){ai.html("");for(i=0;i<K.quickList.length;i++){if((typeof(K.quickList[i])).toString().toLowerCase()=="string"){K.quickList[i]=new f({hex:K.quickList[i]});}var ax=K.quickList[i].get_Rgba();ai.append('<span class="jPicker_QuickColor" title="'+(ax&&"#"+ax||"")+'">&nbsp;</span>');var N=K.quickList[i].get_Hex();V.find(".jPicker_QuickColor").eq(i).css({backgroundColor:N&&N.length==6?"#"+N:"transparent",backgroundImage:N?"none":"url("+q.clientPath+"NoColor.png)"}).click(H);}}an(K.mode);az.fields.hex.val(K.active.get_Rgba()||"");az.setValuesFromHex();v();ah();if(!aj.expandable){w.show();}c.push(w);});};e.fn.jPicker.defaults={window:{title:null,position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true},color:{mode:"h",active:new f({hex:"#ffcc00ff"}),quickList:[new f({h:360,s:33,v:100}),new f({h:360,s:66,v:100}),new f({h:360,s:100,v:100}),new f({h:360,s:100,v:75}),new f({h:360,s:100,v:50}),new f({h:180,s:0,v:100}),new f({h:30,s:33,v:100}),new f({h:30,s:66,v:100}),new f({h:30,s:100,v:100}),new f({h:30,s:100,v:75}),new f({h:30,s:100,v:50}),new f({h:180,s:0,v:90}),new f({h:60,s:33,v:100}),new f({h:60,s:66,v:100}),new f({h:60,s:100,v:100}),new f({h:60,s:100,v:75}),new f({h:60,s:100,v:50}),new f({h:180,s:0,v:80}),new f({h:90,s:33,v:100}),new f({h:90,s:66,v:100}),new f({h:90,s:100,v:100}),new f({h:90,s:100,v:75}),new f({h:90,s:100,v:50}),new f({h:180,s:0,v:70}),new f({h:120,s:33,v:100}),new f({h:120,s:66,v:100}),new f({h:120,s:100,v:100}),new f({h:120,s:100,v:75}),new f({h:120,s:100,v:50}),new f({h:180,s:0,v:60}),new f({h:150,s:33,v:100}),new f({h:150,s:66,v:100}),new f({h:150,s:100,v:100}),new f({h:150,s:100,v:75}),new f({h:150,s:100,v:50}),new f({h:180,s:0,v:50}),new f({h:180,s:33,v:100}),new f({h:180,s:66,v:100}),new f({h:180,s:100,v:100}),new f({h:180,s:100,v:75}),new f({h:180,s:100,v:50}),new f({h:180,s:0,v:40}),new f({h:210,s:33,v:100}),new f({h:210,s:66,v:100}),new f({h:210,s:100,v:100}),new f({h:210,s:100,v:75}),new f({h:210,s:100,v:50}),new f({h:180,s:0,v:30}),new f({h:240,s:33,v:100}),new f({h:240,s:66,v:100}),new f({h:240,s:100,v:100}),new f({h:240,s:100,v:75}),new f({h:240,s:100,v:50}),new f({h:180,s:0,v:20}),new f({h:270,s:33,v:100}),new f({h:270,s:66,v:100}),new f({h:270,s:100,v:100}),new f({h:270,s:100,v:75}),new f({h:270,s:100,v:50}),new f({h:180,s:0,v:10}),new f({h:300,s:33,v:100}),new f({h:300,s:66,v:100}),new f({h:300,s:100,v:100}),new f({h:300,s:100,v:75}),new f({h:300,s:100,v:50}),new f({h:180,s:0,v:0}),new f({h:330,s:33,v:100}),new f({h:330,s:66,v:100}),new f({h:330,s:100,v:100}),new f({h:330,s:100,v:75}),new f({h:330,s:100,v:50}),new f()]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:40,height:9}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press &ldquo;OK&rdquo; To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To &ldquo;Hue&rdquo; Color Mode",textbox:"Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)"},saturation:{radio:"Set To &ldquo;Saturation&rdquo; Color Mode",textbox:"Enter A &ldquo;Saturation&rdquo; Value (0-100%)"},brightness:{radio:"Set To &ldquo;Brightness&rdquo; Color Mode",textbox:"Enter A &ldquo;Brightness&rdquo; Value (0-100%)"},red:{radio:"Set To &ldquo;Red&rdquo; Color Mode",textbox:"Enter A &ldquo;Red&rdquo; Value (0-255)"},green:{radio:"Set To &ldquo;Green&rdquo; Color Mode",textbox:"Enter A &ldquo;Green&rdquo; Value (0-255)"},blue:{radio:"Set To &ldquo;Blue&rdquo; Color Mode",textbox:"Enter A &ldquo;Blue&rdquo; Value (0-255)"},alpha:{radio:"Set To &ldquo;Alpha&rdquo; Color Mode",textbox:"Enter A &ldquo;Alpha&rdquo; Value (0-100)"},hex:{textbox:"Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)"}}}};})(jQuery,"1.0.12");