From 717f5969285dce24bb3cae8671f141a779df74f6 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 18 Jan 2011 18:54:50 +0000 Subject: [PATCH] Fixed gradient picker by updating minified file git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1933 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/jgraduate/jquery.jgraduate.js | 4 +-- editor/jgraduate/jquery.jgraduate.min.js | 38 +++++++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/editor/jgraduate/jquery.jgraduate.js b/editor/jgraduate/jquery.jgraduate.js index 066a8309..d4baa693 100644 --- a/editor/jgraduate/jquery.jgraduate.js +++ b/editor/jgraduate/jquery.jgraduate.js @@ -690,7 +690,7 @@ jQuery.fn.jGraduate = stopMakerSVG = mkElem('svg', { width: '100%', - height: 45, + height: 45 }, stopMakerDiv[0]); var trans_pattern = mkElem('pattern', { @@ -1012,7 +1012,7 @@ jQuery.fn.jGraduate = elem: handle, input: $(data.input), parent: parent, - offset: parent.offset(), + offset: parent.offset() }; $win.mousemove(dragSlider).mouseup(stopSlider); evt.preventDefault(); diff --git a/editor/jgraduate/jquery.jgraduate.min.js b/editor/jgraduate/jquery.jgraduate.min.js index c149d2df..84144eec 100644 --- a/editor/jgraduate/jquery.jgraduate.min.js +++ b/editor/jgraduate/jquery.jgraduate.min.js @@ -1 +1,37 @@ -;var ns={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console){window.console=new function(){this.log=function(a){};this.dir=function(a){}}}$.jGraduate={Paint:function(b){var a=b||{};this.alpha=a.alpha||100;if(a.copy){this.type=a.copy.type;this.alpha=a.copy.alpha;switch(this.type){case"none":this.solidColor=null;this.linearGradient=null;break;case"solidColor":this.solidColor=a.copy.solidColor;this.linearGradient=null;break;case"linearGradient":this.solidColor=null;this.linearGradient=a.copy.linearGradient.cloneNode(true);break}}else{if(a.linearGradient){this.type="linearGradient";this.solidColor=null;this.linearGradient=a.linearGradient.cloneNode(true)}else{if(a.solidColor){this.type="solidColor";this.solidColor=a.solidColor}else{this.type="none";this.solidColor=null;this.linearGradient=null}}}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint(),window:{pickerTitle:"Drag markers to pick a paint",},images:{clientPath:"images/",},};jQuery.fn.jGraduate=function(b){var a=arguments;return this.each(function(){var l=$(this),m=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),H=l.attr("id"),e="#"+l.attr("id")+" ";if(!e){alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");return}var c=function(){$.isFunction(l.okCallback)&&l.okCallback(l.paint);l.hide()},i=function(){$.isFunction(l.cancelCallback)&&l.cancelCallback();l.hide()};$.extend(true,l,{paint:new $.jGraduate.Paint({copy:m.paint}),okCallback:$.isFunction(a[1])&&a[1]||null,cancelCallback:$.isFunction(a[2])&&a[2]||null,});var F=l.position(),B=null;if(l.paint.type=="none"){l.paint=$.jGraduate.Paint({solidColor:"ffffff"})}l.addClass("jGraduate_Picker");l.html('
');var K=$(e+"> .jGraduate_colPick");var s=$(e+"> .jGraduate_lgPick");s.html('

'+m.window.pickerTitle+'

%
');var N=256,E=0,D=0,j=15/2,w=N-2*E,u=N-2*D;var G=document.getElementById(H+"_jGraduate_GradContainer");var g=G.appendChild(document.createElementNS(ns.svg,"svg"));g.id=H+"_jgraduate_svg";g.setAttribute("width",N);g.setAttribute("height",N);g.setAttribute("xmlns",ns.svg);if(l.paint.type=="linearGradient"){l.paint.linearGradient.id=H+"_jgraduate_grad";l.paint.linearGradient=g.appendChild(document.importNode(l.paint.linearGradient,true))}else{var v=g.appendChild(document.createElementNS(ns.svg,"linearGradient"));v.id=H+"_jgraduate_grad";v.setAttribute("x1","0.0");v.setAttribute("y1","0.0");v.setAttribute("x2","1.0");v.setAttribute("y2","1.0");var o=v.appendChild(document.createElementNS(ns.svg,"stop"));o.setAttribute("offset","0.0");o.setAttribute("stop-color","#ff0000");var t=v.appendChild(document.createElementNS(ns.svg,"stop"));t.setAttribute("offset","1.0");t.setAttribute("stop-color","#ffff00");l.paint.linearGradient=v}var z=l.paint.alpha;$("#"+H+"_jGraduate_OpacityInput").val(z);var r=parseInt(255*(z/100))-4.5;$("#"+H+"_jGraduate_AlphaArrows").css({"margin-left":r});$("#"+H+"_jgraduate_rect").attr("fill-opacity",z/100);var q=parseFloat(l.paint.linearGradient.getAttribute("x1")||0);var Q=parseFloat(l.paint.linearGradient.getAttribute("y1")||0);var p=parseFloat(l.paint.linearGradient.getAttribute("x2")||1);var P=parseFloat(l.paint.linearGradient.getAttribute("y2")||0);var C=document.createElementNS(ns.svg,"rect");C.id=H+"_jgraduate_rect";C.setAttribute("x",E);C.setAttribute("y",D);C.setAttribute("width",u);C.setAttribute("height",u);C.setAttribute("fill","url(#"+H+"_jgraduate_grad)");C.setAttribute("fill-opacity","1.0");C=g.appendChild(C);var k=document.createElementNS(ns.svg,"image");k.id=H+"_stop1";k.setAttribute("class","stop");k.setAttributeNS(ns.xlink,"href",m.images.clientPath+"mappoint.gif");k.setAttributeNS(ns.xlink,"title","Begin Stop");k.appendChild(document.createElementNS(ns.svg,"title")).appendChild(document.createTextNode("Begin Stop"));k.setAttribute("width",18);k.setAttribute("height",18);k.setAttribute("x",E+w*q-j);k.setAttribute("y",D+u*Q-j);k.setAttribute("cursor","move");k=g.appendChild(k);var M=document.createElementNS(ns.svg,"image");M.id=H+"_stop2";M.setAttribute("class","stop");M.setAttributeNS(ns.xlink,"href",m.images.clientPath+"mappoint.gif");M.setAttributeNS(ns.xlink,"title","End Stop");M.appendChild(document.createElementNS(ns.svg,"title")).appendChild(document.createTextNode("End Stop"));M.setAttribute("width",18);M.setAttribute("height",18);M.setAttribute("x",E+w*p-j);M.setAttribute("y",D+u*P-j);M.setAttribute("cursor","move");M=g.appendChild(M);$("#"+H+"_jGraduate_Ok").bind("click",function(){l.paint.type="linearGradient";l.paint.solidColor=null;c()});$("#"+H+"_jGraduate_Cancel").bind("click",function(R){i()});var q=l.paint.linearGradient.getAttribute("x1");if(!q){q="0.0"}x1Input=$("#"+H+"_jGraduate_x1");x1Input.val(q);x1Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=0}l.paint.linearGradient.setAttribute("x1",this.value);k.setAttribute("x",E+w*this.value-j)});var Q=l.paint.linearGradient.getAttribute("y1");if(!Q){Q="0.0"}y1Input=$("#"+H+"_jGraduate_y1");y1Input.val(Q);y1Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=0}l.paint.linearGradient.setAttribute("y1",this.value);k.setAttribute("y",D+u*this.value-j)});var p=l.paint.linearGradient.getAttribute("x2");if(!p){p="1.0"}x2Input=$("#"+H+"_jGraduate_x2");x2Input.val(p);x2Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=1}l.paint.linearGradient.setAttribute("x2",this.value);M.setAttribute("x",E+w*this.value-j)});var P=l.paint.linearGradient.getAttribute("y2");if(!P){P="0.0"}y2Input=$("#"+H+"_jGraduate_y2");y2Input.val(P);y2Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=0}l.paint.linearGradient.setAttribute("y2",this.value);M.setAttribute("y",D+u*this.value-j)});var A=l.paint.linearGradient.getElementsByTagNameNS(ns.svg,"stop");var I=A.length;if(I<2){while(I<2){l.paint.linearGradient.appendChild(document.createElementNS(ns.svg,"stop"));++I}A=l.paint.linearGradient.getElementsByTagNameNS(ns.svg,"stop")}var n=function(T,V){var U=V.offset();var S=(T.pageX-U.left-parseInt(V.css("border-left-width")));if(S>255){S=255}if(S<0){S=0}var R=S-4.5;S/=255;$("#"+H+"_jGraduate_AlphaArrows").css({"margin-left":R});$("#"+H+"_jgraduate_rect").attr("fill-opacity",S);S=parseInt(S*100);$("#"+H+"_jGraduate_OpacityInput").val(S);l.paint.alpha=S};var O=false;$(".jGraduate_Opacity").mousedown(function(R){n(R,$(this));O=true;R.preventDefault()});$(".jGraduate_Opacity").mousemove(function(R){if(O){n(R,$(this));R.preventDefault()}});$(".jGraduate_Opacity").mouseup(function(R){n(R,$(this));O=false;R.preventDefault()});var L=null;var h=-1,f=-1;$(".stop, #color_picker_jGraduate_GradContainer image").mousedown(function(R){L=this;h=R.clientX;f=R.clientY;R.preventDefault()});$("#"+H+"_jgraduate_svg").mousemove(function(T){if(null!=L){var V=T.clientX-h;var S=T.clientY-f;h+=V;f+=S;var R=parseFloat(L.getAttribute("x"))+V;var X=parseFloat(L.getAttribute("y"))+S;if(RE+w-j){R=E+w-j}if(X>D+u-j){X=D+u-j}L.setAttribute("x",R);L.setAttribute("y",X);var W=(R-E+j)/w;var U=(X-D+j)/u;if(L.id==(H+"_stop1")){x1Input.val(W);y1Input.val(U);l.paint.linearGradient.setAttribute("x1",W);l.paint.linearGradient.setAttribute("y1",U)}else{x2Input.val(W);y2Input.val(U);l.paint.linearGradient.setAttribute("x2",W);l.paint.linearGradient.setAttribute("y2",U)}T.preventDefault()}});$("#"+H+"_jgraduate_svg").mouseup(function(R){L=null});var J=A[0].getAttribute("stop-color");if(!J){J="#000"}beginColorBox=$("#"+H+"_jGraduate_colorBoxBegin");beginColorBox.css({"background-color":J});var x=A[0].getAttribute("stop-opacity");if(!x){x="1.0"}$("#"+H+"jGraduate_beginOpacity").html((x*100)+"%");var d=A[A.length-1].getAttribute("stop-color");if(!d){d="#000"}endColorBox=$("#"+H+"_jGraduate_colorBoxEnd");endColorBox.css({"background-color":d});var y=A[A.length-1].getAttribute("stop-opacity");if(!y){y="1.0"}$("#"+H+"jGraduate_endOpacity").html((y*100)+"%");$("#"+H+"_jGraduate_colorBoxBegin").click(function(){$("div.jGraduate_LightBox").show();var R=$(this);B=new $.jPicker.Color({hex:J.substr(1),a:(parseFloat(x)*100)});$("#"+H+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:m.images.clientPath},color:{active:B,alphaSupport:true}},function(S){J="#"+this.settings.color.active.hex;x=this.settings.color.active.a/100;R.css("background",J);$("#"+H+"_jGraduate_beginOpacity").html(parseInt(x*100)+"%");A[0].setAttribute("stop-color",J);A[0].setAttribute("stop-opacity",x);$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()})});$("#"+H+"_jGraduate_colorBoxEnd").click(function(){$("div.jGraduate_LightBox").show();var R=$(this);B=new $.jPicker.Color({hex:d.substr(1),a:(parseFloat(y)*100)});$("#"+H+"_jGraduate_stopPicker").css({left:100,top:15}).jPicker({window:{title:"Pick the end color and opacity for the gradient"},images:{clientPath:m.images.clientPath},color:{active:B,alphaSupport:true}},function(S){d="#"+this.settings.color.active.hex;y=this.settings.color.active.a/100;R.css("background",d);$("#"+H+"_jGraduate_endOpacity").html(parseInt(y*100)+"%");A[1].setAttribute("stop-color",d);A[1].setAttribute("stop-opacity",y);$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()})});K.jPicker({window:{title:m.window.pickerTitle},images:{clientPath:m.images.clientPath},color:{active:new $.jPicker.Color({hex:l.paint.solidColor,a:l.paint.alpha}),alphaSupport:true}},function(R){l.paint.type="solidColor";l.paint.alpha=R.a;l.paint.solidColor=R.hex;l.paint.linearGradient=null;c()},null,function(){i()});$(e+" .jGraduate_tab_color").click(function(){$(e+" .jGraduate_tab_lingrad").removeClass("jGraduate_tab_current");$(e+" .jGraduate_tab_color").addClass("jGraduate_tab_current");s.hide();K.show()});$(e+" .jGraduate_tab_lingrad").click(function(){$(e+" .jGraduate_tab_color").removeClass("jGraduate_tab_current");$(e+" .jGraduate_tab_lingrad").addClass("jGraduate_tab_current");K.hide();s.show()});if(l.paint.type=="linearGradient"){s.show();K.hide();$(e+" .jGraduate_tab_color").removeClass("jGraduate_tab_current");$(e+" .jGraduate_tab_lingrad").addClass("jGraduate_tab_current")}else{K.show();s.hide();$(e+" .jGraduate_tab_color").addClass("jGraduate_tab_current");$(e+" .jGraduate_tab_lingrad").removeClass("jGraduate_tab_current")}l.show()})}; \ No newline at end of file +(function(){function r(i,z,t){i=document.createElementNS(A.svg,i);if(Ba)for(var B in z)i.setAttribute(B,z[B]);else for(B in z){var W=z[B],w=i[B];if(w&&w.constructor==="SVGLength")w.baseVal.value=W;else i.setAttribute(B,W)}t&&t.appendChild(i);return i}var A={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console)window.console=new function(){this.log=function(){};this.dir=function(){}};$.jGraduate={Paint:function(i){i=i||{};this.alpha=isNaN(i.alpha)?100:i.alpha;if(i.copy){this.type= +i.copy.type;this.alpha=i.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=i.copy.solidColor;break;case "linearGradient":this.linearGradient=i.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=i.copy.radialGradient.cloneNode(true)}}else if(i.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=i.linearGradient.cloneNode(true)}else if(i.radialGradient){this.type= +"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=i.radialGradient.cloneNode(true)}else if(i.solidColor){this.type="solidColor";this.solidColor=i.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var Ba=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(i){var z= +arguments;return this.each(function(){function t(c,a,d,h,f){var l=f||r("stop",{"stop-color":a,"stop-opacity":d,offset:c},g);if(f){a=f.getAttribute("stop-color");d=f.getAttribute("stop-opacity");c=f.getAttribute("offset")}else g.appendChild(l);if(d===null)d=1;f=r("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+c*j)+", 26)"},fa);var X=r("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z", +fill:a,"fill-opacity":d,transform:"translate("+(10+c*j)+", 26)",stroke:"#000","stroke-width":1.5},fa);$(X).mousedown(function(M){B(this);R=F;N.mousemove(la).mouseup(W);S=ga.offset();M.preventDefault();return false}).data("stop",l).data("bg",f).dblclick(function(){$("div.jGraduate_LightBox").show();for(var M=this,I=+l.getAttribute("stop-opacity")||1,C=l.getAttribute("stop-color")||1,Y=(parseFloat(I)*255).toString(16);Y.length<2;)Y="0"+Y;a=C.substr(1)+Y;$("#"+b+"_jGraduate_stopPicker").css({left:100, +bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:o.images.clientPath},color:{active:a,alphaSupport:true}},function(Z){C=Z.val("hex")?"#"+Z.val("hex"):"none";I=Z.val("a")!==null?Z.val("a")/256:1;M.setAttribute("fill",C);M.setAttribute("fill-opacity",I);l.setAttribute("stop-color",C);l.setAttribute("stop-opacity",I);$("div.jGraduate_LightBox").hide();$("#"+b+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide(); +$("#"+b+"_jGraduate_stopPicker").hide()})});$(g).find("stop").each(function(){var M=$(this);if(+this.getAttribute("offset")>c){if(!a){var I=this.getAttribute("stop-color"),C=this.getAttribute("stop-opacity");l.setAttribute("stop-color",I);X.setAttribute("fill",I);l.setAttribute("stop-opacity",C===null?1:C);X.setAttribute("fill-opacity",C===null?1:C)}M.before(l);return false}});h&&B(X);return l}function B(c){F&&F.setAttribute("stroke","#000");c.setAttribute("stroke","blue");F=c;F.parentNode.appendChild(F)} +function W(){N.unbind("mousemove",la);if(O.getAttribute("display")!=="none"){O.setAttribute("display","none");var c=$(F),a=c.data("stop");c=c.data("bg");$([F,a,c]).remove()}R=null}function w(){var c=T?"rotate("+T+","+ha+","+ia+") ":"";J===1&&G===1?g.removeAttribute("gradientTransform"):g.setAttribute("gradientTransform",c+"translate("+-ha*(J-1)+","+-ia*(G-1)+") scale("+J+","+G+")")}function la(c){var a=c.pageX-S.left;c=c.pageY-S.top;a=a<10?10:a>j+10?j+10:a;var d="translate("+a+", 26)";if(c<-60||c> +130){O.setAttribute("display","block");O.setAttribute("transform",d)}else O.setAttribute("display","none");R.setAttribute("transform",d);$.data(R,"bg").setAttribute("transform",d);$.data(R,"stop").setAttribute("offset",(a-10)/j);var h=0;$(g).find("stop").each(function(){var f=this.getAttribute("offset"),l=$(this);if(f
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var Ca=$(s+"> .jGraduate_colPick"), +n=$(s+"> .jGraduate_gradPick");n.html('

    '+o.window.pickerTitle+'


    ');var j=256,oa=j-0,pa=j-0,p,g,aa,q={};$(".jGraduate_SliderBar").width(145);var x=$("#"+b+"_jGraduate_GradContainer")[0],m=r("svg",{id:b+"_jgraduate_svg",width:j,height:j,xmlns:A.svg},x);p=p||e.paint.type;var v=g=e.paint[p],U=e.paint.alpha,ba=p==="solidColor";switch(p){case "solidColor":case "linearGradient":if(!ba){g.id=b+"_lg_jgraduate_grad";v=g=m.appendChild(g)}r("radialGradient", +{id:b+"_rg_jgraduate_grad"},m);if(p==="linearGradient")break;case "radialGradient":if(!ba){g.id=b+"_rg_jgraduate_grad";v=g=m.appendChild(g)}r("linearGradient",{id:b+"_lg_jgraduate_grad"},m)}if(ba){v=g=$("#"+b+"_lg_jgraduate_grad")[0];u=e.paint[p];t(0,"#"+u,1);var K=typeof o.newstop;if(K==="string")switch(o.newstop){case "same":t(1,"#"+u,1);break;case "inverse":K="";for(var y=0;y<6;y+=2){u.substr(y,2);var P=(255-parseInt(u.substr(y,2),16)).toString(16);if(P.length<2)P=0+P;K+=P}t(1,"#"+K,1);break;case "white":t(1, +"#ffffff",1);break;case "black":t(1,"#000000",1)}else if(K==="object")t(1,o.newstop.color||"#"+u,"opac"in o.newstop?o.newstop.opac:1)}u=parseFloat(v.getAttribute("x1")||0);K=parseFloat(v.getAttribute("y1")||0);y=parseFloat(v.getAttribute("x2")||1);P=parseFloat(v.getAttribute("y2")||0);var ca=parseFloat(v.getAttribute("cx")||0.5),da=parseFloat(v.getAttribute("cy")||0.5),qa=parseFloat(v.getAttribute("fx")||ca),ra=parseFloat(v.getAttribute("fy")||da);aa=r("rect",{id:b+"_jgraduate_rect",x:0,y:0,width:oa, +height:pa,fill:"url(#"+b+"_jgraduate_grad)","fill-opacity":U/100},m);var sa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:K*j,left:u*j}).data("coord","start").appendTo(x),Da=sa.clone().text(2).css({top:P*j,left:y*j}).attr("title","End stop").data("coord","end").appendTo(x),ta=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:da*j,left:ca*j}).data("coord","center").appendTo(x),V=ta.clone().text("F").css({top:ra* +j,left:qa*j,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(x);V[0].id=b+"_jGraduate_focusCoord";$(s+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(c,a){var d=g.getAttribute(a),h=isNaN(a[1]);d||(d=h?"0.5":a==="x2"?"1.0":"0.0");q[a]=$("#"+b+"_jGraduate_"+a).val(d).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>1)this.value=1;if(!(a[0]==="f"&&!E))if(h&&p==="radialGradient"||!h&&p==="linearGradient")g.setAttribute(a, +this.value);var f=h?a[0]==="c"?ta:V:a[1]==="1"?sa:Da,l=a.indexOf("x")>=0?"left":"top";f.css(l,this.value*j)}).change()});var D,fa,ga=$("#"+b+"_jGraduate_StopSlider"),F,H,R,O=r("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},H),S,J=1,G=1,T=0,ha=ca,ia=da;H=r("svg",{width:"100%",height:45},ga[0]);x=r("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},H);r("image",{width:16,height:16},x).setAttributeNS(A.xlink, +"xlink:href",o.images.clientPath+"map-opacity.png");$(H).click(function(c){S=ga.offset();if(c.target.tagName!=="path"){var a=c.pageX-S.left-8;a=a<10?10:a>j+10?j+10:a;t(a/j,0,0,true);c.stopPropagation()}});$(H).mouseover(function(){H.appendChild(O)});fa=r("g",{},H);r("line",{x1:10,y1:15,x2:j+10,y2:15,"stroke-width":2,stroke:"#000"},H);var ua=n.find(".jGraduate_spreadMethod").change(function(){g.setAttribute("spreadMethod",$(this).val())}),Q=null,va=function(c){var a=c.pageX-ja.left,d=c.pageY-ja.top; +a=a<0?0:a>j?j:a;d=d<0?0:d>j?j:d;Q.css("left",a).css("top",d);a=a/oa;d=d/pa;var h=Q.data("coord"),f=g;switch(h){case "start":q.x1.val(a);q.y1.val(d);f.setAttribute("x1",a);f.setAttribute("y1",d);break;case "end":q.x2.val(a);q.y2.val(d);f.setAttribute("x2",a);f.setAttribute("y2",d);break;case "center":q.cx.val(a);q.cy.val(d);f.setAttribute("cx",a);f.setAttribute("cy",d);ha=a;ia=d;w();break;case "focus":q.fx.val(a);q.fy.val(d);f.setAttribute("fx",a);f.setAttribute("fy",d);w()}c.preventDefault()},wa= +function(){Q=null;N.unbind("mousemove",va).unbind("mouseup",wa)};D=g.getElementsByTagNameNS(A.svg,"stop");if(k<2){for(;k<2;){g.appendChild(document.createElementNS(A.svg,"stop"));++k}D=g.getElementsByTagNameNS(A.svg,"stop")}var k=D.length;for(y=0;y99.5)h=99.5;if(h>0)G=1-h/100;else J=-(h/100)-1;f=145*((h+100)/2)/100;l&&w();break;case "angle":T=h;f=T/180;f+=0.5;f*=145;l&&w()}if(f>145)f=145;else if(f<0)f=0;d.css({"margin-left":f-5})}).change()});var za=function(c){var a=c.pageX-L.offset.left-parseInt(L.parent.css("border-left-width"));if(a>145)a=145;if(a<=0)a=0;var d=a-5;a/=145;switch(L.type){case "radius":a= +Math.pow(a*2,2.5);if(a>0.98&&a<1.02)a=1;if(a<=0.01)a=0.01;g.setAttribute("r",a);break;case "opacity":e.paint.alpha=parseInt(a*100);aa.setAttribute("fill-opacity",a);break;case "ellip":G=J=1;if(a<0.5){a/=0.5;J=a<=0?0.01:a}else if(a>0.5){a/=0.5;a=2-a;G=a<=0?0.01:a}w();a-=1;if(G===a+1)a=Math.abs(a);break;case "angle":a-=0.5;T=a*=180;w();a/=100}L.elem.css({"margin-left":d});a=Math.round(a*100);L.input.val(a);c.preventDefault()},Aa=function(){N.unbind("mousemove",za).unbind("mouseup",Aa);L=null};for(n= +(e.paint.alpha*255/100).toString(16);n.length<2;)n="0"+n;n=n.split(".")[0];u=e.paint.solidColor=="none"?"":e.paint.solidColor+n;ba||(u=D[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});Ca.jPicker({window:{title:o.window.pickerTitle},images:{clientPath:o.images.clientPath},color:{active:u,alphaSupport:true}},function(c){e.paint.type="solidColor";e.paint.alpha=c.val("ahex")?Math.round(c.val("a")/255*100):100;e.paint.solidColor= +c.val("hex")?c.val("hex"):"none";e.paint.radialGradient=null;ma()},null,function(){na()});var ka=$(s+" .jGraduate_tabs li");ka.click(function(){ka.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(s+" > div").hide();var c=$(this).attr("data-type");$(s+" .jGraduate_gradPick").show();if(c==="rg"||c==="lg"){$(".jGraduate_"+c+"_field").show();$(".jGraduate_"+(c==="lg"?"rg":"lg")+"_field").hide();$("#"+b+"_jgraduate_rect")[0].setAttribute("fill","url(#"+b+"_"+c+"_jgraduate_grad)"); +p=c==="lg"?"linearGradient":"radialGradient";$("#"+b+"_jGraduate_OpacInput").val(e.paint.alpha).change();var a=$("#"+b+"_"+c+"_jgraduate_grad")[0];if(g!==a){var d=$(g).find("stop");$(a).empty().append(d);g=a;a=ua.val();g.setAttribute("spreadMethod",a)}E=c==="rg"&&g.getAttribute("fx")!=null&&!(ca==qa&&da==ra);$("#"+b+"_jGraduate_focusCoord").toggle(E);if(E)$("#"+b+"_jGraduate_match_ctr")[0].checked=false}else{$(s+" .jGraduate_gradPick").hide();$(s+" .jGraduate_colPick").show()}});$(s+" > div").hide(); +ka.removeClass("jGraduate_tab_current");var ea;switch(e.paint.type){case "linearGradient":ea=$(s+" .jGraduate_tab_lingrad");break;case "radialGradient":ea=$(s+" .jGraduate_tab_radgrad");break;default:ea=$(s+" .jGraduate_tab_color")}e.show();setTimeout(function(){ea.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})(); \ No newline at end of file