diff --git a/editor/jgraduate/css/jPicker-1.0.9.css b/editor/jgraduate/css/jPicker-1.0.12.css old mode 100755 new mode 100644 similarity index 70% rename from editor/jgraduate/css/jPicker-1.0.9.css rename to editor/jgraduate/css/jPicker-1.0.12.css index c4af17a4..c943ae16 --- a/editor/jgraduate/css/jPicker-1.0.9.css +++ b/editor/jgraduate/css/jPicker-1.0.12.css @@ -5,7 +5,8 @@ text-align: left; /* make the zero width children position to the left of container */ width: 25px; /* change this value if using a different sized color picker icon */ } -.jPicker_Color { +.jPicker_Color, .jPicker_Alpha { + background-position: 2px 2px; display: block; height: 100%; left: 0px; @@ -33,7 +34,6 @@ border: 1px outset #666; font-family: Arial, Helvetica, Sans-Serif; font-size: 12px; - height: 330px; margin: 0px; padding: 5px; width: 550px; @@ -71,29 +71,6 @@ div[class="jPicker_ColorMap"] { height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ } -.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3, .jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_AlphaBar_l1, .jPicker_AlphaBar_l2 { - background-repeat: no-repeat; - display: block; - height: 100%; - left: 0px; - position: absolute; - top: 0px; - width: 100%; -} -.jPicker_ColorMap_l1 { - background-color: #000000; - background-image: none; -} -.jPicker_ColorMap_l2 { - background-color: transparent; -} -.jPicker_ColorMap_l3 { - background-repeat: repeat; -} -.jPicker_ColorMap_Arrow { - display: block; - position: absolute; -} .jPicker_ColorBar { border: 2px inset #eee; cursor: n-resize; @@ -107,46 +84,42 @@ div[class="jPicker_ColorBar"] { height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ } -.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3 { +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3, .jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_ColorBar_l6 { background-color: transparent; background-image: none; - background-repeat: repeat-x; + display: block; + height: 256px; /* must specific pixel height. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar + would not be drawn if its overflow is set to hidden. */ + left: 0px; + position: absolute; + top: 0px; } -.jPicker_ColorBar_l4 { - background-color: transparent; - background-repeat: repeat-x; +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3 { + width: 256px; /* must specific pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar + would not be drawn if its overflow is set to hidden. */ } -.jPicker_ColorBar_l5 { - background-color: transparent; +.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_ColorBar_l6 { + width: 20px; /* must specific pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar + would not be drawn if its overflow is set to hidden. */ +} +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorBar_l6 { + background-repeat: no-repeat; +} +.jPicker_ColorMap_l3, .jPicker_ColorBar_l5 { background-repeat: repeat; } +.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4 { + background-repeat: repeat-x; +} +.jPicker_ColorMap_Arrow { + display: block; + position: absolute; +} .jPicker_ColorBar_Arrow { display: block; left: -10px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */ position: absolute; } -.jPicker_AlphaBar { - border: 2px inset #eee; - cursor: e-resize; - display: none; - height: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ - margin: 10px 5px 4px 5px; - padding: 0px; - position: relative; - width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ -} -div[class="jPicker_AlphaBar"] { - height: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ - width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ -} -.jPicker_AlphaBar_Arrow { - display: block; - top: -10px; /* (arrow height / 2) - (element height / 2) - position arrows' center in elements' center */ - position: absolute; -} -.jPicker_EnableAlpha { - text-align: left; -} .jPicker_Preview { font-size: x-small; text-align: center; @@ -183,45 +156,36 @@ div[class="jPicker_AlphaBar"] { .jPicker_OkCancel input.jPicker_Ok { margin: 12px 0px 5px 0px; } -.jPicker_Spacer { - height: 10px; +.jPicker_Text { + text-align: left; } .jPicker_HueText, .jPicker_SaturationText, .jPicker_BrightnessText, .jPicker_RedText, .jPicker_GreenText, .jPicker_BlueText, .jPicker_AlphaText { background-color: #fff; border: 1px inset #aaa; margin: 0px 0px 0px 5px; + text-align: left; width: 30px; } -.jPicker_EnterHex { - text-align: right; -} .jPicker_HexText { background-color: #fff; border: 1px inset #aaa; - margin: 0px 19px 0px 5px; - width: 50px; -} -td.jPicker_OpacityCol { - padding-top: 12px; - text-indent: -8px; -} -td.jPicker_OpacityCol * { - display: none; -} -td.jPicker_HexCol { - text-align: left; + margin: 0px 0px 0px 5px; + width: 65px; } .jPicker_Grid { text-align: center; } -.jPicker_QuickColor { +span.jPicker_QuickColor { border: 1px inset #aaa; cursor: pointer; display: block; float: left; - height: 12px; - line-height: 12px; - margin: 2px 3px 1px 3px; + height: 13px; + line-height: 13px; + margin: 2px 2px 1px 2px; padding: 0px; - width: 12px; + width: 15px; +} +span[class="jPicker_QuickColor"] { + width: 13px; } \ No newline at end of file diff --git a/editor/jgraduate/images/AlphaBar.png b/editor/jgraduate/images/AlphaBar.png new file mode 100644 index 00000000..2950daeb Binary files /dev/null and b/editor/jgraduate/images/AlphaBar.png differ diff --git a/editor/jgraduate/images/Bars.png b/editor/jgraduate/images/Bars.png index 4c1608e3..a9801ec1 100644 Binary files a/editor/jgraduate/images/Bars.png and b/editor/jgraduate/images/Bars.png differ diff --git a/editor/jgraduate/images/Maps.png b/editor/jgraduate/images/Maps.png index 498cf3be..de33e3de 100644 Binary files a/editor/jgraduate/images/Maps.png and b/editor/jgraduate/images/Maps.png differ diff --git a/editor/jgraduate/images/NoColor.png b/editor/jgraduate/images/NoColor.png new file mode 100644 index 00000000..ae361455 Binary files /dev/null and b/editor/jgraduate/images/NoColor.png differ diff --git a/editor/jgraduate/jpicker-1.0.12.min.js b/editor/jgraduate/jpicker-1.0.12.min.js new file mode 100644 index 00000000..9b408ad9 --- /dev/null +++ b/editor/jgraduate/jpicker-1.0.12.min.js @@ -0,0 +1 @@ +(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(xA){x=A;}}q=x;},get_Y:function(){return p;},set_Y:function(x){x=Math.floor(x);if(p==x){return;}if(xw){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(C6){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('    ');}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>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(''+(aj.expandable?'':"")+'
 

'+(aj.title||af.text.title)+'

   
      
'+af.text.newColor+'
  
'+af.text.currentColor+'

 
°
%


%
%
');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 ');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 “OK” 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 “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},brightness:{radio:"Set To “Brightness” Color Mode",textbox:"Enter A “Brightness” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)"}}}};})(jQuery,"1.0.12"); \ No newline at end of file diff --git a/editor/jgraduate/jpicker-1.0.9.min.js b/editor/jgraduate/jpicker-1.0.9.min.js deleted file mode 100755 index 2627c1d1..00000000 --- a/editor/jgraduate/jpicker-1.0.9.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e,a){var d=function(n,k){var p=this,o=e("img",n),l=function(q){h(q);e(document).bind("mousemove",m).bind("mouseup",j);q.stopPropagation();q.preventDefault();return false;},m=function(q){h(q);q.stopPropagation();q.preventDefault();return false;},j=function(q){e(document).unbind("mouseup",j).unbind("mousemove",m);q.stopPropagation();q.preventDefault();return false;},h=function(u){var w=n.offset(),q=u.pageX-w.left-parseInt(n.css("border-left-width")),z=u.pageY-w.top-parseInt(n.css("border-top-width")),t=n.w,r=n.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*p.mxX);s=Math.floor(z/r*p.mxY);p.x=v;p.y=s;if(p.mxX==p.mnX){q=0;}if(p.mxY==p.mnY){z=0;}p.setArrowPosition(q,z);e.isFunction(p.valuesChanged)&&p.valuesChanged(p);};e.extend(true,p,{settings:k,x:0,y:0,mnX:0,mxX:0,mnY:100,mxY:100,valuesChanged:e.isFunction(arguments[2])&&arguments[2]||null,setPositioningVariables:function(r){var q=p.settings.map;n.w=q&&q.width||n.width();n.h=q&&q.height||n.height();p.MinX=0;p.MinY=0;p.MaxX=n.w;p.MaxY=n.h;},setArrowPositionFromValues:function(t){p.setPositioningVariables();var w=0,v=0,u=p.mnX,r=p.mxX,s=p.mnY,q=p.mxY,A=p.x,z=p.y;if(u!=r){if(A==u){w=0;}else{if(A==r){w=n.w;}else{if(u<1){r+=Math.abs(u)+1;}if(A<1){A+=1;}w=A/r*n.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=n.h;}else{if(s<1){q+=Math.abs(s)+1;}if(z<1){z+=1;}v=z/q*n.h;if(parseInt(v)==(q-1)){v=q;}else{v=parseInt(v);}if(s<1){v-=Math.abs(s)-1;}}}}p.setArrowPosition(w,v);},setArrowPosition:function(q,v){var u=n.w,s=n.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(){e(document).unbind("mouseup",j).unbind("mousemove",m);n.unbind("mousedown",l);n=null;o=null;p.valuesChanged=null;}});o.src=p.settings.arrow&&p.settings.arrow.image;o.w=p.settings.arrow&&p.settings.arrow.width||o.width();o.h=p.settings.arrow&&p.settings.arrow.height||o.height();p.setPositioningVariables();n.bind("mousedown",l);p.setArrowPositionFromValues();e.isFunction(p.valuesChanged)&&p.valuesChanged(p);},b=function(n){var m=this,y=function(A){if(A.target.value==""){return;}t(A);m.setValuesFromHsv();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},s=function(A){if(A.target.value==""){return;}q(A);m.setValuesFromRgb();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},r=function(A){if(A.target.value==""){return;}l(A);w.a=A.target.value;e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},v=function(A){if(A.target.value==""){m.setValuesFromRgb();}},k=function(A){if(A.target.value==""){m.setValuesFromHsv();}},o=function(A){if(A.target.value==""){u.alpha.val(100);}},z=function(A){if(A.target.value==""){return;}x(A);m.setValuesFromHex();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},j=function(A){if(A.target.value==""){m.setValuesFromHsv();}},q=function(A){if(!p(A)){return A;}u.red.val(h(u.red.val(),0,255));u.green.val(h(u.green.val(),0,255));u.blue.val(h(u.blue.val(),0,255));},l=function(A){if(!p(A)){return A;}u.alpha.val(h(u.alpha.val(),0,100));},t=function(A){if(!p(A)){return A;}u.hue.val(h(u.hue.val(),0,360));u.saturation.val(h(u.saturation.val(),0,100));u.value.val(h(u.value.val(),0,100));},x=function(A){if(!p(A)){return A;}u.hex.val(u.hex.val().replace(/[^a-fA-F0-9]/g,"0").toLowerCase().substring(0,6));},p=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;}C=parseInt(C);if(C>A){return A;}if(C4){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(h){h=h.toLowerCase().replace(/[^a-f0-9]/g,"0");if(h.length>6){h=h.substring(0,6);}return h;},rgbToHex:function(h){return this.intToHex(h.r)+this.intToHex(h.g)+this.intToHex(h.b);},intToHex:function(j){var h=parseInt(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=parseInt(k.s*100);k.v=parseInt(k.v*100);return k;},hsvToRgb:function(n){var r={r:0,g:0,b:0},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=parseInt(u*255/100);}}else{if(m==360){m=0;}m/=60;x=x/100;u=u/100;var l=parseInt(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=parseInt(r.r*255);r.g=parseInt(r.g*255);r.b=parseInt(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.a});y.color.current=new f({hex:w.val(),a:y.color.active.a});}}if(y.window.expandable){w.after('   ');}else{y.window.liveUpdate=false;}var W=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,ax=null,aw=null,av=null,U=null,T=null,S=null,R=null,Q=null,aC=null,V=null,au=null,J=null,I=null,X=null,ac=null,az=null,ak=null,am=null,ao=null,K=null,G=null,aa=null,L=null,ay=null,P=null,O=null,at=null,aq=null,A=null,l=null,M=null,ap=null,ad=null,ai=null,n=null,C=null,u=null,an=function(aE){N.active=ay.color;var aF=N.active,aG=p.clientPath,aD=function(aH){ae(aH,100);aH.css({backgroundColor:"",backgroundPosition:"0px 0px",filter:""});};aD(ax);aD(aw);aD(U);aD(T);aD(S);aD(R);ac.add(az).add(ak).add(am).add(ao).add(K).removeAttr("checked");switch(aE){case"h":ac.attr("checked",true);ax.css({backgroundColor:"#"+aF.hex});aw.css({backgroundColor:"transparent"});x(aw,-256);ae(aw,100);x(R,-256);G.mxX=100;G.mxY=100;aa.mxY=360;break;case"s":az.attr("checked",true);x(ax,-512);x(aw,-768);ae(aw,0);z(S,aF.hex);x(R,-512);G.mxX=360;G.mxY=100;aa.mxY=100;break;case"v":ak.attr("checked",true);z(ax,"000");x(aw,-1024);S.css({backgroundColor:"#"+aF.hex});x(R,-768);G.mxX=360;G.mxY=100;aa.mxY=100;break;case"r":am.attr("checked",true);x(aw,-1536);x(ax,-1280);x(R,-1024);x(S,-1280);x(T,-1536);x(U,-1792);break;case"g":ao.attr("checked",true);x(aw,-2048);x(ax,-1792);x(R,-2048);x(S,-2304);x(T,-2560);x(U,-2816);break;case"b":K.attr("checked",true);x(aw,-2560);x(ax,-2304);x(R,-3072);x(S,-3328);x(T,-3584);x(U,-3840);break;default:throw ("Invalid Mode");break;}switch(aE){case"h":case"s":case"v":G.mnX=1;G.mnY=1;aa.mnY=1;break;case"r":case"g":case"b":G.mnX=0;G.mnY=0;aa.mnY=0;G.mxX=255;G.mxY=255;aa.mxY=255;break;}N.mode=aE;v();ar();ab();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aF.hex});if(aj.bindToInput){aj.input.val(aF.hex).css({backgroundColor:"#"+aF.hex,color:aF.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aF);},m=function(){v();ah();N.active=ay.color;var aD=N.active;if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aD.hex});if(aj.bindToInput){aj.input.val(ay.fields.hex.val()).css({backgroundColor:"#"+aD.hex,color:aD.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aD);},B=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;switch(N.mode){case"h":aD.saturation.val(G.x);aD.value.val(100-G.y);break;case"s":aD.hue.val(G.x);aD.value.val(100-G.y);break;case"v":aD.hue.val(G.x);aD.saturation.val(100-G.y);break;case"r":aD.blue.val(G.x);aD.green.val(255-G.y);break;case"g":aD.blue.val(G.x);aD.red.val(255-G.y);break;case"b":aD.red.val(G.x);aD.green.val(255-G.y);break;}switch(N.mode){case"h":case"s":case"v":ay.setValuesFromHsv();break;case"r":case"g":case"b":ay.setValuesFromRgb();break;}ah();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aE.hex});if(aj.bindToInput){aj.input.val(aE.hex).css({backgroundColor:"#"+aE.hex,color:aE.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},al=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;switch(N.mode){case"h":aD.hue.val(360-aa.y);break;case"s":aD.saturation.val(100-aa.y);break;case"v":aD.value.val(100-aa.y);break;case"r":aD.red.val(255-aa.y);break;case"g":aD.green.val(255-aa.y);break;case"b":aD.blue.val(255-aa.y);break;}switch(N.mode){case"h":case"s":case"v":ay.setValuesFromHsv();break;case"r":case"g":case"b":ay.setValuesFromRgb();break;}ah();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aE.hex});if(aj.bindToInput){aj.input.val(aE.hex).css({backgroundColor:"#"+aE.hex,color:aE.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},s=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;aD.alpha.val(L.x);ay.setAlphaFromValue();ah();e.isFunction(w.liveCallback)&&w.liveCallback(N.active);},v=function(){N.active=ay.color;var aG=0,aF=N.active;switch(w.settings.color.mode){case"h":aG=360-aF.h;break;case"s":aG=100-aF.s;break;case"v":aG=100-aF.v;break;case"r":aG=255-aF.r;break;case"g":aG=255-aF.g;break;case"b":aG=255-aF.b;break;}aa.y=aG;L.x=aF.a;aa.setArrowPositionFromValues();L.setArrowPositionFromValues();var aE=0,aD=0;switch(w.settings.color.mode){case"h":aE=aF.s;aD=100-aF.v;break;case"s":aE=aF.h;aD=100-aF.v;break;case"v":aE=aF.h;aD=100-aF.s;break;case"r":aE=aF.b;aD=256-aF.g;break;case"g":aE=aF.b;aD=256-aF.r;break;case"b":aE=aF.r;aD=256-aF.g;break;}G.x=aE;G.y=aD;G.setArrowPositionFromValues();},ah=function(){aB();ar();ab();aA();},aB=function(){try{A.css({backgroundColor:"#"+ay.color.hex});ae(A,ay.color.a);}catch(aD){}},ar=function(){if(!N||!ay){return;}N.active=ay.color;var aD=N.active;switch(N.mode){case"h":z(ax,new f({h:aD.h,s:100,v:100}).hex);break;case"s":ae(aw,100-aD.s);break;case"v":ae(aw,aD.v);break;case"r":ae(aw,aD.r/256*100);break;case"g":ae(aw,aD.g/256*100);break;case"b":ae(aw,aD.b/256*100);break;}ae(av,100-aD.a);},ab=function(){if(!N||!ay){return;}N.active=ay.color;var aH=N.active,aK=N.mode,aM=ay.fields;switch(aK){case"h":break;case"s":var aI=new f({h:aH.h,s:100,v:aH.v});z(S,aI.hex);break;case"v":var aL=new f({h:aH.h,s:aH.s,v:100});z(S,aL.hex);break;case"r":case"g":case"b":var aJ=0,aN=0;if(aK=="r"){aJ=aM.blue.val();aN=aM.green.val();}else{if(aK=="g"){aJ=aM.blue.val();aN=aM.red.val();}else{if(aK=="b"){aJ=aM.red.val();aN=aM.green.val();}}}var aD=aJ/256*100,aG=aN/256*100,aF=(256-aJ)/256*100,aE=(256-aN)/256*100;ae(R,aG>aF?aF:aG);ae(S,aG>aD?aD:aG);ae(T,aE>aD?aD:aE);ae(U,aE>aF?aF:aE);break;}ae(Q,100-aH.a);},aA=function(){z(J,ay.color.hex);},z=function(aD,aF){try{aD.css({backgroundColor:"#"+aF});}catch(aE){}},t=function(aD,aE){if(aE.indexOf("png")&&this.isLessThanIE7){aD.attr("pngSrc",aE);aD.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aE+"')"});}else{aD.css({backgroundImage:"url("+aE+")"});}},x=function(aD,aE){aD.css({backgroundPosition:"0px "+aE+"px"});},ae=function(aE,aD){if(aD<100){if(this.isLessThanIE7){var aF=aE.attr("pngSrc");if(aF!=null&&aF.indexOf("map-hue")==-1){aE.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aF+"') progid:DXImageTransform.Microsoft.Alpha(opacity="+aD+")"});}}else{aE.css({opacity:aD/100});}}else{if(aD==100){if(this.isLessThanIE7){var aF=aE.attr("pngSrc");if(aF!=null&&aF.indexOf("map-hue")==-1){aE.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aF+"')"});}}else{aE.css({opacity:""});}}}},E=function(){ay.fields.hex.val(N.current.hex);ay.fields.alpha.val(N.current.a);ay.setValuesFromHex();ay.setAlphaFromValue();e.isFunction(ay.valuesChanged)&&ay.valuesChanged(ay);},D=function(aD){an(aD.target.value);},af=function(){E();},r=function(){E();aj.expandable&&w.hide();e.isFunction(w.cancelCallback)&&w.cancelCallback();},Z=function(){var aD=N.active;N.current=new f({hex:aD.hex});N.current.a=aD.a;l.css({backgroundColor:"#"+aD.hex});ae(l,ay.color.a);if(aj.expandable){n.css({backgroundColor:"#"+aD.hex});if(aj.bindToInput){aj.input.val(aD.hex).css({backgroundColor:"#"+aD.hex,color:aD.v>75?"#000000":"#ffffff"});}}e.isFunction(w.commitCallback)&&w.commitCallback(aD);},o=function(){Z();aj.expandable&&w.hide();},ag=function(){w.show();},Y=function(aF){var aD=aj.element,aE=aj.page;P=parseInt(X.css("left"));O=parseInt(X.css("top"));at=aF.pageX;aq=aF.pageY;e(document).bind("mousemove",k).bind("mouseup",q);aF.stopPropagation();aF.preventDefault();return false;},k=function(aD){X.css({left:P-(at-aD.pageX)+"px",top:O-(aq-aD.pageY)+"px"});aD.stopPropagation();aD.preventDefault();return false;},q=function(aD){e(document).unbind("mousemove",k).unbind("mouseup",q);aD.stopPropagation();aD.preventDefault();return false;},F=function(aD){ay.fields.hex.val(w.settings.window.input.val());ay.bindedHexKeyUp(aD);},H=function(aD){ay.fields.hex.val(N.quickList[aD.data.i].hex);ay.fields.alpha.val(N.quickList[aD.data.i].a);ay.setValuesFromHex();ay.setAlphaFromValue();e.isFunction(ay.valuesChanged)&&ay.valuesChanged(ay);};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>1)-259)-w.next().offset().left+"px":aj.position.x,position:"absolute",top:aj.position.y=="top"?"-340px":aj.position.y=="center"?"-153px":aj.position.y=="bottom"?"25px":aj.position.y});}if((typeof(N.active)).toString().toLowerCase()=="string"){N.active=new f({hex:N.active.substring(1)});}if(!N.alphaSupport){N.active.a=100;}X.html(''+(aj.expandable?'':"")+'
 

'+(aj.title||"Drag Markers To Pick A Color")+'

   
     
new
  
current

 
°
%
%
 
  
% 
');ac=e(".jPicker_HueRadio",X);az=e(".jPicker_SaturationRadio",X);ak=e(".jPicker_BrightnessRadio",X);am=e(".jPicker_RedRadio",X);ao=e(".jPicker_GreenRadio",X);K=e(".jPicker_BlueRadio",X);ax=e(".jPicker_ColorMap_l1",X);aw=e(".jPicker_ColorMap_l2",X);av=e(".jPicker_ColorMap_l3",X);U=e(".jPicker_ColorBar_l1",X);T=e(".jPicker_ColorBar_l2",X);S=e(".jPicker_ColorBar_l3",X);R=e(".jPicker_ColorBar_l4",X);Q=e(".jPicker_ColorBar_l5",X);J=e(".jPicker_AlphaBar_l1",X);I=e(".jPicker_AlphaBar_l2",X);aC=e(".jPicker_EnableAlpha",X);V=e(".jPicker_AlphaCheckbox",X);au=e(".jPicker_AlphaBar",X);M=e(".jPicker_NewCurrent",X);A=e(".jPicker_Active",X).css({backgroundColor:"#"+N.active.hex});l=e(".jPicker_Current",X).css({backgroundColor:"#"+N.active.hex});ap=e(".jPicker_Ok",X);ad=e(".jPicker_Cancel",X);ai=e(".jPicker_Grid",X);w.color=e(".Picker_Color");w.icon=e(".jPicker_Icon");ay=new b(X,m);G=new d(e(".jPicker_ColorMap",X),{map:{width:p.colorMap.width,height:p.colorMap.height},arrow:{image:p.clientPath+p.colorMap.arrow.file,width:p.colorMap.arrow.width,height:p.colorMap.arrow.height}},B);aa=new d(e(".jPicker_ColorBar",X),{map:{width:p.colorBar.width,height:p.colorBar.height},arrow:{image:p.clientPath+p.colorBar.arrow.file,width:p.colorBar.arrow.width,height:p.colorBar.arrow.height}},al);L=new d(e(".jPicker_AlphaBar",X),{map:{width:p.alphaBar.width,height:p.alphaBar.height},arrow:{image:p.clientPath+p.alphaBar.arrow.file,width:p.alphaBar.arrow.width,height:p.alphaBar.arrow.height}},s);L.mnX=0;L.mxX=100;t(ax,p.clientPath+"Maps.png");t(aw,p.clientPath+"Maps.png");t(av,p.clientPath+"map-opacity.png");t(U,p.clientPath+"Bars.png");t(T,p.clientPath+"Bars.png");t(S,p.clientPath+"Bars.png");t(R,p.clientPath+"Bars.png");t(Q,p.clientPath+"bar-opacity.png");t(I,p.clientPath+"Maps.png");x(I,-2816);t(M,p.clientPath+"preview-opacity.png");M.css({backgroundPosition:"1px 1px"});if(N.alphaSupport){aC.hide();au.show();e("td.jPicker_OpacityCol *",X).show();}else{V.bind("click",function(){aC.hide();au.show();e("td.jPicker_OpacityCol *",X).show();});}if(aj.expandable){n=e(".jPicker_Color",w.next()).css({backgroundColor:"#"+N.active.hex});C=e(".jPicker_Icon",w.next()).css({backgroundImage:"url("+p.clientPath+p.picker.file+")"}).bind("click",ag);if(aj.bindToInput){aj.input.bind("keyup",F).bind("change",F);}}ac.add(az).add(ak).add(am).add(ao).add(K).bind("click",D);l.bind("click",af);ad.bind("click",r);ap.bind("click",o);if(aj.expandable){u=e(".jPicker_MoveBar",X).bind("mousedown",Y);}if(N.quickList&&N.quickList.length>0){ai.html("");for(i=0;i ');e(".jPicker_QuickColor",X).eq(i).css({backgroundColor:"#"+N.quickList[i].hex}).bind("click",{i:i},H);}}an(N.mode);ay.fields.hex.val(aa.hex);ay.setValuesFromHex();ay.setAlphaFromValue();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:"ffc000"}),alphaSupport:false,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})]},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}},alphaBar:{width:256,height:20,arrow:{file:"rangearrows2.gif",width:9,height:40}},picker:{file:"picker.gif",width:25,height:24}}};})(jQuery,"1.0.9"); \ No newline at end of file diff --git a/editor/jgraduate/jquery.jgraduate.js b/editor/jgraduate/jquery.jgraduate.js index 9e793798..fe3f3c24 100644 --- a/editor/jgraduate/jquery.jgraduate.js +++ b/editor/jgraduate/jquery.jgraduate.js @@ -1,5 +1,5 @@ /* - * jGraduate 0.2.x + * jGraduate 0.3.x * * jQuery Plugin for a gradient picker * @@ -112,11 +112,11 @@ $.jGraduate = { jQuery.fn.jGraduateDefaults = { paint: new $.jGraduate.Paint(), window: { - pickerTitle: "Drag markers to pick a paint" + pickerTitle: "Drag markers to pick a paint", }, images: { - clientPath: "images/" - } + clientPath: "images/", + }, }; jQuery.fn.jGraduate = @@ -147,7 +147,7 @@ jQuery.fn.jGraduate = // make a copy of the incoming paint paint: new $.jGraduate.Paint({copy: $settings.paint}), okCallback: $.isFunction($arguments[1]) && $arguments[1] || null, - cancelCallback: $.isFunction($arguments[2]) && $arguments[2] || null + cancelCallback: $.isFunction($arguments[2]) && $arguments[2] || null, }); var pos = $this.position(), @@ -214,7 +214,6 @@ jQuery.fn.jGraduate = // Set up all the SVG elements (the gradient, stops and rectangle) var MAX = 256, MARGINX = 0, MARGINY = 0, STOP_RADIUS = 15/2, SIZEX = MAX - 2*MARGINX, SIZEY = MAX - 2*MARGINY; -// var container = document.getElementById(id+'_jGraduate_Swatch'); var container = document.getElementById(id+'_jGraduate_GradContainer'); var svg = container.appendChild(document.createElementNS(ns.svg, 'svg')); svg.id = id+'_jgraduate_svg'; @@ -225,7 +224,6 @@ jQuery.fn.jGraduate = // if we are sent a gradient, import it if ($this.paint.type == "linearGradient") { $this.paint.linearGradient.id = id+'_jgraduate_grad'; -// $this.paint.linearGradient = svg.appendChild(document.importNode($this.paint.linearGradient, true)); $this.paint.linearGradient = svg.appendChild($.cloneNode($this.paint.linearGradient)); } else { // we create a gradient @@ -253,10 +251,10 @@ jQuery.fn.jGraduate = $('#' + id + '_jGraduate_AlphaArrows').css({'margin-left':posx}); $('#' + id + '_jgraduate_rect').attr('fill-opacity', gradalpha/100); - var x1 = parseFloat($this.paint.linearGradient.getAttribute('x1')||0.0); - var y1 = parseFloat($this.paint.linearGradient.getAttribute('y1')||0.0); - var x2 = parseFloat($this.paint.linearGradient.getAttribute('x2')||1.0); - var y2 = parseFloat($this.paint.linearGradient.getAttribute('y2')||0.0); + var x1 = parseFloat($this.paint.linearGradient.getAttribute('x1')||0.0), + y1 = parseFloat($this.paint.linearGradient.getAttribute('y1')||0.0), + x2 = parseFloat($this.paint.linearGradient.getAttribute('x2')||1.0), + y2 = parseFloat($this.paint.linearGradient.getAttribute('y2')||0.0); var rect = document.createElementNS(ns.svg, 'rect'); rect.id = id + '_jgraduate_rect'; @@ -475,14 +473,16 @@ jQuery.fn.jGraduate = $('#'+id+'_jGraduate_colorBoxBegin').click(function() { $('div.jGraduate_LightBox').show(); var colorbox = $(this); - color = new $.jPicker.Color({ hex: beginColor.substr(1), a:(parseFloat(beginOpacity)*100) }); + var thisAlpha = (parseFloat(beginOpacity)*255).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = beginColor.substr(1) + thisAlpha; $('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'bottom': 15}).jPicker({ window: { title: "Pick the start color and opacity for the gradient" }, images: { clientPath: $settings.images.clientPath }, color: { active: color, alphaSupport: true } }, function(color){ - beginColor = '#' + this.settings.color.active.hex; - beginOpacity = this.settings.color.active.a/100; + beginColor = color.get_Hex() ? ('#'+color.get_Hex()) : "none"; + beginOpacity = color.get_A() ? color.get_A()/100 : 1; colorbox.css('background', beginColor); $('#'+id+'_jGraduate_beginOpacity').html(parseInt(beginOpacity*100)+'%'); stops[0].setAttribute('stop-color', beginColor); @@ -497,14 +497,16 @@ jQuery.fn.jGraduate = $('#'+id+'_jGraduate_colorBoxEnd').click(function() { $('div.jGraduate_LightBox').show(); var colorbox = $(this); - color = new $.jPicker.Color({ hex: endColor.substr(1), a:(parseFloat(endOpacity)*100) }); + var thisAlpha = (parseFloat(endOpacity)*255).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = endColor.substr(1) + thisAlpha; $('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'top': 15}).jPicker({ window: { title: "Pick the end color and opacity for the gradient" }, images: { clientPath: $settings.images.clientPath }, color: { active: color, alphaSupport: true } }, function(color){ - endColor = '#' + this.settings.color.active.hex; - endOpacity = this.settings.color.active.a/100; + endColor = color.get_Hex() ? ('#'+color.get_Hex()) : "none"; + endOpacity = color.get_A() ? color.get_A()/100 : 1; colorbox.css('background', endColor); $('#'+id+'_jGraduate_endOpacity').html(parseInt(endOpacity*100)+'%'); stops[1].setAttribute('stop-color', endColor); @@ -518,16 +520,19 @@ jQuery.fn.jGraduate = }); // -------------- + var thisAlpha = ($this.paint.alpha*255/100).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = $this.paint.solidColor == "none" ? "" : $this.paint.solidColor + thisAlpha; colPicker.jPicker( { window: { title: $settings.window.pickerTitle }, images: { clientPath: $settings.images.clientPath }, - color: { active: new $.jPicker.Color({hex:$this.paint.solidColor, a:$this.paint.alpha}), alphaSupport: true } + color: { active: color, alphaSupport: true } }, function(color) { $this.paint.type = "solidColor"; - $this.paint.alpha = color.a; - $this.paint.solidColor = color.hex; + $this.paint.alpha = color.get_A() ? color.get_A() : 100; + $this.paint.solidColor = color.get_Hex() ? color.get_Hex() : "none"; $this.paint.linearGradient = null; okClicked(); }, diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 22aa05bc..55561805 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -5,7 +5,7 @@ - + @@ -32,7 +32,7 @@ script type="text/javascript" src="locale/locale.min.js"> - + diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 6a84f794..8414ada4 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -361,6 +361,30 @@ function svg_edit_setup() { }); } }; + + var getPaint = function(color, opac) { + // update the editor's fill paint + var opts = null; + if (color.substr(0,5) == "url(#") { + opts = { + alpha: opac, + linearGradient: document.getElementById(color.substr(5,color.length-6)) + }; + } + else if (color.substr(0,1) == "#") { + opts = { + alpha: opac, + solidColor: color.substr(1) + }; + } + else { + opts = { + alpha: opac, + solidColor: 'none' + }; + } + return new $.jGraduate.Paint(opts); + }; // updates the toolbar (colors, opacity, etc) based on the selected element var updateToolbar = function() { @@ -394,24 +418,6 @@ function svg_edit_setup() { fillOpacity *= 100; strokeOpacity *= 100; - var getPaint = function(color, opac) { - // update the editor's fill paint - var opts = null; - if (color.substr(0,5) == "url(#") { - opts = { - alpha: opac, - linearGradient: document.getElementById(color.substr(5,color.length-6)) - }; - } - else if (color.substr(0,1) == "#") { - opts = { - alpha: opac, - solidColor: color.substr(1) - }; - } - return new $.jGraduate.Paint(opts); - } - fillPaint = getPaint(fillColor, fillOpacity); strokePaint = getPaint(strokeColor, strokeOpacity); @@ -1667,11 +1673,12 @@ function svg_edit_setup() { var paint = (picker == 'stroke' ? strokePaint : fillPaint); var title = (picker == 'stroke' ? 'Pick a Stroke Paint and Opacity' : 'Pick a Fill Paint and Opacity'); var was_none = false; - if (paint.type == "none") { - // if it was none, then set to solid white - paint = new $.jGraduate.Paint({solidColor: 'ffffff'}); - was_none = true; - } +// if (paint.type == "none") { +// // if it was none, then set to solid white +// paint = new $.jGraduate.Paint({solidColor: 'ffffff'}); +// was_none = true; +// } + console.dir(paint); var pos = elem.position(); $("#color_picker") .draggable({cancel:'.jPicker_table,.jGraduate_lgPick'}) @@ -1697,15 +1704,17 @@ function svg_edit_setup() { rectbox.setAttribute("fill", "url(#gradbox_" + picker + ")"); } else { - rectbox.setAttribute("fill", "#" + paint.solidColor); + rectbox.setAttribute("fill", paint.solidColor != "none" ? "#" + paint.solidColor : "none"); } opacity.html(paint.alpha + " %"); if (picker == 'stroke') { svgCanvas.setStrokePaint(paint, true); + strokePaint = paint; } else { svgCanvas.setFillPaint(paint, true); + fillPaint = paint; } updateToolbar(); $('#color_picker').hide(); diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 76e616b7..00406fd4 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -5969,7 +5969,7 @@ function BatchCommand(text) { // now set the current paint object cur_properties.stroke_paint = p; if (p.type == "solidColor") { - this.setStrokeColor("#"+p.solidColor); + this.setStrokeColor(p.solidColor != "none" ? "#"+p.solidColor : "none"); } else if(p.type == "linearGradient") { canvas.strokeGrad = p.linearGradient; @@ -5988,7 +5988,7 @@ function BatchCommand(text) { // now set the current paint object cur_properties.fill_paint = p; if (p.type == "solidColor") { - this.setFillColor("#"+p.solidColor); + this.setFillColor(p.solidColor != "none" ? "#"+p.solidColor : "none"); } else if(p.type == "linearGradient") { canvas.fillGrad = p.linearGradient;