1 line
26 KiB
JavaScript
1 line
26 KiB
JavaScript
(function(d){var c=function(g,p){var m=this,k=d("#"+g),o=d("#"+g+"_Arrow"),n=function(q){j(q);d(document).bind("mousemove",h).bind("mouseup",l);q.stopPropagation();q.preventDefault();return false;},h=function(q){j(q);q.stopPropagation();q.preventDefault();return false;},l=function(q){d(document).unbind("mouseup",l).unbind("mousemove",h);q.stopPropagation();q.preventDefault();return false;},j=function(u){var w=k.offset(),q=u.pageX-w.left-parseInt(k.css("border-left-width")),z=u.pageY-w.top-parseInt(k.css("border-top-width")),t=k.w,r=k.h,v,s;if(q<0){q=0;}else{if(q>t){q=t;}}if(z<0){z=0;}else{if(z>r){z=r;}}v=Math.floor(q/t*m.mxX);s=Math.floor(z/r*m.mxY);m.x=v;m.y=s;if(m.mxX==m.mnX){q=0;}if(m.mxY==m.mnY){z=0;}m.setArrowPosition(q,z);d.isFunction(m.valuesChanged)&&m.valuesChanged(m);};d.extend(true,m,{settings:p,x:0,y:0,mnX:0,mxX:0,mnY:100,mxY:100,valuesChanged:d.isFunction(arguments[2])&&arguments[2]||null,setPositioningVariables:function(r){var q=m.settings.map;k.w=q&&q.width||k.width();k.h=q&&q.height||k.height();m.MinX=0;m.MinY=0;m.MaxX=k.w;m.MaxY=k.h;},setArrowPositionFromValues:function(t){m.setPositioningVariables();var w=0,v=0,u=m.mnX,r=m.mxX,s=m.mnY,q=m.mxY,A=m.x,z=m.y;if(u!=r){if(A==u){w=0;}else{if(A==r){w=k.w;}else{if(u<1){r+=Math.abs(u)+1;}if(A<1){A+=1;}w=A/r*k.w;if(parseInt(w)==(r-1)){w=r;}else{w=parseInt(w);}if(u<1){w-=Math.abs(u)-1;}}}}if(s!=q){if(z==s){v=0;}else{if(z==q){v=k.h;}else{if(s<1){q+=Math.abs(s)+1;}if(z<1){z+=1;}v=z/q*k.h;if(parseInt(v)==(q-1)){v=q;}else{v=parseInt(v);}if(s<1){v-=Math.abs(s)-1;}}}}m.setArrowPosition(w,v);},setArrowPosition:function(q,v){var u=k.w,s=k.h,t=o.w,r=o.h;if(q<0){q=0;}else{if(q>u){q=u;}}if(v<0){v=0;}else{if(v>s){v=s;}}if(t>u){q=(u>>1)-(t>>1);}else{q-=t>>1;}if(r>s){v=(s>>1)-(r>>1);}else{v-=r>>1;}o.css({left:q+"px",top:v+"px"});},destroy:function(){d(document).unbind("mouseup",l).unbind("mousemove",h);k.unbind("mousedown",n);k=null;o=null;m.valuesChanged=null;}});o.src=m.settings.arrow&&m.settings.arrow.image;o.w=m.settings.arrow&&m.settings.arrow.width||o.width();o.h=m.settings.arrow&&m.settings.arrow.height||o.height();m.setPositioningVariables();k.bind("mousedown",n);m.setArrowPositionFromValues();d.isFunction(m.valuesChanged)&&m.valuesChanged(m);},a=function(h){var r=this,u=function(w){if(w.target.value==""){return;}v(w);r.setValuesFromHsv();d.isFunction(r.valuesChanged)&&r.valuesChanged(r);},n=function(w){if(w.target.value==""){return;}j(w);r.setValuesFromRgb();d.isFunction(r.valuesChanged)&&r.valuesChanged(r);},g=function(w){if(w.target.value==""){r.setValuesFromRgb();}},p=function(w){if(w.target.value==""){r.setValuesFromHsv();}},t=function(w){if(w.target.value==""){return;}s(w);r.setValuesFromHex();d.isFunction(r.valuesChanged)&&r.valuesChanged(r);},q=function(w){if(w.target.value==""){r.setValuesFromHsv();}},j=function(w){if(!l(w)){return w;}o.red.val(m(o.red.val(),0,255));o.green.val(m(o.green.val(),0,255));o.blue.val(m(o.blue.val(),0,255));},v=function(w){if(!l(w)){return w;}o.hue.val(m(o.hue.val(),0,360));o.saturation.val(m(o.saturation.val(),0,100));o.value.val(m(o.value.val(),0,100));},s=function(w){if(!l(w)){return w;}o.hex.val(o.hex.val().replace(/[^a-fA-F0-9]/g,"0").toLowerCase().substring(0,6));},l=function(w){switch(w.keyCode){case 9:case 16:case 29:case 37:case 38:case 40:return false;case"c".charCodeAt():case"v".charCodeAt():if(w.ctrlKey){return false;}}return true;},m=function(y,x,w){if(y==""||isNaN(y)){return x;}y=parseInt(y);if(y>w){return w;}if(y<x){return x;}return y;};d.extend(true,r,{color:new e(),fields:{hue:d("#"+h+"_jPicker_Hue"),saturation:d("#"+h+"_jPicker_Saturation"),value:d("#"+h+"_jPicker_Brightness"),red:d("#"+h+"_jPicker_Red"),green:d("#"+h+"_jPicker_Green"),blue:d("#"+h+"_jPicker_Blue"),hex:d("#"+h+"_jPicker_Hex")},valuesChanged:d.isFunction(arguments[1])&&arguments[1]||null,bindedHexKeyUp:function(w){t(w);},setValuesFromRgb:function(){k.fromRgb(o.red.val(),o.green.val(),o.blue.val());o.hex.val(k.hex);o.hue.val(k.h);o.saturation.val(k.s);o.value.val(k.v);},setValuesFromHsv:function(){k.fromHsv(o.hue.val(),o.saturation.val(),o.value.val());o.hex.val(k.hex);o.red.val(k.r);o.green.val(k.g);o.blue.val(k.b);},setValuesFromHex:function(){k.fromHex(o.hex.val());o.red.val(k.r);o.green.val(k.g);o.blue.val(k.b);o.hue.val(k.h);o.saturation.val(k.s);o.value.val(k.v);},destroy:function(){o.hue.add(o.saturation).add(o.value).unbind("keyup",events.hsvKeyUp).unbind("blur",g);o.red.add(o.green).add(o.blue).unbind("keyup",events.rgbKeyUp).unbind("blur",p);o.hex.unbind("keyup",r.hexKeyUp);o=null;k=null;r.valuesChanged=null;}});var o=r.fields,k=r.color;o.hue.add(o.saturation).add(o.value).bind("keyup",u).bind("blur",g);o.red.add(o.green).add(o.blue).bind("keyup",n).bind("blur",p);o.hex.bind("keyup",t);if(o.hex.val()!=""){k.fromHex(o.hex.val());r.setValuesFromHex();}};d.jPicker={List:[],getListElementById:function(h){var g=d.jPicker.List;for(i=0;i<g.length;i++){if(g[i].id==h){return g[i];}}return null;},Color:function(h){var g=this;d.extend(true,g,{r:0,g:0,b:0,h:0,s:0,v:0,hex:"",fromRgb:function(l,k,j){var n=this;n.r=l;n.g=k;n.b=j;var m=f.rgbToHsv(n);n.h=m.h;n.s=m.s;n.v=m.v;n.hex=f.rgbToHex(n);},fromHsv:function(l,k,j){var n=this;n.h=l;n.s=k;n.v=j;var m=f.hsvToRgb(n);n.r=m.r;n.g=m.g;n.b=m.b;n.hex=f.rgbToHex(m);},fromHex:function(j){var m=this;m.hex=j;var l=f.hexToRgb(j);m.r=l.r;m.g=l.g;m.b=l.b;var k=f.rgbToHsv(l);m.h=k.h;m.s=k.s;m.v=k.v;m.hex=f.rgbToHex(l);}});if(h){if(h.hex){g.fromHex(h.hex);}else{if(h.r){g.fromRgb(h.r,h.g,h.b);}else{if(h.h){g.fromHsv(h.h,h.s,h.v);}}}}},ColorMethods:{hexToRgb:function(l){l=this.validateHex(l);var k="00",j="00",h="00";if(l.length==6){k=l.substring(0,2);j=l.substring(2,4);h=l.substring(4,6);}else{if(l.length>4){k=l.substring(4,l.length);l=l.substring(0,4);}if(l.length>2){j=l.substring(2,l.length);l=l.substring(0,2);}if(l.length>0){h=l.substring(0,l.length);}}return{r:this.hexToInt(k),g:this.hexToInt(j),b:this.hexToInt(h)};},validateHex:function(g){g=g.toLowerCase().replace(/[^a-f0-9]/g,"0");if(g.length>6){g=g.substring(0,6);}return g;},rgbToHex:function(g){return this.intToHex(g.r)+this.intToHex(g.g)+this.intToHex(g.b);},intToHex:function(h){var g=parseInt(h).toString(16);if(g.length==1){g=("0"+g);}return g.toLowerCase();},hexToInt:function(g){return parseInt(g,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=parseInt(k.s*100);k.v=parseInt(k.v*100);return k;},hsvToRgb:function(m){var o={r:0,g:0,b:0},l=m.h,w=m.s,r=m.v;if(w==0){if(r==0){o.r=o.g=o.b=0;}else{o.r=o.g=o.b=parseInt(r*255/100);}}else{if(l==360){l=0;}l/=60;w=w/100;r=r/100;var k=parseInt(l),n=l-k,j=r*(1-w),g=r*(1-(w*n)),u=r*(1-(w*(1-n)));switch(k){case 0:o.r=r;o.g=u;o.b=j;break;case 1:o.r=g;o.g=r;o.b=j;break;case 2:o.r=j;o.g=r;o.b=u;break;case 3:o.r=j;o.g=g;o.b=r;break;case 4:o.r=u;o.g=j;o.b=r;break;case 5:o.r=r;o.g=j;o.b=g;break;}o.r=parseInt(o.r*255);o.g=parseInt(o.g*255);o.b=parseInt(o.b*255);}return o;}}};var e=d.jPicker.Color,b=d.jPicker.List,f=d.jPicker.ColorMethods;d.fn.jPicker=function(h){var g=arguments;return this.each(function(){var u=d(this),R=u.attr("id"),v=d.extend(true,{},d.fn.jPicker.defaults,h);if(!R){alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");return;}if(u.get(0).nodeName.toLowerCase()=="input"){d.extend(true,v,{window:{bindToInput:true,expandable:true,input:u}});if(f.validateHex(u.val())){v.color.active=new e({hex:u.val()});v.color.current=new e({hex:u.val()});}}if(v.window.expandable){u.after('<span id="'+R+'_jPicker_Picker" class="jPicker_Picker"><span id="'+R+'_jPicker_Color" class="jPicker_Color"> </span><span id="'+R+'_jPicker_Icon" class="jPicker_Icon" title="Click To Open Color Picker"> </span><span id="'+R+'_jPicker_Container" class="jPicker_Container"> </span></span>');}else{v.window.liveUpdate=false;}var N=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,al=null,ak=null,M=null,L=null,K=null,J=null,O=null,U=null,an=null,ac=null,ad=null,ae=null,F=null,D=null,S=null,am=null,I=null,H=null,aj=null,ah=null,x=null,k=null,ag=null,V=null,aa=null,m=null,z=null,s=null,af=function(ar){G.active=am.color;var at=G.active,au=o.clientPath,aq=function(av){W(av,100);av.css({backgroundColor:"",backgroundImage:"none",filter:""});};aq(al);aq(ak);aq(M);aq(L);aq(K);aq(J);U.add(an).add(ac).add(ad).add(ae).add(F).removeAttr("checked");switch(ar){case"h":U.attr("checked",true);al.css({backgroundColor:"#"+at.hex});ak.css({backgroundColor:"transparent"});r(ak,au+"map-hue.png");W(ak,100);r(J,au+"bar-hue.png");D.mxX=100;D.mxY=100;S.mxY=360;break;case"s":an.attr("checked",true);r(al,au+"map-saturation.png");r(ak,au+"map-saturation-overlay.png");W(ak,0);w(K,at.hex);r(J,au+"bar-saturation.png");D.mxX=360;D.mxY=100;S.mxY=100;break;case"v":ac.attr("checked",true);w(al,"000");r(ak,au+"map-brightness.png");K.css({backgroundColor:"#"+at.hex});r(J,au+"bar-brightness.png");D.mxX=360;D.mxY=100;S.mxY=100;break;case"r":ad.attr("checked",true);r(ak,au+"map-red-max.png");r(al,au+"map-red-min.png");r(J,au+"bar-red-tl.png");r(K,au+"bar-red-tr.png");r(L,au+"bar-red-br.png");r(M,au+"bar-red-bl.png");break;case"g":ae.attr("checked",true);r(ak,au+"map-green-max.png");r(al,au+"map-green-min.png");r(J,au+"bar-green-tl.png");r(K,au+"bar-green-tr.png");r(L,au+"bar-green-br.png");r(M,au+"bar-green-bl.png");break;case"b":F.attr("checked",true);r(ak,au+"map-blue-max.png");r(al,au+"map-blue-min.png");r(J,au+"bar-blue-tl.png");r(K,au+"bar-blue-tr.png");r(L,au+"bar-blue-br.png");r(M,au+"bar-blue-bl.png");break;default:throw ("Invalid Mode");break;}switch(ar){case"h":case"s":case"v":D.mnX=1;D.mnY=1;S.mnY=1;break;case"r":case"g":case"b":D.mnX=0;D.mnY=0;S.mnY=0;D.mxX=255;D.mxY=255;S.mxY=255;break;}G.mode=ar;t();ai();T();if(ab.expandable&&ab.liveUpdate){m.css({backgroundColor:"#"+at.hex});if(ab.bindToInput){ab.input.val(at.hex).css({backgroundColor:"#"+at.hex,color:at.v>75?"#000000":"#ffffff"});}}d.isFunction(u.liveCallback)&&u.liveCallback(at);},l=function(){t();Z();G.active=am.color;var aq=G.active;if(ab.expandable&&ab.liveUpdate){m.css({backgroundColor:"#"+aq.hex});if(ab.bindToInput){ab.input.val(am.fields.hex.val()).css({backgroundColor:"#"+aq.hex,color:aq.v>75?"#000000":"#ffffff"});}}d.isFunction(u.liveCallback)&&u.liveCallback(aq);},y=function(){if(!am||!D||!S){return;}G.active=am.color;var aq=am.fields,ar=G.active;switch(G.mode){case"h":aq.saturation.val(D.x);aq.value.val(100-D.y);break;case"s":aq.hue.val(D.x);aq.value.val(100-D.y);break;case"v":aq.hue.val(D.x);aq.saturation.val(100-D.y);break;case"r":aq.blue.val(D.x);aq.green.val(255-D.y);break;case"g":aq.blue.val(D.x);aq.red.val(255-D.y);break;case"b":aq.red.val(D.x);aq.green.val(255-D.y);break;}switch(G.mode){case"h":case"s":case"v":am.setValuesFromHsv();break;case"r":case"g":case"b":am.setValuesFromRgb();break;}Z();if(ab.expandable&&ab.liveUpdate){m.css({backgroundColor:"#"+ar.hex});if(ab.bindToInput){ab.input.val(ar.hex).css({backgroundColor:"#"+ar.hex,color:ar.v>75?"#000000":"#ffffff"});}}d.isFunction(u.liveCallback)&&u.liveCallback(ar);},ap=function(){if(!am||!D||!S){return;}G.active=am.color;var aq=am.fields,ar=G.active;switch(G.mode){case"h":aq.hue.val(360-S.y);break;case"s":aq.saturation.val(100-S.y);break;case"v":aq.value.val(100-S.y);break;case"r":aq.red.val(255-S.y);break;case"g":aq.green.val(255-S.y);break;case"b":aq.blue.val(255-S.y);break;}switch(G.mode){case"h":case"s":case"v":am.setValuesFromHsv();break;case"r":case"g":case"b":am.setValuesFromRgb();break;}Z();if(ab.expandable&&ab.liveUpdate){m.css({backgroundColor:"#"+ar.hex});if(ab.bindToInput){ab.input.val(ar.hex).css({backgroundColor:"#"+ar.hex,color:ar.v>75?"#000000":"#ffffff"});}}d.isFunction(u.liveCallback)&&u.liveCallback(ar);},t=function(){G.active=am.color;var au=0,at=G.active;switch(u.settings.color.mode){case"h":au=360-at.h;break;case"s":au=100-at.s;break;case"v":au=100-at.v;break;case"r":au=255-at.r;break;case"g":au=255-at.g;break;case"b":au=255-at.b;break;}S.y=au;S.setArrowPositionFromValues();var ar=0,aq=0;switch(u.settings.color.mode){case"h":ar=at.s;aq=100-at.v;break;case"s":ar=at.h;aq=100-at.v;break;case"v":ar=at.h;aq=100-at.s;break;case"r":ar=at.b;aq=256-at.g;break;case"g":ar=at.b;aq=256-at.r;break;case"b":ar=at.r;aq=256-at.g;break;}D.x=ar;D.y=aq;D.setArrowPositionFromValues();},Z=function(){ao();ai();T();},ao=function(){try{x.css({backgroundColor:"#"+am.color.hex});}catch(aq){}},ai=function(){if(!G||!am){return;}G.active=am.color;var ar=G.active;switch(G.mode){case"h":var aq=new e({h:ar.h,s:100,v:100});w(al,aq.hex);break;case"s":W(ak,100-ar.s);break;case"v":W(ak,ar.v);break;case"r":W(ak,ar.r/256*100);break;case"g":W(ak,ar.g/256*100);break;case"b":W(ak,ar.b/256*100);break;}},T=function(){if(!G||!am){return;}G.active=am.color;var av=G.active,ay=G.mode,aA=am.fields;switch(ay){case"h":break;case"s":var aw=new e({h:av.h,s:100,v:av.v});w(K,aw.hex);break;case"v":var az=new e({h:av.h,s:av.s,v:100});w(K,az.hex);break;case"r":case"g":case"b":var ax=0,aB=0;if(ay=="r"){ax=aA.blue.val();aB=aA.green.val();}else{if(ay=="g"){ax=aA.blue.val();aB=aA.red.val();}else{if(ay=="b"){ax=aA.red.val();aB=aA.green.val();}}}var aq=ax/256*100,au=aB/256*100,at=(256-ax)/256*100,ar=(256-aB)/256*100;W(J,au>at?at:au);W(K,au>aq?aq:au);W(L,ar>aq?aq:ar);W(M,ar>at?at:ar);break;}},w=function(aq,at){try{aq.css({backgroundColor:"#"+at});}catch(ar){}},r=function(aq,ar){if(ar.indexOf("png")&&this.isLessThanIE7){aq.attr("pngSrc",ar);aq.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ar+"')"});}else{aq.css({backgroundImage:"url("+ar+")"});}},W=function(ar,aq){if(aq==0){ar.css({display:"none"});return;}else{if(aq<100){ar.css({display:""});if(this.isLessThanIE7){var at=ar.attr("pngSrc");if(at!=null&&at.indexOf("map-hue")==-1){ar.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+at+"') progid:DXImageTransform.Microsoft.Alpha(opacity="+aq+")"});}}else{ar.css({opacity:aq/100});}}else{if(aq==100){ar.css({display:""});if(this.isLessThanIE7){var at=ar.attr("pngSrc");if(at!=null&&at.indexOf("map-hue")==-1){ar.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+at+"')"});}}else{ar.css({opacity:""});}}}}},B=function(){am.fields.hex.val(G.current.hex);am.setValuesFromHex();d.isFunction(am.valuesChanged)&&am.valuesChanged(am);},A=function(aq){af(aq.target.value);},X=function(){B();},q=function(){B();ab.expandable&&u.hide();d.isFunction(u.cancelCallback)&&u.cancelCallback();},Q=function(){var aq=G.active;G.current=new e({hex:aq.hex});k.css({backgroundColor:"#"+aq.hex});if(ab.expandable){m.css({backgroundColor:"#"+aq.hex});if(ab.bindToInput){ab.input.val(aq.hex).css({backgroundColor:"#"+aq.hex,color:aq.v>75?"#000000":"#ffffff"});}}d.isFunction(u.commitCallback)&&u.commitCallback(aq);},n=function(){Q();ab.expandable&&u.hide();},Y=function(){u.show();},P=function(at){var aq=ab.element,ar=ab.page;I=parseInt(O.css("left"));H=parseInt(O.css("top"));aj=at.pageX;ah=at.pageY;d(document).bind("mousemove",j).bind("mouseup",p);at.stopPropagation();at.preventDefault();return false;},j=function(aq){O.css({left:I-(aj-aq.pageX)+"px",top:H-(ah-aq.pageY)+"px"});aq.stopPropagation();aq.preventDefault();return false;},p=function(aq){d(document).unbind("mousemove",j).unbind("mouseup",p);aq.stopPropagation();aq.preventDefault();return false;},C=function(aq){am.fields.hex.val(u.settings.window.input.val());am.bindedHexKeyUp(aq);},E=function(aq){am.fields.hex.val(G.quickList[aq.data.i].hex);am.setValuesFromHex();d.isFunction(am.valuesChanged)&&am.valuesChanged(am);};d.extend(true,u,{id:u.attr("id"),settings:v,color:null,icon:null,commitCallback:d.isFunction(g[1])&&g[1]||null,liveCallback:d.isFunction(g[2])&&g[2]||null,cancelCallback:d.isFunction(g[3])&&g[3]||null,show:function(){if(document.all){var aq=false;for(i=0;i<b.length;i++){if(aq){b[i].color.add(b[i].icon).css({display:"none"});}if(b[i].id==u.id){aq=true;}}}G.current=new e({hex:G.active.hex});k.css({backgroundColor:"#"+G.active.hex});O.css({display:"block"});D.setPositioningVariables();S.setPositioningVariables();t();},hide:function(){if(document.all){var aq=false;for(i=0;i<b.length;i++){if(aq){b[i].color.add(b[i].icon).css({display:"block"});}if(b[i].id==u.id){aq=true;}}}O.css({display:"none"});},destroy:function(){if(ab.expandable){z=d("#"+u.id+"_jPicker_Icon").unbind("click",Y);}if(ab.bindToInput){ab.input.unbind("keyup",C).unbind("change",C);}U.add(an).add(ac).add(ad).add(ae).add(F).unbind("click",A);k.unbind("click",X);V.unbind("click",q);ag.unbind("click",n);if(ab.expandable){s.unbind("mousedown",P);}if(G.quickList&&G.quickList.length>0){for(i=0;i<G.quickList.length;i++){d("#"+u.id+"_jPicker_Grid_"+i,O).unbind("click",E);}}U=null;an=null;ac=null;ad=null;ae=null;F=null;al=null;ak=null;M=null;L=null;K=null;J=null;x=null;k=null;ag=null;V=null;aa=null;u.color=null;u.icon=null;D.destroy();D=null;S.destroy();S=null;am.destroy();am=null;u.commitCallback=null;u.cancelCallback=null;u.liveCallback=null;O.html("");for(i=0;i<b.length;i++){if(b[i].id==u.id){b.splice(i,1);}}}});var o=u.settings.images,ab=u.settings.window,G=u.settings.color;O=ab.expandable?d("#"+R+"_jPicker_Container"):u;if(ab.expandable){O.css({left:ab.position.x=="left"?"-535px":ab.position.x=="center"?"-268px":ab.position.x=="right"?"0px":ab.position.x=="screenCenter"?((d(document).width()>>1)-268)-d("#"+R+"_jPicker_Picker").offset().left+"px":ab.position.x,position:"absolute",top:ab.position.y=="top"?"-320px":ab.position.y=="center"?"-148px":ab.position.y=="bottom"?"25px":ab.position.y});}if((typeof(G.active)).toString().toLowerCase()=="string"){G.active=new e({hex:G.active.substring(1)});}if((typeof(G.current)).toString().toLowerCase()=="string"){G.current=new e({hex:G.current.substring(1)});}O.html('<table class="jPicker_table"><tbody>'+(ab.expandable?'<tr><td id="'+u.id+'_jPicker_MoveBar" class="jPicker_MoveBar" colspan=6></td></tr>':"")+'<tr><td rowspan="9"><div id="'+u.id+'_jPicker_ColorMap" class="jPicker_ColorMap"><span id="'+u.id+'_jPicker_ColorMap_l1" class="jPicker_ColorMap_l1"> </span><span id="'+u.id+'_jPicker_ColorMap_l2" class="jPicker_ColorMap_l2"> </span><img id="'+u.id+'_jPicker_ColorMap_Arrow" src="'+o.clientPath+o.colorMap.arrow.file+'" class="jPicker_ColorMap_Arrow"/></div></td><td rowspan="9"><div id="'+u.id+'_jPicker_ColorBar" class="jPicker_ColorBar"><span id="'+u.id+'_jPicker_ColorBar_l1" class="jPicker_ColorBar_l1"> </span><span id="'+u.id+'_jPicker_ColorBar_l2" class="jPicker_ColorBar_l2"> </span><span id="'+u.id+'_jPicker_ColorBar_l3" class="jPicker_ColorBar_l3"> </span><span id="'+u.id+'_jPicker_ColorBar_l4" class="jPicker_ColorBar_l4"> </span><img id="'+u.id+'_jPicker_ColorBar_Arrow" src="'+o.clientPath+o.colorBar.arrow.file+'" class="jPicker_ColorBar_Arrow"/></div></td><td colspan="3" class="jPicker_Preview">new<div><span id="'+u.id+'_jPicker_Active" class="jPicker_Active"> </span><span id="'+u.id+'_jPicker_Current" class="jPicker_Current"> </span></div>current</td><td rowspan="9" class="jPicker_OkCancel"><input type="button" id="'+u.id+'_jPicker_Ok" class="jPicker_Ok" value="OK"/><input type="button" id="'+u.id+'_jPicker_Cancel" class="jPicker_Cancel" value="Cancel"/><hr/><div id="'+u.id+'_jPicker_Grid" class="jPicker_Grid"> </div></td></tr><tr><td><input type="radio" id="'+u.id+'_jPicker_HueRadio" name="'+u.id+'_jPicker_Mode" value="h"/></td><td><label for="'+u.id+'_jPicker_HueRadio">H:</label></td><td><input type="text" class="jPicker_RadioText" id="'+u.id+'_jPicker_Hue" name="'+u.id+'_jPicker_Hue" value="'+G.active.h+'"/> °</td</tr><tr><td><input type="radio" id="'+u.id+'_jPicker_SaturationRadio" name="'+u.id+'_jPicker_Mode" value="s"/></td><td><label for="'+u.id+'_jPicker_SaturationRadio">S:</label></td><td><input type="text" class="jPicker_RadioText" id="'+u.id+'_jPicker_Saturation" name="'+u.id+'_jPicker_Saturation" value="'+G.active.s+'"/> %</td></tr><tr><td><input type="radio" id="'+u.id+'_jPicker_BrightnessRadio" name="'+u.id+'_jPicker_Mode" value="v"/></td><td><label for="'+u.id+'_jPicker_BrightnessRadio">B:</label></td><td><input type="text" class="jPicker_RadioText" id="'+u.id+'_jPicker_Brightness" name="'+u.id+'_jPicker_Brightness" value="'+G.active.v+'"/> %</td></tr><tr><td colspan="3" class="jPicker_Spacer"> </td></tr><tr><td><input type="radio" id="'+u.id+'_jPicker_RedRadio" name="'+u.id+'_jPicker_Mode" value="r"/></td><td><label for="'+u.id+'_jPicker_RedRadio">R:</label></td><td><input type="text" class="jPicker_RadioText" id="'+u.id+'_jPicker_Red" name="'+u.id+'_jPicker_Red" value="'+G.active.r+'"/></td></tr><tr><td><input type="radio" id="'+u.id+'_jPicker_GreenRadio" name="'+u.id+'_jPicker_Mode" value="g"/></td><td><label for="'+u.id+'_jPicker_GreenRadio">G:</label></td><td><input type="text" class="jPicker_RadioText" id="'+u.id+'_jPicker_Green" name="'+u.id+'_jPicker_Green" value="'+G.active.g+'"/></td></tr><tr><td><input type="radio" id="'+u.id+'_jPicker_BlueRadio" name="'+u.id+'_jPicker_Mode" value="b"/></td><td><label for="'+u.id+'_jPicker_BlueRadio">B:</label></td><td><input type="text" class="jPicker_RadioText" id="'+u.id+'_jPicker_Blue" name="'+u.id+'_jPicker_Blue" value="'+G.active.b+'"/></td></tr><tr><td colspan="3" class="jPicker_EnterHex">#:<input type="text" class="jPicker_Hex" id="'+u.id+'_jPicker_Hex" name="'+u.id+'_jPicker_Hex" value="'+G.active.hex+'"/></td></tr></tbody></table>');U=d("#"+u.id+"_jPicker_HueRadio",O);an=d("#"+u.id+"_jPicker_SaturationRadio",O);ac=d("#"+u.id+"_jPicker_BrightnessRadio",O);ad=d("#"+u.id+"_jPicker_RedRadio",O);ae=d("#"+u.id+"_jPicker_GreenRadio",O);F=d("#"+u.id+"_jPicker_BlueRadio",O);al=d("#"+u.id+"_jPicker_ColorMap_l1",O);ak=d("#"+u.id+"_jPicker_ColorMap_l2",O);M=d("#"+u.id+"_jPicker_ColorBar_l1",O);L=d("#"+u.id+"_jPicker_ColorBar_l2",O);K=d("#"+u.id+"_jPicker_ColorBar_l3",O);J=d("#"+u.id+"_jPicker_ColorBar_l4",O);x=d("#"+u.id+"_jPicker_Active",O).css({backgroundColor:"#"+G.active.hex});k=d("#"+u.id+"_jPicker_Current",O).css({backgroundColor:"#"+G.current.hex});ag=d("#"+u.id+"_jPicker_Ok",O);V=d("#"+u.id+"_jPicker_Cancel",O);aa=d("#"+u.id+"_jPicker_Grid",O);u.color=d("#"+u.id+"_jPicker_Color");u.icon=d("#"+u.id+"_jPicker_Icon");am=new a(u.id,l);D=new c(u.id+"_jPicker_ColorMap",{map:{width:o.colorMap.width,height:o.colorMap.height},arrow:{image:o.clientPath+o.colorMap.arrow.file,width:o.colorMap.arrow.width,height:o.colorMap.arrow.height}},y);S=new c(u.id+"_jPicker_ColorBar",{map:{width:o.colorBar.width,height:o.colorBar.height},arrow:{image:o.clientPath+o.colorBar.arrow.file,width:o.colorBar.arrow.width,height:o.colorBar.arrow.height}},ap);if(ab.expandable){m=d("#"+u.id+"_jPicker_Color").css({backgroundColor:"#"+G.current.hex});z=d("#"+u.id+"_jPicker_Icon").css({backgroundImage:"url("+o.clientPath+o.picker.file+")"}).bind("click",Y);if(ab.bindToInput){ab.input.bind("keyup",C).bind("change",C);}}U.add(an).add(ac).add(ad).add(ae).add(F).bind("click",A);k.bind("click",X);V.bind("click",q);ag.bind("click",n);if(ab.expandable){s=d("#"+u.id+"_jPicker_MoveBar",O).bind("mousedown",P);}if(G.quickList&&G.quickList.length>0){aa.html("");for(i=0;i<G.quickList.length;i++){if((typeof(G.quickList[i])).toString().toLowerCase()=="string"){G.quickList[i]=new e({hex:G.quickList[i].substring(1)});}aa.append('<span id="'+u.id+"_jPicker_Grid_"+i+'" class="jPicker_QuickColor"> </span>');d("#"+u.id+"_jPicker_Grid_"+i,O).css({backgroundColor:"#"+G.quickList[i].hex}).bind("click",{i:i},E);}}af(G.mode);am.fields.hex.val(S.hex);am.setValuesFromHex();t();Z();Q();d.isFunction(u.commitCallback)&&u.commitCallback(G.current);if(!ab.expandable){u.show();}b.push(u);});};d.fn.jPicker.defaults={window:{position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true},color:{mode:"h",current:new e({hex:"ffffff"}),active:new e({hex:"ffc000"}),quickList:[new e({h:360,s:33,v:100}),new e({h:360,s:66,v:100}),new e({h:360,s:100,v:100}),new e({h:360,s:100,v:75}),new e({h:360,s:100,v:50}),new e({h:180,s:0,v:100}),new e({h:30,s:33,v:100}),new e({h:30,s:66,v:100}),new e({h:30,s:100,v:100}),new e({h:30,s:100,v:75}),new e({h:30,s:100,v:50}),new e({h:180,s:0,v:90}),new e({h:60,s:33,v:100}),new e({h:60,s:66,v:100}),new e({h:60,s:100,v:100}),new e({h:60,s:100,v:75}),new e({h:60,s:100,v:50}),new e({h:180,s:0,v:80}),new e({h:90,s:33,v:100}),new e({h:90,s:66,v:100}),new e({h:90,s:100,v:100}),new e({h:90,s:100,v:75}),new e({h:90,s:100,v:50}),new e({h:180,s:0,v:70}),new e({h:120,s:33,v:100}),new e({h:120,s:66,v:100}),new e({h:120,s:100,v:100}),new e({h:120,s:100,v:75}),new e({h:120,s:100,v:50}),new e({h:180,s:0,v:60}),new e({h:150,s:33,v:100}),new e({h:150,s:66,v:100}),new e({h:150,s:100,v:100}),new e({h:150,s:100,v:75}),new e({h:150,s:100,v:50}),new e({h:180,s:0,v:50}),new e({h:180,s:33,v:100}),new e({h:180,s:66,v:100}),new e({h:180,s:100,v:100}),new e({h:180,s:100,v:75}),new e({h:180,s:100,v:50}),new e({h:180,s:0,v:40}),new e({h:210,s:33,v:100}),new e({h:210,s:66,v:100}),new e({h:210,s:100,v:100}),new e({h:210,s:100,v:75}),new e({h:210,s:100,v:50}),new e({h:180,s:0,v:30}),new e({h:240,s:33,v:100}),new e({h:240,s:66,v:100}),new e({h:240,s:100,v:100}),new e({h:240,s:100,v:75}),new e({h:240,s:100,v:50}),new e({h:180,s:0,v:20}),new e({h:270,s:33,v:100}),new e({h:270,s:66,v:100}),new e({h:270,s:100,v:100}),new e({h:270,s:100,v:75}),new e({h:270,s:100,v:50}),new e({h:180,s:0,v:10}),new e({h:300,s:33,v:100}),new e({h:300,s:66,v:100}),new e({h:300,s:100,v:100}),new e({h:300,s:100,v:75}),new e({h:300,s:100,v:50}),new e({h:180,s:0,v:0}),new e({h:330,s:33,v:100}),new e({h:330,s:66,v:100}),new e({h:330,s:100,v:100}),new e({h:330,s:100,v:75}),new e({h:330,s:100,v:50})]},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}}};})(jQuery); |