755 lines
382 KiB
JavaScript
755 lines
382 KiB
JavaScript
(function(){if(!("SVGPathSeg"in window)){window.SVGPathSeg=function(a,n,e){this.pathSegType=a;this.pathSegTypeAsLetter=n;this._owningPathSegList=e};SVGPathSeg.PATHSEG_UNKNOWN=0;SVGPathSeg.PATHSEG_CLOSEPATH=1;SVGPathSeg.PATHSEG_MOVETO_ABS=2;SVGPathSeg.PATHSEG_MOVETO_REL=3;SVGPathSeg.PATHSEG_LINETO_ABS=4;SVGPathSeg.PATHSEG_LINETO_REL=5;SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6;SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9;SVGPathSeg.PATHSEG_ARC_ABS=
|
|
10;SVGPathSeg.PATHSEG_ARC_REL=11;SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12;SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13;SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14;SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15;SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16;SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)};
|
|
window.SVGPathSegClosePath=function(a){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CLOSEPATH,"z",a)};SVGPathSegClosePath.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"};SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter};SVGPathSegClosePath.prototype.clone=function(){return new SVGPathSegClosePath(undefined)};window.SVGPathSegMovetoAbs=function(a,n,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_ABS,
|
|
"M",a);this._x=n;this._y=e};SVGPathSegMovetoAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"};SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegMovetoAbs.prototype.clone=function(){return new SVGPathSegMovetoAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=
|
|
a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegMovetoRel=function(a,n,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_REL,"m",a);this._x=n;this._y=e};SVGPathSegMovetoRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"};SVGPathSegMovetoRel.prototype._asPathString=
|
|
function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegMovetoRel.prototype.clone=function(){return new SVGPathSegMovetoRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoAbs=
|
|
function(a,n,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_ABS,"L",a);this._x=n;this._y=e};SVGPathSegLinetoAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"};SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegLinetoAbs.prototype.clone=function(){return new SVGPathSegLinetoAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegLinetoAbs.prototype,
|
|
"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoRel=function(a,n,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_REL,"l",a);this._x=n;this._y=e};SVGPathSegLinetoRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"};
|
|
SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegLinetoRel.prototype.clone=function(){return new SVGPathSegLinetoRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},
|
|
enumerable:true});window.SVGPathSegCurvetoCubicAbs=function(a,n,e,c,l,u,b){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",a);this._x=n;this._y=e;this._x1=c;this._y1=l;this._x2=u;this._y2=b};SVGPathSegCurvetoCubicAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"};SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+
|
|
" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicAbs(undefined,this._x,this._y,this._x1,this._y1,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});
|
|
Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,
|
|
"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicRel=function(a,n,e,c,l,u,b){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",a);this._x=n;this._y=e;this._x1=c;this._y1=l;this._x2=u;this._y2=b};SVGPathSegCurvetoCubicRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"};SVGPathSegCurvetoCubicRel.prototype._asPathString=
|
|
function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicRel(undefined,this._x,this._y,this._x1,this._y1,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y},
|
|
set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=
|
|
a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticAbs=function(a,n,e,c,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",a);this._x=n;this._y=e;this._x1=c;this._y1=l};SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticAbs.prototype.toString=
|
|
function(){return"[object SVGPathSegCurvetoQuadraticAbs]"};SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticAbs(undefined,this._x,this._y,this._x1,this._y1)};Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});
|
|
Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});
|
|
window.SVGPathSegCurvetoQuadraticRel=function(a,n,e,c,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",a);this._x=n;this._y=e;this._x1=c;this._y1=l};SVGPathSegCurvetoQuadraticRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"};SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y};
|
|
SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticRel(undefined,this._x,this._y,this._x1,this._y1)};Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,
|
|
"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});window.SVGPathSegArcAbs=function(a,n,e,c,l,u,b,k){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_ABS,"A",a);this._x=n;this._y=e;this._r1=c;this._r2=l;this._angle=u;this._largeArcFlag=b;this._sweepFlag=k};SVGPathSegArcAbs.prototype=
|
|
Object.create(SVGPathSeg.prototype);SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"};SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y};SVGPathSegArcAbs.prototype.clone=function(){return new SVGPathSegArcAbs(undefined,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)};Object.defineProperty(SVGPathSegArcAbs.prototype,
|
|
"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2=
|
|
a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag=
|
|
a;this._segmentChanged()},enumerable:true});window.SVGPathSegArcRel=function(a,n,e,c,l,u,b,k){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_REL,"a",a);this._x=n;this._y=e;this._r1=c;this._r2=l;this._angle=u;this._largeArcFlag=b;this._sweepFlag=k};SVGPathSegArcRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"};SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+
|
|
this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y};SVGPathSegArcRel.prototype.clone=function(){return new SVGPathSegArcRel(undefined,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)};Object.defineProperty(SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"y",{get:function(){return this._y},
|
|
set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=
|
|
a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoHorizontalAbs=function(a,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,
|
|
"H",a);this._x=n};SVGPathSegLinetoHorizontalAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"};SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x};SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new SVGPathSegLinetoHorizontalAbs(undefined,this._x)};Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x},
|
|
set:function(a){this._x=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoHorizontalRel=function(a,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",a);this._x=n};SVGPathSegLinetoHorizontalRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"};SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x};SVGPathSegLinetoHorizontalRel.prototype.clone=
|
|
function(){return new SVGPathSegLinetoHorizontalRel(undefined,this._x)};Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoVerticalAbs=function(a,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",a);this._y=n};SVGPathSegLinetoVerticalAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"};
|
|
SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y};SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new SVGPathSegLinetoVerticalAbs(undefined,this._y)};Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoVerticalRel=function(a,n){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",a);
|
|
this._y=n};SVGPathSegLinetoVerticalRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"};SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y};SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new SVGPathSegLinetoVerticalRel(undefined,this._y)};Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y},
|
|
set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicSmoothAbs=function(a,n,e,c,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",a);this._x=n;this._y=e;this._x2=c;this._y2=l};SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"};SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+
|
|
" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothAbs(undefined,this._x,this._y,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},
|
|
enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicSmoothRel=function(a,n,e,c,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",a);this._x=n;
|
|
this._y=e;this._x2=c;this._y2=l};SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"};SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothRel(undefined,this._x,this._y,
|
|
this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},
|
|
enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticSmoothAbs=function(a,n,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",a);this._x=n;this._y=e};SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"};
|
|
SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype,
|
|
"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticSmoothRel=function(a,n,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",a);this._x=n;this._y=e};SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"};SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString=
|
|
function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=
|
|
a;this._segmentChanged()},enumerable:true});SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new SVGPathSegClosePath(undefined)};SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(a,n){return new SVGPathSegMovetoAbs(undefined,a,n)};SVGPathElement.prototype.createSVGPathSegMovetoRel=function(a,n){return new SVGPathSegMovetoRel(undefined,a,n)};SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(a,n){return new SVGPathSegLinetoAbs(undefined,a,n)};SVGPathElement.prototype.createSVGPathSegLinetoRel=
|
|
function(a,n){return new SVGPathSegLinetoRel(undefined,a,n)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(a,n,e,c,l,u){return new SVGPathSegCurvetoCubicAbs(undefined,a,n,e,c,l,u)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(a,n,e,c,l,u){return new SVGPathSegCurvetoCubicRel(undefined,a,n,e,c,l,u)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(a,n,e,c){return new SVGPathSegCurvetoQuadraticAbs(undefined,a,n,e,c)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=
|
|
function(a,n,e,c){return new SVGPathSegCurvetoQuadraticRel(undefined,a,n,e,c)};SVGPathElement.prototype.createSVGPathSegArcAbs=function(a,n,e,c,l,u,b){return new SVGPathSegArcAbs(undefined,a,n,e,c,l,u,b)};SVGPathElement.prototype.createSVGPathSegArcRel=function(a,n,e,c,l,u,b){return new SVGPathSegArcRel(undefined,a,n,e,c,l,u,b)};SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(a){return new SVGPathSegLinetoHorizontalAbs(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=
|
|
function(a){return new SVGPathSegLinetoHorizontalRel(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(a){return new SVGPathSegLinetoVerticalAbs(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(a){return new SVGPathSegLinetoVerticalRel(undefined,a)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(a,n,e,c){return new SVGPathSegCurvetoCubicSmoothAbs(undefined,a,n,e,c)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=
|
|
function(a,n,e,c){return new SVGPathSegCurvetoCubicSmoothRel(undefined,a,n,e,c)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(a,n){return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined,a,n)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(a,n){return new SVGPathSegCurvetoQuadraticSmoothRel(undefined,a,n)}}if(!("SVGPathSegList"in window)){window.SVGPathSegList=function(a){this._pathElement=a;this._list=this._parsePath(this._pathElement.getAttribute("d"));
|
|
this._mutationObserverConfig={attributes:true,attributeFilter:["d"]};this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this));this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)};Object.defineProperty(SVGPathSegList.prototype,"numberOfItems",{get:function(){this._checkPathSynchronizedToList();return this._list.length},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"pathSegList",{get:function(){if(!this._pathSegList)this._pathSegList=
|
|
new SVGPathSegList(this);return this._pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:true});SVGPathSegList.prototype._checkPathSynchronizedToList=
|
|
function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())};SVGPathSegList.prototype._updateListFromPathMutations=function(a){if(this._pathElement){var n=false;a.forEach(function(e){if(e.attributeName=="d")n=true});if(n)this._list=this._parsePath(this._pathElement.getAttribute("d"))}};SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect();this._pathElement.setAttribute("d",SVGPathSegList._pathSegArrayAsString(this._list));
|
|
this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)};SVGPathSegList.prototype.segmentChanged=function(){this._writeListToPath()};SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList();this._list.forEach(function(a){a._owningPathSegList=null});this._list=[];this._writeListToPath()};SVGPathSegList.prototype.initialize=function(a){this._checkPathSynchronizedToList();this._list=[a];a._owningPathSegList=this;this._writeListToPath();return a};
|
|
SVGPathSegList.prototype._checkValidIndex=function(a){if(isNaN(a)||a<0||a>=this.numberOfItems)throw"INDEX_SIZE_ERR";};SVGPathSegList.prototype.getItem=function(a){this._checkPathSynchronizedToList();this._checkValidIndex(a);return this._list[a]};SVGPathSegList.prototype.insertItemBefore=function(a,n){this._checkPathSynchronizedToList();if(n>this.numberOfItems)n=this.numberOfItems;if(a._owningPathSegList)a=a.clone();this._list.splice(n,0,a);a._owningPathSegList=this;this._writeListToPath();return a};
|
|
SVGPathSegList.prototype.replaceItem=function(a,n){this._checkPathSynchronizedToList();if(a._owningPathSegList)a=a.clone();this._checkValidIndex(n);this._list[n]=a;a._owningPathSegList=this;this._writeListToPath();return a};SVGPathSegList.prototype.removeItem=function(a){this._checkPathSynchronizedToList();this._checkValidIndex(a);var n=this._list[a];this._list.splice(a,1);this._writeListToPath();return n};SVGPathSegList.prototype.appendItem=function(a){this._checkPathSynchronizedToList();if(a._owningPathSegList)a=
|
|
a.clone();this._list.push(a);a._owningPathSegList=this;this._writeListToPath();return a};SVGPathSegList._pathSegArrayAsString=function(a){var n="",e=true;a.forEach(function(c){if(e){e=false;n+=c._asPathString()}else n+=" "+c._asPathString()});return n};SVGPathSegList.prototype._parsePath=function(a){if(!a||a.length==0)return[];var n=this,e=function(){this.pathSegList=[]};e.prototype.appendSegment=function(l){this.pathSegList.push(l)};var c=function(l){this._string=l;this._currentIndex=0;this._endIndex=
|
|
this._string.length;this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN;this._skipOptionalSpaces()};c.prototype._isCurrentSpace=function(){var l=this._string[this._currentIndex];return l<=" "&&(l==" "||l=="\n"||l=="\t"||l=="\r"||l=="\u000c")};c.prototype._skipOptionalSpaces=function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex++;return this._currentIndex<this._endIndex};c.prototype._skipOptionalSpacesOrDelimiter=function(){if(this._currentIndex<this._endIndex&&
|
|
!this._isCurrentSpace()&&this._string.charAt(this._currentIndex)!=",")return false;if(this._skipOptionalSpaces())if(this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)==","){this._currentIndex++;this._skipOptionalSpaces()}return this._currentIndex<this._endIndex};c.prototype.hasMoreData=function(){return this._currentIndex<this._endIndex};c.prototype.peekSegmentType=function(){return this._pathSegTypeFromChar(this._string[this._currentIndex])};c.prototype._pathSegTypeFromChar=
|
|
function(l){switch(l){case "Z":case "z":return SVGPathSeg.PATHSEG_CLOSEPATH;case "M":return SVGPathSeg.PATHSEG_MOVETO_ABS;case "m":return SVGPathSeg.PATHSEG_MOVETO_REL;case "L":return SVGPathSeg.PATHSEG_LINETO_ABS;case "l":return SVGPathSeg.PATHSEG_LINETO_REL;case "C":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;case "c":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;case "Q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;case "q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;case "A":return SVGPathSeg.PATHSEG_ARC_ABS;
|
|
case "a":return SVGPathSeg.PATHSEG_ARC_REL;case "H":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;case "h":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;case "V":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;case "v":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;case "S":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;case "s":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;case "T":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;case "t":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
|
|
default:return SVGPathSeg.PATHSEG_UNKNOWN}};c.prototype._nextCommandHelper=function(l,u){if((l=="+"||l=="-"||l=="."||l>="0"&&l<="9")&&u!=SVGPathSeg.PATHSEG_CLOSEPATH){if(u==SVGPathSeg.PATHSEG_MOVETO_ABS)return SVGPathSeg.PATHSEG_LINETO_ABS;if(u==SVGPathSeg.PATHSEG_MOVETO_REL)return SVGPathSeg.PATHSEG_LINETO_REL;return u}return SVGPathSeg.PATHSEG_UNKNOWN};c.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return true;var l=this.peekSegmentType();return l==SVGPathSeg.PATHSEG_MOVETO_ABS||
|
|
l==SVGPathSeg.PATHSEG_MOVETO_REL};c.prototype._parseNumber=function(){var l=0,u=0,b=1,k=0,d=1,q=1,z=this._currentIndex;this._skipOptionalSpaces();if(this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)=="+")this._currentIndex++;else if(this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)=="-"){this._currentIndex++;d=-1}if(!(this._currentIndex==this._endIndex||(this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")&&this._string.charAt(this._currentIndex)!=
|
|
".")){for(var D=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=D)for(var w=this._currentIndex-1,K=1;w>=D;){u+=K*(this._string.charAt(w--)-"0");K*=10}if(this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)=="."){this._currentIndex++;if(this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>
|
|
"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)k+=(this._string.charAt(this._currentIndex++)-"0")*(b*=0.1)}if(this._currentIndex!=z&&this._currentIndex+1<this._endIndex&&(this._string.charAt(this._currentIndex)=="e"||this._string.charAt(this._currentIndex)=="E")&&this._string.charAt(this._currentIndex+1)!="x"&&this._string.charAt(this._currentIndex+1)!="m"){this._currentIndex++;if(this._string.charAt(this._currentIndex)==
|
|
"+")this._currentIndex++;else if(this._string.charAt(this._currentIndex)=="-"){this._currentIndex++;q=-1}if(this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";){l*=10;l+=this._string.charAt(this._currentIndex)-"0";this._currentIndex++}}u=u+k;u*=d;if(l)u*=Math.pow(10,q*l);if(z!=this._currentIndex){this._skipOptionalSpacesOrDelimiter();
|
|
return u}}};c.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var l=false;l=this._string.charAt(this._currentIndex++);if(l=="0")l=false;else if(l=="1")l=true;else return;this._skipOptionalSpacesOrDelimiter();return l}};c.prototype.parseSegment=function(){var l=this._string[this._currentIndex],u=this._pathSegTypeFromChar(l);if(u==SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==SVGPathSeg.PATHSEG_UNKNOWN)return null;u=this._nextCommandHelper(l,this._previousCommand);
|
|
if(u==SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;this._previousCommand=u;switch(u){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(n,this._parseNumber(),
|
|
this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(n,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(n,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(n,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(n,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:this._skipOptionalSpaces();
|
|
return new SVGPathSegClosePath(n);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:l={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(n,l.x,l.y,l.x1,l.y1,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(n,
|
|
l.x,l.y,l.x1,l.y1,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:l={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(n,l.x,l.y,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:l={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(n,l.x,l.y,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:l={x1:this._parseNumber(),
|
|
y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(n,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(n,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(n,
|
|
this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:l={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(n,l.x,l.y,l.x1,l.y1,l.arcAngle,l.arcLarge,l.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),
|
|
x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(n,l.x,l.y,l.x1,l.y1,l.arcAngle,l.arcLarge,l.arcSweep);default:throw"Unknown path seg type.";}};e=new e;a=new c(a);if(!a.initialCommandIsMoveTo())return[];for(;a.hasMoreData();){c=a.parseSegment();if(!c)return[];e.appendSegment(c)}return e.pathSegList}}})();(function(){function a(n){var e=n.changedTouches,c=e[0],l="";switch(n.type){case "touchstart":l="mousedown";break;case "touchmove":l="mousemove";break;case "touchend":l="mouseup";break;default:return}n=document.createEvent("MouseEvent");n.initMouseEvent(l,true,true,window,1,c.screenX,c.screenY,c.clientX,c.clientY,false,false,false,false,0,null);e.length<2&&c.target.dispatchEvent(n)}document.addEventListener("touchstart",a,true);document.addEventListener("touchmove",a,true);document.addEventListener("touchend",
|
|
a,true);document.addEventListener("touchcancel",a,true)})();(function(a){function n(e){if(typeof e.data==="string"){var c=e.handler,l=e.data.toLowerCase().split(" ");e.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var b=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],k=String.fromCharCode(u.which).toLowerCase(),d="",q={};if(u.altKey&&b!=="alt")d+="alt+";if(u.ctrlKey&&b!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&b!=="meta")d+="meta+";if(u.shiftKey&&b!=="shift")d+="shift+";if(b)q[d+b]=
|
|
true;else{q[d+k]=true;q[d+a.hotkeys.shiftNums[k]]=true;if(d==="shift+")q[a.hotkeys.shiftNums[k]]=true}b=0;for(k=l.length;b<k;b++)if(q[l[b]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",
|
|
106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a){var n={},e;a.svgIcons=function(c,l){function u(la,Y){if(la!=="ajax"){if(U)return;var ca=(L=ga[0].contentDocument)&&L.getElementById("svg_eof");if(!ca&&!(Y&&ca)){S++;if(S<50)setTimeout(u,20);else{k();U=true}return}U=true}K=a(L.firstChild).children();if(l.no_img)setTimeout(function(){H||b()},500);else{ca=ia+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";N=a(new Image).attr({src:ca,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
|
|
function b(la,Y){if(!H){if(l.no_img)la=false;if(la){var ca=a(document.createElement("div"));ca.hide().appendTo("body")}if(Y){var pa=l.fallback_path?l.fallback_path:"";a.each(Y,function(Ua,La){a("#"+Ua);var qa=a(new Image).attr({"class":"svg_icon",src:pa+La,width:D,height:w,alt:"icon"});ja(qa,Ua)})}else for(var oa=K.length,na=0;na<oa;na++){var ma=K[na],Ha=ma.id;if(Ha==="svg_eof")break;a("#"+Ha);ma=ma.getElementsByTagNameNS(q,"svg")[0];var Ia=document.createElementNS(q,"svg");Ia.setAttributeNS(q,"viewBox",
|
|
[0,0,D,w].join(" "));var Ea=ma.getAttribute("width"),Va=ma.getAttribute("height");ma.removeAttribute("width");ma.removeAttribute("height");ma.getAttribute("viewBox")||ma.setAttribute("viewBox",[0,0,Ea,Va].join(" "));Ia.setAttribute("xmlns",q);Ia.setAttribute("width",D);Ia.setAttribute("height",w);Ia.setAttribute("xmlns:xlink",z);Ia.setAttribute("class","svg_icon");T||(ma=ma.cloneNode(true));Ia.appendChild(ma);if(la){T||Ia.cloneNode(true);ca.empty().append(Ia);ma=ia+d(ca.html());ma=a(new Image).attr({"class":"svg_icon",
|
|
src:ma})}else ma=e(a(Ia),na);ja(ma,Ha)}l.placement&&a.each(l.placement,function(Ua,La){n[La]&&a(Ua).each(function(qa){var wa=n[La].clone();if(qa>0&&!la)wa=e(wa,qa,true);ua(a(this),wa,La)})});if(!Y){la&&ca.remove();ga&&ga.remove();N&&N.remove()}l.resize&&a.resizeSvgIcons(l.resize);H=true;l.callback&&l.callback(n)}}function k(){if(c.indexOf(".svgz")!=-1){var la=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(la,l)}else l.fallback&&b(false,l.fallback)}
|
|
function d(la){if(window.btoa)return window.btoa(la);var Y=Array(Math.floor((la.length+2)/3)*4),ca,pa,oa,na,ma,Ha,Ia=0,Ea=0;do{ca=la.charCodeAt(Ia++);pa=la.charCodeAt(Ia++);oa=la.charCodeAt(Ia++);na=ca>>2;ca=(ca&3)<<4|pa>>4;ma=(pa&15)<<2|oa>>6;Ha=oa&63;if(isNaN(pa))ma=Ha=64;else if(isNaN(oa))Ha=64;Y[Ea++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na);Y[Ea++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ca);Y[Ea++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);
|
|
Y[Ea++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ha)}while(Ia<la.length);return Y.join("")}var q="http://www.w3.org/2000/svg",z="http://www.w3.org/1999/xlink",D=l.w?l.w:24,w=l.h?l.h:24,K,L,N,H=false,U=false,S=0,M=navigator.userAgent,T=!!window.opera;M.indexOf("Safari/")>-1&&M.indexOf("Chrome/");var ia="data:image/svg+xml;charset=utf-8;base64,";if(l.svgz){var ga=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{L=ga[0].contentDocument;ga.load(u);
|
|
u(0,true)}catch(Z){k()}}else{var fa=new DOMParser;a.ajax({url:c,dataType:"string",success:function(la){if(la){L=fa.parseFromString(la,"text/xml");a(function(){u("ajax")})}else a(k)},error:function(la){if(window.opera)a(function(){k()});else if(la.responseText){L=fa.parseFromString(la.responseText,"text/xml");L.childNodes.length||a(k);a(function(){u("ajax")})}else a(k)}})}var ua=function(la,Y,ca,pa){T&&Y.css("visibility","hidden");if(l.replace){pa&&Y.attr("id",ca);(ca=la.attr("class"))&&Y.attr("class",
|
|
"svg_icon "+ca);la.replaceWith(Y)}else la.append(Y);T&&setTimeout(function(){Y.removeAttr("style")},1)},ja=function(la,Y){if(l.id_match===undefined||l.id_match!==false)ua(holder,la,Y,true);n[Y]=la};e=function(la,Y){var ca=la.find("defs");if(!ca.length)return la;ca=T?ca.find("*").filter(function(){return!!this.id}):ca.find("[id]");var pa=la[0].getElementsByTagName("*"),oa=pa.length;ca.each(function(na){var ma=this.id;a(L).find("#"+ma);this.id=na="x"+ma+Y+na;ma="url(#"+ma+")";var Ha="url(#"+na+")";
|
|
for(na=0;na<oa;na++){var Ia=pa[na];Ia.getAttribute("fill")===ma&&Ia.setAttribute("fill",Ha);Ia.getAttribute("stroke")===ma&&Ia.setAttribute("stroke",Ha);Ia.getAttribute("filter")===ma&&Ia.setAttribute("filter",Ha)}});return la}};a.getSvgIcon=function(c,l){var u=n[c];if(l&&u)u=e(u,0,true).clone(true);return u};a.resizeSvgIcons=function(c){var l=!a(".svg_icon:first").length;a.each(c,function(u,b){var k=a.isArray(b),d=k?b[0]:b,q=k?b[1]:b;if(l)u=u.replace(/\.svg_icon/g,"svg");a(u).each(function(){this.setAttribute("width",
|
|
d);this.setAttribute("height",q);if(window.opera&&window.widget){this.parentNode.style.width=d+"px";this.parentNode.style.height=q+"px"}})})}})(jQuery);(function(){function a(c,l,u){c=document.createElementNS(n.svg,c);if(e)for(var b in l)c.setAttribute(b,l[b]);else for(b in l){var k=l[b],d=c[b];if(d&&d.constructor==="SVGLength")d.baseVal.value=k;else c.setAttribute(b,k)}u&&u.appendChild(c);return c}var n={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(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type=
|
|
c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type=
|
|
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.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 e=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var l=
|
|
arguments;return this.each(function(){function u(ha,V,da,R,P){var ba=P||a("stop",{"stop-color":V,"stop-opacity":da,offset:ha},fa);if(P){V=P.getAttribute("stop-color");da=P.getAttribute("stop-opacity");ha=P.getAttribute("offset")}else fa.appendChild(ba);if(da===null)da=1;P=a("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+ha*T)+", 26)"},ub);var Ba=
|
|
a("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:V,"fill-opacity":da,transform:"translate("+(10+ha*T)+", 26)",stroke:"#000","stroke-width":1.5},ub);$(Ba).mousedown(function(Pa){b(this);Xa=gb;U.mousemove(q).mouseup(k);sa=nb.offset();Pa.preventDefault();return false}).data("stop",ba).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Pa=this,Ra=+ba.getAttribute("stop-opacity")||
|
|
1,eb=ba.getAttribute("stop-color")||1,Wa=(parseFloat(Ra)*255).toString(16);Wa.length<2;)Wa="0"+Wa;V=eb.substr(1)+Wa;$("#"+w+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:D.images.clientPath},color:{active:V,alphaSupport:true}},function(Da){eb=Da.val("hex")?"#"+Da.val("hex"):"none";Ra=Da.val("a")!==null?Da.val("a")/256:1;Pa.setAttribute("fill",eb);Pa.setAttribute("fill-opacity",Ra);ba.setAttribute("stop-color",
|
|
eb);ba.setAttribute("stop-opacity",Ra);$("div.jGraduate_LightBox").hide();$("#"+w+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+w+"_jGraduate_stopPicker").hide()})});$(fa).find("stop").each(function(){var Pa=$(this);if(+this.getAttribute("offset")>ha){if(!V){var Ra=this.getAttribute("stop-color"),eb=this.getAttribute("stop-opacity");ba.setAttribute("stop-color",Ra);Ba.setAttribute("fill",Ra);ba.setAttribute("stop-opacity",eb===null?1:eb);Ba.setAttribute("fill-opacity",
|
|
eb===null?1:eb)}Pa.before(ba);return false}});R&&b(Ba);return ba}function b(ha){gb&&gb.setAttribute("stroke","#000");ha.setAttribute("stroke","blue");gb=ha;gb.parentNode.appendChild(gb)}function k(){U.unbind("mousemove",q);if(ya.getAttribute("display")!=="none"){ya.setAttribute("display","none");var ha=$(gb),V=ha.data("stop");ha=ha.data("bg");$([gb,V,ha]).remove()}Xa=null}function d(){var ha=xa?"rotate("+xa+","+bb+","+jb+") ":"";Fa===1&&Qa===1?fa.removeAttribute("gradientTransform"):fa.setAttribute("gradientTransform",
|
|
ha+"translate("+-bb*(Fa-1)+","+-jb*(Qa-1)+") scale("+Fa+","+Qa+")")}function q(ha){var V=ha.pageX-sa.left;ha=ha.pageY-sa.top;V=V<10?10:V>T+10?T+10:V;var da="translate("+V+", 26)";if(ha<-60||ha>130){ya.setAttribute("display","block");ya.setAttribute("transform",da)}else ya.setAttribute("display","none");Xa.setAttribute("transform",da);$.data(Xa,"bg").setAttribute("transform",da);$.data(Xa,"stop").setAttribute("offset",(V-10)/T);var R=0;$(fa).find("stop").each(function(){var P=this.getAttribute("offset"),
|
|
ba=$(this);if(P<R){ba.prev().before(ba);va=$(fa).find("stop")}R=P})}var z=$(this),D=$.extend(true,{},jQuery.fn.jGraduateDefaults,c),w=z.attr("id"),K="#"+z.attr("id")+" ";if(K){var L=function(){switch(z.paint.type){case "radialGradient":z.paint.linearGradient=null;break;case "linearGradient":z.paint.radialGradient=null;break;case "solidColor":z.paint.radialGradient=z.paint.linearGradient=null}$.isFunction(z.okCallback)&&z.okCallback(z.paint);z.hide()},N=function(){$.isFunction(z.cancelCallback)&&z.cancelCallback();
|
|
z.hide()};$.extend(true,z,{paint:new $.jGraduate.Paint({copy:D.paint}),okCallback:$.isFunction(l[1])&&l[1]||null,cancelCallback:$.isFunction(l[2])&&l[2]||null});z.position();var H=null,U=$(window);if(z.paint.type=="none")z.paint=$.jGraduate.Paint({solidColor:"ffffff"});z.addClass("jGraduate_Picker");z.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+
|
|
w+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var S=$(K+"> .jGraduate_colPick"),M=$(K+"> .jGraduate_gradPick");M.html('<div id="'+w+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+D.window.pickerTitle+'</h2><div id="'+w+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+w+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+
|
|
w+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+w+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+w+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
|
|
w+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+w+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+w+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+
|
|
w+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+w+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+w+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+
|
|
w+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+w+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+D.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+w+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+w+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
|
|
w+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+D.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+w+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+w+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+w+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+D.images.clientPath+
|
|
'rangearrows2.gif"></div><label><input type="text" id="'+w+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+w+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+w+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+D.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+w+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
|
|
w+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+w+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var T=256,ia=T-0,ga=T-0,Z,fa,ua,ja={};$(".jGraduate_SliderBar").width(145);var la=$("#"+w+"_jGraduate_GradContainer")[0],Y=a("svg",{id:w+"_jgraduate_svg",width:T,height:T,xmlns:n.svg},la);Z=Z||z.paint.type;var ca=fa=z.paint[Z],pa=z.paint.alpha,oa=Z==="solidColor";switch(Z){case "solidColor":case "linearGradient":if(!oa){fa.id=w+"_lg_jgraduate_grad";
|
|
ca=fa=Y.appendChild(fa)}a("radialGradient",{id:w+"_rg_jgraduate_grad"},Y);if(Z==="linearGradient")break;case "radialGradient":if(!oa){fa.id=w+"_rg_jgraduate_grad";ca=fa=Y.appendChild(fa)}a("linearGradient",{id:w+"_lg_jgraduate_grad",x1:0,y1:0,x2:1,y2:0},Y)}if(oa){ca=fa=$("#"+w+"_lg_jgraduate_grad")[0];H=z.paint[Z];u(0,"#"+H,1);var na=typeof D.newstop;if(na==="string")switch(D.newstop){case "same":u(1,"#"+H,1);break;case "inverse":na="";if(H.length===3)H=H.split("").map(function(ha){return ha+""+ha}).join("");
|
|
for(var ma=0;ma<6;ma+=2){H.substr(ma,2);var Ha=(255-parseInt(H.substr(ma,2),16)).toString(16);if(Ha.length<2)Ha=0+Ha;na+=Ha}u(1,"#"+na,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(na==="object")u(1,D.newstop.color||"#"+H,"opac"in D.newstop?D.newstop.opac:1)}H=parseFloat(ca.getAttribute("x1")||0);na=parseFloat(ca.getAttribute("y1")||0);ma=parseFloat(ca.getAttribute("x2")||1);Ha=parseFloat(ca.getAttribute("y2")||0);var Ia=parseFloat(ca.getAttribute("cx")||0.5),
|
|
Ea=parseFloat(ca.getAttribute("cy")||0.5),Va=parseFloat(ca.getAttribute("fx")||Ia),Ua=parseFloat(ca.getAttribute("fy")||Ea);ua=a("rect",{id:w+"_jgraduate_rect",x:0,y:0,width:ia,height:ga,fill:"url(#"+w+"_jgraduate_grad)","fill-opacity":pa/100},Y);var La=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:na*T,left:H*T}).data("coord","start").appendTo(la),qa=La.clone().text(2).css({top:Ha*T,left:ma*T}).attr("title","End stop").data("coord","end").appendTo(la),
|
|
wa=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ea*T,left:Ia*T}).data("coord","center").appendTo(la),za=wa.clone().text("F").css({top:Ua*T,left:Va*T,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(la);za[0].id=w+"_jGraduate_focusCoord";$(K+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ha,V){var da=fa.getAttribute(V),R=isNaN(V[1]);da||(da=R?"0.5":V==="x2"?"1.0":"0.0");ja[V]=$("#"+w+"_jGraduate_"+
|
|
V).val(da).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>1)this.value=1;if(!(V[0]==="f"&&!cb))if(R&&Z==="radialGradient"||!R&&Z==="linearGradient")fa.setAttribute(V,this.value);var P=R?V[0]==="c"?wa:za:V[1]==="1"?La:qa,ba=V.indexOf("x")>=0?"left":"top";P.css(ba,this.value*T)}).change()});var va,ub,nb=$("#"+w+"_jGraduate_StopSlider"),gb,Sa,Xa,ya=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},
|
|
Sa),sa,Fa=1,Qa=1,xa=0,bb=Ia,jb=Ea;Sa=a("svg",{width:"100%",height:45},nb[0]);la=a("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},la).setAttributeNS(n.xlink,"xlink:href",D.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ha){sa=nb.offset();if(ha.target.tagName!=="path"){var V=ha.pageX-sa.left-8;V=V<10?10:V>T+10?T+10:V;u(V/T,0,0,true);ha.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(ya)});
|
|
ub=a("g",{},Sa);a("line",{x1:10,y1:15,x2:T+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var Ya=M.find(".jGraduate_spreadMethod").change(function(){fa.setAttribute("spreadMethod",$(this).val())}),Ta=null,rb=function(ha){var V=ha.pageX-pb.left,da=ha.pageY-pb.top;V=V<0?0:V>T?T:V;da=da<0?0:da>T?T:da;Ta.css("left",V).css("top",da);V=V/ia;da=da/ga;var R=Ta.data("coord"),P=fa;switch(R){case "start":ja.x1.val(V);ja.y1.val(da);P.setAttribute("x1",V);P.setAttribute("y1",da);break;case "end":ja.x2.val(V);ja.y2.val(da);
|
|
P.setAttribute("x2",V);P.setAttribute("y2",da);break;case "center":ja.cx.val(V);ja.cy.val(da);P.setAttribute("cx",V);P.setAttribute("cy",da);bb=V;jb=da;d();break;case "focus":ja.fx.val(V);ja.fy.val(da);P.setAttribute("fx",V);P.setAttribute("fy",da);d()}ha.preventDefault()},Ja=function(){Ta=null;U.unbind("mousemove",rb).unbind("mouseup",Ja)};va=fa.getElementsByTagNameNS(n.svg,"stop");if(Ka<2){for(;Ka<2;){fa.appendChild(document.createElementNS(n.svg,"stop"));++Ka}va=fa.getElementsByTagNameNS(n.svg,
|
|
"stop")}var Ka=va.length;for(ma=0;ma<Ka;ma++)u(0,0,0,0,va[ma]);Ya.val(fa.getAttribute("spreadMethod")||"pad");var pb,cb=false;ua.setAttribute("fill-opacity",pa/100);$("#"+w+" div.grad_coord").mousedown(function(ha){ha.preventDefault();Ta=$(this);Ta.offset();pb=Ta.parent().offset();U.mousemove(rb).mouseup(Ja)});$("#"+w+"_jGraduate_Ok").bind("click touchstart",function(){z.paint.type=Z;z.paint[Z]=fa.cloneNode(true);z.paint.solidColor=null;L()});$("#"+w+"_jGraduate_Cancel").bind("click touchstart",function(){N()});
|
|
if(Z==="radialGradient")if(cb)za.show();else{za.hide();ja.fx.val("");ja.fy.val("")}$("#"+w+"_jGraduate_match_ctr")[0].checked=!cb;var ob,kb;$("#"+w+"_jGraduate_match_ctr").change(function(){cb=!this.checked;za.toggle(cb);ja.fx.val("");ja.fy.val("");var ha=fa;if(cb){var V=ob||0.5,da=kb||0.5;ha.setAttribute("fx",V);ha.setAttribute("fy",da);ja.fx.val(V);ja.fy.val(da)}else{ob=ha.getAttribute("fx");kb=ha.getAttribute("fy");ha.removeAttribute("fx");ha.removeAttribute("fy")}});va=fa.getElementsByTagNameNS(n.svg,
|
|
"stop");Ka=va.length;if(Ka<2){for(;Ka<2;){fa.appendChild(document.createElementNS(n.svg,"stop"));++Ka}va=fa.getElementsByTagNameNS(n.svg,"stop")}var db;pa=M=0;if(Z==="radialGradient"){Y=fa.gradientTransform.baseVal;if(Y.numberOfItems===2){Ka=Y.getItem(0);Y=Y.getItem(1);if(Ka.type===2&&Y.type===3){Ka=Y.matrix;if(Ka.a!==1)M=Math.round(-(1-Ka.a)*100);else if(Ka.d!==1)M=Math.round((1-Ka.d)*100)}}else if(Y.numberOfItems===3){la=Y.getItem(0);Ka=Y.getItem(1);Y=Y.getItem(2);if(la.type===4&&Ka.type===2&&Y.type===
|
|
3){pa=Math.round(la.angle);Ka=Y.matrix;if(Ka.a!==1)M=Math.round(-(1-Ka.a)*100);else if(Ka.d!==1)M=Math.round((1-Ka.d)*100)}}}M={radius:{handle:"#"+w+"_jGraduate_RadiusArrows",input:"#"+w+"_jGraduate_RadiusInput",val:(fa.getAttribute("r")||0.5)*100},opacity:{handle:"#"+w+"_jGraduate_OpacArrows",input:"#"+w+"_jGraduate_OpacInput",val:z.paint.alpha||100},ellip:{handle:"#"+w+"_jGraduate_EllipArrows",input:"#"+w+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+w+"_jGraduate_AngleArrows",input:"#"+w+"_jGraduate_AngleInput",
|
|
val:pa}};$.each(M,function(ha,V){var da=$(V.handle);da.mousedown(function(R){var P=da.parent();db={type:ha,elem:da,input:$(V.input),parent:P,offset:P.offset()};U.mousemove(Za).mouseup(vb);R.preventDefault()});$(V.input).val(V.val).change(function(){var R=+this.value,P=0,ba=Z==="radialGradient";switch(ha){case "radius":ba&&fa.setAttribute("r",R/100);P=Math.pow(R/100,0.4)/2*145;break;case "opacity":z.paint.alpha=R;ua.setAttribute("fill-opacity",R/100);P=R*1.45;break;case "ellip":Fa=Qa=1;if(R===0){P=
|
|
72.5;break}if(R>99.5)R=99.5;if(R>0)Qa=1-R/100;else Fa=-(R/100)-1;P=145*((R+100)/2)/100;ba&&d();break;case "angle":xa=R;P=xa/180;P+=0.5;P*=145;ba&&d()}if(P>145)P=145;else if(P<0)P=0;da.css({"margin-left":P-5})}).change()});var Za=function(ha){var V=ha.pageX-db.offset.left-parseInt(db.parent.css("border-left-width"));if(V>145)V=145;if(V<=0)V=0;var da=V-5;V/=145;switch(db.type){case "radius":V=Math.pow(V*2,2.5);if(V>0.98&&V<1.02)V=1;if(V<=0.01)V=0.01;fa.setAttribute("r",V);break;case "opacity":z.paint.alpha=
|
|
parseInt(V*100);ua.setAttribute("fill-opacity",V);break;case "ellip":Qa=Fa=1;if(V<0.5){V/=0.5;Fa=V<=0?0.01:V}else if(V>0.5){V/=0.5;V=2-V;Qa=V<=0?0.01:V}d();V-=1;if(Qa===V+1)V=Math.abs(V);break;case "angle":V-=0.5;xa=V*=180;d();V/=100}db.elem.css({"margin-left":da});V=Math.round(V*100);db.input.val(V);ha.preventDefault()},vb=function(){U.unbind("mousemove",Za).unbind("mouseup",vb);db=null};for(M=(z.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];H=z.paint.solidColor=="none"?
|
|
"":z.paint.solidColor+M;oa||(H=va[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});S.jPicker({window:{title:D.window.pickerTitle},images:{clientPath:D.images.clientPath},color:{active:H,alphaSupport:true}},function(ha){z.paint.type="solidColor";z.paint.alpha=ha.val("ahex")?Math.round(ha.val("a")/255*100):100;z.paint.solidColor=ha.val("hex")?ha.val("hex"):"none";z.paint.radialGradient=null;L()},null,function(){N()});var qb=$(K+
|
|
" .jGraduate_tabs li");qb.on("click touchstart",function(){qb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(K+" > div").hide();var ha=$(this).attr("data-type");$(K+" .jGraduate_gradPick").show();if(ha==="rg"||ha==="lg"){$(".jGraduate_"+ha+"_field").show();$(".jGraduate_"+(ha==="lg"?"rg":"lg")+"_field").hide();$("#"+w+"_jgraduate_rect")[0].setAttribute("fill","url(#"+w+"_"+ha+"_jgraduate_grad)");Z=ha==="lg"?"linearGradient":"radialGradient";$("#"+w+"_jGraduate_OpacInput").val(z.paint.alpha).change();
|
|
var V=$("#"+w+"_"+ha+"_jgraduate_grad")[0];if(fa!==V){var da=$(fa).find("stop");$(V).empty().append(da);fa=V;V=Ya.val();fa.setAttribute("spreadMethod",V)}cb=ha==="rg"&&fa.getAttribute("fx")!=null&&!(Ia==Va&&Ea==Ua);$("#"+w+"_jGraduate_focusCoord").toggle(cb);if(cb)$("#"+w+"_jGraduate_match_ctr")[0].checked=false}else{$(K+" .jGraduate_gradPick").hide();$(K+" .jGraduate_colPick").show()}});$(K+" > div").hide();qb.removeClass("jGraduate_tab_current");var lb;switch(z.paint.type){case "linearGradient":lb=
|
|
$(K+" .jGraduate_tab_lingrad");break;case "radialGradient":lb=$(K+" .jGraduate_tab_radgrad");break;default:lb=$(K+" .jGraduate_tab_color")}z.show();setTimeout(function(){lb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),n=$(document);$.extend($.fn,{contextMenu:function(e,c){if(e.menu==undefined)return false;if(e.inSpeed==undefined)e.inSpeed=150;if(e.outSpeed==undefined)e.outSpeed=75;if(e.inSpeed==0)e.inSpeed=-1;if(e.outSpeed==0)e.outSpeed=-1;$(this).each(function(){var l=$(this),u=$(l).offset(),b=$("#"+e.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(q){var z=$(this);z.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||
|
|
e.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||k(q,d,z)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var q=$(this);q.unbind("mouseup");k(d,d,q)});var k=function(d,q,z){if(typeof q=="undefined")q=d;d.stopPropagation();if(l.hasClass("disabled")||q.altKey)return false;var D=d.pageX,w=d.pageY;if(svgedit.browser.isTouch()){D=d.originalEvent.touches[0].pageX;w=d.originalEvent.touches[0].pageY}d=a.width()-b.width();q=a.height()-b.height();if(D>d-15)D=d-15;
|
|
if(w>q-30)w=q-30;if(svgedit.browser.isTouch())w-=b.height()/2;n.unbind("click");b.css({top:w,left:D}).fadeIn(e.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});n.keypress(function(K){switch(K.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");
|
|
break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){n.unbind("click").unbind("keypress");$(".contextMenu").hide();c&&c($(this).attr("href").substr(1),
|
|
$(z),{x:D-u.left,y:w-u.top,docX:D,docY:w});return false});setTimeout(function(){n.click(function(){n.unbind("click").unbind("keypress");b.fadeOut(e.outSpeed);return false})},0)};$(l).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(e){if(e==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(e!=undefined)for(var c=e.split(","),l=0;l<c.length;l++)$(this).find('A[href="'+c[l]+'"]').parent().addClass("disabled")});
|
|
return $(this)},enableContextMenuItems:function(e){if(e==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(e!=undefined)for(var c=e.split(","),l=0;l<c.length;l++)$(this).find('A[href="'+c[l]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},
|
|
destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{};
|
|
(function(){if(!svgedit.browser)svgedit.browser={};var a=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;svgedit.browser.supportsSvg=function(){return a};if(svgedit.browser.supportsSvg()){var n=navigator.userAgent,e=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,l=n.indexOf("AppleWebKit")>=0,u=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,k=n.indexOf("Chrome/")>=0,d=n.indexOf("Windows")>=0,q=n.indexOf("Macintosh")>=
|
|
0,z="ontouchstart"in window,D=!!e.querySelector,w=!!document.evaluate,K=function(){var T=document.createElementNS("http://www.w3.org/2000/svg","svg"),ia=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(T);ia.setAttribute("x",5);T.appendChild(ia);var ga=document.createElementNS("http://www.w3.org/2000/svg","text");ga.textContent="a";ia.appendChild(ga);ia=ga.getStartPositionOfChar(0);ia=ia.x;document.documentElement.removeChild(T);return ia===0}(),L=
|
|
function(){var T=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(T);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 C0,0 10,10 10,0");T.appendChild(ia);ia=ia.getBBox();document.documentElement.removeChild(T);return ia.height>4&&ia.height<5}(),N=function(){var T=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(T);var ia=document.createElementNS("http://www.w3.org/2000/svg",
|
|
"path");ia.setAttribute("d","M0,0 10,0");var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M5,0 15,0");var Z=document.createElementNS("http://www.w3.org/2000/svg","g");Z.appendChild(ia);Z.appendChild(ga);T.appendChild(Z);ia=Z.getBBox();document.documentElement.removeChild(T);return ia.width==15}(),H=function(){var T=document.createElementNS("http://www.w3.org/2000/svg","rect");T.setAttribute("x",0.1);(T=T.cloneNode(false).getAttribute("x").indexOf(",")==-1)||
|
|
$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n Please upgrade to the <a href='http://opera.com'>latest version</a> in which the problems have been fixed.");return T}(),U=function(){var T=document.createElementNS("http://www.w3.org/2000/svg","rect");T.setAttribute("style","vector-effect:non-scaling-stroke");return T.style.vectorEffect==="non-scaling-stroke"}(),S=function(){var T=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ia=e.createSVGTransform();
|
|
T.appendItem(ia);return T.getItem(0)==ia}(),M=function(){if(typeof Blob!="function")return false;var T=new Blob(["<svg xmlns='http://www.w3.org/2000/svg'></svg>"],{type:"image/svg+xml;charset=utf-8"}),ia=new Image;ia.onload=function(){svgedit.browser.supportsBlobs=function(){return true}};ia.onerror=function(){svgedit.browser.supportsBlobs=function(){return false}};ia.src=URL.createObjectURL(T);return false}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return l};
|
|
svgedit.browser.isGecko=function(){return u};svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return k};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return q};svgedit.browser.isTouch=function(){return z};svgedit.browser.supportsSelectors=function(){return D};svgedit.browser.supportsXpath=function(){return w};svgedit.browser.supportsPathBBox=function(){return L};svgedit.browser.supportsHVLineContainerBBox=function(){return N};svgedit.browser.supportsGoodTextCharPos=
|
|
function(){return K};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return H};svgedit.browser.supportsNonScalingStroke=function(){return U};svgedit.browser.supportsNativeTransformLists=function(){return S};svgedit.browser.supportsBlobs=function(){return M}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),n={};svgedit.transformlist.SVGTransformList=function(e){this._elem=e||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var l=0;l<this.numberOfItems;++l){var u=this._list.getItem(l);c=c;u=u;var b=u.matrix,k="";switch(u.type){case 1:k="matrix("+[b.a,b.b,b.c,b.d,b.e,b.f].join(",")+")";break;case 2:k="translate("+b.e+","+b.f+")";break;case 3:k=
|
|
b.a==b.d?"scale("+b.a+")":"scale("+b.a+","+b.d+")";break;case 4:var d=0;k=0;if(u.angle!=0){d=1-b.a;k=(d*b.f+b.b*b.e)/(d*d+b.b*b.b);d=(b.e-b.b*k)/d}k="rotate("+u.angle+" "+d+","+k+")"}c=c+(k+" ")}this._elem.setAttribute("transform",c)};this._list=this;this._init=function(){var c=this._elem.getAttribute("transform");if(c)for(var l=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,u=true;u;){u=c.match(l);c=c.replace(l,"");if(u&&u[1]){var b=u[1].split(/\s*\(/),k=b[0];b=b[1].match(/\s*(.*?)\s*\)/);
|
|
b[1]=b[1].replace(/(\d)-/g,"$1 -");var d=b[1].split(/[, ]+/),q="abcdef".split(""),z=a.createSVGMatrix();$.each(d,function(K,L){d[K]=parseFloat(L);if(k=="matrix")z[q[K]]=d[K]});b=a.createSVGTransform();var D="set"+k.charAt(0).toUpperCase()+k.slice(1),w=k=="matrix"?[z]:d;if(k=="scale"&&w.length==1)w.push(w[0]);else if(k=="translate"&&w.length==1)w.push(0);else if(k=="rotate"&&w.length==1){w.push(0);w.push(0)}b[D].apply(b,w);this._list.appendItem(b)}}};this._removeFromOtherLists=function(c){if(c){var l=
|
|
false,u;for(u in n){for(var b=n[u],k=0,d=b._xforms.length;k<d;++k)if(b._xforms[k]==c){l=true;b.removeItem(k);break}if(l)break}}};this.numberOfItems=0;this.clear=function(){this.numberOfItems=0;this._xforms=[]};this.initialize=function(c){this.numberOfItems=1;this._removeFromOtherLists(c);this._xforms=[c]};this.getItem=function(c){if(c<this.numberOfItems&&c>=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,l){var u=null;if(l>=0)if(l<this.numberOfItems){this._removeFromOtherLists(c);
|
|
u=Array(this.numberOfItems+1);for(var b=0;b<l;++b)u[b]=this._xforms[b];u[b]=c;for(var k=b+1;b<this.numberOfItems;++k,++b)u[k]=this._xforms[b];this.numberOfItems++;this._xforms=u;u=c;this._list._update()}else u=this._list.appendItem(c);return u};this.replaceItem=function(c,l){var u=null;if(l<this.numberOfItems&&l>=0){this._removeFromOtherLists(c);u=this._xforms[l]=c;this._list._update()}return u};this.removeItem=function(c){if(c<this.numberOfItems&&c>=0){for(var l=this._xforms[c],u=Array(this.numberOfItems-
|
|
1),b=0;b<c;++b)u[b]=this._xforms[b];for(c=b;c<this.numberOfItems-1;++c,++b)u[c]=this._xforms[b+1];this.numberOfItems--;this._xforms=u;this._list._update();return l}else throw{code:1};};this.appendItem=function(c){this._removeFromOtherLists(c);this._xforms.push(c);this.numberOfItems++;this._list._update();return c}};svgedit.transformlist.resetListMap=function(){n={}};svgedit.transformlist.removeElementFromListMap=function(e){e.id&&n[e.id]&&delete n[e.id]};svgedit.transformlist.getTransformList=function(e){if(svgedit.browser.supportsNativeTransformLists())if(e.transform)return e.transform.baseVal;
|
|
else if(e.gradientTransform)return e.gradientTransform.baseVal;else{if(e.patternTransform)return e.patternTransform.baseVal}else{var c=e.id;c||(c="temp");var l=n[c];if(!l||c=="temp"){n[c]=new svgedit.transformlist.SVGTransformList(e);n[c]._init();l=n[c]}return l}return null}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.math)svgedit.math={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg");svgedit.math.transformPoint=function(n,e,c){return{x:c.a*n+c.c*e+c.e,y:c.b*n+c.d*e+c.f}};svgedit.math.isIdentity=function(n){return n.a===1&&n.b===0&&n.c===0&&n.d===1&&n.e===0&&n.f===0};svgedit.math.matrixMultiply=function(){for(var n=arguments,e=n.length,c=n[e-1];e-- >1;)c=n[e-1].multiply(c);if(Math.abs(c.a)<1.0E-14)c.a=0;if(Math.abs(c.b)<1.0E-14)c.b=0;if(Math.abs(c.c)<1.0E-14)c.c=0;if(Math.abs(c.d)<
|
|
1.0E-14)c.d=0;if(Math.abs(c.e)<1.0E-14)c.e=0;if(Math.abs(c.f)<1.0E-14)c.f=0;return c};svgedit.math.hasMatrixTransform=function(n){if(!n)return false;for(var e=n.numberOfItems;e--;){var c=n.getItem(e);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(n,e,c,l,u){var b={x:n,y:e},k={x:n+c,y:e};c={x:n+c,y:e+l};n={x:n,y:e+l};e=svgedit.math.transformPoint;b=e(b.x,b.y,u);var d=l=b.x,q=b.y,z=b.y;k=e(k.x,k.y,u);l=Math.min(l,k.x);d=Math.max(d,k.x);
|
|
q=Math.min(q,k.y);z=Math.max(z,k.y);n=e(n.x,n.y,u);l=Math.min(l,n.x);d=Math.max(d,n.x);q=Math.min(q,n.y);z=Math.max(z,n.y);c=e(c.x,c.y,u);l=Math.min(l,c.x);d=Math.max(d,c.x);q=Math.min(q,c.y);z=Math.max(z,c.y);return{tl:b,tr:k,bl:n,br:c,aabox:{x:l,y:q,width:d-l,height:z-q}}};svgedit.math.transformListToTransform=function(n,e,c){if(n==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());e=e==undefined?0:e;c=c==undefined?n.numberOfItems-1:c;e=parseInt(e);c=parseInt(c);if(e>c){var l=c;c=e;
|
|
e=l}l=a.createSVGMatrix();for(e=e;e<=c;++e){var u=e>=0&&e<n.numberOfItems?n.getItem(e).matrix:a.createSVGMatrix();l=svgedit.math.matrixMultiply(l,u)}return a.createSVGTransformFromMatrix(l)};svgedit.math.getMatrix=function(n){n=svgedit.transformlist.getTransformList(n);return svgedit.math.transformListToTransform(n).matrix};svgedit.math.snapToAngle=function(n,e,c,l){var u=Math.PI/4;c=c-n;var b=l-e;l=Math.sqrt(c*c+b*b);u=Math.round(Math.atan2(b,c)/u)*u;return{x:n+l*Math.cos(u),y:e+l*Math.sin(u),a:u}};
|
|
svgedit.math.rectsIntersect=function(n,e){if(!n||!e)return false;return e.x<n.x+n.width&&e.x+e.width>n.x&&e.y<n.y+n.height&&e.y+e.height>n.y}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],n=["y","y1","cy","ry","height"],e=$.merge(["r","radius"],a);$.merge(e,n);var c,l={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var k=document.createElementNS("http://www.w3.org/2000/svg","rect");k.setAttribute("width","1em");k.setAttribute("height","1ex");k.setAttribute("x","1in");b.appendChild(k);k=k.getBBox();document.body.removeChild(b);
|
|
b=k.x;l.em=k.width;l.ex=k.height;l["in"]=b;l.cm=b/2.54;l.mm=b/25.4;l.pt=b/72;l.pc=b/6;l["%"]=0};svgedit.units.getTypeMap=function(){return l};svgedit.units.shortFloat=function(b){var k=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(k);return parseFloat(b).toFixed(k)-0};svgedit.units.convertUnit=function(b,k){k=k||c.getBaseUnit();return svgedit.unit.shortFloat(b/l[k])};svgedit.units.setUnitAttr=function(b,
|
|
k,d){isNaN(d)||b.getAttribute(k);b.setAttribute(k,d)};var u={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var k=b.tagName,d=c.getBaseUnit();if(k=u[k])for(var q=k.length,z=0;z<q;z++){var D=k[z],w=b.getAttribute(D);if(w)isNaN(w)||b.setAttribute(D,w/l[d]+d)}};svgedit.units.convertToNum=
|
|
function(b,k){if(!isNaN(k))return k-0;if(k.substr(-1)==="%"){var d=k.substr(0,k.length-1)/100,q=c.getWidth(),z=c.getHeight();return a.indexOf(b)>=0?d*q:n.indexOf(b)>=0?d*z:d*Math.sqrt(q*q+z*z)/Math.sqrt(2)}else{q=k.substr(-2);d=k.substr(0,k.length-2);return d*l[q]}};svgedit.units.isValidUnit=function(b,k,d){var q=false;if(e.indexOf(b)>=0)if(isNaN(k)){k=k.toLowerCase();$.each(l,function(w){if(!q)if(RegExp("^-?[\\d\\.]+"+w+"$").test(k))q=true})}else q=true;else if(b=="id"){b=false;try{var z=c.getElement(k);
|
|
b=z==null||z===d}catch(D){}return b}else q=true;return q}})();svgedit=svgedit||{};
|
|
(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(k){}var d=$.data(b,"ref"),q=null;if(d){var z=$(d).children().clone().attr("visibility","hidden");$(u).append(z);q=z.filter("line, path")}else q=$(b).find("line, path");var D=false;if(q.length){q.each(function(){var w=this.getBBox();if(!w.width||!w.height)D=true});if(D){b=d?z:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();d&&z.remove();return ret}if(!svgedit.utilities)svgedit.utilities=
|
|
{};var n="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),e=null,c=null,l=null,u=null;svgedit.utilities.init=function(b){e=b;c=b.getDOMDocument();l=b.getDOMContainer();u=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("<p/>").text(b).html()};svgedit.utilities.fromXml=function(b){return $("<p/>").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b);
|
|
var k=Array(Math.floor((b.length+2)/3)*4),d,q,z,D,w,K,L=0,N=0;do{d=b.charCodeAt(L++);q=b.charCodeAt(L++);z=b.charCodeAt(L++);D=d>>2;d=(d&3)<<4|q>>4;w=(q&15)<<2|z>>6;K=z&63;if(isNaN(q))w=K=64;else if(isNaN(z))K=64;k[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(D);k[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);k[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);k[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(K)}while(L<
|
|
b.length);return k.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var k="",d,q,z="",D,w="",K=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));
|
|
d=d<<2|q>>4;q=(q&15)<<4|D>>2;z=(D&3)<<6|w;k+=String.fromCharCode(d);if(D!=64)k+=String.fromCharCode(q);if(w!=64)k+=String.fromCharCode(z)}while(K<b.length);return unescape(k)};svgedit.utilities.dataURItoBlob=function(b,k){var d;d=b.split(",")[0].indexOf("base64")>=0?atob(b.split(",")[1]):unescape(b.split(",")[1]);k=b.split(",")[0].split(":")[1].split(";")[0];for(var q=new Uint8Array(d.length),z=0;z<d.length;z++)q[z]=d.charCodeAt(z);return new Blob([q],{type:k})};svgedit.utilities.convertToXMLReferences=
|
|
function(b){for(var k="",d=0;d<b.length;d++){var q=b.charCodeAt(d);if(q<128)k+=b[d];else if(q>127)k+="&#"+q+";"}return k};svgedit.utilities.text2xml=function(b){if(b.indexOf("<svg:svg")>=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var k;try{var d=window.DOMParser?new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(q){throw Error("XML Parser could not be instantiated");}try{k=d.loadXML?d.loadXML(b)?d:false:d.parseFromString(b,"text/xml")}catch(z){throw Error("Error parsing XML string");
|
|
}return k};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,k){if(b&&b.nodeType==1){k(b);for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),k)}};svgedit.utilities.walkTreePost=function(b,k){if(b&&b.nodeType==1){for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),k);k(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,
|
|
b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){if(b)return b.getAttributeNS("http://www.w3.org/1999/xlink","href")};svgedit.utilities.setHref=function(b,k){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",k)};svgedit.utilities.findDefs=function(b){b=e.getSVGContent().documentElement;var k=b.getElementsByTagNameNS("http://www.w3.org/2000/svg",
|
|
"defs");return k=k.length>0?k[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var k=b.pathSegList,d=k.numberOfItems;b=[[],[]];var q=k.getItem(0),z=[q.x,q.y];for(q=0;q<d;q++){var D=k.getItem(q);if(typeof D.x!="undefined"){b[0].push(z[0]);b[1].push(z[1]);if(D.x1){for(var w=[D.x1,D.y1],K=[D.x2,D.y2],L=[D.x,D.y],N=0;N<2;N++){D=function(T){return Math.pow(1-T,3)*z[N]+3*Math.pow(1-T,2)*T*w[N]+3*(1-
|
|
T)*Math.pow(T,2)*K[N]+Math.pow(T,3)*L[N]};var H=6*z[N]-12*w[N]+6*K[N],U=-3*z[N]+9*w[N]-9*K[N]+3*L[N],S=3*w[N]-3*z[N];if(U==0){if(H!=0){H=-S/H;0<H&&H<1&&b[N].push(D(H))}}else{S=Math.pow(H,2)-4*S*U;if(!(S<0)){var M=(-H+Math.sqrt(S))/(2*U);0<M&&M<1&&b[N].push(D(M));H=(-H-Math.sqrt(S))/(2*U);0<H&&H<1&&b[N].push(D(H))}}}z=L}else{b[0].push(D.x);b[1].push(D.y)}}}k=Math.min.apply(null,b[0]);d=Math.max.apply(null,b[0])-k;q=Math.min.apply(null,b[1]);b=Math.max.apply(null,b[1])-q;return{x:k,y:q,width:d,height:b}};
|
|
svgedit.utilities.getBBox=function(b){var k=b||e.getSelectedElements()[0];if(b.nodeType!=1)return null;b=null;var d=k.nodeName;switch(d){case "text":if(k.textContent===""){k.textContent="a";b=k.getBBox();k.textContent=""}else try{b=k.getBBox()}catch(q){}break;case "path":if(svgedit.browser.supportsPathBBox())try{b=k.getBBox()}catch(z){}else b=svgedit.utilities.getPathBBox(k);break;case "g":case "a":b=a(k);break;default:if(d==="use")b=a(k,true);if(d==="use")b||(b=k.getBBox());else if(~n.indexOf(d))try{b=
|
|
k.getBBox()}catch(D){k=$(k).closest("foreignObject");if(k.length)try{b=k[0].getBBox()}catch(w){b=null}else b=null}}if(b)b=svgedit.utilities.bboxToObj(b);return b};svgedit.utilities.getRotationAngle=function(b,k){var d=b||e.getSelectedElements()[0];d=svgedit.transformlist.getTransformList(d);if(!d)return 0;for(var q=d.numberOfItems,z=0;z<q;++z){var D=d.getItem(z);if(D.type==4)return k?D.angle*Math.PI/180:D.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(b){return u.querySelector("#"+
|
|
b)}:svgedit.browser.supportsXpath()?function(b){return c.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+b+'"]',l,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(b){return $(u).find("[id="+b+"]")[0]};svgedit.utilities.assignAttributes=function(b,k,d,q){for(var z in k)if(d=z.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":z.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)b.setAttributeNS(d,z,k[z]);else q?svgedit.units.setUnitAttr(b,z,k[z]):b.setAttribute(z,
|
|
k[z])};svgedit.utilities.cleanupElement=function(b){var k={"fill-opacity":1,"stop-opacity":1,opacity:1,stroke:"none","stroke-dasharray":"none","stroke-linejoin":"miter","stroke-linecap":"butt","stroke-opacity":1,"stroke-width":1,rx:0,ry:0},d;for(d in k){var q=k[d];b.getAttribute(d)==q&&b.removeAttribute(d)}}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.sanitize)svgedit.sanitize={};var a={};a["http://www.w3.org/1999/xlink"]="xlink";a["http://www.w3.org/XML/1998/namespace"]="xml";a["http://www.w3.org/2000/xmlns/"]="xmlns";a["http://svg-edit.googlecode.com"]="se";a["http://www.w3.org/1999/xhtml"]="xhtml";a["http://www.w3.org/1998/Math/MathML"]="mathml";var n={};$.each(a,function(l,u){n[u]=l});var e={a:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","mask","opacity","stroke","stroke-dasharray",
|
|
"stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","xlink:href","xlink:title"],circle:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","r","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],clipPath:["class",
|
|
"clipPathUnits","id"],defs:[],style:["type"],desc:[],ellipse:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],feGaussianBlur:["class","color-interpolation-filters","id","requiredFeatures","stdDeviation"],filter:["class","color-interpolation-filters",
|
|
"filterRes","filterUnits","height","id","primitiveUnits","requiredFeatures","width","x","xlink:href","y"],foreignObject:["class","font-size","height","id","opacity","requiredFeatures","style","transform","width","x","y"],g:["class","clip-path","clip-rule","id","display","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage",
|
|
"transform","font-family","font-size","font-style","font-weight","text-anchor","data-locked"],image:["class","clip-path","clip-rule","filter","height","id","mask","opacity","requiredFeatures","style","systemLanguage","transform","width","x","xlink:href","xlink:title","y"],line:["shape-rendering","class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset",
|
|
"stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","x1","x2","y1","y2"],linearGradient:["class","id","gradientTransform","gradientUnits","requiredFeatures","spreadMethod","systemLanguage","x1","x2","xlink:href","y1","y2"],marker:["id","class","markerHeight","markerUnits","markerWidth","orient","preserveAspectRatio","refX","refY","systemLanguage","viewBox"],mask:["class","height","id","maskContentUnits","maskUnits","width","x",
|
|
"y"],metadata:["class","id"],path:["class","clip-path","clip-rule","d","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],pattern:["class","height","id","patternContentUnits","patternTransform","patternUnits","requiredFeatures","style","systemLanguage","viewBox",
|
|
"width","x","xlink:href","y"],polygon:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","id","class","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],polyline:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid",
|
|
"marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],radialGradient:["class","cx","cy","fx","fy","gradientTransform","gradientUnits","id","r","requiredFeatures","spreadMethod","systemLanguage","xlink:href"],rect:["shape-rendering","class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask",
|
|
"opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","width","x","y"],stop:["class","id","offset","requiredFeatures","stop-color","stop-opacity","style","systemLanguage"],svg:["class","clip-path","clip-rule","filter","id","height","mask","preserveAspectRatio","requiredFeatures","style","systemLanguage","viewBox","width","x","xmlns","xmlns:se",
|
|
"xmlns:xlink","y"],"switch":["class","id","requiredFeatures","systemLanguage"],symbol:["class","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","opacity","preserveAspectRatio","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","viewBox"],text:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule",
|
|
"filter","font-family","font-size","font-style","font-weight","id","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","transform","x","xml:space","y"],textPath:["class","id","method","requiredFeatures","spacing","startOffset","style","systemLanguage","transform","xlink:href"],title:[],tspan:["class","clip-path","clip-rule","dx","dy","fill",
|
|
"fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","mask","opacity","requiredFeatures","rotate","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","textLength","transform","x","xml:space","y"],use:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","stroke","stroke-dasharray","stroke-dashoffset",
|
|
"stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","transform","width","x","xlink:href","y"],annotation:["encoding"],"annotation-xml":["encoding"],maction:["actiontype","other","selection"],math:["class","id","display","xmlns"],menclose:["notation"],merror:[],mfrac:["linethickness"],mi:["mathvariant"],mmultiscripts:[],mn:[],mo:["fence","lspace","maxsize","minsize","rspace","stretchy"],mover:[],mpadded:["lspace","width","height","depth","voffset"],mphantom:[],
|
|
mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],
|
|
semantics:[]},c={};$.each(e,function(l,u){var b={};$.each(u,function(k,d){if(d.indexOf(":")>=0){var q=d.split(":");b[q[1]]=n[q[0]]}else b[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[l]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(l){if(l.nodeType==3){l.nodeValue=l.nodeValue.replace(/^\s+|\s+$/g,"");l.nodeValue.length||l.parentNode.removeChild(l)}if(l.nodeType==1){var u=l.parentNode;if(l.ownerDocument&&u){var b=e[l.nodeName],k=c[l.nodeName];if(b!=
|
|
undefined){for(var d=[],q=l.attributes.length;q--;){var z=l.attributes.item(q),D=z.nodeName,w=z.localName,K=z.namespaceURI;if(!(k.hasOwnProperty(w)&&K==k[w]&&K!="http://www.w3.org/2000/xmlns/")&&!(K=="http://www.w3.org/2000/xmlns/"&&a[z.nodeValue])){D.indexOf("se:")==0&&d.push([D,z.nodeValue]);l.removeAttributeNS(K,w)}if(svgedit.browser.isGecko())switch(D){case "transform":case "gradientTransform":case "patternTransform":w=z.nodeValue.replace(/(\d)-/g,"$1 -");l.setAttribute(D,w)}if(D=="style"){z=
|
|
z.nodeValue.split(";");for(D=z.length;D--;){w=z[D].split(":");b.indexOf(w[0])>=0&&l.setAttribute(w[0],w[1])}l.removeAttribute("style")}}$.each(d,function(L,N){l.setAttributeNS("http://svg-edit.googlecode.com",N[0],N[1])});if((q=svgedit.utilities.getHref(l))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(l.nodeName)>=0)if(q[0]!="#"){svgedit.utilities.setHref(l,"");l.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(l.nodeName=="use"&&!svgedit.utilities.getHref(l))u.removeChild(l);
|
|
else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(L,N){var H=l.getAttribute(N);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){l.setAttribute(N,"");l.removeAttribute(N)}});for(q=l.childNodes.length;q--;)svgedit.sanitize.sanitizeSvg(l.childNodes.item(q))}}else{for(b=[];l.hasChildNodes();)b.push(u.insertBefore(l.firstChild,l));u.removeChild(l);for(q=b.length;q--;)svgedit.sanitize.sanitizeSvg(b[q])}}}}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,n,e,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;this.oldParent=e;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type=
|
|
svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
|
|
this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,n){this.elem=a;this.text=n||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type=
|
|
svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
|
|
this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,n,e,c){this.elem=a;this.text=c||"Delete "+a.tagName;this.nextSibling=n;this.parent=e;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"};
|
|
svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,
|
|
this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]};
|
|
svgedit.history.ChangeElementCommand=function(a,n,e){this.elem=a;this.text=e?"Change "+a.tagName+" "+e:"Change "+a.tagName;this.newValues={};this.oldValues=n;for(var c in n)this.newValues[c]=c=="#text"?a.textContent:c=="#href"?svgedit.utilities.getHref(a):a.getAttribute(c)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText=
|
|
function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var n=false,e;for(e in this.newValues){if(this.newValues[e])if(e=="#text")this.elem.textContent=this.newValues[e];else e=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[e]):this.elem.setAttribute(e,this.newValues[e]);else if(e=="#text")this.elem.textContent="";else{this.elem.setAttribute(e,"");this.elem.removeAttribute(e)}if(e==
|
|
"transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){e=elem.getBBox();n=["rotate(",n," ",e.x+e.width/2,",",e.y+e.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var n=false,e;for(e in this.oldValues){if(this.oldValues[e])if(e==
|
|
"#text")this.elem.textContent=this.oldValues[e];else e=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[e]):this.elem.setAttribute(e,this.oldValues[e]);else if(e=="#text")this.elem.textContent="";else this.elem.removeAttribute(e);if(e=="transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){e=this.elem.getBBox();n=["rotate(",n," ",e.x+e.width/2,",",e.y+e.height/2,")"].join("");n!=this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",n)}svgedit.transformlist.removeElementFromListMap(this.elem);
|
|
a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply=
|
|
function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var n=this.stack.length,e=0;e<n;++e)this.stack[e].apply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.BatchCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);for(var n=this.stack.length-1;n>=0;n--)this.stack[n].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,
|
|
this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],n=this.stack.length;n--;)for(var e=this.stack[n].elements(),c=e.length;c--;)a.indexOf(e[c])==-1&&a.push(e[c]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer=
|
|
-1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():
|
|
""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer<this.undoStack.length?this.undoStack[this.undoStackPointer].getText():""};svgedit.history.UndoManager.prototype.undo=function(){this.undoStackPointer>0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)};
|
|
svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,n){for(var e=++this.undoChangeStackPointer,c=n.length,l=Array(c),u=Array(c);c--;){var b=n[c];if(b!=null){u[c]=b;l[c]=b.getAttribute(a)}}this.undoableChangeStack[e]=
|
|
{attrName:a,oldValues:l,elements:u}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,n=this.undoableChangeStack[a],e=n.elements.length,c=n.attrName,l=new svgedit.history.BatchCommand("Change "+c);e--;){var u=n.elements[e];if(u!=null){var b={};b[c]=n.oldValues[e];b[c]!=u.getAttribute(c)&&l.addSubCommand(new svgedit.history.ChangeElementCommand(u,b,c))}}this.undoableChangeStack[a]=null;return l}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.select)svgedit.select={};var a,n,e;svgedit.select.Selector=function(c,l){this.id=c;this.selectedElement=l;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity",
|
|
0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var l=[];c=Math.round(c/45);if(c<0)c+=8;for(var u in e.selectorGrips)l.push(u);for(;c>0;){l.push(l.shift());c--}c=0;for(u in e.selectorGrips){e.selectorGrips[u].setAttribute("style",
|
|
"cursor:"+l[c]+"-resize");c++}};svgedit.select.Selector.prototype.showGrips=function(c){e.selectorGripsGroup.setAttribute("display",c?"inline":"none");var l=this.selectedElement;this.hasGrips=c;if(l&&c){this.selectorGroup.appendChild(e.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(l))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,l=e,u=l.selectorGrips,b=this.selectedElement,k=b.getAttribute("stroke-width"),d=a.currentZoom(),q=1/d;if(b.getAttribute("stroke")!==
|
|
"none"&&!isNaN(k))q+=k/2;var z=b.tagName;if(z==="text")q+=2/d;k=svgedit.transformlist.getTransformList(b);k=svgedit.math.transformListToTransform(k).matrix;k.e*=d;k.f*=d;var D=svgedit.utilities.getBBox(b);if(z==="g"&&!$.data(b,"gsvg"))if(z=a.getStrokedBBox(b.childNodes))D=z;z=D.x;var w=D.y,K=D.width;D=D.height;q*=d;d=svgedit.math.transformBox(z*d,w*d,K*d,D*d,k);k=d.aabox;z=k.x-q;w=k.y-q;var L=k.width+q*2;K=k.height+q*2;k=z+L/2;D=w+K/2;if(b=svgedit.utilities.getRotationAngle(b)){z=a.svgRoot().createSVGTransform();
|
|
z.setRotate(-b,k,D);z=z.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,z);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,z);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,z);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,z);z=d.tl;L=z.x;K=z.y;var N=z.x,H=z.y;z=Math.min;w=Math.max;L=z(L,z(d.tr.x,z(d.bl.x,d.br.x)))-q;K=z(K,z(d.tr.y,z(d.bl.y,d.br.y)))-q;N=w(N,w(d.tr.x,w(d.bl.x,d.br.x)))+q;H=w(H,w(d.tr.y,w(d.bl.y,d.br.y)))+q;z=L;w=K;L=N-L;K=H-K}c.setAttribute("d","M"+z+","+w+" L"+(z+L)+","+w+" "+
|
|
(z+L)+","+(w+K)+" "+z+","+(w+K)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,k,D].join(",")+")":"");if(svgedit.browser.isTouch()){z-=15.75;w-=15.75}else{z-=4;w-=4}this.gripCoords={nw:[z,w].map(Math.round),ne:[z+L,w].map(Math.round),sw:[z,w+K].map(Math.round),se:[z+L,w+K].map(Math.round),n:[z+L/2,w].map(Math.round),w:[z,w+K/2].map(Math.round),e:[z+L,w+K/2].map(Math.round),s:[z+L/2,w+K].map(Math.round)};for(var U in this.gripCoords){c=this.gripCoords[U];u[U].setAttribute("x",c[0]);
|
|
u[U].setAttribute("y",c[1])}this.rotateCoords={nw:[z,w],ne:[z+L+8,w],sw:[z,w+K+8],se:[z+L+8,w+K+8]};for(U in this.rotateCoords){c=this.rotateCoords[U];l.rotateGrips[U].setAttribute("cx",c[0]);l.rotateGrips[U].setAttribute("cy",c[1])}};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,
|
|
se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);a.svgRoot().appendChild(this.selectorParentGroup);
|
|
this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var l=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+n.imgPath+"rotate.png) 12 12, auto;"}});$.data(l,"dir",c);$.data(l,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(l)}for(c in this.selectorGrips){l=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+
|
|
c,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+c+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){l.setAttribute("width",30.5);l.setAttribute("height",30.5);l.setAttribute("fill-opacity",0.3)}$.data(l,"dir",c);$.data(l,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(l)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[1],x:0,y:0,
|
|
overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});l=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var u=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),b=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),k=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}),d=a.createSVGElement({element:"rect",
|
|
attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),q=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});c.appendChild(l);l.appendChild(u);u.appendChild(b);u.appendChild(k);u.appendChild(d);c.appendChild(q);a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var l=this.selectors.length;if(typeof this.selectorMap[c.id]==
|
|
"object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var u=0;u<l;++u)if(this.selectors[u]&&!this.selectors[u].locked){this.selectors[u].locked=true;this.selectors[u].reset(c);this.selectorMap[c.id]=this.selectors[u];return this.selectors[u]}this.selectors[l]=new svgedit.select.Selector(l,c);this.selectorParentGroup.appendChild(this.selectors[l].selectorGroup);this.selectorMap[c.id]=this.selectors[l];return this.selectors[l]};svgedit.select.SelectorManager.prototype.releaseSelector=
|
|
function(c){if(c!=null)for(var l=this.selectors.length,u=this.selectorMap[c.id],b=0;b<l;++b)if(this.selectors[b]&&this.selectors[b]==u){u.locked==false&&console.log("WARNING! selector was released but was already unlocked");delete this.selectorMap[c.id];u.locked=false;u.selectedElement=null;u.showGrips(false);try{u.selectorGroup.setAttribute("display","none")}catch(k){}break}};svgedit.select.SelectorManager.prototype.getRubberBandBox=function(){if(!this.rubberBandBox)this.rubberBandBox=this.selectorParentGroup.appendChild(a.createSVGElement({element:"rect",
|
|
attr:{id:"selectorRubberBand",fill:"none",stroke:"#666","stroke-width":1,"stroke-dasharray":"3,2",display:"none",style:"pointer-events:none"}}));return this.rubberBandBox};svgedit.select.init=function(c,l){n=c;a=l;e=new svgedit.select.SelectorManager;a.createSVGElement({element:"g",attr:{id:"hover_group"}})};svgedit.select.getSelectorManager=function(){return e}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.draw)svgedit.draw={};var a="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),n={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},e=n.LET_DOCUMENT_DECIDE;svgedit.draw.Layer=function(c,l){this.name_=c;this.group_=l};svgedit.draw.Layer.prototype.getName=function(){return this.name_};svgedit.draw.Layer.prototype.getGroup=function(){return this.group_};svgedit.draw.randomizeIds=function(c,l){e=c==false?n.NEVER_RANDOMIZE:
|
|
n.ALWAYS_RANDOMIZE;if(e==n.ALWAYS_RANDOMIZE&&!l.getNonce())l.setNonce(Math.floor(Math.random()*100001));else e==n.NEVER_RANDOMIZE&&l.getNonce()&&l.clearNonce()};svgedit.draw.Drawing=function(c,l){if(!c||!c.tagName||!c.namespaceURI||c.tagName!="svg"||c.namespaceURI!="http://www.w3.org/2000/svg")throw"Error: svgedit.draw.Drawing instance initialized without a <svg> element";this.svgElem_=c;this.obj_num=0;this.idPrefix=l||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_=
|
|
"";var u=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(u&&e!=n.NEVER_RANDOMIZE)this.nonce_=u;else e==n.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_};
|
|
svgedit.draw.Drawing.prototype.setNonce=function(c){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",c);this.nonce_=c};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var c=
|
|
this.obj_num,l=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();l=true}else this.obj_num++;for(var u=this.getId();this.getElem_(u);){if(l){this.obj_num=c;l=false}this.obj_num++;u=this.getId()}if(l)this.obj_num=c;return u};svgedit.draw.Drawing.prototype.releaseId=function(c){var l=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(l)!=0)return false;c=parseInt(c.substr(l.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false;
|
|
this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var l=0;l<this.getNumLayers();l++)if(this.all_layers[l][0]==c)return true;return false};svgedit.draw.Drawing.prototype.getLayerName=function(c){if(c>=0&&c<this.getNumLayers())return this.all_layers[c][0];return""};svgedit.draw.Drawing.prototype.getCurrentLayer=function(){return this.current_layer};svgedit.draw.Drawing.prototype.getCurrentLayerName=
|
|
function(){for(var c=0;c<this.getNumLayers();++c)if(this.all_layers[c][1]==this.current_layer)return this.getLayerName(c);return""};svgedit.draw.Drawing.prototype.setCurrentLayer=function(c){for(var l=0;l<this.getNumLayers();++l)if(c==this.getLayerName(l)){if(this.current_layer!=this.all_layers[l][1]){this.current_layer.setAttribute("style","pointer-events:none");this.current_layer=this.all_layers[l][1];this.current_layer.setAttribute("style","pointer-events:all")}return true}return false};svgedit.draw.Drawing.prototype.deleteCurrentLayer=
|
|
function(){if(this.current_layer&&this.getNumLayers()>1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,l=[],u=[],b=null,k=false,d=0;d<c;++d){var q=this.svgElem_.childNodes.item(d);if(q&&q.nodeType==1)if(q.tagName=="g"){k=true;var z=$("title",q).text();if(!z&&svgedit.browser.isOpera()&&q.querySelectorAll)z=$(q.querySelectorAll("title")).text();
|
|
if(z){u.push(z);this.all_layers.push([z,q]);b=q;svgedit.utilities.walkTree(q,function(D){D.setAttribute("style","pointer-events:inherit")});b.setAttribute("style","pointer-events:none")}else l.push(q)}else if(~a.indexOf(q.nodeName)){svgedit.utilities.getBBox(q);l.push(q)}}c=this.svgElem_.ownerDocument;if(l.length>0||!k){for(d=1;u.indexOf("Layer "+d)>=0;)d++;u="Layer "+d;b=c.createElementNS("http://www.w3.org/2000/svg","g");k=c.createElementNS("http://www.w3.org/2000/svg","title");k.textContent=u;
|
|
b.appendChild(k);for(k=0;k<l.length;++k)b.appendChild(l[k]);this.svgElem_.appendChild(b);this.all_layers.push([u,b])}svgedit.utilities.walkTree(b,function(D){D.setAttribute("style","pointer-events:inherit")});this.current_layer=b.getAttribute("data-locked")==="true"?this.all_layers.slice(-2)[0][1]:b;this.current_layer.setAttribute("style","pointer-events:all")};svgedit.draw.Drawing.prototype.createLayer=function(c){var l=this.svgElem_.ownerDocument,u=l.createElementNS("http://www.w3.org/2000/svg",
|
|
"g");l=l.createElementNS("http://www.w3.org/2000/svg","title");l.textContent=c;u.appendChild(l);this.svgElem_.appendChild(u);this.identifyLayers();return u};svgedit.draw.Drawing.prototype.getLayerVisibility=function(c){for(var l=null,u=0;u<this.getNumLayers();++u)if(this.getLayerName(u)==c){l=this.all_layers[u][1];break}if(!l)return false;return l.getAttribute("display")!="none"};svgedit.draw.Drawing.prototype.setLayerVisibility=function(c,l){if(typeof l!="boolean")return null;for(var u=null,b=0;b<
|
|
this.getNumLayers();++b)if(this.getLayerName(b)==c){u=this.all_layers[b][1];break}if(!u)return null;u.getAttribute("display");u.setAttribute("display",l?"inline":"none");return u};svgedit.draw.Drawing.prototype.getLayerOpacity=function(c){for(var l=0;l<this.getNumLayers();++l)if(this.getLayerName(l)==c){(c=this.all_layers[l][1].getAttribute("opacity"))||(c="1.0");return parseFloat(c)}return null};svgedit.draw.Drawing.prototype.setLayerOpacity=function(c,l){if(!(typeof l!="number"||l<0||l>1))for(var u=
|
|
0;u<this.getNumLayers();++u)if(this.getLayerName(u)==c){this.all_layers[u][1].setAttribute("opacity",l);break}}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.path)svgedit.path={};var a={2:["x","y"],4:["x","y"],6:["x","y","x1","y1","x2","y2"],8:["x","y","x1","y1"],10:["x","y","r1","r2","angle","largeArcFlag","sweepFlag"],12:["x"],14:["y"],16:["x","y","x2","y2"],18:["x","y"]},n=[],e=false,c={};svgedit.path.setLinkControlPoints=function(b){e=b};var l=svgedit.path.path=null;svgedit.path.init=function(b){l=b;n=[0,"ClosePath"];$.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth",
|
|
"CurvetoQuadraticSmooth"],function(k,d){n.push(d+"Abs");n.push(d+"Rel")})};svgedit.path.insertItemBefore=function(b,k,d){b.pathSegList.insertItemBefore(k,d)};svgedit.path.ptObjToArr=function(b,k){for(var d=a[b],q=d.length,z=Array(q),D=0;D<q;D++)z[D]=k[d[D]];return z};svgedit.path.getGripPt=function(b,k){var d={x:k?k.x:b.item.x,y:k?k.y:b.item.y},q=b.path;if(q.matrix)d=svgedit.math.transformPoint(d.x,d.y,q.matrix);d.x*=l.getCurrentZoom();d.y*=l.getCurrentZoom();return d};svgedit.path.getPointFromGrip=
|
|
function(b,k){var d={x:b.x,y:b.y};if(k.matrix){b=svgedit.math.transformPoint(d.x,d.y,k.imatrix);d.x=b.x;d.y=b.y}d.x/=l.getCurrentZoom();d.y/=l.getCurrentZoom();return d};svgedit.path.addPointGrip=function(b,k,d){var q=svgedit.path.getGripContainer(),z=svgedit.utilities.getElem("pathpointgrip_"+b);if(!z){z=document.createElementNS("http://www.w3.org/2000/svg","rect");svgedit.utilities.assignAttributes(z,{id:"pathpointgrip_"+b,display:"none",width:svgedit.browser.isTouch()?30:5,height:svgedit.browser.isTouch()?
|
|
30:5,fill:"#fff",stroke:"#4F80FF","shape-rendering":"crispEdges","stroke-width":1,cursor:"move",style:"pointer-events:all","xlink:title":"Drag node to move it. Double-click node to change segment type"});z=q.appendChild(z);$("#pathpointgrip_"+b).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(k&&d)svgedit.utilities.assignAttributes(z,{x:k-(svgedit.browser.isTouch()?15:2.5),y:d-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return z};svgedit.path.getGripContainer=
|
|
function(){var b=svgedit.utilities.getElem("pathpointgrip_container");if(!b){b=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));b.id="pathpointgrip_container"}return b};svgedit.path.addCtrlGrip=function(b){var k=svgedit.utilities.getElem("ctrlpointgrip_"+b);if(k)return k;k=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(k,{id:"ctrlpointgrip_"+b,display:"none",r:svgedit.browser.isTouch()?
|
|
15:3,fill:"#4F80FF",stroke:"#4F80FF","stroke-opacity":0,"stroke-width":"3",cursor:"move",style:"pointer-events:all","xlink:title":"Drag control point to adjust curve properties"});svgedit.path.getGripContainer().appendChild(k);return k};svgedit.path.getCtrlLine=function(b){var k=svgedit.utilities.getElem("ctrlLine_"+b);if(k)return k;k=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(k,{id:"ctrlLine_"+b,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});
|
|
svgedit.path.getGripContainer().appendChild(k);return k};svgedit.path.getPointGrip=function(b,k){var d=svgedit.path.addPointGrip(b.index);if(k){var q=svgedit.path.getGripPt(b);svgedit.utilities.assignAttributes(d,{x:q.x-(svgedit.browser.isTouch()?15:2.5),y:q.y-(svgedit.browser.isTouch()?15:2.5),display:"inline"})}return d};svgedit.path.getControlPoints=function(b){var k=b.item,d=b.index;if(!k||!("x1"in k)||!("x2"in k))return null;var q={};svgedit.path.getGripContainer();for(var z=[svgedit.path.path.segs[d-
|
|
1].item,k],D=1;D<3;D++){var w=d+"c"+D,K=q["c"+D+"_line"]=svgedit.path.getCtrlLine(w),L=svgedit.path.getGripPt(b,{x:k["x"+D],y:k["y"+D]}),N=svgedit.path.getGripPt(b,{x:z[D-1].x,y:z[D-1].y});svgedit.utilities.assignAttributes(K,{x1:L.x,y1:L.y,x2:N.x,y2:N.y,display:"inline"});q["c"+D+"_line"]=K;pointGrip=q["c"+D]=svgedit.path.addCtrlGrip(w);svgedit.utilities.assignAttributes(pointGrip,{cx:L.x,cy:L.y,display:"inline"});q["c"+D]=pointGrip}return q};svgedit.path.replacePathSeg=function(b,k,d,q){q=q||svgedit.path.path.elem;
|
|
b=q["createSVGPathSeg"+n[b]].apply(q,d);q.pathSegList.replaceItem(b,k)};svgedit.path.getSegSelector=function(b,k){var d=b.index,q=svgedit.utilities.getElem("segline_"+d);if(!q){var z=svgedit.path.getGripContainer();q=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(q,{id:"segline_"+d,display:"none",fill:"none",stroke:"#0ff","stroke-opacity":1,"shape-rendering":"crispEdges","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});z.appendChild(q)}if(k){d=
|
|
b.prev;if(!d){q.setAttribute("display","none");return q}d=svgedit.path.getGripPt(d);svgedit.path.replacePathSeg(2,0,[d.x,d.y],q);z=svgedit.path.ptObjToArr(b.type,b.item,true);for(var D=0;D<z.length;D+=2){d=svgedit.path.getGripPt(b,{x:z[D],y:z[D+1]});z[D]=d.x;z[D+1]=d.y}svgedit.path.replacePathSeg(b.type,1,z,q)}return q};svgedit.path.smoothControlPoints=this.smoothControlPoints=function(b,k,d){var q=b.x-d.x,z=b.y-d.y,D=k.x-d.x,w=k.y-d.y;if((q!=0||z!=0)&&(D!=0||w!=0)){b=Math.atan2(z,q);k=Math.atan2(w,
|
|
D);q=Math.sqrt(q*q+z*z);D=Math.sqrt(D*D+w*w);z=l.getSVGRoot().createSVGPoint();w=l.getSVGRoot().createSVGPoint();if(b<0)b+=2*Math.PI;if(k<0)k+=2*Math.PI;var K=Math.abs(b-k),L=Math.abs(Math.PI-K)/2;if(b-k>0){b=K<Math.PI?b+L:b-L;k=K<Math.PI?k-L:k+L}else{b=K<Math.PI?b-L:b+L;k=K<Math.PI?k+L:k-L}z.x=q*Math.cos(b)+d.x;z.y=q*Math.sin(b)+d.y;w.x=D*Math.cos(k)+d.x;w.y=D*Math.sin(k)+d.y;return[z,w]}};svgedit.path.Segment=function(b,k){this.selected=false;this.index=b;this.item=k;this.type=k.pathSegType;this.ctrlpts=
|
|
[];this.segsel=this.ptgrip=null};svgedit.path.Segment.prototype.showCtrlPts=function(b){for(var k in this.ctrlpts)this.ctrlpts[k].setAttribute("display",b?"inline":"none")};svgedit.path.Segment.prototype.selectCtrls=function(){$("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill","#4F80FF")};svgedit.path.Segment.prototype.show=function(b){if(this.ptgrip){this.ptgrip.setAttribute("display",b?"inline":"none");this.segsel.setAttribute("display",b?"inline":"none");this.showCtrlPts(b)}};
|
|
svgedit.path.Segment.prototype.select=function(b){if(this.ptgrip){this.ptgrip.setAttribute("stroke",b?"#4F80FF":"#4F80FF");this.ptgrip.setAttribute("fill",b?"#4F80FF":"#fff");this.segsel.setAttribute("display",b?"inline":"none");this.ctrlpts&&this.selectCtrls(b);this.selected=b}};svgedit.path.Segment.prototype.addGrip=function(){this.ptgrip=svgedit.path.getPointGrip(this,true);this.ctrlpts=svgedit.path.getControlPoints(this,true);this.segsel=svgedit.path.getSegSelector(this,true)};svgedit.path.Segment.prototype.update=
|
|
function(b){if(this.ptgrip){var k=svgedit.path.getGripPt(this),d=svgedit.browser.isTouch()?15:2.5;svgedit.utilities.assignAttributes(this.ptgrip,this.ptgrip.nodeName=="rect"?{x:k.x-d,y:k.y-d}:{cx:k.x,cy:k.y});svgedit.path.getSegSelector(this,true);if(this.ctrlpts){if(b){this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.type=this.item.pathSegType}svgedit.path.getControlPoints(this)}}};svgedit.path.Segment.prototype.move=function(b,k){var d=this.item;d=$.extend({},d);d=this.ctrlpts?
|
|
[d.x+=b,d.y+=k,d.x1,d.y1,d.x2+=b,d.y2+=k]:[d.x+=b,d.y+=k];svgedit.path.replacePathSeg(this.type,this.index,d);if(this.next&&this.next.ctrlpts){d=this.next.item;d=[d.x,d.y,d.x1+=b,d.y1+=k,d.x2,d.y2];svgedit.path.replacePathSeg(this.next.type,this.next.index,d)}if(this.mate){d=this.mate.item;d=[d.x+=b,d.y+=k];svgedit.path.replacePathSeg(this.mate.type,this.mate.index,d)}this.update(true);this.next&&this.next.update(true)};svgedit.path.Segment.prototype.setLinked=function(b){var k,d,q;if(b==2){d=1;k=
|
|
this.next;if(!k)return;q=this.item}else{d=2;k=this.prev;if(!k)return;q=k.item}var z=$.extend({},k.item);z["x"+d]=q.x+(q.x-this.item["x"+b]);z["y"+d]=q.y+(q.y-this.item["y"+b]);svgedit.path.replacePathSeg(k.type,k.index,[z.x,z.y,z.x1,z.y1,z.x2,z.y2]);k.update(true)};svgedit.path.Segment.prototype.moveCtrl=function(b,k,d){var q=$.extend({},this.item);q["x"+b]+=k;q["y"+b]+=d;svgedit.path.replacePathSeg(this.type,this.index,[q.x,q.y,q.x1,q.y1,q.x2,q.y2]);this.update(true)};svgedit.path.Segment.prototype.setType=
|
|
function(b,k){svgedit.path.replacePathSeg(b,this.index,k);this.type=b;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(b===6);this.ctrlpts=svgedit.path.getControlPoints(this);this.update(true)};svgedit.path.Path=function(b){if(!b||b.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=b;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display",
|
|
"none");var b=this.elem.pathSegList,k=b.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var d=0;d<k;d++){var q=b.getItem(d);q=new svgedit.path.Segment(d,q);q.path=this;this.segs.push(q)}b=this.segs;q=null;for(d=0;d<k;d++){var z=b[d],D=d+1>=k?null:b[d+1],w=d-1<0?null:b[d-1];if(z.type===2){if(w&&w.type!==1){D=b[q];D.next=b[q+1];D.next.prev=D;D.addGrip()}q=d}else if(D&&D.type===1){z.next=b[q+1];z.next.prev=z;z.mate=b[q];z.addGrip();if(this.first_seg==null)this.first_seg=z}else if(D){if(z.type!==
|
|
1){z.addGrip();if(D&&D.type!==2){z.next=D;z.next.prev=z}}}else if(z.type!==1){D=b[q];D.next=b[q+1];D.next.prev=D;D.addGrip();z.addGrip();if(!this.first_seg)this.first_seg=b[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(b){for(var k=this.segs.length,d=0;d<k;d++)if(b.call(this.segs[d],d)===false)break};svgedit.path.Path.prototype.addSeg=function(b){var k=this.segs[b];if(k.prev){var d=k.prev,q;switch(k.item.pathSegType){case 4:var z=(k.item.x+d.item.x)/2,D=(k.item.y+d.item.y)/2;q=this.elem.createSVGPathSegLinetoAbs(z,
|
|
D);break;case 6:q=(d.item.x+k.item.x1)/2;var w=(k.item.x1+k.item.x2)/2,K=(k.item.x2+k.item.x)/2,L=(q+w)/2;w=(w+K)/2;z=(L+w)/2;var N=(d.item.y+k.item.y1)/2,H=(k.item.y1+k.item.y2)/2;d=(k.item.y2+k.item.y)/2;var U=(N+H)/2;H=(H+d)/2;D=(U+H)/2;q=this.elem.createSVGPathSegCurvetoCubicAbs(z,D,q,N,L,U);svgedit.path.replacePathSeg(k.type,b,[k.item.x,k.item.y,w,H,K,d])}svgedit.path.insertItemBefore(this.elem,q,b)}};svgedit.path.Path.prototype.deleteSeg=function(b){var k=this.segs[b],d=this.elem.pathSegList;
|
|
k.show(false);var q=k.next;if(k.mate){var z=[q.item.x,q.item.y];svgedit.path.replacePathSeg(2,q.index,z);svgedit.path.replacePathSeg(4,k.index,z);d.removeItem(k.mate.index)}else{if(!k.prev){z=[q.item.x,q.item.y];svgedit.path.replacePathSeg(2,k.next.index,z)}d.removeItem(b)}};svgedit.path.Path.prototype.subpathIsClosed=function(b){var k=false;svgedit.path.path.eachSeg(function(d){if(d<=b)return true;if(this.type===2)return false;else if(this.type===1){k=true;return false}});return k};svgedit.path.Path.prototype.removePtFromSelection=
|
|
function(b){var k=this.selected_pts.indexOf(b);if(k!=-1){this.segs[b].select(false);this.selected_pts.splice(k,1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(b){this.eachSeg(function(){this.show(b)});b&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(b,
|
|
k){for(var d=this.selected_pts.length;d--;)this.segs[this.selected_pts[d]].move(b,k)};svgedit.path.Path.prototype.moveCtrl=function(b,k){var d=this.segs[this.selected_pts[0]];d.moveCtrl(this.dragctrl,b,k);e&&d.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(b){this.storeD();for(var k=this.selected_pts.length,d;k--;){var q=this.segs[this.selected_pts[k]],z=q.prev;if(z){if(!b){d="Toggle Path Segment Type";b=q.type==6?4:6}b-=0;var D=q.item.x,w=q.item.y,K=z.item.x;z=z.item.y;
|
|
var L;switch(b){case 6:if(q.olditem){K=q.olditem;L=[D,w,K.x1,K.y1,K.x2,K.y2]}else{L=D-K;var N=w-z;L=[D,w,K+L/3,z+N/3,D-L/3,w-N/3]}break;case 4:L=[D,w];q.olditem=q.item}q.setType(b,L)}}svgedit.path.path.endChanges(d)};svgedit.path.Path.prototype.selectPt=function(b,k){this.clearSelection();b==null&&this.eachSeg(function(d){if(this.prev)b=d});this.addPtsToSelection(b);if(k){this.dragctrl=k;e&&this.segs[b].setLinked(k)}};svgedit.path.Path.prototype.update=function(){var b=this.elem;if(svgedit.utilities.getRotationAngle(b)){this.matrix=
|
|
svgedit.math.getMatrix(b);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix=null;this.eachSeg(function(k){this.item=b.pathSegList.getItem(k);this.update()});return this};svgedit.path.getPath_=function(b){var k=c[b.id];k||(k=c[b.id]=new svgedit.path.Path(b));return k};svgedit.path.removePath_=function(b){b in c&&delete c[b]};var u=function(b,k,d,q,z,D,w){dx=b-d;dy=k-q;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+w;dx=r*Math.cos(theta)+d;dy=r*Math.sin(theta)+q;dx-=z;dy-=D;r=Math.sqrt(dx*
|
|
dx+dy*dy);theta=Math.atan2(dy,dx)-w;return{x:(r*Math.cos(theta)+z)/1,y:(r*Math.sin(theta)+D)/1}};svgedit.path.recalcRotatedPath=function(){var b=svgedit.path.path.elem,k=svgedit.utilities.getRotationAngle(b,true);if(k){var d=svgedit.utilities.getBBox(b),q=svgedit.path.path.oldbbox,z=q.x+q.width/2;q=q.y+q.height/2;var D=d.x+d.width/2;d=d.y+d.height/2;D=D-z;var w=d-q;d=Math.sqrt(D*D+w*w);w=Math.atan2(w,D)+k;D=d*Math.cos(w)+z;d=d*Math.sin(w)+q;w=b.pathSegList;for(var K=w.numberOfItems;K;){K-=1;var L=
|
|
w.getItem(K),N=L.pathSegType;if(N!=1){var H=u(L.x,L.y,z,q,D,d,k);H=[H.x,H.y];if(L.x1!=null&&L.x2!=null){c_vals1=u(L.x1,L.y1,z,q,D,d,k);c_vals2=u(L.x2,L.y2,z,q,D,d,k);H.splice(H.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(N,K,H)}}svgedit.utilities.getBBox(b);z=svgroot.createSVGTransform();b=svgedit.transformlist.getTransformList(b);z.setRotate(k*180/Math.PI,D,d);b.replaceItem(z,0)}};svgedit.path.clearData=function(){c={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}}
|
|
(function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(n,e){var c=this.length;if(!c)return a.apply(this,arguments);for(var l=0;l<c;l++){var u=this[l];if(u.namespaceURI==="http://www.w3.org/2000/svg")if(e!==undefined)u.setAttribute(n,e);else if($.isArray(n)){c=n.length;for(l={};c--;){var b=n[c],k=u.getAttribute(b);if(k||k==="0")k=isNaN(k)?k:k-0;l[b]=k}return l}else if(typeof n==="object")for(b in n)u.setAttribute(b,n[b]);else{if((k=u.getAttribute(n))||k==="0")k=isNaN(k)?k:k-0;return k}else return a.apply(this,
|
|
arguments)}return this}})();
|
|
$.SvgCanvas=function(a,n){function e(g,h){for(var m=svgedit.utilities.getBBox(g),C=0;C<2;C++){var A=C===0?"fill":"stroke",G=g.getAttribute(A);if(G&&G.indexOf("url(")===0){G=R(G);if(G.tagName==="linearGradient"){var E=G.getAttribute("x1")||0,v=G.getAttribute("y1")||0,f=G.getAttribute("x2")||1,s=G.getAttribute("y2")||0;E=m.width*E+m.x;v=m.height*v+m.y;f=m.width*f+m.x;s=m.height*s+m.y;E=M(E,v,h);s=M(f,s,h);f={};f.x1=(E.x-m.x)/m.width;f.y1=(E.y-m.y)/m.height;f.x2=(s.x-m.x)/m.width;f.y2=(s.y-m.y)/m.height;
|
|
G=G.cloneNode(true);$(G).attr(f);G.id=V();hb().appendChild(G);g.setAttribute(A,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",l={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(l,n);var u=l.dimensions,b=this,k=a.ownerDocument,d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width",u[0]);d.setAttribute("height",u[1]);d.id="svgroot";d.setAttribute("xlinkns","http://www.w3.org/1999/xlink");a.appendChild(d);var q=k.createElementNS(c,"svg");
|
|
(b.clearSvgContentElement=function(){for(;q.firstChild;)q.removeChild(q.firstChild);$(q).attr({id:"svgcontent",width:u[0],height:u[1],x:u[0],y:u[1],overflow:l.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var g=k.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");q.appendChild(g)})();var z="svg_";b.setIdPrefix=function(g){z=g};b.current_drawing_=new svgedit.draw.Drawing(q,
|
|
z);var D=b.getCurrentDrawing=function(){return b.current_drawing_},w=1,K=null,L={shape:{fill:(l.initFill.color=="none"?"":"#")+l.initFill.color,fill_paint:null,fill_opacity:l.initFill.opacity,stroke:"#"+l.initStroke.color,stroke_paint:null,stroke_opacity:l.initStroke.opacity,stroke_width:l.initStroke.width,stroke_dasharray:"none",opacity:l.initOpacity}};L.text=$.extend(true,{},L.shape);$.extend(L.text,{fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var N=L.shape,
|
|
H=Array(1),U=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),m=D().getCurrentLayer();if(h&&g.element!=h.tagName){m.removeChild(h);h=null}if(!h){h=k.createElementNS(c,g.element);if(m)(K||m).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:N.fill,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-opacity":N.stroke_opacity,"fill-opacity":N.fill_opacity,opacity:N.opacity/2,style:"pointer-events:inherit"},
|
|
100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},S=b.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,T=b.matrixMultiply=svgedit.math.matrixMultiply,ia=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ga=b.transformListToTransform=svgedit.math.transformListToTransform,Z=svgedit.math.snapToAngle,fa=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return l.baseUnit},getElement:svgedit.utilities.getElem,
|
|
getHeight:function(){return q.getAttribute("height")/w},getWidth:function(){return q.getAttribute("width")/w},getRoundDigits:function(){return sa.round_digits}});var ua=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return k},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return H},getSVGContent:function(){return q}});var ja=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,la=b.getHref=svgedit.utilities.getHref,
|
|
Y=b.setHref=svgedit.utilities.setHref,ca=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var pa=b.getRotationAngle=svgedit.utilities.getRotationAngle,oa=b.getElem=svgedit.utilities.getElem,na=b.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,Ha=svgedit.sanitize.getNSMap(),Ia=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ea=svgedit.history.MoveElementCommand,Va=svgedit.history.InsertElementCommand,Ua=svgedit.history.RemoveElementCommand,
|
|
La=svgedit.history.ChangeElementCommand,qa=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var m=svgedit.history.HistoryEventTypes;if(g==m.BEFORE_UNAPPLY||g==m.BEFORE_APPLY)b.clearSelection();else if(g==m.AFTER_APPLY||g==m.AFTER_UNAPPLY){var C=h.elements();b.pathActions.clear();da("changed",C);C=h.type();m=g==m.AFTER_APPLY;if(C==Ea.type())(m?h.newParent:h.oldParent)==q&&b.identifyLayers();else if(C==Va.type()||C==Ua.type()){h.parent==q&&b.identifyLayers();
|
|
if(C==Va.type())m&&gb(h.elem);else m||gb(h.elem);h.elem.tagName==="use"&&Eb(h.elem)}else if(C==La.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==q&&b.identifyLayers();m=m?h.newValues:h.oldValues;m.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,m.stdDeviation)}}}});var wa=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(l,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return d},svgContent:function(){return q},currentZoom:function(){return w},
|
|
getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var za=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return w},getSVGRoot:function(){return d}});svgedit.utilities.snapToGrid=function(g){var h=l.snappingStep,m=l.baseUnit;if(m!=="px")h*=svgedit.units.getTypeMap()[m];return g=Math.round(g/h)*h};var va=svgedit.utilities.snapToGrid,ub=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data,gb=function(g){var h=
|
|
$(g).attr(ub),m;for(m in h){var C=h[m];if(C&&C.indexOf("url(")===0){C=ja(C).substr(1);if(!oa(C)){hb().appendChild(cb[C]);delete cb[C]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(m=g.length;h<m;h++)gb(g[h])}},Sa={},Xa=l.imgPath+"logo.png",ya=[],sa={round_digits:5},Fa=false,Qa=null,xa="select",bb="none",jb={},Ya=L.text,Ta=N,rb=null,Ja=null,Ka=[],pb={},cb={};b.clipBoard=[];var ob=this.runExtensions=function(g,h,m){var C=false;if(m)C=[];$.each(pb,function(A,G){if(g in G)if(m)C.push(G[g](h));
|
|
else C=G[g](h)});return C};this.addExtension=function(g,h){if(g in pb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var m=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:d,svgcontent:q,nonce:D().getNonce(),selectorManager:za})):h;pb[g]=m;da("extension_added",m)}};var kb=this.round=function(g){return parseInt(g*w)/w},db=this.getIntersectionList=function(g){if(Ja==null)return null;var h=K||D().getCurrentLayer();Ka.length||(Ka=vb(h));var m=null;
|
|
try{m=h.getIntersectionList(g,null)}catch(C){}if(m==null||typeof m.item!="function"){m=[];if(g)g=g;else{g=Ja.getBBox();h={};for(var A in g)h[A]=g[A]/w;g=h}for(A=Ka.length;A--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,Ka[A].bbox)&&m.push(Ka[A].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Za());if(!g.length)return false;var h=function(s){try{var o=svgedit.utilities.getBBox(s),p=svgedit.utilities.getRotationAngle(s);if(p&&p%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(s))){p=
|
|
false;if(["ellipse","path","line","polyline","polygon"].indexOf(s.tagName)>=0)o=p=b.convertToPath(s,true);else if(s.tagName=="rect"){var B=s.getAttribute("rx"),F=s.getAttribute("ry");if(B||F)o=p=b.convertToPath(s,true)}if(!p){var I=s.cloneNode(true),J=document.createElementNS(c,"g"),O=s.parentNode;O.appendChild(J);J.appendChild(I);o=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return o}catch(W){console.log(s,W)}},m;$.each(g,function(){if(!m)if(this.parentNode)m=h(this)});if(m==null)return null;
|
|
var C=m.x+m.width,A=m.y+m.height,G=m.x,E=m.y,v=function(s){var o=s.getAttribute("stroke-width"),p=0;if(s.getAttribute("stroke")!="none"&&!isNaN(o))p+=o/2;return p},f=[];$.each(g,function(s,o){var p=h(o);if(p){var B=v(o);G=Math.min(G,p.x-B);E=Math.min(E,p.y-B);f.push(p)}});m.x=G;m.y=E;$.each(g,function(s,o){var p=f[s];if(p&&o.nodeType==1){var B=v(o);C=Math.max(C,p.x+p.width+B);A=Math.max(A,p.y+p.height+B)}});m.width=C-G;m.height=A-E;return m};var Za=this.getVisibleElements=function(g){g||(g=$(q).children());
|
|
g.find("#canvas_background").length&&g.splice(0,1);var h=[];$(g).children().each(function(m,C){try{C.getBBox()&&h.push(C)}catch(A){}});return h.reverse()},vb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(q).children());var h=[];$(g).children().each(function(m,C){try{C.getBBox()&&h.push({elem:C,bbox:getStrokedBBox([C])})}catch(A){}});return h.reverse()},qb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=V()},
|
|
lb=function(g){var h=document.createElementNS(g.namespaceURI,g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(C,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var m=Ca.convertPath(g);h.setAttribute("d",m)}$.each(g.childNodes,function(C,A){switch(A.nodeType){case 1:h.appendChild(lb(A));break;case 3:h.textContent=A.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=
|
|
$(g).data("symbol");$(h).data("ref",g).data("symbol",g)}else h.tagName=="image"&&Bb(h);h.id=V();return h},ha,V,da;(function(g){var h={};ha=g.getId=function(){return D().getId()};V=g.getNextId=function(){return D().getNextId()};da=g.call=function(m,C){if(h[m])return h[m](this,C)};g.bind=function(m,C){var A=h[m];h[m]=C;return A}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,m=g.length;h<m;++h){var C=g[h];C.setAttribute("d",Ca.convertPath(C));
|
|
Ca.fixEnd(C)}};var R=this.getRefElem=function(g){return oa(ja(g).substr(1))},P=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);za.releaseSelector(g);H[0]=h;za.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var m=H[0];if(m){var C=m.getAttribute("transform"),A=svgedit.utilities.getBBox(m),G=A.x+A.width/2,E=A.y+A.height/2;A=S(m);A.numberOfItems>0&&A.getItem(0).type==
|
|
4&&A.removeItem(0);if(g!=0){G=M(G,E,ga(A).matrix);E=d.createSVGTransform();E.setRotate(g,G.x,G.y);A.numberOfItems?A.insertItemBefore(E,0):A.appendItem(E)}else A.numberOfItems==0&&m.removeAttribute("transform");if(!h){A=m.getAttribute("transform");m.setAttribute("transform",C);$a("transform",A,H);da("changed",H)}oa("pathpointgrip_container");m=za.requestSelector(H[0]);m.resize();m.updateGripCursors(g)}};var ba=this.recalculateAllSelectedDimensions=function(){for(var g=new qa(bb=="none"?"position":
|
|
"size"),h=H.length;h--;){var m=Wa(H[h]);m&&g.addSubCommand(m)}if(!g.isEmpty()){wa(g);da("changed",H)}},Ba=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Pa=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},Ra=this.remapElement=function(g,h,m){var C=l.gridSnapping&&g.parentNode.parentNode.localName==="svg",A=function(){if(C)for(var p in h)h[p]=va(h[p]);na(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var G=0;G<2;G++){var E=G===0?"fill":"stroke",v=g.getAttribute(E);
|
|
if(v&&v.indexOf("url(")===0)if(m.a<0||m.d<0){v=R(v).cloneNode(true);if(m.a<0){var f=v.getAttribute("x1"),s=v.getAttribute("x2");v.setAttribute("x1",-(f-1));v.setAttribute("x2",-(s-1))}if(m.d<0){f=v.getAttribute("y1");s=v.getAttribute("y2");v.setAttribute("y1",-(f-1));v.setAttribute("y2",-(s-1))}v.id=V();hb().appendChild(v);g.setAttribute(E,"url(#"+v.id+")")}}G=g.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){E=ga(g).matrix;E=T(E.inverse(),m,E);h.x=parseFloat(h.x)+
|
|
E.e;h.y=parseFloat(h.y)+E.f}else{E=S(g);v=d.createSVGTransform();v.setMatrix(T(ga(E).matrix,m));E.clear();E.appendItem(v)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){E=S(g);v=d.createSVGTransform();v.setMatrix(T(ga(E).matrix,m));E.clear();E.appendItem(v)}else{E=M(h.x,h.y,m);h.width=m.a*h.width;h.height=m.d*h.height;h.x=E.x+Math.min(0,h.width);h.y=E.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=M(h.cx,
|
|
h.cy,m);h.cx=G.x;h.cy=G.y;h.rx=m.a*h.rx;h.ry=m.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=M(h.cx,h.cy,m);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":E=M(h.x1,h.y1,m);f=M(h.x2,h.y2,m);h.x1=E.x;h.y1=E.y;h.x2=f.x;h.y2=f.y;case "text":m=g.querySelectorAll("tspan");for(G=m.length;G--;){E=ua("x",g.getAttribute("x"));v=ua("x",m[G].getAttribute("x"));
|
|
f=ua("y",g.getAttribute("y"));s=ua("y",m[G].getAttribute("y"));var o={};if(!isNaN(E)&&!isNaN(v)&&E!=0&&v!=0&&h.x)o.x=h.x-(E-v);if(!isNaN(f)&&!isNaN(s)&&f!=0&&s!=0&&h.y)o.y=h.y-(f-s);if(o.x||o.y)na(m[G],o,1E3,true)}A();break;case "use":A();break;case "g":(A=$(g).data("gsvg"))&&na(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G<A;++G){s=h.points[G];s=M(s.x,s.y,m);h.points[G].x=s.x;h.points[G].y=s.y}A=h.points.length;m="";for(G=0;G<A;++G){s=h.points[G];m+=s.x+","+s.y+" "}g.setAttribute("points",
|
|
m);break;case "path":E=g.pathSegList;A=E.numberOfItems;h.d=Array(A);for(G=0;G<A;++G){v=E.getItem(G);h.d[G]={type:v.pathSegType,x:v.x,y:v.y,x1:v.x1,y1:v.y1,x2:v.x2,y2:v.y2,r1:v.r1,r2:v.r2,angle:v.angle,largeArcFlag:v.largeArcFlag,sweepFlag:v.sweepFlag}}A=h.d.length;G=h.d[0];o=M(G.x,G.y,m);h.d[0].x=o.x;h.d[0].y=o.y;for(G=1;G<A;++G){v=h.d[G];E=v.type;if(E%2==0){s=M(v.x!=undefined?v.x:o.x,v.y!=undefined?v.y:o.y,m);E=M(v.x1,v.y1,m);f=M(v.x2,v.y2,m);v.x=s.x;v.y=s.y;v.x1=E.x;v.y1=E.y;v.x2=f.x;v.y2=f.y}else{v.x=
|
|
m.a*v.x;v.y=m.d*v.y;v.x1=m.a*v.x1;v.y1=m.d*v.y1;v.x2=m.a*v.x2;v.y2=m.d*v.y2}v.r1=m.a*v.r1;v.r2=m.d*v.r2}m="";A=h.d.length;for(G=0;G<A;++G){v=h.d[G];E=v.type;m+=Ba[E];switch(E){case 13:case 12:m+=v.x+" ";break;case 15:case 14:m+=v.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:m+=v.x+","+v.y+" ";break;case 7:case 6:m+=v.x1+","+v.y1+" "+v.x2+","+v.y2+" "+v.x+","+v.y+" ";break;case 9:case 8:m+=v.x1+","+v.y1+" "+v.x+","+v.y+" ";break;case 11:case 10:m+=v.r1+","+v.r2+" "+v.angle+" "+ +v.largeArcFlag+
|
|
" "+ +v.sweepFlag+" "+v.x+","+v.y+" ";break;case 17:case 16:m+=v.x2+","+v.y2+" "+v.x+","+v.y+" "}}g.setAttribute("d",m)}},eb=function(g,h,m){g=R(g).firstChild;var C=S(g),A=d.createSVGTransform();A.setTranslate(h,m);C.appendItem(A);Wa(g)},Wa=this.recalculateDimensions=function(g){if(g==null)return null;var h=S(g);if(h&&h.numberOfItems>0){for(var m=h.numberOfItems;m--;){var C=h.getItem(m);if(C.type===0)h.removeItem(m);else if(C.type===1)svgedit.math.isIdentity(C.matrix)&&h.removeItem(m);else C.type===
|
|
4&&C.angle===0&&h.removeItem(m)}if(h.numberOfItems===1&&pa(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){m=h.numberOfItems;for(var A=[];m--;){C=h.getItem(m);if(C.type===1)A.push([C.matrix,m]);else if(A.length)A=[]}if(A.length===2){m=d.createSVGTransformFromMatrix(T(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(m,A[1][1])}m=h.numberOfItems;if(m>=2&&h.getItem(m-2).type===1&&h.getItem(m-1).type===2){A=d.createSVGTransform();
|
|
C=T(h.getItem(m-2).matrix,h.getItem(m-1).matrix);A.setMatrix(C);h.removeItem(m-2);h.removeItem(m-2);h.appendItem(A)}}switch(g.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(g).data("gsvg");m=new qa("Transform");var E={},v=null;C=[];switch(g.tagName){case "line":C=["x1","y1","x2","y2"];break;case "circle":C=["cx","cy","r"];break;case "ellipse":C=
|
|
["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":C=["width","height","x","y"];break;case "use":case "text":case "tspan":C=["x","y"];break;case "polygon":case "polyline":v={};v.points=g.getAttribute("points");A=g.points;var f=A.numberOfItems;E.points=Array(f);for(var s=0;s<f;++s){var o=A.getItem(s);E.points[s]={x:o.x,y:o.y}}break;case "path":v={};v.d=g.getAttribute("d");E.d=g.getAttribute("d")}if(C.length){E=$(g).attr(C);$.each(E,function(Oa,Ga){E[Oa]=ua(Oa,Ga)})}else if(G)E=
|
|
{x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(v==null){v=$.extend(true,{},E);$.each(v,function(Oa,Ga){v[Oa]=ua(Oa,Ga)})}v.transform=Qa?Qa:"";if(g.tagName=="g"&&!G||g.tagName=="a"){A=svgedit.utilities.getBBox(g);var p={x:A.x+A.width/2,y:A.y+A.height/2},B=M(A.x+A.width/2,A.y+A.height/2,ga(h).matrix);C=d.createSVGMatrix();if(A=pa(g)){s=A*Math.PI/180;f=Math.abs(s)>1.0E-10?Math.sin(s)/(1-Math.cos(s)):2/s;for(s=0;s<h.numberOfItems;++s){C=h.getItem(s);if(C.type==4){C=C.matrix;p.y=(f*C.e+C.f)/2;p.x=(C.e-f*
|
|
C.f)/2;h.removeItem(s);break}}}s=C=G=0;var F=h.numberOfItems;if(F)var I=h.getItem(0).matrix;if(F>=3&&h.getItem(F-2).type==3&&h.getItem(F-3).type==2&&h.getItem(F-1).type==2){s=3;var J=h.getItem(F-3).matrix,O=h.getItem(F-2).matrix,W=h.getItem(F-1).matrix;f=g.childNodes;for(o=f.length;o--;){var aa=f.item(o);C=G=0;if(aa.nodeType==1){var X=S(aa);if(X){C=ga(X).matrix;G=pa(aa);var ea=Qa,Q=[];Qa=aa.getAttribute("transform");if(G||ia(X)){var ka=d.createSVGTransform();ka.setMatrix(T(J,O,W,C));X.clear();X.appendItem(ka);
|
|
Q.push(ka)}else{G=T(C.inverse(),W,C);ka=d.createSVGMatrix();ka.e=-G.e;ka.f=-G.f;C=T(ka.inverse(),C.inverse(),J,O,W,C,G.inverse());var ra=d.createSVGTransform(),ta=d.createSVGTransform(),Aa=d.createSVGTransform();ra.setTranslate(G.e,G.f);ta.setScale(C.a,C.d);Aa.setTranslate(ka.e,ka.f);X.appendItem(Aa);X.appendItem(ta);X.appendItem(ra);Q.push(Aa);Q.push(ta);Q.push(ra)}m.addSubCommand(Wa(aa));Qa=ea}}}h.removeItem(F-1);h.removeItem(F-2);h.removeItem(F-3)}else if(F>=3&&h.getItem(F-1).type==1){s=3;C=ga(h).matrix;
|
|
ka=d.createSVGTransform();ka.setMatrix(C);h.clear();h.appendItem(ka)}else if((F==1||F>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){s=2;G=ga(h).matrix;h.removeItem(0);C=ga(h).matrix.inverse();C=T(C,G);G=C.e;C=C.f;if(G!=0||C!=0){f=g.childNodes;o=f.length;for(F=[];o--;){aa=f.item(o);if(aa.nodeType==1){if(aa.getAttribute("clip-path")){ea=aa.getAttribute("clip-path");if(F.indexOf(ea)===-1){eb(ea,G,C);F.push(ea)}}ea=Qa;Qa=aa.getAttribute("transform");if(X=S(aa)){J=d.createSVGTransform();J.setTranslate(G,
|
|
C);X.numberOfItems?X.insertItemBefore(J,0):X.appendItem(J);m.addSubCommand(Wa(aa));X=g.getElementsByTagNameNS(c,"use");aa="#"+aa.id;for(J=X.length;J--;){O=X.item(J);if(aa==la(O)){W=d.createSVGTransform();W.setTranslate(-G,-C);S(O).insertItemBefore(W,0);m.addSubCommand(Wa(O))}}Qa=ea}}}F=[];Qa=ea}}else if(F==1&&h.getItem(0).type==1&&!A){s=1;C=h.getItem(0).matrix;f=g.childNodes;for(o=f.length;o--;){aa=f.item(o);if(aa.nodeType==1){ea=Qa;Qa=aa.getAttribute("transform");if(X=S(aa)){G=T(C,ga(X).matrix);
|
|
F=d.createSVGTransform();F.setMatrix(G);X.clear();X.appendItem(F,0);m.addSubCommand(Wa(aa));Qa=ea;ea=aa.getAttribute("stroke-width");aa.getAttribute("stroke")!=="none"&&!isNaN(ea)&&aa.setAttribute("stroke-width",ea*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){p=d.createSVGTransform();p.setRotate(A,B.x,B.y);h.numberOfItems?h.insertItemBefore(p,0):h.appendItem(p)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(s==2){if(A){B={x:p.x+I.e,y:p.y+I.f};p=d.createSVGTransform();
|
|
p.setRotate(A,B.x,B.y);h.numberOfItems?h.insertItemBefore(p,0):h.appendItem(p)}}else if(s==3){C=ga(h).matrix;I=d.createSVGTransform();I.setRotate(A,p.x,p.y);I=I.matrix;p=d.createSVGTransform();p.setRotate(A,B.x,B.y);B=p.matrix.inverse();ea=C.inverse();B=T(ea,B,I,C);G=B.e;C=B.f;if(G!=0||C!=0){f=g.childNodes;for(o=f.length;o--;){aa=f.item(o);if(aa.nodeType==1){ea=Qa;Qa=aa.getAttribute("transform");X=S(aa);J=d.createSVGTransform();J.setTranslate(G,C);X.numberOfItems?X.insertItemBefore(J,0):X.appendItem(J);
|
|
m.addSubCommand(Wa(aa));Qa=ea}}}if(A)h.numberOfItems?h.insertItemBefore(p,0):h.appendItem(p)}}else{A=svgedit.utilities.getBBox(g);if(!A&&g.tagName!="path")return null;C=d.createSVGMatrix();if(G=pa(g)){p={x:A.x+A.width/2,y:A.y+A.height/2};B=M(A.x+A.width/2,A.y+A.height/2,ga(h).matrix);s=G*Math.PI/180;f=Math.abs(s)>1.0E-10?Math.sin(s)/(1-Math.cos(s)):2/s;for(s=0;s<h.numberOfItems;++s){C=h.getItem(s);if(C.type==4){C=C.matrix;p.y=(f*C.e+C.f)/2;p.x=(C.e-f*C.f)/2;h.removeItem(s);break}}}s=0;F=h.numberOfItems;
|
|
if(!svgedit.browser.isWebkit())if((I=g.getAttribute("fill"))&&I.indexOf("url(")===0){I=R(I);ea="pattern";if(I.tagName!==ea)ea="gradient";if(I.getAttribute(ea+"Units")==="userSpaceOnUse"){C=ga(h).matrix;A=S(I);A=ga(A).matrix;C=T(C,A);A="matrix("+[C.a,C.b,C.c,C.d,C.e,C.f].join(",")+")";I.setAttribute(ea+"Transform",A)}}if(F>=3&&h.getItem(F-2).type==3&&h.getItem(F-3).type==2&&h.getItem(F-1).type==2){s=3;C=ga(h,F-3,F-1).matrix;h.removeItem(F-1);h.removeItem(F-2);h.removeItem(F-3)}else if(F==4&&h.getItem(F-
|
|
1).type==1){s=3;C=ga(h).matrix;ka=d.createSVGTransform();ka.setMatrix(C);h.clear();h.appendItem(ka);C=d.createSVGMatrix()}else if((F==1||F>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){s=2;I=h.getItem(0).matrix;ea=ga(h,1).matrix;A=ea.inverse();C=T(A,I,ea);h.removeItem(0)}else if(F==1&&h.getItem(0).type==1&&!G){C=ga(h).matrix;switch(g.tagName){case "line":E=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":E.points=g.getAttribute("points");if(E.points){A=g.points;f=A.numberOfItems;
|
|
E.points=Array(f);for(s=0;s<f;++s){o=A.getItem(s);E.points[s]={x:o.x,y:o.y}}}case "path":E.d=g.getAttribute("d");s=1;h.clear()}}else{s=4;if(G){p=d.createSVGTransform();p.setRotate(G,B.x,B.y);h.numberOfItems?h.insertItemBefore(p,0):h.appendItem(p)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(s==1||s==2||s==3)Ra(g,E,C);if(s==2){if(G){ia(h)||(B={x:p.x+C.e,y:p.y+C.f});p=d.createSVGTransform();p.setRotate(G,B.x,B.y);h.numberOfItems?h.insertItemBefore(p,0):h.appendItem(p)}}else if(s==
|
|
3&&G){C=ga(h).matrix;I=d.createSVGTransform();I.setRotate(G,p.x,p.y);I=I.matrix;p=d.createSVGTransform();p.setRotate(G,B.x,B.y);B=p.matrix.inverse();ea=C.inverse();B=T(ea,B,I,C);Ra(g,E,B);if(G)h.numberOfItems?h.insertItemBefore(p,0):h.appendItem(p)}}h.numberOfItems==0&&g.removeAttribute("transform");m.addSubCommand(new La(g,v));return m},Da=null,Na=this.clearSelection=function(g){if(H[0]!=null)for(var h=H.length,m=0;m<h;++m){var C=H[m];if(C==null)break;za.releaseSelector(C);H[m]=null}g||da("selected",
|
|
H)},ib=this.addToSelection=function(g,h){if(g.length!=0){for(var m=0;m<H.length;){if(H[m]==null)break;++m}for(var C=g.length;C--;){var A=g[C];if(A&&svgedit.utilities.getBBox(A)){if(A.tagName==="a"&&A.childNodes.length===1)A=A.firstChild;if(H.indexOf(A)==-1){H[m]=A;m++;A=za.requestSelector(A);H.length>1&&A.showGrips(false)}}}da("selected",H);h||H.length==1?za.requestSelector(H[0]).showGrips(true):za.requestSelector(H[0]).showGrips(false);for(H.sort(function(G,E){if(G&&E&&G.compareDocumentPosition)return 3-
|
|
(E.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},mb=this.selectOnly=function(g,h){Na(true);ib(g,h)};this.removeFromSelection=function(g){if(H[0]!=null)if(g.length!=0){var h=Array(H.length);j=0;len=H.length;for(var m=0;m<len;++m){var C=H[m];if(C)if(g.indexOf(C)==-1){h[j]=C;j++}else za.releaseSelector(C)}H=h}};this.selectAllInCurrentLayer=function(){var g=D().getCurrentLayer();if(g){xa="select";mb($(K||g).children())}};var Cb=this.getMouseTarget=function(g){if(g==
|
|
null||g.target==null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(g.namespaceURI)>=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return d}var h=D().getCurrentLayer();if([d,a,q,h].indexOf(g)>=0)return d;if($(g).closest("#selectorParentGroup").length)return za.selectorParentGroup;for(;g.parentNode&&g.parentNode!==(K||h);)g=g.parentNode;return g};(function(){var g=
|
|
null,h=null,m=null,C=null,A=null,G={},E={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!b.spaceKey){var f=v.button===2;Da=q.querySelector("g").getScreenCTM().inverse();var s=M(v.pageX,v.pageY,Da),o=s.x*w;s=s.y*w;v.preventDefault();if(f)xa="select";o=o/w;s=s/w;var p=Cb(v);if(p.tagName==="a"&&p.childNodes.length===1)p=p.firstChild;var B=C=h=o,F=A=m=s;if(l.gridSnapping){o=va(o);s=va(s);h=va(h);m=va(m)}if(p==za.selectorParentGroup&&H[0]!=null){p=v.target;var I=nb(p,"type");if(I==
|
|
"rotate"){xa="rotate";current_rotate_mode=nb(p,"dir")}else if(I=="resize"){xa="resize";bb=nb(p,"dir")}p=H[0]}Qa=p.getAttribute("transform");I=S(p);switch(xa){case "select":Fa=true;bb="none";if(f)Fa=false;if(p!=d){if(H.indexOf(p)==-1){v.shiftKey||Na(true);ib([p]);rb=p;Ca.clear()}if(!f)for(f=0;f<H.length;++f)if(H[f]!=null){var J=S(H[f]);J.numberOfItems?J.insertItemBefore(d.createSVGTransform(),0):J.appendItem(d.createSVGTransform())}}else if(!f){Na();xa="multiselect";if(Ja==null)Ja=za.getRubberBandBox();
|
|
C*=w;A*=w;na(Ja,{x:C,y:A,width:0,height:0,display:"inline"},100)}break;case "zoom":Fa=true;if(Ja==null)Ja=za.getRubberBandBox();na(Ja,{x:B*w,y:B*w,width:0,height:0,display:"inline"},100);break;case "resize":Fa=true;h=o;m=s;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var O={};$.each(G,function(W,aa){O[W]=aa/w});G=O;f=pa(p)?1:0;if(ia(I)){I.insertItemBefore(d.createSVGTransform(),f);I.insertItemBefore(d.createSVGTransform(),f);I.insertItemBefore(d.createSVGTransform(),f)}else{I.appendItem(d.createSVGTransform());
|
|
I.appendItem(d.createSVGTransform());I.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(o=svgedit.browser.isWebkit())J=function(W){var aa=W.getAttributeNS(null,"stroke");W.removeAttributeNS(null,"stroke");setTimeout(function(){W.setAttributeNS(null,"stroke",aa)},0)};p.style.vectorEffect="non-scaling-stroke";o&&J(p);s=p.getElementsByTagName("*");B=s.length;for(f=0;f<B;f++){s[f].style.vectorEffect="non-scaling-stroke";o&&J(s[f])}}}break;case "fhellipse":case "fhrect":case "fhpath":Fa=
|
|
true;g=B+","+F+" ";J=N.stroke_width==0?1:N.stroke_width;U({element:"polyline",curStyles:true,attr:{points:g,id:V(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});E.minx=B;E.maxx=B;E.miny=F;E.maxy=F;break;case "image":Fa=true;J=U({element:"image",attr:{x:o,y:s,width:0,height:0,id:V(),opacity:N.opacity/2,style:"pointer-events:inherit"}});Y(J,Xa);Bb(J);break;case "square":case "rect":Fa=true;h=o;m=s;U({element:"rect",curStyles:true,attr:{x:o,y:s,width:0,height:0,
|
|
id:V(),opacity:N.opacity/2}});break;case "line":Fa=true;J=N.stroke_width==0?1:N.stroke_width;U({element:"line",curStyles:true,attr:{x1:o,y1:s,x2:o,y2:s,id:V(),stroke:N.stroke,"stroke-width":J,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":Fa=true;U({element:"circle",curStyles:true,attr:{cx:o,cy:s,r:0,id:V(),opacity:N.opacity/
|
|
2}});break;case "ellipse":Fa=true;U({element:"ellipse",curStyles:true,attr:{cx:o,cy:s,rx:0,ry:0,id:V(),opacity:N.opacity/2}});break;case "text":Fa=true;U({element:"text",curStyles:true,attr:{x:o,y:s,id:V(),fill:Ya.fill,"stroke-width":Ya.stroke_width,"font-size":Ya.font_size,"font-family":Ya.font_family,"text-anchor":"start","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=w;m*=w;Ca.mouseDown(v,p,h,m);Fa=true;break;case "textedit":h*=w;m*=w;ab.mouseDown(v,p,h,m);Fa=
|
|
true;break;case "rotate":Fa=true;b.undoMgr.beginUndoableChange("transform",H);document.getElementById("workarea").className="rotate"}J=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:H},true);$.each(J,function(W,aa){if(aa&&aa.started)Fa=true});if(xa)document.getElementById("workarea").className=xa=="resize"?v.target.style.cursor:xa}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(Fa)if(!(v.button===1||b.spaceKey)){var f=H[0],s=M(v.pageX,v.pageY,
|
|
Da),o=s.x*w;s=s.y*w;var p=oa(ha()),B=x=o/w,F=y=s/w;if(l.gridSnapping){x=va(x);y=va(y)}v.preventDefault();switch(xa){case "select":if(H[0]!==null){B=x-h;var I=y-m;if(l.gridSnapping){B=va(B);I=va(I)}if(v.shiftKey){var J=Z(h,m,x,y);x=J.x;y=J.y}if(B!=0||I!=0){F=H.length;for(var O=0;O<F;++O){f=H[O];if(f==null)break;var W=d.createSVGTransform();p=S(f);if(J){B=J.x-h;I=J.y-m}W.setTranslate(B,I);p.numberOfItems?p.replaceItem(W,0):p.appendItem(W);za.requestSelector(f).resize()}if(v.altKey)if(!b.addClones){b.addClones=
|
|
b.cloneSelectedElements(0,0,W);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(ta){ta.parentNode&&ta.parentNode.removeChild(ta);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}da("transition",H)}}break;case "multiselect":B*=w;F*=w;na(Ja,{x:Math.min(C,B),y:Math.min(A,F),width:Math.abs(B-C),height:Math.abs(F-A)},100);p=[];B=[];J=db();F=H.length;for(O=0;O<F;++O){I=J.indexOf(H[O]);if(I==-1)p.push(H[O]);else J[I]=null}F=J.length;for(O=0;O<F;++O)J[O]&&B.push(J[O]);
|
|
p.length>0&&b.removeFromSelection(p);B.length>0&&ib(B);break;case "resize":p=S(f);B=(J=ia(p))?G:svgedit.utilities.getBBox(f);F=B.x;O=B.y;var aa=B.width,X=B.height;B=x-h;I=y-m;if(l.gridSnapping){B=va(B);I=va(I);X=va(X);aa=va(aa)}if(W=pa(f)){var ea=Math.sqrt(B*B+I*I);I=Math.atan2(I,B)-W*Math.PI/180;B=ea*Math.cos(I);I=ea*Math.sin(I)}if(bb.indexOf("n")==-1&&bb.indexOf("s")==-1)I=0;if(bb.indexOf("e")==-1&&bb.indexOf("w")==-1)B=0;var Q=ea=0,ka=X?(X+I)/X:1,ra=aa?(aa+B)/aa:1;if(bb.indexOf("n")>=0){ka=X?(X-
|
|
I)/X:1;Q=X}if(bb.indexOf("w")>=0){ra=aa?(aa-B)/aa:1;ea=aa}B=d.createSVGTransform();I=d.createSVGTransform();aa=d.createSVGTransform();if(l.gridSnapping){F=va(F);ea=va(ea);O=va(O);Q=va(Q)}B.setTranslate(-(F+ea),-(O+Q));if(v.shiftKey)if(ra==1)ra=ka;else ka=ra;I.setScale(ra,ka);aa.setTranslate(F+ea,O+Q);if(J){J=W?1:0;p.replaceItem(B,2+J);p.replaceItem(I,1+J);p.replaceItem(aa,0+J)}else{J=p.numberOfItems;p.replaceItem(aa,J-3);p.replaceItem(I,J-2);p.replaceItem(B,J-1)}za.requestSelector(f).resize();da("transition",
|
|
H);break;case "zoom":B*=w;F*=w;na(Ja,{x:Math.min(C*w,B),y:Math.min(A*w,F),width:Math.abs(B-C*w),height:Math.abs(F-A*w)},100);break;case "text":na(p,{x:x,y:y},1E3);break;case "line":if(l.gridSnapping){x=va(x);y=va(y)}B=x;J=y;if(v.shiftKey){J=Z(h,m,B,J);B=J.x;J=J.y}p.setAttributeNS(null,"x2",B);p.setAttributeNS(null,"y2",J);break;case "foreignObject":case "square":case "rect":case "image":B=Math.abs(x-h);J=Math.abs(y-m);if(xa=="square"||v.shiftKey){B=J=Math.max(B,J);F=h<x?h:h-B;O=m<y?m:m-J}else{F=Math.min(h,
|
|
x);O=Math.min(m,y)}if(v.altKey){B*=2;J*=2;F=h-B/2;O=m-J/2}if(l.gridSnapping){B=va(B);J=va(J);F=va(F);O=va(O)}na(p,{width:B,height:J,x:F,y:O},1E3);break;case "circle":B=$(p).attr(["cx","cy"]);J=B.cx;F=B.cy;B=Math.sqrt((x-J)*(x-J)+(y-F)*(y-F));if(l.gridSnapping)B=va(B);p.setAttributeNS(null,"r",B);break;case "ellipse":B=$(p).attr(["cx","cy"]);J=Math.abs(h+(x-h)/2);F=Math.abs(m+(y-m)/2);if(l.gridSnapping){x=va(x);J=va(J);y=va(y);F=va(F)}B=Math.abs(h-J);O=Math.abs(m-F);if(v.shiftKey){O=B;F=y>m?m+B:m-
|
|
B}if(v.altKey){J=h;F=m;B=Math.abs(x-J);O=v.shiftKey?B:Math.abs(y-F)}p.setAttributeNS(null,"rx",B);p.setAttributeNS(null,"ry",O);p.setAttributeNS(null,"cx",J);p.setAttributeNS(null,"cy",F);break;case "fhellipse":case "fhrect":E.minx=Math.min(B,E.minx);E.maxx=Math.max(B,E.maxx);E.miny=Math.min(F,E.miny);E.maxy=Math.max(F,E.maxy);case "fhpath":g+=+B+","+F+" ";p.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=w;y*=w;if(l.gridSnapping){x=va(x);y=va(y);h=va(h);m=va(m)}if(v.shiftKey){if(J=
|
|
svgedit.path.path){p=J.dragging?J.dragging[0]:h;J=J.dragging?J.dragging[1]:m}else{p=h;J=m}J=Z(p,J,x,y);x=J.x;y=J.y}if(Ja&&Ja.getAttribute("display")!=="none"){B*=w;F*=w;na(Ja,{x:Math.min(C*w,B),y:Math.min(A*w,F),width:Math.abs(B-C*w),height:Math.abs(F-A*w)},100)}Ca.mouseMove(v,x,y);break;case "textedit":x*=w;y*=w;ab.mouseMove(o,s);break;case "rotate":B=svgedit.utilities.getBBox(f);J=B.x+B.width/2;F=B.y+B.height/2;p=fa(f);p=M(J,F,p);J=p.x;F=p.y;p=B.x;O=B.y;if(current_rotate_mode=="nw")p=B.x+B.width;
|
|
if(current_rotate_mode=="se")O=B.y+B.height;if(current_rotate_mode=="sw"){p=B.x+B.width;O=B.y+B.height}compensation_angle=(Math.atan2(F-O,J-p)*(180/Math.PI)-90)%360;W=(Math.atan2(F-y,J-x)*(180/Math.PI)-90)%360;W+=compensation_angle;if(l.gridSnapping)W=va(W);if(v.shiftKey)W=Math.round(W/45)*45;b.setRotationAngle(W<-180?360+W:W,true);da("transition",H)}ob("mouseMove",{event:v,mouse_x:o,mouse_y:s,selected:f})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var f=v.target.parentNode,
|
|
s=Cb(v),o=s.tagName;if(f!==K){if(o==="text"&&xa!=="textedit"){v=M(v.pageX,v.pageY,Da);ab.select(s,v.x,v.y)}if((o==="g"||o==="a")&&pa(s)){xb(s);s=H[0];Na(true)}K&&Ab();f.tagName!=="g"&&f.tagName!=="a"||f===D().getCurrentLayer()||s===za.selectorParentGroup||Jb(s)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);H=H.filter(Boolean);if(v.button!==2){var f=rb;rb=null;if(Fa){var s=M(v.pageX,v.pageY,Da),o=s.x*w;s=s.y*w;var p=o/w,B=s/w,F=oa(ha()),I=false;Fa=false;
|
|
switch(xa){case "resize":case "multiselect":if(Ja!=null){Ja.setAttribute("display","none");Ka=[]}xa="select";case "select":if(H[0]!=null){if(H.length==1){o=H[0];switch(o.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Ta.fill=o.getAttribute("fill");Ta.fill_opacity=o.getAttribute("fill-opacity");Ta.stroke=o.getAttribute("stroke");Ta.stroke_opacity=o.getAttribute("stroke-opacity");Ta.stroke_width=o.getAttribute("stroke-width");Ta.stroke_dasharray=o.getAttribute("stroke-dasharray");
|
|
Ta.stroke_linejoin=o.getAttribute("stroke-linejoin");Ta.stroke_linecap=o.getAttribute("stroke-linecap")}if(o.tagName=="text"){Ya.font_size=o.getAttribute("font-size");Ya.font_family=o.getAttribute("font-family")}za.requestSelector(o).showGrips(true)}ba();C=C;A=A;o=Math.abs(B-A);if(o>1||o>1){v=H.length;for(o=0;o<v;++o){if(H[o]==null)break;H[o].firstChild||za.requestSelector(H[o]).resize()}}else{o=v.target;if(H[0].nodeName==="path"&&H[1]==null)Ca.select(H[0]);else v.shiftKey&&f!=o&&b.removeFromSelection([o])}if(svgedit.browser.supportsNonScalingStroke())if(v=
|
|
H[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(W){W.removeAttribute("style")})}}return;case "zoom":Ja!=null&&Ja.setAttribute("display","none");da("zoomed",{x:Math.min(C,p),y:Math.min(A,B),width:Math.abs(p-C),height:Math.abs(B-A),factor:v.altKey?0.5:2});return;case "fhpath":f=F.getAttribute("points");B=f.indexOf(",");if(I=B>=0?f.indexOf(",",B+1)>=0:f.indexOf(" ",f.indexOf(" ")+1)>=0)F=Ca.smoothPolylineIntoPath(F);break;case "line":f=$(F).attr(["x1","x2","y1","y2"]);I=f.x1!=
|
|
f.x2||f.y1!=f.y2;break;case "foreignObject":case "square":case "rect":case "image":f=$(F).attr(["width","height"]);I=f.width!=0||f.height!=0||xa==="image";break;case "circle":I=F.getAttribute("r")!=0;break;case "ellipse":f=$(F).attr(["rx","ry"]);I=f.rx!=null||f.ry!=null;break;case "fhellipse":if(E.maxx-E.minx>0&&E.maxy-E.miny>0){F=U({element:"ellipse",curStyles:true,attr:{cx:(E.minx+E.maxx)/2,cy:(E.miny+E.maxy)/2,rx:(E.maxx-E.minx)/2,ry:(E.maxy-E.miny)/2,id:ha()}});da("changed",[F]);I=true}break;
|
|
case "fhrect":if(E.maxx-E.minx>0&&E.maxy-E.miny>0){F=U({element:"rect",curStyles:true,attr:{x:E.minx,y:E.miny,width:E.maxx-E.minx,height:E.maxy-E.miny,id:ha()}});da("changed",[F]);I=true}break;case "text":I=true;mb([F]);ab.start(F);break;case "path":F=null;Fa=true;f=Ca.mouseUp(v,F,o,s);F=f.element;I=f.keep;break;case "pathedit":I=true;F=null;Ca.mouseUp(v);break;case "textedit":I=false;F=null;ab.mouseUp(v,o,s);break;case "rotate":I=true;F=null;xa="select";f=b.undoMgr.finishUndoableChange();f.isEmpty()||
|
|
wa(f);ba();da("changed",H)}o=ob("mouseUp",{event:v,mouse_x:o,mouse_y:s},true);$.each(o,function(W,aa){if(aa){I=aa.keep||I;F=aa.element;Fa=aa.started||Fa}});if(!I&&F!=null){D().releaseId(ha());F.parentNode.removeChild(F);F=null;for(o=v.target;o.parentNode.parentNode.tagName=="g";)o=o.parentNode;if((xa!="path"||!drawn_path)&&o.parentNode.id!="selectorParentGroup"&&o.id!="svgcanvas"&&o.id!="svgroot"){b.setMode("select");mb([o],true)}}else if(F!=null){b.addedNew=true;v=0.2;var J;if(false.beginElement&&
|
|
F.getAttribute("opacity")!=N.opacity){J=$(false).clone().attr({to:N.opacity,dur:v}).appendTo(F);try{J[0].beginElement()}catch(O){}}else v=0;setTimeout(function(){J&&J.remove();F.setAttribute("opacity",N.opacity);F.setAttribute("style","pointer-events:inherit");ma(F);if(xa==="path")Ca.toEditMode(F);else l.selectNew&&mb([F],true);wa(new Va(F));da("changed",[F])},v*1E3)}Qa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(v){if(v.shiftKey){v.preventDefault();Da=q.getScreenCTM().inverse();var f=
|
|
M(v.pageX,v.pageY,Da);f={x:f.x,y:f.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)f.factor=2;else{if(v.wheelDelta<=-120)f.factor=0.5}else if(v.detail)if(v.detail>0)f.factor=0.5;else if(v.detail<0)f.factor=2;f.factor&&da("zoomed",f)}})})();var Bb=function(g){$(g).click(function(h){h.preventDefault()})},ab=b.textActions=function(){function g(X){var ea=s.value==="";$(s).focus();if(!arguments.length)if(ea)X=0;else{if(s.selectionEnd!==s.selectionStart)return;X=s.selectionEnd}var Q;Q=F[X];ea||
|
|
s.setSelectionRange(X,X);o=oa("text_cursor");if(!o){o=document.createElementNS(c,"line");na(o,{id:"text_cursor",stroke:"#333","stroke-width":1});o=oa("selectorParentGroup").appendChild(o)}B||(B=setInterval(function(){var ka=o.getAttribute("display")==="none";o.setAttribute("display",ka?"inline":"none")},600));ea=G(Q.x,I.y);Q=G(Q.x,I.y+I.height);na(o,{x1:ea.x,y1:ea.y,x2:Q.x,y2:Q.y,visibility:"visible",display:"inline"});p&&p.setAttribute("d","M 0 0")}function h(X,ea,Q){if(X===ea)g(ea);else{Q||s.setSelectionRange(X,
|
|
ea);p=oa("text_selectblock");if(!p){p=document.createElementNS(c,"path");na(p,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});oa("selectorParentGroup").appendChild(p)}X=F[X];var ka=F[ea];o.setAttribute("visibility","hidden");ea=G(X.x,I.y);Q=G(X.x+(ka.x-X.x),I.y);var ra=G(X.x,I.y+I.height);X=G(X.x+(ka.x-X.x),I.y+I.height);na(p,{d:"M"+ea.x+","+ea.y+" L"+Q.x+","+Q.y+" "+X.x+","+X.y+" "+ra.x+","+ra.y+"z",display:"inline"})}}function m(X,ea){var Q=d.createSVGPoint();Q.x=X;
|
|
Q.y=ea;if(F.length==1)return 0;Q=f.getCharNumAtPosition(Q);if(Q<0){Q=F.length-2;if(X<=F[0].x)Q=0}else if(Q>=F.length-2)Q=F.length-2;var ka=F[Q];X>ka.x+ka.width/2&&Q++;return Q}function C(X,ea,Q){var ka=s.selectionStart;X=m(X,ea);h(Math.min(ka,X),Math.max(ka,X),!Q)}function A(X,ea){var Q={x:X,y:ea};Q.x/=w;Q.y/=w;if(J){var ka=M(Q.x,Q.y,J.inverse());Q.x=ka.x;Q.y=ka.y}return Q}function G(X,ea){var Q={x:X,y:ea};if(J){var ka=M(Q.x,Q.y,J);Q.x=ka.x;Q.y=ka.y}Q.x*=w;Q.y*=w;return Q}function E(X){h(0,f.textContent.length);
|
|
$(this).unbind(X)}function v(X){if(aa&&f){var ea=M(X.pageX,X.pageY,Da);ea=A(ea.x*w,ea.y*w);ea=m(ea.x,ea.y);var Q=f.textContent,ka=Q.substr(0,ea).replace(/[a-z0-9]+$/i,"").length;Q=Q.substr(ea).match(/^[a-z0-9]+/i);h(ka,(Q?Q[0].length:0)+ea);$(X.target).click(E);setTimeout(function(){$(X.target).unbind("click",E)},300)}}var f,s,o,p,B,F=[],I,J,O,W,aa;return{select:function(X,ea,Q){f=X;ab.toEditMode(ea,Q)},start:function(X){f=X;ab.toEditMode()},mouseDown:function(X,ea,Q,ka){X=A(Q,ka);s.focus();g(m(X.x,
|
|
X.y));O=Q;W=ka},mouseMove:function(X,ea){var Q=A(X,ea);C(Q.x,Q.y)},mouseUp:function(X,ea,Q){var ka=A(ea,Q);C(ka.x,ka.y,true);X.target!==f&&ea<O+2&&ea>O-2&&Q<W+2&&Q>W-2&&ab.toSelectMode(true)},setCursor:g,toEditMode:function(X,ea){mb([f],false);aa=false;xa="textedit";za.requestSelector(f).showGrips(false);za.requestSelector(f);ab.init();$(f).css("cursor","text");if(arguments.length){var Q=A(X,ea);g(m(Q.x,Q.y))}else g();setTimeout(function(){aa=true},300)},toSelectMode:function(X){xa="select";clearInterval(B);
|
|
B=null;p&&$(p).attr("display","none");o&&$(o).attr("visibility","hidden");$(f).css("cursor","move");if(X){Na();$(f).css("cursor","move");da("selected",[f]);ib([f],true)}f&&!f.textContent.length&&b.deleteSelectedElements();$(s).blur();f=false},setInputElem:function(X){s=X},clear:function(){xa=="textedit"&&ab.toSelectMode()},init:function(){if(f){if(!f.parentNode){f=H[0];za.requestSelector(f).showGrips(false)}var X=f.textContent.length,ea=f.getAttribute("transform");I=svgedit.utilities.getBBox(f);J=
|
|
ea?fa(f):null;F=Array(X);s.focus();$(f).unbind("dblclick",v).dblclick(v);if(!X)var Q={x:I.x+I.width/2,width:0};for(ea=0;ea<X;ea++){var ka=f.getStartPositionOfChar(ea);Q=f.getEndPositionOfChar(ea);if(!svgedit.browser.supportsGoodTextCharPos()){var ra=b.contentW*w;ka.x-=ra;Q.x-=ra;ka.x/=w;Q.x/=w}F[ea]={x:ka.x,y:I.y,width:Q.x-ka.x,height:I.height}}F.push({x:Q.x,width:0});h(s.selectionStart,s.selectionEnd,true)}}}}(),Ca=b.pathActions=function(){var g=false,h,m,C;svgedit.path.Path.prototype.endChanges=
|
|
function(E){if(svgedit.browser.isWebkit()){var v=this.elem;v.setAttribute("d",Ca.convertPath(v))}E=new La(this.elem,{d:this.last_d},E);wa(E);da("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(E){$.isArray(E)||(E=[E]);for(var v=0;v<E.length;v++){var f=E[v],s=this.segs[f];s.ptgrip&&this.selected_pts.indexOf(f)==-1&&f>=0&&this.selected_pts.push(f)}this.selected_pts.sort();v=this.selected_pts.length;for(E=Array(v);v--;){s=this.segs[this.selected_pts[v]];s.select(true);E[v]=
|
|
s.ptgrip}Ca.canDeleteNodes=true;Ca.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);da("selected",E)};var A=h=null,G=false;this.lastCtrlPoint=[0,0];return{mouseDown:function(E,v,f,s){if(xa==="path"){mouse_x=f;mouse_y=s;f=mouse_x/w;v=mouse_y/w;s=oa("path_stretch_line");m=[f,v];if(l.gridSnapping){f=va(f);v=va(v);mouse_x=va(mouse_x);mouse_y=va(mouse_y)}if(!s){s=document.createElementNS(c,"path");na(s,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});s=oa("selectorParentGroup").appendChild(s)}s.setAttribute("display",
|
|
"inline");this.stretchy=s;var o=null;if(A){o=A.pathSegList;for(var p=o.numberOfItems,B=6/w,F=false;p;){p--;var I=o.getItem(p),J=I.x;I=I.y;if(f>=J-B&&f<=J+B&&v>=I-B&&v<=I+B){F=true;break}}B=ha();svgedit.path.removePath_(B);B=oa(B);J=o.numberOfItems;if(F){if(p<=1&&J>=2){f=o.getItem(0).x;v=o.getItem(0).y;p=svgedit.path.first_grip?svgedit.path.first_grip[0]/w:o.getItem(0).x;F=svgedit.path.first_grip?svgedit.path.first_grip[1]/w:o.getItem(0).y;E=s.pathSegList.getItem(1);E=E.pathSegType===4?A.createSVGPathSegLinetoAbs(f,
|
|
v):A.createSVGPathSegCurvetoCubicAbs(f,v,E.x1/w,E.y1/w,p,F);f=A.createSVGPathSegClosePath();o.appendItem(E);o.appendItem(f)}else if(J<3)return o=false;$(s).remove();element=B;A=null;Fa=false;if(g){svgedit.path.path.matrix&&Ra(B,{},svgedit.path.path.matrix.inverse());f=B.getAttribute("d");s=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",s+f);$(B).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ca.toEditMode(svgedit.path.path.elem);
|
|
svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Cb(E))){console.log("Clicked outside canvas");return false}o=A.pathSegList.numberOfItems;p=A.pathSegList.getItem(o-1);B=p.x;p=p.y;if(E.shiftKey){v=Z(B,p,f,v);f=v.x;v=v.y}E=s.pathSegList.getItem(1);E=E.pathSegType===4?A.createSVGPathSegLinetoAbs(kb(f),kb(v)):A.createSVGPathSegCurvetoCubicAbs(kb(f),kb(v),E.x1/w,E.y1/w,E.x2/w,E.y2/w);A.pathSegList.appendItem(E);f*=w;v*=w;s.setAttribute("d",["M",f,v,f,v].join(" "));s=svgedit.path.addCtrlGrip("1c1");
|
|
E=svgedit.path.addCtrlGrip("0c2");B=svgedit.path.getCtrlLine(1);p=svgedit.path.getCtrlLine(2);s.setAttribute("cx",f);s.setAttribute("cy",v);E.setAttribute("cx",f);E.setAttribute("cy",v);B.setAttribute("x1",f);B.setAttribute("x2",f);B.setAttribute("y1",v);B.setAttribute("y2",v);p.setAttribute("x1",f);p.setAttribute("x2",f);p.setAttribute("y1",v);p.setAttribute("y2",v);s=o;if(g)s+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(s,f,v)}o=true}else{d_attr="M"+f+","+v+" ";A=U({element:"path",curStyles:true,
|
|
attr:{d:d_attr,id:V(),opacity:N.opacity/2}});s.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));s=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(s,mouse_x,mouse_y);svgedit.path.first_grip=null}}else if(svgedit.path.path){svgedit.path.path.storeD();B=E.target.id;if(B.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(B.substr(14));svgedit.path.path.dragging=[f,s];B=svgedit.path.path.segs[v];if(E.shiftKey)B.selected?svgedit.path.path.removePtFromSelection(v):
|
|
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!B.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(B.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[f,s];E=B.split("_")[1].split("c");v=E[0]-0;o=E=E[1]-0;p=svgedit.path.path.segs[v];svgedit.path.path.selectPt(v,E);if(o==2){F=1;B=p.next}else{F=2;B=p.prev}if(!B)return;E=function(O,W){return Math.sqrt(Math.pow(O.x-W.x,2)+Math.pow(O.y-W.y,2))};v={x:p.item["x"+
|
|
o],y:p.item["y"+o]};o=o==2?{x:p.item.x,y:p.item.y}:{x:B.item.x,y:B.item.y};p={x:B.item["x"+F],y:B.item["y"+F]};B=E(v,o);E=E(p,o);v=Math.abs(Math.round(Math.atan2(v.y-o.y,v.x-o.x)*(180/Math.PI),0)-Math.round(Math.atan2(p.y-o.y,p.x-o.x)*(180/Math.PI),0))==180;if(Math.abs(B-E)<5&&v){svgedit.path.setLinkControlPoints(true);svgedit.path.is_linked=true}else{svgedit.path.setLinkControlPoints(false);svgedit.path.is_linked=false}}if(!svgedit.path.path.dragging){if(Ja==null)Ja=za.getRubberBandBox();na(Ja,{x:f*
|
|
w,y:s*w,width:0,height:0,display:"inline"},100)}}},mouseMove:function(E,v,f){G=true;var s=!E.altKey;if(xa==="path"){if(A){var o=A.pathSegList,p=o.numberOfItems-1,B=svgedit.path.addCtrlGrip("1c1"),F=svgedit.path.addCtrlGrip("0c2");if(m){var I=F.getAttribute("cx")/w||0,J=F.getAttribute("cy")/w||0;B.setAttribute("cx",v);B.setAttribute("cy",f);B.setAttribute("display","inline");E=m[0];B=m[1];o.getItem(p);var O=v/w,W=f/w;I=s?E+(E-O):I;s=s?B+(B-W):J;F.setAttribute("cx",I*w);F.setAttribute("cy",s*w);F.setAttribute("display",
|
|
"inline");F=svgedit.path.getCtrlLine(1);J=svgedit.path.getCtrlLine(2);na(F,{x1:v,y1:f,x2:E*w,y2:B*w,display:"inline"});na(J,{x1:I*w,y1:s*w,x2:E*w,y2:B*w,display:"inline"});if(p===0)C=[v,f];else{o=o.getItem(p-1);v=o.x;f=o.y;if(o.pathSegType===6){v+=v-o.x2;f+=f-o.y2}else if(C){v=C[0]/w;f=C[1]/w}svgedit.path.replacePathSeg(6,p,[E,B,this.lastCtrlPoint[0]/w,this.lastCtrlPoint[1]/w,I,s],A)}}else if(s=this.stretchy){p=o.getItem(p);o=v;B=f;if(E.target.id==="pathpointgrip_0"&&svgedit.path.first_grip){o=svgedit.path.first_grip[0];
|
|
B=svgedit.path.first_grip[1]}if(p.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,f,(this.lastCtrlPoint[0]/w||p.x+(p.x-p.x2))*w,(this.lastCtrlPoint[1]/w||p.y+(p.y-p.y2))*w,o,B],s);else C?svgedit.path.replacePathSeg(6,1,[v,f,C[0],C[1],v,f],s):svgedit.path.replacePathSeg(4,1,[v,f],s)}}}else if(svgedit.path.path.dragging){o=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);E=svgedit.path.getPointFromGrip({x:v,y:f},svgedit.path.path);
|
|
p=E.x-o.x;o=E.y-o.y;svgedit.path.path.dragging=[v,f];!s||!svgedit.path.is_linked?svgedit.path.setLinkControlPoints(false):svgedit.path.setLinkControlPoints(true);svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(p,o):svgedit.path.path.movePts(p,o)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var aa=Ja.getBBox(),X=svgedit.path.getGripPt(this);aa=svgedit.math.rectsIntersect(aa,{x:X.x,y:X.y,width:0,height:0});this.select(aa);aa&&svgedit.path.path.selected_pts.push(this.index)}})}},
|
|
mouseUp:function(E,v,f,s){var o=oa("ctrlpointgrip_1c1"),p=oa("ctrlpointgrip_0c2");this.lastCtrlPoint=o?[o.getAttribute("cx"),o.getAttribute("cy")]:[f,s];if(!svgedit.path.first_grip)svgedit.path.first_grip=p?[p.getAttribute("cx"),p.getAttribute("cy")]:[f,s];if(xa==="path"){m=null;if(!A){v=oa(ha());Fa=false;C=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){v=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");
|
|
!E.shiftKey&&!G&&svgedit.path.path.selectPt(v)}else if(Ja&&Ja.getAttribute("display")!="none"){Ja.setAttribute("display","none");Ja.getAttribute("width")<=2&&Ja.getAttribute("height")<=2&&Ca.toSelectMode(E.target)}else Ca.toSelectMode(E.target);G=false},toEditMode:function(E){svgedit.path.path=svgedit.path.getPath_(E);xa="pathedit";Na();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(E){var v=E==svgedit.path.path.elem;
|
|
xa="select";svgedit.path.path.show(false);h=false;Na();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(v){da("selected",[E]);ib([E],true)}},addSubPath:function(E){if(E){xa="path";g=true}else{Ca.clear(true);Ca.toEditMode(svgedit.path.path.elem)}},select:function(E){if(h===E){Ca.toEditMode(E);xa="pathedit"}else h=E},reorient:function(){var E=H[0];if(E)if(pa(E)!=0){var v=new qa("Reorient path"),f={d:E.getAttribute("d"),transform:E.getAttribute("transform")};v.addSubCommand(new La(E,f));
|
|
Na();this.resetOrientation(E);wa(v);svgedit.path.getPath_(E).show(false).matrix=null;this.clear();ib([E],true);da("changed",H)}},clear:function(E){h=null;if(A){var v=oa(ha());$(oa("path_stretch_line")).remove();E&&$(v).remove();$(oa("pathpointgrip_container")).find("*").attr("display","none");A=C=null;Fa=false}else xa=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(E){if(E==null||E.nodeName!="path")return false;var v=S(E),f=ga(v).matrix;
|
|
v.clear();E.removeAttribute("transform");v=E.pathSegList;for(var s=v.numberOfItems,o=0;o<s;++o){var p=v.getItem(o),B=p.pathSegType;if(B!=1){var F=[];$.each(["",1,2],function(I,J){var O=p["x"+J],W=p["y"+J];if(O!==undefined&&W!==undefined){O=M(O,W,f);F.splice(F.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(B,o,F,E)}}e(E,f)},zoomChange:function(){xa=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){if(svgedit.path.path){var E=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?
|
|
svgedit.path.path.selected_pts[0]:1];return{x:E.item.x,y:E.item.y,type:E.type}}},linkControlPoints:function(E){svgedit.path.setLinkControlPoints(E)},clonePathNode:function(){svgedit.path.path.storeD();for(var E=svgedit.path.path.selected_pts,v=E.length,f=[];v--;){var s=E[v];svgedit.path.path.addSeg(s);f.push(s+v);f.push(s+v+1)}svgedit.path.path.init().addPtsToSelection(f);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var E=svgedit.path.path.selected_pts;if(E.length===
|
|
1){var v=svgedit.path.path.elem,f=v.pathSegList,s=E[0],o=null,p=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=s)p=this.item;if(J<=s)return true;if(this.type===2){o=J;return false}else if(this.type===1)return o=false});if(o==null)o=svgedit.path.path.segs.length-1;if(o!==false){var B=v.createSVGPathSegLinetoAbs(p.x,p.y),F=v.createSVGPathSegClosePath();if(o==svgedit.path.path.segs.length){f.appendItem(B);f.appendItem(F)}else{svgedit.path.insertItemBefore(v,F,o);svgedit.path.insertItemBefore(v,
|
|
B,o)}svgedit.path.path.init().selectPt(o+1)}else if(svgedit.path.path.segs[s].mate){f.removeItem(s);f.removeItem(s);svgedit.path.path.init().selectPt(s-1)}else{for(E=0;E<f.numberOfItems;E++){var I=f.getItem(E);if(I.pathSegType===2)B=E;else if(E===s)f.removeItem(B);else if(I.pathSegType===1&&s<E){F=E-1;f.removeItem(E);break}}for(E=s-B-1;E--;)svgedit.path.insertItemBefore(v,f.getItem(B),F);v=f.getItem(B);svgedit.path.replacePathSeg(2,B,[v.x,v.y]);E=s;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ca.canDeleteNodes){svgedit.path.path.storeD();
|
|
for(var E=svgedit.path.path.selected_pts,v=E.length;v--;)svgedit.path.path.deleteSeg(E[v]);var f=function(){var s=svgedit.path.path.elem.pathSegList,o=s.numberOfItems,p=function(I,J){for(;J--;)s.removeItem(I)};if(o<=1)return true;for(;o--;){var B=s.getItem(o);if(B.pathSegType===1){B=s.getItem(o-1);var F=s.getItem(o-2);if(B.pathSegType===2){p(o-1,2);f();break}else if(F.pathSegType===2){p(o-2,3);f();break}}else if(B.pathSegType===2)if(o>0){B=s.getItem(o-1).pathSegType;if(B===2){p(o-1,1);f();break}else if(B===
|
|
1&&s.numberOfItems-1===o){p(o,1);f();break}}}return false};f();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){b.setMode("select");b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){E=$(svgedit.path.path.elem);E.attr("d",E.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(E){var v=E.points,f=v.numberOfItems;if(f>=4){var s=v.getItem(0),o=null;E=[];E.push(["M",s.x,",",s.y," C"].join(""));
|
|
for(var p=1;p<=f-4;p+=3){var B=v.getItem(p),F=v.getItem(p+1),I=v.getItem(p+2);if(o)if((s=svgedit.path.smoothControlPoints(o,B,s))&&s.length==2){B=E[E.length-1].split(",");B[2]=s[0].x;B[3]=s[0].y;E[E.length-1]=B.join(",");B=s[1]}E.push([B.x,B.y,F.x,F.y,I.x,I.y].join(","));s=I;o=F}for(E.push("L");p<f;++p){F=v.getItem(p);E.push([F.x,F.y].join(","))}E=E.join(" ");E=U({element:"path",curStyles:true,attr:{id:ha(),d:E,fill:"none"}})}return E},setSegType:function(E){svgedit.path.path.setSegType(E)},moveNode:function(E,
|
|
v){var f=svgedit.path.path.selected_pts;if(f.length){svgedit.path.path.storeD();f=svgedit.path.path.segs[f[0]];var s={x:0,y:0};s[E]=v-f.item[E];f.move(s.x,s.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(E){for(var v=E.pathSegList,f=v.numberOfItems,s,o=0;o<f;++o){var p=v.getItem(o);if(p.pathSegType===2)s=p;if(p.pathSegType===1){p=v.getItem(o-1);if(p.x!=s.x||p.y!=s.y){v=E.createSVGPathSegLinetoAbs(s.x,s.y);svgedit.path.insertItemBefore(E,v,o);Ca.fixEnd(E);break}}}svgedit.browser.isWebkit()&&
|
|
E.setAttribute("d",Ca.convertPath(E))},convertPath:function(E,v){for(var f=E.pathSegList,s=f.numberOfItems,o=0,p=0,B="",F=null,I=0;I<s;++I){var J=f.getItem(I),O=J.x||0,W=J.y||0,aa=J.x1||0,X=J.y1||0,ea=J.x2||0,Q=J.y2||0,ka=J.pathSegType,ra=Ba[ka]["to"+(v?"Lower":"Upper")+"Case"](),ta=function(Aa,Oa,Ga){Oa=Oa?" "+Oa.join(" "):"";Ga=Ga?" "+svgedit.units.shortFloat(Ga):"";$.each(Aa,function(Ma,fb){Aa[Ma]=svgedit.units.shortFloat(fb)});B+=ra+Aa.join(" ")+Oa+Ga};switch(ka){case 1:B+="z";break;case 12:O-=
|
|
o;case 13:if(v){o+=O;ra="l"}else{O+=o;o=O;ra="L"}ta([[O,p]]);break;case 14:W-=p;case 15:if(v){p+=W;ra="l"}else{W+=p;p=W;ra="L"}ta([[o,W]]);break;case 2:case 4:case 18:O-=o;W-=p;case 5:case 3:if(F&&f.getItem(I-1).pathSegType===1&&!v){o=F[0];p=F[1]}case 19:if(v){o+=O;p+=W}else{O+=o;W+=p;o=O;p=W}if(ka===3)F=[o,p];ta([[O,W]]);break;case 6:O-=o;aa-=o;ea-=o;W-=p;X-=p;Q-=p;case 7:if(v){o+=O;p+=W}else{O+=o;aa+=o;ea+=o;W+=p;X+=p;Q+=p;o=O;p=W}ta([[aa,X],[ea,Q],[O,W]]);break;case 8:O-=o;aa-=o;W-=p;X-=p;case 9:if(v){o+=
|
|
O;p+=W}else{O+=o;aa+=o;W+=p;X+=p;o=O;p=W}ta([[aa,X],[O,W]]);break;case 10:O-=o;W-=p;case 11:if(v){o+=O;p+=W}else{O+=o;W+=p;o=O;p=W}ta([[J.r1,J.r2]],[J.angle,J.largeArcFlag?1:0,J.sweepFlag?1:0],[O,W]);break;case 16:O-=o;ea-=o;W-=p;Q-=p;case 17:if(v){o+=O;p+=W}else{O+=o;ea+=o;W+=p;Q+=p;o=O;p=W}ta([[ea,Q],[O,W]])}}return B}}}(),Kb=this.removeUnusedDefElems=function(){var g=q.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;for(var h=[],m=0,C=["fill","stroke","filter","marker-start","marker-mid",
|
|
"marker-end"],A=C.length,G=q.getElementsByTagNameNS(c,"*"),E=G.length,v=0;v<E;v++){for(var f=G[v],s=0;s<A;s++)if(f){var o=ja(f.getAttribute(C[s]));o&&h.push(o.substr(1))}(f=la(f))&&f.indexOf("#")===0&&h.push(f.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=g.length;v--;){C=g[v];A=C.id;if(h.indexOf(A)<0){cb[A]=C;C.parentNode.removeChild(C);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ca.clear(true);$.each(q.childNodes,function(m,
|
|
C){m&&C.nodeType===8&&C.data.indexOf("Created with")>=0&&q.insertBefore(C,q.firstChild)});if(K){Ab();mb([K])}$("#canvasGrid").attr("display","none");var g=[];$(q).find("g:data(gsvg)").each(function(){for(var m=this.attributes,C=m.length,A=0;A<C;A++)if(m[A].nodeName=="id"||m[A].nodeName=="style")C--;if(C<=0){m=this.firstChild;g.push(m);$(this).replaceWith(m)}});var h=this.svgToString(q,0);g.length&&$(g).each(function(){qb(this)});return h};this.svgToString=function(g,h){var m=[],C=svgedit.utilities.toXml,
|
|
A=l.baseUnit,G=RegExp("^-?[\\d\\.]+"+A+"$");if(g){ma(g);var E=g.attributes,v,f,s=g.childNodes;for(f=0;f<h;f++)m.push(" ");m.push("<");m.push(g.nodeName);if(g.id==="svgcontent"){f=wb();if(A!=="px"){f.w=svgedit.units.convertUnit(f.w,A)+A;f.h=svgedit.units.convertUnit(f.h,A)+A}m.push(' width="'+f.w+'" height="'+f.h+'" xmlns="'+c+'"');var o={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(I,J){var O=J.namespaceURI;if(O&&!o[O]&&Ha[O]!=="xmlns"&&Ha[O]!=="xml"){o[O]=true;m.push(" xmlns:"+
|
|
Ha[O]+'="'+O+'"')}})});f=E.length;for(A=["width","height","xmlns","x","y","viewBox","id","overflow"];f--;){v=E.item(f);var p=C(v.nodeValue);if(v.nodeName.indexOf("xmlns:")!==0)if(p!=""&&A.indexOf(v.localName)==-1)if(!v.namespaceURI||Ha[v.namespaceURI]){m.push(" ");m.push(v.nodeName);m.push('="');m.push(p);m.push('"')}}}else{if(g.nodeName==="defs"&&!g.firstChild)return;var B=["-moz-math-font-style","_moz-math-font-style"];for(f=E.length-1;f>=0;f--){v=E.item(f);p=C(v.nodeValue);if(!(B.indexOf(v.localName)>=
|
|
0))if(p!="")if(p.indexOf("pointer-events")!==0)if(!(v.localName==="class"&&p.indexOf("se_")===0)){m.push(" ");if(v.localName==="d")p=Ca.convertPath(g,true);if(isNaN(p)){if(G.test(p))p=svgedit.units.shortFloat(p)+A}else p=svgedit.units.shortFloat(p);if(sa.apply&&g.nodeName==="image"&&v.localName==="href"&&sa.images&&sa.images==="embed"){var F=Sa[p];if(F)p=F}if(!v.namespaceURI||v.namespaceURI==c||Ha[v.namespaceURI]){m.push(v.nodeName);m.push('="');m.push(p);m.push('"')}}}}if(g.hasChildNodes()){m.push(">");
|
|
h++;E=false;for(f=0;f<s.length;f++){A=s.item(f);switch(A.nodeType){case 1:m.push("\n");m.push(this.svgToString(s.item(f),h));break;case 3:A=A.nodeValue.replace(/^\s+|\s+$/g,"");if(A!=""){E=true;m.push(C(A)+"")}break;case 4:m.push("\n");m.push(Array(h+1).join(" "));m.push("<![CDATA[");m.push(A.nodeValue);m.push("]]\>");break;case 8:m.push("\n");m.push(Array(h+1).join(" "));m.push("<!--");m.push(A.data);m.push("--\>")}}h--;if(!E){m.push("\n");for(f=0;f<h;f++)m.push(" ")}m.push("</");m.push(g.nodeName);
|
|
m.push(">")}else m.push("/>")}return m.join("")};this.embedImage=function(g,h){$(new Image).load(function(){var m=document.createElement("canvas");m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var C=";svgedit_url="+encodeURIComponent(g);C=m.toDataURL().replace(";base64",C+";base64");Sa[g]=C}catch(A){Sa[g]=false}Xa=g;h&&h(Sa[g])}).attr("src",g)};this.setGoodImage=function(g){Xa=g};this.open=function(){};this.save=function(g){Na();g&&$.extend(sa,g);sa.apply=true;
|
|
g=this.svgCanvasToString();g=new Blob([g],{type:"image/svg+xml;charset=utf-8"});saveAs(g,"method-draw-image.svg",true)};this.rasterExport=function(){Na();var g=[],h={feGaussianBlur:"Blurred elements will appear as un-blurred",foreignObject:"foreignObject elements will not appear","[stroke-dasharray]":"Strokes will appear filled"},m=$(q);"font"in $("<canvas>")[0].getContext("2d")||(h.text="Text may not appear as expected");$.each(h,function(C,A){m.find(C).length&&g.push(A)});h=this.svgCanvasToString();
|
|
da("exported",{svg:h,issues:g})};this.getSvgString=function(){sa.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,D()):svgedit.draw.randomizeIds(true,D())};var Fb=this.uniquifyElems=function(g){var h={},m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(v){if(v.nodeType==1){if(v.id){v.id in h||(h[v.id]={elem:null,attrs:[],hrefs:[]});
|
|
h[v.id].elem=v}$.each(ub,function(s,o){var p=v.getAttributeNode(o);if(p){var B=svgedit.utilities.getUrlFromAttr(p.value);if(B=B?B.substr(1):null){B in h||(h[B]={elem:null,attrs:[],hrefs:[]});h[B].attrs.push(p)}}});var f=svgedit.utilities.getHref(v);if(f&&m.indexOf(v.nodeName)>=0)if(f=f.substr(1)){f in h||(h[f]={elem:null,attrs:[],hrefs:[]});h[f].hrefs.push(v)}}});for(var C in h)if(C){var A=h[C].elem;if(A){g=V();A.id=g;A=h[C].attrs;for(var G=A.length;G--;){var E=A[G];E.ownerElement.setAttribute(E.name,
|
|
"url(#"+g+")")}A=h[C].hrefs;for(G=A.length;G--;)svgedit.utilities.setHref(A[G],"#"+g)}}},Eb=this.setUseData=function(g){var h=$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var m=la(this).substr(1);if(m=oa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol",m).data("ref",m)}})},Gb=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=
|
|
0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(q).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var C=$(this).attr(["x1","y1","x2","y2"]),A=this.gradientTransform.baseVal;if(A&&A.numberOfItems>0){var G=ga(A).matrix;A=M(C.x1,C.y1,G);G=M(C.x2,C.y2,G);C.x1=A.x;C.y1=A.y;C.x2=G.x;C.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(C.x1-m.x)/m.width,
|
|
y1:(C.y1-m.y)/m.height,x2:(C.x2-m.x)/m.width,y2:(C.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Db=this.convertToGroup=function(g){g||(g=H[0]);var h=$(g),m=new qa,C;if(h.data("gsvg")){m=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();$(g).removeData("gsvg");C=S(g);var A=d.createSVGTransform();A.setTranslate(m.x,m.y);C.appendItem(A);Wa(g);da("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");C=h.attr("transform");A=h.attr(["x","y"]);var G=g.getAttribute("viewBox");
|
|
if(G){G=G.split(" ");A.x-=+G[0];A.y-=+G[1]}C+=" translate("+(A.x||0)+","+(A.y||0)+")";A=h.prev();m.addSubCommand(new Ua(h[0],h[0].nextSibling,h[0].parentNode));h.remove();G=$(q).find("use:data(symbol)").length;h=k.createElementNS(c,"g");for(var E=g.childNodes,v=0;v<E.length;v++)h.appendChild(E[v].cloneNode(true));if(svgedit.browser.isGecko()){E=$(hb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(E)}C&&h.setAttribute("transform",C);C=g.parentNode;Fb(h);svgedit.browser.isGecko()&&
|
|
$(hb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=V();A.after(h);if(C){if(!G){A=g.nextSibling;C.removeChild(g);m.addSubCommand(new Ua(g,A,C))}m.addSubCommand(new Va(h))}Eb(h);svgedit.browser.isGecko()?Gb(hb()):Gb(h);svgedit.utilities.walkTreePost(h,function(f){try{Wa(f)}catch(s){console.log(s)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=V()});mb([h]);(g=xb(h,true))&&m.addSubCommand(g);
|
|
wa(m)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);this.prepareSvg(h);var m=new qa("Change Source"),C=q.nextSibling,A=d.removeChild(q);m.addSubCommand(new Ua(A,C,d));q=k.adoptNode?k.adoptNode(h.documentElement):k.importNode(h.documentElement,true);d.appendChild(q);var G=$(q);b.current_drawing_=new svgedit.draw.Drawing(q,z);var E=D().getNonce();E?da("setnonce",E):da("unsetnonce");G.find("image").each(function(){var J=this;
|
|
Bb(J);var O=la(this);if(O.indexOf("data:")===0){var W=O.match(/svgedit_url=(.*?);/);if(W){var aa=decodeURIComponent(W[1]);$(new Image).load(function(){J.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",aa)}).attr("src",aa)}}b.embedImage(O)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Fb(this);var J=this.parentNode;if(J.childNodes.length===1&&J.nodeName==="g"){$(J).data("gsvg",this);J.id=J.id||V()}else qb(this)}});G.find("linearGradient, radialGradient, pattern").appendTo(hb());
|
|
Eb(G);Gb(G[0]);svgedit.utilities.walkTreePost(q,function(J){try{Wa(J)}catch(O){console.log(O)}});var v={id:"svgcontent",overflow:l.show_outside_canvas?"visible":"hidden"},f=false;if(G.attr("viewBox")){var s=G.attr("viewBox").split(" ");v.width=s[2];v.height=s[3]}else $.each(["width","height"],function(J,O){var W=G.attr(O);W||(W="100%");if((W+"").substr(-1)==="%")f=true;else v[O]=ua(O,W)});yb();G.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=
|
|
V()});if(f){var o=getStrokedBBox();v.width=o.width+o.x;v.height=o.height+o.y}if(v.width<=0)v.width=200;if(v.height<=0)v.height=200;G.attr(v);this.contentW=v.width;this.contentH=v.height;$("#canvas_width").val(this.contentW);$("#canvas_height").val(this.contentH);var p=$("#canvas_background");if(p.length){var B=p.attr("fill-opacity");B=B?parseInt(B)*100:100;fill=this.getPaint(p.attr("fill"),B,"canvas")}else fill=this.getPaint("none",100,"canvas");methodDraw.paintBox.canvas.setPaint(fill);m.addSubCommand(new Va(q));
|
|
var F=G.attr(["width","height"]);m.addSubCommand(new La(d,F));w=1;svgedit.transformlist.resetListMap();Na();svgedit.path.clearData();d.appendChild(za.selectorParentGroup);wa(m);da("changed",[q])}catch(I){console.log(I);return false}return true};this.getPaint=function(g,h,m){var C=null;if(g.indexOf("url(#")===0){g=(g=svgCanvas.getRefElem(g))?g.cloneNode(true):$("#"+m+"_color defs *")[0];C={alpha:h};C[g.tagName]=g}else C=g.indexOf("#")===0?{alpha:h,solidColor:g.substr(1)}:{alpha:h,solidColor:"none"};
|
|
return new $.jGraduate.Paint(C)};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+g).substr(0,32),m=false;if(jb[h])if($(jb[h].symbol).parents("#svgroot").length)m=true;var C=new qa("Import SVG");if(m)var A=jb[h].symbol,G=jb[h].xform;else{var E=svgedit.utilities.text2xml(g);this.prepareSvg(E);var v;v=k.adoptNode?k.adoptNode(E.documentElement):k.importNode(E.documentElement,true);Fb(v);var f=ua("width",v.getAttribute("width")),s=ua("height",v.getAttribute("height")),o=
|
|
v.getAttribute("viewBox"),p=o?o.split(" "):[0,0,f,s];for(g=0;g<4;++g)p[g]=+p[g];q.getAttribute("width");var B=+q.getAttribute("height");G=s>f?"scale("+B/3/p[3]+")":"scale("+B/3/p[2]+")";G="translate(0) "+G+" translate(0)";A=k.createElementNS(c,"symbol");var F=hb();for(svgedit.browser.isGecko()&&$(v).find("linearGradient, radialGradient, pattern").appendTo(F);v.firstChild;)A.appendChild(v.firstChild);var I=v.attributes;for(v=0;v<I.length;v++){var J=I[v];A.setAttribute(J.nodeName,J.nodeValue)}A.id=
|
|
V();jb[h]={symbol:A,xform:G};hb().appendChild(A);C.addSubCommand(new Va(A))}var O=k.createElementNS(c,"use");O.id=V();Y(O,"#"+A.id);(K||D().getCurrentLayer()).appendChild(O);C.addSubCommand(new Va(O));Na();O.setAttribute("transform",G);Wa(O);$(O).data("symbol",A).data("ref",A);ib([O]);wa(C);da("changed",[q])}catch(W){console.log(W);return false}return true};var yb=b.identifyLayers=function(){Ab();D().identifyLayers()};this.createLayer=function(g){var h=new qa("Create Layer");g=D().createLayer(g);
|
|
h.addSubCommand(new Va(g));wa(h);Na();da("changed",[g])};this.cloneLayer=function(g){var h=new qa("Duplicate Layer"),m=k.createElementNS(c,"g"),C=k.createElementNS(c,"title");C.textContent=g;m.appendChild(C);C=D().getCurrentLayer();$(C).after(m);C=C.childNodes;for(var A=0;A<C.length;A++){var G=C[A];G.localName!="title"&&m.appendChild(lb(G))}Na();yb();h.addSubCommand(new Va(m));wa(h);b.setCurrentLayer(g);da("changed",[m])};this.deleteCurrentLayer=function(){var g=D().getCurrentLayer(),h=g.nextSibling,
|
|
m=g.parentNode;if(g=D().deleteCurrentLayer()){var C=new qa("Delete Layer");C.addSubCommand(new Ua(g,h,m));wa(C);Na();da("changed",[m]);return true}return false};this.setCurrentLayer=function(g){(g=D().setCurrentLayer(svgedit.utilities.toXml(g)))&&Na();return g};this.renameCurrentLayer=function(g){var h=D();if(h.current_layer){var m=h.current_layer;if(!b.setCurrentLayer(g)){for(var C=new qa("Rename Layer"),A=0;A<h.getNumLayers();++A)if(h.all_layers[A][1]==m)break;var G=h.getLayerName(A);h.all_layers[A][0]=
|
|
svgedit.utilities.toXml(g);var E=m.childNodes.length;for(A=0;A<E;++A){var v=m.childNodes.item(A);if(v&&v.tagName=="title"){for(;v.firstChild;)v.removeChild(v.firstChild);v.textContent=g;C.addSubCommand(new La(v,{"#text":G}));wa(C);da("changed",[m]);return true}}}h.current_layer=m}return false};this.setCurrentLayerPosition=function(g){var h=D();if(h.current_layer&&g>=0&&g<h.getNumLayers()){for(var m=0;m<h.getNumLayers();++m)if(h.all_layers[m][1]==h.current_layer)break;if(m==h.getNumLayers())return false;
|
|
if(m!=g){var C=null,A=h.current_layer.nextSibling;if(g>m){if(g<h.getNumLayers()-1)C=h.all_layers[g+1][1]}else C=h.all_layers[g][1];q.insertBefore(h.current_layer,C);wa(new Ea(h.current_layer,A,q));yb();b.setCurrentLayer(h.getLayerName(g));return true}}return false};this.setLayerVisibility=function(g,h){var m=D(),C=m.getLayerVisibility(g),A=m.setLayerVisibility(g,h);if(A)wa(new La(A,{display:C?"inline":"none"},"Layer Visibility"));else return false;if(A==m.getCurrentLayer()){Na();Ca.clear()}return true};
|
|
this.moveSelectedToLayer=function(g){for(var h=null,m=D(),C=0;C<m.getNumLayers();++C)if(m.getLayerName(C)==g){h=m.all_layers[C][1];break}if(!h)return false;g=new qa("Move Elements to Layer");m=H;for(C=m.length;C--;){var A=m[C];if(A){var G=A.nextSibling,E=A.parentNode;h.appendChild(A);g.addSubCommand(new Ea(A,G,E))}}wa(g);return true};this.mergeLayer=function(g){var h=new qa("Merge Layer"),m=D(),C=$(m.current_layer).prev()[0];if(C){for(h.addSubCommand(new Ua(m.current_layer,m.current_layer.nextSibling,
|
|
q));m.current_layer.firstChild;){var A=m.current_layer.firstChild;if(A.localName=="title"){h.addSubCommand(new Ua(A,A.nextSibling,m.current_layer));m.current_layer.removeChild(A)}else{var G=A.nextSibling;C.appendChild(A);h.addSubCommand(new Ea(A,G,m.current_layer))}}q.removeChild(m.current_layer);if(!g){Na();yb();da("changed",[q]);wa(h)}m.current_layer=C;return h}};this.mergeAllLayers=function(){var g=new qa("Merge all Layers"),h=D();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(q).children("g").length>
|
|
1;)g.addSubCommand(b.mergeLayer(true));Na();yb();da("changed",[q]);wa(g)};var Ab=this.leaveContext=function(){var g=ya.length;if(g){for(var h=0;h<g;h++){var m=ya[h],C=nb(m,"orig_opac");C!==1?m.setAttribute("opacity",C):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}ya=[];Na(true);da("contextset",null)}K=null},Jb=this.setContext=function(g){Ab();if(typeof g==="string")g=oa(g);K=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||
|
|
1;nb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");ya.push(this)});Na();da("contextset",K)};this.clear=function(){Ca.clear();Na();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(q);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();za.initGroup();Ja=za.getRubberBandBox();da("cleared")};this.linkControlPoints=Ca.linkControlPoints;this.getContentElem=function(){return q};this.getRootElem=function(){return d};this.getSelectedElems=
|
|
function(){return H};var wb=this.getResolution=function(){var g=q.getAttribute("width")/w,h=q.getAttribute("height")/w;return{w:g,h:h,zoom:w}};this.getZoom=function(){return w};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setConfig=function(g){$.extend(l,g)};this.getTitle=function(g){if(g=g||H[0]){g=$(g).data("gsvg")||$(g).data("symbol")||g;g=g.childNodes;for(var h=0;h<g.length;h++)if(g[h].nodeName=="title")return g[h].textContent;return""}};this.setGroupTitle=function(g){var h=
|
|
H[0];h=$(h).data("gsvg")||h;var m=$(h).children("title"),C=new qa("Set Label");if(g.length)if(m.length){m=m[0];C.addSubCommand(new La(m,{"#text":m.textContent}));m.textContent=g}else{m=k.createElementNS(c,"title");m.textContent=g;$(h).prepend(m);C.addSubCommand(new Va(m))}else{C.addSubCommand(new Ua(m[0],m.nextSibling,h));m.remove()}wa(C)};this.getDocumentTitle=function(){return b.getTitle(q)};this.setDocumentTitle=function(g){for(var h=q.childNodes,m=false,C="",A=new qa("Change Image Title"),G=0;G<
|
|
h.length;G++)if(h[G].nodeName=="title"){m=h[G];C=m.textContent;break}if(!m){m=k.createElementNS(c,"title");q.insertBefore(m,q.firstChild)}if(g.length)m.textContent=g;else m.parentNode.removeChild(m);A.addSubCommand(new La(m,{"#text":C}));wa(A)};this.getEditorNS=function(g){g&&q.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var m=wb(),C=m.w;m=m.h;var A;if(g=="fit"){var G=getStrokedBBox();if(G){A=new qa("Fit Canvas to Content");
|
|
var E=Za();ib(E);var v=[],f=[];$.each(E,function(){v.push(G.x*-1);f.push(G.y*-1)});E=b.moveSelectedElements(v,f,true);A.addSubCommand(E);Na();g=Math.round(G.width);h=Math.round(G.height)}else return false}if(g!=C||h!=m){A||(A=new qa("Change Image Dimensions"));g=ua("width",g);h=ua("height",h);q.setAttribute("width",g);q.setAttribute("height",h);this.contentW=g;this.contentH=h;A.addSubCommand(new La(q,{width:C,height:m}));q.setAttribute("viewBox",[0,0,g/w,h/w].join(" "));A.addSubCommand(new La(q,{viewBox:["0 0",
|
|
C,m].join(" ")}));wa(A);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",g+2);background.setAttribute("height",h+2)}da("changed",[q])}return[g,h]};this.getOffset=function(){return $(q).attr(["x","y"])};this.setBBoxZoom=function(g,h,m){var C=0.85,A=function(G){if(!G)return false;var E=Math.min(Math.round(h/G.width*100*C)/100,Math.round(m/G.height*100*C)/100);b.setZoom(E);return{zoom:E,bbox:G}};
|
|
if(typeof g=="object"){g=g;if(g.width==0||g.height==0){b.setZoom(g.zoom?g.zoom:w*g.factor);return{zoom:w,bbox:g}}return A(g)}switch(g){case "selection":if(!H[0])return;g=$.map(H,function(G){if(G)return G});g=getStrokedBBox(g);break;case "canvas":g=wb();C=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=getStrokedBBox();break;case "layer":g=getStrokedBBox(Za(D().getCurrentLayer()));break;default:return}return A(g)};this.setZoom=function(g){var h=wb();q.setAttribute("viewBox","0 0 "+h.w/
|
|
g+" "+h.h/g);w=g;$.each(H,function(m,C){C&&za.requestSelector(C).resize()});Ca.zoomChange();ob("zoomChanged",g)};this.getMode=function(){return xa};this.setMode=function(g){Ca.clear();ab.clear();$("#workarea").attr("class",g);Ta=H[0]&&H[0].nodeName=="text"?Ya:N;xa=g};this.getColor=function(g){return Ta[g]};this.setColor=function(g,h,m){N[g]=h;Ta[g+"_paint"]={type:"solidColor"};for(var C=[],A=H.length;A--;){var G=H[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(E){E.nodeName!="g"&&
|
|
C.push(E)});else if(g=="fill")G.tagName!="polyline"&&G.tagName!="line"&&C.push(G);else C.push(G)}if(C.length>0)if(m)sb(g,h,C);else{$a(g,h,C);da("changed",C)}};var hb=function(){var g=q.getElementsByTagNameNS(c,"defs");if(g.length>0)g=g[0];else{g=k.createElementNS(c,"defs");q.firstChild?q.insertBefore(g,q.firstChild.nextSibling):q.appendChild(g)}return g},Lb=this.setGradient=function(g){if(!(!Ta[g+"_paint"]||Ta[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],m=Hb(h),C=hb();if(m)h=m;else{h=C.appendChild(k.importNode(h,
|
|
true));h.id=V()}b.setColor(g,"url(#"+h.id+")");if(g=="canvas")(g=document.getElementById("canvas_background"))&&g.setAttribute("fill","url(#"+h.id+")")}},Hb=function(g){var h=hb();h=$(h).find("linearGradient, radialGradient");for(var m=h.length,C=["r","cx","cy","fx","fy"];m--;){var A=h[m];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=A.getAttribute("x1")||g.getAttribute("y1")!=A.getAttribute("y1")||g.getAttribute("x2")!=A.getAttribute("x2")||g.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=
|
|
$(g).attr(C),E=$(A).attr(C),v=false;$.each(C,function(F,I){if(G[I]!=E[I])v=true});if(v)continue}var f=g.getElementsByTagNameNS(c,"stop"),s=A.getElementsByTagNameNS(c,"stop");if(f.length==s.length){for(var o=f.length;o--;){var p=f[o],B=s[o];if(p.getAttribute("offset")!=B.getAttribute("offset")||p.getAttribute("stop-opacity")!=B.getAttribute("stop-opacity")||p.getAttribute("stop-color")!=B.getAttribute("stop-color"))break}if(o==-1)return A}}return null};this.setPaint=function(g,h){var m=new $.jGraduate.Paint(h);
|
|
this.setPaintOpacity(g,m.alpha/100,true);Ta[g+"_paint"]=m;switch(m.type){case "solidColor":if(m.solidColor!="none"&&m.solidColor!="#none")this.setColor(g,"#"+m.solidColor);else{this.setColor(g,"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=m[m.type];Lb(g)}};this.getStrokeWidth=function(){return Ta.stroke_width};this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(xa)>=
|
|
0)b.setStrokeWidth(1);else{Ta.stroke_width=g;for(var h=[],m=H.length;m--;){var C=H[m];if(C)C.tagName=="g"?svgedit.utilities.walkTree(C,function(A){A.nodeName!="g"&&h.push(A)}):h.push(C)}if(h.length>0){$a("stroke-width",g,h);da("changed",H)}}};this.setStrokeAttr=function(g,h){N[g.replace("-","_")]=h;for(var m=[],C=H.length;C--;){var A=H[C];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(G){G.nodeName!="g"&&m.push(G)}):m.push(A)}if(m.length>0){$a(g,h,m);da("changed",H)}};this.getStyle=function(){return N};
|
|
this.getOpacity=function(){return N.opacity};this.setOpacity=function(g){N.opacity=g;$a("opacity",g)};this.getFillOpacity=function(){return N.fill_opacity};this.getStrokeOpacity=function(){return N.stroke_opacity};this.setPaintOpacity=function(g,h,m){N[g+"_opacity"]=h;m?sb(g+"-opacity",h):$a(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=oa(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");return h};(function(){function g(){var A=b.undoMgr.finishUndoableChange();
|
|
h.addSubCommand(A);wa(h);m=h=null}var h=null,m=null,C=false;b.setBlurNoUndo=function(A){if(m)if(A===0){sb("filter","");C=true}else{var G=H[0];C&&sb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}sb("stdDeviation",A,[m.firstChild]);b.setBlurOffsets(m,A)}else b.setBlur(A)};b.setBlurOffsets=function(A,G){if(G>3)na(A,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){A.removeAttribute("x");
|
|
A.removeAttribute("y");A.removeAttribute("width");A.removeAttribute("height")}};b.setBlur=function(A,G){if(h)g();else{var E=H[0],v=E.id;m=oa(v+"_blur");A-=0;var f=new qa;if(m){if(A===0)m=null}else{var s=U({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:A}});m=U({element:"filter",attr:{id:v+"_blur"}});m.appendChild(s);hb().appendChild(m);f.addSubCommand(new Va(m))}s={filter:E.getAttribute("filter")};if(A===0){E.removeAttribute("filter");f.addSubCommand(new La(E,s))}else{$a("filter",
|
|
"url(#"+v+"_blur)");f.addSubCommand(new La(E,s));b.setBlurOffsets(m,A);h=f;b.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){b.setBlurNoUndo(A);g()}}}}})();this.getBold=function(){var g=true;H.filter(Boolean).forEach(function(h){if(h.getAttribute("font-weight")!="bold")g=false});return g};this.setBold=function(g){var h=H.filter(Boolean);h.forEach(function(m){if(m!=null&&m.tagName=="text")$a("font-weight",g?"bold":"normal")});h[0].textContent||ab.setCursor()};this.getItalic=
|
|
function(){var g=true;H.filter(Boolean).forEach(function(h){if(h.getAttribute("font-style")!="italic")g=false});return g};this.setItalic=function(g){var h=H.filter(Boolean);h.forEach(function(m){if(m!=null&&m.tagName=="text")$a("font-style",g?"italic":"normal")});h[0].textContent||ab.setCursor()};this.getFontFamily=function(){return Ya.font_family};this.setFontFamily=function(g){Ya.font_family=g;$a("font-family",g);H[0]&&!H[0].textContent&&ab.setCursor()};this.setFontColor=function(g){Ya.fill=g;$a("fill",
|
|
g)};this.getFontSize=function(){return Ya.fill};this.getFontSize=function(){return Ya.font_size};this.setFontSize=function(g){Ya.font_size=g;$a("font-size",g);H[0].textContent||ab.setCursor()};this.getText=function(){var g=H[0];if(g==null)return"";return g.textContent};this.setTextContent=function(g){$a("#text",g);ab.init(g);ab.setCursor()};this.setImageURL=function(g){var h=H[0];if(h){var m=$(h).attr(["width","height"]);m=!m.width||!m.height;var C=la(h);if(C!==g)m=true;else if(!m)return;var A=new qa("Change Image URL");
|
|
Y(h,g);A.addSubCommand(new La(h,{"#href":C}));m?$(new Image).load(function(){var G=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});za.requestSelector(h).resize();A.addSubCommand(new La(h,G));wa(A);da("changed",[h])}).attr("src",g):wa(A)}};this.setLinkURL=function(g){var h=H[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var m=la(h);if(m!==g){var C=new qa("Change Link URL");Y(h,g);C.addSubCommand(new La(h,{"#href":m}));wa(C)}}};this.elementsAreSame=
|
|
function(g){return!g.length||g[0]==null?null:H.every(function(h){return h&&H[0]?h.nodeName==H[0].nodeName:null})};this.setRectRadius=function(g){b.elementsAreSame(H)&&H[0].tagName=="rect"&&H.forEach(function(h){var m=h.getAttribute("rx");if(m!=g){h.setAttribute("rx",g);h.setAttribute("ry",g);wa(new La(h,{rx:m,ry:m},"Radius"));da("changed",[h])}})};this.makeHyperlink=function(g){b.groupSelectedElements("a",g)};this.removeHyperlink=function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ca.setSegType(g)};
|
|
this.convertToPath=function(g,h){if(g==null)$.each(H,function(aa,X){X&&b.convertToPath(X)});else{if(!h)var m=new qa("Convert element to Path");var C=h?{}:{fill:N.fill,"fill-opacity":N.fill_opacity,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,opacity:N.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))C[this]=
|
|
g.getAttribute(this)});var A=U({element:"path",attr:C}),G=g.getAttribute("transform");G&&A.setAttribute("transform",G);var E=g.id,v=g.parentNode;g.nextSibling?v.insertBefore(A,g):v.appendChild(A);var f="",s=function(aa){$.each(aa,function(X,ea){var Q=ea[1];f+=ea[0];for(var ka=0;ka<Q.length;ka+=2)f+=Q[ka]+","+Q[ka+1]+" "})},o=1.81;switch(g.tagName){case "ellipse":case "circle":var p=$(g).attr(["rx","ry","cx","cy"]),B=p.cx,F=p.cy,I=p.rx;p=p.ry;if(g.tagName=="circle")I=p=$(g).attr("r");s([["M",[B-I,
|
|
F]],["C",[B-I,F-p/o,B-I/o,F-p,B,F-p]],["C",[B+I/o,F-p,B+I,F-p/o,B+I,F]],["C",[B+I,F+p/o,B+I/o,F+p,B,F+p]],["C",[B-I/o,F+p,B-I,F+p/o,B-I,F]],["Z",[]]]);break;case "path":f=g.getAttribute("d");break;case "line":p=$(g).attr(["x1","y1","x2","y2"]);f="M"+p.x1+","+p.y1+"L"+p.x2+","+p.y2;break;case "polyline":case "polygon":f="M"+g.getAttribute("points");break;case "rect":p=$(g).attr(["rx","ry"]);I=p.rx;p=p.ry;var J=g.getBBox();B=J.x;F=J.y;var O=J.width;J=J.height;o=4-o;if(!I&&!p)s([["M",[B,F]],["L",[B+
|
|
O,F]],["L",[B+O,F+J]],["L",[B,F+J]],["L",[B,F]],["Z",[]]]);else{p||(p=I);s([["M",[B,F+p]],["C",[B,F+p/o,B+I/o,F,B+I,F]],["L",[B+O-I,F]],["C",[B+O-I/o,F,B+O,F+p/o,B+O,F+p]],["L",[B+O,F+J-p]],["C",[B+O,F+J-p/o,B+O-I/o,F+J,B+O-I,F+J]],["L",[B+I,F+J]],["C",[B+I/o,F+J,B,F+J-p/o,B,F+J-p]],["L",[B,F+p]],["Z",[]]])}break;default:A.parentNode.removeChild(A)}f&&A.setAttribute("d",f);if(h){Ca.resetOrientation(A);m=false;try{m=A.getBBox()}catch(W){}A.parentNode.removeChild(A);return m}else{if(G){G=S(A);ia(G)&&
|
|
Ca.resetOrientation(A)}m.addSubCommand(new Ua(g,g.nextSibling,v));m.addSubCommand(new Va(A));Na();g.parentNode.removeChild(g);A.setAttribute("id",E);A.removeAttribute("visibility");ib([A],true);wa(m)}}};var sb=this.changeSelectedAttributeNoUndo=function(g,h,m){xa=="pathedit"&&Ca.moveNode(g,h);m=m||H;for(var C=m.length,A=["g","polyline","path"];C--;){var G=m[C];if(G!=null){xa==="textedit"&&g!=="#text"&&G.textContent.length&&ab.toSelectMode(G);if((g==="x"||g==="y")&&A.indexOf(G.tagName)>=0){var E=getStrokedBBox([G]);
|
|
b.moveSelectedElements((g==="x"?h-E.x:0)*w,(g==="y"?h-E.y:0)*w,true)}else{E=g==="#text"?G.textContent:G.getAttribute(g);if(E==null)E="";if(E!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(G);G.textContent=h}else g=="#href"?Y(G,h):G.setAttribute(g,h);H.indexOf(G)>=0&&setTimeout(function(){G.parentNode&&za.requestSelector(G).resize()},0);E=pa(G);if(E!=0&&g!="transform")for(var v=S(G),f=v.numberOfItems;f--;)if(v.getItem(f).type==4){v.removeItem(f);var s=svgedit.utilities.getBBox(G),o=M(s.x+s.width/
|
|
2,s.y+s.height/2,ga(v).matrix);s=o.x;o=o.y;var p=d.createSVGTransform();p.setRotate(E,s,o);v.insertItemBefore(p,f);break}}}}}},$a=this.changeSelectedAttribute=function(g,h,m){m=m||H;b.undoMgr.beginUndoableChange(g,m);sb(g,h,m);g=b.undoMgr.finishUndoableChange();g.isEmpty()||wa(g)};this.deleteSelectedElements=function(){for(var g=new qa("Delete Elements"),h=H.length,m=[],C=0;C<h;++C){var A=H[C];if(A==null)break;var G=A.parentNode,E=A;za.releaseSelector(E);svgedit.path.removePath_(E.id);if(G.tagName===
|
|
"a"&&G.childNodes.length===1){E=G;G=G.parentNode}var v=E.nextSibling;E=G.removeChild(E);m.push(A);H[C]=null;g.addSubCommand(new Ua(E,v,G))}g.isEmpty()||wa(g);da("changed",m);Na()};this.cutSelectedElements=function(){for(var g=new qa("Cut Elements"),h=H.length,m=[],C=0;C<h;++C){var A=H[C];if(A==null)break;var G=A.parentNode,E=A;za.releaseSelector(E);svgedit.path.removePath_(E.id);var v=E.nextSibling;E=G.removeChild(E);m.push(A);H[C]=null;g.addSubCommand(new Ua(E,v,G))}g.isEmpty()||wa(g);da("changed",
|
|
m);Na();b.clipBoard=m};this.copySelectedElements=function(){b.clipBoard=$.merge([],H)};this.pasteElements=function(){var g=b.clipBoard,h=g.length;if(h){for(var m=[],C=new qa("Paste elements");h--;){var A=g[h];if(A){var G=lb(A);if(!oa(A.id))G.id=A.id;m.push(G);(K||D().getCurrentLayer()).appendChild(G);C.addSubCommand(new Va(G))}}svgCanvas.clearSelection();setTimeout(function(){mb(m)},100);wa(C);da("changed",m)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";
|
|
var m="";if(arguments.length>1)m=arguments[1];break;default:g="g";h="Group Elements"}h=new qa(h);var C=U({element:g,attr:{id:V()}});g==="a"&&Y(C,m);h.addSubCommand(new Va(C));for(m=H.length;m--;){var A=H[m];if(A!=null){if(A.parentNode.tagName==="a"&&A.parentNode.childNodes.length===1)A=A.parentNode;var G=A.nextSibling,E=A.parentNode;C.appendChild(A);h.addSubCommand(new Ea(A,G,E))}}h.isEmpty()||wa(h);mb([C],true)};var xb=this.pushGroupProperties=function(g,h){var m=g.childNodes,C=m.length,A=g.getAttribute("transform"),
|
|
G=S(g),E=ga(G).matrix,v=new qa("Push group properties"),f=0,s=pa(g),o=$(g).attr(["filter","opacity"]),p,B;for(f=0;f<C;f++){var F=m[f];if(F.nodeType===1){if(o.opacity!==null&&o.opacity!==1){F.getAttribute("opacity");var I=Math.round((F.getAttribute("opacity")||1)*o.opacity*100)/100;$a("opacity",I,[F])}if(o.filter){var J=I=this.getBlur(F);B||(B=this.getBlur(g));if(I)I=B-0+(I-0);else if(I===0)I=B;if(J)p=R(F.getAttribute("filter"));else if(p){p=lb(p);hb().appendChild(p)}else p=R(o.filter);p.id=F.id+"_"+
|
|
(p.firstChild.tagName==="feGaussianBlur"?"blur":"filter");$a("filter","url(#"+p.id+")",[F]);if(I){$a("stdDeviation",I,[p.firstChild]);b.setBlurOffsets(p,I)}}I=S(F);if(~F.tagName.indexOf("Gradient"))I=null;if(I)if(F.tagName!=="defs")if(G.numberOfItems){if(s&&G.numberOfItems==1){var O=G.getItem(0).matrix,W=d.createSVGMatrix();if(J=pa(F))W=I.getItem(0).matrix;var aa=svgedit.utilities.getBBox(F),X=ga(I).matrix,ea=M(aa.x+aa.width/2,aa.y+aa.height/2,X);aa=s+J;X=d.createSVGTransform();X.setRotate(aa,ea.x,
|
|
ea.y);O=T(O,W,X.matrix.inverse());J&&I.removeItem(0);if(aa)I.numberOfItems?I.insertItemBefore(X,0):I.appendItem(X);if(O.e||O.f){J=d.createSVGTransform();J.setTranslate(O.e,O.f);I.numberOfItems?I.insertItemBefore(J,0):I.appendItem(J)}}else{J=F.getAttribute("transform");O={};O.transform=J?J:"";J=d.createSVGTransform();O=ga(I).matrix;W=O.inverse();O=T(W,E,O);J.setMatrix(O);I.appendItem(J)}(F=Wa(F))&&v.addSubCommand(F)}}}if(A){O={};O.transform=A;g.setAttribute("transform","");g.removeAttribute("transform");
|
|
v.addSubCommand(new La(g,O))}if(h&&!v.isEmpty())return v};this.ungroupSelectedElement=function(){var g=H[0];if($(g).data("gsvg")||$(g).data("symbol"))Db(g);else if(g.tagName==="use"){var h=oa(la(g).substr(1));$(g).data("symbol",h).data("ref",h);Db(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName==="g"||g.tagName==="a"){h=new qa("Ungroup Elements");var m=xb(g,true);m&&h.addSubCommand(m);m=g.parentNode;for(var C=g.nextSibling,A=Array(g.childNodes.length),G=0;g.firstChild;){var E=g.firstChild,
|
|
v=E.nextSibling,f=E.parentNode;if(E.tagName==="title"){h.addSubCommand(new Ua(E,E.nextSibling,f));f.removeChild(E)}else{A[G++]=E=m.insertBefore(E,C);h.addSubCommand(new Ea(E,v,f))}}Na();C=g.nextSibling;g=m.removeChild(g);h.addSubCommand(new Ua(g,C,m));h.isEmpty()||wa(h);ib(A)}}};this.moveToTopSelectedElement=function(){var g=H.filter(Boolean).reverse(),h=new qa("Move to top");g.forEach(function(m){m=m;var C=m.parentNode,A=m.nextSibling;m=m.parentNode.appendChild(m);if(A!=m.nextSibling){h.addSubCommand(new Ea(m,
|
|
A,C,"top"));da("changed",[m])}h.isEmpty()||wa(h)})};this.moveToBottomSelectedElement=function(){var g=H.filter(Boolean).reverse(),h=new qa("Move to top");g.forEach(function(m){m=m;var C=m.parentNode,A=m.nextSibling,G=m.parentNode.firstChild;if(G.tagName=="title")G=G.nextSibling;if(G.tagName=="defs")G=G.nextSibling;m=m.parentNode.insertBefore(m,G);if(A!=m.nextSibling){h.addSubCommand(new Ea(m,A,C,"bottom"));da("changed",[m])}});h.isEmpty()||wa(h)};this.moveUpDownSelected=function(g){var h=H.filter(Boolean);
|
|
g=="Down"&&h.reverse();var m=new qa("Move "+g);h.forEach(function(C){Ka=[];var A,G,E=$(db(getStrokedBBox([C]))).toArray();g=="Down"&&E.reverse();$.each(E,function(){if(G){A=this;return false}else if(this==C)G=true});if(A){E=C.parentNode;var v=C.nextSibling;$(A)[g=="Down"?"before":"after"](C);if(v!=C.nextSibling){m.addSubCommand(new Ea(C,v,E,"Move "+g));da("changed",[C])}}});m.isEmpty()||wa(m)};this.moveSelectedElements=function(g,h,m){if(g.constructor!=Array){g/=w;h/=w}m=m||true;for(var C=new qa("position"),
|
|
A=H.length;A--;){var G=H[A];if(G!=null){var E=d.createSVGTransform(),v=S(G);g.constructor==Array?E.setTranslate(g[A],h[A]):E.setTranslate(g,h);v.numberOfItems?v.insertItemBefore(E,0):v.appendItem(E);(E=Wa(G))&&C.addSubCommand(E);za.requestSelector(G).resize()}}if(!C.isEmpty()){m&&wa(C);da("changed",H);return C}};this.cloneSelectedElements=function(g,h,m){for(var C=new qa("Clone Elements"),A=H.length,G=0;G<A;++G){var E=H[G];if(E==null)break}A=H.slice(0,G);this.clearSelection(true);G=A.length;for(clones=
|
|
[];G--;){E=A[G];var v=lb(A[G]),f=K||D().getCurrentLayer();if(m){tlist=S(v);tlist.removeItem(0);Wa(v);f.insertBefore(v,E)}else f.appendChild(v);clones.push(v);C.addSubCommand(new Va(v))}if(!C.isEmpty()){ib(A.reverse());m||this.moveSelectedElements(g,h,false);wa(C)}return clones};this.alignSelectedElements=function(g,h){var m=[],C=Number.MAX_VALUE,A=Number.MIN_VALUE,G=Number.MAX_VALUE,E=Number.MIN_VALUE,v=Number.MIN_VALUE,f=Number.MIN_VALUE,s=H.length;if(s){for(var o=0;o<s;++o){if(H[o]==null)break;
|
|
m[o]=getStrokedBBox([H[o]]);switch(h){case "smallest":if((g=="l"||g=="c"||g=="r")&&(v==Number.MIN_VALUE||v>m[o].width)||(g=="t"||g=="m"||g=="b")&&(f==Number.MIN_VALUE||f>m[o].height)){C=m[o].x;G=m[o].y;A=m[o].x+m[o].width;E=m[o].y+m[o].height;v=m[o].width;f=m[o].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(v==Number.MIN_VALUE||v<m[o].width)||(g=="t"||g=="m"||g=="b")&&(f==Number.MIN_VALUE||f<m[o].height)){C=m[o].x;G=m[o].y;A=m[o].x+m[o].width;E=m[o].y+m[o].height;v=m[o].width;f=m[o].height}break;
|
|
default:if(m[o].x<C)C=m[o].x;if(m[o].y<G)G=m[o].y;if(m[o].x+m[o].width>A)A=m[o].x+m[o].width;if(m[o].y+m[o].height>E)E=m[o].y+m[o].height}}if(h=="page"){G=C=0;A=b.contentW;E=b.contentH}v=Array(s);f=Array(s);for(o=0;o<s;++o){if(H[o]==null)break;var p=m[o];v[o]=0;f[o]=0;switch(g){case "l":v[o]=C-p.x;break;case "c":v[o]=(C+A)/2-(p.x+p.width/2);break;case "r":v[o]=A-(p.x+p.width);break;case "t":f[o]=G-p.y;break;case "m":f[o]=(G+E)/2-(p.y+p.height/2);break;case "b":f[o]=E-(p.y+p.height)}}this.moveSelectedElements(v,
|
|
f)}};this.contentW=wb().w;this.contentH=wb().h;this.updateCanvas=function(g,h){d.setAttribute("width",g);d.setAttribute("height",h);var m=$("#canvasBackground")[0],C=q.getAttribute("x"),A=q.getAttribute("y"),G=g/2-this.contentW*w/2,E=h/2-this.contentH*w/2;na(q,{width:this.contentW*w,height:this.contentH*w,x:G,y:E,viewBox:"0 0 "+this.contentW+" "+this.contentH});na(m,{width:q.getAttribute("width"),height:q.getAttribute("height"),x:G,y:E});(m=oa("background_image"))&&na(m,{width:"100%",height:"100%"});
|
|
za.selectorParentGroup.setAttribute("transform","translate("+G+","+E+")");return{x:G,y:E,old_x:C,old_y:A,d_x:G-C,d_y:E-A}};this.setBackground=function(g,h){var m=oa("canvasBackground"),C=$(m).find("rect")[0],A=oa("background_image");C.setAttribute("fill",g);if(h){if(!A){A=k.createElementNS(c,"image");na(A,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}Y(A,h);m.appendChild(A)}else A&&A.parentNode.removeChild(A)};this.cycleElement=function(g){var h=
|
|
H[0],m=false,C=Za(K||D().getCurrentLayer());if(C.length){if(h==null){g=g?C.length-1:0;m=C[g]}else for(var A=C.length;A--;)if(C[A]==h){g=g?A-1:A+1;if(g>=C.length)g=0;else if(g<0)g=C.length-1;m=C[g];break}mb([m],true);da("selected",H)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:wa,setGradient:Lb,addSvgElementFromJson:U,assignAttributes:na,BatchCommand:qa,call:da,ChangeElementCommand:La,copyElem:lb,ffClone:P,findDefs:hb,findDuplicateGradient:Hb,getElem:oa,getId:ha,getIntersectionList:db,
|
|
getMouseTarget:Cb,getNextId:V,getPathBBox:ca,getUrlFromAttr:ja,hasMatrixTransform:ia,identifyLayers:yb,InsertElementCommand:Va,isIdentity:svgedit.math.isIdentity,logMatrix:Pa,matrixMultiply:T,MoveElementCommand:Ea,preventClickDefault:Bb,recalculateAllSelectedDimensions:ba,recalculateDimensions:Wa,remapElement:Ra,RemoveElementCommand:Ua,removeUnusedDefElems:Kb,round:kb,runExtensions:ob,sanitizeSvg:Ia,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,
|
|
transformListToTransform:ga,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){if(!window.methodDraw)window.methodDraw=function(a){function n(d,q){var z=e.setSvgString(d)!==false;q=q||a.noop;z?q(true):a.alert("Error: Unable to load SVG data",function(){q(false)})}var e,c={},l=false,u={canvas_expansion:1,dimensions:[580,400],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"lib/jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,
|
|
gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"},b={};c.curConfig=u;c.tool_scale=1;c.setConfig=function(d){a.extend(true,u,d);if(d.extensions)u.extensions=d.extensions};c.setCustomHandlers=function(d){c.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();e.open=d.open}if(d.save){c.show_save_warning=false;e.bind("saved",d.save)}d.pngsave&&
|
|
e.bind("exported",d.pngsave)})};c.randomizeIds=function(){e.randomizeIds(arguments)};c.init=function(){(function(){var f=window.opener;if(f)try{var s=f.document.createEvent("Event");s.initEvent("methodDrawReady",true,true);f.document.documentElement.dispatchEvent(s)}catch(o){}})();a("body").toggleClass("touch",svgedit.browser.isTouch());a("#canvas_width").val(u.dimensions[0]);a("#canvas_height").val(u.dimensions[1]);var d=function(){a.each(u.extensions,function(){var f=this;a.getScript(u.extPath+
|
|
f,function(s){if(!s){s=document.createElement("script");s.src=u.extPath+f;document.querySelector("head").appendChild(s)}})})};document.location.protocol==="file:"?setTimeout(d,100):d();a.svgIcons(u.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:u.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png",
|
|
"delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path",
|
|
"#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom",
|
|
"#cur_position":"align","#zoomLabel":"zoom"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var f=
|
|
a("#tools_left");if(f.length!=0){f.offset();f.outerHeight()}a(".tools_flyout").each(function(){var s=a("#"+this.id+"_show"),o=s.attr("data-curopt");if(!s.children("svg, img").length){o=a(o).children().clone();if(o.length){o[0].removeAttribute("style");s.append(o)}}});methodDraw.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(f){a("#base_unit_container").css({top:f.pageY-
|
|
10,left:f.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});c.canvas=e=new a.SvgCanvas(document.getElementById("svgcanvas"),u);c.show_save_warning=false;c.paintBox={fill:null,stroke:null,canvas:null};d=navigator.platform.indexOf("Mac")>=0;var q=navigator.userAgent.indexOf("AppleWebKit")>=
|
|
0,z=d?"meta+":"ctrl+",D=e.pathActions,w=e.undoMgr,K=u.imgPath+"placeholder.svg",L=a("#workarea"),N=a("#cmenu_canvas"),H=1,U="toolbars",S="";d||a(".shortcut").each(function(){var f=a(this).text();a(this).text(f.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var f=a("#dialog_box"),s=a("#dialog_buttons"),o=function(p,B,F,I){a("#dialog_content").html("<p>"+B.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",
|
|
p=="prompt");s.empty();var J=a('<input type="button" value="OK">').appendTo(s);p!="alert"&&a('<input type="button" value="Cancel">').appendTo(s).on("click touchstart",function(){f.hide();F(false)});if(p=="prompt"){var O=a('<input type="text">').prependTo(s);O.val(I||"");O.bind("keydown","return",function(){J.trigger("click touchstart")})}p=="process"&&J.hide();f.show();J.on("click touchstart",function(){f.hide();var W=p=="prompt"?O.val():true;F&&F(W)}).focus();p=="prompt"&&O.focus()};a.alert=function(p,
|
|
B){o("alert",p,B)};a.confirm=function(p,B){o("confirm",p,B)};a.process_cancel=function(p,B){o("process",p,B)};a.prompt=function(p,B,F){o("prompt",p,F,B)}})();var M=function(){var f=a(".tool_button_current");if(f.length&&f[0].id!=="tool_select"){f.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}e.setMode("select")},T=null,ia=false,ga=false,Z="",fa=function(f,s){var o=e.getResolution(),p=L;a("#svgcanvas").position();
|
|
if(p=e.setBBoxZoom(s,p.width()-15,p.height()-15)){var B=p.zoom;p=p.bbox;if(B<0.001)La({value:0.1});else{typeof animatedZoom!="undefined"&&f.cancelAnimationFrame(animatedZoom);var F=Date.now(),I=B-o.zoom;a("#zoom");var J=o.zoom,O=function(){var W=(Date.now()-F)/500;W=Math.pow(W-1,3)+1;e.setZoom(J+I*W);A();if(W<1&&W>-0.9)f.animatedZoom=requestAnimationFrame(O);else{a("#zoom").val(parseInt(B*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(B*100)+"]","#zoom_select").attr("selected",
|
|
"selected")}};O();e.getMode()=="zoom"&&p.width&&M();Db()}}};a("#cur_context_panel").delegate("a","click",function(){var f=a(this);f.attr("data-root")?e.leaveContext():e.setContext(f.text());e.clearSelection();return false});var ua=function(){c.paintBox.fill.prep();c.paintBox.stroke.prep()},ja={},la=function(f){a.each(f,function(s,o){var p=a(s).children(),B=s+"_show",F=a(B),I=false;p.addClass("tool_button").unbind("click mousedown mouseup").each(function(W){var aa=o[W];ja[aa.sel]=aa.fn;if(aa.isDefault)I=
|
|
W;W=function(X){var ea=aa;if(X.type==="keydown"){var Q=a(ea.parent+"_show").hasClass("tool_button_current"),ka=a(ea.parent+"_show").attr("data-curopt");a.each(f[aa.parent],function(ta,Aa){if(Aa.sel==ka)ea=!X.shiftKey||!Q?Aa:f[aa.parent][ta+1]||f[aa.parent][0]})}if(a(this).hasClass("disabled"))return false;qa(B)&&ea.fn();var ra=ea.icon?a.getSvgIcon(ea.icon,true):a(ea.sel).children().eq(0).clone();ra[0].setAttribute("width",F.width());ra[0].setAttribute("height",F.height());F.children(":not(.flyout_arrow_horiz)").remove();
|
|
F.append(ra).attr("data-curopt",ea.sel)};a(this).mouseup(W);aa.key&&a(document).bind("keydown",aa.key[0]+" shift+"+aa.key[0],W)});if(I)F.attr("data-curopt",o[I].sel);else F.attr("data-curopt")||F.attr("data-curopt",o[0].sel);var J,O=a(B).position();a(s).css({left:O.left+34,top:O.top+77});F.mousedown(function(W){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&qa(B,false);if(F.hasClass("disabled"))return false;var aa=a(s),X=O.left+34,ea=aa.width()*
|
|
-1,Q=aa.data("shown_popop")?200:0;J=setTimeout(function(){F.data("isLibrary")?aa.css("left",X).show():aa.css("left",ea).show().animate({left:X},50);aa.data("shown_popop",true)},Q);W.preventDefault()}).mouseup(function(){clearTimeout(J);var W=a(this).attr("data-curopt");if(F.data("isLibrary")&&a(B.replace("_show","")).is(":visible"))qa(B,true);else qa(B)&&W in ja&&ja[W]()})});pa()},Y=function(f,s){return a("<div>",{"class":"tools_flyout",id:f}).appendTo("#svg_editor").append(s)},ca=function(){a(".tools_flyout").each(function(){var f=
|
|
a("#"+this.id+"_show"),s=f.offset();f=f.outerWidth();a(this).css({left:(s.left+f)*H,top:s.top})})},pa=function(){a(".tools_flyout").each(function(){var f=a("#"+this.id+"_show");if(!f.data("isLibrary")){var s=[];a(this).children().each(function(){s.push(this.title)});f[0].title=s.join(" / ")}})},oa,na=function(f,s,o){var p=null;if(f.indexOf("url(#")===0){f=(f=e.getRefElem(f))?f.cloneNode(true):a("#"+o+"_color defs *")[0];p={alpha:s};p[f.tagName]=f}else p=f.indexOf("#")===0?{alpha:s,solidColor:f.substr(1)}:
|
|
{alpha:s,solidColor:"none"};return new a.jGraduate.Paint(p)},ma=e.getResolution();if(u.baseUnit!=="px"){ma.w=svgedit.units.convertUnit(ma.w)+u.baseUnit;ma.h=svgedit.units.convertUnit(ma.h)+u.baseUnit}var Ha=function(f){e.createLayer("background");cur_shape=e.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ma.w+2,height:ma.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:f||"#fff",style:"pointer-events:none"}});e.setCurrentLayer("Layer 1");e.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||
|
|
Ha();document.getElementById("canvas_background").getAttribute("fill");var Ia=c.setImageURL=function(f){f||(f=K);e.setImageURL(f);a("#image_url").val(f)},Ea=function(){var f=T;if(f!=null&&!f.parentNode)f=null;if(ia&&ia[0]!=null&&!ia[0].parentNode)ia=false;var s=e.getCurrentDrawing().getCurrentLayerName(),o=e.getMode(),p=u.baseUnit!=="px"?u.baseUnit:null,B=o=="pathedit";if(B){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();s=D.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
|
|
a("#tool_node_delete").toggleClass("disabled",!D.canDeleteNodes);Jb("#tool_openclose_path",D.closed_subpath?"open_path":"close_path");if(s){B=a("#seg_type");if(p){s.x=svgedit.units.convertUnit(s.x);s.y=svgedit.units.convertUnit(s.y)}a("#path_node_x").val(Math.round(s.x));a("#path_node_y").val(Math.round(s.y));if(s.type){B.val(s.type).removeAttr("disabled");a("#seg_type_label").html(s.type==4?"Straight":"Curve")}else B.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
|
|
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var F=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ia){ia=ia.filter(Boolean);(f=e.elementsAreSame(ia)?ia[0]:null)&&a("#tools_top").addClass("multiselected")}if(!f&&!ia){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(f!=null){a("#stroke_panel").show();var I=f.nodeName,J=e.getRotationAngle(f);
|
|
a("#angle").val(Math.round(J));J=e.getBlur(f);a("#blur").val(J);if(!B&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var O,W;if(["g","polyline","path"].indexOf(I)>=0)if(o=e.getStrokedBBox([f])){O=o.x;W=o.y}if(p){O=svgedit.units.convertUnit(O);W=svgedit.units.convertUnit(W)}a("#"+I+"_x").val(Math.round(O));a("#"+I+"_y").val(Math.round(W));if(I==="polyline"){a("#path_x").val(Math.round(O));a("#path_y").val(Math.round(W))}["image","text","path","g","use"].indexOf(I)==
|
|
-1&&a(".action_path_convert_selected").removeClass("disabled");I==="path"&&a(".action_path_selected").removeClass("disabled")}p=null;if(aa==="a"){p=e.getHref(f);a("#g_panel").show()}if(f.parentNode.tagName==="a")if(!a(f).siblings().length){a("#a_panel").show();p=e.getHref(f.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!p);p&&a("#link_url").val(p);p={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1",
|
|
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var aa=f.tagName;a(f).data("gsvg")&&a("#g_panel").show();if(aa=="path"||aa=="polyline")a("#path_panel").show();if(p[aa]){p=p[aa];a("#"+aa+"_panel").show();aa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(p,function(X,ea){var Q=f.getAttribute(ea);if(u.baseUnit!=="px"&&f[ea])Q=svgedit.units.convertUnit(f[ea].baseVal.value);var ka=document.getElementById(aa+"_"+ea);ka.value=Math.round(Q)||0;ka.getAttribute("data-cursor")===
|
|
"true"&&a.fn.dragInput.updateCursor(ka)});if(aa=="text"){p=f.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",e.getItalic());a("#tool_bold").toggleClass("active",e.getBold());a("#font_family").val(p);a("#font_size").val(f.getAttribute("font-size"));a("#text").val(f.textContent);a("#preview_font").text(p.split(",")[0].replace(/'/g,"")).css("font-family",p);e.addedNew&&setTimeout(function(){a("#text").focus().select()},
|
|
100)}else if(aa=="image")Ia(e.getHref(f));else if(aa==="g"||aa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");e.getTitle()}}F[(aa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");F[(aa==="g"||!ia?"dis":"en")+"ableContextMenuItems"]("#group")}if(ia){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");F.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}f||F.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
|
|
w.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");w.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");e.addedNew=false;if(f&&!B||ia){a("#selLayerNames").removeAttr("disabled").val(s);N.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});e.bind("selected",function(f,s){var o=e.getMode();o==="select"&&
|
|
M();if(o==="pathedit")return Ea();T=s.length==1||s[1]==null?s[0]:null;s=s.filter(Boolean);ia=s.length>=2?s:false;if(e.elementsAreSame(ia))T=ia[0];if(T!=null){a("#multiselected_panel").hide();if(T!=null)switch(T.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var p=T.getElementsByTagName("*"),B=0,F=p.length;B<F;B++){var I=
|
|
p[B].getAttribute("stroke-width");if(B===0)o=I;else if(o!==I)o=null}a("#stroke_width").val(o===null?"0":o);Ea();break;default:a("#stroke_width").val(T.getAttribute("stroke-width")||0);o=T.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);a.fn.dragInput.updateCursor(a("#blur")[0])}if(T!=null){o=(T.getAttribute("opacity")||
|
|
1)*100;a("#group_opacity").val(o);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}ia.length&&a("#tools_top").addClass("multiselected")}else if(ia.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}e.runExtensions("selectedChanged",{elems:s,selectedElement:T,multiselected:ia})});e.bind("transition",function(f,s){var o=e.getMode(),p=
|
|
s[0];if(p){ia=s.length>=2&&s[1]!=null?s:null;if(!ia)switch(o){case "rotate":o=e.getRotationAngle(p);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}e.runExtensions("elementTransition",{elems:s})}});e.bind("changed",function(f,s){var o=e.getMode();o==="select"&&M();for(var p=0;p<s.length;++p){var B=s[p];if(B&&B.tagName==="svg")A();else if(B&&T&&T.parentNode==null)T=B}c.show_save_warning=true;Ea();if(T&&o==="select"){c.paintBox.fill.update();c.paintBox.stroke.update()}e.runExtensions("elementChanged",
|
|
{elems:s})});e.bind("exported",function(f,s){a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var o=a("#export_canvas")[0];o.width=e.contentW;o.height=e.contentH;canvg(o,s.svg,{renderCallback:function(){var p=o.toDataURL("image/png");if(!p)return false;p=svgedit.utilities.dataURItoBlob(p,"image/png");if(f.navigator.msSaveOrOpenBlob)f.navigator.msSaveOrOpenBlob(p,"Method Draw Image");else{var B=document.createElement("a"),F=URL.createObjectURL(p);B.href=F;B.download=
|
|
"Method Draw Image";document.body.appendChild(B);B.click();setTimeout(function(){document.body.removeChild(B);f.URL.revokeObjectURL(F)},0)}}})});e.bind("zoomed",fa);e.bind("contextset",function(f,s){var o="";if(s){var p="";o='<a href="#" data-root="y">'+e.getCurrentDrawing().getCurrentLayerName()+"</a>";a(s).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){p+=" > "+this.id;o+=this!==s?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Z=p}else Z=null;a("#cur_context_panel").toggle(!!s).html(o)});
|
|
e.bind("extension_added",function(f,s){function o(){if(oa){clearTimeout(oa);oa=null}B||(oa=setTimeout(function(){B=true;Lb(b.iconsize)},50))}var p=false,B=false,F=true,I=function(){if(s.callback&&!p&&F){p=true;s.callback()}},J=[];s.context_tools&&a.each(s.context_tools,function(ea,Q){var ka=Q.container_id?' id="'+Q.container_id+'"':"",ra=a("#"+Q.panel);ra.length||(ra=a("<div>",{id:Q.panel}).appendTo("#tools_top").hide());switch(Q.type){case "tool_button":var ta='<div class="tool_button">'+Q.id+"</div>",
|
|
Aa=a(ta).appendTo(ra);Q.events&&a.each(Q.events,function(Ma,fb){a(Aa).bind(Ma,fb)});break;case "select":ta="<label"+ka+'><select id="'+Q.id+'">';a.each(Q.options,function(Ma,fb){ta+='<option value="'+Ma+'"'+(Ma==Q.defval?" selected":"")+">"+fb+"</option>"});ta+="</select></label>";var Oa=a(ta).appendTo(ra).find("select");a.each(Q.events,function(Ma,fb){a(Oa).bind(Ma,fb)});break;case "button-select":ta='<div id="'+Q.id+'" class="dropdown toolset" title="'+Q.title+'"><div id="cur_'+Q.id+'" class="icon_label"></div><button></button></div>';
|
|
ka=a('<ul id="'+Q.id+'_opts"></ul>').appendTo("#option_lists");Q.colnum&&ka.addClass("optcols"+Q.colnum);a(ta).appendTo(ra).children();J.push({elem:"#"+Q.id,list:"#"+Q.id+"_opts",title:Q.title,callback:Q.events.change,cur:"#cur_"+Q.id});break;case "input":ta="<label"+ka+'><span id="'+Q.id+'_label">'+Q.label+':</span><input id="'+Q.id+'" title="'+Q.title+'" size="'+(Q.size||"4")+'" value="'+(Q.defval||"")+'" type="text"/></label>';var Ga=a(ta).appendTo(ra).find("input");Q.spindata&&Ga.SpinButton(Q.spindata);
|
|
Q.events&&a.each(Q.events,function(Ma,fb){Ga.bind(Ma,fb)})}});if(s.buttons){var O={},W={},aa=s.svgicons,X={};a.each(s.buttons,function(ea,Q){for(var ka,ra=Q.id,ta=ea;a("#"+ra).length;)ra=Q.id+"_"+ ++ta;if(aa){O[ra]=Q.icon;ta=Q.svgicon?Q.svgicon:Q.id;if(Q.type=="app_menu")W["#"+ra+" > div"]=ta;else W["#"+ra]=ta}else ka=Q.type=="menu"?"":a('<img src="'+Q.icon+'">');var Aa,Oa;switch(Q.type){case "mode_flyout":case "mode":Aa="tool_button";if(Q.cls)Aa+=" "+Q.cls;Oa="#tools_left";break;case "context":Aa=
|
|
"tool_button";Oa="#"+Q.panel;a(Oa).length||a("<div>",{id:Q.panel}).appendTo("#tools_top");break;case "menu":Aa="menu_item tool_button";Oa="#"+(Q.after||Q.panel);break;case "app_menu":Aa="";Oa=Q.parent||"#main_menu ul";a(Oa).length||a("<div>",{id:Q.panel}).appendTo("#tools_top")}var Ga=a(Q.list||Q.type=="app_menu"?"<li/>":"<div/>").attr("id",ra).attr("title",Q.title).addClass(Aa);if(!Q.includeWith&&!Q.list){if("position"in Q)a(Oa).children().eq(Q.position).before(Ga);else Q.type!="menu"||!Q.after?
|
|
Ga.appendTo(Oa):a(Oa).after(Ga);if(Q.type=="mode_flyout"){ta=a(Ga);Aa=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Ma=ta[0].id.replace("tool_","tools_"),fb=ta.clone().attr("id",Ma+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(fb);Aa=Y(Ma,ta);Aa.data("isLibrary",true);fb.data("isLibrary",true)}W["#"+Ma+"_show"]=Q.id;ra=X["#"+Aa[0].id]=[{sel:"#"+ra,fn:Q.events.click,icon:Q.id,isDefault:true},tb]}else if(Q.type=="app_menu"||Q.type=="menu")Ga.append(Q.title)}else if(Q.list){Ga.addClass("push_button");
|
|
a("#"+Q.list+"_opts").append(Ga);if(Q.isDefault){a("#cur_"+Q.list).append(Ga.children().clone());ta=Q.svgicon?Q.svgicon:Q.id;W["#cur_"+Q.list]=ta}}else if(Q.includeWith){Oa=Q.includeWith;ta=a(Oa.button);Aa=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Ma=ta[0].id.replace("tool_","tools_");fb=ta.clone().attr("id",Ma+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(fb);Aa=Y(Ma,ta)}var tb=m.getButtonData(Oa.button);if(Oa.isDefault)W["#"+Ma+"_show"]=Q.id;ra=X["#"+Aa[0].id]=
|
|
[{sel:"#"+ra,fn:Q.events.click,icon:Q.id,key:Q.key,isDefault:Q.includeWith?Q.includeWith.isDefault:0},tb];Ma="position"in Oa?Oa.position:"last";tb=Aa.children().length;if(!isNaN(Ma)&&Ma>=0&&Ma<tb)Aa.children().eq(Ma).before(Ga);else{Aa.append(Ga);ra.reverse()}}aa||Ga.append(ka);Q.list||a.each(Q.events,function(zb,Ib){if(zb=="click")if(Q.type=="mode"){Q.includeWith?Ga.bind(zb,Ib):Ga.bind(zb,function(){qa(Ga)&&Ib()});if(Q.key){a(document).bind("keydown",Q.key,Ib);Q.title&&Ga.attr("title",Q.title+" ["+
|
|
Q.key+"]")}}else Ga.bind(zb,Ib);else Ga.bind(zb,Ib)});la(X)});a.each(J,function(){va(this.elem,this.list,this.callback,{seticon:true})});if(aa)F=false;a.svgIcons(aa,{w:27,h:27,id_match:false,no_img:!q,fallback:O,placement:W,callback:function(){b.iconsize&&b.iconsize!="m"&&o();F=true;I()}})}I()});e.textActions.setInputElem(a("#text")[0]);var Va='<div class="palette_item transparent" data-rgb="none"></div> <div class="palette_item black" data-rgb="#000000"></div> <div class="palette_item white" data-rgb="#ffffff"></div>';
|
|
["#444444","#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#666666","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#999999","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB",
|
|
"#8391AE","#9A8AAB","#AF84A3","#BF7E96","#C97A86","#CE7975","#CC7C65","#BBBBBB","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#DDDDDD","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(f){Va+='<div class="palette_item" style="background-color: '+
|
|
f+';" data-rgb="'+f+'"></div>'});a("#palette").append(Va);var Ua=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(f){f="rotate("+f+"deg)";Ua.css({"-webkit-transform":f,"-moz-transform":f,"-o-transform":f,"-ms-transform":f,transform:f})};var La=function(f){var s=f.value/100;if(s<0.001)f.value=0.1;else{f=e.getZoom();var o=L;fa(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/f,y:(o[0].scrollTop+o.height()/2)/f,zoom:s},true)}};a("#stroke_style").change(function(){e.setStrokeAttr("stroke-dasharray",
|
|
a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){e.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){e.setFontFamily(this.value)});a("#text").keyup(function(){e.setTextContent(this.value)});changeAttribute=function(f){var s=f.getAttribute("data-attr"),
|
|
o=f.getAttribute("data-multiplier")||1;o=parseFloat(o);o=f.value*o;if(!svgedit.units.isValidUnit(s,o,T)){a.alert("Invalid value given");f.value=T.getAttribute(s);return false}e.changeSelectedAttributeNoUndo(s,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(f){f.preventDefault();if(f.type=="mousedown")picking=true;if(picking){var s=a("#tool_stroke").hasClass("active"),o=s?"stroke":"fill",p=a(this).attr("data-rgb"),
|
|
B=null,F=true;if(f.type=="mousedown")F=false;if(p==="transparent"||p==="initial"||p==="#none"){p="none";B=new a.jGraduate.Paint}else B=new a.jGraduate.Paint({alpha:100,solidColor:p.substr(1)});c.paintBox[o].setPaint(B);if(s){e.setColor("stroke",p,F);p!="none"&&e.getStrokeOpacity()!=1&&e.setPaintOpacity("stroke",1)}else{e.setColor("fill",p,F);p!="none"&&e.getFillOpacity()!=1&&e.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(f){f.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
|
"table-cell");a(this).addClass("expanded");$a()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");$a()});var qa=function(f,s){if(a(f).hasClass("disabled"))return false;if(a(f).parent().hasClass("tools_flyout"))return true;var o=o||"normal";s||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(f).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var f=
|
|
null,s=null,o=L[0],p=false,B=false;a("#svgcanvas").on("mousemove mouseup touchend",function(F){if(p!==false){o.scrollLeft-=F.clientX-f;o.scrollTop-=F.clientY-s;f=F.clientX;s=F.clientY;if(F.type==="mouseup"||F.type==="touchend")p=false;return false}}).on("mousedown touchmove",function(F){if(F.button===1||B===true||F.originalEvent.touches&&F.originalEvent.touches.length>=2){p=true;f=F.clientX;s=F.clientY;return false}});a(window).mouseup(function(){p=false});a(document).bind("keydown","space",function(F){F.preventDefault();
|
|
e.spaceKey=B=true}).bind("keyup","space",function(F){F.preventDefault();e.spaceKey=B=false}).bind("keydown","alt",function(){e.getMode()==="zoom"&&L.addClass("out")}).bind("keyup","alt",function(){e.getMode()==="zoom"&&L.removeClass("out")})})();var wa=a(".menu"),za=function(f){f.target.style.background="#fff";setTimeout(function(){f.target.style.background="#ddd"},50);setTimeout(function(){f.target.style.background="#fff"},150);setTimeout(function(){f.target.style.background="#ddd"},200);setTimeout(function(){f.target.style.background=
|
|
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(f){za(f)});a("svg, body").on("mousedown touchstart",function(f){if(!(f.target.nodeName&&f.target.nodeName.toLowerCase()==="input"))if(!a(f.target).hasClass("menu_title")&&!a(f.target).parent().hasClass("menu_title"))!a(f.target).hasClass("disabled")&&a(f.target).hasClass("menu_item")?za(f):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",
|
|
function(f,s,o,p){if(f.altKey||f.ctrlKey){f.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+p*(f.altKey?10:5))).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");wa.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){wa.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(f,s,o){if(a(f).length!=0){var p=a(f).find("button"),B=a(f).find("ul").attr("id",
|
|
a(f)[0].id+"-list");o||a("#option_lists").append(B);var F=false;o&&a(f).addClass("dropup");B.find("li").bind("mouseup",s);a(window).mouseup(function(){if(!F){p.removeClass("down");B.hide()}F=false});p.bind("mousedown",function(){if(p.hasClass("down")){p.removeClass("down");B.hide()}else{p.addClass("down");if(!o){var I=a(f).offset();B.css({top:I.top,left:I.left-110})}B.show();F=true}}).hover(function(){F=true}).mouseout(function(){F=false})}};var va=function(f,s,o,p){var B=a(f);s=a(s);var F=false,
|
|
I=p.dropUp;I&&a(f).addClass("dropup");s.find("li").bind("mouseup",function(){if(p.seticon){Jb("#cur_"+B[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!F){B.removeClass("down");s.hide();s.css({top:0,left:0})}F=false});s.height();a(f).bind("mousedown",function(){var J=a(f).offset();if(I){J.top-=s.height();J.left+=8}else J.top+=a(f).height();a(s).offset(J);if(B.hasClass("down")){B.removeClass("down");
|
|
s.hide();s.css({top:0,left:0})}else{B.addClass("down");s.show();F=true;return false}}).hover(function(){F=true}).mouseout(function(){F=false});p.multiclick&&s.mousedown(function(){F=true})};a("#font_family_dropdown").change(function(){var f=this.options[this.selectedIndex].value,s=this.options[this.selectedIndex].text;a("#preview_font").html(s).css("font-family",f);a("#font_family").val(f).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var f=this.id.replace("tool_pos",
|
|
"").charAt(0);e.alignSelectedElements(f,"page")})});(function(){var f,s=function(){a(f).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){f=this;U="toolbars";L.mousedown(s)}).blur(function(){U="canvas";L.unbind("mousedown",s);e.getMode()=="textedit"&&a("#text").focus()})})();var ub=function(){qa("#tool_select")&&e.setMode("select")},nb=function(){qa("#tool_fhpath")&&e.setMode("fhpath")},gb=function(){qa("#tool_line")&&e.setMode("line")},Sa=function(){qa("#tool_rect")&&
|
|
e.setMode("rect")},Xa=function(){qa("#tool_ellipse")&&e.setMode("ellipse")},ya=function(){qa("#tool_image")&&e.setMode("image")},sa=function(){qa("#tool_zoom")&&e.setMode("zoom")},Fa=function(){if(qa("#tool_zoom")){Ca();M()}},Qa=function(){qa("#tool_text")&&e.setMode("text")},xa=function(){qa("#tool_path")&&e.setMode("path")},bb=function(){if(T!=null||ia)e.deleteSelectedElements();D.getNodePoint()&&D.deletePathNode()},jb=function(){if(T!=null||ia){Da(a("#edit_menu"));e.cutSelectedElements()}},Ya=
|
|
function(){if(T!=null||ia){Da(a("#edit_menu"));e.copySelectedElements()}},Ta=function(){Da(a("#edit_menu"));var f=e.getZoom(),s=(L[0].scrollLeft+L.width()/2)/f-e.contentW;f=(L[0].scrollTop+L.height()/2)/f-e.contentH;e.pasteElements("point",s,f)},rb=function(){if(T!=null){Da(a("#object_menu"));e.moveToTopSelectedElement()}},Ja=function(){if(T!=null){Da(a("#object_menu"));e.moveToBottomSelectedElement()}},Ka=function(){if(T!=null){Da(a("#object_menu"));e.moveUpDownSelected("Up")}},pb=function(){if(T!=
|
|
null){Da(a("#object_menu"));e.moveUpDownSelected("Down")}},cb=function(f){if(T!=null){Da(a("#object_menu"));e.moveUpDownSelected(f)}},ob=function(){if(T!=null){e.convertToPath();var f=e.getSelectedElems();e.selectorManager.requestSelector(f[0]).reset(f[0]);e.selectorManager.requestSelector(f[0]).selectorRect.setAttribute("display","none");e.setMode("pathedit");D.toEditMode(f[0]);e.clearSelection();Ea()}},kb=function(){T!=null&&D.reorient()},db=function(){if(T!=null||ia)a.prompt("Enter the new hyperlink URL",
|
|
"http://",function(f){f&&e.makeHyperlink(f)})},Za=function(f,s){if(T!=null||ia){if(u.gridSnapping){var o=e.getZoom()*u.snappingStep;f*=o;s*=o}a("input").blur();e.moveSelectedElements(f,s)}},vb=function(){},qb=function(){D.getNodePoint()&&D.clonePathNode()},lb=function(){D.getNodePoint()&&D.deletePathNode()},ha=function(){var f=a("#tool_add_subpath"),s=!f.hasClass("push_button_pressed");s?f.addClass("push_button_pressed").removeClass("tool_button"):f.removeClass("push_button_pressed").addClass("tool_button");
|
|
D.addSubPath(s)},V=function(){D.opencloseSubPath()},da=function(){e.cycleElement(1)},R=function(){e.cycleElement(0)},P=function(f,s){if(!(T==null||ia)){f||(s*=-1);var o=a("#angle").val()*1+s;e.setRotationAngle(o);Ea()}},ba=function(){var f=u.dimensions;a.confirm("<strong>Do you want to clear the drawing?</strong>\nThis will also erase your undo history",function(s){if(s){M();e.deleteSelectedElements();e.clear();e.setResolution(f[0],f[1]);A(true);Ha();Ca();Ea();ua();e.runExtensions("onNewDocument")}})},
|
|
Ba=function(){e.setBold(!e.getBold());Ea()},Pa=function(){e.setItalic(!e.getItalic());Ea()},Ra=function(){window.canvg?e.rasterExport():a.getScript("/lib/canvg/rgbcolor.js",function(){a.getScript("/lib/canvg/canvg.js",function(){e.rasterExport()})})},eb=function(){e.open()},Wa=function(){},Da=function(f){var s=f.prev();s.css({background:"white",color:"black"});setTimeout(function(){s.removeAttr("style")},200)},Na=function(){if(w.getUndoStackSize()>0){Da(a("#edit_menu"));w.undo()}},ib=function(){if(w.getRedoStackSize()>
|
|
0){Da(a("#edit_menu"));w.redo()}},mb=function(){if(ia){Da(a("#object_menu"));e.groupSelectedElements()}else if(T){Da(a("#object_menu"));e.ungroupSelectedElement()}},Cb=function(){Da(a("#edit_menu"));e.cloneSelectedElements(20,20)},Bb=function(){var f=this.id.replace("tool_align","").charAt(0);e.alignSelectedElements(f,a("#align_relative_to").val())},ab=function(){var f=document.querySelector("#tool_stroke rect");a("#tool_stroke").toggleClass("active");a("#tool_fill").toggleClass("active");var s=document.querySelector("#tool_fill rect"),
|
|
o=s.getAttribute("fill"),p=f.getAttribute("fill");f=parseFloat(f.getAttribute("stroke-opacity"));if(isNaN(f))f=100;s=parseFloat(s.getAttribute("fill-opacity"));if(isNaN(s))s=100;p=na(p,f,"stroke");o=na(o,s,"fill");c.paintBox.fill.setPaint(p,true);c.paintBox.stroke.setPaint(o,true)},Ca=function(f){var s=e.getResolution();f=f?s.zoom*f:1;a("#zoom").val(f*100);e.setZoom(f);Db();A(true)},Kb=function(){Da(a("#view_menu"));!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
|
|
a("#tool_wireframe").removeClass("push_button_pressed");L.toggleClass("wireframe");if(!g){var f=a("#wireframe_rules");f.length?f.empty():a('<style id="wireframe_rules"></style>').appendTo("head");Db()}},Fb=function(){Da(a("#view_menu"));var f=!a("#tool_snap").hasClass("push_button_pressed");f?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");u.gridSnapping=f},Eb=function(){window.self!=window.top&&top.exit_fullscreen()},Gb=function(){Da(a("#view_menu"));
|
|
if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);u.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);u.showRulers=true}a("#rulers").toggle(!!u.showRulers)},Db=function(){if(!g){var f="#workarea.wireframe #svgcontent * { stroke-width: "+1/e.getZoom()+"px; }";a("#wireframe_rules").text(L.hasClass("wireframe")?f:"")}},yb=function(f,s){if(!ga){Da(a("#view_menu"));
|
|
ga=true;a("#save_output_btns").toggle(!!s);a("#tool_source_back").toggle(!s);var o=S=e.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Ab=function(){if(ga){if(e.setSvgString(a("#svg_source_textarea").val())){e.clearSelection();sb();Ca();ua()}else a.confirm("There were parsing errors in your SVG source.\nRevert back to original SVG source?",function(f){if(!f)return false;e.clearSelection();sb();Ca();ua()});M()}},Jb=c.setIcon=
|
|
function(f,s){var o=typeof s==="string"?a.getSvgIcon(s,true):s.clone();o?a(f).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+s)},wb;wb=function(){var f=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,s=document.getElementsByTagName("script")[0],o;for(o in s.style)if(f.test(o))return o.match(f)[0];if("WebkitOpacity"in s.style)return"Webkit";if("KhtmlOpacity"in s.style)return"Khtml";return""}();var hb=function(f,s){wb.toLowerCase();var o=["top","left","bottom","right"];f.each(function(){for(var p=
|
|
a(this),B=p.outerWidth()*(s-1),F=p.outerHeight()*(s-1),I=0;I<4;I++){var J=o[I],O=p.data("orig_margin-"+J);if(O==null){O=parseInt(p.css("margin-"+J));p.data("orig_margin-"+J,O)}O=O*s;if(J==="right")O+=B;else if(J==="bottom")O+=F;p.css("margin-"+J,O)}})},Lb=c.setIconSize=function(f,s){if(!(f==b.size&&!s)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *, #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *, #g_panel > *, #tool_font_size > *, .tools_flyout"),
|
|
p=1;p=typeof f=="number"?f:{s:0.75,m:1,l:1.25,xl:1.5}[f];c.tool_scale=H=p;ca();var B=o.parents(":hidden");B.css("visibility","hidden").show();hb(o,p);B.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(f!="m"){var F="";a.each(cssResizeRules,function(I,J){I="#svg_editor "+I.replace(/,/g,", #svg_editor");F+=I+"{";a.each(J,function(O,W){if(typeof W==="number")var aa=W*p+"px";else if(W[f]||W.all)aa=W[f]||
|
|
W.all;F+=O+":"+aa+";"});F+="}"});B="-"+wb.toLowerCase()+"-";F+="#tools_top .toolset, #editor_panel > *, #history_panel > *, #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *, #g_panel > *, #tool_font_size > *, .tools_flyout{"+B+"transform: scale("+p+");} #svg_editor div.toolset .toolset {"+B+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+B+"transform: scale("+1/p+");}";o.text(F)}ca()}},Hb=function(){a("#dialog_box").hide();if(ga){if(ga)S!==
|
|
a("#svg_source_textarea").val()?a.confirm("Ignore changes made to SVG source?",function(f){f&&sb()}):sb();$a()}else Z&&e.leaveContext()},sb=function(){a("#svg_source_editor").hide();ga=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var $a=a.noop;a(window).resize(function(){A()});(function(){L.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=L[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=L[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
|
|
a("#change_image_url").click(function(){var f=e.getHref(T);f=f.indexOf("data:")===0?"":f;a.prompt("Enter the new image URL",f,function(s){s&&Ia(s)})});var xb=function(f){var s=f[0].id=="stroke_color"?"stroke":"fill",o=f[0].id=="canvas_color";if(o)s="canvas";var p=c.paintBox[s].paint;f=s=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
|
|
containment:"window"}).removeAttr("style").css(o).jGraduate({paint:p,window:{pickerTitle:f},images:{clientPath:u.jGraduatePath},newstop:"inverse"},function(B){p=new a.jGraduate.Paint(B);c.paintBox[s].setPaint(p);e.setPaint(s,p);a("#color_picker").hide()},function(){a("#color_picker").hide()})};d=function(f,s){var o=document.getElementById("canvas_background"),p={color:"fff",opacity:1};if(s=="stroke")p=u.initStroke;if(s=="fill")p=u.initFill;if(s=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))p=
|
|
{color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="#'+p.color+'" opacity="'+p.opacity+'"/> <defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(f)[0].appendChild(document.importNode(o,true));s==="canvas"?o.setAttribute("width",60.5):
|
|
o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:p.color});this.type=s;this.setPaint=function(B,F){this.paint=B;var I="none",J=B.type,O=B.alpha/100;switch(J){case "solidColor":I=B[J]=="none"||B[J]=="one"?"none":"#"+B[J];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(B[J]);I="url(#"+(this.grad.id="gradbox_"+
|
|
this.type)+")"}this.rect.setAttribute("fill",I);this.rect.setAttribute("opacity",O);if(this.type=="canvas")if(J=document.getElementById("canvas_background")){ma=e.getResolution();J.setAttribute("x",-1);J.setAttribute("y",-1);J.setAttribute("width",ma.w+2);J.setAttribute("height",ma.h+2);I.indexOf("url")==-1&&J.setAttribute("fill",I)}else Ha(I);if(F){e.setColor(this.type,I,true);e.setPaintOpacity(this.type,O,true)}};this.update=function(B){if(T){var F=this.type;switch(T.tagName){case "use":case "image":case "foreignObject":return;
|
|
case "g":case "a":for(var I=null,J=T.getElementsByTagName("*"),O=0,W=J.length;O<W;O++){var aa=J[O].getAttribute(F);if(O===0)I=aa;else if(I!==aa){I=null;break}}if(I===null){J=null;return}J=I;I=1;break;default:I=parseFloat(T.getAttribute(F+"-opacity"));if(isNaN(I))I=1;J=F==="fill"?"black":"none";J=T.getAttribute(F)||J}if(B){e.setColor(F,J,true);e.setPaintOpacity(F,I,true)}I*=100;this.setPaint(na(J,I,F))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var B=
|
|
new a.jGraduate.Paint({copy:this.paint});e.setPaint(s,B)}}};c.paintBox.fill=new d("#fill_color","fill");c.paintBox.stroke=new d("#stroke_color","stroke");c.paintBox.canvas=new d("#canvas_color","canvas");a("#stroke_width").val(u.initStroke.width);a("#group_opacity").val(u.initOpacity*100);d=c.paintBox.fill.rect.cloneNode(false);d.setAttribute("style","vector-effect:non-scaling-stroke");var g=d.style.vectorEffect==="non-scaling-stroke";d.removeAttribute("style");d=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
|
|
"feGaussianBlur");typeof d.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(d).remove();setTimeout(function(){e.embedImage("images/placeholder.svg",function(f){if(!f){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title","Feature not supported")}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))xb(a("#fill_color"));else{a("#tool_fill").addClass("active");
|
|
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))xb(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){xb(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");xb(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
|
|
a("#tool_stroke").removeClass("active");xb(a("#fill_color"))});a("#zoom_select").on("change",function(){var f=this.options[this.selectedIndex].text;f=f.split("%")[0];a("#zoom").val(f).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});
|
|
a(window).bind("load resize",function(){L.css("line-height",L.height()+"px")});var h=function(){var f=a("#canvas_width"),s=a("#canvas_height"),o=f.val(),p=s.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert("Invalid value given");f.parent().addClass("error");return false}f.parent().removeClass("error");if(p!="fit"&&!svgedit.units.isValidUnit("height",p)){a.alert("Invalid value given");s.parent().addClass("error");return false}s.parent().removeClass("error");if(!e.setResolution(o,p)){a.alert("No content to fit to");
|
|
o=e.getResolution();f.val(o.w);s.val(o.h);return false}A()};a("#resolution").change(function(){var f=a("#canvas_width")[0],s=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){f.value="fit";s.value="fit";h();var o=e.getResolution();f.value=o.w;s.value=o.h}else{var p=this.value.split("x");p[0]=parseInt(p[0]);p[1]=parseInt(p[1]);var B=p[0]-f.value,F=p[1]-s.value,I=Date.now(),J=function(){var O=(Date.now()-I)/1E3;O=Math.pow(O-1,3)+1;f.value=(p[0]-B+O*B).toFixed(0);s.value=(p[1]-F+
|
|
O*F).toFixed(0);h();if(O>=1){O=e.getResolution();a("#canvas_width").val(O.w.toFixed());a("#canvas_height").val(O.h.toFixed());a("#resolution_label").html("<div class='pull'>"+O.w+"<span>\u00d7</span></br>"+O.h+"</div>")}else requestAnimationFrame(J)};J()}else{a("#resolution_label").html("Custom");f.removeAttribute("readonly");f.focus();f.select();if(f.value=="fit"){f.value=100;s.value=100}}});a("#zoom").change(function(){La(this)});a("input,select").attr("autocomplete","off");var m=function(){var f=
|
|
[{sel:"#tool_select",fn:ub,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:nb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:gb,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Sa,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Xa,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:xa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Qa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:ya,evt:"mouseup"},{sel:"#tool_zoom",fn:sa,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
|
|
fn:ba,evt:"mouseup",key:[z+"N",true]},{sel:"#tool_save",fn:function(){if(ga)Ab();else{Da(a("#file_menu"));e.save({images:b.img_save,round_digits:6})}},evt:"mouseup",key:[z+"S",true]},{sel:"#tool_export",fn:Ra,evt:"mouseup"},{sel:"#tool_open",fn:eb,evt:"mouseup"},{sel:"#tool_import",fn:Wa,evt:"mouseup"},{sel:"#tool_source",fn:yb,evt:"click",key:[z+"U",true]},{sel:"#tool_wireframe",fn:Kb,evt:"click"},{sel:"#tool_snap",fn:Fb,evt:"click"},{sel:"#tool_rulers",fn:Gb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
|
|
fn:Hb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Ab,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:bb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:kb,evt:"click"},{sel:"#tool_node_link",fn:vb,evt:"change"},{sel:"#tool_node_clone",fn:qb,evt:"click"},{sel:"#tool_node_delete",fn:lb,evt:"click"},{sel:"#tool_openclose_path",fn:V,evt:"click"},{sel:"#tool_add_subpath",fn:ha,evt:"click"},{sel:"#tool_move_top",fn:rb,evt:"click",key:z+"shift+up"},
|
|
{sel:"#tool_move_bottom",fn:Ja,evt:"click",key:z+"shift+down"},{sel:"#tool_move_up",fn:Ka,evt:"click",key:[z+"up",true]},{sel:"#tool_move_down",fn:pb,evt:"click",key:[z+"down",true]},{sel:"#tool_topath",fn:ob,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:db,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Cb,evt:"click",key:[z+"D",true]},{sel:"#tool_group",fn:mb,evt:"click",key:[z+"G",true]},{sel:"#tool_ungroup",fn:mb,evt:"click",key:z+"shift+G"},{sel:"#tool_unlink_use",fn:mb,evt:"click"},
|
|
{sel:"[id^=tool_align]",fn:Bb,evt:"click"},{sel:"#tool_undo",fn:Na,evt:"click",key:z+"z"},{sel:"#tool_redo",fn:ib,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:jb,evt:"click",key:[z+"x",true]},{sel:"#tool_copy",fn:Ya,evt:"click",key:z+"c"},{sel:"#tool_paste",fn:Ta,evt:"click",key:z+"v"},{sel:"#tool_switch",fn:ab,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Ba,evt:"mousedown",key:[z+"B",true]},{sel:"#tool_italic",fn:Pa,evt:"mousedown",key:[z+"I",true]},{sel:"#copy_save_done",fn:Hb,evt:"click"},
|
|
{key:"ctrl+left",fn:function(){P(0,1)}},{key:"ctrl+right",fn:function(){P(1,1)}},{key:"ctrl+shift+left",fn:function(){P(0,5)}},{key:"ctrl+shift+right",fn:function(){P(1,5)}},{key:"shift+O",fn:R},{key:"shift+P",fn:da},{key:[z+"+",true],fn:function(){Ca(2)}},{key:[z+"-",true],fn:function(){Ca(0.5)}},{key:["up",true],fn:function(){Za(0,-1)}},{key:["down",true],fn:function(){Za(0,1)}},{key:["left",true],fn:function(){Za(-1,0)}},{key:["right",true],fn:function(){Za(1,0)}},{key:"shift+up",fn:function(){Za(0,
|
|
-10)}},{key:"shift+down",fn:function(){Za(0,10)}},{key:"shift+left",fn:function(){Za(-10,0)}},{key:"shift+right",fn:function(){Za(10,0)}},{key:["alt+up",true],fn:function(){e.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){e.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){e.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){e.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){e.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",
|
|
true],fn:function(){e.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){e.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){e.cloneSelectedElements(10,0)}},{key:z+"A",fn:function(){e.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}e.setMode("eyedropper")}},
|
|
{key:z+"shift+z",fn:ib},{key:"esc",fn:Eb}],s={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(f,function(p,B){if(B.sel){var F=a(B.sel);if(F.length==0)return true;if(B.evt){if(svgedit.browser.isTouch()&&B.evt==="click")B.evt="mousedown";F[B.evt](B.fn)}if(B.parent&&a(B.parent+"_show").length!=0){var I=a(B.parent);I.length||(I=Y(B.parent.substr(1)));I.append(F);a.isArray(o[B.parent])||(o[B.parent]=[]);o[B.parent].push(B)}}if(B.key){var J=B.fn,
|
|
O=false;if(a.isArray(B.key)){I=B.key[0];if(B.key.length>1)O=B.key[1]}else I=B.key;I+="";svgedit.browser.isMac&&I.indexOf("+")!=-1&&I.split("+")[0]=="ctrl"&&I.replace("ctrl","cmd");a.each(I.split("/"),function(aa,X){a(document).bind("keydown",X,function(ea){J();O&&ea.preventDefault();return false})});if(B.sel&&!B.hidekey&&F.attr("title")){var W=F.attr("title").split("[")[0]+" ("+I+")";s[I]=B.sel;F.parents("#main_menu").length||F.attr("title",W)}}});la(o);a(window).bind("keydown","tab",function(p){if(U===
|
|
"canvas"){p.preventDefault();da()}}).bind("keydown","shift+tab",function(p){if(U==="canvas"){p.preventDefault();R()}});a("#tool_zoom").dblclick(Fa)},setTitles:function(){a.each(s,function(o,p){var B=a(p).parents("#main_menu").length;a(p).each(function(){var F=B?a(this).text().split(" [")[0]:this.title.split(" [")[0],I="";a.each(o.split("/"),function(J,O){var W=O.split("+"),aa="";if(W.length>1){aa=W[0]+"+";O=W[1]}I+=(J?"/":"")+aa+O});if(B)this.lastChild.textContent=F+" ["+I+"]";else this.title=F+" ["+
|
|
I+"]"})})},getButtonData:function(o){var p;a.each(f,function(B,F){if(F.sel===o)p=F});return p}}}();m.setAll();c.ready(function(){var f=u.initTool,s=a("#tools_left, #svg_editor .tools_flyout"),o=s.find("#tool_"+f);f=s.find("#"+f);(o.length?o:f.length?f:a("#tool_select")).click().mouseup();u.wireframe&&a("#tool_wireframe").click();u.showlayers&&toggleSidePanel();a("#rulers").toggle(!!u.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:h,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,
|
|
max:null,step:10,callback:h,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
|
|
a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,
|
|
cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,
|
|
max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
|
|
a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,
|
|
cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(f){var s=f.value;if(s==0&&T&&["line","polyline"].indexOf(T.nodeName)>=0)s=f.value=1;e.setStrokeWidth(s)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,
|
|
max:180,step:1,callback:function(f){e.setRotationAngle(f.value,true);rotateCursor(f.value);a("#tool_reorient").toggleClass("disabled",f.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(f){e.setFontSize(f.value)},cursor:true,stepfunc:function(f,s){var o=f.value-0,p=o+s,B=p>=o;if(s===0)return o;return o>=24?B?Math.round(o*1.1):Math.round(o/1.1):o<=1?B?o*2:o/2:p},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,
|
|
cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(f,s){val=f.value;a("#blur").val(val);s?e.setBlur(val,true):e.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(e.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(f){switch(f){case "delete":bb();break;case "cut":jb();break;case "copy":Ya();break;case "paste":e.pasteElements();break;case "paste_in_place":e.pasteElements("in_place");break;case "group":e.groupSelectedElements();
|
|
break;case "ungroup":e.ungroupSelectedElement();break;case "move_front":rb();break;case "move_up":cb("Up");break;case "move_down":cb("Down");break;case "move_back":Ja();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(f)&&svgedit.contextmenu.getCustomHandler(f).call()}});a(".contextMenu li").mousedown(function(f){f.preventDefault()});a("#cmenu_canvas li").disableContextMenu();N.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(w.getUndoStackSize()===
|
|
0)c.show_save_warning=false;if(!u.no_save_warning&&c.show_save_warning)return"There are unsaved changes."};c.openPrep=function(f){a("#main_menu").hide();w.getUndoStackSize()===0?f(true):a.confirm("Do you want to open a new file?\nThis will also erase your undo history",f)};if(window.FileReader){d=function(f){f.stopPropagation();f.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var s=null;if(s=f.type=="drop"?f.dataTransfer.files[0]:this.files[0])if(s.type.indexOf("image")!=
|
|
-1)if(s.type.indexOf("svg")!=-1){f=new FileReader;f.onloadend=function(o){e.importSvgString(o.target.result,true);e.ungroupSelectedElement();e.ungroupSelectedElement();e.groupSelectedElements();e.alignSelectedElements("m","page");e.alignSelectedElements("c","page")};f.readAsText(s)}else{f=new FileReader;f.onloadend=function(o){insertNewImage=function(I,J){var O=e.addSvgElementFromJson({element:"image",attr:{x:0,y:0,width:I,height:J,id:e.getNextId(),style:"pointer-events:inherit"}});e.setHref(O,o.target.result);
|
|
e.selectOnly([O]);e.alignSelectedElements("m","page");e.alignSelectedElements("c","page");Ea()};var p=100,B=100,F=new Image;F.src=o.target.result;document.body.appendChild(F);F.onload=function(){p=F.offsetWidth;B=F.offsetHeight;insertNewImage(p,B);document.body.removeChild(F)}};f.readAsDataURL(s)}};L=a("#workarea");L[0].addEventListener("dragenter",function(f){f.stopPropagation();f.preventDefault();L.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)",
|
|
"-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);L[0].addEventListener("dragover",function(f){f.stopPropagation();f.preventDefault()},false);L[0].addEventListener("dragleave",function(f){L.removeAttr("style");f.stopPropagation();f.preventDefault()},false);L[0].addEventListener("drop",d,false);var C=a('<input type="file">').change(function(){var f=this;c.openPrep(function(s){if(s){e.clear();if(f.files.length==1){s=new FileReader;s.onloadend=function(o){n(o.target.result);
|
|
A()};s.readAsText(f.files[0])}}})});a("#tool_open").show().prepend(C);d=a('<input type="file">').change(d);a("#tool_import").show().prepend(d)}var A=c.updateCanvas=function(f,s){var o=L.width(),p=L.height(),B=o,F=p,I=e.getZoom(),J=L,O=a("#svgcanvas"),W={x:J[0].scrollLeft+B/2,y:J[0].scrollTop+F/2},aa=u.canvas_expansion;o=Math.max(B,e.contentW*I*aa);p=Math.max(F,e.contentH*I*aa);o==B&&p==F?L.css("overflow","hidden"):L.css("overflow","scroll");aa=O.height()/2;var X=O.width()/2;O.width(o).height(p);var ea=
|
|
p/2,Q=o/2,ka=e.updateCanvas(o,p),ra=Q/X;o=o/2-B/2;p=p/2-F/2;if(s){s.x+=ka.x;s.y+=ka.y}else s={x:Q+(W.x-X)*ra,y:ea+(W.y-aa)*ra};if(f)if(e.contentW>J.width()){L[0].scrollLeft=ka.x-10;L[0].scrollTop=ka.y-10}else{J[0].scrollLeft=o;J[0].scrollTop=p}else{J[0].scrollLeft=s.x-B/2;J[0].scrollTop=s.y-F/2}if(u.showRulers){B=O;I=I;document.getElementById("workarea");document.getElementById("title_show");I||(I=e.getZoom());B||(B=a("#svgcanvas"));F=e.getContentElem();J=svgedit.units.getTypeMap()[u.baseUnit];for(O=
|
|
0;O<2;O++){X=(W=O===0)?"x":"y";ra=W?"width":"height";aa=F.getAttribute(X)-0;X=a("#ruler_"+X+" canvas:first");$hcanv=X.clone();X.replaceWith($hcanv);o=$hcanv[0];ea=X=B[ra]()*2;o.parentNode.style[ra]=ea+"px";Q=0;var ta;ka=o.getContext("2d");ka.fillStyle="rgb(200,0,0)";ka.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(X>=3E4){var Aa=parseInt(X/3E4)+1;ta=Array(Aa);ta[0]=ka;for(p=1;p<Aa;p++){o[ra]=3E4;var Oa=o.cloneNode(true);o.parentNode.appendChild(Oa);ta[p]=Oa.getContext("2d")}Oa[ra]=
|
|
X%3E4;X=3E4}o[ra]=X;ra=J*I;var Ga=50/ra;o=1;for(p=0;p<G.length;p++){o=Aa=G[p];if(Ga<=Aa)break}Ga=o*ra;ka.font="normal 9px 'Lucida Grande', sans-serif";ka.fillStyle="#777";for(var Ma=aa/ra%o*ra,fb=Ma-Ga;Ma<ea;Ma+=Ga){fb+=Ga;p=Math.round(Ma)+0.5;if(W){ka.moveTo(p,15);ka.lineTo(p,0)}else{ka.moveTo(15,p);ka.lineTo(0,p)}Aa=(fb-aa)/ra;if(o>=1)p=Math.round(Aa);else{p=(o+"").split(".")[1].length;p=Aa.toFixed(p)-0}if(p!==0&&p!==1E3&&p%1E3===0)p=p/1E3+"K";if(W){ka.fillText(p,Ma+2,8);ka.fillStyle="#777"}else{Aa=
|
|
(p+"").split("");for(p=0;p<Aa.length;p++){ka.fillText(Aa[p],1,Ma+9+p*9);ka.fillStyle="#777"}}Aa=Ga/10;for(p=1;p<10;p++){var tb=Math.round(Ma+Aa*p)+0.5;if(ta&&tb>X){Q++;ka.stroke();if(Q>=ta.length){p=10;Ma=ea;continue}ka=ta[Q];Ma-=3E4;tb=Math.round(Ma+Aa*p)+0.5}var zb=p%2?12:10;if(W){ka.moveTo(tb,15);ka.lineTo(tb,zb)}else{ka.moveTo(15,tb);ka.lineTo(zb,tb)}}}ka.strokeStyle="#666";ka.stroke()}L.scroll()}},G=[];for(d=0.1;d<1E5;d*=10){G.push(1*d);G.push(2*d);G.push(5*d)}A(true);try{var E=function(f){if(window.JSON&&
|
|
JSON.stringify)return JSON.stringify(f);var s=arguments.callee;if(typeof f=="boolean"||typeof f=="number")return f+"";else if(typeof f=="string")return'"'+f.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(B){return"\\u"+("0000"+B.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(f.length){for(var o=0;o<f.length;o++)f[o]=s(f[o]);return"["+f.join(",")+"]"}else{o=[];for(var p in f)o.push(s(p)+":"+s(f[p]));return"{"+
|
|
o.join(",")+"}"}};window.addEventListener("message",function(f){var s=parseInt(f.data.substr(0,f.data.indexOf(";")));try{f.source.postMessage("SVGe"+s+";"+E(eval(f.data)),"*")}catch(o){f.source.postMessage("SVGe"+s+";error:"+o.message,"*")}},false)}catch(v){window.embed_error=v}a(function(){window.svgCanvas=e;e.ready=methodDraw.ready});c.setLang=function(f,s){a.pref("lang",f);a("#lang_select").val(f);if(s){e.runExtensions("langChanged",f);pa();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block",
|
|
"#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(o,p){a(p).attr("title",a(o)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var k=[];c.ready=function(d){l?d():k.push(d)};c.runCallbacks=function(){a.each(k,function(){this()});l=true};c.loadFromString=function(d){c.ready(function(){n(d)})};c.loadFromURL=function(d,q){q||(q={});var z=
|
|
q.cache,D=q.callback;c.ready(function(){a.ajax({url:d,dataType:"text",cache:!!z,success:function(w){n(w,D)},error:function(w,K,L){w.status!=404&&w.responseText?n(w.responseText,D):a.alert("Unable to load from URL: \n"+L+"",D)}})})};c.loadFromDataURI=function(d){c.ready(function(){var q=d.substring(26);n(svgedit.utilities.decode64(q))})};c.addExtension=function(){var d=arguments;a(function(){e&&e.addExtension.apply(this,d)})};return c}(jQuery);$(methodDraw.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
|
|
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var n=this.dragCfg.dragAdjust,e=$(this).parent(),c=$(this),l=this.dragCfg.height,u=this.dragCfg.min,b=this.dragCfg.max,k=this.dragCfg.step,d=b-u>0?(b-u)/k:200,q=d/l*k,z=0,D=this.getAttribute("data-attr"),w=methodDraw.canvas,K=svgedit.browser.isTouch(),L=true,N=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(e):false;c.attr("readonly","readonly");N&&!isNaN(this.dragCfg.start)&&N.css("top",this.dragCfg.start*-1/q+l);this.adjustValue=
|
|
function(H,U){var S;H=parseFloat(H);S=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,H):Number((Number(this.value)+Number(H)).toFixed(5));if(b!==null)S=Math.min(S,b);if(u!==null)S=Math.max(S,u);N&&this.updateCursor(S);this.value=S;e.attr("data-value",S);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,U)};e.toggleClass("draginput",e.is("label"));this.move=function(H,U,S){if(K)H=H.originalEvent.touches[0];if(z===0)z=U;U=(H.pageY-z)*
|
|
-1;z=H.pageY;S=U*q*n;this.adjustValue(S.toFixed(k<1?1:0))};this.stop=function(){var H=w.getSelectedElems();$("body").removeClass("dragging");e.removeClass("active");L=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");z=0;if(H[0]){H=w.undoMgr.finishUndoableChange();H.isEmpty()||w.undoMgr.addCommandToHistory(H)}this.adjustValue(0,L)};this.updateCursor=function(){var H=parseFloat(this.value)*-1/q+l;N.css("top",H)};this.launch=function(H){var U=w.getSelectedElems();
|
|
if(K)H=H.originalEvent.touches[0];var S=H.pageY,M=this.value,T=this;w.undoMgr.beginUndoableChange(D,U);$("body").addClass("dragging");e.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(ia){T.move(ia,S,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){T.stop()})};$(this).attr("readonly","readonly").attr("data-scale",q).attr("data-domain",l).attr("data-cursor",N!=false).bind("mousedown touchstart",function(H){this.blur();this.launch(H)}).bind("dblclick taphold",
|
|
function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(H,U,S,M){U=w.getSelectedElems();L&&w.undoMgr.beginUndoableChange(D,U);L=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){T.stop()},200);var T=this;
|
|
if(M>0)this.adjustValue(this.dragCfg.step);else M<0&&this.adjustValue(-this.dragCfg.step);H.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var n=parseFloat(a.value),e=parseFloat(a.getAttribute("data-scale")),c=parseFloat(a.getAttribute("data-domain"));n=n*-1/e+c+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=n};svgedit=svgedit||{};
|
|
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};methodDraw.ready(function(){for(menuItem in contextMenuExtensions){var n=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var e=n.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+n.id+"'>"+n.label+"<span class='shortcut'>"+e+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
|
|
{}};svgedit.contextmenu.add=function(n){if(n&&n.id&&n.label&&n.action&&typeof n.action=="function")if(n.id in a.contextMenuExtensions)console.error('Cannot add extension "'+n.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+n.id+", label:"+n.label+"}");a.contextMenuExtensions[n.id]=n}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=
|
|
function(n){return a.contextMenuExtensions[n]&&true};svgedit.contextmenu.getCustomHandler=function(n){return a.contextMenuExtensions[n].action}})();(function(a,n){function e(l){return!a(l).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(l,u){var b=l.nodeName.toLowerCase();if("area"===b){b=l.parentNode;var k=b.name;if(!l.href||!k||b.nodeName.toLowerCase()!=="map")return false;b=a("img[usemap=#"+k+"]")[0];return!!b&&e(b)}return(/input|select|textarea|button|object/.test(b)?!l.disabled:"a"==b?l.href||u:u)&&e(l)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
|
|
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(l,u){return typeof l=="number"?this.each(function(){var b=
|
|
this;setTimeout(function(){a(b).focus();u&&u.call(b)},l)}):this._focus.apply(this,arguments)},scrollParent:function(){var l;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?l=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):l=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,
|
|
"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!l.length?a(document):l},zIndex:function(l){if(l!==n)return this.css("zIndex",l);if(this.length){l=a(this[0]);for(var u;l.length&&l[0]!==document;){u=l.css("position");if(u==="absolute"||u==="relative"||u==="fixed"){u=parseInt(l.css("zIndex"),10);if(!isNaN(u)&&u!==0)return u}l=l.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":
|
|
"mousedown")+".ui-disableSelection",function(l){l.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(l,u){function b(z,D,w,K){a.each(k,function(){D-=parseFloat(a.curCSS(z,"padding"+this,true))||0;w&&(D-=parseFloat(a.curCSS(z,"border"+this+"Width",true))||0);K&&(D-=parseFloat(a.curCSS(z,"margin"+this,true))||0)});return D}var k=u==="Width"?["Left","Right"]:["Top","Bottom"],d=u.toLowerCase(),q={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,
|
|
outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+u]=function(z){if(z===n)return q["inner"+u].call(this);return this.each(function(){a(this).css(d,b(this,z)+"px")})};a.fn["outer"+u]=function(z,D){if(typeof z!="number")return q["outer"+u].call(this,z);return this.each(function(){a(this).css(d,b(this,z,true,D)+"px")})}}),a.extend(a.expr[":"],{data:function(l,u,b){return!!a.data(l,b[3])},focusable:function(l){return c(l,!isNaN(a.attr(l,"tabindex")))},tabbable:function(l){var u=a.attr(l,
|
|
"tabindex"),b=isNaN(u);return(b||u>=0)&&c(l,!b)}}),a(function(){var l=document.body,u=l.appendChild(u=document.createElement("div"));a.extend(u.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=u.offsetHeight===100;a.support.selectstart="onselectstart"in u;l.removeChild(u).style.display="none"}),a.extend(a.ui,{plugin:{add:function(l,u,b){l=a.ui[l].prototype;for(var k in b){l.plugins[k]=l.plugins[k]||[];l.plugins[k].push([u,b[k]])}},call:function(l,u,b){if((u=l.plugins[u])&&
|
|
l.element[0].parentNode)for(var k=0;k<u.length;k++)l.options[u[k][0]]&&u[k][1].apply(l.element,b)}},contains:function(l,u){return document.compareDocumentPosition?l.compareDocumentPosition(u)&16:l!==u&&l.contains(u)},hasScroll:function(l,u){if(a(l).css("overflow")==="hidden")return false;var b=u&&u==="left"?"scrollLeft":"scrollTop",k=false;if(l[b]>0)return true;l[b]=1;k=l[b]>0;l[b]=0;return k},isOverAxis:function(l,u,b){return l>u&&l<u+b},isOver:function(l,u,b,k,d,q){return a.ui.isOverAxis(l,b,d)&&
|
|
a.ui.isOverAxis(u,k,q)}}))})(jQuery);
|
|
(function(a,n){if(a.cleanData){var e=a.cleanData;a.cleanData=function(l){for(var u=0,b;(b=l[u])!=null;u++)try{a(b).triggerHandler("remove")}catch(k){}e(l)}}else{var c=a.fn.remove;a.fn.remove=function(l,u){return this.each(function(){u||(!l||a.filter(l,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}});return c.call(a(this),l,u)})}}a.widget=function(l,u,b){var k=l.split(".")[0],d;l=l.split(".")[1];d=k+"-"+l;b||(b=u,u=a.Widget);a.expr[":"][d]=
|
|
function(q){return!!a.data(q,l)};a[k]=a[k]||{};a[k][l]=function(q,z){arguments.length&&this._createWidget(q,z)};u=new u;u.options=a.extend(true,{},u.options);a[k][l].prototype=a.extend(true,u,{namespace:k,widgetName:l,widgetEventPrefix:a[k][l].prototype.widgetEventPrefix||l,widgetBaseClass:d},b);a.widget.bridge(l,a[k][l])};a.widget.bridge=function(l,u){a.fn[l]=function(b){var k=typeof b=="string",d=Array.prototype.slice.call(arguments,1),q=this;b=!k&&d.length?a.extend.apply(null,[true,b].concat(d)):
|
|
b;if(k&&b.charAt(0)==="_")return q;k?this.each(function(){var z=a.data(this,l),D=z&&a.isFunction(z[b])?z[b].apply(z,d):z;if(D!==z&&D!==n){q=D;return false}}):this.each(function(){var z=a.data(this,l);z?z.option(b||{})._init():a.data(this,l,new u(b,this))});return q}};a.Widget=function(l,u){arguments.length&&this._createWidget(l,u)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(l,u){a.data(u,this.widgetName,this);this.element=a(u);this.options=
|
|
a.extend(true,{},this.options,this._getCreateOptions(),l);var b=this;this.element.bind("remove."+this.widgetName,function(){b.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
|
|
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(l,u){var b=l;if(arguments.length===0)return a.extend({},this.options);if(typeof l=="string"){if(u===n)return this.options[l];b={};b[l]=u}this._setOptions(b);return this},_setOptions:function(l){var u=this;a.each(l,function(b,k){u._setOption(b,k)});return this},_setOption:function(l,u){this.options[l]=u;l==="disabled"&&this.widget()[u?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
|
|
u);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(l,u,b){var k,d=this.options[l];b=b||{};u=a.Event(u);u.type=(l===this.widgetEventPrefix?l:this.widgetEventPrefix+l).toLowerCase();u.target=this.element[0];if(l=u.originalEvent)for(k in l)k in u||(u[k]=l[k]);this.element.trigger(u,b);return!(a.isFunction(d)&&d.call(this.element[0],u,b)===false||u.isDefaultPrevented())}}})(jQuery);
|
|
(function(a){var n=false;a(document).mouseup(function(){n=false});a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(c){return e._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===a.data(c.target,e.widgetName+".preventClickEvent")){a.removeData(c.target,e.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
|
|
this.widgetName)},_mouseDown:function(e){if(!n){this._mouseStarted&&this._mouseUp(e);this._mouseDownEvent=e;var c=this,l=e.which==1,u=typeof this.options.cancel=="string"&&e.target.nodeName?a(e.target).closest(this.options.cancel).length:false;if(!l||u||!this._mouseCapture(e))return true;(this.mouseDelayMet=!this.options.delay)||(this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay));if(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)){this._mouseStarted=this._mouseStart(e)!==
|
|
false;if(!this._mouseStarted){e.preventDefault();return true}}true===a.data(e.target,this.widgetName+".preventClickEvent")&&a.removeData(e.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(b){return c._mouseMove(b)};this._mouseUpDelegate=function(b){return c._mouseUp(b)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);e.preventDefault();return n=true}},_mouseMove:function(e){if(a.browser.msie&&
|
|
!(document.documentMode>=9)&&!e.button)return this._mouseUp(e);if(this._mouseStarted){this._mouseDrag(e);return e.preventDefault()}this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==false,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e));return!this._mouseStarted},_mouseUp:function(e){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);this._mouseStarted&&
|
|
(this._mouseStarted=false,e.target==this._mouseDownEvent.target&&a.data(e.target,this.widgetName+".preventClickEvent",true),this._mouseStop(e));return false},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
|
|
(function(a){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){this.options.helper=="original"&&
|
|
!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative");this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(n){var e=this.options;
|
|
if(this.helper||e.disabled||a(n.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(n);if(!this.handle)return false;e.iframeFix&&a(e.iframeFix===true?"iframe":e.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(a(this).offset()).appendTo("body")});return true},_mouseStart:function(n){var e=this.options;this.helper=
|
|
this._createHelper(n);this._cacheHelperProportions();a.ui.ddmanager&&(a.ui.ddmanager.current=this);this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:n.pageX-this.offset.left,top:n.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
|
|
this.originalPosition=this.position=this._generatePosition(n);this.originalPageX=n.pageX;this.originalPageY=n.pageY;e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt);e.containment&&this._setContainment();if(this._trigger("start",n)===false){this._clear();return false}this._cacheHelperProportions();a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,n);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(n,true);a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,n);return true},
|
|
_mouseDrag:function(n,e){this.position=this._generatePosition(n);this.positionAbs=this._convertPositionTo("absolute");if(!e){var c=this._uiHash();if(this._trigger("drag",n,c)===false){this._mouseUp({});return false}this.position=c.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";a.ui.ddmanager&&a.ui.ddmanager.drag(this,n);return false},_mouseStop:function(n){var e=
|
|
false;a.ui.ddmanager&&!this.options.dropBehaviour&&(e=a.ui.ddmanager.drop(this,n));this.dropped&&(e=this.dropped,this.dropped=false);if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!e||this.options.revert=="valid"&&e||this.options.revert===true||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,e)){var c=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),
|
|
function(){c._trigger("stop",n)!==false&&c._clear()})}else this._trigger("stop",n)!==false&&this._clear();return false},_mouseUp:function(n){this.options.iframeFix===true&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,n);return a.ui.mouse.prototype._mouseUp.call(this,n)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(n){var e=!this.options.handle||
|
|
!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){this==n.target&&(e=true)});return e},_createHelper:function(n){var e=this.options;n=a.isFunction(e.helper)?a(e.helper.apply(this.element[0],[n])):e.helper=="clone"?this.element.clone().removeAttr("id"):this.element;n.parents("body").length||n.appendTo(e.appendTo=="parent"?this.element[0].parentNode:e.appendTo);n[0]!=this.element[0]&&!/(fixed|absolute)/.test(n.css("position"))&&
|
|
n.css("position","absolute");return n},_adjustOffsetFromHelper:function(n){typeof n=="string"&&(n=n.split(" "));a.isArray(n)&&(n={left:+n[0],top:+n[1]||0});"left"in n&&(this.offset.click.left=n.left+this.margins.left);"right"in n&&(this.offset.click.left=this.helperProportions.width-n.right+this.margins.left);"top"in n&&(this.offset.click.top=n.top+this.margins.top);"bottom"in n&&(this.offset.click.top=this.helperProportions.height-n.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=
|
|
this.helper.offsetParent();var n=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(n.left+=this.scrollParent.scrollLeft(),n.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)n={top:0,left:0};return{top:n.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:n.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
|
|
10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var n=this.element.position();return{top:n.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:n.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),
|
|
10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var n=this.options;n.containment=="parent"&&(n.containment=this.helper[0].parentNode);if(n.containment=="document"||n.containment=="window")this.containment=[n.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,n.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,
|
|
(n.containment=="document"?0:a(window).scrollLeft())+a(n.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(n.containment=="document"?0:a(window).scrollTop())+(a(n.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(n.containment)&&n.containment.constructor!=Array){n=a(n.containment);var e=n[0];if(e){n.offset();var c=a(e).css("overflow")!=
|
|
"hidden";this.containment=[(parseInt(a(e).css("borderLeftWidth"),10)||0)+(parseInt(a(e).css("paddingLeft"),10)||0),(parseInt(a(e).css("borderTopWidth"),10)||0)+(parseInt(a(e).css("paddingTop"),10)||0),(c?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(a(e).css("borderLeftWidth"),10)||0)-(parseInt(a(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(a(e).css("borderTopWidth"),
|
|
10)||0)-(parseInt(a(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=n}}else n.containment.constructor==Array&&(this.containment=n.containment)},_convertPositionTo:function(n,e){e||(e=this.position);var c=n=="absolute"?1:-1,l=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,u=/(html|body)/i.test(l[0].tagName);return{top:e.top+
|
|
this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():u?0:l.scrollTop())*c),left:e.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():u?0:l.scrollLeft())*c)}},_generatePosition:function(n){var e=this.options,c=this.cssPosition=="absolute"&&
|
|
(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,l=/(html|body)/i.test(c[0].tagName),u=n.pageX,b=n.pageY;if(this.originalPosition){var k;if(this.containment){if(this.relative_container){k=this.relative_container.offset();k=[this.containment[0]+k.left,this.containment[1]+k.top,this.containment[2]+k.left,this.containment[3]+k.top]}else k=this.containment;n.pageX-this.offset.click.left<k[0]&&(u=k[0]+this.offset.click.left);
|
|
n.pageY-this.offset.click.top<k[1]&&(b=k[1]+this.offset.click.top);n.pageX-this.offset.click.left>k[2]&&(u=k[2]+this.offset.click.left);n.pageY-this.offset.click.top>k[3]&&(b=k[3]+this.offset.click.top)}if(e.grid){b=e.grid[1]?this.originalPageY+Math.round((b-this.originalPageY)/e.grid[1])*e.grid[1]:this.originalPageY;b=k?b-this.offset.click.top<k[1]||b-this.offset.click.top>k[3]?b-this.offset.click.top<k[1]?b+e.grid[1]:b-e.grid[1]:b:b;u=e.grid[0]?this.originalPageX+Math.round((u-this.originalPageX)/
|
|
e.grid[0])*e.grid[0]:this.originalPageX;u=k?u-this.offset.click.left<k[0]||u-this.offset.click.left>k[2]?u-this.offset.click.left<k[0]?u+e.grid[0]:u-e.grid[0]:u:u}}return{top:b-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():l?0:c.scrollTop()),left:u-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<
|
|
526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():l?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(n,e,c){c=c||this._uiHash();a.ui.plugin.call(this,n,[e,c]);n=="drag"&&(this.positionAbs=this._convertPositionTo("absolute"));return a.Widget.prototype._trigger.call(this,n,e,
|
|
c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});a.extend(a.ui.draggable,{version:"1.8.17"});a.ui.plugin.add("draggable","connectToSortable",{start:function(n,e){var c=a(this).data("draggable"),l=c.options,u=a.extend({},e,{item:c.element});c.sortables=[];a(l.connectToSortable).each(function(){var b=a.data(this,"sortable");b&&!b.options.disabled&&(c.sortables.push({instance:b,shouldRevert:b.options.revert}),
|
|
b.refreshPositions(),b._trigger("activate",n,u))})},stop:function(n,e){var c=a(this).data("draggable"),l=a.extend({},e,{item:c.element});a.each(c.sortables,function(){this.instance.isOver?(this.instance.isOver=0,c.cancelHelperRemoval=true,this.instance.cancelHelperRemoval=false,this.shouldRevert&&(this.instance.options.revert=true),this.instance._mouseStop(n),this.instance.options.helper=this.instance.options._helper,c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):
|
|
(this.instance.cancelHelperRemoval=false,this.instance._trigger("deactivate",n,l))})},drag:function(n,e){var c=a(this).data("draggable"),l=this;a.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(l).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",
|
|
true),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return e.helper[0]},n.target=this.instance.currentItem[0],this.instance._mouseCapture(n,true),this.instance._mouseStart(n,true,true),this.instance.offset.click.top=c.offset.click.top,this.instance.offset.click.left=c.offset.click.left,this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top,
|
|
c._trigger("toSortable",n),c.dropped=this.instance.element,c.currentItem=c.element,this.instance.fromOutside=c),this.instance.currentItem&&this.instance._mouseDrag(n)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=true,this.instance.options.revert=false,this.instance._trigger("out",n,this.instance._uiHash(this.instance)),this.instance._mouseStop(n,true),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&
|
|
this.instance.placeholder.remove(),c._trigger("fromSortable",n),c.dropped=false)})}});a.ui.plugin.add("draggable","cursor",{start:function(){var n=a("body"),e=a(this).data("draggable").options;n.css("cursor")&&(e._cursor=n.css("cursor"));n.css("cursor",e.cursor)},stop:function(){var n=a(this).data("draggable").options;n._cursor&&a("body").css("cursor",n._cursor)}});a.ui.plugin.add("draggable","opacity",{start:function(n,e){var c=a(e.helper),l=a(this).data("draggable").options;c.css("opacity")&&(l._opacity=
|
|
c.css("opacity"));c.css("opacity",l.opacity)},stop:function(n,e){var c=a(this).data("draggable").options;c._opacity&&a(e.helper).css("opacity",c._opacity)}});a.ui.plugin.add("draggable","scroll",{start:function(){var n=a(this).data("draggable");n.scrollParent[0]!=document&&n.scrollParent[0].tagName!="HTML"&&(n.overflowOffset=n.scrollParent.offset())},drag:function(n){var e=a(this).data("draggable"),c=e.options,l=false;if(e.scrollParent[0]!=document&&e.scrollParent[0].tagName!="HTML"){if(!c.axis||
|
|
c.axis!="x")e.overflowOffset.top+e.scrollParent[0].offsetHeight-n.pageY<c.scrollSensitivity?e.scrollParent[0].scrollTop=l=e.scrollParent[0].scrollTop+c.scrollSpeed:n.pageY-e.overflowOffset.top<c.scrollSensitivity&&(e.scrollParent[0].scrollTop=l=e.scrollParent[0].scrollTop-c.scrollSpeed);if(!c.axis||c.axis!="y")e.overflowOffset.left+e.scrollParent[0].offsetWidth-n.pageX<c.scrollSensitivity?e.scrollParent[0].scrollLeft=l=e.scrollParent[0].scrollLeft+c.scrollSpeed:n.pageX-e.overflowOffset.left<c.scrollSensitivity&&
|
|
(e.scrollParent[0].scrollLeft=l=e.scrollParent[0].scrollLeft-c.scrollSpeed)}else{if(!c.axis||c.axis!="x")n.pageY-a(document).scrollTop()<c.scrollSensitivity?l=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(n.pageY-a(document).scrollTop())<c.scrollSensitivity&&(l=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed));if(!c.axis||c.axis!="y")n.pageX-a(document).scrollLeft()<c.scrollSensitivity?l=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):
|
|
a(window).width()-(n.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(l=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))}l!==false&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(e,n)}});a.ui.plugin.add("draggable","snap",{start:function(){var n=a(this).data("draggable"),e=n.options;n.snapElements=[];a(e.snap.constructor!=String?e.snap.items||":data(draggable)":e.snap).each(function(){var c=a(this),l=c.offset();this!=n.element[0]&&n.snapElements.push({item:this,
|
|
width:c.outerWidth(),height:c.outerHeight(),top:l.top,left:l.left})})},drag:function(n,e){for(var c=a(this).data("draggable"),l=c.options,u=l.snapTolerance,b=e.offset.left,k=b+c.helperProportions.width,d=e.offset.top,q=d+c.helperProportions.height,z=c.snapElements.length-1;z>=0;z--){var D=c.snapElements[z].left,w=D+c.snapElements[z].width,K=c.snapElements[z].top,L=K+c.snapElements[z].height;if(D-u<b&&b<w+u&&K-u<d&&d<L+u||D-u<b&&b<w+u&&K-u<q&&q<L+u||D-u<k&&k<w+u&&K-u<d&&d<L+u||D-u<k&&k<w+u&&K-u<q&&
|
|
q<L+u){if(l.snapMode!="inner"){var N=Math.abs(K-q)<=u,H=Math.abs(L-d)<=u,U=Math.abs(D-k)<=u,S=Math.abs(w-b)<=u;N&&(e.position.top=c._convertPositionTo("relative",{top:K-c.helperProportions.height,left:0}).top-c.margins.top);H&&(e.position.top=c._convertPositionTo("relative",{top:L,left:0}).top-c.margins.top);U&&(e.position.left=c._convertPositionTo("relative",{top:0,left:D-c.helperProportions.width}).left-c.margins.left);S&&(e.position.left=c._convertPositionTo("relative",{top:0,left:w}).left-c.margins.left)}var M=
|
|
N||H||U||S;if(l.snapMode!="outer"){N=Math.abs(K-d)<=u;H=Math.abs(L-q)<=u;U=Math.abs(D-b)<=u;S=Math.abs(w-k)<=u;N&&(e.position.top=c._convertPositionTo("relative",{top:K,left:0}).top-c.margins.top);H&&(e.position.top=c._convertPositionTo("relative",{top:L-c.helperProportions.height,left:0}).top-c.margins.top);U&&(e.position.left=c._convertPositionTo("relative",{top:0,left:D}).left-c.margins.left);S&&(e.position.left=c._convertPositionTo("relative",{top:0,left:w-c.helperProportions.width}).left-c.margins.left)}!c.snapElements[z].snapping&&
|
|
(N||H||U||S||M)&&c.options.snap.snap&&c.options.snap.snap.call(c.element,n,a.extend(c._uiHash(),{snapItem:c.snapElements[z].item}));c.snapElements[z].snapping=N||H||U||S||M}else{c.snapElements[z].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,n,a.extend(c._uiHash(),{snapItem:c.snapElements[z].item}));c.snapElements[z].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var n=a(this).data("draggable").options;n=a.makeArray(a(n.stack)).sort(function(c,
|
|
l){return(parseInt(a(c).css("zIndex"),10)||0)-(parseInt(a(l).css("zIndex"),10)||0)});if(n.length){var e=parseInt(n[0].style.zIndex)||0;a(n).each(function(c){this.style.zIndex=e+c});this[0].style.zIndex=e+n.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(n,e){var c=a(e.helper),l=a(this).data("draggable").options;c.css("zIndex")&&(l._zIndex=c.css("zIndex"));c.css("zIndex",l.zIndex)},stop:function(n,e){var c=a(this).data("draggable").options;c._zIndex&&a(e.helper).css("zIndex",c._zIndex)}})})(jQuery);
|
|
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var n=this,e=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),l=e.values&&e.values.length||1,u=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
|
|
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(e.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);e.range&&(e.range===true&&(e.values||(e.values=[this._valueMin(),this._valueMin()]),e.values.length&&e.values.length!==2&&(e.values=[e.values[0],e.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(e.range==="min"||e.range==="max"?" ui-slider-range-"+e.range:"")));for(var b=c.length;b<l;b+=1)u.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
|
|
this.handles=c.add(a(u.join("")).appendTo(n.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(k){k.preventDefault()}).hover(function(){e.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){e.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(k){a(this).data("index.ui-slider-handle",
|
|
k)});this.handles.keydown(function(k){var d=true,q=a(this).data("index.ui-slider-handle"),z,D,w;if(!n.options.disabled){switch(k.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d=false;if(!n._keySliding){n._keySliding=true;a(this).addClass("ui-state-active");z=n._start(k,q);if(z===false)return}}z=n.options.step;n.options.values&&n.options.values.length?
|
|
D=w=n.values(q):D=w=n.value();switch(k.keyCode){case a.ui.keyCode.HOME:w=n._valueMin();break;case a.ui.keyCode.END:w=n._valueMax();break;case a.ui.keyCode.PAGE_UP:w=n._trimAlignValue(D+(n._valueMax()-n._valueMin())/5);break;case a.ui.keyCode.PAGE_DOWN:w=n._trimAlignValue(D-(n._valueMax()-n._valueMin())/5);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(D===n._valueMax())return;w=n._trimAlignValue(D+z);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(D===n._valueMin())return;w=n._trimAlignValue(D-
|
|
z)}n._slide(k,q,w);return d}}).keyup(function(k){var d=a(this).data("index.ui-slider-handle");n._keySliding&&(n._keySliding=false,n._stop(k,d),n._change(k,d),a(this).removeClass("ui-state-active"))});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
|
|
return this},_mouseCapture:function(n){var e=this.options,c,l,u,b,k;if(e.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:n.pageX,y:n.pageY});l=this._valueMax()-this._valueMin()+1;b=this;this.handles.each(function(d){var q=Math.abs(c-b.values(d));l>q&&(l=q,u=a(this),k=d)});e.range===true&&this.values(1)===e.min&&(k+=1,u=a(this.handles[k]));if(this._start(n,k)===false)return false;
|
|
this._mouseSliding=true;b._handleIndex=k;u.addClass("ui-state-active").focus();e=u.offset();this._clickOffset=!a(n.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:n.pageX-e.left-u.width()/2,top:n.pageY-e.top-u.height()/2-(parseInt(u.css("borderTopWidth"),10)||0)-(parseInt(u.css("borderBottomWidth"),10)||0)+(parseInt(u.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(n,k,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(n){var e=
|
|
this._normValueFromMouse({x:n.pageX,y:n.pageY});this._slide(n,this._handleIndex,e);return false},_mouseStop:function(n){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(n,this._handleIndex);this._change(n,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(n){var e,c;this.orientation==="horizontal"?
|
|
(e=this.elementSize.width,c=n.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,c=n.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0));n=c/e;n>1&&(n=1);n<0&&(n=0);this.orientation==="vertical"&&(n=1-n);e=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+n*e)},_start:function(n,e){var c={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(e),
|
|
c.values=this.values());return this._trigger("start",n,c)},_slide:function(n,e,c){var l,u,b;this.options.values&&this.options.values.length?(l=this.values(e?0:1),this.options.values.length===2&&this.options.range===true&&(e===0&&c>l||e===1&&c<l)&&(c=l),c!==this.values(e)&&(u=this.values(),u[e]=c,b=this._trigger("slide",n,{handle:this.handles[e],value:c,values:u}),this.values(e?0:1),b!==false&&this.values(e,c,true))):c!==this.value()&&(b=this._trigger("slide",n,{handle:this.handles[e],value:c}),b!==
|
|
false&&this.value(c))},_stop:function(n,e){var c={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(e),c.values=this.values());this._trigger("stop",n,c)},_change:function(n,e){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(e),c.values=this.values());this._trigger("change",n,c)}},value:function(n){if(arguments.length){this.options.value=
|
|
this._trimAlignValue(n);this._refreshValue();this._change(null,0)}else return this._value()},values:function(n,e){var c,l,u;if(arguments.length>1){this.options.values[n]=this._trimAlignValue(e);this._refreshValue();this._change(null,n)}else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(n):this.value();c=this.options.values;l=arguments[0];for(u=0;u<c.length;u+=1){c[u]=this._trimAlignValue(l[u]);this._change(null,
|
|
u)}this._refreshValue()}},_setOption:function(n,e){var c,l=0;a.isArray(this.options.values)&&(l=this.options.values.length);a.Widget.prototype._setOption.apply(this,arguments);switch(n){case "disabled":e?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",true),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",false),this.element.removeClass("ui-disabled"));break;case "orientation":this._detectOrientation();
|
|
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<l;c+=1)this._change(null,c);this._animateOff=false}},_value:function(){var n=this.options.value;return n=this._trimAlignValue(n)},_values:function(n){var e,c;if(arguments.length){e=this.options.values[n];
|
|
return e=this._trimAlignValue(e)}e=this.options.values.slice();for(c=0;c<e.length;c+=1)e[c]=this._trimAlignValue(e[c]);return e},_trimAlignValue:function(n){if(n<=this._valueMin())return this._valueMin();if(n>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,c=(n-this._valueMin())%e;n=n-c;Math.abs(c)*2>=e&&(n+=c>0?e:-e);return parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var n=
|
|
this.options.range,e=this.options,c=this,l=this._animateOff?false:e.animate,u,b={},k,d,q,z;this.options.values&&this.options.values.length?this.handles.each(function(D){u=(c.values(D)-c._valueMin())/(c._valueMax()-c._valueMin())*100;b[c.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[l?"animate":"css"](b,e.animate);c.options.range===true&&(c.orientation==="horizontal"?(D===0&&c.range.stop(1,1)[l?"animate":"css"]({left:u+"%"},e.animate),D===1&&c.range[l?"animate":"css"]({width:u-
|
|
k+"%"},{queue:false,duration:e.animate})):(D===0&&c.range.stop(1,1)[l?"animate":"css"]({bottom:u+"%"},e.animate),D===1&&c.range[l?"animate":"css"]({height:u-k+"%"},{queue:false,duration:e.animate})));k=u}):(d=this.value(),q=this._valueMin(),z=this._valueMax(),u=z!==q?(d-q)/(z-q)*100:0,b[c.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[l?"animate":"css"](b,e.animate),n==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[l?"animate":"css"]({width:u+"%"},e.animate),
|
|
n==="max"&&this.orientation==="horizontal"&&this.range[l?"animate":"css"]({width:100-u+"%"},{queue:false,duration:e.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[l?"animate":"css"]({height:u+"%"},e.animate),n==="max"&&this.orientation==="vertical"&&this.range[l?"animate":"css"]({height:100-u+"%"},{queue:false,duration:e.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,k){if(k===undefined)k=0;return Math.round(b*Math.pow(10,k))/Math.pow(10,k)};var n=function(b,k){var d=this,q=b.find("img:first"),z=0,D=100,w=100,K=0,L=100,N=100,H=0,U=0,S,M,T=[],ia=function(Y){for(var ca=0;ca<T.length;ca++)T[ca].call(d,d,Y)},ga=function(Y){var ca=b.offset();S={l:ca.left|0,t:ca.top|0};clearTimeout(M);M=setTimeout(function(){ua.call(d,Y)},0);a(document).bind("mousemove",Z).bind("mouseup",fa);Y.preventDefault()},Z=function(Y){clearTimeout(M);M=
|
|
setTimeout(function(){ua.call(d,Y)},0);Y.stopPropagation();Y.preventDefault();return false},fa=function(Y){a(document).unbind("mouseup",fa).unbind("mousemove",Z);Y.stopPropagation();Y.preventDefault();return false},ua=function(Y){var ca=Y.pageX-S.l;Y=Y.pageY-S.t;var pa=b.w,oa=b.h;if(ca<0)ca=0;else if(ca>pa)ca=pa;if(Y<0)Y=0;else if(Y>oa)Y=oa;ja.call(d,"xy",{x:ca/pa*w+z,y:Y/oa*N+K})},ja=function(Y,ca,pa){if(ca===undefined){if(Y===undefined||Y==null)Y="xy";switch(Y.toLowerCase()){case "x":return H;case "y":return U;
|
|
default:return{x:H,y:U}}}if(!(pa!=null&&pa==d)){var oa=false,na,ma;if(Y==null)Y="xy";switch(Y.toLowerCase()){case "x":na=ca&&(ca.x&&ca.x|0||ca|0)||0;break;case "y":ma=ca&&(ca.y&&ca.y|0||ca|0)||0;break;default:na=ca&&ca.x&&ca.x|0||0;ma=ca&&ca.y&&ca.y|0||0}if(na!=null){if(na<z)na=z;else if(na>D)na=D;if(H!=na){H=na;oa=true}}if(ma!=null){if(ma<K)ma=K;else if(ma>L)ma=L;if(U!=ma){U=ma;oa=true}}oa&&ia.call(d,pa||d)}},la=function(Y){a.isFunction(Y)&&T.push(Y)};a.extend(true,d,{val:ja,range:function(Y,ca){if(ca===
|
|
undefined){if(Y===undefined||Y==null)Y="all";switch(Y.toLowerCase()){case "minx":return z;case "maxx":return D;case "rangex":return{minX:z,maxX:D,rangeX:w};case "miny":return K;case "maxy":return L;case "rangey":return{minY:K,maxY:L,rangeY:N};default:return{minX:z,maxX:D,rangeX:w,minY:K,maxY:L,rangeY:N}}}var pa,oa,na,ma;if(Y==null)Y="all";switch(Y.toLowerCase()){case "minx":pa=ca&&(ca.minX&&ca.minX|0||ca|0)||0;break;case "maxx":oa=ca&&(ca.maxX&&ca.maxX|0||ca|0)||0;break;case "rangex":pa=ca&&ca.minX&&
|
|
ca.minX|0||0;oa=ca&&ca.maxX&&ca.maxX|0||0;break;case "miny":na=ca&&(ca.minY&&ca.minY|0||ca|0)||0;break;case "maxy":ma=ca&&(ca.maxY&&ca.maxY|0||ca|0)||0;break;case "rangey":na=ca&&ca.minY&&ca.minY|0||0;ma=ca&&ca.maxY&&ca.maxY|0||0;break;default:pa=ca&&ca.minX&&ca.minX|0||0;oa=ca&&ca.maxX&&ca.maxX|0||0;na=ca&&ca.minY&&ca.minY|0||0;ma=ca&&ca.maxY&&ca.maxY|0||0}if(pa!=null&&z!=pa){z=pa;w=D-z}if(oa!=null&&D!=oa){D=oa;w=D-z}if(na!=null&&K!=na){K=na;N=L-K}if(ma!=null&&L!=ma){L=ma;N=L-K}},bind:la,unbind:function(Y){if(a.isFunction(Y))for(var ca;(ca=
|
|
a.inArray(Y,T))!=-1;)T.splice(ca,1)},destroy:function(){a(document).unbind("mouseup",fa).unbind("mousemove",Z);b.unbind("mousedown",ga);T=q=b=null}});q.src=k.arrow&&k.arrow.image;q.w=k.arrow&&k.arrow.width||q.width();q.h=k.arrow&&k.arrow.height||q.height();b.w=k.map&&k.map.width||b.width();b.h=k.map&&k.map.height||b.height();b.bind("mousedown",ga);la.call(d,function(){var Y=0,ca=0,pa=b.w,oa=b.h,na=q.w,ma=q.h;setTimeout(function(){if(w>0)Y=H==D?pa:H/w*pa|0;if(N>0)ca=U==L?oa:U/N*oa|0;if(na>=pa)Y=(pa>>
|
|
1)-(na>>1);else Y-=na>>1;if(ma>=oa)ca=(oa>>1)-(ma>>1);else ca-=ma>>1;q.css({left:Y+"px",top:ca+"px"})},0)})},e=function(b,k,d,q){var z=this;b=b.find("td.Text input");var D=b.eq(3),w=b.eq(4),K=b.eq(5),L=b.length>7?b.eq(6):null,N=b.eq(0),H=b.eq(1),U=b.eq(2),S=b.eq(b.length>7?7:6),M=b.length>7?b.eq(8):null,T=function(ja){if(!(ja.target.value==""&&ja.target!=S.get(0)&&(d!=null&&ja.target!=d.get(0)||d==null))){if(!Z(ja))return ja;switch(ja.target){case D.get(0):switch(ja.keyCode){case 38:D.val(fa.call(z,
|
|
(D.val()<<0)+1,0,255));k.val("r",D.val(),ja.target);return false;case 40:D.val(fa.call(z,(D.val()<<0)-1,0,255));k.val("r",D.val(),ja.target);return false}break;case w.get(0):switch(ja.keyCode){case 38:w.val(fa.call(z,(w.val()<<0)+1,0,255));k.val("g",w.val(),ja.target);return false;case 40:w.val(fa.call(z,(w.val()<<0)-1,0,255));k.val("g",w.val(),ja.target);return false}break;case K.get(0):switch(ja.keyCode){case 38:K.val(fa.call(z,(K.val()<<0)+1,0,255));k.val("b",K.val(),ja.target);return false;case 40:K.val(fa.call(z,
|
|
(K.val()<<0)-1,0,255));k.val("b",K.val(),ja.target);return false}break;case L&&L.get(0):switch(ja.keyCode){case 38:L.val(fa.call(z,parseFloat(L.val())+1,0,100));k.val("a",Math.precision(L.val()*255/100,q),ja.target);return false;case 40:L.val(fa.call(z,parseFloat(L.val())-1,0,100));k.val("a",Math.precision(L.val()*255/100,q),ja.target);return false}break;case N.get(0):switch(ja.keyCode){case 38:N.val(fa.call(z,(N.val()<<0)+1,0,360));k.val("h",N.val(),ja.target);return false;case 40:N.val(fa.call(z,
|
|
(N.val()<<0)-1,0,360));k.val("h",N.val(),ja.target);return false}break;case H.get(0):switch(ja.keyCode){case 38:H.val(fa.call(z,(H.val()<<0)+1,0,100));k.val("s",H.val(),ja.target);return false;case 40:H.val(fa.call(z,(H.val()<<0)-1,0,100));k.val("s",H.val(),ja.target);return false}break;case U.get(0):switch(ja.keyCode){case 38:U.val(fa.call(z,(U.val()<<0)+1,0,100));k.val("v",U.val(),ja.target);return false;case 40:U.val(fa.call(z,(U.val()<<0)-1,0,100));k.val("v",U.val(),ja.target);return false}}}},
|
|
ia=function(ja){if(!(ja.target.value==""&&ja.target!=S.get(0)&&(d!=null&&ja.target!=d.get(0)||d==null))){if(!Z(ja))return ja;switch(ja.target){case D.get(0):D.val(fa.call(z,D.val(),0,255));k.val("r",D.val(),ja.target);break;case w.get(0):w.val(fa.call(z,w.val(),0,255));k.val("g",w.val(),ja.target);break;case K.get(0):K.val(fa.call(z,K.val(),0,255));k.val("b",K.val(),ja.target);break;case L&&L.get(0):L.val(fa.call(z,L.val(),0,100));k.val("a",Math.precision(L.val()*255/100,q),ja.target);break;case N.get(0):N.val(fa.call(z,
|
|
N.val(),0,360));k.val("h",N.val(),ja.target);break;case H.get(0):H.val(fa.call(z,H.val(),0,100));k.val("s",H.val(),ja.target);break;case U.get(0):U.val(fa.call(z,U.val(),0,100));k.val("v",U.val(),ja.target);break;case S.get(0):S.val(S.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(S.val());k.val("hex",S.val()!=""?S.val():null,ja.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));S.val(d.val());k.val("hex",d.val()!=""?d.val():
|
|
null,ja.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));k.val("a",M.val()!=null?parseInt(M.val(),16):null,ja.target)}}},ga=function(ja){if(k.val()!=null)switch(ja.target){case D.get(0):D.val(k.val("r"));break;case w.get(0):w.val(k.val("g"));break;case K.get(0):K.val(k.val("b"));break;case L&&L.get(0):L.val(Math.precision(k.val("a")*100/255,q));break;case N.get(0):N.val(k.val("h"));break;case H.get(0):H.val(k.val("s"));break;case U.get(0):U.val(k.val("v"));
|
|
break;case S.get(0):case d&&d.get(0):S.val(k.val("hex"));d&&d.val(k.val("hex"));break;case M&&M.get(0):M.val(k.val("ahex").substring(6))}},Z=function(ja){switch(ja.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ja.ctrlKey)return false}return true},fa=function(ja,la,Y){if(ja==""||isNaN(ja))return la;if(ja>Y)return Y;if(ja<la)return la;return ja},ua=function(ja,la){var Y=ja.val("all");if(la!=D.get(0))D.val(Y!=null?Y.r:"");if(la!=w.get(0))w.val(Y!=
|
|
null?Y.g:"");if(la!=K.get(0))K.val(Y!=null?Y.b:"");if(L&&la!=L.get(0))L.val(Y!=null?Math.precision(Y.a*100/255,q):"");if(la!=N.get(0))N.val(Y!=null?Y.h:"");if(la!=H.get(0))H.val(Y!=null?Y.s:"");if(la!=U.get(0))U.val(Y!=null?Y.v:"");if(la!=S.get(0)&&(d&&la!=d.get(0)||!d))S.val(Y!=null?Y.hex:"");if(d&&la!=d.get(0)&&la!=S.get(0))d.val(Y!=null?Y.hex:"");if(M&&la!=M.get(0))M.val(Y!=null?Y.ahex.substring(6):"")};a.extend(true,z,{destroy:function(){D.add(w).add(K).add(L).add(N).add(H).add(U).add(S).add(d).add(M).unbind("keyup",
|
|
ia).unbind("blur",ga);D.add(w).add(K).add(L).add(N).add(H).add(U).unbind("keydown",T);k.unbind(ua);M=S=U=H=N=L=K=w=D=null}});D.add(w).add(K).add(L).add(N).add(H).add(U).add(S).add(d).add(M).bind("keyup",ia).bind("blur",ga);D.add(w).add(K).add(L).add(N).add(H).add(U).bind("keydown",T);k.bind(ua)};a.jPicker={List:[],Color:function(b){var k=this,d,q,z,D,w,K,L,N=[],H=function(S){for(var M=0;M<N.length;M++)N[M].call(k,k,S)},U=function(S,M,T){if(M===undefined){if(S===undefined||S==null||S=="")S="all";if(d==
|
|
null)return null;switch(S.toLowerCase()){case "ahex":return u.rgbaToHex({r:d,g:q,b:z,a:D});case "hex":return U("ahex").substring(0,6);case "all":return{r:d,g:q,b:z,a:D,h:w,s:K,v:L,hex:U.call(k,"hex"),ahex:U.call(k,"ahex")};default:M={};for(var ia=0;ia<S.length;ia++)switch(S.charAt(ia)){case "r":if(S.length==1)M=d;else M.r=d;break;case "g":if(S.length==1)M=q;else M.g=q;break;case "b":if(S.length==1)M=z;else M.b=z;break;case "a":if(S.length==1)M=D;else M.a=D;break;case "h":if(S.length==1)M=w;else M.h=
|
|
w;break;case "s":if(S.length==1)M=K;else M.s=K;break;case "v":if(S.length==1)M=L;else M.v=L}return M=={}?U.call(k,"all"):M}}if(!(T!=null&&T==k)){var ga=false;if(S==null)S="";if(M==null){if(d!=null){d=null;ga=true}if(q!=null){q=null;ga=true}if(z!=null){z=null;ga=true}if(D!=null){D=null;ga=true}if(w!=null){w=null;ga=true}if(K!=null){K=null;ga=true}if(L!=null){L=null;ga=true}ga&&H.call(k,T||k)}else switch(S.toLowerCase()){case "ahex":case "hex":M=u.hexToRgba(M&&(M.ahex||M.hex)||M||"00000000");U.call(k,
|
|
"rgba",{r:M.r,g:M.g,b:M.b,a:S=="ahex"?M.a:D!=null?D:255},T);break;default:if(M&&(M.ahex!=null||M.hex!=null)){U.call(k,"ahex",M.ahex||M.hex||"00000000",T);break}var Z={},fa=false,ua=false;if(M.r!==undefined&&!S.indexOf("r")==-1)S+="r";if(M.g!==undefined&&!S.indexOf("g")==-1)S+="g";if(M.b!==undefined&&!S.indexOf("b")==-1)S+="b";if(M.a!==undefined&&!S.indexOf("a")==-1)S+="a";if(M.h!==undefined&&!S.indexOf("h")==-1)S+="h";if(M.s!==undefined&&!S.indexOf("s")==-1)S+="s";if(M.v!==undefined&&!S.indexOf("v")==
|
|
-1)S+="v";for(ia=0;ia<S.length;ia++)switch(S.charAt(ia)){case "r":if(ua)continue;fa=true;Z.r=M&&M.r&&M.r|0||M&&M|0||0;if(Z.r<0)Z.r=0;else if(Z.r>255)Z.r=255;if(d!=Z.r){d=Z.r;ga=true}break;case "g":if(ua)continue;fa=true;Z.g=M&&M.g&&M.g|0||M&&M|0||0;if(Z.g<0)Z.g=0;else if(Z.g>255)Z.g=255;if(q!=Z.g){q=Z.g;ga=true}break;case "b":if(ua)continue;fa=true;Z.b=M&&M.b&&M.b|0||M&&M|0||0;if(Z.b<0)Z.b=0;else if(Z.b>255)Z.b=255;if(z!=Z.b){z=Z.b;ga=true}break;case "a":Z.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(Z.a<
|
|
0)Z.a=0;else if(Z.a>255)Z.a=255;if(D!=Z.a){D=Z.a;ga=true}break;case "h":if(fa)continue;ua=true;Z.h=M&&M.h&&M.h|0||M&&M|0||0;if(Z.h<0)Z.h=0;else if(Z.h>360)Z.h=360;if(w!=Z.h){w=Z.h;ga=true}break;case "s":if(fa)continue;ua=true;Z.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(Z.s<0)Z.s=0;else if(Z.s>100)Z.s=100;if(K!=Z.s){K=Z.s;ga=true}break;case "v":if(fa)continue;ua=true;Z.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(Z.v<0)Z.v=0;else if(Z.v>100)Z.v=100;if(L!=Z.v){L=Z.v;ga=true}}if(ga){if(fa){d=d||0;q=q||0;z=
|
|
z||0;M=u.rgbToHsv({r:d,g:q,b:z});w=M.h;K=M.s;L=M.v}else if(ua){w=w||0;K=K!=null?K:100;L=L!=null?L:100;M=u.hsvToRgb({h:w,s:K,v:L});d=M.r;q=M.g;z=M.b}D=D!=null?D:255;H.call(k,T||k)}}}};a.extend(true,k,{val:U,bind:function(S){a.isFunction(S)&&N.push(S)},unbind:function(S){if(a.isFunction(S))for(var M;(M=a.inArray(S,N))!=-1;)N.splice(M,1)},destroy:function(){N=null}});if(b)if(b.ahex!=null)U("ahex",b);else if(b.hex!=null)U((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+u.intToHex(b.a)}:b);else if(b.r!=
|
|
null&&b.g!=null&&b.b!=null)U("rgb"+(b.a!=null?"a":""),b);else if(b.h!=null&&b.s!=null&&b.v!=null)U("hsv"+(b.a!=null?"a":""),b)},ColorMethods:{hexToRgba:function(b){b=this.validateHex(b);if(b=="")return{r:null,g:null,b:null,a:null};var k="00",d="00",q="00",z="255";if(b.length==6)b+="ff";if(b.length>6){k=b.substring(0,2);d=b.substring(2,4);q=b.substring(4,6);z=b.substring(6,b.length)}else{if(b.length>4){k=b.substring(4,b.length);b=b.substring(0,4)}if(b.length>2){d=b.substring(2,b.length);b=b.substring(0,
|
|
2)}if(b.length>0)q=b.substring(0,b.length)}return{r:this.hexToInt(k),g:this.hexToInt(d),b:this.hexToInt(q),a:this.hexToInt(z)}},validateHex:function(b){if(typeof b=="object")return"";b=b.toLowerCase().replace(/[^a-f0-9]/g,"");if(b.length>8)b=b.substring(0,8);return b},rgbaToHex:function(b){return this.intToHex(b.r)+this.intToHex(b.g)+this.intToHex(b.b)+this.intToHex(b.a)},intToHex:function(b){b=(b|0).toString(16);if(b.length==1)b="0"+b;return b.toLowerCase()},hexToInt:function(b){return parseInt(b,
|
|
16)},rgbToHsv:function(b){var k=b.r/255,d=b.g/255;b=b.b/255;var q={h:0,s:0,v:0},z=0,D=0;if(k>=d&&k>=b){D=k;z=d>b?b:d}else if(d>=b&&d>=k){D=d;z=k>b?b:k}else{D=b;z=d>k?k:d}q.v=D;q.s=D?(D-z)/D:0;if(q.s){z=D-z;q.h=k==D?(d-b)/z:d==D?2+(b-k)/z:4+(k-d)/z;q.h=parseInt(q.h*60);if(q.h<0)q.h+=360}else q.h=0;q.s=q.s*100|0;q.v=q.v*100|0;return q},hsvToRgb:function(b){var k={r:0,g:0,b:0,a:100},d=b.h,q=b.s;b=b.v;if(q==0)k.r=b==0?k.g=k.b=0:k.g=k.b=b*255/100|0;else{if(d==360)d=0;d/=60;q/=100;b/=100;var z=d|0,D=d-
|
|
z;d=b*(1-q);var w=b*(1-q*D);q=b*(1-q*(1-D));switch(z){case 0:k.r=b;k.g=q;k.b=d;break;case 1:k.r=w;k.g=b;k.b=d;break;case 2:k.r=d;k.g=b;k.b=q;break;case 3:k.r=d;k.g=w;k.b=b;break;case 4:k.r=q;k.g=d;k.b=b;break;case 5:k.r=b;k.g=d;k.b=w}k.r=k.r*255|0;k.g=k.g*255|0;k.b=k.b*255|0}return k}}};var c=a.jPicker.Color,l=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(b){var k=arguments;return this.each(function(){var d=this,q=a.extend(true,{},a.fn.jPicker.defaults,b);if(a(d).get(0).nodeName.toLowerCase()==
|
|
"input"){a.extend(true,q,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()==""){q.color.active=new c({hex:null});q.color.current=new c({hex:null})}else if(u.validateHex(a(d).val())){q.color.active=new c({hex:a(d).val(),a:q.color.active.val("a")});q.color.current=new c({hex:a(d).val(),a:q.color.active.val("a")})}}if(q.window.expandable)a(d).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>');
|
|
else q.window.liveUpdate=false;var z=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,D=null,w=null,K=null,L=null,N=null,H=null,U=null,S=null,M=null,T=null,ia=null,ga=null,Z=null,fa=null,ua=null,ja=null,la=null,Y=null,ca=null,pa=null,oa=null,na=null,ma=null,Ha=null,Ia=null,Ea=null,Va=null,Ua=null,La=function(R){var P=da.active,ba=P.val("hex"),Ba,Pa;q.color.mode=R;switch(R){case "h":setTimeout(function(){Sa.call(d,w,"transparent");ya.call(d,L,0);sa.call(d,L,100);ya.call(d,
|
|
N,260);sa.call(d,N,100);Sa.call(d,K,"transparent");ya.call(d,U,0);sa.call(d,U,100);ya.call(d,S,260);sa.call(d,S,100);ya.call(d,M,260);sa.call(d,M,100);ya.call(d,T,260);sa.call(d,T,100);ya.call(d,ga,260);sa.call(d,ga,100)},0);Z.range("all",{minX:0,maxX:100,minY:0,maxY:100});fa.range("rangeY",{minY:0,maxY:360});if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("s"),y:100-P.val("v")},Z);fa.val("y",360-P.val("h"),fa);break;case "s":setTimeout(function(){Sa.call(d,w,"transparent");ya.call(d,L,-260);ya.call(d,
|
|
N,-520);ya.call(d,U,-260);ya.call(d,S,-520);ya.call(d,ga,260);sa.call(d,ga,100)},0);Z.range("all",{minX:0,maxX:360,minY:0,maxY:100});fa.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("h"),y:100-P.val("v")},Z);fa.val("y",100-P.val("s"),fa);break;case "v":setTimeout(function(){Sa.call(d,w,"000000");ya.call(d,L,-780);ya.call(d,N,260);Sa.call(d,K,ba);ya.call(d,U,-520);ya.call(d,S,260);sa.call(d,S,100);ya.call(d,ga,260);sa.call(d,ga,100)},0);Z.range("all",{minX:0,maxX:360,
|
|
minY:0,maxY:100});fa.range("rangeY",{minY:0,maxY:100});if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("h"),y:100-P.val("s")},Z);fa.val("y",100-P.val("v"),fa);break;case "r":Ba=-1040;Pa=-780;Z.range("all",{minX:0,maxX:255,minY:0,maxY:255});fa.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("b"),y:255-P.val("g")},Z);fa.val("y",255-P.val("r"),fa);break;case "g":Ba=-1560;Pa=-1820;Z.range("all",{minX:0,maxX:255,minY:0,maxY:255});fa.range("rangeY",{minY:0,maxY:255});
|
|
if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("b"),y:255-P.val("r")},Z);fa.val("y",255-P.val("g"),fa);break;case "b":Ba=-2080;Pa=-2860;Z.range("all",{minX:0,maxX:255,minY:0,maxY:255});fa.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("r"),y:255-P.val("g")},Z);fa.val("y",255-P.val("b"),fa);break;case "a":setTimeout(function(){Sa.call(d,w,"transparent");ya.call(d,L,-260);ya.call(d,N,-520);ya.call(d,U,260);ya.call(d,S,260);sa.call(d,S,100);ya.call(d,ga,0);sa.call(d,
|
|
ga,100)},0);Z.range("all",{minX:0,maxX:360,minY:0,maxY:100});fa.range("rangeY",{minY:0,maxY:255});if(P.val("ahex")==null)break;Z.val("xy",{x:P.val("h"),y:100-P.val("v")},Z);fa.val("y",255-P.val("a"),fa);break;default:throw"Invalid Mode";}switch(R){case "s":case "v":case "a":setTimeout(function(){sa.call(d,L,100);sa.call(d,U,100);ya.call(d,M,260);sa.call(d,M,100);ya.call(d,T,260);sa.call(d,T,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,w,"transparent");Sa.call(d,K,"transparent");
|
|
sa.call(d,U,100);sa.call(d,L,100);ya.call(d,L,Ba);ya.call(d,N,Ba-260);ya.call(d,U,Pa-780);ya.call(d,S,Pa-520);ya.call(d,M,Pa);ya.call(d,T,Pa-260);ya.call(d,ga,260);sa.call(d,ga,100)},0)}P.val("ahex")!=null&&qa.call(d,P)},qa=function(R,P){if(P==null||P!=fa&&P!=Z)va.call(d,R,P);setTimeout(function(){ub.call(d,R);nb.call(d,R);gb.call(d,R)},0)},wa=function(R,P){var ba=da.active;if(!(P!=Z&&ba.val()==null)){var Ba=R.val("all");switch(q.color.mode){case "h":ba.val("sv",{s:Ba.x,v:100-Ba.y},P);break;case "s":case "a":ba.val("hv",
|
|
{h:Ba.x,v:100-Ba.y},P);break;case "v":ba.val("hs",{h:Ba.x,s:100-Ba.y},P);break;case "r":ba.val("gb",{g:255-Ba.y,b:Ba.x},P);break;case "g":ba.val("rb",{r:255-Ba.y,b:Ba.x},P);break;case "b":ba.val("rg",{r:Ba.x,g:255-Ba.y},P)}}},za=function(R,P){var ba=da.active;if(!(P!=fa&&ba.val()==null))switch(q.color.mode){case "h":ba.val("h",{h:360-R.val("y")},P);break;case "s":ba.val("s",{s:100-R.val("y")},P);break;case "v":ba.val("v",{v:100-R.val("y")},P);break;case "r":ba.val("r",{r:255-R.val("y")},P);break;
|
|
case "g":ba.val("g",{g:255-R.val("y")},P);break;case "b":ba.val("b",{b:255-R.val("y")},P);break;case "a":ba.val("a",255-R.val("y"),P)}},va=function(R,P){if(P!=Z)switch(q.color.mode){case "h":var ba=R.val("sv");Z.val("xy",{x:ba!=null?ba.s:100,y:100-(ba!=null?ba.v:100)},P);break;case "s":case "a":ba=R.val("hv");Z.val("xy",{x:ba&&ba.h||0,y:100-(ba!=null?ba.v:100)},P);break;case "v":ba=R.val("hs");Z.val("xy",{x:ba&&ba.h||0,y:100-(ba!=null?ba.s:100)},P);break;case "r":ba=R.val("bg");Z.val("xy",{x:ba&&
|
|
ba.b||0,y:255-(ba&&ba.g||0)},P);break;case "g":ba=R.val("br");Z.val("xy",{x:ba&&ba.b||0,y:255-(ba&&ba.r||0)},P);break;case "b":ba=R.val("rg");Z.val("xy",{x:ba&&ba.r||0,y:255-(ba&&ba.g||0)},P)}if(P!=fa)switch(q.color.mode){case "h":fa.val("y",360-(R.val("h")||0),P);break;case "s":ba=R.val("s");fa.val("y",100-(ba!=null?ba:100),P);break;case "v":ba=R.val("v");fa.val("y",100-(ba!=null?ba:100),P);break;case "r":fa.val("y",255-(R.val("r")||0),P);break;case "g":fa.val("y",255-(R.val("g")||0),P);break;case "b":fa.val("y",
|
|
255-(R.val("b")||0),P);break;case "a":ba=R.val("a");fa.val("y",255-(ba!=null?ba:255),P)}},ub=function(R){try{var P=R.val("all");pa.css({backgroundColor:P&&"#"+P.hex||"transparent"});sa.call(d,pa,P&&Math.precision(P.a*100/255,4)||0)}catch(ba){}},nb=function(R){switch(q.color.mode){case "h":Sa.call(d,w,(new c({h:R.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var P=R.val("s");sa.call(d,N,100-(P!=null?P:100));break;case "v":P=R.val("v");sa.call(d,L,P!=null?P:100);break;case "r":sa.call(d,
|
|
N,Math.precision((R.val("r")||0)/255*100,4));break;case "g":sa.call(d,N,Math.precision((R.val("g")||0)/255*100,4));break;case "b":sa.call(d,N,Math.precision((R.val("b")||0)/255*100))}R=R.val("a");sa.call(d,H,Math.precision((255-(R||0))*100/255,4))},gb=function(R){switch(q.color.mode){case "h":var P=R.val("a");sa.call(d,ia,Math.precision((255-(P||0))*100/255,4));break;case "s":P=R.val("hva");var ba=new c({h:P&&P.h||0,s:100,v:P!=null?P.v:100});Sa.call(d,K,ba.val("hex"));sa.call(d,S,100-(P!=null?P.v:
|
|
100));sa.call(d,ia,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "v":P=R.val("hsa");ba=new c({h:P&&P.h||0,s:P!=null?P.s:100,v:100});Sa.call(d,K,ba.val("hex"));sa.call(d,ia,Math.precision((255-(P&&P.a||0))*100/255,4));break;case "r":case "g":case "b":ba=P=0;R=R.val("rgba");if(q.color.mode=="r"){P=R&&R.b||0;ba=R&&R.g||0}else if(q.color.mode=="g"){P=R&&R.b||0;ba=R&&R.r||0}else if(q.color.mode=="b"){P=R&&R.r||0;ba=R&&R.g||0}var Ba=ba>P?P:ba;sa.call(d,S,P>ba?Math.precision((P-ba)/(255-ba)*100,
|
|
4):0);sa.call(d,M,ba>P?Math.precision((ba-P)/(255-P)*100,4):0);sa.call(d,T,Math.precision(Ba/255*100,4));sa.call(d,ia,Math.precision((255-(R&&R.a||0))*100/255,4));break;case "a":P=R.val("a");Sa.call(d,K,R.val("hex")||"000000");sa.call(d,ia,P!=null?0:100);sa.call(d,ga,P!=null?100:0)}},Sa=function(R,P){R.css({backgroundColor:P&&P.length==6&&"#"+P||"transparent"})},Xa=function(R,P){if(z&&(P.indexOf("AlphaBar.png")!=-1||P.indexOf("Bars.png")!=-1||P.indexOf("Maps.png")!=-1)){R.attr("pngSrc",P);R.css({backgroundImage:"none",
|
|
filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+P+"', sizingMethod='scale')"})}else R.css({backgroundImage:"url('"+P+"')"})},ya=function(R,P){R.css({top:P+"px"})},sa=function(R,P){R.css({visibility:P>0?"visible":"hidden"});if(P>0&&P<100)if(z){var ba=R.attr("pngSrc");ba!=null&&(ba.indexOf("AlphaBar.png")!=-1||ba.indexOf("Bars.png")!=-1||ba.indexOf("Maps.png")!=-1)?R.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ba+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+
|
|
P+")"}):R.css({opacity:Math.precision(P/100,4)})}else R.css({opacity:Math.precision(P/100,4)});else if(P==0||P==100)if(z){ba=R.attr("pngSrc");ba!=null&&(ba.indexOf("AlphaBar.png")!=-1||ba.indexOf("Bars.png")!=-1||ba.indexOf("Maps.png")!=-1)?R.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ba+"', sizingMethod='scale')"}):R.css({opacity:""})}else R.css({opacity:""})},Fa=function(){da.active.val("ahex",da.current.val("ahex"))},Qa=function(){da.current.val("ahex",da.active.val("ahex"))},
|
|
xa=function(R){a(this).parents("tbody:first").find('input:radio[value!="'+R.target.value+'"]').removeAttr("checked");La.call(d,R.target.value)},bb=function(){Fa.call(d)},jb=function(){Fa.call(d);q.window.expandable&&qb.call(d);a.isFunction(Za)&&Za.call(d,da.active,ma)},Ya=function(){Qa.call(d);q.window.expandable&&qb.call(d);a.isFunction(kb)&&kb.call(d,da.active,na)},Ta=function(){vb.call(d)},rb=function(R){var P=R.val("hex");oa.css({backgroundColor:P&&"#"+P||"transparent"});sa.call(d,oa,Math.precision((R.val("a")||
|
|
0)*100/255,4))},Ja=function(R){var P=R.val("hex");R=R.val("va");Ia.css({backgroundColor:P&&"#"+P||"transparent"});sa.call(d,Ea,Math.precision((255-(R&&R.a||0))*100/255,4));if(q.window.bindToInput&&q.window.updateInputColor)q.window.input.css({backgroundColor:P&&"#"+P||"transparent",color:R==null||R.v>75?"#000000":"#ffffff"})},Ka=function(R){ja=parseInt(D.css("left"));la=parseInt(D.css("top"));Y=R.pageX;ca=R.pageY;a(document).bind("mousemove",pb).bind("mouseup",cb);R.preventDefault()},pb=function(R){D.css({left:ja-
|
|
(Y-R.pageX)+"px",top:la-(ca-R.pageY)+"px"});q.window.expandable&&!a.support.boxModel&&D.prev().css({left:D.css("left"),top:D.css("top")});R.stopPropagation();R.preventDefault();return false},cb=function(R){a(document).unbind("mousemove",pb).unbind("mouseup",cb);R.stopPropagation();R.preventDefault();return false},ob=function(R){R.preventDefault();R.stopPropagation();da.active.val("ahex",a(this).attr("title")||null,R.target);return false},kb=a.isFunction(k[1])&&k[1]||null,db=a.isFunction(k[2])&&k[2]||
|
|
null,Za=a.isFunction(k[3])&&k[3]||null,vb=function(){da.current.val("ahex",da.active.val("ahex"));var R=function(){if(!(!q.window.expandable||a.support.boxModel)){var P=D.find("table:first");D.before("<iframe/>");D.prev().css({width:P.width(),height:D.height(),opacity:0,position:"absolute",left:D.css("left"),top:D.css("top")})}};if(q.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});D.css({zIndex:20})}switch(q.window.effects.type){case "fade":D.fadeIn(q.window.effects.speed.show,
|
|
R);break;case "slide":D.slideDown(q.window.effects.speed.show,R);break;default:D.show(q.window.effects.speed.show,R)}},qb=function(){var R=function(){q.window.expandable&&D.css({zIndex:10});!q.window.expandable||a.support.boxModel||D.prev().remove()};switch(q.window.effects.type){case "fade":D.fadeOut(q.window.effects.speed.hide,R);break;case "slide":D.slideUp(q.window.effects.speed.hide,R);break;default:D.hide(q.window.effects.speed.hide,R)}},lb=function(){var R=q.window,P=R.expandable?a(d).next().find(".Container:first"):
|
|
null;D=R.expandable?a("<div/>"):a(d);D.addClass("jPicker Container");R.expandable&&D.hide();D.get(0).onselectstart=function(ib){if(ib.target.nodeName.toLowerCase()!=="input")return false};var ba=da.active.val("all");if(R.alphaPrecision<0)R.alphaPrecision=0;else if(R.alphaPrecision>2)R.alphaPrecision=2;var Ba='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(R.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(R.title||V.text.title)+
|
|
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="'+ha.clientPath+ha.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="'+ha.clientPath+ha.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+
|
|
V.text.newColor+'<div class="color_preview"><span class="Active" title="'+V.tooltips.colors.newColor+'"> </span><span class="Current" title="'+V.tooltips.colors.currentColor+'"> </span></div></div>'+V.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+V.text.ok+'" title="'+V.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+V.text.cancel+'" title="'+V.tooltips.buttons.cancel+'"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="'+
|
|
V.tooltips.hue.radio+'"><input type="radio" value="h"'+(q.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ba!=null?ba.h:"")+'" title="'+V.tooltips.hue.textbox+'"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+V.tooltips.saturation.radio+'"><input type="radio" value="s"'+(q.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ba!=
|
|
null?ba.s:"")+'" title="'+V.tooltips.saturation.textbox+'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="'+V.tooltips.value.radio+'"><input type="radio" value="v"'+(q.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ba!=null?ba.v:"")+'" title="'+V.tooltips.value.textbox+'"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+V.tooltips.red.radio+'"><input type="radio" value="r"'+(q.color.mode==
|
|
"r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ba!=null?ba.r:"")+'" title="'+V.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+V.tooltips.green.radio+'"><input type="radio" value="g"'+(q.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ba!=null?ba.g:"")+'" title="'+V.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+
|
|
V.tooltips.blue.radio+'"><input type="radio" value="b"'+(q.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ba!=null?ba.b:"")+'" title="'+V.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(R.alphaSupport?'<label title="'+V.tooltips.alpha.radio+'"><input type="radio" value="a"'+(q.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":" ")+'</td><td class="Text">'+(R.alphaSupport?'<input type="text" maxlength="'+
|
|
(3+R.alphaPrecision)+'" value="'+(ba!=null?Math.precision(ba.a*100/255,R.alphaPrecision):"")+'" title="'+V.tooltips.alpha.textbox+'"/> %':" ")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+V.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ba!=null?ba.hex:"")+'"/></label>'+(R.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ba!=null?ba.ahex.substring(6):"")+'" title="'+V.tooltips.hex.alpha+'"/></td>':" ")+
|
|
"</tr></tbody></table>";if(R.expandable){D.html(Ba);a(document.body).children("div.jPicker.Container").length==0?a(document.body).prepend(D):a(document.body).children("div.jPicker.Container:last").after(D);D.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});D.css({zIndex:20})});D.css({left:R.position.x=="left"?P.offset().left-530-(R.position.y=="center"?25:0)+"px":R.position.x=="center"?P.offset().left-260+"px":R.position.x=="right"?P.offset().left-10+(R.position.y==
|
|
"center"?25:0)+"px":R.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":P.offset().left+parseInt(R.position.x)+"px",position:"absolute",top:R.position.y=="top"?P.offset().top-312+"px":R.position.y=="center"?P.offset().top-156+"px":R.position.y=="bottom"?P.offset().top+25+"px":P.offset().top+parseInt(R.position.y)+"px"})}else{D=a(d);D.html(Ba)}Ba=D.find("tbody:first");w=Ba.find("div.Map:first");K=Ba.find("div.Bar:first");var Pa=w.find("span"),Ra=K.find("span");L=Pa.filter(".Map1:first");
|
|
N=Pa.filter(".Map2:first");H=Pa.filter(".Map3:first");U=Ra.filter(".Map1:first");S=Ra.filter(".Map2:first");M=Ra.filter(".Map3:first");T=Ra.filter(".Map4:first");ia=Ra.filter(".Map5:first");ga=Ra.filter(".Map6:first");Z=new n(w,{map:{width:ha.colorMap.width,height:ha.colorMap.height},arrow:{image:ha.clientPath+ha.colorMap.arrow.file,width:ha.colorMap.arrow.width,height:ha.colorMap.arrow.height}});Z.bind(wa);fa=new n(K,{map:{width:ha.colorBar.width,height:ha.colorBar.height},arrow:{image:ha.clientPath+
|
|
ha.colorBar.arrow.file,width:ha.colorBar.arrow.width,height:ha.colorBar.arrow.height}});fa.bind(za);ua=new e(Ba,da.active,R.expandable&&R.bindToInput?R.input:null,R.alphaPrecision);Pa=ba!=null?ba.hex:null;var eb=Ba.find(".Preview");Ra=Ba.find(".Button");pa=eb.find(".Active:first").css({backgroundColor:Pa&&"#"+Pa||"transparent"});oa=eb.find(".Current:first").css({backgroundColor:Pa&&"#"+Pa||"transparent"}).bind("click",bb);sa.call(d,oa,Math.precision(da.current.val("a")*100)/255,4);na=Ra.find(".Ok:first").bind("click touchstart",
|
|
Ya);ma=Ra.find(".Cancel:first").bind("click touchstart",jb);Ha=Ra.find(".Grid:first");setTimeout(function(){Xa.call(d,L,ha.clientPath+"Maps.png");Xa.call(d,N,ha.clientPath+"Maps.png");Xa.call(d,H,ha.clientPath+"map-opacity.png");Xa.call(d,U,ha.clientPath+"Bars.png");Xa.call(d,S,ha.clientPath+"Bars.png");Xa.call(d,M,ha.clientPath+"Bars.png");Xa.call(d,T,ha.clientPath+"Bars.png");Xa.call(d,ia,ha.clientPath+"bar-opacity.png");Xa.call(d,ga,ha.clientPath+"AlphaBar.png");Xa.call(d,eb.find("div:last"),ha.clientPath+
|
|
"preview-opacity.png")},0);Ba.find("td.Radio input").bind("click touchstart",xa);if(da.quickList&&da.quickList.length>0){Ra="";for(i=0;i<da.quickList.length;i++){if((typeof da.quickList[i]).toString().toLowerCase()=="string")da.quickList[i]=new c({hex:da.quickList[i]});var Wa=da.quickList[i].val("a"),Da=da.quickList[i].val("ahex");if(!R.alphaSupport&&Da)Da=Da.substring(0,6)+"ff";var Na=da.quickList[i].val("hex");Ra+='<span class="QuickColor"'+(Da&&' title="#'+Da+'"'||"")+' style="background-color:'+
|
|
(Na&&"#"+Na||"")+";"+(Na?"":"background-image:url("+ha.clientPath+"NoColor.png)")+(R.alphaSupport&&Wa&&Wa<255?";opacity:"+Math.precision(Wa/255,4)+";filter:Alpha(opacity="+Math.precision(Wa/2.55,4)+")":"")+'"> </span>'}Xa.call(d,Ha,ha.clientPath+"bar-opacity.png");Ha.html(Ra);Ha.find(".QuickColor").click(ob)}La.call(d,q.color.mode);da.active.bind(qa);a.isFunction(db)&&da.active.bind(db);da.current.bind(rb);if(R.expandable){d.icon=P.parents(".Icon:first");Ia=d.icon.find(".Color:first").css({backgroundColor:Pa&&
|
|
"#"+Pa||"transparent"});Ea=d.icon.find(".Alpha:first");Xa.call(d,Ea,ha.clientPath+"bar-opacity.png");sa.call(d,Ea,Math.precision((255-(ba!=null?ba.a:0))*100/255,4));Va=d.icon.find(".Image:first").css({backgroundImage:"url('"+ha.clientPath+ha.picker.file+"')"}).bind("click",Ta);if(R.bindToInput&&R.updateInputColor)R.input.css({backgroundColor:Pa&&"#"+Pa||"transparent",color:ba==null||ba.v>75?"#000000":"#ffffff"});Ua=Ba.find(".Move:first").bind("mousedown",Ka);da.active.bind(Ja)}else vb.call(d)},ha=
|
|
q.images,V=q.localization,da={active:(typeof q.color.active).toString().toLowerCase()=="string"?new c({ahex:!q.window.alphaSupport&&q.color.active?q.color.active.substring(0,6)+"ff":q.color.active}):new c({ahex:!q.window.alphaSupport&&q.color.active.val("ahex")?q.color.active.val("ahex").substring(0,6)+"ff":q.color.active.val("ahex")}),current:(typeof q.color.active).toString().toLowerCase()=="string"?new c({ahex:!q.window.alphaSupport&&q.color.active?q.color.active.substring(0,6)+"ff":q.color.active}):
|
|
new c({ahex:!q.window.alphaSupport&&q.color.active.val("ahex")?q.color.active.val("ahex").substring(0,6)+"ff":q.color.active.val("ahex")}),quickList:q.color.quickList};a.extend(true,d,{commitCallback:kb,liveCallback:db,cancelCallback:Za,color:da,show:vb,hide:qb,destroy:function(){D.find("td.Radio input touchstart").unbind("click",xa);oa.unbind("click touchstart",bb);ma.unbind("click touchstart",jb);na.unbind("click touchstart",Ya);if(q.window.expandable){Va.unbind("click",Ta);Ua.unbind("mousedown",
|
|
Ka);d.icon=null}D.find(".QuickColor").unbind("click",ob);ga=ia=T=M=S=U=H=N=L=K=w=null;Z.destroy();Z=null;fa.destroy();fa=null;ua.destroy();db=Za=kb=Ha=ma=na=oa=pa=ua=null;D.html("");for(i=0;i<l.length;i++)l[i]==d&&l.splice(i,1)}});l.push(d);setTimeout(function(){lb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},
|
|
color:{mode:"h",active:new c({ahex:"#ffcc00ff"}),quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,
|
|
s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,
|
|
s:66,v:100}),new c({h:180,s:100,v:100}),new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,s:33,v:100}),new c({h:210,s:66,v:100}),new c({h:210,s:100,v:100}),new c({h:210,s:100,v:75}),new c({h:210,s:100,v:50}),new c({h:180,s:0,v:30}),new c({h:240,s:33,v:100}),new c({h:240,s:66,v:100}),new c({h:240,s:100,v:100}),new c({h:240,s:100,v:75}),new c({h:240,s:100,v:50}),new c({h:180,s:0,v:20}),new c({h:270,s:33,v:100}),new c({h:270,s:66,v:100}),new c({h:270,s:100,v:100}),
|
|
new c({h:270,s:100,v:75}),new c({h:270,s:100,v:50}),new c({h:180,s:0,v:10}),new c({h:300,s:33,v:100}),new c({h:300,s:66,v:100}),new c({h:300,s:100,v:100}),new c({h:300,s:100,v:75}),new c({h:300,s:100,v:50}),new c({h:180,s:0,v:0}),new c({h:330,s:33,v:100}),new c({h:330,s:66,v:100}),new c({h:330,s:100,v:100}),new c({h:330,s:100,v:75}),new c({h:330,s:100,v:50}),new c]},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:20,height:7}},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%)"},value:{radio:"Set To “Value” Color Mode",textbox:"Enter A “Value” 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)",alpha:"Enter A “Alpha” Value (#00-#ff)"}}}}})(jQuery,"1.1.6");(function(a){function n(l){var u=l||window.event,b=[].slice.call(arguments,1),k=0,d=0,q=0;l=a.event.fix(u);l.type="mousewheel";if(u.wheelDelta)k=u.wheelDelta/120;if(u.detail)k=-u.detail/3;q=k;if(u.axis!==undefined&&u.axis===u.HORIZONTAL_AXIS){q=0;d=-1*k}if(u.wheelDeltaY!==undefined)q=u.wheelDeltaY/120;if(u.wheelDeltaX!==undefined)d=-1*u.wheelDeltaX/120;b.unshift(l,k,d,q);return(a.event.dispatch||a.event.handle).apply(this,b)}var e=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=e.length;c;)a.event.fixHooks[e[--c]]=
|
|
a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var l=e.length;l;)this.addEventListener(e[--l],n,false);else this.onmousewheel=n},teardown:function(){if(this.removeEventListener)for(var l=e.length;l;)this.removeEventListener(e[--l],n,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(l){return l?this.bind("mousewheel",l):this.trigger("mousewheel")},unmousewheel:function(l){return this.unbind("mousewheel",l)}})})(jQuery);methodDraw.addExtension("eyedropper",function(a){var n=methodDraw.canvas,e=svgedit.history.ChangeElementCommand,c={fillPaint:"red",fillOpacity:1,strokePaint:"black",strokeOpacity:1,strokeWidth:5,strokeDashArray:null,opacity:1,strokeLinecap:"butt",strokeLinejoin:"miter"},l=function(u,b,k){var d=null;if(u.indexOf("url(#")===0){u=(u=n.getRefElem(u))?u.cloneNode(true):$("#"+k+"_color defs *")[0];d={alpha:b};d[u.tagName]=u}else d=u.indexOf("#")===0?{alpha:b,solidColor:u.substr(1)}:{alpha:b,solidColor:"none"};
|
|
return new $.jGraduate.Paint(d)};return{name:"eyedropper",svgicons:"extensions/eyedropper-icon.xml",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",position:8,key:"I",icon:"extensions/eyedropper.png",events:{click:function(){n.setMode("eyedropper")}}}],mouseDown:function(u){var b=n.getMode(),k=u.event;k=k.target.id==="svgroot"?document.getElementById("canvas_background"):k.target;if(b=="eyedropper"&&k){c.fillPaint=k.getAttribute("fill")||"white";c.fillOpacity=k.getAttribute("fill-opacity")||
|
|
1;c.strokePaint=k.getAttribute("stroke")||"none";c.strokeOpacity=k.getAttribute("stroke-opacity")||1;c.strokeWidth=k.getAttribute("stroke-width");c.strokeDashArray=k.getAttribute("stroke-dasharray");c.strokeLinecap=k.getAttribute("stroke-linecap");c.strokeLinejoin=k.getAttribute("stroke-linejoin");c.opacity=k.getAttribute("opacity")||1;u.selectedElements=u.selectedElements.filter(Boolean);if(u.selectedElements.length){if($.inArray(u.selectedElements.nodeName,["g","use"])==-1){var d={},q=function(D,
|
|
w,K){d[w]=D.getAttribute(w);D.setAttribute(w,K)},z=new a.BatchCommand;u.selectedElements.forEach(function(D){c.fillPaint&&q(D,"fill",c.fillPaint);c.fillOpacity&&q(D,"fill-opacity",c.fillOpacity);c.strokePaint&&q(D,"stroke",c.strokePaint);c.strokeOpacity&&q(D,"stroke-opacity",c.strokeOpacity);c.strokeWidth&&q(D,"stroke-width",c.strokeWidth);c.strokeDashArray&&q(D,"stroke-dasharray",c.strokeDashArray);c.opacity&&q(D,"opacity",c.opacity);c.strokeLinecap&&q(D,"stroke-linecap",c.strokeLinecap);c.strokeLinejoin&&
|
|
q(D,"stroke-linejoin",c.strokeLinejoin);z.addSubCommand(new e(D,d));d={}});u=l(c.fillPaint,c.fillOpacity*100,"fill");b=l(c.strokePaint,c.strokeOpacity*100,"stroke");methodDraw.paintBox.fill.update(true);methodDraw.paintBox.stroke.update(true);n.undoMgr.addCommandToHistory(z)}}else{u=l(c.fillPaint,c.fillOpacity*100,"fill");b=l(c.strokePaint,c.strokeOpacity*100,"stroke");methodDraw.paintBox.fill.setPaint(u);methodDraw.paintBox.stroke.setPaint(b)}}}}});methodDraw.addExtension("view_grid",function(a){function n(q){k.attr("width");k.attr("height");var z=svgedit.units.getTypeMap()[methodDraw.curConfig.baseUnit],D=[0.01,0.1,1,10,100,1E3];c.getContentElem().getAttribute("x");var w=u;z=z*q;var K=100/z,L=1;for(q=0;q<D.length;q++){var N=D[q];L=N;if(K<=N)break}D=L*z;w.width=D;w.height=D;z=w.getContext("2d");K=D/10;z.globalAlpha=0.2;z.strokeStyle="#000";for(q=1;q<10;q++){L=Math.round(K*q)+0.5;z.moveTo(L,D);z.lineTo(L,0);z.moveTo(D,L);z.lineTo(0,L)}z.stroke();
|
|
z.beginPath();z.globalAlpha=0.5;z.moveTo(0.5,D);z.lineTo(0.5,0);z.moveTo(D,0.5);z.lineTo(0,0.5);z.stroke();w=w.toDataURL("image/png");d.setAttribute("width",D);d.setAttribute("height",D);d.parentNode.setAttribute("width",D);d.parentNode.setAttribute("height",D);c.setHref(d,w)}if(!document.getElementById("canvasGrid")){var e=document.getElementById("svgcanvas").ownerDocument,c=methodDraw.canvas,l=false;a=a.assignAttributes;var u=document.createElement("canvas");$(u).hide().appendTo("body");var b=e.createElementNS("http://www.w3.org/2000/svg",
|
|
"g");a(b,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var k=$("#canvas_background");k.after(b);b=e.createElementNS("http://www.w3.org/2000/svg","pattern");a(b,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var d=e.createElementNS("http://www.w3.org/2000/svg","image");a(d,{x:0,y:0,width:100,height:100});b.appendChild(d);$("#svgroot defs").append(b);e=e.createElementNS("http://www.w3.org/2000/svg","rect");a(e,{width:"100%",height:"100%",
|
|
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(e)}return{name:"view_grid",zoomChanged:function(q){l&&n(q)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){methodDraw.curConfig.showGrid=l=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{methodDraw.curConfig.showGrid=
|
|
l=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","inline");n(c.getZoom())}}}}]}});methodDraw.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(K.buttons)}function n(N){var H=w[N];if(H){K=H;H.buttons.length||e(N,H);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+N+".json",function(U){K=w[N]={data:U.data,size:U.size,fill:U.fill};e(N,U);a()})}}function e(N,H){var U=K.size||300,S=K.fill||false,M=U*0.05;M=[-M,-M,U+M*2,U+M*2].join(" ");U=S?0:U/30;U=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
|
|
M+'"><path fill="#333" stroke="transparent" stroke-width="'+U+'" /></svg></svg>',"text/xml");U.documentElement.setAttribute("width",40);U.documentElement.setAttribute("height",40);U=$(document.importNode(U.documentElement,true));S=H.data;K.buttons=[];for(var T in S){M=S[T];var ia=U.clone();ia.find("path").attr("d",M);M=ia.wrap('<div class="tool_button">').parent().attr({id:L+"_"+T,title:T});K.buttons.push(M[0])}}var c,l,u=methodDraw.canvas,b,k,d,q=u.getRootElem(),z={},D={basic:"Basic",object:"Objects",
|
|
symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather & Time",ui:"User Interface",social:"Social Web"},w={basic:{data:{star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z",donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",
|
|
triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z",pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",
|
|
heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z",decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",
|
|
trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",dialog_balloon_1:"m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z",heart:"m150,73c61,-175 300,0 0,225c-300,-225 -61,-400 0,-225z",
|
|
cylinder:"m299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m149.00002,-33.11111l0,0c0,18.28676 -66.70958,33.11111 -149.00002,33.11111c-82.29041,0 -148.99997,-14.82432 -148.99997,-33.11111m0,0l0,0c0,-18.28674 66.70956,-33.1111 148.99997,-33.1111c82.29044,0 149.00002,14.82436 149.00002,33.1111l0,132.44449c0,18.28674 -66.70958,33.11105 -149.00002,33.11105c-82.29041,0 -148.99997,-14.82431 -148.99997,-33.11105z",arrow_up:"m1.49805,149.64304l148.50121,-148.00241l148.50121,148.00241l-74.25061,0l0,148.71457l-148.5012,0l0,-148.71457z",
|
|
arrow_u_turn:"m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z",arrow_left_up:"m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z",
|
|
plaque:"m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z",page:"m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234",cross:"m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z",
|
|
divide:"m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z",minus:"m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z",
|
|
times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z"},buttons:[]}},K=w.basic,L="shapelib";return{svgicons:"extensions/ext-shapes.xml",buttons:[{id:"tool_shapelib",type:"mode_flyout",position:6,title:"Shape library",icon:"extensions/ext-shapes.png",events:{click:function(){u.setMode(L)}}}],callback:function(){var N=
|
|
$('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(N);var H=$("#tools_shapelib_show");n("basic");$("#shape_buttons").mouseup(function(S){S=$(S.target).closest("div.tool_button");if(S.length){var M=S.children().clone().attr({width:24,height:24});H.children(":not(.flyout_arrow_horiz)").remove();H.append(M).attr("data-curopt","#"+S[0].id).mouseup();u.setMode(L);l=S[0].id.substr((L+"_").length);c=K.data[l];$(".tools_flyout").fadeOut()}});N=$('<div id="shape_cats">');var U="";$.each(D,function(S,
|
|
M){U+="<div data-cat="+S+">"+M+"</div>"});N.html(U).children().bind("mouseup",function(){var S=$(this);S.siblings().removeClass("current");S.addClass("current");n(S.attr("data-cat"));return false});N.children().eq(0).addClass("current");$("#tools_shapelib").prepend(N);H.mouseup(function(){u.setMode(c?L:"select")});$("#tool_shapelib").remove();N=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(N/2),"margin-left":3})},mouseDown:function(N){if(u.getMode()===L){var H=k=N.start_x;
|
|
N=d=N.start_y;var U=u.getStyle();b=u.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:c,id:u.getNextId(),opacity:U.opacity/2,style:"pointer-events:none"}});b.setAttribute("d",c);if(/[a-z]/.test(c)){c=K.data[l]=u.pathActions.convertPath(b);b.setAttribute("d",c);u.pathActions.fixEnd(b)}b.setAttribute("transform","translate("+H+","+N+") scale(0.005) translate("+-H+","+-N+")");u.recalculateDimensions(b);u.getTransformList(b);z=b.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(N){if(u.getMode()===
|
|
L){var H=u.getZoom(),U=N.event,S=N.mouse_x/H,M=N.mouse_y/H;N=u.getTransformList(b);var T=b.getBBox();H=T.x;var ia=T.y,ga=T.width,Z=T.height,fa=S-k,ua=M-d,ja={x:Math.min(k,S),y:Math.min(d,M),width:Math.abs(S-k),height:Math.abs(M-d)},la=T=0;Z=Z?(Z+ua)/Z:1;ga=ga?(ga+fa)/ga:1;ga=ja.width/z.width;Z=ja.height/z.height;ga=ga||1;Z=Z||1;if(S<k)T=z.width;if(M<d)la=z.height;S=q.createSVGTransform();M=q.createSVGTransform();ja=q.createSVGTransform();S.setTranslate(-(H+T),-(ia+la));if(U.shiftKey){replaced=true;
|
|
U=Math.min(Math.abs(ga),Math.abs(Z));ga=U*(ga<0?-1:1);Z=U*(Z<0?-1:1);if(totalScale.sx!=totalScale.sy){U=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;ga*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;Z*=U}}totalScale.sx*=ga;totalScale.sy*=Z;M.setScale(ga,Z);ja.setTranslate(H+T,ia+la);N.appendItem(ja);N.appendItem(M);N.appendItem(S);u.recalculateDimensions(b);z=b.getBBox()}},mouseUp:function(N){if(u.getMode()===L){if(N.mouse_x==k&&N.mouse_y==d)return{keep:false,element:b,started:false};
|
|
u.setMode("select");return{keep:true,element:b,started:false}}}}});(function(){for(var a=0,n=["ms","moz","webkit","o"],e=0;e<n.length&&!window.requestAnimationFrame;++e){window.requestAnimationFrame=window[n[e]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[n[e]+"CancelAnimationFrame"]||window[n[e]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(c){var l=(new Date).getTime(),u=Math.max(0,16-(l-a)),b=window.setTimeout(function(){c(l+u)},u);a=l+u;return b};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
|
|
function(c){clearTimeout(c)}})();(function(a){function n(w){var K=w.originalEvent;if(!K.touches||K.targetTouches.length===1&&K.touches.length===1){b.call(this,w);w=a(this);w.bind(z,e);w.bind(q,c)}else{clearTimeout(D);u.call(this)}}function e(w){if(D!=null){var K=w.originalEvent;w=K.changedTouches?K.changedTouches[0].pageX:K.pageX;K=K.changedTouches?K.changedTouches[0].pageY:K.pageY;var L=a(this).data("taphold.point");w=w-L.x;K=K-L.y;if(Math.sqrt(w*w+K*K)>d){clearTimeout(D);u.call(this)}}}function c(){clearTimeout(D);u.call(this)}
|
|
function l(w){u.call(this);a(this).data("taphold.handler").call(this,w)}function u(){D=null;a(this).unbind(z,e);a(this).unbind(q,c)}function b(w){if(D==null){var K=this;D=setTimeout(function(){l.call(K,w)},k);var L=w.originalEvent,N={};N.x=L.changedTouches?L.changedTouches[0].pageX:L.pageX;N.y=L.changedTouches?L.changedTouches[0].pageY:L.pageY;a(this).data("taphold.point",N)}}var k=1E3,d=5,q="touchend",z="touchmove",D=null;a.event.special.taphold={setup:function(){},add:function(w){a(this).data("taphold.handler",
|
|
w.handler);w.data?a(this).bind("touchstart",w.data,n):a(this).bind("touchstart",n)},remove:function(w){clearTimeout(D);u.call(this);w.data?a(this).unbind("touchstart",w.data,n):a(this).unbind("touchstart",n)},teardown:function(){}}})(jQuery);var saveAs=saveAs||function(a){if(!(typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent))){var n=a.document.createElementNS("http://www.w3.org/1999/xhtml","a"),e="download"in n,c=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),l=a.webkitRequestFileSystem,u=a.requestFileSystem||l||a.mozRequestFileSystem,b=function(K){(a.setImmediate||a.setTimeout)(function(){throw K;},0)},k=0,d=function(K){var L=function(){typeof K==="string"?(a.URL||a.webkitURL||a).revokeObjectURL(K):K.remove()};
|
|
a.chrome?L():setTimeout(L,500)},q=function(K,L,N){L=[].concat(L);for(var H=L.length;H--;){var U=K["on"+L[H]];if(typeof U==="function")try{U.call(K,N||K)}catch(S){b(S)}}},z=function(K){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(K.type))return new Blob(["\ufeff",K],{type:K.type});return K},D=function(K,L,N){N||(K=z(K));var H=this;N=K.type;var U=false,S,M,T=function(){q(H,"writestart progress write writeend".split(" "))},ia=function(){if(M&&c&&typeof FileReader!==
|
|
"undefined"){var ua=new FileReader;ua.onloadend=function(){var ja=ua.result;M.location.href="data:attachment/file"+ja.slice(ja.search(/[,;]/));H.readyState=H.DONE;T()};ua.readAsDataURL(K);H.readyState=H.INIT}else{if(U||!S)S=(a.URL||a.webkitURL||a).createObjectURL(K);if(M)M.location.href=S;else if(a.open(S,"_blank")==undefined&&c)a.location.href=S;H.readyState=H.DONE;T();d(S)}},ga=function(ua){return function(){if(H.readyState!==H.DONE)return ua.apply(this,arguments)}},Z={create:true,exclusive:false},
|
|
fa;H.readyState=H.INIT;L||(L="download");if(e){S=(a.URL||a.webkitURL||a).createObjectURL(K);setTimeout(function(){n.href=S;n.download=L;var ua=new MouseEvent("click");n.dispatchEvent(ua);T();d(S);H.readyState=H.DONE})}else{if(a.chrome&&N&&N!=="application/octet-stream"){fa=K.slice||K.webkitSlice;K=fa.call(K,0,K.size,"application/octet-stream");U=true}if(l&&L!=="download")L+=".download";if(N==="application/octet-stream"||l)M=a;if(u){k+=K.size;u(a.TEMPORARY,k,ga(function(ua){ua.root.getDirectory("saved",
|
|
Z,ga(function(ja){var la=function(){ja.getFile(L,Z,ga(function(Y){Y.createWriter(ga(function(ca){ca.onwriteend=function(pa){M.location.href=Y.toURL();H.readyState=H.DONE;q(H,"writeend",pa);d(Y)};ca.onerror=function(){var pa=ca.error;pa.code!==pa.ABORT_ERR&&ia()};"writestart progress write abort".split(" ").forEach(function(pa){ca["on"+pa]=H["on"+pa]});ca.write(K);H.abort=function(){ca.abort();H.readyState=H.DONE};H.readyState=H.WRITING}),ia)}),ia)};ja.getFile(L,{create:false},ga(function(Y){Y.remove();
|
|
la()}),ga(function(Y){Y.code===Y.NOT_FOUND_ERR?la():ia()}))}),ia)}),ia)}else ia()}},w=D.prototype;if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob)return function(K,L,N){N||(K=z(K));return navigator.msSaveOrOpenBlob(K,L||"download")};w.abort=function(){this.readyState=this.DONE;q(this,"abort")};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return function(K,L,N){return new D(K,L,N)}}}(typeof self!=="undefined"&&
|
|
self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports)module.exports.saveAs=saveAs;else typeof define!=="undefined"&&define!==null&&define.amd!=null&&define([],function(){return saveAs});
|