2012-07-25 08:56:15 +00:00
function touchHandler ( a ) { var p = a . changedTouches , g = p [ 0 ] , c = "" ; switch ( a . type ) { case "touchstart" : c = "mousedown" ; break ; case "touchmove" : c = "mousemove" ; break ; case "touchend" : c = "mouseup" ; break ; default : return } var m = document . createEvent ( "MouseEvent" ) ; m . initMouseEvent ( c , true , true , window , 1 , g . screenX , g . screenY , g . clientX , g . clientY , false , false , false , false , 0 , null ) ; if ( p . length < 2 ) { g . target . dispatchEvent ( m ) ; a . preventDefault ( ) } } ; ( function ( a ) { function p ( g ) { if ( typeof g . data === "string" ) { var c = g . handler , m = g . data . toLowerCase ( ) . split ( " " ) ; g . handler = function ( s ) { if ( ! ( this !== s . target && ( /textarea|select/i . test ( s . target . nodeName ) || s . target . type === "text" ) ) ) { var b = s . type !== "keypress" && a . hotkeys . specialKeys [ s . which ] , f = String . fromCharCode ( s . which ) . toLowerCase ( ) , d = "" , k = { } ; if ( s . altKey && b !== "alt" ) d += "alt+" ; if ( s . ctrlKey && b !== "ctrl" ) d += "ctrl+" ; if ( s . metaKey && ! s . ctrlKey && b !== "meta" ) d += "meta+" ; if ( s . shiftKey && b !== "shift" ) d += "shift+" ; if ( b ) k [ d + b ] =
true ; else { k [ d + f ] = true ; k [ d + a . hotkeys . shiftNums [ f ] ] = true ; if ( d === "shift+" ) k [ a . hotkeys . shiftNums [ f ] ] = true } b = 0 ; for ( f = m . length ; b < f ; b ++ ) if ( k [ m [ 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 : p } } ) } ) ( jQuery ) ; ( function ( a , p ) { function g ( da ) { return typeof da === "string" } function c ( da ) { var X = d . call ( arguments , 1 ) ; return function ( ) { return da . apply ( this , X . concat ( d . call ( arguments ) ) ) } } function m ( da , X , Z , oa , ra ) { var ma ; if ( oa !== f ) { X = Z . match ( da ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/ ) ; Z = X [ 3 ] || "" ; if ( ra === 2 && g ( oa ) ) oa = oa . replace ( da ? W : ba , "" ) ; else { ma = o ( X [ 2 ] ) ; oa = g ( oa ) ? o [ da ? ia : P ] ( oa ) : oa ; oa = ra === 2 ? oa : ra === 1 ? a . extend ( { } , oa , ma ) : a . extend ( { } , ma , oa ) ; oa = q ( oa ) ; if ( da ) oa = oa . replace ( ta , k ) } da = X [ 1 ] + ( da ? "#" : oa || ! X [ 1 ] ? "?" : "" ) + oa + Z } else da =
X ( Z !== f ? Z : p [ qa ] [ ga ] ) ; return da } function s ( da , X , Z ) { if ( X === f || typeof X === "boolean" ) { Z = X ; X = q [ da ? ia : P ] ( ) } else X = g ( X ) ? X . replace ( da ? W : ba , "" ) : X ; return o ( X , Z ) } function b ( da , X , Z , oa ) { if ( ! g ( Z ) && typeof Z !== "object" ) { oa = Z ; Z = X ; X = f } return this . each ( function ( ) { var ra = a ( this ) , ma = X || S ( ) [ ( this . nodeName || "" ) . toLowerCase ( ) ] || "" , na = ma && ra . attr ( ma ) || "" ; ra . attr ( ma , q [ da ] ( na , Z , oa ) ) } ) } var f , d = Array . prototype . slice , k = decodeURIComponent , q = a . param , B , o , J , U = a . bbq = a . bbq || { } , M , I , S , Y = a . event . special , P = "querystring" , ia = "fragment" , qa =
"location" , ga = "href" , ba = /^.*\?|#.*$/g , W = /^.*\#/ , ta , ka = { } ; q [ P ] = c ( m , 0 , function ( da ) { return da . replace ( /(?:^[^?#]*\?([^#]*).*$)?.*/ , "$1" ) } ) ; q [ ia ] = B = c ( m , 1 , function ( da ) { return da . replace ( /^[^#]*#?(.*)$/ , "$1" ) } ) ; B . noEscape = function ( da ) { da = da || "" ; da = a . map ( da . split ( "" ) , encodeURIComponent ) ; ta = RegExp ( da . join ( "|" ) , "g" ) } ; B . noEscape ( ",/" ) ; a . deparam = o = function ( da , X ) { var Z = { } , oa = { "true" : true , "false" : false , "null" : null } ; a . each ( da . replace ( /\+/g , " " ) . split ( "&" ) , function ( ra , ma ) { var na = ma . split ( "=" ) , Ca = k ( na [ 0 ] ) , Ga = Z , Ja =
0 , Da = Ca . split ( "][" ) , La = Da . length - 1 ; if ( /\[/ . test ( Da [ 0 ] ) && /\]$/ . test ( Da [ La ] ) ) { Da [ La ] = Da [ La ] . replace ( /\]$/ , "" ) ; Da = Da . shift ( ) . split ( "[" ) . concat ( Da ) ; La = Da . length - 1 } else La = 0 ; if ( na . length === 2 ) { na = k ( na [ 1 ] ) ; if ( X ) na = na && ! isNaN ( na ) ? + na : na === "undefined" ? f : oa [ na ] !== f ? oa [ na ] : na ; if ( La ) for ( ; Ja <= La ; Ja ++ ) { Ca = Da [ Ja ] === "" ? Ga . length : Da [ Ja ] ; Ga = Ga [ Ca ] = Ja < La ? Ga [ Ca ] || ( Da [ Ja + 1 ] && isNaN ( Da [ Ja + 1 ] ) ? { } : [ ] ) : na } else if ( a . isArray ( Z [ Ca ] ) ) Z [ Ca ] . push ( na ) ; else Z [ Ca ] = Z [ Ca ] !== f ? [ Z [ Ca ] , na ] : na } else if ( Ca ) Z [ Ca ] = X ? f : "" } ) ; return Z } ; o [ P ] = c ( s ,
0 ) ; o [ ia ] = J = c ( s , 1 ) ; a . elemUrlAttr || ( a . elemUrlAttr = function ( da ) { return a . extend ( ka , da ) } ) ( { a : ga , base : ga , iframe : "src" , img : "src" , input : "src" , form : "action" , link : ga , script : "src" } ) ; S = a . elemUrlAttr ; a . fn [ P ] = c ( b , P ) ; a . fn [ ia ] = c ( b , ia ) ; U . pushState = M = function ( da , X ) { if ( g ( da ) && /^#/ . test ( da ) && X === f ) X = 2 ; var Z = da !== f ; Z = B ( p [ qa ] [ ga ] , Z ? da : { } , Z ? X : 2 ) ; p [ qa ] [ ga ] = Z + ( /#/ . test ( Z ) ? "" : "#" ) } ; U . getState = I = function ( da , X ) { return da === f || typeof da === "boolean" ? J ( da ) : J ( X ) [ da ] } ; U . removeState = function ( da ) { var X = { } ; if ( da !== f ) { X = I ( ) ; a . each ( a . isArray ( da ) ?
da : arguments , function ( Z , oa ) { delete X [ oa ] } ) } M ( X , 2 ) } ; Y . hashchange = a . extend ( Y . hashchange , { add : function ( da ) { function X ( oa ) { var ra = oa [ ia ] = B ( ) ; oa . getState = function ( ma , na ) { return ma === f || typeof ma === "boolean" ? o ( ra , ma ) : o ( ra , na ) [ ma ] } ; Z . apply ( this , arguments ) } var Z ; if ( a . isFunction ( da ) ) { Z = da ; return X } else { Z = da . handler ; da . handler = X } } } ) } ) ( jQuery , this ) ;
( function ( a , p , g ) { function c ( B ) { B = B || p [ b ] [ f ] ; return B . replace ( /^[^#]*#?(.*)$/ , "$1" ) } var m , s = a . event . special , b = "location" , f = "href" , d = document . documentMode , k = a . browser . msie && ( d === g || d < 8 ) , q = "onhashchange" in p && ! k ; a . hashchangeDelay = 100 ; s . hashchange = a . extend ( s . hashchange , { setup : function ( ) { if ( q ) return false ; a ( m . start ) } , teardown : function ( ) { if ( q ) return false ; a ( m . stop ) } } ) ; m = function ( ) { function B ( ) { M = I = function ( S ) { return S } ; if ( k ) { U = a ( '<iframe src="javascript:0"/>' ) . hide ( ) . insertAfter ( "body" ) [ 0 ] . contentWindow ;
I = function ( ) { return c ( U . document [ b ] [ f ] ) } ; M = function ( S , Y ) { if ( S !== Y ) { var P = U . document ; P . open ( ) . close ( ) ; P [ b ] . hash = "#" + S } } ; M ( c ( ) ) } } var o = { } , J , U , M , I ; o . start = function ( ) { if ( ! J ) { var S = c ( ) ; M || B ( ) ; ( function Y ( ) { var P = c ( ) , ia = I ( S ) ; if ( P !== S ) { M ( S = P , ia ) ; a ( p ) . trigger ( "hashchange" ) } else if ( ia !== S ) p [ b ] [ f ] = p [ b ] [ f ] . replace ( /#.*/ , "" ) + "#" + ia ; J = setTimeout ( Y , a . hashchangeDelay ) } ) ( ) } } ; o . stop = function ( ) { if ( ! U ) { J && clearTimeout ( J ) ; J = 0 } } ; return o } ( ) } ) ( jQuery , this ) ; ( function ( a ) { var p = { } , g ; a . svgIcons = function ( c , m ) { function s ( da , X ) { if ( da !== "ajax" ) { if ( S ) return ; var Z = ( U = ga [ 0 ] . contentDocument ) && U . getElementById ( "svg_eof" ) ; if ( ! Z && ! ( X && Z ) ) { Y ++ ; if ( Y < 50 ) setTimeout ( s , 20 ) ; else { f ( ) ; S = true } return } S = true } J = a ( U . firstChild ) . children ( ) ; if ( m . no _img ) setTimeout ( function ( ) { I || b ( ) } , 500 ) ; else { Z = qa + "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D" ; M = a ( new Image ) . attr ( { src : Z , width : 0 , height : 0 } ) . appendTo ( "body" ) . load ( function ( ) { b ( true ) } ) . error ( function ( ) { b ( ) } ) } }
function b ( da , X ) { if ( ! I ) { if ( m . no _img ) da = false ; if ( da ) { var Z = a ( document . createElement ( "div" ) ) ; Z . hide ( ) . appendTo ( "body" ) } if ( X ) { var oa = m . fallback _path ? m . fallback _path : "" ; a . each ( X , function ( La , Oa ) { a ( "#" + La ) ; var Ba = a ( new Image ) . attr ( { "class" : "svg_icon" , src : oa + Oa , width : B , height : o , alt : "icon" } ) ; ka ( Ba , La ) } ) } else for ( var ra = J . length , ma = 0 ; ma < ra ; ma ++ ) { var na = J [ ma ] , Ca = na . id ; if ( Ca === "svg_eof" ) break ; a ( "#" + Ca ) ; na = na . getElementsByTagNameNS ( k , "svg" ) [ 0 ] ; var Ga = document . createElementNS ( k , "svg" ) ; Ga . setAttributeNS ( k , "viewBox" ,
[ 0 , 0 , B , o ] . join ( " " ) ) ; var Ja = na . getAttribute ( "width" ) , Da = na . getAttribute ( "height" ) ; na . removeAttribute ( "width" ) ; na . removeAttribute ( "height" ) ; na . getAttribute ( "viewBox" ) || na . setAttribute ( "viewBox" , [ 0 , 0 , Ja , Da ] . join ( " " ) ) ; Ga . setAttribute ( "xmlns" , k ) ; Ga . setAttribute ( "width" , B ) ; Ga . setAttribute ( "height" , o ) ; Ga . setAttribute ( "xmlns:xlink" , q ) ; Ga . setAttribute ( "class" , "svg_icon" ) ; ia || ( na = na . cloneNode ( true ) ) ; Ga . appendChild ( na ) ; if ( da ) { ia || Ga . cloneNode ( true ) ; Z . empty ( ) . append ( Ga ) ; na = qa + d ( Z . html ( ) ) ; na = a ( new Image ) . attr ( { "class" : "svg_icon" ,
src : na } ) } else na = g ( a ( Ga ) , ma ) ; ka ( na , Ca ) } m . placement && a . each ( m . placement , function ( La , Oa ) { p [ Oa ] && a ( La ) . each ( function ( Ba ) { var za = p [ Oa ] . clone ( ) ; if ( Ba > 0 && ! da ) za = g ( za , Ba , true ) ; ta ( a ( this ) , za , Oa ) } ) } ) ; if ( ! X ) { da && Z . remove ( ) ; ga && ga . remove ( ) ; M && M . remove ( ) } m . resize && a . resizeSvgIcons ( m . resize ) ; I = true ; m . callback && m . callback ( p ) } } function f ( ) { if ( c . indexOf ( ".svgz" ) != - 1 ) { var da = c . replace ( ".svgz" , ".svg" ) ; window . console && console . log ( ".svgz failed, trying with .svg" ) ; a . svgIcons ( da , m ) } else m . fallback && b ( false , m . fallback ) }
function d ( da ) { if ( window . btoa ) return window . btoa ( da ) ; var X = Array ( Math . floor ( ( da . length + 2 ) / 3 ) * 4 ) , Z , oa , ra , ma , na , Ca , Ga = 0 , Ja = 0 ; do { Z = da . charCodeAt ( Ga ++ ) ; oa = da . charCodeAt ( Ga ++ ) ; ra = da . charCodeAt ( Ga ++ ) ; ma = Z >> 2 ; Z = ( Z & 3 ) << 4 | oa >> 4 ; na = ( oa & 15 ) << 2 | ra >> 6 ; Ca = ra & 63 ; if ( isNaN ( oa ) ) na = Ca = 64 ; else if ( isNaN ( ra ) ) Ca = 64 ; X [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( ma ) ; X [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Z ) ; X [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( na ) ;
X [ Ja ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Ca ) } while ( Ga < da . length ) ; return X . join ( "" ) } var k = "http://www.w3.org/2000/svg" , q = "http://www.w3.org/1999/xlink" , B = m . w ? m . w : 24 , o = m . h ? m . h : 24 , J , U , M , I = false , S = false , Y = 0 , P = navigator . userAgent , ia = ! ! window . opera ; P . indexOf ( "Safari/" ) > - 1 && P . indexOf ( "Chrome/" ) ; var qa = "data:image/svg+xml;charset=utf-8;base64," ; if ( m . svgz ) { var ga = a ( '<object data="' + c + '" type=image/svg+xml>' ) . appendTo ( "body" ) . hide ( ) ; try { U = ga [ 0 ] . contentDocument ; ga . load ( s ) ;
s ( 0 , true ) } catch ( ba ) { f ( ) } } else { var W = new DOMParser ; a . ajax ( { url : c , dataType : "string" , success : function ( da ) { if ( da ) { U = W . parseFromString ( da , "text/xml" ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } , error : function ( da ) { if ( window . opera ) a ( function ( ) { f ( ) } ) ; else if ( da . responseText ) { U = W . parseFromString ( da . responseText , "text/xml" ) ; U . childNodes . length || a ( f ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } } ) } var ta = function ( da , X , Z , oa ) { ia && X . css ( "visibility" , "hidden" ) ; if ( m . replace ) { oa && X . attr ( "id" , Z ) ; ( Z = da . attr ( "class" ) ) && X . attr ( "class" ,
"svg_icon " + Z ) ; da . replaceWith ( X ) } else da . append ( X ) ; ia && setTimeout ( function ( ) { X . removeAttr ( "style" ) } , 1 ) } , ka = function ( da , X ) { if ( m . id _match === undefined || m . id _match !== false ) ta ( holder , da , X , true ) ; p [ X ] = da } ; g = function ( da , X ) { var Z = da . find ( "defs" ) ; if ( ! Z . length ) return da ; Z = ia ? Z . find ( "*" ) . filter ( function ( ) { return ! ! this . id } ) : Z . find ( "[id]" ) ; var oa = da [ 0 ] . getElementsByTagName ( "*" ) , ra = oa . length ; Z . each ( function ( ma ) { var na = this . id ; a ( U ) . find ( "#" + na ) ; this . id = ma = "x" + na + X + ma ; na = "url(#" + na + ")" ; var Ca = "url(#" + ma + ")" ; for ( ma =
0 ; ma < ra ; ma ++ ) { var Ga = oa [ ma ] ; Ga . getAttribute ( "fill" ) === na && Ga . setAttribute ( "fill" , Ca ) ; Ga . getAttribute ( "stroke" ) === na && Ga . setAttribute ( "stroke" , Ca ) ; Ga . getAttribute ( "filter" ) === na && Ga . setAttribute ( "filter" , Ca ) } } ) ; return da } } ; a . getSvgIcon = function ( c , m ) { var s = p [ c ] ; if ( m && s ) s = g ( s , 0 , true ) . clone ( true ) ; return s } ; a . resizeSvgIcons = function ( c ) { var m = ! a ( ".svg_icon:first" ) . length ; a . each ( c , function ( s , b ) { var f = a . isArray ( b ) , d = f ? b [ 0 ] : b , k = f ? b [ 1 ] : b ; if ( m ) s = s . replace ( /\.svg_icon/g , "svg" ) ; a ( s ) . each ( function ( ) { this . setAttribute ( "width" ,
d ) ; this . setAttribute ( "height" , k ) ; if ( window . opera && window . widget ) { this . parentNode . style . width = d + "px" ; this . parentNode . style . height = k + "px" } } ) } ) } } ) ( jQuery ) ; ( function ( ) { function a ( c , m , s ) { c = document . createElementNS ( p . svg , c ) ; if ( g ) for ( var b in m ) c . setAttribute ( b , m [ b ] ) ; else for ( b in m ) { var f = m [ b ] , d = c [ b ] ; if ( d && d . constructor === "SVGLength" ) d . baseVal . value = f ; else c . setAttribute ( b , f ) } s && s . appendChild ( c ) ; return c } var p = { 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 =
2012-07-24 12:42:34 +00:00
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 =
2012-07-25 08:56:15 +00:00
"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 g = navigator . userAgent . indexOf ( "Gecko/" ) >= 0 ; jQuery . fn . jGraduate = function ( c ) { var m =
arguments ; return this . each ( function ( ) { function s ( la , ca , ja , O , T ) { var ea = T || a ( "stop" , { "stop-color" : ca , "stop-opacity" : ja , offset : la } , W ) ; if ( T ) { ca = T . getAttribute ( "stop-color" ) ; ja = T . getAttribute ( "stop-opacity" ) ; la = T . getAttribute ( "offset" ) } else W . appendChild ( ea ) ; if ( ja === null ) ja = 1 ; T = 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 + la * ia ) + ", 26)" } , rb ) ; var Ha =
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 : ca , "fill-opacity" : ja , transform : "translate(" + ( 10 + la * ia ) + ", 26)" , stroke : "#000" , "stroke-width" : 1.5 } , rb ) ; $ ( Ha ) . mousedown ( function ( Pa ) { b ( this ) ; Sa = jb ; S . mousemove ( k ) . mouseup ( f ) ; wa = $a . offset ( ) ; Pa . preventDefault ( ) ; return false } ) . data ( "stop" , ea ) . data ( "bg" , T ) . dblclick ( function ( ) { $ ( "div.jGraduate_LightBox" ) . show ( ) ; for ( var Pa = this , Xa = + ea . getAttribute ( "stop-opacity" ) ||
1 , fb = ea . getAttribute ( "stop-color" ) || 1 , ob = ( parseFloat ( Xa ) * 255 ) . toString ( 16 ) ; ob . length < 2 ; ) ob = "0" + ob ; ca = fb . substr ( 1 ) + ob ; $ ( "#" + o + "_jGraduate_stopPicker" ) . css ( { left : 100 , bottom : 15 } ) . jPicker ( { window : { title : "Pick the start color and opacity for the gradient" } , images : { clientPath : B . images . clientPath } , color : { active : ca , alphaSupport : true } } , function ( Wa ) { fb = Wa . val ( "hex" ) ? "#" + Wa . val ( "hex" ) : "none" ; Xa = Wa . val ( "a" ) !== null ? Wa . val ( "a" ) / 256 : 1 ; Pa . setAttribute ( "fill" , fb ) ; Pa . setAttribute ( "fill-opacity" , Xa ) ; ea . setAttribute ( "stop-color" ,
fb ) ; ea . setAttribute ( "stop-opacity" , Xa ) ; $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + o + "_jGraduate_stopPicker" ) . hide ( ) } , null , function ( ) { $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + o + "_jGraduate_stopPicker" ) . hide ( ) } ) } ) ; $ ( W ) . find ( "stop" ) . each ( function ( ) { var Pa = $ ( this ) ; if ( + this . getAttribute ( "offset" ) > la ) { if ( ! ca ) { var Xa = this . getAttribute ( "stop-color" ) , fb = this . getAttribute ( "stop-opacity" ) ; ea . setAttribute ( "stop-color" , Xa ) ; Ha . setAttribute ( "fill" , Xa ) ; ea . setAttribute ( "stop-opacity" , fb === null ? 1 : fb ) ; Ha . setAttribute ( "fill-opacity" ,
fb === null ? 1 : fb ) } Pa . before ( ea ) ; return false } } ) ; O && b ( Ha ) ; return ea } function b ( la ) { jb && jb . setAttribute ( "stroke" , "#000" ) ; la . setAttribute ( "stroke" , "blue" ) ; jb = la ; jb . parentNode . appendChild ( jb ) } function f ( ) { S . unbind ( "mousemove" , k ) ; if ( Ea . getAttribute ( "display" ) !== "none" ) { Ea . setAttribute ( "display" , "none" ) ; var la = $ ( jb ) , ca = la . data ( "stop" ) ; la = la . data ( "bg" ) ; $ ( [ jb , ca , la ] ) . remove ( ) } Sa = null } function d ( ) { var la = Ta ? "rotate(" + Ta + "," + Fa + "," + lb + ") " : "" ; hb === 1 && Ma === 1 ? W . removeAttribute ( "gradientTransform" ) : W . setAttribute ( "gradientTransform" ,
la + "translate(" + - Fa * ( hb - 1 ) + "," + - lb * ( Ma - 1 ) + ") scale(" + hb + "," + Ma + ")" ) } function k ( la ) { var ca = la . pageX - wa . left ; la = la . pageY - wa . top ; ca = ca < 10 ? 10 : ca > ia + 10 ? ia + 10 : ca ; var ja = "translate(" + ca + ", 26)" ; if ( la < - 60 || la > 130 ) { Ea . setAttribute ( "display" , "block" ) ; Ea . setAttribute ( "transform" , ja ) } else Ea . setAttribute ( "display" , "none" ) ; Sa . setAttribute ( "transform" , ja ) ; $ . data ( Sa , "bg" ) . setAttribute ( "transform" , ja ) ; $ . data ( Sa , "stop" ) . setAttribute ( "offset" , ( ca - 10 ) / ia ) ; var O = 0 ; $ ( W ) . find ( "stop" ) . each ( function ( ) { var T = this . getAttribute ( "offset" ) ,
ea = $ ( this ) ; if ( T < O ) { ea . prev ( ) . before ( ea ) ; xa = $ ( W ) . find ( "stop" ) } O = T } ) } var q = $ ( this ) , B = $ . extend ( true , { } , jQuery . fn . jGraduateDefaults , c ) , o = q . attr ( "id" ) , J = "#" + q . attr ( "id" ) + " " ; if ( J ) { var U = function ( ) { switch ( q . paint . type ) { case "radialGradient" : q . paint . linearGradient = null ; break ; case "linearGradient" : q . paint . radialGradient = null ; break ; case "solidColor" : q . paint . radialGradient = q . paint . linearGradient = null } $ . isFunction ( q . okCallback ) && q . okCallback ( q . paint ) ; q . hide ( ) } , M = function ( ) { $ . isFunction ( q . cancelCallback ) && q . cancelCallback ( ) ;
q . hide ( ) } ; $ . extend ( true , q , { paint : new $ . jGraduate . Paint ( { copy : B . paint } ) , okCallback : $ . isFunction ( m [ 1 ] ) && m [ 1 ] || null , cancelCallback : $ . isFunction ( m [ 2 ] ) && m [ 2 ] || null } ) ; q . position ( ) ; var I = null , S = $ ( window ) ; if ( q . paint . type == "none" ) q . paint = $ . jGraduate . Paint ( { solidColor : "ffffff" } ) ; q . addClass ( "jGraduate_Picker" ) ; q . 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="' +
o + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>' ) ; var Y = $ ( J + "> .jGraduate_colPick" ) , P = $ ( J + "> .jGraduate_gradPick" ) ; P . html ( '<div id="' + o + '_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">' + B . window . pickerTitle + '</h2><div id="' + o + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="' + o + '_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="' +
2012-07-25 06:32:18 +00:00
o + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + o + '_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="' + o + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' +
o + '_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="' + o + '_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + o + '_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="' +
o + '_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="' + o + '_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + o + '_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="' +
o + '_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="' + o + '_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="' + o + '_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="' +
o + '_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="' + o + '_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="' + o + '_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="' + B . images . clientPath +
'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="' + o + '_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="' + o + '_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="' + B . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + o + '_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="' +
2012-07-25 08:56:15 +00:00
o + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="' + o + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>' ) ; var ia = 256 , qa = ia - 0 , ga = ia - 0 , ba , W , ta , ka = { } ; $ ( ".jGraduate_SliderBar" ) . width ( 145 ) ; var da = $ ( "#" + o + "_jGraduate_GradContainer" ) [ 0 ] , X = a ( "svg" , { id : o + "_jgraduate_svg" , width : ia , height : ia , xmlns : p . svg } , da ) ; ba = ba || q . paint . type ; var Z = W = q . paint [ ba ] , oa = q . paint . alpha , ra = ba === "solidColor" ; switch ( ba ) { case "solidColor" : case "linearGradient" : if ( ! ra ) { W . id = o + "_lg_jgraduate_grad" ;
Z = W = X . appendChild ( W ) } a ( "radialGradient" , { id : o + "_rg_jgraduate_grad" } , X ) ; if ( ba === "linearGradient" ) break ; case "radialGradient" : if ( ! ra ) { W . id = o + "_rg_jgraduate_grad" ; Z = W = X . appendChild ( W ) } a ( "linearGradient" , { id : o + "_lg_jgraduate_grad" } , X ) } if ( ra ) { Z = W = $ ( "#" + o + "_lg_jgraduate_grad" ) [ 0 ] ; I = q . paint [ ba ] ; s ( 0 , "#" + I , 1 ) ; var ma = typeof B . newstop ; if ( ma === "string" ) switch ( B . newstop ) { case "same" : s ( 1 , "#" + I , 1 ) ; break ; case "inverse" : ma = "" ; for ( var na = 0 ; na < 6 ; na += 2 ) { I . substr ( na , 2 ) ; var Ca = ( 255 - parseInt ( I . substr ( na , 2 ) , 16 ) ) . toString ( 16 ) ;
if ( Ca . length < 2 ) Ca = 0 + Ca ; ma += Ca } s ( 1 , "#" + ma , 1 ) ; break ; case "white" : s ( 1 , "#ffffff" , 1 ) ; break ; case "black" : s ( 1 , "#000000" , 1 ) } else if ( ma === "object" ) s ( 1 , B . newstop . color || "#" + I , "opac" in B . newstop ? B . newstop . opac : 1 ) } I = parseFloat ( Z . getAttribute ( "x1" ) || 0 ) ; ma = parseFloat ( Z . getAttribute ( "y1" ) || 0 ) ; na = parseFloat ( Z . getAttribute ( "x2" ) || 1 ) ; Ca = parseFloat ( Z . getAttribute ( "y2" ) || 0 ) ; var Ga = parseFloat ( Z . getAttribute ( "cx" ) || 0.5 ) , Ja = parseFloat ( Z . getAttribute ( "cy" ) || 0.5 ) , Da = parseFloat ( Z . getAttribute ( "fx" ) || Ga ) , La = parseFloat ( Z . getAttribute ( "fy" ) ||
Ja ) ; ta = a ( "rect" , { id : o + "_jgraduate_rect" , x : 0 , y : 0 , width : qa , height : ga , fill : "url(#" + o + "_jgraduate_grad)" , "fill-opacity" : oa / 100 } , X ) ; var Oa = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_lg_field" , title : "Begin Stop" } ) . text ( 1 ) . css ( { top : ma * ia , left : I * ia } ) . data ( "coord" , "start" ) . appendTo ( da ) , Ba = Oa . clone ( ) . text ( 2 ) . css ( { top : Ca * ia , left : na * ia } ) . attr ( "title" , "End stop" ) . data ( "coord" , "end" ) . appendTo ( da ) , za = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_rg_field" , title : "Center stop" } ) . text ( "C" ) . css ( { top : Ja * ia , left : Ga *
ia } ) . data ( "coord" , "center" ) . appendTo ( da ) , Ia = za . clone ( ) . text ( "F" ) . css ( { top : La * ia , left : Da * ia , display : "none" } ) . attr ( "title" , "Focus point" ) . data ( "coord" , "focus" ) . appendTo ( da ) ; Ia [ 0 ] . id = o + "_jGraduate_focusCoord" ; $ ( J + " .grad_coord" ) ; $ . each ( [ "x1" , "y1" , "x2" , "y2" , "cx" , "cy" , "fx" , "fy" ] , function ( la , ca ) { var ja = W . getAttribute ( ca ) , O = isNaN ( ca [ 1 ] ) ; ja || ( ja = O ? "0.5" : ca === "x2" ? "1.0" : "0.0" ) ; ka [ ca ] = $ ( "#" + o + "_jGraduate_" + ca ) . val ( ja ) . change ( function ( ) { if ( isNaN ( parseFloat ( this . value ) ) || this . value < 0 ) this . value = 0 ; else if ( this . value >
1 ) this . value = 1 ; if ( ! ( ca [ 0 ] === "f" && ! kb ) ) if ( O && ba === "radialGradient" || ! O && ba === "linearGradient" ) W . setAttribute ( ca , this . value ) ; var T = O ? ca [ 0 ] === "c" ? za : Ia : ca [ 1 ] === "1" ? Oa : Ba , ea = ca . indexOf ( "x" ) >= 0 ? "left" : "top" ; T . css ( ea , this . value * ia ) } ) . change ( ) } ) ; var xa , rb , $a = $ ( "#" + o + "_jGraduate_StopSlider" ) , jb , Ua , Sa , Ea = a ( "path" , { d : "m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5" , fill : "none" , stroke : "#D00" , "stroke-width" : 5 , display : "none" } , Ua ) , wa , hb = 1 , Ma = 1 , Ta = 0 , Fa = Ga , lb = Ja ; Ua = a ( "svg" , { width : "100%" , height : 45 } , $a [ 0 ] ) ; da = a ( "pattern" , { width : 16 ,
height : 16 , patternUnits : "userSpaceOnUse" , id : "jGraduate_trans" } , Ua ) ; a ( "image" , { width : 16 , height : 16 } , da ) . setAttributeNS ( p . xlink , "xlink:href" , B . images . clientPath + "map-opacity.png" ) ; $ ( Ua ) . on ( "click touchstart" , function ( la ) { wa = $a . offset ( ) ; if ( la . target . tagName !== "path" ) { var ca = la . pageX - wa . left - 8 ; ca = ca < 10 ? 10 : ca > ia + 10 ? ia + 10 : ca ; s ( ca / ia , 0 , 0 , true ) ; la . stopPropagation ( ) } } ) ; $ ( Ua ) . mouseover ( function ( ) { Ua . appendChild ( Ea ) } ) ; rb = a ( "g" , { } , Ua ) ; a ( "line" , { x1 : 10 , y1 : 15 , x2 : ia + 10 , y2 : 15 , "stroke-width" : 2 , stroke : "#000" } , Ua ) ; var tb =
P . find ( ".jGraduate_spreadMethod" ) . change ( function ( ) { W . setAttribute ( "spreadMethod" , $ ( this ) . val ( ) ) } ) , Ya = null , bb = function ( la ) { var ca = la . pageX - nb . left , ja = la . pageY - nb . top ; ca = ca < 0 ? 0 : ca > ia ? ia : ca ; ja = ja < 0 ? 0 : ja > ia ? ia : ja ; Ya . css ( "left" , ca ) . css ( "top" , ja ) ; ca = ca / qa ; ja = ja / ga ; var O = Ya . data ( "coord" ) , T = W ; switch ( O ) { case "start" : ka . x1 . val ( ca ) ; ka . y1 . val ( ja ) ; T . setAttribute ( "x1" , ca ) ; T . setAttribute ( "y1" , ja ) ; break ; case "end" : ka . x2 . val ( ca ) ; ka . y2 . val ( ja ) ; T . setAttribute ( "x2" , ca ) ; T . setAttribute ( "y2" , ja ) ; break ; case "center" : ka . cx . val ( ca ) ;
ka . cy . val ( ja ) ; T . setAttribute ( "cx" , ca ) ; T . setAttribute ( "cy" , ja ) ; Fa = ca ; lb = ja ; d ( ) ; break ; case "focus" : ka . fx . val ( ca ) ; ka . fy . val ( ja ) ; T . setAttribute ( "fx" , ca ) ; T . setAttribute ( "fy" , ja ) ; d ( ) } la . preventDefault ( ) } , Cb = function ( ) { Ya = null ; S . unbind ( "mousemove" , bb ) . unbind ( "mouseup" , Cb ) } ; xa = W . getElementsByTagNameNS ( p . svg , "stop" ) ; if ( ua < 2 ) { for ( ; ua < 2 ; ) { W . appendChild ( document . createElementNS ( p . svg , "stop" ) ) ; ++ ua } xa = W . getElementsByTagNameNS ( p . svg , "stop" ) } var ua = xa . length ; for ( na = 0 ; na < ua ; na ++ ) s ( 0 , 0 , 0 , 0 , xa [ na ] ) ; tb . val ( W . getAttribute ( "spreadMethod" ) ||
"pad" ) ; var nb , kb = false ; ta . setAttribute ( "fill-opacity" , oa / 100 ) ; $ ( "#" + o + " div.grad_coord" ) . mousedown ( function ( la ) { la . preventDefault ( ) ; Ya = $ ( this ) ; Ya . offset ( ) ; nb = Ya . parent ( ) . offset ( ) ; S . mousemove ( bb ) . mouseup ( Cb ) } ) ; $ ( "#" + o + "_jGraduate_Ok" ) . bind ( "click touchstart" , function ( ) { q . paint . type = ba ; q . paint [ ba ] = W . cloneNode ( true ) ; q . paint . solidColor = null ; U ( ) } ) ; $ ( "#" + o + "_jGraduate_Cancel" ) . bind ( "click touchstart" , function ( ) { M ( ) } ) ; if ( ba === "radialGradient" ) if ( kb ) Ia . show ( ) ; else { Ia . hide ( ) ; ka . fx . val ( "" ) ; ka . fy . val ( "" ) } $ ( "#" +
o + "_jGraduate_match_ctr" ) [ 0 ] . checked = ! kb ; var zb , pb ; $ ( "#" + o + "_jGraduate_match_ctr" ) . change ( function ( ) { kb = ! this . checked ; Ia . toggle ( kb ) ; ka . fx . val ( "" ) ; ka . fy . val ( "" ) ; var la = W ; if ( kb ) { var ca = zb || 0.5 , ja = pb || 0.5 ; la . setAttribute ( "fx" , ca ) ; la . setAttribute ( "fy" , ja ) ; ka . fx . val ( ca ) ; ka . fy . val ( ja ) } else { zb = la . getAttribute ( "fx" ) ; pb = la . getAttribute ( "fy" ) ; la . removeAttribute ( "fx" ) ; la . removeAttribute ( "fy" ) } } ) ; xa = W . getElementsByTagNameNS ( p . svg , "stop" ) ; ua = xa . length ; if ( ua < 2 ) { for ( ; ua < 2 ; ) { W . appendChild ( document . createElementNS ( p . svg ,
"stop" ) ) ; ++ ua } xa = W . getElementsByTagNameNS ( p . svg , "stop" ) } var gb ; oa = P = 0 ; if ( ba === "radialGradient" ) { X = W . gradientTransform . baseVal ; if ( X . numberOfItems === 2 ) { ua = X . getItem ( 0 ) ; X = X . getItem ( 1 ) ; if ( ua . type === 2 && X . type === 3 ) { ua = X . matrix ; if ( ua . a !== 1 ) P = Math . round ( - ( 1 - ua . a ) * 100 ) ; else if ( ua . d !== 1 ) P = Math . round ( ( 1 - ua . d ) * 100 ) } } else if ( X . numberOfItems === 3 ) { da = X . getItem ( 0 ) ; ua = X . getItem ( 1 ) ; X = X . getItem ( 2 ) ; if ( da . type === 4 && ua . type === 2 && X . type === 3 ) { oa = Math . round ( da . angle ) ; ua = X . matrix ; if ( ua . a !== 1 ) P = Math . round ( - ( 1 - ua . a ) * 100 ) ; else if ( ua . d !==
1 ) P = Math . round ( ( 1 - ua . d ) * 100 ) } } } P = { radius : { handle : "#" + o + "_jGraduate_RadiusArrows" , input : "#" + o + "_jGraduate_RadiusInput" , val : ( W . getAttribute ( "r" ) || 0.5 ) * 100 } , opacity : { handle : "#" + o + "_jGraduate_OpacArrows" , input : "#" + o + "_jGraduate_OpacInput" , val : q . paint . alpha || 100 } , ellip : { handle : "#" + o + "_jGraduate_EllipArrows" , input : "#" + o + "_jGraduate_EllipInput" , val : P } , angle : { handle : "#" + o + "_jGraduate_AngleArrows" , input : "#" + o + "_jGraduate_AngleInput" , val : oa } } ; $ . each ( P , function ( la , ca ) { var ja = $ ( ca . handle ) ; ja . mousedown ( function ( O ) { var T =
ja . parent ( ) ; gb = { type : la , elem : ja , input : $ ( ca . input ) , parent : T , offset : T . offset ( ) } ; S . mousemove ( ub ) . mouseup ( vb ) ; O . preventDefault ( ) } ) ; $ ( ca . input ) . val ( ca . val ) . change ( function ( ) { var O = + this . value , T = 0 , ea = ba === "radialGradient" ; switch ( la ) { case "radius" : ea && W . setAttribute ( "r" , O / 100 ) ; T = Math . pow ( O / 100 , 0.4 ) / 2 * 145 ; break ; case "opacity" : q . paint . alpha = O ; ta . setAttribute ( "fill-opacity" , O / 100 ) ; T = O * 1.45 ; break ; case "ellip" : hb = Ma = 1 ; if ( O === 0 ) { T = 72.5 ; break } if ( O > 99.5 ) O = 99.5 ; if ( O > 0 ) Ma = 1 - O / 100 ; else hb = - ( O / 100 ) - 1 ; T = 145 * ( ( O + 100 ) /
2 ) / 100 ; ea && d ( ) ; break ; case "angle" : Ta = O ; T = Ta / 180 ; T += 0.5 ; T *= 145 ; ea && d ( ) } if ( T > 145 ) T = 145 ; else if ( T < 0 ) T = 0 ; ja . css ( { "margin-left" : T - 5 } ) } ) . change ( ) } ) ; var ub = function ( la ) { var ca = la . pageX - gb . offset . left - parseInt ( gb . parent . css ( "border-left-width" ) ) ; if ( ca > 145 ) ca = 145 ; if ( ca <= 0 ) ca = 0 ; var ja = ca - 5 ; ca /= 145 ; switch ( gb . type ) { case "radius" : ca = Math . pow ( ca * 2 , 2.5 ) ; if ( ca > 0.98 && ca < 1.02 ) ca = 1 ; if ( ca <= 0.01 ) ca = 0.01 ; W . setAttribute ( "r" , ca ) ; break ; case "opacity" : q . paint . alpha = parseInt ( ca * 100 ) ; ta . setAttribute ( "fill-opacity" , ca ) ; break ;
case "ellip" : Ma = hb = 1 ; if ( ca < 0.5 ) { ca /= 0.5 ; hb = ca <= 0 ? 0.01 : ca } else if ( ca > 0.5 ) { ca /= 0.5 ; ca = 2 - ca ; Ma = ca <= 0 ? 0.01 : ca } d ( ) ; ca -= 1 ; if ( Ma === ca + 1 ) ca = Math . abs ( ca ) ; break ; case "angle" : ca -= 0.5 ; Ta = ca *= 180 ; d ( ) ; ca /= 100 } gb . elem . css ( { "margin-left" : ja } ) ; ca = Math . round ( ca * 100 ) ; gb . input . val ( ca ) ; la . preventDefault ( ) } , vb = function ( ) { S . unbind ( "mousemove" , ub ) . unbind ( "mouseup" , vb ) ; gb = null } ; for ( P = ( q . paint . alpha * 255 / 100 ) . toString ( 16 ) ; P . length < 2 ; ) P = "0" + P ; P = P . split ( "." ) [ 0 ] ; I = q . paint . solidColor == "none" ? "" : q . paint . solidColor + P ; ra || ( I = xa [ 0 ] . getAttribute ( "stop-color" ) ) ;
$ . extend ( $ . fn . jPicker . defaults . window , { alphaSupport : true , effects : { type : "show" , speed : 0 } } ) ; Y . jPicker ( { window : { title : B . window . pickerTitle } , images : { clientPath : B . images . clientPath } , color : { active : I , alphaSupport : true } } , function ( la ) { q . paint . type = "solidColor" ; q . paint . alpha = la . val ( "ahex" ) ? Math . round ( la . val ( "a" ) / 255 * 100 ) : 100 ; q . paint . solidColor = la . val ( "hex" ) ? la . val ( "hex" ) : "none" ; q . paint . radialGradient = null ; U ( ) } , null , function ( ) { M ( ) } ) ; var xb = $ ( J + " .jGraduate_tabs li" ) ; xb . on ( "click touchstart" , function ( ) { xb . removeClass ( "jGraduate_tab_current" ) ;
$ ( this ) . addClass ( "jGraduate_tab_current" ) ; $ ( J + " > div" ) . hide ( ) ; var la = $ ( this ) . attr ( "data-type" ) ; $ ( J + " .jGraduate_gradPick" ) . show ( ) ; if ( la === "rg" || la === "lg" ) { $ ( ".jGraduate_" + la + "_field" ) . show ( ) ; $ ( ".jGraduate_" + ( la === "lg" ? "rg" : "lg" ) + "_field" ) . hide ( ) ; $ ( "#" + o + "_jgraduate_rect" ) [ 0 ] . setAttribute ( "fill" , "url(#" + o + "_" + la + "_jgraduate_grad)" ) ; ba = la === "lg" ? "linearGradient" : "radialGradient" ; $ ( "#" + o + "_jGraduate_OpacInput" ) . val ( q . paint . alpha ) . change ( ) ; var ca = $ ( "#" + o + "_" + la + "_jgraduate_grad" ) [ 0 ] ; if ( W !== ca ) { var ja =
$ ( W ) . find ( "stop" ) ; $ ( ca ) . empty ( ) . append ( ja ) ; W = ca ; ca = tb . val ( ) ; W . setAttribute ( "spreadMethod" , ca ) } kb = la === "rg" && W . getAttribute ( "fx" ) != null && ! ( Ga == Da && Ja == La ) ; $ ( "#" + o + "_jGraduate_focusCoord" ) . toggle ( kb ) ; if ( kb ) $ ( "#" + o + "_jGraduate_match_ctr" ) [ 0 ] . checked = false } else { $ ( J + " .jGraduate_gradPick" ) . hide ( ) ; $ ( J + " .jGraduate_colPick" ) . show ( ) } } ) ; $ ( J + " > div" ) . hide ( ) ; xb . removeClass ( "jGraduate_tab_current" ) ; var Ab ; switch ( q . paint . type ) { case "linearGradient" : Ab = $ ( J + " .jGraduate_tab_lingrad" ) ; break ; case "radialGradient" : Ab =
$ ( J + " .jGraduate_tab_radgrad" ) ; break ; default : Ab = $ ( J + " .jGraduate_tab_color" ) } q . show ( ) ; setTimeout ( function ( ) { Ab . 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 ) , p = $ ( document ) ; $ . extend ( $ . fn , { contextMenu : function ( g , c ) { if ( g . menu == undefined ) return false ; if ( g . inSpeed == undefined ) g . inSpeed = 150 ; if ( g . outSpeed == undefined ) g . outSpeed = 75 ; if ( g . inSpeed == 0 ) g . inSpeed = - 1 ; if ( g . outSpeed == 0 ) g . outSpeed = - 1 ; $ ( this ) . each ( function ( ) { var m = $ ( this ) , s = $ ( m ) . offset ( ) , b = $ ( "#" + g . menu ) ; b . addClass ( "contextMenu" ) ; $ ( this ) . bind ( "mousedown" , function ( d ) { $ ( this ) . on ( "mouseup" , function ( k ) { var q = $ ( this ) ; q . unbind ( "mouseup" ) ; $ ( ".contextMenu" ) . hide ( ) ; if ( d . button === 2 ||
g . allowLeft || d . ctrlKey && svgedit . browser . isMac ( ) ) svgedit . browser . isTouch ( ) || f ( k , d , q ) } ) } ) ; svgedit . browser . isTouch ( ) && $ ( this ) . bind ( "taphold" , function ( d ) { var k = $ ( this ) ; k . unbind ( "mouseup" ) ; f ( d , d , k ) } ) ; var f = function ( d , k , q ) { if ( typeof k == "undefined" ) k = d ; d . stopPropagation ( ) ; if ( m . hasClass ( "disabled" ) || k . altKey ) return false ; var B = d . pageX , o = d . pageY ; if ( svgedit . browser . isTouch ( ) ) { B = d . originalEvent . touches [ 0 ] . pageX ; o = d . originalEvent . touches [ 0 ] . pageY } d = a . width ( ) - b . width ( ) ; k = a . height ( ) - b . height ( ) ; if ( B > d - 15 ) B = d - 15 ;
if ( o > k - 30 ) o = k - 30 ; if ( svgedit . browser . isTouch ( ) ) o -= b . height ( ) / 2 ; p . unbind ( "click" ) ; b . css ( { top : o , left : B } ) . fadeIn ( g . inSpeed ) ; b . find ( "A" ) . mouseover ( function ( ) { b . find ( "LI.hover" ) . removeClass ( "hover" ) ; $ ( this ) . parent ( ) . addClass ( "hover" ) } ) . mouseout ( function ( ) { b . find ( "LI.hover" ) . removeClass ( "hover" ) } ) ; p . keypress ( function ( J ) { switch ( J . 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 : p . trigger ( "click" ) } } ) ; b . find ( "A" ) . unbind ( "mouseup" ) ; b . find ( "LI:not(.disabled) A" ) . mouseup ( function ( ) { p . unbind ( "click" ) . unbind ( "keypress" ) ; $ ( ".contextMenu" ) . hide ( ) ; c && c ( $ ( this ) . attr ( "href" ) . substr ( 1 ) ,
$ ( q ) , { x : B - s . left , y : o - s . top , docX : B , docY : o } ) ; return false } ) ; setTimeout ( function ( ) { p . click ( function ( ) { p . unbind ( "click" ) . unbind ( "keypress" ) ; b . fadeOut ( g . outSpeed ) ; return false } ) } , 0 ) } ; if ( $ . browser . mozilla ) $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . css ( { MozUserSelect : "none" } ) } ) ; else $ . browser . msie ? $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . bind ( "selectstart.disableTextSelect" , function ( ) { return false } ) } ) : $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . bind ( "mousedown.disableTextSelect" , function ( ) { return false } ) } ) ; $ ( m ) . add ( $ ( "UL.contextMenu" ) ) . bind ( "contextmenu" ,
function ( ) { return false } ) } ) ; return $ ( this ) } , disableContextMenuItems : function ( g ) { if ( g == undefined ) { $ ( this ) . find ( "LI" ) . addClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( g != undefined ) for ( var c = g . split ( "," ) , m = 0 ; m < c . length ; m ++ ) $ ( this ) . find ( 'A[href="' + c [ m ] + '"]' ) . parent ( ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenuItems : function ( g ) { if ( g == undefined ) { $ ( this ) . find ( "LI.disabled" ) . removeClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( g != undefined ) for ( var c = g . split ( "," ) , m =
0 ; m < c . length ; m ++ ) $ ( this ) . find ( 'A[href="' + c [ m ] + '"]' ) . 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 p = navigator . userAgent , g = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , c = ! ! window . opera , m = p . indexOf ( "AppleWebKit" ) >= 0 , s = p . indexOf ( "Gecko/" ) >= 0 , b = p . indexOf ( "MSIE" ) >= 0 , f = p . indexOf ( "Chrome/" ) >= 0 , d = p . indexOf ( "Windows" ) >= 0 , k = p . indexOf ( "Macintosh" ) >=
0 , q = "ontouchstart" in window , B = ! ! g . querySelector , o = ! ! document . evaluate , J = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; qa . setAttribute ( "d" , "M0,0 10,10" ) ; var ga = qa . pathSegList ; qa = qa . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { ga . replaceItem ( qa , 0 ) ; return true } catch ( ba ) { } return false } ( ) , U = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; qa . setAttribute ( "d" , "M0,0 10,10" ) ; var ga = qa . pathSegList ; qa = qa . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { ga . insertItemBefore ( qa ,
0 ) ; return true } catch ( ba ) { } return false } ( ) , M = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , ga = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( qa ) ; ga . setAttribute ( "x" , 5 ) ; qa . appendChild ( ga ) ; var ba = document . createElementNS ( "http://www.w3.org/2000/svg" , "text" ) ; ba . textContent = "a" ; ga . appendChild ( ba ) ; ga = ba . getStartPositionOfChar ( 0 ) . x ; document . documentElement . removeChild ( qa ) ; return ga === 0 } ( ) , I = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"svg" ) ; document . documentElement . appendChild ( qa ) ; var ga = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ga . setAttribute ( "d" , "M0,0 C0,0 10,10 10,0" ) ; qa . appendChild ( ga ) ; ga = ga . getBBox ( ) ; document . documentElement . removeChild ( qa ) ; return ga . height > 4 && ga . height < 5 } ( ) , S = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( qa ) ; var ga = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ga . setAttribute ( "d" , "M0,0 10,0" ) ; var ba =
document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ba . setAttribute ( "d" , "M5,0 15,0" ) ; var W = document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; W . appendChild ( ga ) ; W . appendChild ( ba ) ; qa . appendChild ( W ) ; ga = W . getBBox ( ) ; document . documentElement . removeChild ( qa ) ; return ga . width == 15 } ( ) , Y = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; qa . setAttribute ( "x" , 0.1 ) ; ( qa = qa . cloneNode ( false ) . getAttribute ( "x" ) . indexOf ( "," ) == - 1 ) || $ . alert ( "NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the <a href='http://opera.com'>latest version</a> in which the problems have been fixed." ) ;
return qa } ( ) , P = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; qa . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; return qa . style . vectorEffect === "non-scaling-stroke" } ( ) , ia = function ( ) { var qa = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) . transform . baseVal , ga = g . createSVGTransform ( ) ; qa . appendItem ( ga ) ; return qa . getItem ( 0 ) == ga } ( ) ; svgedit . browser . isOpera = function ( ) { return c } ; svgedit . browser . isWebkit = function ( ) { return m } ; svgedit . browser . isGecko = function ( ) { return s } ;
svgedit . browser . isIE = function ( ) { return b } ; svgedit . browser . isChrome = function ( ) { return f } ; svgedit . browser . isWindows = function ( ) { return d } ; svgedit . browser . isMac = function ( ) { return k } ; svgedit . browser . isTouch = function ( ) { return q } ; svgedit . browser . supportsSelectors = function ( ) { return B } ; svgedit . browser . supportsXpath = function ( ) { return o } ; svgedit . browser . supportsPathReplaceItem = function ( ) { return J } ; svgedit . browser . supportsPathInsertItemBefore = function ( ) { return U } ; svgedit . browser . supportsPathBBox = function ( ) { return I } ;
svgedit . browser . supportsHVLineContainerBBox = function ( ) { return S } ; svgedit . browser . supportsGoodTextCharPos = function ( ) { return M } ; svgedit . browser . supportsEditableText = function ( ) { return c } ; svgedit . browser . supportsGoodDecimals = function ( ) { return Y } ; svgedit . browser . supportsNonScalingStroke = function ( ) { return P } ; svgedit . browser . supportsNativeTransformLists = function ( ) { return ia } } 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" ) , p = { } ; svgedit . transformlist . SVGTransformList = function ( g ) { this . _elem = g || null ; this . _xforms = [ ] ; this . _update = function ( ) { var c = "" ; a . createSVGMatrix ( ) ; for ( var m = 0 ; m < this . numberOfItems ; ++ m ) { var s = this . _list . getItem ( m ) ; c = c ; s = s ; var b = s . matrix , f = "" ; switch ( s . type ) { case 1 : f = "matrix(" + [ b . a , b . b , b . c , b . d , b . e , b . f ] . join ( "," ) + ")" ; break ; case 2 : f = "translate(" + b . e + "," + b . f + ")" ; break ; case 3 : f =
b . a == b . d ? "scale(" + b . a + ")" : "scale(" + b . a + "," + b . d + ")" ; break ; case 4 : var d = 0 ; f = 0 ; if ( s . angle != 0 ) { d = 1 - b . a ; f = ( d * b . f + b . b * b . e ) / ( d * d + b . b * b . b ) ; d = ( b . e - b . b * f ) / d } f = "rotate(" + s . angle + " " + d + "," + f + ")" } c = c + ( f + " " ) } this . _elem . setAttribute ( "transform" , c ) } ; this . _list = this ; this . _init = function ( ) { var c = this . _elem . getAttribute ( "transform" ) ; if ( c ) for ( var m = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/ , s = true ; s ; ) { s = c . match ( m ) ; c = c . replace ( m , "" ) ; if ( s && s [ 1 ] ) { var b = s [ 1 ] . split ( /\s*\(/ ) , f = b [ 0 ] ; b = b [ 1 ] . match ( /\s*(.*?)\s*\)/ ) ;
b [ 1 ] = b [ 1 ] . replace ( /(\d)-/g , "$1 -" ) ; var d = b [ 1 ] . split ( /[, ]+/ ) , k = "abcdef" . split ( "" ) , q = a . createSVGMatrix ( ) ; $ . each ( d , function ( J , U ) { d [ J ] = parseFloat ( U ) ; if ( f == "matrix" ) q [ k [ J ] ] = d [ J ] } ) ; b = a . createSVGTransform ( ) ; var B = "set" + f . charAt ( 0 ) . toUpperCase ( ) + f . slice ( 1 ) , o = f == "matrix" ? [ q ] : d ; if ( f == "scale" && o . length == 1 ) o . push ( o [ 0 ] ) ; else if ( f == "translate" && o . length == 1 ) o . push ( 0 ) ; else if ( f == "rotate" && o . length == 1 ) { o . push ( 0 ) ; o . push ( 0 ) } b [ B ] . apply ( b , o ) ; this . _list . appendItem ( b ) } } } ; this . _removeFromOtherLists = function ( c ) { if ( c ) { var m =
false , s ; for ( s in p ) { for ( var b = p [ s ] , f = 0 , d = b . _xforms . length ; f < d ; ++ f ) if ( b . _xforms [ f ] == c ) { m = true ; b . removeItem ( f ) ; break } if ( m ) 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 , m ) { var s = null ; if ( m >= 0 ) if ( m < this . numberOfItems ) { this . _removeFromOtherLists ( c ) ;
s = Array ( this . numberOfItems + 1 ) ; for ( var b = 0 ; b < m ; ++ b ) s [ b ] = this . _xforms [ b ] ; s [ b ] = c ; for ( var f = b + 1 ; b < this . numberOfItems ; ++ f , ++ b ) s [ f ] = this . _xforms [ b ] ; this . numberOfItems ++ ; this . _xforms = s ; s = c ; this . _list . _update ( ) } else s = this . _list . appendItem ( c ) ; return s } ; this . replaceItem = function ( c , m ) { var s = null ; if ( m < this . numberOfItems && m >= 0 ) { this . _removeFromOtherLists ( c ) ; s = this . _xforms [ m ] = c ; this . _list . _update ( ) } return s } ; this . removeItem = function ( c ) { if ( c < this . numberOfItems && c >= 0 ) { for ( var m = this . _xforms [ c ] , s = Array ( this . numberOfItems -
1 ) , b = 0 ; b < c ; ++ b ) s [ b ] = this . _xforms [ b ] ; for ( c = b ; c < this . numberOfItems - 1 ; ++ c , ++ b ) s [ c ] = this . _xforms [ b + 1 ] ; this . numberOfItems -- ; this . _xforms = s ; this . _list . _update ( ) ; return m } 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 ( ) { p = { } } ; svgedit . transformlist . removeElementFromListMap = function ( g ) { g . id && p [ g . id ] && delete p [ g . id ] } ; svgedit . transformlist . getTransformList = function ( g ) { if ( svgedit . browser . supportsNativeTransformLists ( ) ) if ( g . transform ) return g . transform . baseVal ;
else if ( g . gradientTransform ) return g . gradientTransform . baseVal ; else { if ( g . patternTransform ) return g . patternTransform . baseVal } else { var c = g . id ; c || ( c = "temp" ) ; var m = p [ c ] ; if ( ! m || c == "temp" ) { p [ c ] = new svgedit . transformlist . SVGTransformList ( g ) ; p [ c ] . _init ( ) ; m = p [ c ] } return m } return null } } ) ( ) ; svgedit = svgedit || { } ;
2012-07-25 06:32:18 +00:00
( function ( ) { if ( ! svgedit . math ) svgedit . math = { } ; var a = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; svgedit . math . transformPoint = function ( p , g , c ) { return { x : c . a * p + c . c * g + c . e , y : c . b * p + c . d * g + c . f } } ; svgedit . math . isIdentity = function ( p ) { return p . a === 1 && p . b === 0 && p . c === 0 && p . d === 1 && p . e === 0 && p . f === 0 } ; svgedit . math . matrixMultiply = function ( ) { for ( var p = arguments , g = p . length , c = p [ g - 1 ] ; g -- > 1 ; ) c = p [ g - 1 ] . multiply ( c ) ; if ( Math . abs ( c . a ) < 1.0 E - 14 ) c . a = 0 ; if ( Math . abs ( c . b ) < 1.0 E - 14 ) c . b = 0 ; if ( Math . abs ( c . c ) < 1.0 E - 14 ) c . c = 0 ; if ( Math . abs ( c . d ) <
2012-07-25 08:56:15 +00:00
1.0 E - 14 ) c . d = 0 ; if ( Math . abs ( c . e ) < 1.0 E - 14 ) c . e = 0 ; if ( Math . abs ( c . f ) < 1.0 E - 14 ) c . f = 0 ; return c } ; svgedit . math . hasMatrixTransform = function ( p ) { if ( ! p ) return false ; for ( var g = p . numberOfItems ; g -- ; ) { var c = p . getItem ( g ) ; if ( c . type == 1 && ! svgedit . math . isIdentity ( c . matrix ) ) return true } return false } ; svgedit . math . transformBox = function ( p , g , c , m , s ) { var b = { x : p , y : g } , f = { x : p + c , y : g } ; c = { x : p + c , y : g + m } ; p = { x : p , y : g + m } ; g = svgedit . math . transformPoint ; b = g ( b . x , b . y , s ) ; var d = m = b . x , k = b . y , q = b . y ; f = g ( f . x , f . y , s ) ; m = Math . min ( m , f . x ) ; d = Math . max ( d , f . x ) ;
k = Math . min ( k , f . y ) ; q = Math . max ( q , f . y ) ; p = g ( p . x , p . y , s ) ; m = Math . min ( m , p . x ) ; d = Math . max ( d , p . x ) ; k = Math . min ( k , p . y ) ; q = Math . max ( q , p . y ) ; c = g ( c . x , c . y , s ) ; m = Math . min ( m , c . x ) ; d = Math . max ( d , c . x ) ; k = Math . min ( k , c . y ) ; q = Math . max ( q , c . y ) ; return { tl : b , tr : f , bl : p , br : c , aabox : { x : m , y : k , width : d - m , height : q - k } } } ; svgedit . math . transformListToTransform = function ( p , g , c ) { if ( p == null ) return a . createSVGTransformFromMatrix ( a . createSVGMatrix ( ) ) ; g = g == undefined ? 0 : g ; c = c == undefined ? p . numberOfItems - 1 : c ; g = parseInt ( g ) ; c = parseInt ( c ) ; if ( g > c ) { var m = c ; c = g ;
g = m } m = a . createSVGMatrix ( ) ; for ( g = g ; g <= c ; ++ g ) { var s = g >= 0 && g < p . numberOfItems ? p . getItem ( g ) . matrix : a . createSVGMatrix ( ) ; m = svgedit . math . matrixMultiply ( m , s ) } return a . createSVGTransformFromMatrix ( m ) } ; svgedit . math . getMatrix = function ( p ) { p = svgedit . transformlist . getTransformList ( p ) ; return svgedit . math . transformListToTransform ( p ) . matrix } ; svgedit . math . snapToAngle = function ( p , g , c , m ) { var s = Math . PI / 4 ; c = c - p ; var b = m - g ; m = Math . sqrt ( c * c + b * b ) ; s = Math . round ( Math . atan2 ( b , c ) / s ) * s ; return { x : p + m * Math . cos ( s ) , y : g + m * Math . sin ( s ) , a : s } } ;
2012-07-25 06:32:18 +00:00
svgedit . math . rectsIntersect = function ( p , g ) { return g . x < p . x + p . width && g . x + g . width > p . x && g . y < p . y + p . height && g . y + g . height > p . y } } ) ( ) ; svgedit = svgedit || { } ;
2012-07-25 08:56:15 +00:00
( function ( ) { if ( ! svgedit . units ) svgedit . units = { } ; var a = [ "x" , "x1" , "cx" , "rx" , "width" ] , p = [ "y" , "y1" , "cy" , "ry" , "height" ] , g = $ . merge ( [ "r" , "radius" ] , a ) ; $ . merge ( g , p ) ; var c , m = { px : 1 } ; svgedit . units . init = function ( b ) { c = b ; b = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . body . appendChild ( b ) ; var f = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; f . setAttribute ( "width" , "1em" ) ; f . setAttribute ( "height" , "1ex" ) ; f . setAttribute ( "x" , "1in" ) ; b . appendChild ( f ) ; f = f . getBBox ( ) ; document . body . removeChild ( b ) ;
b = f . x ; m . em = f . width ; m . ex = f . height ; m [ "in" ] = b ; m . cm = b / 2.54 ; m . mm = b / 25.4 ; m . pt = b / 72 ; m . pc = b / 6 ; m [ "%" ] = 0 } ; svgedit . units . getTypeMap = function ( ) { return m } ; svgedit . units . shortFloat = function ( b ) { var f = c . getRoundDigits ( ) ; if ( isNaN ( b ) ) { if ( $ . isArray ( b ) ) return svgedit . units . shortFloat ( b [ 0 ] ) + "," + svgedit . units . shortFloat ( b [ 1 ] ) } else return + ( + b ) . toFixed ( f ) ; return parseFloat ( b ) . toFixed ( f ) - 0 } ; svgedit . units . convertUnit = function ( b , f ) { f = f || c . getBaseUnit ( ) ; return svgedit . unit . shortFloat ( b / m [ f ] ) } ; svgedit . units . setUnitAttr = function ( b ,
f , d ) { isNaN ( d ) || b . getAttribute ( f ) ; b . setAttribute ( f , d ) } ; var s = { 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 f = b . tagName , d = c . getBaseUnit ( ) ; if ( f = s [ f ] ) for ( var k = f . length , q = 0 ; q < k ; q ++ ) { var B = f [ q ] , o = b . getAttribute ( B ) ; if ( o ) isNaN ( o ) || b . setAttribute ( B , o / m [ d ] + d ) } } ; svgedit . units . convertToNum =
function ( b , f ) { if ( ! isNaN ( f ) ) return f - 0 ; if ( f . substr ( - 1 ) === "%" ) { var d = f . substr ( 0 , f . length - 1 ) / 100 , k = c . getWidth ( ) , q = c . getHeight ( ) ; return a . indexOf ( b ) >= 0 ? d * k : p . indexOf ( b ) >= 0 ? d * q : d * Math . sqrt ( k * k + q * q ) / Math . sqrt ( 2 ) } else { k = f . substr ( - 2 ) ; d = f . substr ( 0 , f . length - 2 ) ; return d * m [ k ] } } ; svgedit . units . isValidUnit = function ( b , f , d ) { var k = false ; if ( g . indexOf ( b ) >= 0 ) if ( isNaN ( f ) ) { f = f . toLowerCase ( ) ; $ . each ( m , function ( o ) { if ( ! k ) if ( RegExp ( "^-?[\\d\\.]+" + o + "$" ) . test ( f ) ) k = true } ) } else k = true ; else if ( b == "id" ) { b = false ; try { var q = c . getElement ( f ) ;
b = q == null || q === d } catch ( B ) { } return b } else k = true ; return k } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { function a ( b ) { if ( svgedit . browser . supportsHVLineContainerBBox ( ) ) try { return b . getBBox ( ) } catch ( f ) { } var d = $ . data ( b , "ref" ) , k = null ; if ( d ) { var q = $ ( d ) . children ( ) . clone ( ) . attr ( "visibility" , "hidden" ) ; $ ( s ) . append ( q ) ; k = q . filter ( "line, path" ) } else k = $ ( b ) . find ( "line, path" ) ; var B = false ; if ( k . length ) { k . each ( function ( ) { var o = this . getBBox ( ) ; if ( ! o . width || ! o . height ) B = true } ) ; if ( B ) { b = d ? q : $ ( b ) . children ( ) ; ret = getStrokedBBox ( b ) } else ret = b . getBBox ( ) } else ret = b . getBBox ( ) ; d && q . remove ( ) ; return ret } if ( ! svgedit . utilities ) svgedit . utilities =
{ } ; var p = "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" . split ( "," ) , g = null , c = null , m = null , s = null ; svgedit . utilities . init = function ( b ) { g = b ; c = b . getDOMDocument ( ) ; m = b . getDOMContainer ( ) ; s = 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 f = Array ( Math . floor ( ( b . length + 2 ) / 3 ) * 4 ) , d , k , q , B , o , J , U = 0 , M = 0 ; do { d = b . charCodeAt ( U ++ ) ; k = b . charCodeAt ( U ++ ) ; q = b . charCodeAt ( U ++ ) ; B = d >> 2 ; d = ( d & 3 ) << 4 | k >> 4 ; o = ( k & 15 ) << 2 | q >> 6 ; J = q & 63 ; if ( isNaN ( k ) ) o = J = 64 ; else if ( isNaN ( q ) ) J = 64 ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( B ) ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( d ) ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( o ) ; f [ M ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( J ) } while ( U <
b . length ) ; return f . join ( "" ) } ; svgedit . utilities . decode64 = function ( b ) { if ( window . atob ) return window . atob ( b ) ; var f = "" , d , k , q = "" , B , o = "" , J = 0 ; b = b . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; do { d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( J ++ ) ) ; k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( J ++ ) ) ; B = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( J ++ ) ) ; o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( b . charAt ( J ++ ) ) ;
d = d << 2 | k >> 4 ; k = ( k & 15 ) << 4 | B >> 2 ; q = ( B & 3 ) << 6 | o ; f += String . fromCharCode ( d ) ; if ( B != 64 ) f += String . fromCharCode ( k ) ; if ( o != 64 ) f += String . fromCharCode ( q ) } while ( J < b . length ) ; return unescape ( f ) } ; svgedit . utilities . convertToXMLReferences = function ( b ) { for ( var f = "" , d = 0 ; d < b . length ; d ++ ) { var k = b . charCodeAt ( d ) ; if ( k < 128 ) f += b [ d ] ; else if ( k > 127 ) f += "&#" + k + ";" } return f } ; svgedit . utilities . text2xml = function ( b ) { if ( b . indexOf ( "<svg:svg" ) >= 0 ) b = b . replace ( /<(\/?)svg:/g , "<$1" ) . replace ( "xmlns:svg" , "xmlns" ) ; var f ; try { var d = window . DOMParser ?
new DOMParser : new ActiveXObject ( "Microsoft.XMLDOM" ) ; d . async = false } catch ( k ) { throw Error ( "XML Parser could not be instantiated" ) ; } try { f = d . loadXML ? d . loadXML ( b ) ? d : false : d . parseFromString ( b , "text/xml" ) } catch ( q ) { throw Error ( "Error parsing XML string" ) ; } return f } ; svgedit . utilities . bboxToObj = function ( b ) { return { x : b . x , y : b . y , width : b . width , height : b . height } } ; svgedit . utilities . walkTree = function ( b , f ) { if ( b && b . nodeType == 1 ) { f ( b ) ; for ( var d = b . childNodes . length ; d -- ; ) svgedit . utilities . walkTree ( b . childNodes . item ( d ) , f ) } } ;
2012-07-24 12:42:34 +00:00
svgedit . utilities . walkTreePost = function ( b , f ) { if ( b && b . nodeType == 1 ) { for ( var d = b . childNodes . length ; d -- ; ) svgedit . utilities . walkTree ( b . childNodes . item ( d ) , f ) ; f ( 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 ) { return b . getAttributeNS ( "http://www.w3.org/1999/xlink" ,
2012-07-25 08:56:15 +00:00
"href" ) } ; svgedit . utilities . setHref = function ( b , f ) { b . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , f ) } ; svgedit . utilities . findDefs = function ( b ) { b = g . getSVGContent ( ) . documentElement ; var f = b . getElementsByTagNameNS ( "http://www.w3.org/2000/svg" , "defs" ) ; return f = f . length > 0 ? f [ 0 ] : b . insertBefore ( b . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "defs" ) , b . firstChild . nextSibling ) } ; svgedit . utilities . getPathBBox = function ( b ) { var f = b . pathSegList , d = f . numberOfItems ; b = [ [ ] , [ ] ] ; var k = f . getItem ( 0 ) ,
q = [ k . x , k . y ] ; for ( k = 0 ; k < d ; k ++ ) { var B = f . getItem ( k ) ; if ( typeof B . x != "undefined" ) { b [ 0 ] . push ( q [ 0 ] ) ; b [ 1 ] . push ( q [ 1 ] ) ; if ( B . x1 ) { for ( var o = [ B . x1 , B . y1 ] , J = [ B . x2 , B . y2 ] , U = [ B . x , B . y ] , M = 0 ; M < 2 ; M ++ ) { B = function ( ia ) { return Math . pow ( 1 - ia , 3 ) * q [ M ] + 3 * Math . pow ( 1 - ia , 2 ) * ia * o [ M ] + 3 * ( 1 - ia ) * Math . pow ( ia , 2 ) * J [ M ] + Math . pow ( ia , 3 ) * U [ M ] } ; var I = 6 * q [ M ] - 12 * o [ M ] + 6 * J [ M ] , S = - 3 * q [ M ] + 9 * o [ M ] - 9 * J [ M ] + 3 * U [ M ] , Y = 3 * o [ M ] - 3 * q [ M ] ; if ( S == 0 ) { if ( I != 0 ) { I = - Y / I ; 0 < I && I < 1 && b [ M ] . push ( B ( I ) ) } } else { Y = Math . pow ( I , 2 ) - 4 * Y * S ; if ( ! ( Y < 0 ) ) { var P = ( - I + Math . sqrt ( Y ) ) / ( 2 * S ) ; 0 < P && P <
1 && b [ M ] . push ( B ( P ) ) ; I = ( - I - Math . sqrt ( Y ) ) / ( 2 * S ) ; 0 < I && I < 1 && b [ M ] . push ( B ( I ) ) } } } q = U } else { b [ 0 ] . push ( B . x ) ; b [ 1 ] . push ( B . y ) } } } f = Math . min . apply ( null , b [ 0 ] ) ; d = Math . max . apply ( null , b [ 0 ] ) - f ; k = Math . min . apply ( null , b [ 1 ] ) ; b = Math . max . apply ( null , b [ 1 ] ) - k ; return { x : f , y : k , width : d , height : b } } ; svgedit . utilities . getBBox = function ( b ) { var f = b || g . geSelectedElements ( ) [ 0 ] ; if ( b . nodeType != 1 ) return null ; b = null ; var d = f . nodeName ; switch ( d ) { case "text" : if ( f . textContent === "" ) { f . textContent = "a" ; b = f . getBBox ( ) ; f . textContent = "" } else try { b = f . getBBox ( ) } catch ( k ) { } break ;
2012-07-25 06:32:18 +00:00
case "path" : if ( svgedit . browser . supportsPathBBox ( ) ) try { b = f . getBBox ( ) } catch ( q ) { } else b = svgedit . utilities . getPathBBox ( f ) ; break ; case "g" : case "a" : b = a ( f ) ; break ; default : if ( d === "use" ) b = a ( f , true ) ; if ( d === "use" ) { b || ( b = f . getBBox ( ) ) ; if ( ! svgedit . browser . isWebkit ( ) ) { d = { } ; d . width = b . width ; d . height = b . height ; d . x = b . x + parseFloat ( f . getAttribute ( "x" ) || 0 ) ; d . y = b . y + parseFloat ( f . getAttribute ( "y" ) || 0 ) ; b = d } } else if ( ~ p . indexOf ( d ) ) try { b = f . getBBox ( ) } catch ( B ) { f = $ ( f ) . closest ( "foreignObject" ) ; if ( f . length ) try { b = f [ 0 ] . getBBox ( ) } catch ( o ) { b =
2012-07-25 08:56:15 +00:00
null } else b = null } } if ( b ) b = svgedit . utilities . bboxToObj ( b ) ; return b } ; svgedit . utilities . getRotationAngle = function ( b , f ) { var d = b || g . getSelectedElements ( ) [ 0 ] ; d = svgedit . transformlist . getTransformList ( d ) ; if ( ! d ) return 0 ; for ( var k = d . numberOfItems , q = 0 ; q < k ; ++ q ) { var B = d . getItem ( q ) ; if ( B . type == 4 ) return f ? B . angle * Math . PI / 180 : B . angle } return 0 } ; svgedit . utilities . getElem = svgedit . browser . supportsSelectors ( ) ? function ( b ) { return s . querySelector ( "#" + b ) } : svgedit . browser . supportsXpath ( ) ? function ( b ) { return c . evaluate ( 'svg:svg[@id="svgroot"]//svg:*[@id="' +
b + '"]' , m , function ( ) { return "http://www.w3.org/2000/svg" } , 9 , null ) . singleNodeValue } : function ( b ) { return $ ( s ) . find ( "[id=" + b + "]" ) [ 0 ] } ; svgedit . utilities . assignAttributes = function ( b , f , d , k ) { d || ( d = 0 ) ; svgedit . browser . isOpera ( ) || s . suspendRedraw ( d ) ; for ( var q in f ) if ( d = q . substr ( 0 , 4 ) === "xml:" ? "http://www.w3.org/XML/1998/namespace" : q . substr ( 0 , 6 ) === "xlink:" ? "http://www.w3.org/1999/xlink" : null ) b . setAttributeNS ( d , q , f [ q ] ) ; else k ? svgedit . units . setUnitAttr ( b , q , f [ q ] ) : b . setAttribute ( q , f [ q ] ) ; svgedit . browser . isOpera ( ) || s . unsuspendRedraw ( null ) } ;
svgedit . utilities . cleanupElement = function ( b ) { var f = s . suspendRedraw ( 60 ) , d = { "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 } , k ; for ( k in d ) { var q = d [ k ] ; b . getAttribute ( k ) == q && b . removeAttribute ( k ) } s . unsuspendRedraw ( f ) } } ) ( ) ; 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 p = { } ; $ . each ( a , function ( m , s ) { p [ s ] = m } ) ; var g = { a : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "stroke" , "stroke-dasharray" ,
2012-06-23 19:40:40 +00:00
"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" ] , image : [ "class" , "clip-path" , "clip-rule" , "filter" , "height" , "id" , "mask" , "opacity" , "requiredFeatures" , "style" , "systemLanguage" , "transform" , "width" , "x" , "xlink:href" , "xlink:title" , "y" ] , line : [ "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 : [ "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" ,
2012-07-25 08:56:15 +00:00
"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 ( g , function ( m , s ) { var b = { } ; $ . each ( s , function ( f , d ) { if ( d . indexOf ( ":" ) >=
0 ) { var k = d . split ( ":" ) ; b [ k [ 1 ] ] = p [ k [ 0 ] ] } else b [ d ] = d == "xmlns" ? "http://www.w3.org/2000/xmlns/" : null } ) ; c [ m ] = b } ) ; svgedit . sanitize . getNSMap = function ( ) { return a } ; svgedit . sanitize . sanitizeSvg = function ( m ) { if ( m . nodeType == 3 ) { m . nodeValue = m . nodeValue . replace ( /^\s+|\s+$/g , "" ) ; m . nodeValue . length || m . parentNode . removeChild ( m ) } if ( m . nodeType == 1 ) { var s = m . parentNode ; if ( m . ownerDocument && s ) { var b = g [ m . nodeName ] , f = c [ m . nodeName ] ; if ( b != undefined ) { for ( var d = [ ] , k = m . attributes . length ; k -- ; ) { var q = m . attributes . item ( k ) , B = q . nodeName ,
o = q . localName , J = q . namespaceURI ; if ( ! ( f . hasOwnProperty ( o ) && J == f [ o ] && J != "http://www.w3.org/2000/xmlns/" ) && ! ( J == "http://www.w3.org/2000/xmlns/" && a [ q . nodeValue ] ) ) { B . indexOf ( "se:" ) == 0 && d . push ( [ B , q . nodeValue ] ) ; m . removeAttributeNS ( J , o ) } if ( svgedit . browser . isGecko ( ) ) switch ( B ) { case "transform" : case "gradientTransform" : case "patternTransform" : o = q . nodeValue . replace ( /(\d)-/g , "$1 -" ) ; m . setAttribute ( B , o ) } if ( B == "style" ) { q = q . nodeValue . split ( ";" ) ; for ( B = q . length ; B -- ; ) { o = q [ B ] . split ( ":" ) ; b . indexOf ( o [ 0 ] ) >= 0 && m . setAttribute ( o [ 0 ] ,
o [ 1 ] ) } m . removeAttribute ( "style" ) } } $ . each ( d , function ( U , M ) { m . setAttributeNS ( "http://svg-edit.googlecode.com" , M [ 0 ] , M [ 1 ] ) } ) ; if ( ( k = svgedit . utilities . getHref ( m ) ) && [ "filter" , "linearGradient" , "pattern" , "radialGradient" , "textPath" , "use" ] . indexOf ( m . nodeName ) >= 0 ) if ( k [ 0 ] != "#" ) { svgedit . utilities . setHref ( m , "" ) ; m . removeAttributeNS ( "http://www.w3.org/1999/xlink" , "href" ) } if ( m . nodeName == "use" && ! svgedit . utilities . getHref ( m ) ) s . removeChild ( m ) ; else { $ . each ( [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" ,
"mask" , "stroke" ] , function ( U , M ) { var I = m . getAttribute ( M ) ; if ( I ) if ( ( I = svgedit . utilities . getUrlFromAttr ( I ) ) && I [ 0 ] !== "#" ) { m . setAttribute ( M , "" ) ; m . removeAttribute ( M ) } } ) ; for ( k = m . childNodes . length ; k -- ; ) svgedit . sanitize . sanitizeSvg ( m . childNodes . item ( k ) ) } } else { for ( b = [ ] ; m . hasChildNodes ( ) ; ) b . push ( s . insertBefore ( m . firstChild , m ) ) ; s . removeChild ( m ) ; for ( k = b . length ; k -- ; ) svgedit . sanitize . sanitizeSvg ( b [ k ] ) } } } } } ) ( ) ; svgedit = svgedit || { } ;
2012-07-25 06:32:18 +00:00
( 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 , p , g , c ) { this . elem = a ; this . text = c ? "Move " + a . tagName + " to " + c : "Move " + a . tagName ; this . oldNextSibling = p ; this . oldParent = g ; this . newNextSibling = a . nextSibling ; this . newParent = a . parentNode } ; svgedit . history . MoveElementCommand . type = function ( ) { return "svgedit.history.MoveElementCommand" } ; svgedit . history . MoveElementCommand . prototype . type =
2012-06-23 19:40:40 +00:00
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 ,
2012-07-25 06:32:18 +00:00
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 , p ) { this . elem = a ; this . text = p || "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 =
2012-06-23 19:40:40 +00:00
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 ,
2012-07-25 06:32:18 +00:00
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 , p , g , c ) { this . elem = a ; this . text = c || "Delete " + a . tagName ; this . nextSibling = p ; this . parent = g ; svgedit . transformlist . removeElementFromListMap ( a ) } ; svgedit . history . RemoveElementCommand . type = function ( ) { return "svgedit.history.RemoveElementCommand" } ;
2012-06-23 19:40:40 +00:00
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 ] } ;
2012-07-25 06:32:18 +00:00
svgedit . history . ChangeElementCommand = function ( a , p , g ) { this . elem = a ; this . text = g ? "Change " + a . tagName + " " + g : "Change " + a . tagName ; this . newValues = { } ; this . oldValues = p ; for ( var c in p ) 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 p = false , g ; for ( g in this . newValues ) { if ( this . newValues [ g ] ) if ( g == "#text" ) this . elem . textContent = this . newValues [ g ] ; else g == "#href" ? svgedit . utilities . setHref ( this . elem , this . newValues [ g ] ) : this . elem . setAttribute ( g , this . newValues [ g ] ) ; else if ( g == "#text" ) this . elem . textContent = "" ; else { this . elem . setAttribute ( g , "" ) ; this . elem . removeAttribute ( g ) } if ( g ==
"transform" ) p = true } if ( ! p ) if ( p = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = elem . getBBox ( ) ; p = [ "rotate(" , p , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; p != elem . getAttribute ( "transform" ) && elem . setAttribute ( "transform" , p ) } 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 p = false , g ; for ( g in this . oldValues ) { if ( this . oldValues [ g ] ) if ( g ==
"#text" ) this . elem . textContent = this . oldValues [ g ] ; else g == "#href" ? svgedit . utilities . setHref ( this . elem , this . oldValues [ g ] ) : this . elem . setAttribute ( g , this . oldValues [ g ] ) ; else if ( g == "#text" ) this . elem . textContent = "" ; else this . elem . removeAttribute ( g ) ; if ( g == "transform" ) p = true } if ( ! p ) if ( p = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = this . elem . getBBox ( ) ; p = [ "rotate(" , p , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; p != this . elem . getAttribute ( "transform" ) && this . elem . setAttribute ( "transform" , p ) } svgedit . transformlist . removeElementFromListMap ( this . elem ) ;
2012-06-23 19:40:40 +00:00
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 =
2012-07-25 06:32:18 +00:00
function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; for ( var p = this . stack . length , g = 0 ; g < p ; ++ g ) this . stack [ g ] . 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 p = this . stack . length - 1 ; p >= 0 ; p -- ) this . stack [ p ] . unapply ( a ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY ,
this ) } ; svgedit . history . BatchCommand . prototype . elements = function ( ) { for ( var a = [ ] , p = this . stack . length ; p -- ; ) for ( var g = this . stack [ p ] . elements ( ) , c = g . length ; c -- ; ) a . indexOf ( g [ c ] ) == - 1 && a . push ( g [ 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 =
2012-06-23 19:40:40 +00:00
- 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 _ ) } ;
2012-07-25 08:56:15 +00:00
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 , p ) { for ( var g = ++ this . undoChangeStackPointer , c = p . length , m = Array ( c ) , s = Array ( c ) ; c -- ; ) { var b = p [ c ] ; if ( b != null ) { s [ c ] = b ; m [ c ] = b . getAttribute ( a ) } } this . undoableChangeStack [ g ] =
{ attrName : a , oldValues : m , elements : s } } ; svgedit . history . UndoManager . prototype . finishUndoableChange = function ( ) { for ( var a = this . undoChangeStackPointer -- , p = this . undoableChangeStack [ a ] , g = p . elements . length , c = p . attrName , m = new svgedit . history . BatchCommand ( "Change " + c ) ; g -- ; ) { var s = p . elements [ g ] ; if ( s != null ) { var b = { } ; b [ c ] = p . oldValues [ g ] ; b [ c ] != s . getAttribute ( c ) && m . addSubCommand ( new svgedit . history . ChangeElementCommand ( s , b , c ) ) } } this . undoableChangeStack [ a ] = null ; return m } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . select ) svgedit . select = { } ; var a , p , g ; svgedit . select . Selector = function ( c , m ) { this . id = c ; this . selectedElement = m ; 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 m = [ ] ; c = Math . round ( c / 45 ) ; if ( c < 0 ) c += 8 ; for ( var s in g . selectorGrips ) m . push ( s ) ; for ( ; c > 0 ; ) { m . push ( m . shift ( ) ) ; c -- } c = 0 ; for ( s in g . selectorGrips ) { g . selectorGrips [ s ] . setAttribute ( "style" ,
"cursor:" + m [ c ] + "-resize" ) ; c ++ } } ; svgedit . select . Selector . prototype . showGrips = function ( c ) { g . selectorGripsGroup . setAttribute ( "display" , c ? "inline" : "none" ) ; var m = this . selectedElement ; this . hasGrips = c ; if ( m && c ) { this . selectorGroup . appendChild ( g . selectorGripsGroup ) ; this . updateGripCursors ( svgedit . utilities . getRotationAngle ( m ) ) } } ; svgedit . select . Selector . prototype . resize = function ( ) { var c = this . selectorRect , m = g , s = m . selectorGrips , b = this . selectedElement , f = b . getAttribute ( "stroke-width" ) , d = a . currentZoom ( ) , k = 1 / d ; if ( b . getAttribute ( "stroke" ) !==
"none" && ! isNaN ( f ) ) k += f / 2 ; var q = b . tagName ; if ( q === "text" ) k += 2 / d ; f = svgedit . transformlist . getTransformList ( b ) ; f = svgedit . math . transformListToTransform ( f ) . matrix ; f . e *= d ; f . f *= d ; var B = svgedit . utilities . getBBox ( b ) ; if ( q === "g" && ! $ . data ( b , "gsvg" ) ) if ( q = a . getStrokedBBox ( b . childNodes ) ) B = q ; q = B . x ; var o = B . y , J = B . width ; B = B . height ; k *= d ; d = svgedit . math . transformBox ( q * d , o * d , J * d , B * d , f ) ; f = d . aabox ; q = f . x - k ; o = f . y - k ; J = f . width + k * 2 ; var U = f . height + k * 2 ; f = q + J / 2 ; B = o + U / 2 ; if ( b = svgedit . utilities . getRotationAngle ( b ) ) { q = a . svgRoot ( ) . createSVGTransform ( ) ;
q . setRotate ( - b , f , B ) ; q = q . matrix ; d . tl = svgedit . math . transformPoint ( d . tl . x , d . tl . y , q ) ; d . tr = svgedit . math . transformPoint ( d . tr . x , d . tr . y , q ) ; d . bl = svgedit . math . transformPoint ( d . bl . x , d . bl . y , q ) ; d . br = svgedit . math . transformPoint ( d . br . x , d . br . y , q ) ; q = d . tl ; J = q . x ; U = q . y ; var M = q . x , I = q . y ; q = Math . min ; o = Math . max ; J = q ( J , q ( d . tr . x , q ( d . bl . x , d . br . x ) ) ) - k ; U = q ( U , q ( d . tr . y , q ( d . bl . y , d . br . y ) ) ) - k ; M = o ( M , o ( d . tr . x , o ( d . bl . x , d . br . x ) ) ) + k ; I = o ( I , o ( d . tr . y , o ( d . bl . y , d . br . y ) ) ) + k ; q = J ; o = U ; J = M - J ; U = I - U } k = a . svgRoot ( ) . suspendRedraw ( 100 ) ; c . setAttribute ( "d" ,
"M" + q + "," + o + " L" + ( q + J ) + "," + o + " " + ( q + J ) + "," + ( o + U ) + " " + q + "," + ( o + U ) + "z" ) ; this . selectorGroup . setAttribute ( "transform" , b ? "rotate(" + [ b , f , B ] . join ( "," ) + ")" : "" ) ; if ( svgedit . browser . isTouch ( ) ) { q -= 15.75 ; o -= 15.75 } else { q -= 4 ; o -= 4 } this . gripCoords = { nw : [ q , o ] . map ( Math . round ) , ne : [ q + J , o ] . map ( Math . round ) , sw : [ q , o + U ] . map ( Math . round ) , se : [ q + J , o + U ] . map ( Math . round ) , n : [ q + J / 2 , o ] . map ( Math . round ) , w : [ q , o + U / 2 ] . map ( Math . round ) , e : [ q + J , o + U / 2 ] . map ( Math . round ) , s : [ q + J / 2 , o + U ] . map ( Math . round ) } ; for ( var S in this . gripCoords ) { c = this . gripCoords [ S ] ;
s [ S ] . setAttribute ( "x" , c [ 0 ] ) ; s [ S ] . setAttribute ( "y" , c [ 1 ] ) } this . rotateCoords = { nw : [ q , o ] , ne : [ q + J + 8 , o ] , sw : [ q , o + U + 8 ] , se : [ q + J + 8 , o + U + 8 ] } ; for ( S in this . rotateCoords ) { c = this . rotateCoords [ S ] ; m . rotateGrips [ S ] . setAttribute ( "cx" , c [ 0 ] ) ; m . rotateGrips [ S ] . setAttribute ( "cy" , c [ 1 ] ) } a . svgRoot ( ) . unsuspendRedraw ( k ) } ; 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 } ;
2012-07-24 02:30:12 +00:00
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 ) ;
2012-07-25 08:56:15 +00:00
a . svgRoot ( ) . appendChild ( this . selectorParentGroup ) ; this . selectorMap = { } ; this . selectors = [ ] ; this . rubberBandBox = null ; for ( var c in this . rotateGrips ) { var m = 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(" + p . imgPath + "rotate.png) 12 12, auto;" } } ) ; $ . data ( m , "dir" , c ) ; $ . data ( m , "type" , "rotate" ) ; this . rotateGrips [ c ] = this . selectorGripsGroup . appendChild ( m ) } for ( c in this . selectorGrips ) { m = 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 ( ) ) { m . setAttribute ( "width" , 30.5 ) ; m . setAttribute ( "height" , 30.5 ) ; m . setAttribute ( "fill-opacity" , 0.3 ) } $ . data ( m , "dir" , c ) ; $ . data ( m , "type" , "resize" ) ; this . selectorGrips [ c ] = this . selectorGripsGroup . appendChild ( m ) } if ( ! $ ( "#canvasBackground" ) . length ) { c = p . 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" } } ) ; m = a . createSVGElement ( { element : "defs" , attr : { id : "placeholder_defs" } } ) ; var s = 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" } } ) , f = 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" } } ) , k = 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 ( m ) ; m . appendChild ( s ) ; s . appendChild ( b ) ; s . appendChild ( f ) ; s . appendChild ( d ) ; c . appendChild ( k ) ; a . svgRoot ( ) . insertBefore ( c , a . svgContent ( ) ) } } ; svgedit . select . SelectorManager . prototype . requestSelector = function ( c ) { if ( c == null ) return null ; var m = this . selectors . length ;
if ( typeof this . selectorMap [ c . id ] == "object" ) { this . selectorMap [ c . id ] . locked = true ; return this . selectorMap [ c . id ] } for ( var s = 0 ; s < m ; ++ s ) if ( this . selectors [ s ] && ! this . selectors [ s ] . locked ) { this . selectors [ s ] . locked = true ; this . selectors [ s ] . reset ( c ) ; this . selectorMap [ c . id ] = this . selectors [ s ] ; return this . selectors [ s ] } this . selectors [ m ] = new svgedit . select . Selector ( m , c ) ; this . selectorParentGroup . appendChild ( this . selectors [ m ] . selectorGroup ) ; this . selectorMap [ c . id ] = this . selectors [ m ] ; return this . selectors [ m ] } ; svgedit . select . SelectorManager . prototype . releaseSelector =
function ( c ) { if ( c != null ) for ( var m = this . selectors . length , s = this . selectorMap [ c . id ] , b = 0 ; b < m ; ++ b ) if ( this . selectors [ b ] && this . selectors [ b ] == s ) { s . locked == false && console . log ( "WARNING! selector was released but was already unlocked" ) ; delete this . selectorMap [ c . id ] ; s . locked = false ; s . selectedElement = null ; s . showGrips ( false ) ; try { s . selectorGroup . setAttribute ( "display" , "none" ) } catch ( f ) { } break } } ; svgedit . select . SelectorManager . prototype . getRubberBandBox = function ( ) { if ( ! this . rubberBandBox ) this . rubberBandBox = this . selectorParentGroup . appendChild ( a . createSVGElement ( { element : "rect" ,
attr : { id : "selectorRubberBand" , fill : "transparent" , stroke : "#666" , "stroke-width" : 1 , "stroke-dasharray" : "3,2" , display : "none" , style : "pointer-events:none" } } ) ) ; return this . rubberBandBox } ; svgedit . select . init = function ( c , m ) { p = c ; a = m ; g = new svgedit . select . SelectorManager ; a . createSVGElement ( { element : "g" , attr : { id : "hover_group" } } ) } ; svgedit . select . getSelectorManager = function ( ) { return g } } ) ( ) ; 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 ( "," ) , p = { LET _DOCUMENT _DECIDE : 0 , ALWAYS _RANDOMIZE : 1 , NEVER _RANDOMIZE : 2 } , g = p . LET _DOCUMENT _DECIDE ; svgedit . draw . Layer = function ( c , m ) { this . name _ = c ; this . group _ = m } ; svgedit . draw . Layer . prototype . getName = function ( ) { return this . name _ } ; svgedit . draw . Layer . prototype . getGroup = function ( ) { return this . group _ } ; svgedit . draw . randomizeIds = function ( c , m ) { g = c == false ? p . NEVER _RANDOMIZE :
p . ALWAYS _RANDOMIZE ; if ( g == p . ALWAYS _RANDOMIZE && ! m . getNonce ( ) ) m . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) ; else g == p . NEVER _RANDOMIZE && m . getNonce ( ) && m . clearNonce ( ) } ; svgedit . draw . Drawing = function ( c , m ) { 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 = m || "svg_" ; this . releasedNums = [ ] ; this . all _layers = [ ] ; this . current _layer = null ; this . nonce _ =
2012-07-25 06:32:18 +00:00
"" ; var s = this . svgElem _ . getAttributeNS ( "http://svg-edit.googlecode.com" , "nonce" ) ; if ( s && g != p . NEVER _RANDOMIZE ) this . nonce _ = s ; else g == p . 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 _ } ;
2012-07-24 12:42:34 +00:00
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 =
2012-07-25 08:56:15 +00:00
this . obj _num , m = false ; if ( this . releasedNums . length > 0 ) { this . obj _num = this . releasedNums . pop ( ) ; m = true } else this . obj _num ++ ; for ( var s = this . getId ( ) ; this . getElem _ ( s ) ; ) { if ( m ) { this . obj _num = c ; m = false } this . obj _num ++ ; s = this . getId ( ) } if ( m ) this . obj _num = c ; return s } ; svgedit . draw . Drawing . prototype . releaseId = function ( c ) { var m = this . idPrefix + ( this . nonce _ ? this . nonce _ + "_" : "" ) ; if ( typeof c != "string" || c . indexOf ( m ) != 0 ) return false ; c = parseInt ( c . substr ( m . 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 m = 0 ; m < this . getNumLayers ( ) ; m ++ ) if ( this . all _layers [ m ] [ 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 m = 0 ; m < this . getNumLayers ( ) ; ++ m ) if ( c == this . getLayerName ( m ) ) { if ( this . current _layer != this . all _layers [ m ] [ 1 ] ) { this . current _layer . setAttribute ( "style" , "pointer-events:none" ) ; this . current _layer = this . all _layers [ m ] [ 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 , m = [ ] , s = [ ] , b = null , f = false , d = 0 ; d < c ; ++ d ) { var k = this . svgElem _ . childNodes . item ( d ) ; if ( k && k . nodeType == 1 ) if ( k . tagName == "g" ) { f = true ; var q = $ ( "title" , k ) . text ( ) ; if ( ! q && svgedit . browser . isOpera ( ) && k . querySelectorAll ) q = $ ( k . querySelectorAll ( "title" ) ) . text ( ) ;
if ( q ) { s . push ( q ) ; this . all _layers . push ( [ q , k ] ) ; b = k ; svgedit . utilities . walkTree ( k , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; b . setAttribute ( "style" , "pointer-events:none" ) } else m . push ( k ) } else if ( ~ a . indexOf ( k . nodeName ) ) { svgedit . utilities . getBBox ( k ) ; m . push ( k ) } } c = this . svgElem _ . ownerDocument ; if ( m . length > 0 || ! f ) { for ( d = 1 ; s . indexOf ( "Layer " + d ) >= 0 ; ) d ++ ; s = "Layer " + d ; b = c . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; f = c . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; f . textContent = s ;
b . appendChild ( f ) ; for ( f = 0 ; f < m . length ; ++ f ) b . appendChild ( m [ f ] ) ; this . svgElem _ . appendChild ( b ) ; this . all _layers . push ( [ s , b ] ) } svgedit . utilities . walkTree ( b , function ( B ) { B . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; this . current _layer = b ; this . current _layer . setAttribute ( "style" , "pointer-events:all" ) } ; svgedit . draw . Drawing . prototype . createLayer = function ( c ) { var m = this . svgElem _ . ownerDocument , s = m . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; m = m . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; m . textContent =
c ; s . appendChild ( m ) ; this . svgElem _ . appendChild ( s ) ; this . identifyLayers ( ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerVisibility = function ( c ) { for ( var m = null , s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == c ) { m = this . all _layers [ s ] [ 1 ] ; break } if ( ! m ) return false ; return m . getAttribute ( "display" ) != "none" } ; svgedit . draw . Drawing . prototype . setLayerVisibility = function ( c , m ) { if ( typeof m != "boolean" ) return null ; for ( var s = null , b = 0 ; b < this . getNumLayers ( ) ; ++ b ) if ( this . getLayerName ( b ) == c ) { s = this . all _layers [ b ] [ 1 ] ;
break } if ( ! s ) return null ; s . getAttribute ( "display" ) ; s . setAttribute ( "display" , m ? "inline" : "none" ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerOpacity = function ( c ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; ++ m ) if ( this . getLayerName ( m ) == c ) { ( c = this . all _layers [ m ] [ 1 ] . getAttribute ( "opacity" ) ) || ( c = "1.0" ) ; return parseFloat ( c ) } return null } ; svgedit . draw . Drawing . prototype . setLayerOpacity = function ( c , m ) { if ( ! ( typeof m != "number" || m < 0 || m > 1 ) ) for ( var s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == c ) { this . all _layers [ s ] [ 1 ] . setAttribute ( "opacity" ,
m ) ; break } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . path ) svgedit . path = { } ; var a = { pathNodeTooltip : "Drag node to move it. Double-click node to change segment type" , pathCtrlPtTooltip : "Drag control point to adjust curve properties" } , p = { 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" ] } , g = [ ] , c = true , m = { } ; svgedit . path . setLinkControlPoints = function ( f ) { c = f } ; var s = svgedit . path . path = null ; svgedit . path . init =
function ( f ) { s = f ; g = [ 0 , "ClosePath" ] ; $ . each ( [ "Moveto" , "Lineto" , "CurvetoCubic" , "CurvetoQuadratic" , "Arc" , "LinetoHorizontal" , "LinetoVertical" , "CurvetoCubicSmooth" , "CurvetoQuadraticSmooth" ] , function ( d , k ) { g . push ( k + "Abs" ) ; g . push ( k + "Rel" ) } ) } ; svgedit . path . insertItemBefore = function ( f , d , k ) { f = f . pathSegList ; if ( svgedit . browser . supportsPathInsertItemBefore ( ) ) f . insertItemBefore ( d , k ) ; else { for ( var q = f . numberOfItems , B = [ ] , o = 0 ; o < q ; o ++ ) { var J = f . getItem ( o ) ; B . push ( J ) } f . clear ( ) ; for ( o = 0 ; o < q ; o ++ ) { o == k && f . appendItem ( d ) ; f . appendItem ( B [ o ] ) } } } ;
svgedit . path . ptObjToArr = function ( f , d ) { for ( var k = p [ f ] , q = k . length , B = Array ( q ) , o = 0 ; o < q ; o ++ ) B [ o ] = d [ k [ o ] ] ; return B } ; svgedit . path . getGripPt = function ( f , d ) { var k = { x : d ? d . x : f . item . x , y : d ? d . y : f . item . y } , q = f . path ; if ( q . matrix ) k = svgedit . math . transformPoint ( k . x , k . y , q . matrix ) ; k . x *= s . getCurrentZoom ( ) ; k . y *= s . getCurrentZoom ( ) ; return k } ; svgedit . path . getPointFromGrip = function ( f , d ) { var k = { x : f . x , y : f . y } ; if ( d . matrix ) { f = svgedit . math . transformPoint ( k . x , k . y , d . imatrix ) ; k . x = f . x ; k . y = f . y } k . x /= s . getCurrentZoom ( ) ; k . y /= s . getCurrentZoom ( ) ;
2012-07-25 09:18:34 +00:00
return k } ; svgedit . path . addPointGrip = function ( f , d , k ) { var q = svgedit . path . getGripContainer ( ) , B = svgedit . utilities . getElem ( "pathpointgrip_" + f ) ; if ( ! B ) { B = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; svgedit . utilities . assignAttributes ( B , { id : "pathpointgrip_" + f , 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" : a . pathNodeTooltip } ) ;
B = q . appendChild ( B ) ; $ ( "#pathpointgrip_" + f ) . dblclick ( function ( ) { svgedit . path . path && svgedit . path . path . setSegType ( ) } ) } if ( d && k ) svgedit . utilities . assignAttributes ( B , { x : d - ( svgedit . browser . isTouch ( ) ? 15 : 2.5 ) , y : k - ( svgedit . browser . isTouch ( ) ? 15 : 2.5 ) , display : "inline" } ) ; return B } ; svgedit . path . getGripContainer = function ( ) { var f = svgedit . utilities . getElem ( "pathpointgrip_container" ) ; if ( ! f ) { f = svgedit . utilities . getElem ( "selectorParentGroup" ) . appendChild ( document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ) ; f . id =
"pathpointgrip_container" } return f } ; svgedit . path . addCtrlGrip = function ( f ) { var d = svgedit . utilities . getElem ( "ctrlpointgrip_" + f ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" , "circle" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlpointgrip_" + f , display : "none" , r : svgedit . browser . isTouch ( ) ? 15 : 3 , fill : "#4F80FF" , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathCtrlPtTooltip } ) ; svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getCtrlLine = function ( f ) { var d =
svgedit . utilities . getElem ( "ctrlLine_" + f ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" , "line" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlLine_" + f , stroke : "#4F80FF" , "stroke-width" : 1 , style : "pointer-events:none" } ) ; svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getPointGrip = function ( f , d ) { var k = svgedit . path . addPointGrip ( f . index ) ; if ( d ) { var q = svgedit . path . getGripPt ( f ) ; svgedit . utilities . assignAttributes ( k , { x : q . x - ( svgedit . browser . isTouch ( ) ? 15 : 2.5 ) , y : q . y - ( svgedit . browser . isTouch ( ) ?
15 : 2.5 ) , display : "inline" } ) } return k } ; svgedit . path . getControlPoints = function ( f ) { var d = f . item , k = f . index ; if ( ! ( "x1" in d ) || ! ( "x2" in d ) ) return null ; var q = { } ; svgedit . path . getGripContainer ( ) ; for ( var B = [ svgedit . path . path . segs [ k - 1 ] . item , d ] , o = 1 ; o < 3 ; o ++ ) { var J = k + "c" + o , U = q [ "c" + o + "_line" ] = svgedit . path . getCtrlLine ( J ) , M = svgedit . path . getGripPt ( f , { x : d [ "x" + o ] , y : d [ "y" + o ] } ) , I = svgedit . path . getGripPt ( f , { x : B [ o - 1 ] . x , y : B [ o - 1 ] . y } ) ; svgedit . utilities . assignAttributes ( U , { x1 : M . x , y1 : M . y , x2 : I . x , y2 : I . y , display : "inline" } ) ; q [ "c" + o +
"_line" ] = U ; pointGrip = q [ "c" + o ] = svgedit . path . addCtrlGrip ( J ) ; svgedit . utilities . assignAttributes ( pointGrip , { cx : M . x , cy : M . y , display : "inline" } ) ; q [ "c" + o ] = pointGrip } return q } ; svgedit . path . replacePathSeg = function ( f , d , k , q ) { q = q || svgedit . path . path . elem ; f = q [ "createSVGPathSeg" + g [ f ] ] . apply ( q , k ) ; if ( svgedit . browser . supportsPathReplaceItem ( ) ) q . pathSegList . replaceItem ( f , d ) ; else { k = q . pathSegList ; q = k . numberOfItems ; for ( var B = [ ] , o = 0 ; o < q ; o ++ ) { var J = k . getItem ( o ) ; B . push ( J ) } k . clear ( ) ; for ( o = 0 ; o < q ; o ++ ) o == d ? k . appendItem ( f ) : k . appendItem ( B [ o ] ) } } ;
svgedit . path . getSegSelector = function ( f , d ) { var k = f . index , q = svgedit . utilities . getElem ( "segline_" + k ) ; if ( ! q ) { var B = svgedit . path . getGripContainer ( ) ; q = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; svgedit . utilities . assignAttributes ( q , { id : "segline_" + k , display : "none" , fill : "none" , stroke : "#0FF" , "stroke-width" : 2 , style : "pointer-events:none" , d : "M0,0 0,0" } ) ; B . appendChild ( q ) } if ( d ) { k = f . prev ; if ( ! k ) { q . setAttribute ( "display" , "none" ) ; return q } k = svgedit . path . getGripPt ( k ) ; svgedit . path . replacePathSeg ( 2 ,
0 , [ k . x , k . y ] , q ) ; B = svgedit . path . ptObjToArr ( f . type , f . item , true ) ; for ( var o = 0 ; o < B . length ; o += 2 ) { k = svgedit . path . getGripPt ( f , { x : B [ o ] , y : B [ o + 1 ] } ) ; B [ o ] = k . x ; B [ o + 1 ] = k . y } svgedit . path . replacePathSeg ( f . type , 1 , B , q ) } return q } ; svgedit . path . smoothControlPoints = this . smoothControlPoints = function ( f , d , k ) { var q = f . x - k . x , B = f . y - k . y , o = d . x - k . x , J = d . y - k . y ; if ( ( q != 0 || B != 0 ) && ( o != 0 || J != 0 ) ) { f = Math . atan2 ( B , q ) ; d = Math . atan2 ( J , o ) ; q = Math . sqrt ( q * q + B * B ) ; o = Math . sqrt ( o * o + J * J ) ; B = s . getSVGRoot ( ) . createSVGPoint ( ) ; J = s . getSVGRoot ( ) . createSVGPoint ( ) ;
if ( f < 0 ) f += 2 * Math . PI ; if ( d < 0 ) d += 2 * Math . PI ; var U = Math . abs ( f - d ) , M = Math . abs ( Math . PI - U ) / 2 ; if ( f - d > 0 ) { f = U < Math . PI ? f + M : f - M ; d = U < Math . PI ? d - M : d + M } else { f = U < Math . PI ? f - M : f + M ; d = U < Math . PI ? d + M : d - M } B . x = q * Math . cos ( f ) + k . x ; B . y = q * Math . sin ( f ) + k . y ; J . x = o * Math . cos ( d ) + k . x ; J . y = o * Math . sin ( d ) + k . y ; return [ B , J ] } } ; svgedit . path . Segment = function ( f , d ) { this . selected = false ; this . index = f ; this . item = d ; this . type = d . pathSegType ; this . ctrlpts = [ ] ; this . segsel = this . ptgrip = null } ; svgedit . path . Segment . prototype . showCtrlPts = function ( f ) { for ( var d in this . ctrlpts ) this . ctrlpts [ d ] . setAttribute ( "display" ,
f ? "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 ( f ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "display" , f ? "inline" : "none" ) ; this . segsel . setAttribute ( "display" , f ? "inline" : "none" ) ; this . showCtrlPts ( f ) } } ; svgedit . path . Segment . prototype . select = function ( f ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "stroke" , f ? "#0FF" : "#00F" ) ; this . segsel . setAttribute ( "display" ,
f ? "inline" : "none" ) ; this . ctrlpts && this . selectCtrls ( f ) ; this . selected = f } } ; 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 ( f ) { if ( this . ptgrip ) { var d = svgedit . path . getGripPt ( this ) , k = svgedit . browser . isTouch ( ) ? 15 : 2.5 ; svgedit . utilities . assignAttributes ( this . ptgrip , this . ptgrip . nodeName == "rect" ? { x : d . x - k , y : d . y -
k } : { cx : d . x , cy : d . y } ) ; svgedit . path . getSegSelector ( this , true ) ; if ( this . ctrlpts ) { if ( f ) { 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 ( f , d ) { var k = this . item ; k = this . ctrlpts ? [ k . x += f , k . y += d , k . x1 , k . y1 , k . x2 += f , k . y2 += d ] : [ k . x += f , k . y += d ] ; svgedit . path . replacePathSeg ( this . type , this . index , k ) ; if ( this . next && this . next . ctrlpts ) { k = this . next . item ; k = [ k . x , k . y , k . x1 += f , k . y1 += d , k . x2 , k . y2 ] ; svgedit . path . replacePathSeg ( this . next . type ,
this . next . index , k ) } if ( this . mate ) { k = this . mate . item ; k = [ k . x += f , k . y += d ] ; svgedit . path . replacePathSeg ( this . mate . type , this . mate . index , k ) } this . update ( true ) ; this . next && this . next . update ( true ) } ; svgedit . path . Segment . prototype . setLinked = function ( f ) { var d , k , q ; if ( f == 2 ) { k = 1 ; d = this . next ; if ( ! d ) return ; q = this . item } else { k = 2 ; d = this . prev ; if ( ! d ) return ; q = d . item } var B = d . item ; B [ "x" + k ] = q . x + ( q . x - this . item [ "x" + f ] ) ; B [ "y" + k ] = q . y + ( q . y - this . item [ "y" + f ] ) ; svgedit . path . replacePathSeg ( d . type , d . index , [ B . x , B . y , B . x1 , B . y1 , B . x2 , B . y2 ] ) ; d . update ( true ) } ;
svgedit . path . Segment . prototype . moveCtrl = function ( f , d , k ) { var q = this . item ; q [ "x" + f ] += d ; q [ "y" + f ] += k ; 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 ( f , d ) { svgedit . path . replacePathSeg ( f , this . index , d ) ; this . type = f ; this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . showCtrlPts ( f === 6 ) ; this . ctrlpts = svgedit . path . getControlPoints ( this ) ; this . update ( true ) } ; svgedit . path . Path = function ( f ) { if ( ! f || f . tagName !==
"path" ) throw "svgedit.path.Path constructed without a <path> element" ; this . elem = f ; 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 f = this . elem . pathSegList , d = f . numberOfItems ; this . segs = [ ] ; this . selected _pts = [ ] ; this . first _seg = null ; for ( var k = 0 ; k < d ; k ++ ) { var q = f . getItem ( k ) ; q = new svgedit . path . Segment ( k , q ) ; q . path = this ; this . segs . push ( q ) } f = this . segs ; q = null ; for ( k = 0 ; k < d ; k ++ ) { var B =
f [ k ] , o = k + 1 >= d ? null : f [ k + 1 ] , J = k - 1 < 0 ? null : f [ k - 1 ] ; if ( B . type === 2 ) { if ( J && J . type !== 1 ) { o = f [ q ] ; o . next = f [ q + 1 ] ; o . next . prev = o ; o . addGrip ( ) } q = k } else if ( o && o . type === 1 ) { B . next = f [ q + 1 ] ; B . next . prev = B ; B . mate = f [ q ] ; B . addGrip ( ) ; if ( this . first _seg == null ) this . first _seg = B } else if ( o ) { if ( B . type !== 1 ) { B . addGrip ( ) ; if ( o && o . type !== 2 ) { B . next = o ; B . next . prev = B } } } else if ( B . type !== 1 ) { o = f [ q ] ; o . next = f [ q + 1 ] ; o . next . prev = o ; o . addGrip ( ) ; B . addGrip ( ) ; if ( ! this . first _seg ) this . first _seg = f [ q ] } } return this } ; svgedit . path . Path . prototype . eachSeg = function ( f ) { for ( var d =
this . segs . length , k = 0 ; k < d ; k ++ ) if ( f . call ( this . segs [ k ] , k ) === false ) break } ; svgedit . path . Path . prototype . addSeg = function ( f ) { var d = this . segs [ f ] ; if ( d . prev ) { var k = d . prev , q ; switch ( d . item . pathSegType ) { case 4 : var B = ( d . item . x + k . item . x ) / 2 , o = ( d . item . y + k . item . y ) / 2 ; q = this . elem . createSVGPathSegLinetoAbs ( B , o ) ; break ; case 6 : q = ( k . item . x + d . item . x1 ) / 2 ; var J = ( d . item . x1 + d . item . x2 ) / 2 , U = ( d . item . x2 + d . item . x ) / 2 , M = ( q + J ) / 2 ; J = ( J + U ) / 2 ; B = ( M + J ) / 2 ; var I = ( k . item . y + d . item . y1 ) / 2 , S = ( d . item . y1 + d . item . y2 ) / 2 ; k = ( d . item . y2 + d . item . y ) / 2 ; var Y = ( I +
S ) / 2 ; S = ( S + k ) / 2 ; o = ( Y + S ) / 2 ; q = this . elem . createSVGPathSegCurvetoCubicAbs ( B , o , q , I , M , Y ) ; svgedit . path . replacePathSeg ( d . type , f , [ d . item . x , d . item . y , J , S , U , k ] ) } svgedit . path . insertItemBefore ( this . elem , q , f ) } } ; svgedit . path . Path . prototype . deleteSeg = function ( f ) { var d = this . segs [ f ] , k = this . elem . pathSegList ; d . show ( false ) ; var q = d . next ; if ( d . mate ) { var B = [ q . item . x , q . item . y ] ; svgedit . path . replacePathSeg ( 2 , q . index , B ) ; svgedit . path . replacePathSeg ( 4 , d . index , B ) ; k . removeItem ( d . mate . index ) } else { if ( ! d . prev ) { B = [ q . item . x , q . item . y ] ; svgedit . path . replacePathSeg ( 2 ,
d . next . index , B ) } k . removeItem ( f ) } } ; svgedit . path . Path . prototype . subpathIsClosed = function ( f ) { var d = false ; svgedit . path . path . eachSeg ( function ( k ) { if ( k <= f ) return true ; if ( this . type === 2 ) return false ; else if ( this . type === 1 ) { d = true ; return false } } ) ; return d } ; svgedit . path . Path . prototype . removePtFromSelection = function ( f ) { var d = this . selected _pts . indexOf ( f ) ; if ( d != - 1 ) { this . segs [ f ] . select ( false ) ; this . selected _pts . splice ( d , 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 ( f ) { this . eachSeg ( function ( ) { this . show ( f ) } ) ; f && this . selectPt ( this . first _seg . index ) ; return this } ; svgedit . path . Path . prototype . movePts = function ( f , d ) { for ( var k = this . selected _pts . length ; k -- ; ) this . segs [ this . selected _pts [ k ] ] . move ( f , d ) } ; svgedit . path . Path . prototype . moveCtrl = function ( f , d ) { var k = this . segs [ this . selected _pts [ 0 ] ] ; k . moveCtrl ( this . dragctrl , f , d ) ; c && k . setLinked ( this . dragctrl ) } ;
svgedit . path . Path . prototype . setSegType = function ( f ) { this . storeD ( ) ; for ( var d = this . selected _pts . length , k ; d -- ; ) { var q = this . segs [ this . selected _pts [ d ] ] , B = q . prev ; if ( B ) { if ( ! f ) { k = "Toggle Path Segment Type" ; f = q . type == 6 ? 4 : 6 } f -= 0 ; var o = q . item . x , J = q . item . y , U = B . item . x ; B = B . item . y ; var M ; switch ( f ) { case 6 : if ( q . olditem ) { U = q . olditem ; M = [ o , J , U . x1 , U . y1 , U . x2 , U . y2 ] } else { M = o - U ; var I = J - B ; M = [ o , J , U + M / 3 , B + I / 3 , o - M / 3 , J - I / 3 ] } break ; case 4 : M = [ o , J ] ; q . olditem = q . item } q . setType ( f , M ) } } svgedit . path . path . endChanges ( k ) } ; svgedit . path . Path . prototype . selectPt =
function ( f , d ) { this . clearSelection ( ) ; f == null && this . eachSeg ( function ( k ) { if ( this . prev ) f = k } ) ; this . addPtsToSelection ( f ) ; if ( d ) { this . dragctrl = d ; c && this . segs [ f ] . setLinked ( d ) } } ; svgedit . path . Path . prototype . update = function ( ) { var f = this . elem ; if ( svgedit . utilities . getRotationAngle ( f ) ) { this . matrix = svgedit . math . getMatrix ( f ) ; this . imatrix = this . matrix . inverse ( ) } else this . imatrix = this . matrix = null ; this . eachSeg ( function ( d ) { this . item = f . pathSegList . getItem ( d ) ; this . update ( ) } ) ; return this } ; svgedit . path . getPath _ = function ( f ) { var d =
m [ f . id ] ; d || ( d = m [ f . id ] = new svgedit . path . Path ( f ) ) ; return d } ; svgedit . path . removePath _ = function ( f ) { f in m && delete m [ f ] } ; var b = function ( f , d ) { dx = f - oldcx ; dy = d - oldcy ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) + angle ; dx = r * Math . cos ( theta ) + oldcx ; dy = r * Math . sin ( theta ) + oldcy ; dx -= newcx ; dy -= newcy ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) - angle ; return { x : ( r * Math . cos ( theta ) + newcx ) / 1 , y : ( r * Math . sin ( theta ) + newcy ) / 1 } } ; svgedit . path . recalcRotatedPath = function ( ) { var f = svgedit . path . path . elem , d = svgedit . utilities . getRotationAngle ( f ,
true ) ; if ( d ) { var k = svgedit . utilities . getBBox ( f ) , q = svgedit . path . path . oldbbox , B = q . x + q . width / 2 , o = q . y + q . height / 2 ; q = k . x + k . width / 2 ; k = k . y + k . height / 2 ; q = q - B ; var J = k - o ; k = Math . sqrt ( q * q + J * J ) ; J = Math . atan2 ( J , q ) + d ; q = k * Math . cos ( J ) + B ; k = k * Math . sin ( J ) + o ; B = f . pathSegList ; for ( o = B . numberOfItems ; o ; ) { o -= 1 ; J = B . getItem ( o ) ; var U = J . pathSegType ; if ( U != 1 ) { var M = b ( J . x , J . y ) ; M = [ M . x , M . y ] ; if ( J . x1 != null && J . x2 != null ) { c _vals1 = b ( J . x1 , J . y1 ) ; c _vals2 = b ( J . x2 , J . y2 ) ; M . splice ( M . length , 0 , c _vals1 . x , c _vals1 . y , c _vals2 . x , c _vals2 . y ) } svgedit . path . replacePathSeg ( U ,
o , M ) } } svgedit . utilities . getBBox ( f ) ; B = svgroot . createSVGTransform ( ) ; f = svgedit . transformlist . getTransformList ( f ) ; B . setRotate ( d * 180 / Math . PI , q , k ) ; f . replaceItem ( B , 0 ) } } ; svgedit . path . clearData = function ( ) { m = { } } } ) ( ) ; 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 ( ) { } }
2012-07-25 08:56:15 +00:00
( function ( ) { var a = jQuery . fn . attr ; jQuery . fn . attr = function ( p , g ) { var c = this . length ; if ( ! c ) return a . apply ( this , arguments ) ; for ( var m = 0 ; m < c ; m ++ ) { var s = this [ m ] ; if ( s . namespaceURI === "http://www.w3.org/2000/svg" ) if ( g !== undefined ) s . setAttribute ( p , g ) ; else if ( $ . isArray ( p ) ) { c = p . length ; for ( m = { } ; c -- ; ) { var b = p [ c ] , f = s . getAttribute ( b ) ; if ( f || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; m [ b ] = f } return m } else if ( typeof p === "object" ) for ( b in p ) s . setAttribute ( b , p [ b ] ) ; else { if ( ( f = s . getAttribute ( p ) ) || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; return f } else return a . apply ( this ,
2012-06-23 19:40:40 +00:00
arguments ) } return this } } ) ( ) ;
2012-07-25 08:56:15 +00:00
$ . SvgCanvas = function ( a , p ) { function g ( e , h ) { for ( var l = svgedit . utilities . getBBox ( e ) , z = 0 ; z < 2 ; z ++ ) { var v = z === 0 ? "fill" : "stroke" , G = e . getAttribute ( v ) ; if ( G && G . indexOf ( "url(" ) === 0 ) { G = T ( G ) ; if ( G . tagName === "linearGradient" ) { var A = G . getAttribute ( "x1" ) || 0 , u = G . getAttribute ( "y1" ) || 0 , F = G . getAttribute ( "x2" ) || 1 , H = G . getAttribute ( "y2" ) || 0 ; A = l . width * A + l . x ; u = l . height * u + l . y ; F = l . width * F + l . x ; H = l . height * H + l . y ; A = P ( A , u , h ) ; H = P ( F , H , h ) ; F = { } ; F . x1 = ( A . x - l . x ) / l . width ; F . y1 = ( A . y - l . y ) / l . height ; F . x2 = ( H . x - l . x ) / l . width ; F . y2 = ( H . y - l . y ) / l . height ;
G = G . cloneNode ( true ) ; $ ( G ) . attr ( F ) ; G . id = ja ( ) ; mb ( ) . appendChild ( G ) ; e . setAttribute ( v , "url(#" + G . id + ")" ) } } } } var c = "http://www.w3.org/2000/svg" , m = { show _outside _canvas : true , selectNew : true , dimensions : [ 640 , 480 ] } ; p && $ . extend ( m , p ) ; var s = m . dimensions , b = this , f = a . ownerDocument , d = f . importNode ( svgedit . utilities . text2xml ( '<svg id="svgroot" xmlns="' + c + '" xlinkns="http://www.w3.org/1999/xlink" width="' + s [ 0 ] + '" height="' + s [ 1 ] + '" x="' + s [ 0 ] + '" y="' + s [ 1 ] + '" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>' ) . documentElement ,
true ) ; a . appendChild ( d ) ; var k = f . createElementNS ( c , "svg" ) ; ( b . clearSvgContentElement = function ( ) { for ( ; k . firstChild ; ) k . removeChild ( k . firstChild ) ; $ ( k ) . attr ( { id : "svgcontent" , width : s [ 0 ] , height : s [ 1 ] , x : s [ 0 ] , y : s [ 1 ] , overflow : m . 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 e = f . createComment ( " Created with Method Draw - http://github.com/duopixel/Method-Draw/ " ) ; k . appendChild ( e ) } ) ( ) ; var q = "svg_" ; b . setIdPrefix =
function ( e ) { q = e } ; b . current _drawing _ = new svgedit . draw . Drawing ( k , q ) ; var B = b . getCurrentDrawing = function ( ) { return b . current _drawing _ } , o = 1 , J = null , U = { shape : { fill : ( m . initFill . color == "none" ? "" : "#" ) + m . initFill . color , fill _paint : null , fill _opacity : m . initFill . opacity , stroke : "#" + m . initStroke . color , stroke _paint : null , stroke _opacity : m . initStroke . opacity , stroke _width : m . initStroke . width , stroke _dasharray : "none" , stroke _linejoin : "miter" , stroke _linecap : "butt" , opacity : m . initOpacity } } ; U . text = $ . extend ( true , { } , U . shape ) ; $ . extend ( U . text ,
2012-07-25 10:27:26 +00:00
{ fill : "#000000" , stroke _width : 0 , font _size : 24 , font _family : "Helvetica, Arial, sans-serif" } ) ; var M = U . shape , I = Array ( 1 ) , S = this . addSvgElementFromJson = function ( e ) { var h = svgedit . utilities . getElem ( e . attr . id ) , l = B ( ) . getCurrentLayer ( ) ; if ( h && e . element != h . tagName ) { l . removeChild ( h ) ; h = null } if ( ! h ) { h = f . createElementNS ( c , e . element ) ; if ( l ) ( J || l ) . appendChild ( h ) } e . curStyles && svgedit . utilities . assignAttributes ( h , { fill : M . fill , stroke : M . stroke , "stroke-width" : M . stroke _width , "stroke-dasharray" : M . stroke _dasharray , "stroke-linejoin" : M . stroke _linejoin ,
2012-07-25 06:32:18 +00:00
"stroke-linecap" : M . stroke _linecap , "stroke-opacity" : M . stroke _opacity , "fill-opacity" : M . fill _opacity , opacity : M . opacity / 2 , style : "pointer-events:inherit" } , 100 ) ; svgedit . utilities . assignAttributes ( h , e . attr , 100 ) ; svgedit . utilities . cleanupElement ( h ) ; return h } , Y = b . getTransformList = svgedit . transformlist . getTransformList , P = svgedit . math . transformPoint , ia = b . matrixMultiply = svgedit . math . matrixMultiply , qa = b . hasMatrixTransform = svgedit . math . hasMatrixTransform , ga = b . transformListToTransform = svgedit . math . transformListToTransform ,
2012-07-25 08:56:15 +00:00
ba = svgedit . math . snapToAngle , W = svgedit . math . getMatrix ; svgedit . units . init ( { getBaseUnit : function ( ) { return m . baseUnit } , getElement : svgedit . utilities . getElem , getHeight : function ( ) { return k . getAttribute ( "height" ) / o } , getWidth : function ( ) { return k . getAttribute ( "width" ) / o } , getRoundDigits : function ( ) { return hb . round _digits } } ) ; var ta = b . convertToNum = svgedit . units . convertToNum ; svgedit . utilities . init ( { getDOMDocument : function ( ) { return f } , getDOMContainer : function ( ) { return a } , getSVGRoot : function ( ) { return d } , getSelectedElements : function ( ) { return I } ,
getSVGContent : function ( ) { return k } } ) ; var ka = b . getUrlFromAttr = svgedit . utilities . getUrlFromAttr , da = b . getHref = svgedit . utilities . getHref , X = b . setHref = svgedit . utilities . setHref , Z = svgedit . utilities . getPathBBox ; b . getBBox = svgedit . utilities . getBBox ; var oa = b . getRotationAngle = svgedit . utilities . getRotationAngle , ra = b . getElem = svgedit . utilities . getElem , ma = b . assignAttributes = svgedit . utilities . assignAttributes , na = this . cleanupElement = svgedit . utilities . cleanupElement , Ca = svgedit . sanitize . getNSMap ( ) , Ga = b . sanitizeSvg = svgedit . sanitize . sanitizeSvg ,
Ja = svgedit . history . MoveElementCommand , Da = svgedit . history . InsertElementCommand , La = svgedit . history . RemoveElementCommand , Oa = svgedit . history . ChangeElementCommand , Ba = svgedit . history . BatchCommand ; b . undoMgr = new svgedit . history . UndoManager ( { handleHistoryEvent : function ( e , h ) { var l = svgedit . history . HistoryEventTypes ; if ( e == l . BEFORE _UNAPPLY || e == l . BEFORE _APPLY ) b . clearSelection ( ) ; else if ( e == l . AFTER _APPLY || e == l . AFTER _UNAPPLY ) { var z = h . elements ( ) ; b . pathActions . clear ( ) ; O ( "changed" , z ) ; z = h . type ( ) ; l = e == l . AFTER _APPLY ; if ( z ==
Ja . type ( ) ) { l = l ? h . newParent : h . oldParent ; l == k && b . identifyLayers ( ) } else if ( z == Da . type ( ) || z == La . type ( ) ) { h . parent == k && b . identifyLayers ( ) ; if ( z == Da . type ( ) ) l && Ua ( h . elem ) ; else l || Ua ( h . elem ) ; h . elem . tagName === "use" && Nb ( h . elem ) } else if ( z == Oa . type ( ) ) { h . elem . tagName == "title" && h . elem . parentNode . parentNode == k && b . identifyLayers ( ) ; l = l ? h . newValues : h . oldValues ; l . stdDeviation && b . setBlurOffsets ( h . elem . parentNode , l . stdDeviation ) ; if ( h . elem . tagName === "use" && svgedit . browser . isWebkit ( ) ) { z = h . elem ; if ( ! z . getAttribute ( "x" ) && ! z . getAttribute ( "y" ) ) { l =
z . parentNode ; var v = z . nextSibling ; l . removeChild ( z ) ; l . insertBefore ( z , v ) } } } } } } ) ; var za = function ( e ) { b . undoMgr . addCommandToHistory ( e ) } ; svgedit . select . init ( m , { createSVGElement : function ( e ) { return b . addSvgElementFromJson ( e ) } , svgRoot : function ( ) { return d } , svgContent : function ( ) { return k } , currentZoom : function ( ) { return o } , getStrokedBBox : function ( e ) { return b . getStrokedBBox ( [ e ] ) } } ) ; var Ia = this . selectorManager = svgedit . select . getSelectorManager ( ) ; svgedit . path . init ( { getCurrentZoom : function ( ) { return o } , getSVGRoot : function ( ) { return d } } ) ;
svgedit . utilities . snapToGrid = function ( e ) { var h = m . snappingStep , l = m . baseUnit ; if ( l !== "px" ) h *= svgedit . units . getTypeMap ( ) [ l ] ; return e = Math . round ( e / h ) * h } ; var xa = svgedit . utilities . snapToGrid , rb = { exportNoBlur : "Blurred elements will appear as un-blurred" , exportNoforeignObject : "foreignObject elements will not appear" , exportNoDashArray : "Strokes will appear filled" , exportNoText : "Text may not appear as expected" } , $a = [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "stroke" ] , jb = $ . data ,
Ua = function ( e ) { var h = $ ( e ) . attr ( $a ) , l ; for ( l in h ) { var z = h [ l ] ; if ( z && z . indexOf ( "url(" ) === 0 ) { z = ka ( z ) . substr ( 1 ) ; if ( ! ra ( z ) ) { mb ( ) . appendChild ( zb [ z ] ) ; delete zb [ z ] } } } e = e . getElementsByTagName ( "*" ) ; if ( e . length ) { h = 0 ; for ( l = e . length ; h < l ; h ++ ) Ua ( e [ h ] ) } } , Sa = { } , Ea = m . imgPath + "logo.png" , wa = [ ] , hb = { round _digits : 5 } , Ma = false , Ta = null , Fa = "select" , lb = "none" , tb = { } , Ya = U . text , bb = M , Cb = null , ua = null , nb = [ ] , kb = { } , zb = { } ; b . clipBoard = [ ] ; var pb = this . runExtensions = function ( e , h , l ) { var z = false ; if ( l ) z = [ ] ; $ . each ( kb , function ( v , G ) { if ( e in G ) if ( l ) z . push ( G [ e ] ( h ) ) ;
else z = G [ e ] ( h ) } ) ; return z } ; this . addExtension = function ( e , h ) { if ( e in kb ) console . log ( 'Cannot add extension "' + e + '", an extension by that name already exists"' ) ; else { var l = $ . isFunction ( h ) ? h ( $ . extend ( b . getPrivateMethods ( ) , { svgroot : d , svgcontent : k , nonce : B ( ) . getNonce ( ) , selectorManager : Ia } ) ) : h ; kb [ e ] = l ; O ( "extension_added" , l ) } } ; var gb = this . round = function ( e ) { return parseInt ( e * o ) / o } , ub = this . getIntersectionList = function ( e ) { if ( ua == null ) return null ; var h = J || B ( ) . getCurrentLayer ( ) ; nb . length || ( nb = xb ( h ) ) ; var l = null ;
try { l = h . getIntersectionList ( e , null ) } catch ( z ) { } if ( l == null || typeof l . item != "function" ) { l = [ ] ; if ( e ) e = e ; else { e = ua . getBBox ( ) ; h = { } ; for ( var v in e ) h [ v ] = e [ v ] / o ; e = h } for ( v = nb . length ; v -- ; ) e . width && e . width && svgedit . math . rectsIntersect ( e , nb [ v ] . bbox ) && l . push ( nb [ v ] . elem ) } return l } ; getStrokedBBox = this . getStrokedBBox = function ( e ) { e || ( e = vb ( ) ) ; if ( ! e . length ) return false ; var h = function ( H ) { try { var D = svgedit . utilities . getBBox ( H ) , E = svgedit . utilities . getRotationAngle ( H ) ; if ( E && E % 90 || svgedit . math . hasMatrixTransform ( svgedit . transformlist . getTransformList ( H ) ) ) { E =
false ; if ( [ "ellipse" , "path" , "line" , "polyline" , "polygon" ] . indexOf ( H . tagName ) >= 0 ) D = E = b . convertToPath ( H , true ) ; else if ( H . tagName == "rect" ) { var L = H . getAttribute ( "rx" ) , N = H . getAttribute ( "ry" ) ; if ( L || N ) D = E = b . convertToPath ( H , true ) } if ( ! E ) { var n = H . cloneNode ( true ) , w = document . createElementNS ( c , "g" ) , C = H . parentNode ; C . appendChild ( w ) ; w . appendChild ( n ) ; D = svgedit . utilities . bboxToObj ( w . getBBox ( ) ) ; C . removeChild ( w ) } } return D } catch ( K ) { console . log ( H , K ) ; return null } } , l ; $ . each ( e , function ( ) { if ( ! l ) if ( this . parentNode ) l = h ( this ) } ) ;
if ( l == null ) return null ; var z = l . x + l . width , v = l . y + l . height , G = l . x , A = l . y , u = function ( H ) { var D = H . getAttribute ( "stroke-width" ) , E = 0 ; if ( H . getAttribute ( "stroke" ) != "none" && ! isNaN ( D ) ) E += D / 2 ; return E } , F = [ ] ; $ . each ( e , function ( H , D ) { var E = h ( D ) ; if ( E ) { var L = u ( D ) ; G = Math . min ( G , E . x - L ) ; A = Math . min ( A , E . y - L ) ; F . push ( E ) } } ) ; l . x = G ; l . y = A ; $ . each ( e , function ( H , D ) { var E = F [ H ] ; if ( E && D . nodeType == 1 ) { var L = u ( D ) ; z = Math . max ( z , E . x + E . width + L ) ; v = Math . max ( v , E . y + E . height + L ) } } ) ; l . width = z - G ; l . height = v - A ; return l } ; var vb = this . getVisibleElements = function ( e ) { e ||
( e = $ ( k ) . children ( ) ) ; e . find ( "#canvas_background" ) . length && e . splice ( 0 , 1 ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( l , z ) { try { z . getBBox ( ) && h . push ( z ) } catch ( v ) { } } ) ; return h . reverse ( ) } , xb = this . getVisibleElementsAndBBoxes = function ( e ) { e || ( e = $ ( k ) . children ( ) ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( l , z ) { try { z . getBBox ( ) && h . push ( { elem : z , bbox : getStrokedBBox ( [ z ] ) } ) } catch ( v ) { } } ) ; return h . reverse ( ) } , Ab = this . groupSvgElem = function ( e ) { var h = document . createElementNS ( c , "g" ) ; e . parentNode . replaceChild ( h , e ) ; $ ( h ) . append ( e ) . data ( "gsvg" ,
e ) [ 0 ] . id = ja ( ) } , la = function ( e ) { var h = document . createElementNS ( e . namespaceURI , e . nodeName ) ; h . removeAttribute ( "id" ) ; $ . each ( e . attributes , function ( z , v ) { v . localName != "-moz-math-font-style" && h . setAttributeNS ( v . namespaceURI , v . nodeName , v . nodeValue ) } ) ; if ( svgedit . browser . isWebkit ( ) && e . nodeName == "path" ) { var l = Ka . convertPath ( e ) ; h . setAttribute ( "d" , l ) } $ . each ( e . childNodes , function ( z , v ) { switch ( v . nodeType ) { case 1 : h . appendChild ( la ( v ) ) ; break ; case 3 : h . textContent = v . nodeValue } } ) ; if ( $ ( e ) . data ( "gsvg" ) ) $ ( h ) . data ( "gsvg" , h . firstChild ) ;
else if ( $ ( e ) . data ( "symbol" ) ) { e = $ ( e ) . data ( "symbol" ) ; $ ( h ) . data ( "ref" , e ) . data ( "symbol" , e ) } else h . tagName == "image" && qb ( h ) ; h . id = ja ( ) ; return h } , ca , ja , O ; ( function ( e ) { var h = { } ; ca = e . getId = function ( ) { return B ( ) . getId ( ) } ; ja = e . getNextId = function ( ) { return B ( ) . getNextId ( ) } ; O = e . call = function ( l , z ) { if ( h [ l ] ) return h [ l ] ( this , z ) } ; e . bind = function ( l , z ) { var v = h [ l ] ; h [ l ] = z ; return v } } ) ( b ) ; this . prepareSvg = function ( e ) { this . sanitizeSvg ( e . documentElement ) ; e = e . getElementsByTagNameNS ( c , "path" ) ; for ( var h = 0 , l = e . length ; h < l ; ++ h ) { var z =
e [ h ] ; z . setAttribute ( "d" , Ka . convertPath ( z ) ) ; Ka . fixEnd ( z ) } } ; var T = this . getRefElem = function ( e ) { return ra ( ka ( e ) . substr ( 1 ) ) } , ea = function ( e ) { if ( ! svgedit . browser . isGecko ( ) ) return e ; var h = e . cloneNode ( true ) ; e . parentNode . insertBefore ( h , e ) ; e . parentNode . removeChild ( e ) ; Ia . releaseSelector ( e ) ; I [ 0 ] = h ; Ia . requestSelector ( h ) . showGrips ( true ) ; return h } ; this . setRotationAngle = function ( e , h ) { e = parseFloat ( e ) ; var l = I [ 0 ] , z = l . getAttribute ( "transform" ) , v = svgedit . utilities . getBBox ( l ) , G = v . x + v . width / 2 , A = v . y + v . height / 2 ; v = Y ( l ) ; v . numberOfItems >
0 && v . getItem ( 0 ) . type == 4 && v . removeItem ( 0 ) ; if ( e != 0 ) { G = P ( G , A , ga ( v ) . matrix ) ; A = d . createSVGTransform ( ) ; A . setRotate ( e , G . x , G . y ) ; v . numberOfItems ? v . insertItemBefore ( A , 0 ) : v . appendItem ( A ) } else v . numberOfItems == 0 && l . removeAttribute ( "transform" ) ; if ( ! h ) { v = l . getAttribute ( "transform" ) ; l . setAttribute ( "transform" , z ) ; db ( "transform" , v , I ) ; O ( "changed" , I ) } ra ( "pathpointgrip_container" ) ; l = Ia . requestSelector ( I [ 0 ] ) ; l . resize ( ) ; l . updateGripCursors ( e ) } ; var Ha = this . recalculateAllSelectedDimensions = function ( ) { for ( var e = new Ba ( lb ==
"none" ? "position" : "size" ) , h = I . length ; h -- ; ) { var l = Wa ( I [ h ] ) ; l && e . addSubCommand ( l ) } if ( ! e . isEmpty ( ) ) { za ( e ) ; O ( "changed" , I ) } } , Pa = [ 0 , "z" , "M" , "m" , "L" , "l" , "C" , "c" , "Q" , "q" , "A" , "a" , "H" , "h" , "V" , "v" , "S" , "s" , "T" , "t" ] , Xa = function ( e ) { console . log ( [ e . a , e . b , e . c , e . d , e . e , e . f ] ) } , fb = this . remapElement = function ( e , h , l ) { var z = m . gridSnapping && e . parentNode . parentNode . localName === "svg" , v = function ( ) { if ( z ) for ( var E in h ) h [ E ] = xa ( h [ E ] ) ; ma ( e , h , 1E3 , true ) } ; box = svgedit . utilities . getBBox ( e ) ; for ( var G = 0 ; G < 2 ; G ++ ) { var A = G === 0 ? "fill" : "stroke" ,
u = e . getAttribute ( A ) ; if ( u && u . indexOf ( "url(" ) === 0 ) if ( l . a < 0 || l . d < 0 ) { u = T ( u ) . cloneNode ( true ) ; if ( l . a < 0 ) { var F = u . getAttribute ( "x1" ) , H = u . getAttribute ( "x2" ) ; u . setAttribute ( "x1" , - ( F - 1 ) ) ; u . setAttribute ( "x2" , - ( H - 1 ) ) } if ( l . d < 0 ) { F = u . getAttribute ( "y1" ) ; H = u . getAttribute ( "y2" ) ; u . setAttribute ( "y1" , - ( F - 1 ) ) ; u . setAttribute ( "y2" , - ( H - 1 ) ) } u . id = ja ( ) ; mb ( ) . appendChild ( u ) ; e . setAttribute ( A , "url(#" + u . id + ")" ) } } G = e . tagName ; if ( G === "g" || G === "text" || G === "use" ) if ( l . a == 1 && l . b == 0 && l . c == 0 && l . d == 1 && ( l . e != 0 || l . f != 0 ) ) { A = ga ( e ) . matrix ; A = ia ( A . inverse ( ) ,
l , A ) ; h . x = parseFloat ( h . x ) + A . e ; h . y = parseFloat ( h . y ) + A . f } else { A = Y ( e ) ; u = d . createSVGTransform ( ) ; u . setMatrix ( ia ( ga ( A ) . matrix , l ) ) ; A . clear ( ) ; A . appendItem ( u ) } switch ( G ) { case "foreignObject" : case "rect" : case "image" : if ( G === "image" && ( l . a < 0 || l . d < 0 ) ) { A = Y ( e ) ; u = d . createSVGTransform ( ) ; u . setMatrix ( ia ( ga ( A ) . matrix , l ) ) ; A . clear ( ) ; A . appendItem ( u ) } else { A = P ( h . x , h . y , l ) ; h . width = l . a * h . width ; h . height = l . d * h . height ; h . x = A . x + Math . min ( 0 , h . width ) ; h . y = A . y + Math . min ( 0 , h . height ) ; h . width = Math . abs ( h . width ) ; h . height = Math . abs ( h . height ) } v ( ) ;
break ; case "ellipse" : G = P ( h . cx , h . cy , l ) ; h . cx = G . x ; h . cy = G . y ; h . rx = l . a * h . rx ; h . ry = l . d * h . ry ; h . rx = Math . abs ( h . rx ) ; h . ry = Math . abs ( h . ry ) ; v ( ) ; break ; case "circle" : G = P ( h . cx , h . cy , l ) ; h . cx = G . x ; h . cy = G . y ; G = svgedit . math . transformBox ( box . x , box . y , box . width , box . height , l ) ; 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 ) ; v ( ) ; break ; case "line" : A = P ( h . x1 , h . y1 , l ) ; F = P ( h . x2 , h . y2 , l ) ; h . x1 = A . x ; h . y1 = A . y ; h . x2 = F . x ; h . y2 = F . y ; case "text" : l = e . querySelectorAll ( "tspan" ) ; for ( G = l . length ; G -- ; ) { A = ta ( "x" , e . getAttribute ( "x" ) ) ;
u = ta ( "x" , l [ G ] . getAttribute ( "x" ) ) ; F = ta ( "y" , e . getAttribute ( "y" ) ) ; H = ta ( "y" , l [ G ] . getAttribute ( "y" ) ) ; var D = { } ; if ( ! isNaN ( A ) && ! isNaN ( u ) && A != 0 && u != 0 && h . x ) D . x = h . x - ( A - u ) ; if ( ! isNaN ( F ) && ! isNaN ( H ) && F != 0 && H != 0 && h . y ) D . y = h . y - ( F - H ) ; if ( D . x || D . y ) ma ( l [ G ] , D , 1E3 , true ) } v ( ) ; break ; case "use" : v ( ) ; break ; case "g" : ( v = $ ( e ) . data ( "gsvg" ) ) && ma ( v , h , 1E3 , true ) ; break ; case "polyline" : case "polygon" : v = h . points . length ; for ( G = 0 ; G < v ; ++ G ) { H = h . points [ G ] ; H = P ( H . x , H . y , l ) ; h . points [ G ] . x = H . x ; h . points [ G ] . y = H . y } v = h . points . length ; l = "" ; for ( G = 0 ; G < v ; ++ G ) { H =
h . points [ G ] ; l += H . x + "," + H . y + " " } e . setAttribute ( "points" , l ) ; break ; case "path" : A = e . pathSegList ; v = A . numberOfItems ; h . d = Array ( v ) ; for ( G = 0 ; G < v ; ++ G ) { u = A . getItem ( G ) ; h . d [ G ] = { type : u . pathSegType , x : u . x , y : u . y , x1 : u . x1 , y1 : u . y1 , x2 : u . x2 , y2 : u . y2 , r1 : u . r1 , r2 : u . r2 , angle : u . angle , largeArcFlag : u . largeArcFlag , sweepFlag : u . sweepFlag } } v = h . d . length ; G = h . d [ 0 ] ; D = P ( G . x , G . y , l ) ; h . d [ 0 ] . x = D . x ; h . d [ 0 ] . y = D . y ; for ( G = 1 ; G < v ; ++ G ) { u = h . d [ G ] ; A = u . type ; if ( A % 2 == 0 ) { H = P ( u . x != undefined ? u . x : D . x , u . y != undefined ? u . y : D . y , l ) ; A = P ( u . x1 , u . y1 , l ) ; F = P ( u . x2 , u . y2 , l ) ;
u . x = H . x ; u . y = H . y ; u . x1 = A . x ; u . y1 = A . y ; u . x2 = F . x ; u . y2 = F . y } else { u . x = l . a * u . x ; u . y = l . d * u . y ; u . x1 = l . a * u . x1 ; u . y1 = l . d * u . y1 ; u . x2 = l . a * u . x2 ; u . y2 = l . d * u . y2 } u . r1 = l . a * u . r1 ; u . r2 = l . d * u . r2 } l = "" ; v = h . d . length ; for ( G = 0 ; G < v ; ++ G ) { u = h . d [ G ] ; A = u . type ; l += Pa [ A ] ; switch ( A ) { case 13 : case 12 : l += u . x + " " ; break ; case 15 : case 14 : l += u . y + " " ; break ; case 3 : case 5 : case 19 : case 2 : case 4 : case 18 : l += u . x + "," + u . y + " " ; break ; case 7 : case 6 : l += u . x1 + "," + u . y1 + " " + u . x2 + "," + u . y2 + " " + u . x + "," + u . y + " " ; break ; case 9 : case 8 : l += u . x1 + "," + u . y1 + " " + u . x + "," + u . y + " " ; break ;
case 11 : case 10 : l += u . r1 + "," + u . r2 + " " + u . angle + " " + + u . largeArcFlag + " " + + u . sweepFlag + " " + u . x + "," + u . y + " " ; break ; case 17 : case 16 : l += u . x2 + "," + u . y2 + " " + u . x + "," + u . y + " " } } e . setAttribute ( "d" , l ) } } , ob = function ( e , h , l ) { e = T ( e ) . firstChild ; var z = Y ( e ) , v = d . createSVGTransform ( ) ; v . setTranslate ( h , l ) ; z . appendItem ( v ) ; Wa ( e ) } , Wa = this . recalculateDimensions = function ( e ) { if ( e == null ) return null ; var h = Y ( e ) ; if ( h && h . numberOfItems > 0 ) { for ( var l = h . numberOfItems ; l -- ; ) { var z = h . getItem ( l ) ; if ( z . type === 0 ) h . removeItem ( l ) ; else if ( z . type ===
1 ) svgedit . math . isIdentity ( z . matrix ) && h . removeItem ( l ) ; else z . type === 4 && z . angle === 0 && h . removeItem ( l ) } if ( h . numberOfItems === 1 && oa ( e ) ) return null } if ( ! h || h . numberOfItems == 0 ) { e . removeAttribute ( "transform" ) ; return null } if ( h ) { l = h . numberOfItems ; for ( var v = [ ] ; l -- ; ) { z = h . getItem ( l ) ; if ( z . type === 1 ) v . push ( [ z . matrix , l ] ) ; else if ( v . length ) v = [ ] } if ( v . length === 2 ) { l = d . createSVGTransformFromMatrix ( ia ( v [ 1 ] [ 0 ] , v [ 0 ] [ 0 ] ) ) ; h . removeItem ( v [ 0 ] [ 1 ] ) ; h . removeItem ( v [ 1 ] [ 1 ] ) ; h . insertItemBefore ( l , v [ 1 ] [ 1 ] ) } l = h . numberOfItems ; if ( l >= 2 && h . getItem ( l -
2 ) . type === 1 && h . getItem ( l - 1 ) . type === 2 ) { v = d . createSVGTransform ( ) ; z = ia ( h . getItem ( l - 2 ) . matrix , h . getItem ( l - 1 ) . matrix ) ; v . setMatrix ( z ) ; h . removeItem ( l - 2 ) ; h . removeItem ( l - 2 ) ; h . appendItem ( v ) } } switch ( e . 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 = $ ( e ) . data ( "gsvg" ) ; l = new Ba ( "Transform" ) ; var A = { } , u = null ; z = [ ] ; switch ( e . tagName ) { case "line" : z = [ "x1" , "y1" ,
"x2" , "y2" ] ; break ; case "circle" : z = [ "cx" , "cy" , "r" ] ; break ; case "ellipse" : z = [ "cx" , "cy" , "rx" , "ry" ] ; break ; case "foreignObject" : case "rect" : case "image" : z = [ "width" , "height" , "x" , "y" ] ; break ; case "use" : case "text" : case "tspan" : z = [ "x" , "y" ] ; break ; case "polygon" : case "polyline" : u = { } ; u . points = e . getAttribute ( "points" ) ; v = e . points ; var F = v . numberOfItems ; A . points = Array ( F ) ; for ( var H = 0 ; H < F ; ++ H ) { var D = v . getItem ( H ) ; A . points [ H ] = { x : D . x , y : D . y } } break ; case "path" : u = { } ; u . d = e . getAttribute ( "d" ) ; A . d = e . getAttribute ( "d" ) } if ( z . length ) { A =
$ ( e ) . attr ( z ) ; $ . each ( A , function ( Aa , ha ) { A [ Aa ] = ta ( Aa , ha ) } ) } else if ( G ) A = { x : $ ( G ) . attr ( "x" ) || 0 , y : $ ( G ) . attr ( "y" ) || 0 } ; if ( u == null ) { u = $ . extend ( true , { } , A ) ; $ . each ( u , function ( Aa , ha ) { u [ Aa ] = ta ( Aa , ha ) } ) } u . transform = Ta ? Ta : "" ; if ( e . tagName == "g" && ! G || e . tagName == "a" ) { v = svgedit . utilities . getBBox ( e ) ; var E = { x : v . x + v . width / 2 , y : v . y + v . height / 2 } , L = P ( v . x + v . width / 2 , v . y + v . height / 2 , ga ( h ) . matrix ) ; z = d . createSVGMatrix ( ) ; if ( v = oa ( e ) ) { H = v * Math . PI / 180 ; F = Math . abs ( H ) > 1.0 E - 10 ? Math . sin ( H ) / ( 1 - Math . cos ( H ) ) : 2 / H ; for ( H = 0 ; H < h . numberOfItems ; ++ H ) { z =
h . getItem ( H ) ; if ( z . type == 4 ) { z = z . matrix ; E . y = ( F * z . e + z . f ) / 2 ; E . x = ( z . e - F * z . f ) / 2 ; h . removeItem ( H ) ; break } } } H = z = G = 0 ; var N = h . numberOfItems ; if ( N ) var n = h . getItem ( 0 ) . matrix ; if ( N >= 3 && h . getItem ( N - 2 ) . type == 3 && h . getItem ( N - 3 ) . type == 2 && h . getItem ( N - 1 ) . type == 2 ) { H = 3 ; var w = h . getItem ( N - 3 ) . matrix , C = h . getItem ( N - 2 ) . matrix , K = h . getItem ( N - 1 ) . matrix ; F = e . childNodes ; for ( D = F . length ; D -- ; ) { var R = F . item ( D ) ; z = G = 0 ; if ( R . nodeType == 1 ) { var Q = Y ( R ) ; if ( Q ) { z = ga ( Q ) . matrix ; G = oa ( R ) ; var V = Ta , aa = [ ] ; Ta = R . getAttribute ( "transform" ) ; if ( G || qa ( Q ) ) { var fa =
d . createSVGTransform ( ) ; fa . setMatrix ( ia ( w , C , K , z ) ) ; Q . clear ( ) ; Q . appendItem ( fa ) ; aa . push ( fa ) } else { G = ia ( z . inverse ( ) , K , z ) ; fa = d . createSVGMatrix ( ) ; fa . e = - G . e ; fa . f = - G . f ; z = ia ( fa . inverse ( ) , z . inverse ( ) , w , C , K , z , G . inverse ( ) ) ; var pa = d . createSVGTransform ( ) , sa = d . createSVGTransform ( ) , Za = d . createSVGTransform ( ) ; pa . setTranslate ( G . e , G . f ) ; sa . setScale ( z . a , z . d ) ; Za . setTranslate ( fa . e , fa . f ) ; Q . appendItem ( Za ) ; Q . appendItem ( sa ) ; Q . appendItem ( pa ) ; aa . push ( Za ) ; aa . push ( sa ) ; aa . push ( pa ) } l . addSubCommand ( Wa ( R ) ) ; Ta = V } } } h . removeItem ( N - 1 ) ; h . removeItem ( N -
2 ) ; h . removeItem ( N - 3 ) } else if ( N >= 3 && h . getItem ( N - 1 ) . type == 1 ) { H = 3 ; z = ga ( h ) . matrix ; fa = d . createSVGTransform ( ) ; fa . setMatrix ( z ) ; h . clear ( ) ; h . appendItem ( fa ) } else if ( ( N == 1 || N > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { H = 2 ; G = ga ( h ) . matrix ; h . removeItem ( 0 ) ; z = ga ( h ) . matrix . inverse ( ) ; z = ia ( z , G ) ; G = z . e ; z = z . f ; if ( G != 0 || z != 0 ) { F = e . childNodes ; D = F . length ; for ( N = [ ] ; D -- ; ) { R = F . item ( D ) ; if ( R . nodeType == 1 ) { if ( R . getAttribute ( "clip-path" ) ) { V = R . getAttribute ( "clip-path" ) ; if ( N . indexOf ( V ) === - 1 ) { ob ( V , G , z ) ; N . push ( V ) } } V = Ta ; Ta = R . getAttribute ( "transform" ) ;
if ( Q = Y ( R ) ) { w = d . createSVGTransform ( ) ; w . setTranslate ( G , z ) ; Q . numberOfItems ? Q . insertItemBefore ( w , 0 ) : Q . appendItem ( w ) ; l . addSubCommand ( Wa ( R ) ) ; Q = e . getElementsByTagNameNS ( c , "use" ) ; R = "#" + R . id ; for ( w = Q . length ; w -- ; ) { C = Q . item ( w ) ; if ( R == da ( C ) ) { K = d . createSVGTransform ( ) ; K . setTranslate ( - G , - z ) ; Y ( C ) . insertItemBefore ( K , 0 ) ; l . addSubCommand ( Wa ( C ) ) } } Ta = V } } } N = [ ] ; Ta = V } } else if ( N == 1 && h . getItem ( 0 ) . type == 1 && ! v ) { H = 1 ; z = h . getItem ( 0 ) . matrix ; F = e . childNodes ; for ( D = F . length ; D -- ; ) { R = F . item ( D ) ; if ( R . nodeType == 1 ) { V = Ta ; Ta = R . getAttribute ( "transform" ) ;
if ( Q = Y ( R ) ) { G = ia ( z , ga ( Q ) . matrix ) ; N = d . createSVGTransform ( ) ; N . setMatrix ( G ) ; Q . clear ( ) ; Q . appendItem ( N , 0 ) ; l . addSubCommand ( Wa ( R ) ) ; Ta = V ; V = R . getAttribute ( "stroke-width" ) ; R . getAttribute ( "stroke" ) !== "none" && ! isNaN ( V ) && R . setAttribute ( "stroke-width" , V * ( ( Math . abs ( G . a ) + Math . abs ( G . d ) ) / 2 ) ) } } } h . clear ( ) } else { if ( v ) { E = d . createSVGTransform ( ) ; E . setRotate ( v , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( H == 2 ) { if ( v ) { L = { x : E . x + n . e , y : E . y + n . f } ;
E = d . createSVGTransform ( ) ; E . setRotate ( v , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } else if ( H == 3 ) { z = ga ( h ) . matrix ; n = d . createSVGTransform ( ) ; n . setRotate ( v , E . x , E . y ) ; n = n . matrix ; E = d . createSVGTransform ( ) ; E . setRotate ( v , L . x , L . y ) ; L = E . matrix . inverse ( ) ; V = z . inverse ( ) ; L = ia ( V , L , n , z ) ; G = L . e ; z = L . f ; if ( G != 0 || z != 0 ) { F = e . childNodes ; for ( D = F . length ; D -- ; ) { R = F . item ( D ) ; if ( R . nodeType == 1 ) { V = Ta ; Ta = R . getAttribute ( "transform" ) ; Q = Y ( R ) ; w = d . createSVGTransform ( ) ; w . setTranslate ( G , z ) ; Q . numberOfItems ? Q . insertItemBefore ( w ,
0 ) : Q . appendItem ( w ) ; l . addSubCommand ( Wa ( R ) ) ; Ta = V } } } if ( v ) h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } else { v = svgedit . utilities . getBBox ( e ) ; if ( ! v && e . tagName != "path" ) return null ; z = d . createSVGMatrix ( ) ; if ( G = oa ( e ) ) { E = { x : v . x + v . width / 2 , y : v . y + v . height / 2 } ; L = P ( v . x + v . width / 2 , v . y + v . height / 2 , ga ( h ) . matrix ) ; H = G * Math . PI / 180 ; F = Math . abs ( H ) > 1.0 E - 10 ? Math . sin ( H ) / ( 1 - Math . cos ( H ) ) : 2 / H ; for ( H = 0 ; H < h . numberOfItems ; ++ H ) { z = h . getItem ( H ) ; if ( z . type == 4 ) { z = z . matrix ; E . y = ( F * z . e + z . f ) / 2 ; E . x = ( z . e - F * z . f ) / 2 ; h . removeItem ( H ) ; break } } } H =
0 ; N = h . numberOfItems ; if ( ! svgedit . browser . isWebkit ( ) ) if ( ( n = e . getAttribute ( "fill" ) ) && n . indexOf ( "url(" ) === 0 ) { n = T ( n ) ; V = "pattern" ; if ( n . tagName !== V ) V = "gradient" ; if ( n . getAttribute ( V + "Units" ) === "userSpaceOnUse" ) { z = ga ( h ) . matrix ; v = Y ( n ) ; v = ga ( v ) . matrix ; z = ia ( z , v ) ; v = "matrix(" + [ z . a , z . b , z . c , z . d , z . e , z . f ] . join ( "," ) + ")" ; n . setAttribute ( V + "Transform" , v ) } } if ( N >= 3 && h . getItem ( N - 2 ) . type == 3 && h . getItem ( N - 3 ) . type == 2 && h . getItem ( N - 1 ) . type == 2 ) { H = 3 ; z = ga ( h , N - 3 , N - 1 ) . matrix ; h . removeItem ( N - 1 ) ; h . removeItem ( N - 2 ) ; h . removeItem ( N - 3 ) } else if ( N ==
4 && h . getItem ( N - 1 ) . type == 1 ) { H = 3 ; z = ga ( h ) . matrix ; fa = d . createSVGTransform ( ) ; fa . setMatrix ( z ) ; h . clear ( ) ; h . appendItem ( fa ) ; z = d . createSVGMatrix ( ) } else if ( ( N == 1 || N > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { H = 2 ; n = h . getItem ( 0 ) . matrix ; V = ga ( h , 1 ) . matrix ; v = V . inverse ( ) ; z = ia ( v , n , V ) ; h . removeItem ( 0 ) } else if ( N == 1 && h . getItem ( 0 ) . type == 1 && ! G ) { z = ga ( h ) . matrix ; switch ( e . tagName ) { case "line" : A = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; case "polyline" : case "polygon" : A . points = e . getAttribute ( "points" ) ; if ( A . points ) { v = e . points ; F = v . numberOfItems ;
A . points = Array ( F ) ; for ( H = 0 ; H < F ; ++ H ) { D = v . getItem ( H ) ; A . points [ H ] = { x : D . x , y : D . y } } } case "path" : A . d = e . getAttribute ( "d" ) ; H = 1 ; h . clear ( ) } } else { H = 4 ; if ( G ) { E = d . createSVGTransform ( ) ; E . setRotate ( G , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( H == 1 || H == 2 || H == 3 ) fb ( e , A , z ) ; if ( H == 2 ) { if ( G ) { qa ( h ) || ( L = { x : E . x + z . e , y : E . y + z . f } ) ; E = d . createSVGTransform ( ) ; E . setRotate ( G , L . x , L . y ) ; h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } else if ( H ==
3 && G ) { z = ga ( h ) . matrix ; n = d . createSVGTransform ( ) ; n . setRotate ( G , E . x , E . y ) ; n = n . matrix ; E = d . createSVGTransform ( ) ; E . setRotate ( G , L . x , L . y ) ; L = E . matrix . inverse ( ) ; V = z . inverse ( ) ; L = ia ( V , L , n , z ) ; fb ( e , A , L ) ; if ( G ) h . numberOfItems ? h . insertItemBefore ( E , 0 ) : h . appendItem ( E ) } } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; l . addSubCommand ( new Oa ( e , u ) ) ; return l } , sb = null , Qa = this . clearSelection = function ( e ) { if ( I [ 0 ] != null ) for ( var h = I . length , l = 0 ; l < h ; ++ l ) { var z = I [ l ] ; if ( z == null ) break ; Ia . releaseSelector ( z ) ; I [ l ] = null } e || O ( "selected" ,
I ) } , wb = this . addToSelection = function ( e , h ) { if ( e . length != 0 ) { for ( var l = 0 ; l < I . length ; ) { if ( I [ l ] == null ) break ; ++ l } for ( var z = e . length ; z -- ; ) { var v = e [ z ] ; if ( v && svgedit . utilities . getBBox ( v ) ) { if ( v . tagName === "a" && v . childNodes . length === 1 ) v = v . firstChild ; if ( I . indexOf ( v ) == - 1 ) { I [ l ] = v ; l ++ ; v = Ia . requestSelector ( v ) ; I . length > 1 && v . showGrips ( false ) } } } O ( "selected" , I ) ; h || I . length == 1 ? Ia . requestSelector ( I [ 0 ] ) . showGrips ( true ) : Ia . requestSelector ( I [ 0 ] ) . showGrips ( false ) ; for ( I . sort ( function ( G , A ) { if ( G && A && G . compareDocumentPosition ) return 3 -
( A . compareDocumentPosition ( G ) & 6 ) ; else if ( G == null ) return 1 } ) ; I [ 0 ] == null ; ) I . shift ( 0 ) } } , Bb = this . selectOnly = function ( e , h ) { Qa ( true ) ; wb ( e , h ) } ; this . removeFromSelection = function ( e ) { if ( I [ 0 ] != null ) if ( e . length != 0 ) { var h = Array ( I . length ) ; j = 0 ; len = I . length ; for ( var l = 0 ; l < len ; ++ l ) { var z = I [ l ] ; if ( z ) if ( e . indexOf ( z ) == - 1 ) { h [ j ] = z ; j ++ } else Ia . releaseSelector ( z ) } I = h } } ; this . selectAllInCurrentLayer = function ( ) { var e = B ( ) . getCurrentLayer ( ) ; if ( e ) { Fa = "select" ; Bb ( $ ( J || e ) . children ( ) ) } } ; var Kb = this . getMouseTarget = function ( e ) { if ( e ==
null ) return null ; e = e . target ; if ( e . correspondingUseElement ) e = e . correspondingUseElement ; if ( [ "http://www.w3.org/1998/Math/MathML" , "http://www.w3.org/1999/xhtml" ] . indexOf ( e . namespaceURI ) >= 0 && e . id != "svgcanvas" ) for ( ; e . nodeName != "foreignObject" ; ) { e = e . parentNode ; if ( ! e ) return d } var h = B ( ) . getCurrentLayer ( ) ; if ( [ d , a , k , h ] . indexOf ( e ) >= 0 ) return d ; if ( $ ( e ) . closest ( "#selectorParentGroup" ) . length ) return Ia . selectorParentGroup ; for ( ; e . parentNode !== ( J || h ) ; ) e = e . parentNode ; return e } ; ( function ( ) { var e = null , h = null , l = null , z =
null , v = null , G = { } , A = { minx : null , miny : null , maxx : null , maxy : null } ; $ ( a ) . mousedown ( function ( u ) { if ( ! ( u . originalEvent . touches && u . originalEvent . touches > 1 ) ) { var F = u . button === 2 ; sb = k . getScreenCTM ( ) . inverse ( ) ; var H = P ( u . pageX , u . pageY , sb ) , D = H . x * o ; H = H . y * o ; u . preventDefault ( ) ; if ( F ) Fa = "select" ; D = D / o ; H = H / o ; var E = Kb ( u ) ; if ( E . tagName === "a" && E . childNodes . length === 1 ) E = E . firstChild ; var L = z = h = D , N = v = l = H ; if ( m . gridSnapping ) { D = xa ( D ) ; H = xa ( H ) ; h = xa ( h ) ; l = xa ( l ) } if ( E == Ia . selectorParentGroup && I [ 0 ] != null ) { E = u . target ; var n = jb ( E , "type" ) ;
if ( n == "rotate" ) { Fa = "rotate" ; current _rotate _mode = jb ( E , "dir" ) } else if ( n == "resize" ) { Fa = "resize" ; lb = jb ( E , "dir" ) } E = I [ 0 ] } Ta = E . getAttribute ( "transform" ) ; n = Y ( E ) ; switch ( Fa ) { case "select" : Ma = true ; lb = "none" ; if ( F ) Ma = false ; if ( E != d ) { if ( I . indexOf ( E ) == - 1 ) { u . shiftKey || Qa ( true ) ; wb ( [ E ] ) ; Cb = E ; Ka . clear ( ) } if ( ! F ) for ( F = 0 ; F < I . length ; ++ F ) if ( I [ F ] != null ) { var w = Y ( I [ F ] ) ; w . numberOfItems ? w . insertItemBefore ( d . createSVGTransform ( ) , 0 ) : w . appendItem ( d . createSVGTransform ( ) ) } } else if ( ! F ) { Qa ( ) ; Fa = "multiselect" ; if ( ua == null ) ua = Ia . getRubberBandBox ( ) ;
z *= o ; v *= o ; ma ( ua , { x : z , y : v , width : 0 , height : 0 , display : "inline" } , 100 ) } break ; case "zoom" : Ma = true ; if ( ua == null ) ua = Ia . getRubberBandBox ( ) ; ma ( ua , { x : L * o , y : L * o , width : 0 , height : 0 , display : "inline" } , 100 ) ; break ; case "resize" : Ma = true ; h = D ; l = H ; G = svgedit . utilities . getBBox ( $ ( "#selectedBox0" ) [ 0 ] ) ; var C = { } ; $ . each ( G , function ( K , R ) { C [ K ] = R / o } ) ; G = C ; F = oa ( E ) ? 1 : 0 ; if ( qa ( n ) ) { n . insertItemBefore ( d . createSVGTransform ( ) , F ) ; n . insertItemBefore ( d . createSVGTransform ( ) , F ) ; n . insertItemBefore ( d . createSVGTransform ( ) , F ) } else { n . appendItem ( d . createSVGTransform ( ) ) ;
n . appendItem ( d . createSVGTransform ( ) ) ; n . appendItem ( d . createSVGTransform ( ) ) ; if ( svgedit . browser . supportsNonScalingStroke ( ) ) { if ( D = svgedit . browser . isChrome ( ) ) w = function ( K ) { var R = K . getAttributeNS ( null , "stroke" ) ; K . removeAttributeNS ( null , "stroke" ) ; setTimeout ( function ( ) { K . setAttributeNS ( null , "stroke" , R ) } , 1 ) } ; E . style . vectorEffect = "non-scaling-stroke" ; D && w ( E ) ; H = E . getElementsByTagName ( "*" ) ; L = H . length ; for ( F = 0 ; F < L ; F ++ ) { H [ F ] . style . vectorEffect = "non-scaling-stroke" ; D && w ( H [ F ] ) } } } break ; case "fhellipse" : case "fhrect" : case "fhpath" : Ma =
true ; e = L + "," + N + " " ; w = M . stroke _width == 0 ? 1 : M . stroke _width ; S ( { element : "polyline" , curStyles : true , attr : { points : e , id : ja ( ) , fill : "none" , opacity : M . opacity / 2 , "stroke-linecap" : "round" , style : "pointer-events:none" } } ) ; A . minx = L ; A . maxx = L ; A . miny = N ; A . maxy = N ; break ; case "image" : Ma = true ; w = S ( { element : "image" , attr : { x : D , y : H , width : 0 , height : 0 , id : ja ( ) , opacity : M . opacity / 2 , style : "pointer-events:inherit" } } ) ; X ( w , Ea ) ; qb ( w ) ; break ; case "square" : case "rect" : Ma = true ; h = D ; l = H ; S ( { element : "rect" , curStyles : true , attr : { x : D , y : H , width : 0 , height : 0 ,
id : ja ( ) , opacity : M . opacity / 2 } } ) ; break ; case "line" : Ma = true ; w = M . stroke _width == 0 ? 1 : M . stroke _width ; S ( { element : "line" , curStyles : true , attr : { x1 : D , y1 : H , x2 : D , y2 : H , id : ja ( ) , stroke : M . stroke , "stroke-width" : w , "stroke-dasharray" : M . stroke _dasharray , "stroke-linejoin" : M . stroke _linejoin , "stroke-linecap" : M . stroke _linecap , "stroke-opacity" : M . stroke _opacity , fill : "none" , opacity : M . opacity / 2 , style : "pointer-events:none" } } ) ; break ; case "circle" : Ma = true ; S ( { element : "circle" , curStyles : true , attr : { cx : D , cy : H , r : 0 , id : ja ( ) , opacity : M . opacity /
2 } } ) ; break ; case "ellipse" : Ma = true ; S ( { element : "ellipse" , curStyles : true , attr : { cx : D , cy : H , rx : 0 , ry : 0 , id : ja ( ) , opacity : M . opacity / 2 } } ) ; break ; case "text" : Ma = true ; S ( { element : "text" , curStyles : true , attr : { x : D , y : H , id : ja ( ) , fill : Ya . fill , "stroke-width" : Ya . stroke _width , "font-size" : Ya . font _size , "font-family" : Ya . font _family , "text-anchor" : "left" , "xml:space" : "preserve" , opacity : M . opacity } } ) ; break ; case "path" : case "pathedit" : h *= o ; l *= o ; Ka . mouseDown ( u , E , h , l ) ; Ma = true ; break ; case "textedit" : h *= o ; l *= o ; ib . mouseDown ( u , E , h , l ) ; Ma =
true ; break ; case "rotate" : Ma = true ; b . undoMgr . beginUndoableChange ( "transform" , I ) ; document . getElementById ( "workarea" ) . className = "rotate" } w = pb ( "mouseDown" , { event : u , start _x : h , start _y : l , selectedElements : I } , true ) ; $ . each ( w , function ( K , R ) { if ( R && R . started ) Ma = true } ) ; if ( Fa ) document . getElementById ( "workarea" ) . className = Fa == "resize" ? u . target . style . cursor : Fa } } ) . mousemove ( function ( u ) { if ( ! ( u . originalEvent . touches && u . originalEvent . touches . length > 1 ) ) if ( Ma ) if ( ! ( u . button === 1 || b . spaceKey ) ) { var F = I [ 0 ] , H = P ( u . pageX , u . pageY ,
sb ) , D = H . x * o ; H = H . y * o ; var E = ra ( ca ( ) ) , L = x = D / o , N = y = H / o ; if ( m . gridSnapping ) { x = xa ( x ) ; y = xa ( y ) } u . preventDefault ( ) ; switch ( Fa ) { case "select" : if ( I [ 0 ] !== null ) { L = x - h ; var n = y - l ; if ( m . gridSnapping ) { L = xa ( L ) ; n = xa ( n ) } if ( u . shiftKey ) { var w = ba ( h , l , x , y ) ; x = w . x ; y = w . y } if ( L != 0 || n != 0 ) { w = I . length ; for ( N = 0 ; N < w ; ++ N ) { F = I [ N ] ; if ( F == null ) break ; var C = d . createSVGTransform ( ) ; E = Y ( F ) ; C . setTranslate ( L , n ) ; E . numberOfItems ? E . replaceItem ( C , 0 ) : E . appendItem ( C ) ; Ia . requestSelector ( F ) . resize ( ) } if ( u . altKey ) if ( ! b . addClone ) { b . addClone = b . cloneSelectedElements ( 0 ,
0 , C ) ; b . removeClone = function ( ) { if ( parent = b . addClone . parentNode ) { parent . removeChild ( b . addClone ) ; b . addClone = false } } ; window . addEventListener ( "keyup" , b . removeClone ) } O ( "transition" , I ) } } break ; case "multiselect" : L *= o ; N *= o ; ma ( ua , { x : Math . min ( z , L ) , y : Math . min ( v , N ) , width : Math . abs ( L - z ) , height : Math . abs ( N - v ) } , 100 ) ; E = [ ] ; L = [ ] ; C = ub ( ) ; w = I . length ; for ( N = 0 ; N < w ; ++ N ) { n = C . indexOf ( I [ N ] ) ; if ( n == - 1 ) E . push ( I [ N ] ) ; else C [ n ] = null } w = C . length ; for ( N = 0 ; N < w ; ++ N ) C [ N ] && L . push ( C [ N ] ) ; E . length > 0 && b . removeFromSelection ( E ) ; L . length > 0 && wb ( L ) ;
break ; case "resize" : E = Y ( F ) ; L = ( C = qa ( E ) ) ? G : svgedit . utilities . getBBox ( F ) ; w = L . x ; N = L . y ; var K = L . width , R = L . height ; L = x - h ; n = y - l ; if ( m . gridSnapping ) { L = xa ( L ) ; n = xa ( n ) ; R = xa ( R ) ; K = xa ( K ) } var Q = oa ( F ) ; if ( Q ) { var V = Math . sqrt ( L * L + n * n ) ; n = Math . atan2 ( n , L ) - Q * Math . PI / 180 ; L = V * Math . cos ( n ) ; n = V * Math . sin ( n ) } if ( lb . indexOf ( "n" ) == - 1 && lb . indexOf ( "s" ) == - 1 ) n = 0 ; if ( lb . indexOf ( "e" ) == - 1 && lb . indexOf ( "w" ) == - 1 ) L = 0 ; var aa = V = 0 , fa = R ? ( R + n ) / R : 1 , pa = K ? ( K + L ) / K : 1 ; if ( lb . indexOf ( "n" ) >= 0 ) { fa = R ? ( R - n ) / R : 1 ; aa = R } if ( lb . indexOf ( "w" ) >= 0 ) { pa = K ? ( K - L ) / K : 1 ; V = K } L =
d . createSVGTransform ( ) ; n = d . createSVGTransform ( ) ; K = d . createSVGTransform ( ) ; if ( m . gridSnapping ) { w = xa ( w ) ; V = xa ( V ) ; N = xa ( N ) ; aa = xa ( aa ) } L . setTranslate ( - ( w + V ) , - ( N + aa ) ) ; if ( u . shiftKey ) if ( pa == 1 ) pa = fa ; else fa = pa ; n . setScale ( pa , fa ) ; K . setTranslate ( w + V , N + aa ) ; if ( C ) { C = Q ? 1 : 0 ; E . replaceItem ( L , 2 + C ) ; E . replaceItem ( n , 1 + C ) ; E . replaceItem ( K , 0 + C ) } else { C = E . numberOfItems ; E . replaceItem ( K , C - 3 ) ; E . replaceItem ( n , C - 2 ) ; E . replaceItem ( L , C - 1 ) } Ia . requestSelector ( F ) . resize ( ) ; O ( "transition" , I ) ; break ; case "zoom" : L *= o ; N *= o ; ma ( ua , { x : Math . min ( z * o ,
L ) , y : Math . min ( v * o , N ) , width : Math . abs ( L - z * o ) , height : Math . abs ( N - v * o ) } , 100 ) ; break ; case "text" : ma ( E , { x : x , y : y } , 1E3 ) ; break ; case "line" : L = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( m . gridSnapping ) { x = xa ( x ) ; y = xa ( y ) } C = x ; w = y ; if ( u . shiftKey ) { w = ba ( h , l , C , w ) ; C = w . x ; w = w . y } E . setAttributeNS ( null , "x2" , C ) ; E . setAttributeNS ( null , "y2" , w ) ; window . opera || d . unsuspendRedraw ( L ) ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : L = Math . abs ( x - h ) ; C = Math . abs ( y - l ) ; if ( Fa == "square" || u . shiftKey ) { L = C = Math . max ( L , C ) ; w = h < x ? h :
h - L ; N = l < y ? l : l - C } else { w = Math . min ( h , x ) ; N = Math . min ( l , y ) } if ( u . altKey ) { L *= 2 ; C *= 2 ; w = h - L / 2 ; N = l - C / 2 } if ( m . gridSnapping ) { L = xa ( L ) ; C = xa ( C ) ; w = xa ( w ) ; N = xa ( N ) } ma ( E , { width : L , height : C , x : w , y : N } , 1E3 ) ; break ; case "circle" : L = $ ( E ) . attr ( [ "cx" , "cy" ] ) ; C = L . cx ; w = L . cy ; L = Math . sqrt ( ( x - C ) * ( x - C ) + ( y - w ) * ( y - w ) ) ; if ( m . gridSnapping ) L = xa ( L ) ; E . setAttributeNS ( null , "r" , L ) ; break ; case "ellipse" : L = $ ( E ) . attr ( [ "cx" , "cy" ] ) ; C = Math . abs ( h + ( x - h ) / 2 ) ; w = Math . abs ( l + ( y - l ) / 2 ) ; L = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( m . gridSnapping ) { x = xa ( x ) ; C = xa ( C ) ; y = xa ( y ) ;
w = xa ( w ) } N = Math . abs ( h - C ) ; n = Math . abs ( l - w ) ; if ( u . shiftKey ) { n = N ; w = y > l ? l + N : l - N } if ( u . altKey ) { C = h ; w = l ; N = Math . abs ( x - C ) ; n = u . shiftKey ? N : Math . abs ( y - w ) } E . setAttributeNS ( null , "rx" , N ) ; E . setAttributeNS ( null , "ry" , n ) ; E . setAttributeNS ( null , "cx" , C ) ; E . setAttributeNS ( null , "cy" , w ) ; window . opera || d . unsuspendRedraw ( L ) ; break ; case "fhellipse" : case "fhrect" : A . minx = Math . min ( L , A . minx ) ; A . maxx = Math . max ( L , A . maxx ) ; A . miny = Math . min ( N , A . miny ) ; A . maxy = Math . max ( N , A . maxy ) ; case "fhpath" : e += + L + "," + N + " " ; E . setAttributeNS ( null , "points" , e ) ; break ;
case "path" : case "pathedit" : x *= o ; y *= o ; if ( m . gridSnapping ) { x = xa ( x ) ; y = xa ( y ) ; h = xa ( h ) ; l = xa ( l ) } if ( u . shiftKey ) { if ( C = svgedit . path . path ) { E = C . dragging ? C . dragging [ 0 ] : h ; C = C . dragging ? C . dragging [ 1 ] : l } else { E = h ; C = l } w = ba ( E , C , x , y ) ; x = w . x ; y = w . y } if ( ua && ua . getAttribute ( "display" ) !== "none" ) { L *= o ; N *= o ; ma ( ua , { x : Math . min ( z * o , L ) , y : Math . min ( v * o , N ) , width : Math . abs ( L - z * o ) , height : Math . abs ( N - v * o ) } , 100 ) } Ka . mouseMove ( u , x , y ) ; break ; case "textedit" : x *= o ; y *= o ; ib . mouseMove ( D , H ) ; break ; case "rotate" : L = svgedit . utilities . getBBox ( F ) ; C = L . x + L . width /
2 ; w = L . y + L . height / 2 ; E = W ( F ) ; E = P ( C , w , E ) ; C = E . x ; w = E . y ; E = L . x ; N = L . y ; if ( current _rotate _mode == "nw" ) E = L . x + L . width ; if ( current _rotate _mode == "se" ) N = L . y + L . height ; if ( current _rotate _mode == "sw" ) { E = L . x + L . width ; N = L . y + L . height } compensation _angle = ( Math . atan2 ( w - N , C - E ) * ( 180 / Math . PI ) - 90 ) % 360 ; Q = ( Math . atan2 ( w - y , C - x ) * ( 180 / Math . PI ) - 90 ) % 360 ; Q += compensation _angle ; if ( m . gridSnapping ) Q = xa ( Q ) ; if ( u . shiftKey ) Q = Math . round ( Q / 45 ) * 45 ; b . setRotationAngle ( Q < - 180 ? 360 + Q : Q , true ) ; O ( "transition" , I ) } pb ( "mouseMove" , { event : u , mouse _x : D , mouse _y : H , selected : F } ) } } ) . click ( function ( u ) { u . preventDefault ( ) ;
return false } ) . dblclick ( function ( u ) { var F = u . target . parentNode ; if ( F !== J ) { var H = Kb ( u ) , D = H . tagName ; if ( D === "text" && Fa !== "textedit" ) { u = P ( u . pageX , u . pageY , sb ) ; ib . select ( H , u . x , u . y ) } if ( ( D === "g" || D === "a" ) && oa ( H ) ) { Ib ( H ) ; H = I [ 0 ] ; Qa ( true ) } J && Lb ( ) ; F . tagName !== "g" && F . tagName !== "a" || F === B ( ) . getCurrentLayer ( ) || H === Ia . selectorParentGroup || Sb ( H ) } } ) . mouseup ( function ( u ) { b . addClone = false ; window . removeEventListener ( "keyup" , b . removeClone ) ; if ( u . button !== 2 ) { var F = Cb ; Cb = null ; if ( Ma ) { var H = P ( u . pageX , u . pageY , sb ) , D = H . x * o ; H = H . y *
o ; var E = D / o , L = H / o , N = ra ( ca ( ) ) , n = false ; Ma = false ; switch ( Fa ) { case "resize" : case "multiselect" : if ( ua != null ) { ua . setAttribute ( "display" , "none" ) ; nb = [ ] } Fa = "select" ; case "select" : if ( I [ 0 ] != null ) { if ( I [ 1 ] == null ) { D = I [ 0 ] ; switch ( D . tagName ) { case "g" : case "use" : case "image" : case "foreignObject" : break ; default : bb . fill = D . getAttribute ( "fill" ) ; bb . fill _opacity = D . getAttribute ( "fill-opacity" ) ; bb . stroke = D . getAttribute ( "stroke" ) ; bb . stroke _opacity = D . getAttribute ( "stroke-opacity" ) ; bb . stroke _width = D . getAttribute ( "stroke-width" ) ;
bb . stroke _dasharray = D . getAttribute ( "stroke-dasharray" ) ; bb . stroke _linejoin = D . getAttribute ( "stroke-linejoin" ) ; bb . stroke _linecap = D . getAttribute ( "stroke-linecap" ) } if ( D . tagName == "text" ) { Ya . font _size = D . getAttribute ( "font-size" ) ; Ya . font _family = D . getAttribute ( "font-family" ) } Ia . requestSelector ( D ) . showGrips ( true ) } Ha ( ) ; if ( E != z || L != v ) { u = I . length ; for ( D = 0 ; D < u ; ++ D ) { if ( I [ D ] == null ) break ; I [ D ] . firstChild || Ia . requestSelector ( I [ D ] ) . resize ( ) } } else { D = u . target ; if ( I [ 0 ] . nodeName === "path" && I [ 1 ] == null ) Ka . select ( I [ 0 ] ) ; else u . shiftKey &&
F != D && b . removeFromSelection ( [ D ] ) } if ( svgedit . browser . supportsNonScalingStroke ( ) ) if ( u = I [ 0 ] ) { u . removeAttribute ( "style" ) ; svgedit . utilities . walkTree ( u , function ( K ) { K . removeAttribute ( "style" ) } ) } } return ; case "zoom" : ua != null && ua . setAttribute ( "display" , "none" ) ; O ( "zoomed" , { x : Math . min ( z , E ) , y : Math . min ( v , L ) , width : Math . abs ( E - z ) , height : Math . abs ( L - v ) , factor : u . altKey ? 0.5 : 2 } ) ; return ; case "fhpath" : F = N . getAttribute ( "points" ) ; E = F . indexOf ( "," ) ; if ( n = E >= 0 ? F . indexOf ( "," , E + 1 ) >= 0 : F . indexOf ( " " , F . indexOf ( " " ) + 1 ) >= 0 ) N = Ka . smoothPolylineIntoPath ( N ) ;
break ; case "line" : F = $ ( N ) . attr ( [ "x1" , "x2" , "y1" , "y2" ] ) ; n = F . x1 != F . x2 || F . y1 != F . y2 ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : F = $ ( N ) . attr ( [ "width" , "height" ] ) ; n = F . width != 0 || F . height != 0 || Fa === "image" ; break ; case "circle" : n = N . getAttribute ( "r" ) != 0 ; break ; case "ellipse" : F = $ ( N ) . attr ( [ "rx" , "ry" ] ) ; n = F . rx != null || F . ry != null ; break ; case "fhellipse" : if ( A . maxx - A . minx > 0 && A . maxy - A . miny > 0 ) { N = S ( { element : "ellipse" , curStyles : true , attr : { cx : ( A . minx + A . maxx ) / 2 , cy : ( A . miny + A . maxy ) / 2 , rx : ( A . maxx - A . minx ) / 2 , ry : ( A . maxy -
A . miny ) / 2 , id : ca ( ) } } ) ; O ( "changed" , [ N ] ) ; n = true } break ; case "fhrect" : if ( A . maxx - A . minx > 0 && A . maxy - A . miny > 0 ) { N = S ( { element : "rect" , curStyles : true , attr : { x : A . minx , y : A . miny , width : A . maxx - A . minx , height : A . maxy - A . miny , id : ca ( ) } } ) ; O ( "changed" , [ N ] ) ; n = true } break ; case "text" : n = true ; Bb ( [ N ] ) ; ib . start ( N ) ; break ; case "path" : N = null ; Ma = true ; F = Ka . mouseUp ( u , N , D , H ) ; N = F . element ; n = F . keep ; break ; case "pathedit" : n = true ; N = null ; Ka . mouseUp ( u ) ; break ; case "textedit" : n = false ; N = null ; ib . mouseUp ( u , D , H ) ; break ; case "rotate" : n = true ; N = null ; Fa = "select" ;
F = b . undoMgr . finishUndoableChange ( ) ; F . isEmpty ( ) || za ( F ) ; Ha ( ) ; O ( "changed" , I ) } D = pb ( "mouseUp" , { event : u , mouse _x : D , mouse _y : H } , true ) ; $ . each ( D , function ( K , R ) { if ( R ) { n = R . keep || n ; N = R . element ; Ma = R . started || Ma } } ) ; if ( ! n && N != null ) { B ( ) . releaseId ( ca ( ) ) ; N . parentNode . removeChild ( N ) ; N = null ; for ( D = u . target ; D . parentNode . parentNode . tagName == "g" ; ) D = D . parentNode ; if ( ( Fa != "path" || ! drawn _path ) && D . parentNode . id != "selectorParentGroup" && D . id != "svgcanvas" && D . id != "svgroot" ) { b . setMode ( "select" ) ; Bb ( [ D ] , true ) } } else if ( N != null ) { b . addedNew =
true ; u = 0.2 ; var w ; if ( false . beginElement && N . getAttribute ( "opacity" ) != M . opacity ) { w = $ ( false ) . clone ( ) . attr ( { to : M . opacity , dur : u } ) . appendTo ( N ) ; try { w [ 0 ] . beginElement ( ) } catch ( C ) { } } else u = 0 ; setTimeout ( function ( ) { w && w . remove ( ) ; N . setAttribute ( "opacity" , M . opacity ) ; N . setAttribute ( "style" , "pointer-events:inherit" ) ; na ( N ) ; if ( Fa === "path" ) Ka . toEditMode ( N ) ; else m . selectNew && Bb ( [ N ] , true ) ; za ( new Da ( N ) ) ; O ( "changed" , [ N ] ) } , u * 1E3 ) } Ta = null } } } ) ; $ ( a ) . bind ( "mousewheel DOMMouseScroll" , function ( u ) { if ( u . shiftKey ) { u . preventDefault ( ) ;
sb = k . getScreenCTM ( ) . inverse ( ) ; var F = P ( u . pageX , u . pageY , sb ) ; F = { x : F . x , y : F . y , width : 0 , height : 0 } ; if ( u . wheelDelta ) if ( u . wheelDelta >= 120 ) F . factor = 2 ; else { if ( u . wheelDelta <= - 120 ) F . factor = 0.5 } else if ( u . detail ) if ( u . detail > 0 ) F . factor = 0.5 ; else if ( u . detail < 0 ) F . factor = 2 ; F . factor && O ( "zoomed" , F ) } } ) } ) ( ) ; var qb = function ( e ) { $ ( e ) . click ( function ( h ) { h . preventDefault ( ) } ) } , ib = b . textActions = function ( ) { function e ( Q ) { var V = H . value === "" ; $ ( H ) . focus ( ) ; if ( ! arguments . length ) if ( V ) Q = 0 ; else { if ( H . selectionEnd !== H . selectionStart ) return ;
Q = H . selectionEnd } var aa ; aa = N [ Q ] ; V || H . setSelectionRange ( Q , Q ) ; D = ra ( "text_cursor" ) ; if ( ! D ) { D = document . createElementNS ( c , "line" ) ; ma ( D , { id : "text_cursor" , stroke : "#333" , "stroke-width" : 1 } ) ; D = ra ( "selectorParentGroup" ) . appendChild ( D ) } L || ( L = setInterval ( function ( ) { var fa = D . getAttribute ( "display" ) === "none" ; D . setAttribute ( "display" , fa ? "inline" : "none" ) } , 600 ) ) ; V = G ( aa . x , n . y ) ; aa = G ( aa . x , n . y + n . height ) ; ma ( D , { x1 : V . x , y1 : V . y , x2 : aa . x , y2 : aa . y , visibility : "visible" , display : "inline" } ) ; E && E . setAttribute ( "d" , "" ) } function h ( Q , V ,
aa ) { if ( Q === V ) e ( V ) ; else { aa || H . setSelectionRange ( Q , V ) ; E = ra ( "text_selectblock" ) ; if ( ! E ) { E = document . createElementNS ( c , "path" ) ; ma ( E , { id : "text_selectblock" , fill : "green" , opacity : 0.5 , style : "pointer-events:none" } ) ; ra ( "selectorParentGroup" ) . appendChild ( E ) } Q = N [ Q ] ; var fa = N [ V ] ; D . setAttribute ( "visibility" , "hidden" ) ; V = G ( Q . x , n . y ) ; aa = G ( Q . x + ( fa . x - Q . x ) , n . y ) ; var pa = G ( Q . x , n . y + n . height ) ; Q = G ( Q . x + ( fa . x - Q . x ) , n . y + n . height ) ; ma ( E , { d : "M" + V . x + "," + V . y + " L" + aa . x + "," + aa . y + " " + Q . x + "," + Q . y + " " + pa . x + "," + pa . y + "z" , display : "inline" } ) } }
function l ( Q , V ) { var aa = d . createSVGPoint ( ) ; aa . x = Q ; aa . y = V ; if ( N . length == 1 ) return 0 ; aa = F . getCharNumAtPosition ( aa ) ; if ( aa < 0 ) { aa = N . length - 2 ; if ( Q <= N [ 0 ] . x ) aa = 0 } else if ( aa >= N . length - 2 ) aa = N . length - 2 ; var fa = N [ aa ] ; Q > fa . x + fa . width / 2 && aa ++ ; return aa } function z ( Q , V , aa ) { var fa = H . selectionStart ; Q = l ( Q , V ) ; h ( Math . min ( fa , Q ) , Math . max ( fa , Q ) , ! aa ) } function v ( Q , V ) { var aa = { x : Q , y : V } ; aa . x /= o ; aa . y /= o ; if ( w ) { var fa = P ( aa . x , aa . y , w . inverse ( ) ) ; aa . x = fa . x ; aa . y = fa . y } return aa } function G ( Q , V ) { var aa = { x : Q , y : V } ; if ( w ) { var fa = P ( aa . x , aa . y , w ) ;
aa . x = fa . x ; aa . y = fa . y } aa . x *= o ; aa . y *= o ; return aa } function A ( Q ) { h ( 0 , F . textContent . length ) ; $ ( this ) . unbind ( Q ) } function u ( Q ) { if ( R && F ) { var V = P ( Q . pageX , Q . pageY , sb ) ; V = v ( V . x * o , V . y * o ) ; V = l ( V . x , V . y ) ; var aa = F . textContent , fa = aa . substr ( 0 , V ) . replace ( /[a-z0-9]+$/i , "" ) . length ; aa = aa . substr ( V ) . match ( /^[a-z0-9]+/i ) ; h ( fa , ( aa ? aa [ 0 ] . length : 0 ) + V ) ; $ ( Q . target ) . click ( A ) ; setTimeout ( function ( ) { $ ( Q . target ) . unbind ( "click" , A ) } , 300 ) } } var F , H , D , E , L , N = [ ] , n , w , C , K , R ; return { select : function ( Q , V , aa ) { F = Q ; ib . toEditMode ( V , aa ) } , start : function ( Q ) { F =
Q ; ib . toEditMode ( ) } , mouseDown : function ( Q , V , aa , fa ) { Q = v ( aa , fa ) ; H . focus ( ) ; e ( l ( Q . x , Q . y ) ) ; C = aa ; K = fa } , mouseMove : function ( Q , V ) { if ( ! ( evt . originalEvent . touches && evt . originalEvent . touches . length > 1 ) ) { var aa = v ( Q , V ) ; z ( aa . x , aa . y ) } } , mouseUp : function ( Q , V , aa ) { var fa = v ( V , aa ) ; z ( fa . x , fa . y , true ) ; Q . target !== F && V < C + 2 && V > C - 2 && aa < K + 2 && aa > K - 2 && ib . toSelectMode ( true ) } , setCursor : e , toEditMode : function ( Q , V ) { R = false ; Fa = "textedit" ; Ia . requestSelector ( F ) . showGrips ( false ) ; Ia . requestSelector ( F ) ; ib . init ( ) ; $ ( F ) . css ( "cursor" , "text" ) ; if ( arguments . length ) { var aa =
v ( Q , V ) ; e ( l ( aa . x , aa . y ) ) } else e ( ) ; setTimeout ( function ( ) { R = true } , 300 ) } , toSelectMode : function ( Q ) { Fa = "select" ; clearInterval ( L ) ; L = null ; E && $ ( E ) . attr ( "display" , "none" ) ; D && $ ( D ) . attr ( "visibility" , "hidden" ) ; $ ( F ) . css ( "cursor" , "move" ) ; if ( Q ) { Qa ( ) ; $ ( F ) . css ( "cursor" , "move" ) ; O ( "selected" , [ F ] ) ; wb ( [ F ] , true ) } F && ! F . textContent . length && b . deleteSelectedElements ( ) ; $ ( H ) . blur ( ) ; F = false } , setInputElem : function ( Q ) { H = Q } , clear : function ( ) { Fa == "textedit" && ib . toSelectMode ( ) } , init : function ( ) { if ( F ) { if ( ! F . parentNode ) { F = I [ 0 ] ; Ia . requestSelector ( F ) . showGrips ( false ) } var Q =
F . textContent . length , V = F . getAttribute ( "transform" ) ; n = svgedit . utilities . getBBox ( F ) ; w = V ? W ( F ) : null ; N = Array ( Q ) ; H . focus ( ) ; $ ( F ) . unbind ( "dblclick" , u ) . dblclick ( u ) ; if ( ! Q ) var aa = { x : n . x + n . width / 2 , width : 0 } ; for ( V = 0 ; V < Q ; V ++ ) { var fa = F . getStartPositionOfChar ( V ) ; aa = F . getEndPositionOfChar ( V ) ; if ( ! svgedit . browser . supportsGoodTextCharPos ( ) ) { var pa = b . contentW * o ; fa . x -= pa ; aa . x -= pa ; fa . x /= o ; aa . x /= o } N [ V ] = { x : fa . x , y : n . y , width : aa . x - fa . x , height : n . height } } N . push ( { x : aa . x , width : 0 } ) ; h ( H . selectionStart , H . selectionEnd , true ) } } } } ( ) , Ka =
b . pathActions = function ( ) { var e = false , h , l , z ; svgedit . path . Path . prototype . endChanges = function ( A ) { if ( svgedit . browser . isWebkit ( ) ) { var u = this . elem ; u . setAttribute ( "d" , Ka . convertPath ( u ) ) } A = new Oa ( this . elem , { d : this . last _d } , A ) ; za ( A ) ; O ( "changed" , [ this . elem ] ) } ; svgedit . path . Path . prototype . addPtsToSelection = function ( A ) { $ . isArray ( A ) || ( A = [ A ] ) ; for ( var u = 0 ; u < A . length ; u ++ ) { var F = A [ u ] , H = this . segs [ F ] ; H . ptgrip && this . selected _pts . indexOf ( F ) == - 1 && F >= 0 && this . selected _pts . push ( F ) } this . selected _pts . sort ( ) ; u = this . selected _pts . length ;
for ( A = Array ( u ) ; u -- ; ) { H = this . segs [ this . selected _pts [ u ] ] ; H . select ( true ) ; A [ u ] = H . ptgrip } Ka . canDeleteNodes = true ; Ka . closed _subpath = this . subpathIsClosed ( this . selected _pts [ 0 ] ) ; O ( "selected" , A ) } ; var v = h = null , G = false ; return { mouseDown : function ( A , u , F , H ) { if ( Fa === "path" ) { mouse _x = F ; mouse _y = H ; H = mouse _x / o ; u = mouse _y / o ; F = ra ( "path_stretch_line" ) ; l = [ H , u ] ; if ( m . gridSnapping ) { H = xa ( H ) ; u = xa ( u ) ; mouse _x = xa ( mouse _x ) ; mouse _y = xa ( mouse _y ) } if ( ! F ) { F = document . createElementNS ( c , "path" ) ; ma ( F , { id : "path_stretch_line" , stroke : "#22C" , "stroke-width" : "0.5" ,
fill : "none" } ) ; F = ra ( "selectorParentGroup" ) . appendChild ( F ) } F . setAttribute ( "display" , "inline" ) ; var D = null ; if ( v ) { D = v . pathSegList ; for ( var E = D . numberOfItems , L = 6 / o , N = false ; E ; ) { E -- ; var n = D . getItem ( E ) , w = n . x ; n = n . y ; if ( H >= w - L && H <= w + L && u >= n - L && u <= n + L ) { N = true ; break } } L = ca ( ) ; svgedit . path . removePath _ ( L ) ; L = ra ( L ) ; w = D . numberOfItems ; if ( N ) { if ( E <= 1 && w >= 2 ) { H = D . getItem ( 0 ) . x ; u = D . getItem ( 0 ) . y ; A = F . pathSegList . getItem ( 1 ) ; A = A . pathSegType === 4 ? v . createSVGPathSegLinetoAbs ( H , u ) : v . createSVGPathSegCurvetoCubicAbs ( H , u , A . x1 / o , A . y1 / o ,
H , u ) ; H = v . createSVGPathSegClosePath ( ) ; D . appendItem ( A ) ; D . appendItem ( H ) } else if ( w < 3 ) return D = false ; $ ( F ) . remove ( ) ; element = L ; v = null ; Ma = false ; if ( e ) { svgedit . path . path . matrix && fb ( L , { } , svgedit . path . path . matrix . inverse ( ) ) ; F = L . getAttribute ( "d" ) ; A = $ ( svgedit . path . path . elem ) . attr ( "d" ) ; $ ( svgedit . path . path . elem ) . attr ( "d" , A + F ) ; $ ( L ) . remove ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; svgedit . path . path . init ( ) ; Ka . toEditMode ( svgedit . path . path . elem ) ; svgedit . path . path . selectPt ( ) ; return false } } else { if ( ! $ . contains ( a ,
Kb ( A ) ) ) { console . log ( "Clicked outside canvas" ) ; return false } D = v . pathSegList . numberOfItems ; E = v . pathSegList . getItem ( D - 1 ) ; L = E . x ; E = E . y ; if ( A . shiftKey ) { A = ba ( L , E , H , u ) ; H = A . x ; u = A . y } A = F . pathSegList . getItem ( 1 ) ; A = A . pathSegType === 4 ? v . createSVGPathSegLinetoAbs ( gb ( H ) , gb ( u ) ) : v . createSVGPathSegCurvetoCubicAbs ( gb ( H ) , gb ( u ) , A . x1 / o , A . y1 / o , A . x2 / o , A . y2 / o ) ; v . pathSegList . appendItem ( A ) ; H *= o ; u *= o ; F . setAttribute ( "d" , [ "M" , H , u , H , u ] . join ( " " ) ) ; F = D ; if ( e ) F += svgedit . path . path . segs . length ; svgedit . path . addPointGrip ( F , H , u ) } } else { d _attr =
"M" + H + "," + u + " " ; v = S ( { element : "path" , curStyles : true , attr : { d : d _attr , id : ja ( ) , opacity : M . opacity / 2 } } ) ; F . setAttribute ( "d" , [ "M" , mouse _x , mouse _y , mouse _x , mouse _y ] . join ( " " ) ) ; F = e ? svgedit . path . path . segs . length : 0 ; svgedit . path . addPointGrip ( F , mouse _x , mouse _y ) } } else if ( svgedit . path . path ) { svgedit . path . path . storeD ( ) ; L = A . target . id ; if ( L . substr ( 0 , 14 ) == "pathpointgrip_" ) { u = svgedit . path . path . cur _pt = parseInt ( L . substr ( 14 ) ) ; svgedit . path . path . dragging = [ F , H ] ; D = svgedit . path . path . segs [ u ] ; if ( A . shiftKey ) D . selected ? svgedit . path . path . removePtFromSelection ( u ) :
svgedit . path . path . addPtsToSelection ( u ) ; else { if ( svgedit . path . path . selected _pts . length <= 1 || ! D . selected ) svgedit . path . path . clearSelection ( ) ; svgedit . path . path . addPtsToSelection ( u ) } } else if ( L . indexOf ( "ctrlpointgrip_" ) == 0 ) { svgedit . path . path . dragging = [ F , H ] ; A = L . split ( "_" ) [ 1 ] . split ( "c" ) ; u = A [ 0 ] - 0 ; svgedit . path . path . selectPt ( u , A [ 1 ] - 0 ) } if ( ! svgedit . path . path . dragging ) { if ( ua == null ) ua = Ia . getRubberBandBox ( ) ; ma ( ua , { x : F * o , y : H * o , width : 0 , height : 0 , display : "inline" } , 100 ) } } } , mouseMove : function ( A , u , F ) { if ( ! ( A . originalEvent . touches &&
A . originalEvent . touches . length > 1 ) ) { G = true ; if ( Fa === "path" ) { if ( v ) { var H = v . pathSegList ; A = H . numberOfItems - 1 ; if ( l ) { var D = svgedit . path . addCtrlGrip ( "1c1" ) , E = svgedit . path . addCtrlGrip ( "0c2" ) ; E . getAttribute ( "cx" ) ; E . getAttribute ( "cy" ) ; D . setAttribute ( "cx" , u ) ; D . setAttribute ( "cy" , F ) ; D . setAttribute ( "display" , "inline" ) ; D = l [ 0 ] ; var L = l [ 1 ] ; H . getItem ( A ) ; var N = D + ( D - u / o ) , n = L + ( L - F / o ) ; E . setAttribute ( "cx" , N * o ) ; E . setAttribute ( "cy" , n * o ) ; E . setAttribute ( "display" , "inline" ) ; E = svgedit . path . getCtrlLine ( 1 ) ; var w = svgedit . path . getCtrlLine ( 2 ) ;
ma ( E , { x1 : u , y1 : F , x2 : D * o , y2 : L * o , display : "inline" } ) ; ma ( w , { x1 : N * o , y1 : n * o , x2 : D * o , y2 : L * o , display : "inline" } ) ; if ( A === 0 ) z = [ u , F ] ; else { H = H . getItem ( A - 1 ) ; u = H . x ; F = H . y ; if ( H . pathSegType === 6 ) { u += u - H . x2 ; F += F - H . y2 } else if ( z ) { u = z [ 0 ] / o ; F = z [ 1 ] / o } svgedit . path . replacePathSeg ( 6 , A , [ D , L , u , F , N , n ] , v ) } } else if ( D = ra ( "path_stretch_line" ) ) { A = H . getItem ( A ) ; if ( A . pathSegType === 6 ) svgedit . path . replacePathSeg ( 6 , 1 , [ u , F , ( A . x + ( A . x - A . x2 ) ) * o , ( A . y + ( A . y - A . y2 ) ) * o , u , F ] , D ) ; else z ? svgedit . path . replacePathSeg ( 6 , 1 , [ u , F , z [ 0 ] , z [ 1 ] , u , F ] , D ) : svgedit . path . replacePathSeg ( 4 ,
1 , [ u , F ] , D ) } } } else if ( svgedit . path . path . dragging ) { D = svgedit . path . getPointFromGrip ( { x : svgedit . path . path . dragging [ 0 ] , y : svgedit . path . path . dragging [ 1 ] } , svgedit . path . path ) ; L = svgedit . path . getPointFromGrip ( { x : u , y : F } , svgedit . path . path ) ; A = L . x - D . x ; D = L . y - D . y ; svgedit . path . path . dragging = [ u , F ] ; svgedit . path . path . dragctrl ? svgedit . path . path . moveCtrl ( A , D ) : svgedit . path . path . movePts ( A , D ) } else { svgedit . path . path . selected _pts = [ ] ; svgedit . path . path . eachSeg ( function ( ) { if ( this . next || this . prev ) { var C = ua . getBBox ( ) , K = svgedit . path . getGripPt ( this ) ;
C = svgedit . math . rectsIntersect ( C , { x : K . x , y : K . y , width : 0 , height : 0 } ) ; this . select ( C ) ; C && svgedit . path . path . selected _pts . push ( this . index ) } } ) } } } , mouseUp : function ( A , u ) { if ( Fa === "path" ) { l = null ; if ( ! v ) { u = ra ( ca ( ) ) ; Ma = false ; z = null } return { keep : true , element : u } } if ( svgedit . path . path . dragging ) { var F = 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)" ) ; ! A . shiftKey && ! G && svgedit . path . path . selectPt ( F ) } else if ( ua &&
ua . getAttribute ( "display" ) != "none" ) { ua . setAttribute ( "display" , "none" ) ; ua . getAttribute ( "width" ) <= 2 && ua . getAttribute ( "height" ) <= 2 && Ka . toSelectMode ( A . target ) } else Ka . toSelectMode ( A . target ) ; G = false } , toEditMode : function ( A ) { svgedit . path . path = svgedit . path . getPath _ ( A ) ; Fa = "pathedit" ; Qa ( ) ; svgedit . path . path . show ( true ) . update ( ) ; svgedit . path . path . oldbbox = svgedit . utilities . getBBox ( svgedit . path . path . elem ) ; e = false } , toSelectMode : function ( A ) { var u = A == svgedit . path . path . elem ; Fa = "select" ; svgedit . path . path . show ( false ) ;
h = false ; Qa ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; if ( u ) { O ( "selected" , [ A ] ) ; wb ( [ A ] , true ) } } , addSubPath : function ( A ) { if ( A ) { Fa = "path" ; e = true } else { Ka . clear ( true ) ; Ka . toEditMode ( svgedit . path . path . elem ) } } , select : function ( A ) { if ( h === A ) { Ka . toEditMode ( A ) ; Fa = "pathedit" } else h = A } , reorient : function ( ) { var A = I [ 0 ] ; if ( A ) if ( oa ( A ) != 0 ) { var u = new Ba ( "Reorient path" ) , F = { d : A . getAttribute ( "d" ) , transform : A . getAttribute ( "transform" ) } ; u . addSubCommand ( new Oa ( A , F ) ) ; Qa ( ) ; this . resetOrientation ( A ) ; za ( u ) ; svgedit . path . getPath _ ( A ) . show ( false ) . matrix =
null ; this . clear ( ) ; wb ( [ A ] , true ) ; O ( "changed" , I ) } } , clear : function ( ) { h = null ; if ( v ) { var A = ra ( ca ( ) ) ; $ ( ra ( "path_stretch_line" ) ) . remove ( ) ; $ ( A ) . remove ( ) ; $ ( ra ( "pathpointgrip_container" ) ) . find ( "*" ) . attr ( "display" , "none" ) ; v = z = null ; Ma = false } else Fa == "pathedit" && this . toSelectMode ( ) ; svgedit . path . path && svgedit . path . path . init ( ) . show ( false ) } , resetOrientation : function ( A ) { if ( A == null || A . nodeName != "path" ) return false ; var u = Y ( A ) , F = ga ( u ) . matrix ; u . clear ( ) ; A . removeAttribute ( "transform" ) ; u = A . pathSegList ; for ( var H = u . numberOfItems ,
D = 0 ; D < H ; ++ D ) { var E = u . getItem ( D ) , L = E . pathSegType ; if ( L != 1 ) { var N = [ ] ; $ . each ( [ "" , 1 , 2 ] , function ( n , w ) { var C = E [ "x" + w ] , K = E [ "y" + w ] ; if ( C !== undefined && K !== undefined ) { C = P ( C , K , F ) ; N . splice ( N . length , 0 , C . x , C . y ) } } ) ; svgedit . path . replacePathSeg ( L , D , N , A ) } } g ( A , F ) } , zoomChange : function ( ) { Fa == "pathedit" && svgedit . path . path . update ( ) } , getNodePoint : function ( ) { var A = svgedit . path . path . segs [ svgedit . path . path . selected _pts . length ? svgedit . path . path . selected _pts [ 0 ] : 1 ] ; return { x : A . item . x , y : A . item . y , type : A . type } } , linkControlPoints : function ( A ) { svgedit . path . setLinkControlPoints ( A ) } ,
clonePathNode : function ( ) { svgedit . path . path . storeD ( ) ; for ( var A = svgedit . path . path . selected _pts , u = A . length , F = [ ] ; u -- ; ) { var H = A [ u ] ; svgedit . path . path . addSeg ( H ) ; F . push ( H + u ) ; F . push ( H + u + 1 ) } svgedit . path . path . init ( ) . addPtsToSelection ( F ) ; svgedit . path . path . endChanges ( "Clone path node(s)" ) } , opencloseSubPath : function ( ) { var A = svgedit . path . path . selected _pts ; if ( A . length === 1 ) { var u = svgedit . path . path . elem , F = u . pathSegList , H = A [ 0 ] , D = null , E = null ; svgedit . path . path . eachSeg ( function ( w ) { if ( this . type === 2 && w <= H ) E = this . item ; if ( w <=
H ) return true ; if ( this . type === 2 ) { D = w ; return false } else if ( this . type === 1 ) return D = false } ) ; if ( D == null ) D = svgedit . path . path . segs . length - 1 ; if ( D !== false ) { var L = u . createSVGPathSegLinetoAbs ( E . x , E . y ) , N = u . createSVGPathSegClosePath ( ) ; if ( D == svgedit . path . path . segs . length - 1 ) { F . appendItem ( L ) ; F . appendItem ( N ) } else { svgedit . path . insertItemBefore ( u , N , D ) ; svgedit . path . insertItemBefore ( u , L , D ) } svgedit . path . path . init ( ) . selectPt ( D + 1 ) } else if ( svgedit . path . path . segs [ H ] . mate ) { F . removeItem ( H ) ; F . removeItem ( H ) ; svgedit . path . path . init ( ) . selectPt ( H -
1 ) } else { for ( A = 0 ; A < F . numberOfItems ; A ++ ) { var n = F . getItem ( A ) ; if ( n . pathSegType === 2 ) L = A ; else if ( A === H ) F . removeItem ( L ) ; else if ( n . pathSegType === 1 && H < A ) { N = A - 1 ; F . removeItem ( A ) ; break } } for ( A = H - L - 1 ; A -- ; ) svgedit . path . insertItemBefore ( u , F . getItem ( L ) , N ) ; u = F . getItem ( L ) ; svgedit . path . replacePathSeg ( 2 , L , [ u . x , u . y ] ) ; A = H ; svgedit . path . path . init ( ) . selectPt ( 0 ) } } } , deletePathNode : function ( ) { if ( Ka . canDeleteNodes ) { svgedit . path . path . storeD ( ) ; for ( var A = svgedit . path . path . selected _pts , u = A . length ; u -- ; ) svgedit . path . path . deleteSeg ( A [ u ] ) ;
var F = function ( ) { var H = svgedit . path . path . elem . pathSegList , D = H . numberOfItems , E = function ( n , w ) { for ( ; w -- ; ) H . removeItem ( n ) } ; if ( D <= 1 ) return true ; for ( ; D -- ; ) { var L = H . getItem ( D ) ; if ( L . pathSegType === 1 ) { L = H . getItem ( D - 1 ) ; var N = H . getItem ( D - 2 ) ; if ( L . pathSegType === 2 ) { E ( D - 1 , 2 ) ; F ( ) ; break } else if ( N . pathSegType === 2 ) { E ( D - 2 , 3 ) ; F ( ) ; break } } else if ( L . pathSegType === 2 ) if ( D > 0 ) { L = H . getItem ( D - 1 ) . pathSegType ; if ( L === 2 ) { E ( D - 1 , 1 ) ; F ( ) ; break } else if ( L === 1 && H . numberOfItems - 1 === D ) { E ( D , 1 ) ; F ( ) ; break } } } return false } ; F ( ) ; if ( svgedit . path . path . elem . pathSegList . numberOfItems <=
1 ) { Ka . toSelectMode ( svgedit . path . path . elem ) ; b . deleteSelectedElements ( ) } else { svgedit . path . path . init ( ) ; svgedit . path . path . clearSelection ( ) ; if ( window . opera ) { A = $ ( svgedit . path . path . elem ) ; A . attr ( "d" , A . attr ( "d" ) ) } svgedit . path . path . endChanges ( "Delete path node(s)" ) } } } , smoothPolylineIntoPath : function ( A ) { var u = A . points , F = u . numberOfItems ; if ( F >= 4 ) { var H = u . getItem ( 0 ) , D = null ; A = [ ] ; A . push ( [ "M" , H . x , "," , H . y , " C" ] . join ( "" ) ) ; for ( var E = 1 ; E <= F - 4 ; E += 3 ) { var L = u . getItem ( E ) , N = u . getItem ( E + 1 ) , n = u . getItem ( E + 2 ) ; if ( D ) if ( ( H = svgedit . path . smoothControlPoints ( D ,
L , H ) ) && H . length == 2 ) { L = A [ A . length - 1 ] . split ( "," ) ; L [ 2 ] = H [ 0 ] . x ; L [ 3 ] = H [ 0 ] . y ; A [ A . length - 1 ] = L . join ( "," ) ; L = H [ 1 ] } A . push ( [ L . x , L . y , N . x , N . y , n . x , n . y ] . join ( "," ) ) ; H = n ; D = N } for ( A . push ( "L" ) ; E < F ; ++ E ) { N = u . getItem ( E ) ; A . push ( [ N . x , N . y ] . join ( "," ) ) } A = A . join ( " " ) ; A = S ( { element : "path" , curStyles : true , attr : { id : ca ( ) , d : A , fill : "none" } } ) } return A } , setSegType : function ( A ) { svgedit . path . path . setSegType ( A ) } , moveNode : function ( A , u ) { var F = svgedit . path . path . selected _pts ; if ( F . length ) { svgedit . path . path . storeD ( ) ; F = svgedit . path . path . segs [ F [ 0 ] ] ;
var H = { x : 0 , y : 0 } ; H [ A ] = u - F . item [ A ] ; F . move ( H . x , H . y ) ; svgedit . path . path . endChanges ( "Move path point" ) } } , fixEnd : function ( A ) { for ( var u = A . pathSegList , F = u . numberOfItems , H , D = 0 ; D < F ; ++ D ) { var E = u . getItem ( D ) ; if ( E . pathSegType === 2 ) H = E ; if ( E . pathSegType === 1 ) { E = u . getItem ( D - 1 ) ; if ( E . x != H . x || E . y != H . y ) { u = A . createSVGPathSegLinetoAbs ( H . x , H . y ) ; svgedit . path . insertItemBefore ( A , u , D ) ; Ka . fixEnd ( A ) ; break } } } svgedit . browser . isWebkit ( ) && A . setAttribute ( "d" , Ka . convertPath ( A ) ) } , convertPath : function ( A , u ) { for ( var F = A . pathSegList , H = F . numberOfItems ,
D = 0 , E = 0 , L = "" , N = null , n = 0 ; n < H ; ++ n ) { var w = F . getItem ( n ) , C = w . x || 0 , K = w . y || 0 , R = w . x1 || 0 , Q = w . y1 || 0 , V = w . x2 || 0 , aa = w . y2 || 0 , fa = w . pathSegType , pa = Pa [ fa ] [ "to" + ( u ? "Lower" : "Upper" ) + "Case" ] ( ) , sa = function ( Za , Aa , ha ) { Aa = Aa ? " " + Aa . join ( " " ) : "" ; ha = ha ? " " + svgedit . units . shortFloat ( ha ) : "" ; $ . each ( Za , function ( eb , Ra ) { Za [ eb ] = svgedit . units . shortFloat ( Ra ) } ) ; L += pa + Za . join ( " " ) + Aa + ha } ; switch ( fa ) { case 1 : L += "z" ; break ; case 12 : C -= D ; case 13 : if ( u ) { D += C ; pa = "l" } else { C += D ; D = C ; pa = "L" } sa ( [ [ C , E ] ] ) ; break ; case 14 : K -= E ; case 15 : if ( u ) { E += K ; pa = "l" } else { K +=
E ; E = K ; pa = "L" } sa ( [ [ D , K ] ] ) ; break ; case 2 : case 4 : case 18 : C -= D ; K -= E ; case 5 : case 3 : if ( N && F . getItem ( n - 1 ) . pathSegType === 1 && ! u ) { D = N [ 0 ] ; E = N [ 1 ] } case 19 : if ( u ) { D += C ; E += K } else { C += D ; K += E ; D = C ; E = K } if ( fa === 3 ) N = [ D , E ] ; sa ( [ [ C , K ] ] ) ; break ; case 6 : C -= D ; R -= D ; V -= D ; K -= E ; Q -= E ; aa -= E ; case 7 : if ( u ) { D += C ; E += K } else { C += D ; R += D ; V += D ; K += E ; Q += E ; aa += E ; D = C ; E = K } sa ( [ [ R , Q ] , [ V , aa ] , [ C , K ] ] ) ; break ; case 8 : C -= D ; R -= D ; K -= E ; Q -= E ; case 9 : if ( u ) { D += C ; E += K } else { C += D ; R += D ; K += E ; Q += E ; D = C ; E = K } sa ( [ [ R , Q ] , [ C , K ] ] ) ; break ; case 10 : C -= D ; K -= E ; case 11 : if ( u ) { D += C ; E += K } else { C +=
D ; K += E ; D = C ; E = K } sa ( [ [ w . r1 , w . r2 ] ] , [ w . angle , w . largeArcFlag ? 1 : 0 , w . sweepFlag ? 1 : 0 ] , [ C , K ] ) ; break ; case 16 : C -= D ; V -= D ; K -= E ; aa -= E ; case 17 : if ( u ) { D += C ; E += K } else { C += D ; V += D ; K += E ; aa += E ; D = C ; E = K } sa ( [ [ V , aa ] , [ C , K ] ] ) } } return L } } } ( ) , Mb = this . removeUnusedDefElems = function ( ) { var e = k . getElementsByTagNameNS ( c , "defs" ) ; if ( ! e || ! e . length ) return 0 ; for ( var h = [ ] , l = 0 , z = [ "fill" , "stroke" , "filter" , "marker-start" , "marker-mid" , "marker-end" ] , v = z . length , G = k . getElementsByTagNameNS ( c , "*" ) , A = G . length , u = 0 ; u < A ; u ++ ) { for ( var F = G [ u ] , H = 0 ; H < v ; H ++ ) { var D =
ka ( F . getAttribute ( z [ H ] ) ) ; D && h . push ( D . substr ( 1 ) ) } ( F = da ( F ) ) && F . indexOf ( "#" ) === 0 && h . push ( F . substr ( 1 ) ) } e = $ ( e ) . find ( "linearGradient, radialGradient, filter, marker, svg, symbol" ) ; defelem _ids = [ ] ; for ( u = e . length ; u -- ; ) { z = e [ u ] ; v = z . id ; if ( h . indexOf ( v ) < 0 ) { zb [ v ] = z ; z . parentNode . removeChild ( z ) ; l ++ } } return l } ; this . svgCanvasToString = function ( ) { for ( ; Mb ( ) > 0 ; ) ; Ka . clear ( true ) ; $ . each ( k . childNodes , function ( l , z ) { l && z . nodeType === 8 && z . data . indexOf ( "Created with" ) >= 0 && k . insertBefore ( z , k . firstChild ) } ) ; if ( J ) { Lb ( ) ; Bb ( [ J ] ) } var e =
[ ] ; $ ( k ) . find ( "g:data(gsvg)" ) . each ( function ( ) { for ( var l = this . attributes , z = l . length , v = 0 ; v < z ; v ++ ) if ( l [ v ] . nodeName == "id" || l [ v ] . nodeName == "style" ) z -- ; if ( z <= 0 ) { l = this . firstChild ; e . push ( l ) ; $ ( this ) . replaceWith ( l ) } } ) ; var h = this . svgToString ( k , 0 ) ; e . length && $ ( e ) . each ( function ( ) { Ab ( this ) } ) ; return h } ; this . svgToString = function ( e , h ) { var l = [ ] , z = svgedit . utilities . toXml , v = m . baseUnit , G = RegExp ( "^-?[\\d\\.]+" + v + "$" ) ; if ( e ) { na ( e ) ; var A = e . attributes , u , F , H = e . childNodes ; for ( F = 0 ; F < h ; F ++ ) l . push ( " " ) ; l . push ( "<" ) ; l . push ( e . nodeName ) ;
if ( e . id === "svgcontent" ) { F = Eb ( ) ; if ( v !== "px" ) { F . w = svgedit . units . convertUnit ( F . w , v ) + v ; F . h = svgedit . units . convertUnit ( F . h , v ) + v } l . push ( ' width="' + F . w + '" height="' + F . h + '" xmlns="' + c + '"' ) ; var D = { } ; $ ( e ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { $ . each ( this . attributes , function ( n , w ) { var C = w . namespaceURI ; if ( C && ! D [ C ] && Ca [ C ] !== "xmlns" && Ca [ C ] !== "xml" ) { D [ C ] = true ; l . push ( " xmlns:" + Ca [ C ] + '="' + C + '"' ) } } ) } ) ; F = A . length ; for ( v = [ "width" , "height" , "xmlns" , "x" , "y" , "viewBox" , "id" , "overflow" ] ; F -- ; ) { u = A . item ( F ) ; var E = z ( u . nodeValue ) ; if ( u . nodeName . indexOf ( "xmlns:" ) !==
0 ) if ( E != "" && v . indexOf ( u . localName ) == - 1 ) if ( ! u . namespaceURI || Ca [ u . namespaceURI ] ) { l . push ( " " ) ; l . push ( u . nodeName ) ; l . push ( '="' ) ; l . push ( E ) ; l . push ( '"' ) } } } else { if ( e . nodeName === "defs" && ! e . firstChild ) return ; var L = [ "-moz-math-font-style" , "_moz-math-font-style" ] ; for ( F = A . length - 1 ; F >= 0 ; F -- ) { u = A . item ( F ) ; E = z ( u . nodeValue ) ; if ( ! ( L . indexOf ( u . localName ) >= 0 ) ) if ( E != "" ) if ( E . indexOf ( "pointer-events" ) !== 0 ) if ( ! ( u . localName === "class" && E . indexOf ( "se_" ) === 0 ) ) { l . push ( " " ) ; if ( u . localName === "d" ) E = Ka . convertPath ( e , true ) ; if ( isNaN ( E ) ) { if ( G . test ( E ) ) E =
svgedit . units . shortFloat ( E ) + v } else E = svgedit . units . shortFloat ( E ) ; if ( hb . apply && e . nodeName === "image" && u . localName === "href" && hb . images && hb . images === "embed" ) { var N = Sa [ E ] ; if ( N ) E = N } if ( ! u . namespaceURI || u . namespaceURI == c || Ca [ u . namespaceURI ] ) { l . push ( u . nodeName ) ; l . push ( '="' ) ; l . push ( E ) ; l . push ( '"' ) } } } } if ( e . hasChildNodes ( ) ) { l . push ( ">" ) ; h ++ ; A = false ; for ( F = 0 ; F < H . length ; F ++ ) { v = H . item ( F ) ; switch ( v . nodeType ) { case 1 : l . push ( "\n" ) ; l . push ( this . svgToString ( H . item ( F ) , h ) ) ; break ; case 3 : v = v . nodeValue . replace ( /^\s+|\s+$/g , "" ) ;
if ( v != "" ) { A = true ; l . push ( z ( v ) + "" ) } break ; case 4 : l . push ( "\n" ) ; l . push ( Array ( h + 1 ) . join ( " " ) ) ; l . push ( "<![CDATA[" ) ; l . push ( v . nodeValue ) ; l . push ( "]]\>" ) ; break ; case 8 : l . push ( "\n" ) ; l . push ( Array ( h + 1 ) . join ( " " ) ) ; l . push ( "<!--" ) ; l . push ( v . data ) ; l . push ( "--\>" ) } } h -- ; if ( ! A ) { l . push ( "\n" ) ; for ( F = 0 ; F < h ; F ++ ) l . push ( " " ) } l . push ( "</" ) ; l . push ( e . nodeName ) ; l . push ( ">" ) } else l . push ( "/>" ) } return l . join ( "" ) } ; this . embedImage = function ( e , h ) { $ ( new Image ) . load ( function ( ) { var l = document . createElement ( "canvas" ) ; l . width = this . width ; l . height =
this . height ; l . getContext ( "2d" ) . drawImage ( this , 0 , 0 ) ; try { var z = ";svgedit_url=" + encodeURIComponent ( e ) ; z = l . toDataURL ( ) . replace ( ";base64" , z + ";base64" ) ; Sa [ e ] = z } catch ( v ) { Sa [ e ] = false } Ea = e ; h && h ( Sa [ e ] ) } ) . attr ( "src" , e ) } ; this . setGoodImage = function ( e ) { Ea = e } ; this . open = function ( ) { } ; this . save = function ( e ) { Qa ( ) ; e && $ . extend ( hb , e ) ; hb . apply = true ; e = this . svgCanvasToString ( ) ; O ( "saved" , e ) } ; this . rasterExport = function ( ) { Qa ( ) ; var e = [ ] , h = { feGaussianBlur : rb . exportNoBlur , foreignObject : rb . exportNoforeignObject , "[stroke-dasharray]" : rb . exportNoDashArray } ,
l = $ ( k ) ; if ( ! ( "font" in $ ( "<canvas>" ) [ 0 ] . getContext ( "2d" ) ) ) h . text = rb . exportNoText ; $ . each ( h , function ( z , v ) { l . find ( z ) . length && e . push ( v ) } ) ; h = this . svgCanvasToString ( ) ; O ( "exported" , { svg : h , issues : e } ) } ; this . getSvgString = function ( ) { hb . apply = false ; return this . svgCanvasToString ( ) } ; this . randomizeIds = function ( ) { arguments . length > 0 && arguments [ 0 ] == false ? svgedit . draw . randomizeIds ( false , B ( ) ) : svgedit . draw . randomizeIds ( true , B ( ) ) } ; var Ob = this . uniquifyElems = function ( e ) { var h = { } , l = [ "filter" , "linearGradient" , "pattern" , "radialGradient" ,
"symbol" , "textPath" , "use" ] ; svgedit . utilities . walkTree ( e , function ( u ) { if ( u . nodeType == 1 ) { if ( u . id ) { u . id in h || ( h [ u . id ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ u . id ] . elem = u } $ . each ( $a , function ( H , D ) { var E = u . getAttributeNode ( D ) ; if ( E ) { var L = svgedit . utilities . getUrlFromAttr ( E . value ) ; if ( L = L ? L . substr ( 1 ) : null ) { L in h || ( h [ L ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ L ] . attrs . push ( E ) } } } ) ; var F = svgedit . utilities . getHref ( u ) ; if ( F && l . indexOf ( u . nodeName ) >= 0 ) if ( F = F . substr ( 1 ) ) { F in h || ( h [ F ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ F ] . hrefs . push ( u ) } } } ) ;
for ( var z in h ) if ( z ) { var v = h [ z ] . elem ; if ( v ) { e = ja ( ) ; v . id = e ; v = h [ z ] . attrs ; for ( var G = v . length ; G -- ; ) { var A = v [ G ] ; A . ownerElement . setAttribute ( A . name , "url(#" + e + ")" ) } v = h [ z ] . hrefs ; for ( G = v . length ; G -- ; ) svgedit . utilities . setHref ( v [ G ] , "#" + e ) } } } , Nb = this . setUseData = function ( e ) { var h = $ ( e ) ; if ( e . tagName !== "use" ) h = h . find ( "use" ) ; h . each ( function ( ) { var l = da ( this ) . substr ( 1 ) ; if ( l = ra ( l ) ) { $ ( this ) . data ( "ref" , l ) ; if ( l . tagName == "symbol" || l . tagName == "svg" ) $ ( this ) . data ( "symbol" , l ) . data ( "ref" , l ) } } ) } , Pb = this . convertGradients = function ( e ) { var h =
$ ( e ) . find ( "linearGradient, radialGradient" ) ; if ( ! h . length && svgedit . browser . isWebkit ( ) ) h = $ ( e ) . find ( "*" ) . filter ( function ( ) { return this . tagName . indexOf ( "Gradient" ) >= 0 } ) ; h . each ( function ( ) { if ( $ ( this ) . attr ( "gradientUnits" ) === "userSpaceOnUse" ) { var l = $ ( k ) . find ( '[fill="url(#' + this . id + ')"],[stroke="url(#' + this . id + ')"]' ) ; if ( l . length ) if ( l = svgedit . utilities . getBBox ( l [ 0 ] ) ) if ( this . tagName === "linearGradient" ) { var z = $ ( this ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) , v = this . gradientTransform . baseVal ; if ( v && v . numberOfItems > 0 ) { var G =
ga ( v ) . matrix ; v = P ( z . x1 , z . y1 , G ) ; G = P ( z . x2 , z . y2 , G ) ; z . x1 = v . x ; z . y1 = v . y ; z . x2 = G . x ; z . y2 = G . y ; this . removeAttribute ( "gradientTransform" ) } $ ( this ) . attr ( { x1 : ( z . x1 - l . x ) / l . width , y1 : ( z . y1 - l . y ) / l . height , x2 : ( z . x2 - l . x ) / l . width , y2 : ( z . y2 - l . y ) / l . height } ) ; this . removeAttribute ( "gradientUnits" ) } } } ) } , Fb = this . convertToGroup = function ( e ) { e || ( e = I [ 0 ] ) ; var h = $ ( e ) , l = new Ba , z ; if ( h . data ( "gsvg" ) ) { l = $ ( e . firstChild ) . attr ( [ "x" , "y" ] ) ; $ ( e . firstChild . firstChild ) . unwrap ( ) ; $ ( e ) . removeData ( "gsvg" ) ; z = Y ( e ) ; var v = d . createSVGTransform ( ) ; v . setTranslate ( l . x ,
l . y ) ; z . appendItem ( v ) ; Wa ( e ) ; O ( "selected" , [ e ] ) } else if ( h . data ( "symbol" ) ) { e = h . data ( "symbol" ) ; z = h . attr ( "transform" ) ; v = h . attr ( [ "x" , "y" ] ) ; var G = e . getAttribute ( "viewBox" ) ; if ( G ) { G = G . split ( " " ) ; v . x -= + G [ 0 ] ; v . y -= + G [ 1 ] } z += " translate(" + ( v . x || 0 ) + "," + ( v . y || 0 ) + ")" ; v = h . prev ( ) ; l . addSubCommand ( new La ( h [ 0 ] , h [ 0 ] . nextSibling , h [ 0 ] . parentNode ) ) ; h . remove ( ) ; G = $ ( k ) . find ( "use:data(symbol)" ) . length ; h = f . createElementNS ( c , "g" ) ; for ( var A = e . childNodes , u = 0 ; u < A . length ; u ++ ) h . appendChild ( A [ u ] . cloneNode ( true ) ) ; if ( svgedit . browser . isGecko ( ) ) { A =
$ ( mb ( ) ) . children ( "linearGradient,radialGradient,pattern" ) . clone ( ) ; $ ( h ) . append ( A ) } z && h . setAttribute ( "transform" , z ) ; z = e . parentNode ; Ob ( h ) ; svgedit . browser . isGecko ( ) && $ ( mb ( ) ) . append ( $ ( h ) . find ( "linearGradient,radialGradient,pattern" ) ) ; h . id = ja ( ) ; v . after ( h ) ; if ( z ) { if ( ! G ) { v = e . nextSibling ; z . removeChild ( e ) ; l . addSubCommand ( new La ( e , v , z ) ) } l . addSubCommand ( new Da ( h ) ) } Nb ( h ) ; svgedit . browser . isGecko ( ) ? Pb ( mb ( ) ) : Pb ( h ) ; svgedit . utilities . walkTreePost ( h , function ( F ) { try { Wa ( F ) } catch ( H ) { console . log ( H ) } } ) ; $ ( h ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id =
ja ( ) } ) ; Bb ( [ h ] ) ; ( e = Ib ( h , true ) ) && l . addSubCommand ( e ) ; za ( l ) } else console . log ( "Unexpected element to ungroup:" , e ) } ; this . setSvgString = function ( e ) { try { var h = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( h ) ; var l = new Ba ( "Change Source" ) , z = k . nextSibling , v = d . removeChild ( k ) ; l . addSubCommand ( new La ( v , z , d ) ) ; k = f . adoptNode ? f . adoptNode ( h . documentElement ) : f . importNode ( h . documentElement , true ) ; d . appendChild ( k ) ; var G = $ ( k ) ; b . current _drawing _ = new svgedit . draw . Drawing ( k , q ) ; var A = B ( ) . getNonce ( ) ; A ? O ( "setnonce" , A ) : O ( "unsetnonce" ) ;
G . find ( "image" ) . each ( function ( ) { var N = this ; qb ( N ) ; var n = da ( this ) ; if ( n . indexOf ( "data:" ) === 0 ) { var w = n . match ( /svgedit_url=(.*?);/ ) ; if ( w ) { var C = decodeURIComponent ( w [ 1 ] ) ; $ ( new Image ) . load ( function ( ) { N . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , C ) } ) . attr ( "src" , C ) } } b . embedImage ( n ) } ) ; G . find ( "svg" ) . each ( function ( ) { if ( ! $ ( this ) . closest ( "defs" ) . length ) { Ob ( this ) ; var N = this . parentNode ; if ( N . childNodes . length === 1 && N . nodeName === "g" ) { $ ( N ) . data ( "gsvg" , this ) ; N . id = N . id || ja ( ) } else Ab ( this ) } } ) ; svgedit . browser . isGecko ( ) &&
G . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( mb ( ) ) ; Nb ( G ) ; Pb ( G [ 0 ] ) ; svgedit . utilities . walkTreePost ( k , function ( N ) { try { Wa ( N ) } catch ( n ) { console . log ( n ) } } ) ; var u = { id : "svgcontent" , overflow : m . show _outside _canvas ? "visible" : "hidden" } , F = false ; if ( G . attr ( "viewBox" ) ) { var H = G . attr ( "viewBox" ) . split ( " " ) ; u . width = H [ 2 ] ; u . height = H [ 3 ] } else $ . each ( [ "width" , "height" ] , function ( N , n ) { var w = G . attr ( n ) ; w || ( w = "100%" ) ; if ( ( w + "" ) . substr ( - 1 ) === "%" ) F = true ; else u [ n ] = ta ( n , w ) } ) ; Gb ( ) ; 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 =
ja ( ) } ) ; if ( F ) { var D = getStrokedBBox ( ) ; u . width = D . width + D . x ; u . height = D . height + D . y } if ( u . width <= 0 ) u . width = 100 ; if ( u . height <= 0 ) u . height = 100 ; G . attr ( u ) ; this . contentW = u . width ; this . contentH = u . height ; l . addSubCommand ( new Da ( k ) ) ; var E = G . attr ( [ "width" , "height" ] ) ; l . addSubCommand ( new Oa ( d , E ) ) ; o = 1 ; svgedit . transformlist . resetListMap ( ) ; Qa ( ) ; svgedit . path . clearData ( ) ; d . appendChild ( Ia . selectorParentGroup ) ; za ( l ) ; O ( "changed" , [ k ] ) } catch ( L ) { console . log ( L ) ; return false } return true } ; this . importSvgString = function ( e ) { try { var h =
svgedit . utilities . encode64 ( e . length + e ) . substr ( 0 , 32 ) , l = false ; if ( tb [ h ] ) if ( $ ( tb [ h ] . symbol ) . parents ( "#svgroot" ) . length ) l = true ; var z = new Ba ( "Import SVG" ) ; if ( l ) var v = tb [ h ] . symbol , G = tb [ h ] . xform ; else { var A = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( A ) ; var u ; u = f . adoptNode ? f . adoptNode ( A . documentElement ) : f . importNode ( A . documentElement , true ) ; Ob ( u ) ; var F = ta ( "width" , u . getAttribute ( "width" ) ) , H = ta ( "height" , u . getAttribute ( "height" ) ) , D = u . getAttribute ( "viewBox" ) , E = D ? D . split ( " " ) : [ 0 , 0 , F , H ] ; for ( e = 0 ; e < 4 ; ++ e ) E [ e ] = + E [ e ] ;
k . getAttribute ( "width" ) ; var L = + k . getAttribute ( "height" ) ; G = H > F ? "scale(" + L / 3 / E [ 3 ] + ")" : "scale(" + L / 3 / E [ 2 ] + ")" ; G = "translate(0) " + G + " translate(0)" ; v = f . createElementNS ( c , "symbol" ) ; var N = mb ( ) ; for ( svgedit . browser . isGecko ( ) && $ ( u ) . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( N ) ; u . firstChild ; ) v . appendChild ( u . firstChild ) ; var n = u . attributes ; for ( u = 0 ; u < n . length ; u ++ ) { var w = n [ u ] ; v . setAttribute ( w . nodeName , w . nodeValue ) } v . id = ja ( ) ; tb [ h ] = { symbol : v , xform : G } ; mb ( ) . appendChild ( v ) ; z . addSubCommand ( new Da ( v ) ) } var C =
f . createElementNS ( c , "use" ) ; C . id = ja ( ) ; X ( C , "#" + v . id ) ; ( J || B ( ) . getCurrentLayer ( ) ) . appendChild ( C ) ; z . addSubCommand ( new Da ( C ) ) ; Qa ( ) ; C . setAttribute ( "transform" , G ) ; Wa ( C ) ; $ ( C ) . data ( "symbol" , v ) . data ( "ref" , v ) ; wb ( [ C ] ) ; za ( z ) ; O ( "changed" , [ k ] ) } catch ( K ) { console . log ( K ) ; return false } return true } ; var Gb = b . identifyLayers = function ( ) { Lb ( ) ; B ( ) . identifyLayers ( ) } ; this . createLayer = function ( e ) { var h = new Ba ( "Create Layer" ) ; e = B ( ) . createLayer ( e ) ; h . addSubCommand ( new Da ( e ) ) ; za ( h ) ; Qa ( ) ; O ( "changed" , [ e ] ) } ; this . cloneLayer = function ( e ) { var h =
new Ba ( "Duplicate Layer" ) , l = f . createElementNS ( c , "g" ) , z = f . createElementNS ( c , "title" ) ; z . textContent = e ; l . appendChild ( z ) ; z = B ( ) . getCurrentLayer ( ) ; $ ( z ) . after ( l ) ; z = z . childNodes ; for ( var v = 0 ; v < z . length ; v ++ ) { var G = z [ v ] ; G . localName != "title" && l . appendChild ( la ( G ) ) } Qa ( ) ; Gb ( ) ; h . addSubCommand ( new Da ( l ) ) ; za ( h ) ; b . setCurrentLayer ( e ) ; O ( "changed" , [ l ] ) } ; this . deleteCurrentLayer = function ( ) { var e = B ( ) . getCurrentLayer ( ) , h = e . nextSibling , l = e . parentNode ; if ( e = B ( ) . deleteCurrentLayer ( ) ) { var z = new Ba ( "Delete Layer" ) ; z . addSubCommand ( new La ( e ,
h , l ) ) ; za ( z ) ; Qa ( ) ; O ( "changed" , [ l ] ) ; return true } return false } ; this . setCurrentLayer = function ( e ) { ( e = B ( ) . setCurrentLayer ( svgedit . utilities . toXml ( e ) ) ) && Qa ( ) ; return e } ; this . renameCurrentLayer = function ( e ) { var h = B ( ) ; if ( h . current _layer ) { var l = h . current _layer ; if ( ! b . setCurrentLayer ( e ) ) { for ( var z = new Ba ( "Rename Layer" ) , v = 0 ; v < h . getNumLayers ( ) ; ++ v ) if ( h . all _layers [ v ] [ 1 ] == l ) break ; var G = h . getLayerName ( v ) ; h . all _layers [ v ] [ 0 ] = svgedit . utilities . toXml ( e ) ; var A = l . childNodes . length ; for ( v = 0 ; v < A ; ++ v ) { var u = l . childNodes . item ( v ) ;
if ( u && u . tagName == "title" ) { for ( ; u . firstChild ; ) u . removeChild ( u . firstChild ) ; u . textContent = e ; z . addSubCommand ( new Oa ( u , { "#text" : G } ) ) ; za ( z ) ; O ( "changed" , [ l ] ) ; return true } } } h . current _layer = l } return false } ; this . setCurrentLayerPosition = function ( e ) { var h = B ( ) ; if ( h . current _layer && e >= 0 && e < h . getNumLayers ( ) ) { for ( var l = 0 ; l < h . getNumLayers ( ) ; ++ l ) if ( h . all _layers [ l ] [ 1 ] == h . current _layer ) break ; if ( l == h . getNumLayers ( ) ) return false ; if ( l != e ) { var z = null , v = h . current _layer . nextSibling ; if ( e > l ) { if ( e < h . getNumLayers ( ) - 1 ) z = h . all _layers [ e +
1 ] [ 1 ] } else z = h . all _layers [ e ] [ 1 ] ; k . insertBefore ( h . current _layer , z ) ; za ( new Ja ( h . current _layer , v , k ) ) ; Gb ( ) ; b . setCurrentLayer ( h . getLayerName ( e ) ) ; return true } } return false } ; this . setLayerVisibility = function ( e , h ) { var l = B ( ) , z = l . getLayerVisibility ( e ) , v = l . setLayerVisibility ( e , h ) ; if ( v ) za ( new Oa ( v , { display : z ? "inline" : "none" } , "Layer Visibility" ) ) ; else return false ; if ( v == l . getCurrentLayer ( ) ) { Qa ( ) ; Ka . clear ( ) } return true } ; this . moveSelectedToLayer = function ( e ) { for ( var h = null , l = B ( ) , z = 0 ; z < l . getNumLayers ( ) ; ++ z ) if ( l . getLayerName ( z ) ==
e ) { h = l . all _layers [ z ] [ 1 ] ; break } if ( ! h ) return false ; e = new Ba ( "Move Elements to Layer" ) ; l = I ; for ( z = l . length ; z -- ; ) { var v = l [ z ] ; if ( v ) { var G = v . nextSibling , A = v . parentNode ; h . appendChild ( v ) ; e . addSubCommand ( new Ja ( v , G , A ) ) } } za ( e ) ; return true } ; this . mergeLayer = function ( e ) { var h = new Ba ( "Merge Layer" ) , l = B ( ) , z = $ ( l . current _layer ) . prev ( ) [ 0 ] ; if ( z ) { for ( h . addSubCommand ( new La ( l . current _layer , l . current _layer . nextSibling , k ) ) ; l . current _layer . firstChild ; ) { var v = l . current _layer . firstChild ; if ( v . localName == "title" ) { h . addSubCommand ( new La ( v ,
v . nextSibling , l . current _layer ) ) ; l . current _layer . removeChild ( v ) } else { var G = v . nextSibling ; z . appendChild ( v ) ; h . addSubCommand ( new Ja ( v , G , l . current _layer ) ) } } k . removeChild ( l . current _layer ) ; if ( ! e ) { Qa ( ) ; Gb ( ) ; O ( "changed" , [ k ] ) ; za ( h ) } l . current _layer = z ; return h } } ; this . mergeAllLayers = function ( ) { var e = new Ba ( "Merge all Layers" ) , h = B ( ) ; for ( h . current _layer = h . all _layers [ h . getNumLayers ( ) - 1 ] [ 1 ] ; $ ( k ) . children ( "g" ) . length > 1 ; ) e . addSubCommand ( b . mergeLayer ( true ) ) ; Qa ( ) ; Gb ( ) ; O ( "changed" , [ k ] ) ; za ( e ) } ; var Lb = this . leaveContext =
function ( ) { var e = wa . length ; if ( e ) { for ( var h = 0 ; h < e ; h ++ ) { var l = wa [ h ] , z = jb ( l , "orig_opac" ) ; z !== 1 ? l . setAttribute ( "opacity" , z ) : l . removeAttribute ( "opacity" ) ; l . setAttribute ( "style" , "pointer-events: inherit" ) } wa = [ ] ; Qa ( true ) ; O ( "contextset" , null ) } J = null } , Sb = this . setContext = function ( e ) { Lb ( ) ; if ( typeof e === "string" ) e = ra ( e ) ; J = e ; $ ( e ) . parentsUntil ( "#svgcontent" ) . andSelf ( ) . siblings ( ) . each ( function ( ) { var h = this . getAttribute ( "opacity" ) || 1 ; jb ( this , "orig_opac" , h ) ; this . setAttribute ( "opacity" , h * 0.33 ) ; this . setAttribute ( "style" ,
"pointer-events: none" ) ; wa . push ( this ) } ) ; Qa ( ) ; O ( "contextset" , J ) } ; this . clear = function ( ) { Ka . clear ( ) ; Qa ( ) ; b . clearSvgContentElement ( ) ; b . current _drawing _ = new svgedit . draw . Drawing ( k ) ; b . createLayer ( "Layer 1" ) ; b . undoMgr . resetUndoStack ( ) ; Ia . initGroup ( ) ; ua = Ia . getRubberBandBox ( ) ; O ( "cleared" ) } ; this . linkControlPoints = Ka . linkControlPoints ; this . getContentElem = function ( ) { return k } ; this . getRootElem = function ( ) { return d } ; this . getSelectedElems = function ( ) { return I } ; var Eb = this . getResolution = function ( ) { var e = k . getAttribute ( "width" ) /
o , h = k . getAttribute ( "height" ) / o ; return { w : e , h : h , zoom : o } } ; this . getZoom = function ( ) { return o } ; this . getVersion = function ( ) { return "svgcanvas.js ($Rev: 2082 $)" } ; this . setUiStrings = function ( e ) { $ . extend ( rb , e . notification ) } ; this . setConfig = function ( e ) { $ . extend ( m , e ) } ; this . getTitle = function ( e ) { if ( e = e || I [ 0 ] ) { e = $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) || e ; e = e . childNodes ; for ( var h = 0 ; h < e . length ; h ++ ) if ( e [ h ] . nodeName == "title" ) return e [ h ] . textContent ; return "" } } ; this . setGroupTitle = function ( e ) { var h = I [ 0 ] ; h = $ ( h ) . data ( "gsvg" ) ||
h ; var l = $ ( h ) . children ( "title" ) , z = new Ba ( "Set Label" ) ; if ( e . length ) if ( l . length ) { l = l [ 0 ] ; z . addSubCommand ( new Oa ( l , { "#text" : l . textContent } ) ) ; l . textContent = e } else { l = f . createElementNS ( c , "title" ) ; l . textContent = e ; $ ( h ) . prepend ( l ) ; z . addSubCommand ( new Da ( l ) ) } else { z . addSubCommand ( new La ( l [ 0 ] , l . nextSibling , h ) ) ; l . remove ( ) } za ( z ) } ; this . getDocumentTitle = function ( ) { return b . getTitle ( k ) } ; this . setDocumentTitle = function ( e ) { for ( var h = k . childNodes , l = false , z = "" , v = new Ba ( "Change Image Title" ) , G = 0 ; G < h . length ; G ++ ) if ( h [ G ] . nodeName ==
"title" ) { l = h [ G ] ; z = l . textContent ; break } if ( ! l ) { l = f . createElementNS ( c , "title" ) ; k . insertBefore ( l , k . firstChild ) } if ( e . length ) l . textContent = e ; else l . parentNode . removeChild ( l ) ; v . addSubCommand ( new Oa ( l , { "#text" : z } ) ) ; za ( v ) } ; this . getEditorNS = function ( e ) { e && k . setAttribute ( "xmlns:se" , "http://svg-edit.googlecode.com" ) ; return "http://svg-edit.googlecode.com" } ; this . setResolution = function ( e , h ) { var l = Eb ( ) , z = l . w ; l = l . h ; var v ; if ( e == "fit" ) { var G = getStrokedBBox ( ) ; if ( G ) { v = new Ba ( "Fit Canvas to Content" ) ; var A = vb ( ) ; wb ( A ) ;
var u = [ ] , F = [ ] ; $ . each ( A , function ( ) { u . push ( G . x * - 1 ) ; F . push ( G . y * - 1 ) } ) ; A = b . moveSelectedElements ( u , F , true ) ; v . addSubCommand ( A ) ; Qa ( ) ; e = Math . round ( G . width ) ; h = Math . round ( G . height ) } else return false } if ( e != z || h != l ) { A = d . suspendRedraw ( 1E3 ) ; v || ( v = new Ba ( "Change Image Dimensions" ) ) ; e = ta ( "width" , e ) ; h = ta ( "height" , h ) ; k . setAttribute ( "width" , e ) ; k . setAttribute ( "height" , h ) ; this . contentW = e ; this . contentH = h ; v . addSubCommand ( new Oa ( k , { width : z , height : l } ) ) ; k . setAttribute ( "viewBox" , [ 0 , 0 , e / o , h / o ] . join ( " " ) ) ; v . addSubCommand ( new Oa ( k ,
{ viewBox : [ "0 0" , z , l ] . join ( " " ) } ) ) ; za ( v ) ; d . unsuspendRedraw ( A ) ; if ( background = document . getElementById ( "canvas_background" ) ) { background . setAttribute ( "x" , - 1 ) ; background . setAttribute ( "y" , - 1 ) ; background . setAttribute ( "width" , e + 2 ) ; background . setAttribute ( "height" , h + 2 ) } O ( "changed" , [ k ] ) } return [ e , h ] } ; this . getOffset = function ( ) { return $ ( k ) . attr ( [ "x" , "y" ] ) } ; this . setBBoxZoom = function ( e , h , l ) { var z = 0.85 , v = function ( G ) { if ( ! G ) return false ; var A = Math . min ( Math . round ( h / G . width * 100 * z ) / 100 , Math . round ( l / G . height * 100 * z ) / 100 ) ;
b . setZoom ( A ) ; return { zoom : A , bbox : G } } ; if ( typeof e == "object" ) { e = e ; if ( e . width == 0 || e . height == 0 ) { b . setZoom ( e . zoom ? e . zoom : o * e . factor ) ; return { zoom : o , bbox : e } } return v ( e ) } switch ( e ) { case "selection" : if ( ! I [ 0 ] ) return ; e = $ . map ( I , function ( G ) { if ( G ) return G } ) ; e = getStrokedBBox ( e ) ; break ; case "canvas" : e = Eb ( ) ; z = 0.95 ; e = { width : e . w , height : e . h , x : 0 , y : 0 } ; break ; case "content" : e = getStrokedBBox ( ) ; break ; case "layer" : e = getStrokedBBox ( vb ( B ( ) . getCurrentLayer ( ) ) ) ; break ; default : return } return v ( e ) } ; this . setZoom = function ( e ) { var h = Eb ( ) ;
k . setAttribute ( "viewBox" , "0 0 " + h . w / e + " " + h . h / e ) ; o = e ; $ . each ( I , function ( l , z ) { z && Ia . requestSelector ( z ) . resize ( ) } ) ; Ka . zoomChange ( ) ; pb ( "zoomChanged" , e ) } ; this . getMode = function ( ) { return Fa } ; this . setMode = function ( e ) { Ka . clear ( true ) ; ib . clear ( ) ; $ ( "#workarea" ) . attr ( "class" , e ) ; bb = I [ 0 ] && I [ 0 ] . nodeName == "text" ? Ya : M ; Fa = e } ; this . getColor = function ( e ) { return bb [ e ] } ; this . setColor = function ( e , h , l ) { M [ e ] = h ; bb [ e + "_paint" ] = { type : "solidColor" } ; for ( var z = [ ] , v = I . length ; v -- ; ) { var G = I [ v ] ; if ( G ) if ( G . tagName == "g" ) svgedit . utilities . walkTree ( G ,
function ( A ) { A . nodeName != "g" && z . push ( A ) } ) ; else if ( e == "fill" ) G . tagName != "polyline" && G . tagName != "line" && z . push ( G ) ; else z . push ( G ) } if ( z . length > 0 ) if ( l ) Db ( e , h , z ) ; else { db ( e , h , z ) ; O ( "changed" , z ) } } ; var mb = function ( ) { var e = k . getElementsByTagNameNS ( c , "defs" ) ; if ( e . length > 0 ) e = e [ 0 ] ; else { e = f . createElementNS ( c , "defs" ) ; k . firstChild ? k . insertBefore ( e , k . firstChild . nextSibling ) : k . appendChild ( e ) } return e } , Rb = this . setGradient = function ( e ) { if ( ! ( ! bb [ e + "_paint" ] || bb [ e + "_paint" ] . type == "solidColor" ) ) { var h = b [ e + "Grad" ] , l = Qb ( h ) ,
z = mb ( ) ; if ( l ) h = l ; else { h = z . appendChild ( f . importNode ( h , true ) ) ; h . id = ja ( ) } b . setColor ( e , "url(#" + h . id + ")" ) ; if ( e == "canvas" ) ( e = document . getElementById ( "canvas_background" ) ) && e . setAttribute ( "fill" , "url(#" + h . id + ")" ) } } , Qb = function ( e ) { var h = mb ( ) ; h = $ ( h ) . find ( "linearGradient, radialGradient" ) ; for ( var l = h . length , z = [ "r" , "cx" , "cy" , "fx" , "fy" ] ; l -- ; ) { var v = h [ l ] ; if ( e . tagName == "linearGradient" ) { if ( e . getAttribute ( "x1" ) != v . getAttribute ( "x1" ) || e . getAttribute ( "y1" ) != v . getAttribute ( "y1" ) || e . getAttribute ( "x2" ) != v . getAttribute ( "x2" ) ||
e . getAttribute ( "y2" ) != v . getAttribute ( "y2" ) ) continue } else { var G = $ ( e ) . attr ( z ) , A = $ ( v ) . attr ( z ) , u = false ; $ . each ( z , function ( N , n ) { if ( G [ n ] != A [ n ] ) u = true } ) ; if ( u ) continue } var F = e . getElementsByTagNameNS ( c , "stop" ) , H = v . getElementsByTagNameNS ( c , "stop" ) ; if ( F . length == H . length ) { for ( var D = F . length ; D -- ; ) { var E = F [ D ] , L = H [ D ] ; if ( E . getAttribute ( "offset" ) != L . getAttribute ( "offset" ) || E . getAttribute ( "stop-opacity" ) != L . getAttribute ( "stop-opacity" ) || E . getAttribute ( "stop-color" ) != L . getAttribute ( "stop-color" ) ) break } if ( D == - 1 ) return v } } return null } ;
this . setPaint = function ( e , h ) { var l = new $ . jGraduate . Paint ( h ) ; this . setPaintOpacity ( e , l . alpha / 100 , true ) ; bb [ e + "_paint" ] = l ; switch ( l . type ) { case "solidColor" : if ( l . solidColor != "none" && l . solidColor != "#none" ) this . setColor ( e , "#" + l . solidColor ) ; else { this . setColor ( e , "none" ) ; document . querySelector ( e == "fill" ? "#fill_color rect" : "#stroke_color rect" ) . setAttribute ( "fill" , "none" ) } break ; case "linearGradient" : case "radialGradient" : b [ e + "Grad" ] = l [ l . type ] ; Rb ( e ) } } ; this . getStrokeWidth = function ( ) { return bb . stroke _width } ; this . setStrokeWidth =
function ( e ) { if ( e == 0 && [ "line" , "path" ] . indexOf ( Fa ) >= 0 ) b . setStrokeWidth ( 1 ) ; else { bb . stroke _width = e ; for ( var h = [ ] , l = I . length ; l -- ; ) { var z = I [ l ] ; if ( z ) z . tagName == "g" ? svgedit . utilities . walkTree ( z , function ( v ) { v . nodeName != "g" && h . push ( v ) } ) : h . push ( z ) } if ( h . length > 0 ) { db ( "stroke-width" , e , h ) ; O ( "changed" , I ) } } } ; this . setStrokeAttr = function ( e , h ) { M [ e . replace ( "-" , "_" ) ] = h ; for ( var l = [ ] , z = I . length ; z -- ; ) { var v = I [ z ] ; if ( v ) v . tagName == "g" ? svgedit . utilities . walkTree ( v , function ( G ) { G . nodeName != "g" && l . push ( G ) } ) : l . push ( v ) } if ( l . length >
0 ) { db ( e , h , l ) ; O ( "changed" , I ) } } ; this . getStyle = function ( ) { return M } ; this . getOpacity = function ( ) { return M . opacity } ; this . setOpacity = function ( e ) { M . opacity = e ; db ( "opacity" , e ) } ; this . getFillOpacity = function ( ) { return M . fill _opacity } ; this . getStrokeOpacity = function ( ) { return M . stroke _opacity } ; this . setPaintOpacity = function ( e , h , l ) { M [ e + "_opacity" ] = h ; l ? Db ( e + "-opacity" , h ) : db ( e + "-opacity" , h ) } ; this . getBlur = function ( e ) { var h = 0 ; if ( e ) if ( e . getAttribute ( "filter" ) ) if ( e = ra ( e . id + "_blur" ) ) h = e . firstChild . getAttribute ( "stdDeviation" ) ;
return h } ; ( function ( ) { function e ( ) { var v = b . undoMgr . finishUndoableChange ( ) ; h . addSubCommand ( v ) ; za ( h ) ; l = h = null } var h = null , l = null , z = false ; b . setBlurNoUndo = function ( v ) { if ( l ) if ( v === 0 ) { Db ( "filter" , "" ) ; z = true } else { var G = I [ 0 ] ; z && Db ( "filter" , "url(#" + G . id + "_blur)" ) ; if ( svgedit . browser . isWebkit ( ) ) { G . removeAttribute ( "filter" ) ; G . setAttribute ( "filter" , "url(#" + G . id + "_blur)" ) } Db ( "stdDeviation" , v , [ l . firstChild ] ) ; b . setBlurOffsets ( l , v ) } else b . setBlur ( v ) } ; b . setBlurOffsets = function ( v , G ) { if ( G > 3 ) ma ( v , { x : "-50%" , y : "-50%" , width : "200%" ,
height : "200%" } , 100 ) ; else if ( ! svgedit . browser . isWebkit ( ) ) { v . removeAttribute ( "x" ) ; v . removeAttribute ( "y" ) ; v . removeAttribute ( "width" ) ; v . removeAttribute ( "height" ) } } ; b . setBlur = function ( v , G ) { if ( h ) e ( ) ; else { var A = I [ 0 ] , u = A . id ; l = ra ( u + "_blur" ) ; v -= 0 ; var F = new Ba ; if ( l ) { if ( v === 0 ) l = null } else { var H = S ( { element : "feGaussianBlur" , attr : { "in" : "SourceGraphic" , stdDeviation : v } } ) ; l = S ( { element : "filter" , attr : { id : u + "_blur" } } ) ; l . appendChild ( H ) ; mb ( ) . appendChild ( l ) ; F . addSubCommand ( new Da ( l ) ) } H = { filter : A . getAttribute ( "filter" ) } ; if ( v ===
0 ) { A . removeAttribute ( "filter" ) ; F . addSubCommand ( new Oa ( A , H ) ) } else { db ( "filter" , "url(#" + u + "_blur)" ) ; F . addSubCommand ( new Oa ( A , H ) ) ; b . setBlurOffsets ( l , v ) ; h = F ; b . undoMgr . beginUndoableChange ( "stdDeviation" , [ l ? l . firstChild : null ] ) ; if ( G ) { b . setBlurNoUndo ( v ) ; e ( ) } } } } } ) ( ) ; this . getBold = function ( ) { var e = I [ 0 ] ; if ( e != null && e . tagName == "text" && I [ 1 ] == null ) return e . getAttribute ( "font-weight" ) == "bold" ; return false } ; this . setBold = function ( e ) { var h = I [ 0 ] ; if ( h != null && h . tagName == "text" && I [ 1 ] == null ) db ( "font-weight" , e ? "bold" : "normal" ) ;
I [ 0 ] . textContent || ib . setCursor ( ) } ; this . getItalic = function ( ) { var e = I [ 0 ] ; if ( e != null && e . tagName == "text" && I [ 1 ] == null ) return e . getAttribute ( "font-style" ) == "italic" ; return false } ; this . setItalic = function ( e ) { var h = I [ 0 ] ; if ( h != null && h . tagName == "text" && I [ 1 ] == null ) db ( "font-style" , e ? "italic" : "normal" ) ; I [ 0 ] . textContent || ib . setCursor ( ) } ; this . getFontFamily = function ( ) { return Ya . font _family } ; this . setFontFamily = function ( e ) { Ya . font _family = e ; db ( "font-family" , e ) ; I [ 0 ] && ! I [ 0 ] . textContent && ib . setCursor ( ) } ; this . setFontColor =
function ( e ) { Ya . fill = e ; db ( "fill" , e ) } ; this . getFontSize = function ( ) { return Ya . fill } ; this . getFontSize = function ( ) { return Ya . font _size } ; this . setFontSize = function ( e ) { Ya . font _size = e ; db ( "font-size" , e ) ; I [ 0 ] . textContent || ib . setCursor ( ) } ; this . getText = function ( ) { var e = I [ 0 ] ; if ( e == null ) return "" ; return e . textContent } ; this . setTextContent = function ( e ) { db ( "#text" , e ) ; ib . init ( e ) ; ib . setCursor ( ) } ; this . setImageURL = function ( e ) { var h = I [ 0 ] ; if ( h ) { var l = $ ( h ) . attr ( [ "width" , "height" ] ) ; l = ! l . width || ! l . height ; var z = da ( h ) ; if ( z !== e ) l =
true ; else if ( ! l ) return ; var v = new Ba ( "Change Image URL" ) ; X ( h , e ) ; v . addSubCommand ( new Oa ( h , { "#href" : z } ) ) ; l ? $ ( new Image ) . load ( function ( ) { var G = $ ( h ) . attr ( [ "width" , "height" ] ) ; $ ( h ) . attr ( { width : this . width , height : this . height } ) ; Ia . requestSelector ( h ) . resize ( ) ; v . addSubCommand ( new Oa ( h , G ) ) ; za ( v ) ; O ( "changed" , [ h ] ) } ) . attr ( "src" , e ) : za ( v ) } } ; this . setLinkURL = function ( e ) { var h = I [ 0 ] ; if ( h ) { if ( h . tagName !== "a" ) { h = $ ( h ) . parents ( "a" ) ; if ( h . length ) h = h [ 0 ] ; else return } var l = da ( h ) ; if ( l !== e ) { var z = new Ba ( "Change Link URL" ) ; X ( h , e ) ;
z . addSubCommand ( new Oa ( h , { "#href" : l } ) ) ; za ( z ) } } } ; this . elementsAreSame = function ( e ) { return ! e . length || e [ 0 ] == null ? null : I . every ( function ( h ) { return h && I [ 0 ] ? h . nodeName == I [ 0 ] . nodeName : null } ) } ; this . setRectRadius = function ( e ) { b . elementsAreSame ( I ) && I [ 0 ] . tagName == "rect" && I . forEach ( function ( h ) { var l = h . getAttribute ( "rx" ) ; if ( l != e ) { h . setAttribute ( "rx" , e ) ; h . setAttribute ( "ry" , e ) ; za ( new Oa ( h , { rx : l , ry : l } , "Radius" ) ) ; O ( "changed" , [ h ] ) } } ) } ; this . makeHyperlink = function ( e ) { b . groupSelectedElements ( "a" , e ) } ; this . removeHyperlink =
function ( ) { b . ungroupSelectedElement ( ) } ; this . setSegType = function ( e ) { Ka . setSegType ( e ) } ; this . convertToPath = function ( e , h ) { if ( e == null ) $ . each ( I , function ( R , Q ) { Q && b . convertToPath ( Q ) } ) ; else { if ( ! h ) var l = new Ba ( "Convert element to Path" ) ; var z = h ? { } : { fill : M . fill , "fill-opacity" : M . fill _opacity , stroke : M . stroke , "stroke-width" : M . stroke _width , "stroke-dasharray" : M . stroke _dasharray , "stroke-linejoin" : M . stroke _linejoin , "stroke-linecap" : M . stroke _linecap , "stroke-opacity" : M . stroke _opacity , opacity : M . opacity , visibility : "hidden" } ;
$ . each ( [ "marker-start" , "marker-end" , "marker-mid" , "filter" , "clip-path" ] , function ( ) { if ( e . getAttribute ( this ) ) z [ this ] = e . getAttribute ( this ) } ) ; var v = S ( { element : "path" , attr : z } ) , G = e . getAttribute ( "transform" ) ; G && v . setAttribute ( "transform" , G ) ; var A = e . id , u = e . parentNode ; e . nextSibling ? u . insertBefore ( v , e ) : u . appendChild ( v ) ; var F = "" , H = function ( R ) { $ . each ( R , function ( Q , V ) { var aa = V [ 1 ] ; F += V [ 0 ] ; for ( var fa = 0 ; fa < aa . length ; fa += 2 ) F += aa [ fa ] + "," + aa [ fa + 1 ] + " " } ) } , D = 1.81 ; switch ( e . tagName ) { case "ellipse" : case "circle" : var E = $ ( e ) . attr ( [ "rx" ,
"ry" , "cx" , "cy" ] ) , L = E . cx , N = E . cy , n = E . rx ; E = E . ry ; if ( e . tagName == "circle" ) n = E = $ ( e ) . attr ( "r" ) ; H ( [ [ "M" , [ L - n , N ] ] , [ "C" , [ L - n , N - E / D , L - n / D , N - E , L , N - E ] ] , [ "C" , [ L + n / D , N - E , L + n , N - E / D , L + n , N ] ] , [ "C" , [ L + n , N + E / D , L + n / D , N + E , L , N + E ] ] , [ "C" , [ L - n / D , N + E , L - n , N + E / D , L - n , N ] ] , [ "Z" , [ ] ] ] ) ; break ; case "path" : F = e . getAttribute ( "d" ) ; break ; case "line" : E = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; F = "M" + E . x1 + "," + E . y1 + "L" + E . x2 + "," + E . y2 ; break ; case "polyline" : case "polygon" : F = "M" + e . getAttribute ( "points" ) ; break ; case "rect" : E = $ ( e ) . attr ( [ "rx" , "ry" ] ) ; n = E . rx ; E =
E . ry ; var w = e . getBBox ( ) ; L = w . x ; N = w . y ; var C = w . width ; w = w . height ; D = 4 - D ; ! n && ! E ? H ( [ [ "M" , [ L , N ] ] , [ "L" , [ L + C , N ] ] , [ "L" , [ L + C , N + w ] ] , [ "L" , [ L , N + w ] ] , [ "L" , [ L , N ] ] , [ "Z" , [ ] ] ] ) : H ( [ [ "M" , [ L , N + E ] ] , [ "C" , [ L , N + E / D , L + n / D , N , L + n , N ] ] , [ "L" , [ L + C - n , N ] ] , [ "C" , [ L + C - n / D , N , L + C , N + E / D , L + C , N + E ] ] , [ "L" , [ L + C , N + w - E ] ] , [ "C" , [ L + C , N + w - E / D , L + C - n / D , N + w , L + C - n , N + w ] ] , [ "L" , [ L + n , N + w ] ] , [ "C" , [ L + n / D , N + w , L , N + w - E / D , L , N + w - E ] ] , [ "L" , [ L , N + E ] ] , [ "Z" , [ ] ] ] ) ; break ; default : v . parentNode . removeChild ( v ) } F && v . setAttribute ( "d" , F ) ; if ( h ) { Ka . resetOrientation ( v ) ; l = false ; try { l =
v . getBBox ( ) } catch ( K ) { } v . parentNode . removeChild ( v ) ; return l } else { if ( G ) { G = Y ( v ) ; qa ( G ) && Ka . resetOrientation ( v ) } l . addSubCommand ( new La ( e , e . nextSibling , u ) ) ; l . addSubCommand ( new Da ( v ) ) ; Qa ( ) ; e . parentNode . removeChild ( e ) ; v . setAttribute ( "id" , A ) ; v . removeAttribute ( "visibility" ) ; wb ( [ v ] , true ) ; za ( l ) } } } ; var Db = this . changeSelectedAttributeNoUndo = function ( e , h , l ) { var z = d . suspendRedraw ( 1E3 ) ; Fa == "pathedit" && Ka . moveNode ( e , h ) ; l = l || I ; for ( var v = l . length , G = [ "g" , "polyline" , "path" ] ; v -- ; ) { var A = l [ v ] ; if ( A != null ) { Fa === "textedit" &&
e !== "#text" && A . textContent . length && ib . toSelectMode ( A ) ; if ( ( e === "x" || e === "y" ) && G . indexOf ( A . tagName ) >= 0 ) { var u = getStrokedBBox ( [ A ] ) ; b . moveSelectedElements ( ( e === "x" ? h - u . x : 0 ) * o , ( e === "y" ? h - u . y : 0 ) * o , true ) } else { u = e === "#text" ? A . textContent : A . getAttribute ( e ) ; if ( u == null ) u = "" ; if ( u !== String ( h ) ) { if ( e == "#text" ) { svgedit . utilities . getBBox ( A ) ; A . textContent = h } else e == "#href" ? X ( A , h ) : A . setAttribute ( e , h ) ; I . indexOf ( A ) >= 0 && setTimeout ( function ( ) { A . parentNode && Ia . requestSelector ( A ) . resize ( ) } , 0 ) ; u = oa ( A ) ; if ( u != 0 && e != "transform" ) for ( var F =
Y ( A ) , H = F . numberOfItems ; H -- ; ) if ( F . getItem ( H ) . type == 4 ) { F . removeItem ( H ) ; var D = svgedit . utilities . getBBox ( A ) , E = P ( D . x + D . width / 2 , D . y + D . height / 2 , ga ( F ) . matrix ) ; D = E . x ; E = E . y ; var L = d . createSVGTransform ( ) ; L . setRotate ( u , D , E ) ; F . insertItemBefore ( L , H ) ; break } } } } } d . unsuspendRedraw ( z ) } , db = this . changeSelectedAttribute = function ( e , h , l ) { l = l || I ; b . undoMgr . beginUndoableChange ( e , l ) ; Db ( e , h , l ) ; e = b . undoMgr . finishUndoableChange ( ) ; e . isEmpty ( ) || za ( e ) } ; this . deleteSelectedElements = function ( ) { for ( var e = new Ba ( "Delete Elements" ) , h = I . length ,
l = [ ] , z = 0 ; z < h ; ++ z ) { var v = I [ z ] ; if ( v == null ) break ; var G = v . parentNode , A = v ; Ia . releaseSelector ( A ) ; svgedit . path . removePath _ ( A . id ) ; if ( G . tagName === "a" && G . childNodes . length === 1 ) { A = G ; G = G . parentNode } var u = A . nextSibling ; A = G . removeChild ( A ) ; l . push ( v ) ; I [ z ] = null ; e . addSubCommand ( new La ( A , u , G ) ) } e . isEmpty ( ) || za ( e ) ; O ( "changed" , l ) ; Qa ( ) } ; this . cutSelectedElements = function ( ) { for ( var e = new Ba ( "Cut Elements" ) , h = I . length , l = [ ] , z = 0 ; z < h ; ++ z ) { var v = I [ z ] ; if ( v == null ) break ; var G = v . parentNode , A = v ; Ia . releaseSelector ( A ) ; svgedit . path . removePath _ ( A . id ) ;
var u = A . nextSibling ; A = G . removeChild ( A ) ; l . push ( v ) ; I [ z ] = null ; e . addSubCommand ( new La ( A , u , G ) ) } e . isEmpty ( ) || za ( e ) ; O ( "changed" , l ) ; Qa ( ) ; b . clipBoard = l } ; this . copySelectedElements = function ( ) { b . clipBoard = $ . merge ( [ ] , I ) } ; this . pasteElements = function ( ) { var e = b . clipBoard , h = e . length ; if ( h ) { for ( var l = [ ] , z = new Ba ( "Paste elements" ) ; h -- ; ) { var v = e [ h ] ; if ( v ) { var G = la ( v ) ; if ( ! ra ( v . id ) ) G . id = v . id ; l . push ( G ) ; ( J || B ( ) . getCurrentLayer ( ) ) . appendChild ( G ) ; z . addSubCommand ( new Da ( G ) ) } } svgCanvas . clearSelection ( ) ; setTimeout ( function ( ) { Bb ( l ) } ,
100 ) ; za ( z ) ; O ( "changed" , l ) } } ; this . groupSelectedElements = function ( e ) { e || ( e = "g" ) ; var h = "" ; switch ( e ) { case "a" : h = "Make hyperlink" ; var l = "" ; if ( arguments . length > 1 ) l = arguments [ 1 ] ; break ; default : e = "g" ; h = "Group Elements" } h = new Ba ( h ) ; var z = S ( { element : e , attr : { id : ja ( ) } } ) ; e === "a" && X ( z , l ) ; h . addSubCommand ( new Da ( z ) ) ; for ( l = I . length ; l -- ; ) { var v = I [ l ] ; if ( v != null ) { if ( v . parentNode . tagName === "a" && v . parentNode . childNodes . length === 1 ) v = v . parentNode ; var G = v . nextSibling , A = v . parentNode ; z . appendChild ( v ) ; h . addSubCommand ( new Ja ( v ,
G , A ) ) } } h . isEmpty ( ) || za ( h ) ; Bb ( [ z ] , true ) } ; var Ib = this . pushGroupProperties = function ( e , h ) { var l = e . childNodes , z = l . length , v = e . getAttribute ( "transform" ) , G = Y ( e ) , A = ga ( G ) . matrix , u = new Ba ( "Push group properties" ) , F = 0 , H = oa ( e ) , D = $ ( e ) . attr ( [ "filter" , "opacity" ] ) , E , L ; for ( F = 0 ; F < z ; F ++ ) { var N = l [ F ] ; if ( N . nodeType === 1 ) { if ( D . opacity !== null && D . opacity !== 1 ) { N . getAttribute ( "opacity" ) ; var n = Math . round ( ( N . getAttribute ( "opacity" ) || 1 ) * D . opacity * 100 ) / 100 ; db ( "opacity" , n , [ N ] ) } if ( D . filter ) { var w = n = this . getBlur ( N ) ; L || ( L = this . getBlur ( e ) ) ;
if ( n ) n = L - 0 + ( n - 0 ) ; else if ( n === 0 ) n = L ; if ( w ) E = T ( N . getAttribute ( "filter" ) ) ; else if ( E ) { E = la ( E ) ; mb ( ) . appendChild ( E ) } else E = T ( D . filter ) ; E . id = N . id + "_" + ( E . firstChild . tagName === "feGaussianBlur" ? "blur" : "filter" ) ; db ( "filter" , "url(#" + E . id + ")" , [ N ] ) ; if ( n ) { db ( "stdDeviation" , n , [ E . firstChild ] ) ; b . setBlurOffsets ( E , n ) } } n = Y ( N ) ; if ( ~ N . tagName . indexOf ( "Gradient" ) ) n = null ; if ( n ) if ( N . tagName !== "defs" ) if ( G . numberOfItems ) { if ( H && G . numberOfItems == 1 ) { var C = G . getItem ( 0 ) . matrix , K = d . createSVGMatrix ( ) ; if ( w = oa ( N ) ) K = n . getItem ( 0 ) . matrix ;
var R = svgedit . utilities . getBBox ( N ) , Q = ga ( n ) . matrix , V = P ( R . x + R . width / 2 , R . y + R . height / 2 , Q ) ; R = H + w ; Q = d . createSVGTransform ( ) ; Q . setRotate ( R , V . x , V . y ) ; C = ia ( C , K , Q . matrix . inverse ( ) ) ; w && n . removeItem ( 0 ) ; if ( R ) n . numberOfItems ? n . insertItemBefore ( Q , 0 ) : n . appendItem ( Q ) ; if ( C . e || C . f ) { w = d . createSVGTransform ( ) ; w . setTranslate ( C . e , C . f ) ; n . numberOfItems ? n . insertItemBefore ( w , 0 ) : n . appendItem ( w ) } } else { w = N . getAttribute ( "transform" ) ; C = { } ; C . transform = w ? w : "" ; w = d . createSVGTransform ( ) ; C = ga ( n ) . matrix ; K = C . inverse ( ) ; C = ia ( K , A , C ) ; w . setMatrix ( C ) ;
n . appendItem ( w ) } ( N = Wa ( N ) ) && u . addSubCommand ( N ) } } } if ( v ) { C = { } ; C . transform = v ; e . setAttribute ( "transform" , "" ) ; e . removeAttribute ( "transform" ) ; u . addSubCommand ( new Oa ( e , C ) ) } if ( h && ! u . isEmpty ( ) ) return u } ; this . ungroupSelectedElement = function ( ) { var e = I [ 0 ] ; if ( $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) ) Fb ( e ) ; else if ( e . tagName === "use" ) { var h = ra ( da ( e ) . substr ( 1 ) ) ; $ ( e ) . data ( "symbol" , h ) . data ( "ref" , h ) ; Fb ( e ) } else { h = $ ( e ) . parents ( "a" ) ; if ( h . length ) e = h [ 0 ] ; if ( e . tagName === "g" || e . tagName === "a" ) { h = new Ba ( "Ungroup Elements" ) ; var l =
Ib ( e , true ) ; l && h . addSubCommand ( l ) ; l = e . parentNode ; for ( var z = e . nextSibling , v = Array ( e . childNodes . length ) , G = 0 ; e . firstChild ; ) { var A = e . firstChild , u = A . nextSibling , F = A . parentNode ; if ( A . tagName === "title" ) { h . addSubCommand ( new La ( A , A . nextSibling , F ) ) ; F . removeChild ( A ) } else { v [ G ++ ] = A = l . insertBefore ( A , z ) ; h . addSubCommand ( new Ja ( A , u , F ) ) } } Qa ( ) ; z = e . nextSibling ; e = l . removeChild ( e ) ; h . addSubCommand ( new La ( e , z , l ) ) ; h . isEmpty ( ) || za ( h ) ; wb ( v ) } } } ; this . moveToTopSelectedElement = function ( ) { var e = I [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode ,
l = e . nextSibling ; e = e . parentNode . appendChild ( e ) ; if ( l != e . nextSibling ) { za ( new Ja ( e , l , h , "top" ) ) ; O ( "changed" , [ e ] ) } } } ; this . moveToBottomSelectedElement = function ( ) { var e = I [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode , l = e . nextSibling , z = e . parentNode . firstChild ; if ( z . tagName == "title" ) z = z . nextSibling ; if ( z . tagName == "defs" ) z = z . nextSibling ; e = e . parentNode . insertBefore ( e , z ) ; if ( l != e . nextSibling ) { za ( new Ja ( e , l , h , "bottom" ) ) ; O ( "changed" , [ e ] ) } } } ; this . moveUpDownSelected = function ( e ) { var h = I [ 0 ] ; if ( h ) { nb = [ ] ; var l , z , v = $ ( ub ( getStrokedBBox ( [ h ] ) ) ) . toArray ( ) ;
e == "Down" && v . reverse ( ) ; $ . each ( v , function ( ) { if ( z ) { l = this ; return false } else if ( this == h ) z = true } ) ; if ( l ) { v = h . parentNode ; var G = h . nextSibling ; $ ( l ) [ e == "Down" ? "before" : "after" ] ( h ) ; if ( G != h . nextSibling ) { za ( new Ja ( h , G , v , "Move " + e ) ) ; O ( "changed" , [ h ] ) } } } } ; this . moveSelectedElements = function ( e , h , l ) { if ( e . constructor != Array ) { e /= o ; h /= o } l = l || true ; for ( var z = new Ba ( "position" ) , v = I . length ; v -- ; ) { var G = I [ v ] ; if ( G != null ) { var A = d . createSVGTransform ( ) , u = Y ( G ) ; e . constructor == Array ? A . setTranslate ( e [ v ] , h [ v ] ) : A . setTranslate ( e , h ) ; u . numberOfItems ?
u . insertItemBefore ( A , 0 ) : u . appendItem ( A ) ; ( A = Wa ( G ) ) && z . addSubCommand ( A ) ; Ia . requestSelector ( G ) . resize ( ) } } if ( ! z . isEmpty ( ) ) { l && za ( z ) ; O ( "changed" , I ) ; return z } } ; this . cloneSelectedElements = function ( e , h , l ) { for ( var z = new Ba ( "Clone Elements" ) , v = I . length , G = 0 ; G < v ; ++ G ) if ( I [ G ] == null ) break ; v = I . slice ( 0 , G ) ; this . clearSelection ( true ) ; for ( G = v . length ; G -- ; ) { var A = la ( v [ G ] ) ; l && A . setAttribute ( "transform" , "" ) ; ( J || B ( ) . getCurrentLayer ( ) ) . appendChild ( A ) ; z . addSubCommand ( new Da ( A ) ) } if ( ! z . isEmpty ( ) ) { wb ( v . reverse ( ) ) ; this . moveSelectedElements ( e ,
h , false ) ; za ( z ) } return A } ; this . alignSelectedElements = function ( e , h ) { var l = [ ] , z = Number . MAX _VALUE , v = Number . MIN _VALUE , G = Number . MAX _VALUE , A = Number . MIN _VALUE , u = Number . MIN _VALUE , F = Number . MIN _VALUE , H = I . length ; if ( H ) { for ( var D = 0 ; D < H ; ++ D ) { if ( I [ D ] == null ) break ; l [ D ] = getStrokedBBox ( [ I [ D ] ] ) ; switch ( h ) { case "smallest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( u == Number . MIN _VALUE || u > l [ D ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( F == Number . MIN _VALUE || F > l [ D ] . height ) ) { z = l [ D ] . x ; G = l [ D ] . y ; v = l [ D ] . x + l [ D ] . width ; A = l [ D ] . y + l [ D ] . height ; u = l [ D ] . width ;
F = l [ D ] . height } break ; case "largest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( u == Number . MIN _VALUE || u < l [ D ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( F == Number . MIN _VALUE || F < l [ D ] . height ) ) { z = l [ D ] . x ; G = l [ D ] . y ; v = l [ D ] . x + l [ D ] . width ; A = l [ D ] . y + l [ D ] . height ; u = l [ D ] . width ; F = l [ D ] . height } break ; default : if ( l [ D ] . x < z ) z = l [ D ] . x ; if ( l [ D ] . y < G ) G = l [ D ] . y ; if ( l [ D ] . x + l [ D ] . width > v ) v = l [ D ] . x + l [ D ] . width ; if ( l [ D ] . y + l [ D ] . height > A ) A = l [ D ] . y + l [ D ] . height } } if ( h == "page" ) { G = z = 0 ; v = b . contentW ; A = b . contentH } u = Array ( H ) ; F = Array ( H ) ; for ( D = 0 ; D < H ; ++ D ) { if ( I [ D ] == null ) break ;
var E = l [ D ] ; u [ D ] = 0 ; F [ D ] = 0 ; switch ( e ) { case "l" : u [ D ] = z - E . x ; break ; case "c" : u [ D ] = ( z + v ) / 2 - ( E . x + E . width / 2 ) ; break ; case "r" : u [ D ] = v - ( E . x + E . width ) ; break ; case "t" : F [ D ] = G - E . y ; break ; case "m" : F [ D ] = ( G + A ) / 2 - ( E . y + E . height / 2 ) ; break ; case "b" : F [ D ] = A - ( E . y + E . height ) } } this . moveSelectedElements ( u , F ) } } ; this . contentW = Eb ( ) . w ; this . contentH = Eb ( ) . h ; this . updateCanvas = function ( e , h ) { d . setAttribute ( "width" , e ) ; d . setAttribute ( "height" , h ) ; var l = $ ( "#canvasBackground" ) [ 0 ] , z = k . getAttribute ( "x" ) , v = k . getAttribute ( "y" ) , G = e / 2 - this . contentW * o /
2 , A = h / 2 - this . contentH * o / 2 ; ma ( k , { width : this . contentW * o , height : this . contentH * o , x : G , y : A , viewBox : "0 0 " + this . contentW + " " + this . contentH } ) ; ma ( l , { width : k . getAttribute ( "width" ) , height : k . getAttribute ( "height" ) , x : G , y : A } ) ; ( l = ra ( "background_image" ) ) && ma ( l , { width : "100%" , height : "100%" } ) ; Ia . selectorParentGroup . setAttribute ( "transform" , "translate(" + G + "," + A + ")" ) ; return { x : G , y : A , old _x : z , old _y : v , d _x : G - z , d _y : A - v } } ; this . setBackground = function ( e , h ) { var l = ra ( "canvasBackground" ) , z = $ ( l ) . find ( "rect" ) [ 0 ] , v = ra ( "background_image" ) ;
z . setAttribute ( "fill" , e ) ; if ( h ) { if ( ! v ) { v = f . createElementNS ( c , "image" ) ; ma ( v , { id : "background_image" , width : "100%" , height : "100%" , preserveAspectRatio : "xMinYMin" , style : "pointer-events:none" } ) } X ( v , h ) ; l . appendChild ( v ) } else v && v . parentNode . removeChild ( v ) } ; this . cycleElement = function ( e ) { var h = I [ 0 ] , l = false , z = vb ( J || B ( ) . getCurrentLayer ( ) ) ; if ( z . length ) { if ( h == null ) { e = e ? z . length - 1 : 0 ; l = z [ e ] } else for ( var v = z . length ; v -- ; ) if ( z [ v ] == h ) { e = e ? v - 1 : v + 1 ; if ( e >= z . length ) e = 0 ; else if ( e < 0 ) e = z . length - 1 ; l = z [ e ] ; break } Bb ( [ l ] , true ) ; O ( "selected" ,
I ) } } ; this . clear ( ) ; this . getPrivateMethods = function ( ) { return { addCommandToHistory : za , setGradient : Rb , addSvgElementFromJson : S , assignAttributes : ma , BatchCommand : Ba , call : O , ChangeElementCommand : Oa , copyElem : la , ffClone : ea , findDefs : mb , findDuplicateGradient : Qb , getElem : ra , getId : ca , getIntersectionList : ub , getMouseTarget : Kb , getNextId : ja , getPathBBox : Z , getUrlFromAttr : ka , hasMatrixTransform : qa , identifyLayers : Gb , InsertElementCommand : Da , isIdentity : svgedit . math . isIdentity , logMatrix : Xa , matrixMultiply : ia , MoveElementCommand : Ja ,
preventClickDefault : qb , recalculateAllSelectedDimensions : Ha , recalculateDimensions : Wa , remapElement : fb , RemoveElementCommand : La , removeUnusedDefElems : Mb , round : gb , runExtensions : pb , sanitizeSvg : Ga , SVGEditTransformList : svgedit . transformlist . SVGTransformList , toString : toString , transformBox : svgedit . math . transformBox , transformListToTransform : ga , transformPoint : P , walkTree : svgedit . utilities . walkTree } } } ; ( function ( ) { document . addEventListener ( "touchstart" , touchHandler , true ) ; document . addEventListener ( "touchmove" , touchHandler , true ) ; document . addEventListener ( "touchend" , touchHandler , true ) ; document . addEventListener ( "touchcancel" , touchHandler , true ) ; if ( ! window . svgEditor ) window . svgEditor = function ( a ) { function p ( d , k ) { var q = g . setSvgString ( d ) !== false ; k = k || a . noop ; q ? k ( true ) : a . alert ( uiStrings . notification . errorLoadingSVG , function ( ) { k ( false ) } ) } var g , c = { } , m = false ; curConfig = { canvas _expansion : 1 , dimensions : [ 580 , 400 ] ,
2012-07-25 10:27:26 +00:00
initFill : { color : "fff" , opacity : 1 } , initStroke : { width : 1.5 , color : "000" , opacity : 1 } , initOpacity : 1 , imgPath : "images/" , extPath : "extensions/" , jGraduatePath : "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" } ; uiStrings = c . uiStrings = { common : { ok : "OK" , cancel : "Cancel" , key _up : "Up" ,
key _down : "Down" , key _backspace : "Backspace" , key _del : "Del" } , layers : { layer : "Layer" } , notification : { invalidAttrValGiven : "Invalid value given" , noContentToFitTo : "No content to fit to" , dupeLayerName : "There is already a layer named that!" , enterUniqueLayerName : "Please enter a unique layer name" , enterNewLayerName : "Please enter the new layer name" , layerHasThatName : "Layer already has that name" , QmoveElemsToLayer : 'Move selected elements to layer "%s"?' , QwantToClear : "Do you want to clear the drawing?\nThis will also erase your undo history!" ,
2012-07-19 14:54:50 +00:00
QwantToOpen : "Do you want to open a new file?\nThis will also erase your undo history!" , QerrorsRevertToSource : "There were parsing errors in your SVG source.\nRevert back to original SVG source?" , QignoreSourceChanges : "Ignore changes made to SVG source?" , featNotSupported : "Feature not supported" , enterNewImgURL : "Enter the new image URL" , defsFailOnSave : "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved." , loadingImage : "Loading image, please wait..." ,
2012-07-25 08:56:15 +00:00
saveFromBrowser : 'Select "Save As..." in your browser to save this image as a %s file.' , noteTheseIssues : "Also note the following issues: " , unsavedChanges : "There are unsaved changes." , enterNewLinkURL : "Enter the new hyperlink URL" , errorLoadingSVG : "Error: Unable to load SVG data" , URLloadFail : "Unable to load from URL" , retrieving : 'Retrieving "%s" ...' } } ; var s = { } , b = { } ; c . curConfig = curConfig ; c . tool _scale = 1 ; c . setConfig = function ( d ) { a . each ( d , function ( k , q ) { k in defaultPrefs && a . pref ( k , q ) } ) ; a . extend ( true , curConfig ,
d ) ; if ( d . extensions ) curConfig . extensions = d . extensions } ; c . setCustomHandlers = function ( d ) { c . ready ( function ( ) { if ( d . open ) { a ( '#tool_open > input[type="file"]' ) . remove ( ) ; a ( "#tool_open" ) . show ( ) ; g . open = d . open } if ( d . save ) { c . show _save _warning = false ; g . bind ( "saved" , d . save ) } d . pngsave && g . bind ( "exported" , d . pngsave ) ; b = d } ) } ; c . randomizeIds = function ( ) { g . randomizeIds ( arguments ) } ; c . init = function ( ) { function d ( n , w ) { var C = n . id , K = C . split ( "_" ) , R = K [ 0 ] ; K = K [ 1 ] ; w && g . setStrokeAttr ( "stroke-" + R , K ) ; rb ( ) ; db ( "#cur_" + R , C , 20 ) ; a ( n ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) }
function k ( n , w ) { var C = document . getElementById ( "ruler_x_cursor" ) , K = document . getElementById ( "ruler_y_cursor" ) , R = document . getElementById ( "workarea" ) ; document . getElementById ( "title_show" ) ; svgedit . browser . isTouch ( ) && a ( "#workarea" ) . unbind ( "mousemove.rulers" ) . bind ( "mousemove.rulers" , function ( Tb ) { Tb . stopPropagation ( ) ; C . style . left = Tb . pageX - 66 + R . scrollLeft + "px" ; K . style . top = Tb . pageY - 48 + R . scrollTop + "px" } ) ; w || ( w = g . getZoom ( ) ) ; n || ( n = a ( "#svgcanvas" ) ) ; for ( var Q = g . getContentElem ( ) , V = svgedit . units . getTypeMap ( ) [ curConfig . baseUnit ] ,
aa = 0 ; aa < 2 ; aa ++ ) { var fa = aa === 0 , pa = fa ? "x" : "y" , sa = fa ? "width" : "height" , Za = Q . getAttribute ( pa ) - 0 ; pa = a ( "#ruler_" + pa + " canvas:first" ) ; $hcanv = pa . clone ( ) ; pa . replaceWith ( $hcanv ) ; var Aa = $hcanv [ 0 ] ; var ha = pa = n [ sa ] ( ) * 2 ; Aa . parentNode . style [ sa ] = ha + "px" ; var eb = 0 , Ra , va = Aa . getContext ( "2d" ) ; va . fillStyle = "rgb(200,0,0)" ; va . fillRect ( 0 , 0 , Aa . width , Aa . height ) ; $hcanv . siblings ( ) . remove ( ) ; if ( pa >= 3E4 ) { var Na = parseInt ( pa / 3E4 ) + 1 ; Ra = Array ( Na ) ; Ra [ 0 ] = va ; for ( var ya = 1 ; ya < Na ; ya ++ ) { Aa [ sa ] = 3E4 ; var ab = Aa . cloneNode ( true ) ; Aa . parentNode . appendChild ( ab ) ;
Ra [ ya ] = ab . getContext ( "2d" ) } ab [ sa ] = pa % 3E4 ; pa = 3E4 } Aa [ sa ] = pa ; sa = V * w ; var Va = 50 / sa ; Aa = 1 ; for ( ya = 0 ; ya < D . length ; ya ++ ) { Aa = Na = D [ ya ] ; if ( Va <= Na ) break } Va = Aa * sa ; va . font = "normal 9px 'Lucida Grande', sans-serif" ; va . fillStyle = "#777" ; for ( var cb = Za / sa % Aa * sa , Jb = cb - Va ; cb < ha ; cb += Va ) { Jb += Va ; ya = Math . round ( cb ) + 0.5 ; if ( fa ) { va . moveTo ( ya , 15 ) ; va . lineTo ( ya , 0 ) } else { va . moveTo ( 15 , ya ) ; va . lineTo ( 0 , ya ) } Na = ( Jb - Za ) / sa ; if ( Aa >= 1 ) ya = Math . round ( Na ) ; else { ya = ( Aa + "" ) . split ( "." ) [ 1 ] . length ; ya = Na . toFixed ( ya ) - 0 } if ( ya !== 0 && ya !== 1E3 && ya % 1E3 === 0 ) ya =
ya / 1E3 + "K" ; if ( fa ) { va . fillText ( ya , cb + 2 , 8 ) ; va . fillStyle = "#777" } else { Na = ( ya + "" ) . split ( "" ) ; for ( ya = 0 ; ya < Na . length ; ya ++ ) { va . fillText ( Na [ ya ] , 1 , cb + 9 + ya * 9 ) ; va . fillStyle = "#777" } } Na = Va / 10 ; for ( ya = 1 ; ya < 10 ; ya ++ ) { var yb = Math . round ( cb + Na * ya ) + 0.5 ; if ( Ra && yb > pa ) { eb ++ ; va . stroke ( ) ; if ( eb >= Ra . length ) { ya = 10 ; cb = ha ; continue } va = Ra [ eb ] ; cb -= 3E4 ; yb = Math . round ( cb + Na * ya ) + 0.5 } var Hb = ya % 2 ? 12 : 10 ; if ( fa ) { va . moveTo ( yb , 15 ) ; va . lineTo ( yb , Hb ) } else { va . moveTo ( 15 , yb ) ; va . lineTo ( Hb , yb ) } } } va . strokeStyle = "#666" ; va . stroke ( ) } } ( function ( ) { var n = window . opener ;
if ( n ) try { var w = n . document . createEvent ( "Event" ) ; w . initEvent ( "svgEditorReady" , true , true ) ; n . document . documentElement . dispatchEvent ( w ) } catch ( C ) { } } ) ( ) ; ( function ( ) { a ( "#canvas_width" ) . val ( curConfig . dimensions [ 0 ] ) ; a ( "#canvas_height" ) . val ( curConfig . dimensions [ 1 ] ) ; a ( "body" ) . toggleClass ( "touch" , svgedit . browser . isTouch ( ) ) ; var n = a . deparam . querystring ( true ) ; if ( ! a . isEmptyObject ( n ) ) { if ( n . dimensions ) n . dimensions = n . dimensions . split ( "," ) ; if ( n . extensions ) n . extensions = n . extensions . split ( "," ) ; if ( n . bkgd _color ) n . bkgd _color =
"#" + n . bkgd _color ; svgEditor . setConfig ( n ) ; var w = n . source , C = a . param . querystring ( ) ; if ( ! w ) if ( C . indexOf ( "source=data:" ) >= 0 ) w = C . match ( /source=(data:[^&]*)/ ) [ 1 ] ; if ( w ) if ( w . indexOf ( "data:" ) === 0 ) { w = w . replace ( / /g , "+" ) ; c . loadFromDataURI ( w ) } else c . loadFromString ( w ) ; else if ( C . indexOf ( "paramurl=" ) !== - 1 ) svgEditor . loadFromURL ( C . substr ( 9 ) ) ; else n . url && svgEditor . loadFromURL ( n . url ) } } ) ( ) ; var q = function ( ) { a . each ( curConfig . extensions , function ( ) { var n = this ; a . getScript ( curConfig . extPath + n , function ( w ) { if ( ! w ) { w = document . createElement ( "script" ) ;
w . src = curConfig . extPath + n ; document . querySelector ( "head" ) . appendChild ( w ) } } ) } ) } ; document . location . protocol === "file:" ? setTimeout ( q , 100 ) : q ( ) ; a . svgIcons ( curConfig . imgPath + "svg_edit_icons.svg" , { w : 27 , h : 27 , id _match : false , no _img : ! svgedit . browser . isWebkit ( ) , fallback _path : curConfig . imgPath , fallback : { logo : "logo.png" , select : "select.png" , select _node : "select_node.png" , pencil : "fhpath.png" , pen : "line.png" , square : "square.png" , rect : "rect.png" , fh _rect : "freehand-square.png" , circle : "circle.png" , ellipse : "ellipse.png" , fh _ellipse : "freehand-circle.png" ,
2012-07-24 02:30:12 +00:00
path : "path.png" , text : "text.png" , image : "image.png" , zoom : "zoom.png" , "delete" : "delete.png" , node _delete : "node_delete.png" , align _left : "align-left.png" , align _center : "align-center" , align _right : "align-right" , align _top : "align-top" , align _middle : "align-middle" , align _bottom : "align-bottom" , 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_square" : "square" , "#tool_fhrect" : "fh_rect" ,
"#tool_ellipse,#tools_ellipse_show" : "ellipse" , "#tool_circle" : "circle" , "#tool_fhellipse" : "fh_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" ,
2012-07-25 06:32:18 +00:00
"#tool_alignmiddle, #tool_posmiddle" : "align_middle" , "#tool_alignbottom, #tool_posbottom" : "align_bottom" , "#cur_position" : "align" , "#zoomLabel" : "zoom" , "#palette .palette_item:first, #fill_bg, #stroke_bg" : "no_color" } , 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 ) } ) ;
2012-07-25 08:56:15 +00:00
a ( ".tool_button, .tool_button_current" ) . addClass ( "loaded" ) ; var n = a ( "#tools_left" ) ; if ( n . length != 0 ) { n . offset ( ) ; n . outerHeight ( ) } a ( ".tools_flyout" ) . each ( function ( ) { var w = a ( "#" + this . id + "_show" ) , C = w . attr ( "data-curopt" ) ; if ( ! w . children ( "svg, img" ) . length ) { C = a ( C ) . children ( ) . clone ( ) ; if ( C . length ) { C [ 0 ] . removeAttribute ( "style" ) ; w . append ( C ) } } } ) ; svgEditor . 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 ( n ) { a ( "#base_unit_container" ) . css ( { top : n . pageY - 10 , left : n . 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 = g = new a . SvgCanvas ( document . getElementById ( "svgcanvas" ) , curConfig ) ; c . show _save _warning = false ; c . paintBox = { fill : null , stroke : null , canvas : null } ; q = navigator . platform . indexOf ( "Mac" ) >=
0 ; var B = navigator . userAgent . indexOf ( "AppleWebKit" ) >= 0 , o = q ? "meta+" : "ctrl+" , J = g . pathActions , U = g . undoMgr , M = svgedit . utilities , I = curConfig . imgPath + "placeholder.svg" , S = a ( "#workarea" ) , Y = a ( "#cmenu_canvas" ) , P = null , ia = 1 , qa = "toolbars" , ga = "" ; q || a ( ".shortcut" ) . each ( function ( ) { var n = a ( this ) . text ( ) ; a ( this ) . text ( n . split ( "\u2318" ) . join ( "Ctrl+" ) ) } ) ; ( function ( ) { a ( "#dialog_container" ) . draggable ( { cancel : "#dialog_content, #dialog_buttons *" , containment : "window" } ) ; var n = a ( "#dialog_box" ) , w = a ( "#dialog_buttons" ) , C = function ( K ,
R , Q , V ) { a ( "#dialog_content" ) . html ( "<p>" + R . replace ( /\n/g , "</p><p>" ) + "</p>" ) . toggleClass ( "prompt" , K == "prompt" ) ; w . empty ( ) ; var aa = a ( '<input type="button" value="' + uiStrings . common . ok + '">' ) . appendTo ( w ) ; K != "alert" && a ( '<input type="button" value="' + uiStrings . common . cancel + '">' ) . appendTo ( w ) . on ( "click, touchstart" , function ( ) { n . hide ( ) ; Q ( false ) } ) ; if ( K == "prompt" ) { var fa = a ( '<input type="text">' ) . prependTo ( w ) ; fa . val ( V || "" ) ; fa . bind ( "keydown" , "return" , function ( ) { aa . trigger ( "click touchstart" ) } ) } K == "process" && aa . hide ( ) ;
n . show ( ) ; aa . on ( "click touchstart" , function ( ) { n . hide ( ) ; var pa = K == "prompt" ? fa . val ( ) : true ; Q && Q ( pa ) } ) . focus ( ) ; K == "prompt" && fa . focus ( ) } ; a . alert = function ( K , R ) { C ( "alert" , K , R ) } ; a . confirm = function ( K , R ) { C ( "confirm" , K , R ) } ; a . process _cancel = function ( K , R ) { C ( "process" , K , R ) } ; a . prompt = function ( K , R , Q ) { C ( "prompt" , K , Q , R ) } } ) ( ) ; var ba = function ( ) { var n = a ( ".tool_button_current" ) ; if ( n . length && n [ 0 ] . id !== "tool_select" ) { n . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) } g . setMode ( "select" ) } ,
W = null , ta = false , ka = false , da = "" , X = function ( n , w ) { var C = g . getResolution ( ) ; a ( "#svgcanvas" ) . position ( ) ; var K = g . setBBoxZoom ( w , S . width ( ) - 15 , S . height ( ) - 15 ) ; if ( K ) { var R = K . zoom ; K = K . bbox ; if ( R < 0.0010 ) xa ( { value : 0.1 } ) ; else { var Q = Date . now ( ) , V = R - C . zoom ; a ( "#zoom" ) ; var aa = C . zoom , fa = function ( pa ) { pa = ( pa - Q ) / 500 ; pa = Math . pow ( pa - 1 , 3 ) + 1 ; g . setZoom ( aa + V * pa ) ; H ( ) ; pa < 1 ? requestAnimationFrame ( fa ) : a ( "#zoom" ) . val ( R * 100 ) } ; fa ( Date . now ( ) ) ; g . getMode ( ) == "zoom" && K . width && ba ( ) ; mb ( ) } } } ; a ( "#cur_context_panel" ) . delegate ( "a" , "click" , function ( ) { var n =
a ( this ) ; n . attr ( "data-root" ) ? g . leaveContext ( ) : g . setContext ( n . text ( ) ) ; return false } ) ; var Z = function ( ) { c . paintBox . fill . prep ( ) ; c . paintBox . stroke . prep ( ) } , oa = { } , ra = function ( n ) { a . each ( n , function ( w , C ) { var K = a ( w ) . children ( ) , R = w + "_show" , Q = a ( R ) , V = false ; K . addClass ( "tool_button" ) . unbind ( "click mousedown mouseup" ) . each ( function ( pa ) { var sa = C [ pa ] ; oa [ sa . sel ] = sa . fn ; if ( sa . isDefault ) V = pa ; pa = function ( Za ) { var Aa = sa ; if ( Za . type === "keydown" ) { var ha = a ( Aa . parent + "_show" ) . hasClass ( "tool_button_current" ) , eb = a ( Aa . parent + "_show" ) . attr ( "data-curopt" ) ;
a . each ( n [ sa . parent ] , function ( va , Na ) { if ( Na . sel == eb ) Aa = ! Za . shiftKey || ! ha ? Na : n [ sa . parent ] [ va + 1 ] || n [ sa . parent ] [ 0 ] } ) } if ( a ( this ) . hasClass ( "disabled" ) ) return false ; $a ( R ) && Aa . fn ( ) ; var Ra = Aa . icon ? a . getSvgIcon ( Aa . icon , true ) : a ( Aa . sel ) . children ( ) . eq ( 0 ) . clone ( ) ; Ra [ 0 ] . setAttribute ( "width" , Q . width ( ) ) ; Ra [ 0 ] . setAttribute ( "height" , Q . height ( ) ) ; Q . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; Q . append ( Ra ) . attr ( "data-curopt" , Aa . sel ) } ; a ( this ) . mouseup ( pa ) ; sa . key && a ( document ) . bind ( "keydown" , sa . key [ 0 ] + " shift+" + sa . key [ 0 ] ,
pa ) } ) ; if ( V ) Q . attr ( "data-curopt" , C [ V ] . sel ) ; else Q . attr ( "data-curopt" ) || Q . attr ( "data-curopt" , C [ 0 ] . sel ) ; var aa , fa = a ( R ) . position ( ) ; a ( w ) . css ( { left : fa . left + 34 , top : fa . top + 77 } ) ; Q . mousedown ( function ( pa ) { a ( "#tools_shapelib" ) . is ( ":visible" ) && $a ( R , false ) ; if ( Q . hasClass ( "disabled" ) ) return false ; var sa = a ( w ) , Za = fa . left + 34 , Aa = sa . width ( ) * - 1 , ha = sa . data ( "shown_popop" ) ? 200 : 0 ; aa = setTimeout ( function ( ) { Q . data ( "isLibrary" ) ? sa . css ( "left" , Za ) . show ( ) : sa . css ( "left" , Aa ) . show ( ) . animate ( { left : Za } , 150 ) ; sa . data ( "shown_popop" , true ) } ,
ha ) ; pa . preventDefault ( ) } ) . mouseup ( function ( ) { clearTimeout ( aa ) ; var pa = a ( this ) . attr ( "data-curopt" ) ; if ( Q . data ( "isLibrary" ) && a ( R . replace ( "_show" , "" ) ) . is ( ":visible" ) ) $a ( R , true ) ; else $a ( R ) && pa in oa && oa [ pa ] ( ) } ) } ) ; Ca ( ) } , ma = function ( n , w ) { return a ( "<div>" , { "class" : "tools_flyout" , id : n } ) . appendTo ( "#svg_editor" ) . append ( w ) } , na = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var n = a ( "#" + this . id + "_show" ) , w = n . offset ( ) ; n = n . outerWidth ( ) ; a ( this ) . css ( { left : ( w . left + n ) * ia , top : w . top } ) } ) } , Ca = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var n =
a ( "#" + this . id + "_show" ) ; if ( ! n . data ( "isLibrary" ) ) { var w = [ ] ; a ( this ) . children ( ) . each ( function ( ) { w . push ( this . title ) } ) ; n [ 0 ] . title = w . join ( " / " ) } } ) } , Ga , Ja = function ( n , w , C ) { var K = null ; if ( n . indexOf ( "url(#" ) === 0 ) { n = ( n = g . getRefElem ( n ) ) ? n . cloneNode ( true ) : a ( "#" + C + "_color defs *" ) [ 0 ] ; K = { alpha : w } ; K [ n . tagName ] = n } else K = n . indexOf ( "#" ) === 0 ? { alpha : w , solidColor : n . substr ( 1 ) } : { alpha : w , solidColor : "none" } ; return new a . jGraduate . Paint ( K ) } , Da = g . getResolution ( ) ; if ( curConfig . baseUnit !== "px" ) { Da . w = svgedit . units . convertUnit ( Da . w ) +
curConfig . baseUnit ; Da . h = svgedit . units . convertUnit ( Da . h ) + curConfig . baseUnit } var La = function ( n ) { g . createLayer ( "background" ) ; cur _shape = g . addSvgElementFromJson ( { element : "rect" , attr : { x : - 1 , y : - 1 , width : Da . w + 2 , height : Da . h + 2 , stroke : "none" , id : "canvas_background" , opacity : 1 , fill : n || "#fff" , style : "pointer-events:none" } } ) ; g . setCurrentLayer ( "Layer 1" ) ; g . setCurrentLayerPosition ( "1" ) } ; document . getElementById ( "canvas_background" ) || La ( ) ; document . getElementById ( "canvas_background" ) . getAttribute ( "fill" ) ; var Oa = c . setImageURL =
function ( n ) { n || ( n = I ) ; g . setImageURL ( n ) ; a ( "#image_url" ) . val ( n ) } , Ba = function ( ) { var n = W ; if ( n != null && ! n . parentNode ) n = null ; if ( ta && ta [ 0 ] != null && ! ta [ 0 ] . parentNode ) ta = false ; var w = g . getCurrentDrawing ( ) . getCurrentLayerName ( ) , C = g . getMode ( ) , K = curConfig . baseUnit !== "px" ? curConfig . baseUnit : null , R = C == "pathedit" , Q = a ( "#cmenu_canvas li" ) ; a ( ".context_panel" ) . hide ( ) ; a ( ".menu_item" , "#edit_menu" ) . addClass ( "disabled" ) ; a ( ".menu_item" , "#object_menu" ) . addClass ( "disabled" ) ; if ( ta ) ( n = g . elementsAreSame ( ta ) ? ta [ 0 ] : null ) && a ( "#tools_top" ) . addClass ( "multiselected" ) ;
if ( ! n && ! ta ) { a ( "#tools_top" ) . removeClass ( "multiselected" ) ; a ( "#stroke_panel" ) . hide ( ) ; a ( "#canvas_panel" ) . show ( ) } if ( n != null ) { a ( "#stroke_panel" ) . show ( ) ; var V = n . nodeName , aa = g . getRotationAngle ( n ) ; a ( "#angle" ) . val ( Math . round ( aa ) ) ; aa = g . getBlur ( n ) ; a ( "#blur" ) . val ( aa ) ; if ( ! R && C != "pathedit" ) { a ( "#selected_panel" ) . show ( ) ; a ( ".action_selected" ) . removeClass ( "disabled" ) ; var fa , pa ; if ( [ "g" , "polyline" , "path" ] . indexOf ( V ) >= 0 ) if ( C = g . getStrokedBBox ( [ n ] ) ) { fa = C . x ; pa = C . y } if ( K ) { fa = svgedit . units . convertUnit ( fa ) ; pa = svgedit . units . convertUnit ( pa ) } a ( "#" +
V + "_x" ) . val ( Math . round ( fa ) ) ; a ( "#" + V + "_y" ) . val ( Math . round ( pa ) ) ; [ "image" , "text" , "path" , "g" , "use" ] . indexOf ( V ) == - 1 && a ( ".action_path_convert_selected" ) . removeClass ( "disabled" ) ; V === "path" && a ( ".action_path_selected" ) . removeClass ( "disabled" ) } else { w = J . getNodePoint ( ) ; a ( "#tool_add_subpath" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#tool_node_delete" ) . toggleClass ( "disabled" , ! J . canDeleteNodes ) ; db ( "#tool_openclose_path" , J . closed _subpath ? "open_path" : "close_path" ) ; if ( w ) { R = a ( "#seg_type" ) ; if ( K ) { w . x =
svgedit . units . convertUnit ( w . x ) ; w . y = svgedit . units . convertUnit ( w . y ) } a ( "#path_node_x" ) . val ( Math . round ( w . x ) ) ; a ( "#path_node_y" ) . val ( Math . round ( w . y ) ) ; w . type ? R . val ( w . type ) . removeAttr ( "disabled" ) : R . val ( 4 ) . attr ( "disabled" , "disabled" ) } return } K = null ; if ( sa === "a" ) { K = g . getHref ( n ) ; a ( "#g_panel" ) . show ( ) } if ( n . parentNode . tagName === "a" ) if ( ! a ( n ) . siblings ( ) . length ) { a ( "#a_panel" ) . show ( ) ; K = g . getHref ( n . parentNode ) } a ( "#tool_make_link, #tool_make_link" ) . toggle ( ! K ) ; K && a ( "#link_url" ) . val ( K ) ; K = { 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 : [ ] } ; var sa = n . tagName ; a ( n ) . data ( "gsvg" ) && a ( "#g_panel" ) . show ( ) ; sa == "path" && a ( "#path_panel" ) . show ( ) ; if ( K [ sa ] ) { K = K [ sa ] ; a ( "#" + sa + "_panel" ) . show ( ) ; sa == "rect" ? a ( "#cornerRadiusLabel" ) . show ( ) : a ( "#cornerRadiusLabel" ) . hide ( ) ; a . each ( K , function ( Za , Aa ) { var ha = n . getAttribute ( Aa ) ; if ( curConfig . baseUnit !== "px" && n [ Aa ] ) ha = svgedit . units . convertUnit ( n [ Aa ] . baseVal . value ) ; var eb = document . getElementById ( sa +
"_" + Aa ) ; eb . value = Math . round ( ha ) || 0 ; eb . getAttribute ( "data-cursor" ) === "true" && a . fn . dragInput . updateCursor ( eb ) } ) ; if ( sa == "text" ) { a ( "#text_panel" ) . css ( "display" , "inline" ) ; g . getItalic ( ) ? a ( "#tool_italic" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : a ( "#tool_italic" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; g . getBold ( ) ? a ( "#tool_bold" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : a ( "#tool_bold" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#font_family" ) . val ( n . getAttribute ( "font-family" ) ) ;
a ( "#font_size" ) . val ( n . getAttribute ( "font-size" ) ) ; a ( "#text" ) . val ( n . textContent ) ; g . addedNew && setTimeout ( function ( ) { a ( "#text" ) . focus ( ) . select ( ) } , 100 ) } else if ( sa == "image" ) Oa ( g . getHref ( n ) ) ; else if ( sa === "g" || sa === "use" ) { a ( "#container_panel" ) . show ( ) ; a ( ".action_group_selected" ) . removeClass ( "disabled" ) ; g . getTitle ( ) } } Q [ ( sa === "g" ? "en" : "dis" ) + "ableContextMenuItems" ] ( "#ungroup" ) ; Q [ ( sa === "g" || ! ta ? "dis" : "en" ) + "ableContextMenuItems" ] ( "#group" ) } else if ( ta ) { a ( "#multiselected_panel" ) . show ( ) ; a ( ".action_multi_selected" ) . removeClass ( "disabled" ) ;
Q . enableContextMenuItems ( "#group" ) . disableContextMenuItems ( "#ungroup" ) } else Q . disableContextMenuItems ( "#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back" ) ; U . getUndoStackSize ( ) > 0 ? a ( "#tool_undo" ) . removeClass ( "disabled" ) : a ( "#tool_undo" ) . addClass ( "disabled" ) ; U . getRedoStackSize ( ) > 0 ? a ( "#tool_redo" ) . removeClass ( "disabled" ) : a ( "#tool_redo" ) . addClass ( "disabled" ) ; g . addedNew = false ; if ( n && ! R || ta ) { a ( "#selLayerNames" ) . removeAttr ( "disabled" ) . val ( w ) ; Y . enableContextMenuItems ( "#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back" ) } } ;
a ( "#text" ) . on ( "focus" , function ( ) { } ) ; a ( "#text" ) . on ( "blur" , function ( ) { } ) ; g . bind ( "selected" , function ( n , w ) { var C = g . getMode ( ) ; C === "select" && ba ( ) ; C = C == "pathedit" ; W = w . length == 1 || w [ 1 ] == null ? w [ 0 ] : null ; ta = w . length >= 2 && w [ 1 ] != null ? w : false ; if ( W != null ) if ( ! C ) { if ( W != null ) switch ( W . tagName ) { case "use" : case "image" : case "foreignObject" : break ; case "g" : case "a" : for ( var K = null , R = W . getElementsByTagName ( "*" ) , Q = 0 , V = R . length ; Q < V ; Q ++ ) { var aa = R [ Q ] . getAttribute ( "stroke-width" ) ; if ( Q === 0 ) K = aa ; else if ( K !== aa ) K = null } a ( "#stroke_width" ) . val ( K ===
null ? "" : K ) ; c . paintBox . fill . update ( true ) ; c . paintBox . stroke . update ( true ) ; break ; default : c . paintBox . fill . update ( true ) ; c . paintBox . stroke . update ( true ) ; a ( "#stroke_width" ) . val ( W . getAttribute ( "stroke-width" ) || 1 ) ; a ( "#stroke_style" ) . val ( W . getAttribute ( "stroke-dasharray" ) || "none" ) ; K = W . getAttribute ( "stroke-linejoin" ) || "miter" ; a ( "#linejoin_" + K ) . length != 0 && d ( a ( "#linejoin_" + K ) [ 0 ] ) ; K = W . getAttribute ( "stroke-linecap" ) || "butt" ; a ( "#linecap_" + K ) . length != 0 && d ( a ( "#linecap_" + K ) [ 0 ] ) } if ( W != null ) { K = ( W . getAttribute ( "opacity" ) ||
1 ) * 100 ; a ( "#group_opacity" ) . val ( K ) ; a ( "#opac_slider" ) . slider ( "option" , "value" , K ) ; a ( "#elem_id" ) . val ( W . id ) } } a ( "#path_node_panel" ) . toggle ( C ) ; a ( "#tools_bottom_2,#tools_bottom_3" ) . toggle ( ! C ) ; if ( C ) { a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; db ( "#tool_select" , "select_node" ) ; ta = false ; if ( w . length ) W = w [ 0 ] } else { if ( w [ 0 ] ) { C = g . selectorManager . requestSelector ( w [ 0 ] ) ; C . reset ( w [ 0 ] ) ; C . selectorRect . setAttribute ( "display" ,
"inline" ) } db ( "#tool_select" , "select" ) } Ba ( ) ; g . runExtensions ( "selectedChanged" , { elems : w , selectedElement : W , multiselected : ta } ) } ) ; g . bind ( "transition" , function ( n , w ) { var C = g . getMode ( ) , K = w [ 0 ] ; if ( K ) { ta = w . length >= 2 && w [ 1 ] != null ? w : null ; if ( ! ta ) switch ( C ) { case "rotate" : C = g . getRotationAngle ( K ) ; a ( "#angle" ) . val ( Math . round ( C ) ) ; rotateCursor ( C ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , C == 0 ) } g . runExtensions ( "elementTransition" , { elems : w } ) } } ) ; g . bind ( "changed" , function ( n , w ) { var C = g . getMode ( ) ; C === "select" && ba ( ) ; for ( var K =
0 ; K < w . length ; ++ K ) { var R = w [ K ] ; if ( R && R . tagName === "svg" ) H ( ) ; else if ( R && W && W . parentNode == null ) W = R } c . show _save _warning = true ; Ba ( ) ; if ( W && C === "select" ) { c . paintBox . fill . update ( ) ; c . paintBox . stroke . update ( ) } g . runExtensions ( "elementChanged" , { elems : w } ) } ) ; g . bind ( "saved" , function ( n , w ) { c . show _save _warning = false ; w = '<?xml version="1.0"?>\n' + w ; var C = navigator . userAgent ; if ( ~ C . indexOf ( "Chrome" ) && a . browser . version >= 533 || ~ C . indexOf ( "MSIE" ) ) Rb ( 0 , true ) ; else { var K = n . open ( "data:image/svg+xml;base64," + M . encode64 ( w ) ) , R = a . pref ( "save_notice_done" ) ;
if ( R !== "all" ) { var Q = uiStrings . notification . saveFromBrowser . replace ( "%s" , "SVG" ) ; if ( C . indexOf ( "Gecko/" ) !== - 1 ) if ( w . indexOf ( "<defs" ) !== - 1 ) { Q += "\n\n" + uiStrings . notification . defsFailOnSave ; a . pref ( "save_notice_done" , "all" ) ; R = "all" } else a . pref ( "save_notice_done" , "part" ) ; else a . pref ( "save_notice_done" , "all" ) ; R !== "part" && K . alert ( Q ) } } } ) ; g . bind ( "exported" , function ( n , w ) { var C = w . issues ; a ( "#export_canvas" ) . length || a ( "<canvas>" , { id : "export_canvas" } ) . hide ( ) . appendTo ( "body" ) ; var K = a ( "#export_canvas" ) [ 0 ] ; K . width = g . contentW ;
K . height = g . contentH ; canvg ( K , w . svg , { renderCallback : function ( ) { var R = K . toDataURL ( "image/png" ) ; P . location . href = R ; if ( a . pref ( "export_notice_done" ) !== "all" ) { R = uiStrings . notification . saveFromBrowser . replace ( "%s" , "PNG" ) ; if ( C . length ) R += "\n\n" + uiStrings . notification . noteTheseIssues + "\n \u2022 " + C . join ( "\n \u2022 " ) ; a . pref ( "export_notice_done" , "all" ) ; P . alert ( R ) } } } ) } ) ; g . bind ( "zoomed" , X ) ; g . bind ( "contextset" , function ( n , w ) { var C = "" ; if ( w ) { var K = "" ; C = '<a href="#" data-root="y">' + g . getCurrentDrawing ( ) . getCurrentLayerName ( ) +
"</a>" ; a ( w ) . parentsUntil ( "#svgcontent > g" ) . andSelf ( ) . each ( function ( ) { if ( this . id ) { K += " > " + this . id ; C += this !== w ? ' > <a href="#">' + this . id + "</a>" : " > " + this . id } } ) ; da = K } else da = null ; a ( "#cur_context_panel" ) . toggle ( ! ! w ) . html ( C ) ; Db ( ) } ) ; g . bind ( "extension_added" , function ( n , w ) { function C ( ) { if ( Ga ) { clearTimeout ( Ga ) ; Ga = null } R || ( Ga = setTimeout ( function ( ) { R = true ; h ( s . iconsize ) } , 50 ) ) } var K = false , R = false , Q = true , V = function ( ) { if ( w . callback && ! K && Q ) { K = true ; w . callback ( ) } } , aa = [ ] ; w . context _tools && a . each ( w . context _tools , function ( Aa ,
ha ) { var eb = ha . container _id ? ' id="' + ha . container _id + '"' : "" , Ra = a ( "#" + ha . panel ) ; Ra . length || ( Ra = a ( "<div>" , { id : ha . panel } ) . appendTo ( "#tools_top" ) . hide ( ) ) ; switch ( ha . type ) { case "tool_button" : var va = '<div class="tool_button">' + ha . id + "</div>" , Na = a ( va ) . appendTo ( Ra ) ; ha . events && a . each ( ha . events , function ( Va , cb ) { a ( Na ) . bind ( Va , cb ) } ) ; break ; case "select" : va = "<label" + eb + '><select id="' + ha . id + '">' ; a . each ( ha . options , function ( Va , cb ) { va += '<option value="' + Va + '"' + ( Va == ha . defval ? " selected" : "" ) + ">" + cb + "</option>" } ) ; va += "</select></label>" ;
var ya = a ( va ) . appendTo ( Ra ) . find ( "select" ) ; a . each ( ha . events , function ( Va , cb ) { a ( ya ) . bind ( Va , cb ) } ) ; break ; case "button-select" : va = '<div id="' + ha . id + '" class="dropdown toolset" title="' + ha . title + '"><div id="cur_' + ha . id + '" class="icon_label"></div><button></button></div>' ; eb = a ( '<ul id="' + ha . id + '_opts"></ul>' ) . appendTo ( "#option_lists" ) ; ha . colnum && eb . addClass ( "optcols" + ha . colnum ) ; a ( va ) . appendTo ( Ra ) . children ( ) ; aa . push ( { elem : "#" + ha . id , list : "#" + ha . id + "_opts" , title : ha . title , callback : ha . events . change , cur : "#cur_" +
ha . id } ) ; break ; case "input" : va = "<label" + eb + '><span id="' + ha . id + '_label">' + ha . label + ':</span><input id="' + ha . id + '" title="' + ha . title + '" size="' + ( ha . size || "4" ) + '" value="' + ( ha . defval || "" ) + '" type="text"/></label>' ; var ab = a ( va ) . appendTo ( Ra ) . find ( "input" ) ; ha . spindata && ab . SpinButton ( ha . spindata ) ; ha . events && a . each ( ha . events , function ( Va , cb ) { ab . bind ( Va , cb ) } ) } } ) ; if ( w . buttons ) { var fa = { } , pa = { } , sa = w . svgicons , Za = { } ; a . each ( w . buttons , function ( Aa , ha ) { for ( var eb , Ra = ha . id , va = Aa ; a ( "#" + Ra ) . length ; ) Ra = ha . id + "_" + ++ va ;
if ( sa ) { fa [ Ra ] = ha . icon ; va = ha . svgicon ? ha . svgicon : ha . id ; if ( ha . type == "app_menu" ) pa [ "#" + Ra + " > div" ] = va ; else pa [ "#" + Ra ] = va } else eb = ha . type == "menu" ? "" : a ( '<img src="' + ha . icon + '">' ) ; var Na , ya ; switch ( ha . type ) { case "mode_flyout" : case "mode" : Na = "tool_button" ; if ( ha . cls ) Na += " " + ha . cls ; ya = "#tools_left" ; break ; case "context" : Na = "tool_button" ; ya = "#" + ha . panel ; a ( ya ) . length || a ( "<div>" , { id : ha . panel } ) . appendTo ( "#tools_top" ) ; break ; case "menu" : Na = "menu_item tool_button" ; ya = "#" + ( ha . after || ha . panel ) ; break ; case "app_menu" : Na =
"" ; ya = ha . parent || "#main_menu ul" ; a ( ya ) . length || a ( "<div>" , { id : ha . panel } ) . appendTo ( "#tools_top" ) } var ab = a ( ha . list || ha . type == "app_menu" ? "<li/>" : "<div/>" ) . attr ( "id" , Ra ) . attr ( "title" , ha . title ) . addClass ( Na ) ; if ( ! ha . includeWith && ! ha . list ) { if ( "position" in ha ) a ( ya ) . children ( ) . eq ( ha . position ) . before ( ab ) ; else ha . type != "menu" || ! ha . after ? ab . appendTo ( ya ) : a ( ya ) . after ( ab ) ; if ( ha . type == "mode_flyout" ) { va = a ( ab ) ; Na = va . parent ( ) ; if ( ! va . parent ( ) . hasClass ( "tools_flyout" ) ) { var Va = va [ 0 ] . id . replace ( "tool_" , "tools_" ) , cb = va . clone ( ) . attr ( "id" ,
Va + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; va . before ( cb ) ; Na = ma ( Va , va ) ; Na . data ( "isLibrary" , true ) ; cb . data ( "isLibrary" , true ) } pa [ "#" + Va + "_show" ] = ha . id ; Ra = Za [ "#" + Na [ 0 ] . id ] = [ { sel : "#" + Ra , fn : ha . events . click , icon : ha . id , isDefault : true } , Jb ] } else if ( ha . type == "app_menu" || ha . type == "menu" ) ab . append ( ha . title ) } else if ( ha . list ) { ab . addClass ( "push_button" ) ; a ( "#" + ha . list + "_opts" ) . append ( ab ) ; if ( ha . isDefault ) { a ( "#cur_" + ha . list ) . append ( ab . children ( ) . clone ( ) ) ; va = ha . svgicon ? ha . svgicon : ha . id ; pa [ "#cur_" + ha . list ] =
va } } else if ( ha . includeWith ) { ya = ha . includeWith ; va = a ( ya . button ) ; Na = va . parent ( ) ; if ( ! va . parent ( ) . hasClass ( "tools_flyout" ) ) { Va = va [ 0 ] . id . replace ( "tool_" , "tools_" ) ; cb = va . clone ( ) . attr ( "id" , Va + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; va . before ( cb ) ; Na = ma ( Va , va ) } var Jb = F . getButtonData ( ya . button ) ; if ( ya . isDefault ) pa [ "#" + Va + "_show" ] = ha . id ; Ra = Za [ "#" + Na [ 0 ] . id ] = [ { sel : "#" + Ra , fn : ha . events . click , icon : ha . id , key : ha . key , isDefault : ha . includeWith ? ha . includeWith . isDefault : 0 } , Jb ] ; Va = "position" in ya ? ya . position :
"last" ; Jb = Na . children ( ) . length ; if ( ! isNaN ( Va ) && Va >= 0 && Va < Jb ) Na . children ( ) . eq ( Va ) . before ( ab ) ; else { Na . append ( ab ) ; Ra . reverse ( ) } } sa || ab . append ( eb ) ; ha . list || a . each ( ha . events , function ( yb , Hb ) { if ( yb == "click" ) if ( ha . type == "mode" ) { ha . includeWith ? ab . bind ( yb , Hb ) : ab . bind ( yb , function ( ) { $a ( ab ) && Hb ( ) } ) ; if ( ha . key ) { a ( document ) . bind ( "keydown" , ha . key , Hb ) ; ha . title && ab . attr ( "title" , ha . title + " [" + ha . key + "]" ) } } else ab . bind ( yb , Hb ) ; else ab . bind ( yb , Hb ) } ) ; ra ( Za ) } ) ; a . each ( aa , function ( ) { Ea ( this . elem , this . list , this . callback , { seticon : true } ) } ) ;
if ( sa ) Q = false ; a . svgIcons ( sa , { w : 27 , h : 27 , id _match : false , no _img : ! B , fallback : fa , placement : pa , callback : function ( ) { s . iconsize && s . iconsize != "m" && C ( ) ; Q = true ; V ( ) } } ) } V ( ) } ) ; g . textActions . setInputElem ( a ( "#text" ) [ 0 ] ) ; var za = '<div class="palette_item" data-rgb="none"></div>' ; a . each ( [ "#000000" , "#3f3f3f" , "#7f7f7f" , "#bfbfbf" , "#ffffff" , "#ff0000" , "#ff7f00" , "#ffff00" , "#7fff00" , "#00ff00" , "#00ff7f" , "#00ffff" , "#007fff" , "#0000ff" , "#7f00ff" , "#ff00ff" , "#ff007f" , "#7f0000" , "#7f3f00" , "#7f7f00" , "#3f7f00" , "#007f00" , "#007f3f" , "#007f7f" ,
"#003f7f" , "#00007f" , "#3f007f" , "#7f007f" , "#7f003f" , "#ffaaaa" , "#ffd4aa" , "#ffffaa" , "#d4ffaa" , "#aaffaa" , "#aaffd4" , "#aaffff" , "#aad4ff" ] , function ( n , w ) { za += '<div class="palette_item" style="background-color: ' + w + ';" data-rgb="' + w + '"></div>' } ) ; a ( "#palette" ) . append ( za ) ; var Ia = a ( "#tool_angle_indicator" ) ; a ( "#tool_reorient" ) ; rotateCursor = function ( n ) { n = "rotate(" + n + "deg)" ; Ia . css ( { "-webkit-transform" : n , "-moz-transform" : n , "-o-transform" : n , "-ms-transform" : n , transform : n } ) } ; var xa = function ( n ) { var w = n . value / 100 ; if ( w <
0.0010 ) n . value = 0.1 ; else { n = g . getZoom ( ) ; X ( window , { width : 0 , height : 0 , x : ( S [ 0 ] . scrollLeft + S . width ( ) / 2 ) / n , y : ( S [ 0 ] . scrollTop + S . height ( ) / 2 ) / n , zoom : w } , true ) } } , rb = function ( ) { window . opera && a ( "<p/>" ) . hide ( ) . appendTo ( "body" ) . remove ( ) } ; a ( "#stroke_style" ) . change ( function ( ) { g . setStrokeAttr ( "stroke-dasharray" , a ( this ) . val ( ) ) ; a ( "#stroke_style_label" ) . html ( this . options [ this . selectedIndex ] . text ) ; rb ( ) } ) ; a ( "#seg_type" ) . change ( function ( ) { g . 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 ( ) { g . setFontFamily ( this . value ) } ) ; a ( "#text" ) . keyup ( function ( ) { g . setTextContent ( this . value ) } ) ; changeAttribute = function ( n , w ) { var C = n . getAttribute ( "data-attr" ) , K = n . value ; if ( ! svgedit . units . isValidUnit ( C , K , W ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; n . value = W . getAttribute ( C ) ; return false } w ? g . changeSelectedAttributeNoUndo ( C , K ) : g . changeSelectedAttribute ( C , K ) } ; a ( "#palette" ) . mouseover ( function ( ) { var n = a ( '<input type="hidden">' ) ;
a ( this ) . append ( n ) ; n . focus ( ) . remove ( ) } ) ; a ( ".palette_item" ) . on ( "mousedown touchstart touchmove" , function ( ) { var n = a ( "#tool_stroke" ) . hasClass ( "active" ) , w = n ? "stroke" : "fill" , C = a ( this ) . attr ( "data-rgb" ) , K = null ; if ( C === "transparent" || C === "initial" || C === "#none" ) { C = "none" ; K = new a . jGraduate . Paint } else K = new a . jGraduate . Paint ( { alpha : 100 , solidColor : C . substr ( 1 ) } ) ; c . paintBox [ w ] . setPaint ( K ) ; if ( n ) { g . setColor ( "stroke" , C ) ; C != "none" && g . getStrokeOpacity ( ) != 1 && g . setPaintOpacity ( "stroke" , 1 ) } else { g . setColor ( "fill" , C ) ; C != "none" &&
g . getFillOpacity ( ) != 1 && g . setPaintOpacity ( "fill" , 1 ) } } ) . bind ( "contextmenu" , function ( n ) { n . preventDefault ( ) } ) ; a ( "#toggle_stroke_tools" ) . toggle ( function ( ) { a ( ".stroke_tool" ) . css ( "display" , "table-cell" ) ; a ( this ) . addClass ( "expanded" ) ; v ( ) } , function ( ) { a ( ".stroke_tool" ) . css ( "display" , "none" ) ; a ( this ) . removeClass ( "expanded" ) ; v ( ) } ) ; var $a = function ( n , w ) { if ( a ( n ) . hasClass ( "disabled" ) ) return false ; if ( a ( n ) . parent ( ) . hasClass ( "tools_flyout" ) ) return true ; var C = C || "normal" ; w || a ( ".tools_flyout" ) . fadeOut ( C ) ; a ( "#styleoverrides" ) . text ( "" ) ;
a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( n ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; return true } ; ( function ( ) { var n = null , w = null , C = S [ 0 ] , K = false , R = false ; a ( "#svgcanvas" ) . bind ( "mousemove mouseup touchend" , function ( Q ) { if ( K !== false ) { C . scrollLeft -= Q . clientX - n ; C . scrollTop -= Q . clientY - w ; n = Q . clientX ; w = Q . clientY ; if ( Q . type === "mouseup" || Q . type === "touchend" ) K = false ; return false } } ) . on ( "mousedown touchmove" , function ( Q ) { if ( Q . button === 1 || R === true || Q . originalEvent . touches &&
Q . originalEvent . touches . length >= 2 ) { K = true ; n = Q . clientX ; w = Q . clientY ; return false } } ) ; a ( window ) . mouseup ( function ( ) { K = false ; a ( "body" ) . removeClass ( "dragging" ) } ) ; a ( document ) . bind ( "keydown" , "space" , function ( Q ) { Q . preventDefault ( ) ; g . spaceKey = R = true } ) . bind ( "keyup" , "space" , function ( Q ) { Q . preventDefault ( ) ; g . spaceKey = R = false } ) . bind ( "keydown" , "alt" , function ( ) { g . getMode ( ) === "zoom" && S . addClass ( "out" ) } ) . bind ( "keyup" , "alt" , function ( ) { g . getMode ( ) === "zoom" && S . removeClass ( "out" ) } ) } ) ( ) ; var jb = a ( ".menu" ) , Ua = function ( n ) { n . target . style . background =
"#fff" ; setTimeout ( function ( ) { n . target . style . background = "#ddd" } , 50 ) ; setTimeout ( function ( ) { n . target . style . background = "#fff" } , 150 ) ; setTimeout ( function ( ) { n . target . style . background = "#ddd" } , 200 ) ; setTimeout ( function ( ) { n . target . style . background = "" } , 200 ) ; setTimeout ( function ( ) { a ( "#menu_bar" ) . removeClass ( "active" ) } , 220 ) ; return false } ; a ( ".menu_item" ) . on ( "mousedown touchstart" , function ( n ) { Ua ( n ) } ) ; a ( "svg, body" ) . on ( "mousedown touchstart" , function ( n ) { top != self && ! n . isTrigger && typeof top . exports . setEditorFocus ==
"function" && top . exports . setEditorFocus ( ) ; if ( ! a ( n . target ) . hasClass ( "menu_title" ) && ! a ( n . target ) . parent ( ) . hasClass ( "menu_title" ) ) ! a ( n . target ) . hasClass ( "disabled" ) && a ( n . target ) . hasClass ( "menu_item" ) ? Ua ( n ) : a ( "#menu_bar" ) . removeClass ( "active" ) } ) ; var Sa = [ 6 , 12 , 16 , 33 , 50 , 66 , 100 , 150 , 200 , 300 , 400 , 600 , 800 , 1200 ] ; a ( "#workarea" ) . on ( "mousewheel" , function ( n , w , C , K ) { if ( n . altKey ) { n . preventDefault ( ) ; n = g . getZoom ( ) * 100 ; w = Sa . length ; for ( E = 0 ; E < w ; E ++ ) { C = Math . min ( w , E + 1 ) ; if ( K > 0 ) zoom = Sa [ E ] <= n ? Sa [ C ] : zoom ; if ( K < 0 ) zoom = Sa [ E ] < n ? Sa [ E ] :
zoom } zoom && xa ( { value : zoom } ) } } ) ; a ( ".menu_title" ) . on ( "mousedown" , function ( ) { a ( "#tools_shapelib" ) . hide ( ) ; a ( "#menu_bar" ) . toggleClass ( "active" ) ; jb . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) . on ( "mouseover" , function ( ) { jb . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) ; c . addDropDown = function ( n , w , C ) { if ( a ( n ) . length != 0 ) { var K = a ( n ) . find ( "button" ) , R = a ( n ) . find ( "ul" ) . attr ( "id" , a ( n ) [ 0 ] . id + "-list" ) ; C || a ( "#option_lists" ) . append ( R ) ; var Q = false ; C && a ( n ) . addClass ( "dropup" ) ; R . find ( "li" ) . bind ( "mouseup" ,
w ) ; a ( window ) . mouseup ( function ( ) { if ( ! Q ) { K . removeClass ( "down" ) ; R . hide ( ) } Q = false } ) ; K . bind ( "mousedown" , function ( ) { if ( K . hasClass ( "down" ) ) { K . removeClass ( "down" ) ; R . hide ( ) } else { K . addClass ( "down" ) ; if ( ! C ) { var V = a ( n ) . offset ( ) ; R . css ( { top : V . top , left : V . left - 110 } ) } R . show ( ) ; Q = true } } ) . hover ( function ( ) { Q = true } ) . mouseout ( function ( ) { Q = false } ) } } ; var Ea = function ( n , w , C , K ) { var R = a ( n ) ; w = a ( w ) ; var Q = false , V = K . dropUp ; V && a ( n ) . addClass ( "dropup" ) ; w . find ( "li" ) . bind ( "mouseup" , function ( ) { if ( K . seticon ) { db ( "#cur_" + R [ 0 ] . id , a ( this ) . children ( ) ) ;
a ( this ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } C . apply ( this , arguments ) } ) ; a ( window ) . mouseup ( function ( ) { if ( ! Q ) { R . removeClass ( "down" ) ; w . hide ( ) ; w . css ( { top : 0 , left : 0 } ) } Q = false } ) ; w . height ( ) ; a ( n ) . bind ( "mousedown" , function ( ) { var aa = a ( n ) . offset ( ) ; if ( V ) { aa . top -= w . height ( ) ; aa . left += 8 } else aa . top += a ( n ) . height ( ) ; a ( w ) . offset ( aa ) ; if ( R . hasClass ( "down" ) ) { R . removeClass ( "down" ) ; w . hide ( ) ; w . css ( { top : 0 , left : 0 } ) } else { R . addClass ( "down" ) ; w . show ( ) ; Q = true ; return false } } ) . hover ( function ( ) { Q = true } ) . mouseout ( function ( ) { Q =
2012-07-25 10:27:26 +00:00
false } ) ; K . multiclick && w . mousedown ( function ( ) { Q = true } ) } ; a ( "#font_family_dropdown" ) . change ( function ( ) { var n = this . options [ this . selectedIndex ] . value , w = this . options [ this . selectedIndex ] . text ; a ( "#preview_font" ) . html ( w ) . css ( "font-family" , n ) ; a ( "#font_family" ) . val ( n ) . change ( ) } ) ; a ( "div" , "#position_opts" ) . each ( function ( ) { this . addEventListener ( "mouseup" , function ( ) { var n = this . id . replace ( "tool_pos" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( n , "page" ) } ) } ) ; ( function ( ) { var n , w = function ( ) { a ( n ) . blur ( ) } ; a ( "#svg_editor" ) . find ( "button, select, input:not(#text)" ) . focus ( function ( ) { n =
this ; qa = "toolbars" ; S . mousedown ( w ) } ) . blur ( function ( ) { qa = "canvas" ; S . unbind ( "mousedown" , w ) ; g . getMode ( ) == "textedit" && a ( "#text" ) . focus ( ) } ) } ) ( ) ; var wa = function ( ) { $a ( "#tool_select" ) && g . setMode ( "select" ) } , hb = function ( ) { $a ( "#tool_fhpath" ) && g . setMode ( "fhpath" ) } , Ma = function ( ) { $a ( "#tool_line" ) && g . setMode ( "line" ) } , Ta = function ( ) { $a ( "#tool_rect" ) && g . setMode ( "rect" ) } , Fa = function ( ) { $a ( "#tool_ellipse" ) && g . setMode ( "ellipse" ) } , lb = function ( ) { $a ( "#tool_image" ) && g . setMode ( "image" ) } , tb = function ( ) { $a ( "#tool_zoom" ) && g . setMode ( "zoom" ) } ,
Ya = function ( ) { if ( $a ( "#tool_zoom" ) ) { Fb ( ) ; ba ( ) } } , bb = function ( ) { $a ( "#tool_text" ) && g . setMode ( "text" ) } , Cb = function ( ) { $a ( "#tool_path" ) && g . setMode ( "path" ) } , ua = function ( ) { if ( W != null || ta ) g . deleteSelectedElements ( ) } , nb = function ( ) { if ( W != null || ta ) { window . event . type === "keydown" && qb ( a ( "#edit_menu" ) ) ; g . cutSelectedElements ( ) } } , kb = function ( ) { if ( W != null || ta ) { window . event . type === "keydown" && qb ( a ( "#edit_menu" ) ) ; g . copySelectedElements ( ) } } , zb = function ( ) { window . event . type === "keydown" && qb ( a ( "#edit_menu" ) ) ; var n = g . getZoom ( ) ,
w = ( S [ 0 ] . scrollLeft + S . width ( ) / 2 ) / n - g . contentW ; n = ( S [ 0 ] . scrollTop + S . height ( ) / 2 ) / n - g . contentH ; g . pasteElements ( "point" , w , n ) } , pb = function ( ) { if ( W != null ) { window . event . type === "keydown" && qb ( a ( "#object_menu" ) ) ; g . moveToTopSelectedElement ( ) } } , gb = function ( ) { if ( W != null ) { window . event . type === "keydown" && qb ( a ( "#object_menu" ) ) ; g . moveToBottomSelectedElement ( ) } } , ub = function ( ) { if ( W != null ) { window . event . type === "keydown" && qb ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Up" ) } } , vb = function ( ) { if ( W != null ) { window . event . type === "keydown" &&
qb ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Down" ) } } , xb = function ( n ) { if ( W != null ) { window . event . type === "keydown" && qb ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( n ) } } , Ab = function ( ) { if ( W != null ) { g . convertToPath ( ) ; elems = g . getSelectedElems ( ) ; g . selectorManager . requestSelector ( elems [ 0 ] ) . selectorRect . setAttribute ( "display" , "none" ) ; g . setMode ( "pathedit" ) ; J . toEditMode ( elems [ 0 ] ) ; g . clearSelection ( ) } } , la = function ( ) { W != null && J . reorient ( ) } , ca = function ( ) { if ( W != null || ta ) a . prompt ( uiStrings . notification . enterNewLinkURL , "http://" ,
function ( n ) { n && g . makeHyperlink ( n ) } ) } , ja = function ( n , w ) { if ( W != null || ta ) { if ( curConfig . gridSnapping ) { var C = g . getZoom ( ) * curConfig . snappingStep ; n *= C ; w *= C } a ( "input" ) . blur ( ) ; g . moveSelectedElements ( n , w ) } } , O = function ( ) { var n = ! a ( "#tool_node_link" ) . hasClass ( "checked" ) ; n ? a ( "#tool_node_link" ) . addClass ( "checked" ) . find ( "input" ) . attr ( "checked" , true ) : a ( "#tool_node_link" ) . removeClass ( "checked" ) . find ( "input" ) . attr ( "checked" , false ) ; J . linkControlPoints ( n ) } , T = function ( ) { J . getNodePoint ( ) && J . clonePathNode ( ) } , ea = function ( ) { J . getNodePoint ( ) &&
J . deletePathNode ( ) } , Ha = function ( ) { var n = a ( "#tool_add_subpath" ) , w = ! n . hasClass ( "push_button_pressed" ) ; w ? n . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : n . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; J . addSubPath ( w ) } , Pa = function ( ) { J . opencloseSubPath ( ) } , Xa = function ( ) { g . cycleElement ( 1 ) } , fb = function ( ) { g . cycleElement ( 0 ) } , ob = function ( n , w ) { if ( ! ( W == null || ta ) ) { n || ( w *= - 1 ) ; var C = a ( "#angle" ) . val ( ) * 1 + w ; g . setRotationAngle ( C ) ; Ba ( ) } } , Wa = function ( ) { var n = curConfig . dimensions ; a . confirm ( uiStrings . notification . QwantToClear ,
function ( w ) { if ( w ) { ba ( ) ; g . clear ( ) ; g . setResolution ( n [ 0 ] , n [ 1 ] ) ; H ( true ) ; Fb ( ) ; Ba ( ) ; Z ( ) ; g . runExtensions ( "onNewDocument" ) } } ) } , sb = function ( ) { g . setBold ( ! g . getBold ( ) ) ; Ba ( ) ; return false } , Qa = function ( ) { g . setItalic ( ! g . getItalic ( ) ) ; Ba ( ) ; return false } , wb = function ( ) { if ( ! b . pngsave ) { var n = uiStrings . notification . loadingImage ; P = window . open ( "data:text/html;charset=utf-8,<title>" + n + "</title><h1>" + n + "</h1>" ) } window . canvg ? g . rasterExport ( ) : a . getScript ( "canvg/rgbcolor.js" , function ( ) { a . getScript ( "canvg/canvg.js" , function ( ) { g . rasterExport ( ) } ) } ) } ,
2012-07-25 08:56:15 +00:00
Bb = function ( ) { g . open ( ) } , Kb = function ( ) { } , qb = function ( n ) { var w = n . prev ( ) ; w . css ( "background" , "#09f" ) ; setTimeout ( function ( ) { w . css ( "background" , "" ) } , 200 ) } , ib = function ( ) { if ( U . getUndoStackSize ( ) > 0 ) { window . event . type === "keydown" && qb ( a ( "#edit_menu" ) ) ; U . undo ( ) } } , Ka = function ( ) { if ( U . getRedoStackSize ( ) > 0 ) { window . event . type === "keydown" && qb ( a ( "#edit_menu" ) ) ; U . redo ( ) } } , Mb = function ( ) { if ( ta ) g . groupSelectedElements ( ) ; else W && g . ungroupSelectedElement ( ) } , Ob = function ( ) { window . event . type === "keydown" && qb ( a ( "#edit_menu" ) ) ;
g . cloneSelectedElements ( 20 , 20 ) } , Nb = function ( ) { var n = this . id . replace ( "tool_align" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( n , a ( "#align_relative_to" ) . val ( ) ) } , Pb = function ( ) { var n = document . querySelector ( "#tool_stroke rect" ) , w = document . querySelector ( "#tool_fill rect" ) , C = w . getAttribute ( "fill" ) , K = n . getAttribute ( "fill" ) ; n = parseFloat ( n . getAttribute ( "stroke-opacity" ) ) ; if ( isNaN ( n ) ) n = 100 ; w = parseFloat ( w . getAttribute ( "fill-opacity" ) ) ; if ( isNaN ( w ) ) w = 100 ; K = Ja ( K , n , "stroke" ) ; C = Ja ( C , w , "fill" ) ; c . paintBox . fill . setPaint ( K ,
true ) ; c . paintBox . stroke . setPaint ( C , true ) } , Fb = function ( n ) { var w = g . getResolution ( ) ; n = n ? w . zoom * n : 1 ; a ( "#zoom" ) . val ( n * 100 ) ; g . setZoom ( n ) ; mb ( ) ; H ( true ) } , Gb = function ( ) { ! a ( "#tool_wireframe" ) . hasClass ( "push_button_pressed" ) ? a ( "#tool_wireframe" ) . addClass ( "push_button_pressed" ) : a ( "#tool_wireframe" ) . removeClass ( "push_button_pressed" ) ; S . toggleClass ( "wireframe" ) ; if ( ! A ) { var n = a ( "#wireframe_rules" ) ; n . length ? n . empty ( ) : a ( '<style id="wireframe_rules"></style>' ) . appendTo ( "head" ) ; mb ( ) } } , Lb = function ( ) { var n = ! a ( "#tool_snap" ) . hasClass ( "push_button_pressed" ) ;
n ? a ( "#tool_snap" ) . addClass ( "push_button_pressed" ) : a ( "#tool_snap" ) . removeClass ( "push_button_pressed" ) ; curConfig . gridSnapping = n } , Sb = function ( ) { window . self != window . top && top . exports . setEditorFocus ( false ) } , Eb = function ( ) { if ( a ( "#tool_rulers" ) . hasClass ( "push_button_pressed" ) ) { a ( "#tool_rulers" ) . removeClass ( "push_button_pressed" ) ; a ( "#show_rulers" ) . attr ( "checked" , false ) ; curConfig . showRulers = false } else { a ( "#tool_rulers" ) . addClass ( "push_button_pressed" ) ; a ( "#show_rulers" ) . attr ( "checked" , true ) ; curConfig . showRulers =
true } a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } , mb = function ( ) { if ( ! A ) { var n = "#workarea.wireframe #svgcontent * { stroke-width: " + 1 / g . getZoom ( ) + "px; }" ; a ( "#wireframe_rules" ) . text ( S . hasClass ( "wireframe" ) ? n : "" ) } } , Rb = function ( n , w ) { if ( ! ka ) { ka = true ; a ( "#save_output_btns" ) . toggle ( ! ! w ) ; a ( "#tool_source_back" ) . toggle ( ! w ) ; var C = ga = g . getSvgString ( ) ; a ( "#svg_source_textarea" ) . val ( C ) ; a ( "#svg_source_editor" ) . fadeIn ( ) ; C = a ( "#svg_source_container" ) . height ( ) - 50 ; a ( "#svg_source_textarea" ) . css ( "height" , C ) ; a ( "#svg_source_textarea" ) . focus ( ) } } ,
Qb = function ( ) { if ( ka ) { var n = function ( ) { g . clearSelection ( ) ; z ( ) ; Fb ( ) ; Db ( ) ; Z ( ) } ; g . setSvgString ( a ( "#svg_source_textarea" ) . val ( ) ) ? n ( ) : a . confirm ( uiStrings . notification . QerrorsRevertToSource , function ( w ) { if ( ! w ) return false ; n ( ) } ) ; ba ( ) } } , Db = function ( n ) { n = n || g . getDocumentTitle ( ) ; n = orig _title + ( n ? ": " + n : "" ) ; a ( "title:first" ) . text ( n ) } , db = c . setIcon = function ( n , w ) { var C = typeof w === "string" ? a . getSvgIcon ( w , true ) : w . clone ( ) ; C ? a ( n ) . find ( "img" ) . replaceWith ( C ) : console . log ( "NOTE: Icon image missing: " + w ) } , Ib ; Ib = function ( ) { var n =
/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ , w = document . getElementsByTagName ( "script" ) [ 0 ] , C ; for ( C in w . style ) if ( n . test ( C ) ) return C . match ( n ) [ 0 ] ; if ( "WebkitOpacity" in w . style ) return "Webkit" ; if ( "KhtmlOpacity" in w . style ) return "Khtml" ; return "" } ( ) ; var e = function ( n , w ) { Ib . toLowerCase ( ) ; var C = [ "top" , "left" , "bottom" , "right" ] ; n . each ( function ( ) { for ( var K = a ( this ) , R = K . outerWidth ( ) * ( w - 1 ) , Q = K . outerHeight ( ) * ( w - 1 ) , V = 0 ; V < 4 ; V ++ ) { var aa = C [ V ] , fa = K . data ( "orig_margin-" + aa ) ; if ( fa == null ) { fa = parseInt ( K . css ( "margin-" + aa ) ) ; K . data ( "orig_margin-" +
aa , fa ) } fa = fa * w ; if ( aa === "right" ) fa += R ; else if ( aa === "bottom" ) fa += Q ; K . css ( "margin-" + aa , fa ) } } ) } , h = c . setIconSize = function ( n , w ) { if ( ! ( n == s . size && ! w ) ) { var C = a ( "#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout" ) , K = 1 ; K = typeof n == "number" ? n : { s : 0.75 , m : 1 , l : 1.25 , xl : 1.5 } [ n ] ; c . tool _scale = ia = K ; na ( ) ; var R = C . parents ( ":hidden" ) ; R . css ( "visibility" , "hidden" ) . show ( ) ; e ( C ,
K ) ; R . css ( "visibility" , "visible" ) . hide ( ) ; C = a ( "#tool_size_rules" ) ; if ( C . length ) C . empty ( ) ; else C = a ( '<style id="tool_size_rules"></style>' ) . appendTo ( "head" ) ; if ( n != "m" ) { var Q = "" ; a . each ( cssResizeRules , function ( V , aa ) { V = "#svg_editor " + V . replace ( /,/g , ", #svg_editor" ) ; Q += V + "{" ; a . each ( aa , function ( fa , pa ) { if ( typeof pa === "number" ) var sa = pa * K + "px" ; else if ( pa [ n ] || pa . all ) sa = pa [ n ] || pa . all ; Q += fa + ":" + sa + ";" } ) ; Q += "}" } ) ; R = "-" + Ib . toLowerCase ( ) + "-" ; Q += "#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{" +
R + "transform: scale(" + K + ");} #svg_editor div.toolset .toolset {" + R + "transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {" + R + "transform: scale(" + 1 / K + ");}" ; C . text ( Q ) } na ( ) } } , l = function ( ) { a ( "#dialog_box" ) . hide ( ) ; if ( ka ) { if ( ka ) ga !== a ( "#svg_source_textarea" ) . val ( ) ? a . confirm ( uiStrings . notification . QignoreSourceChanges , function ( n ) { n && z ( ) } ) : z ( ) ; v ( ) } else da && g . leaveContext ( ) } , z = function ( ) { a ( "#svg_source_editor" ) . hide ( ) ; ka = false ; a ( "#svg_source_textarea" ) . blur ( ) } ; a ( window ) . width ( ) ; a ( window ) . height ( ) ;
var v = a . noop ; a ( window ) . resize ( function ( ) { H ( ) } ) ; ( function ( ) { S . scroll ( function ( ) { if ( a ( "#ruler_x" ) . length != 0 ) a ( "#ruler_x" ) [ 0 ] . scrollLeft = S [ 0 ] . scrollLeft ; if ( a ( "#ruler_y" ) . length != 0 ) a ( "#ruler_y" ) [ 0 ] . scrollTop = S [ 0 ] . scrollTop } ) } ) ( ) ; a ( "#url_notice" ) . click ( function ( ) { a . alert ( this . title ) } ) ; a ( "#change_image_url" ) . click ( function ( ) { var n = g . getHref ( W ) ; n = n . indexOf ( "data:" ) === 0 ? "" : n ; a . prompt ( uiStrings . notification . enterNewImgURL , n , function ( w ) { w && Oa ( w ) } ) } ) ; var G = function ( n ) { var w = n [ 0 ] . id == "stroke_color" ? "stroke" :
"fill" , C = n [ 0 ] . id == "canvas_color" ; if ( C ) w = "canvas" ; var K = c . paintBox [ w ] . paint ; n = w == "stroke" ? "Pick a Stroke Paint and Opacity" : "Pick a Fill Paint and Opacity" ; C = C ? { right : 200 , top : 50 } : { left : 45 , bottom : 50 } ; a ( "#color_picker" ) . draggable ( { cancel : ".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker" , containment : "window" } ) . css ( C ) . jGraduate ( { paint : K , window : { pickerTitle : n } , images : { clientPath : curConfig . jGraduatePath } , newstop : "inverse" } , function ( R ) { K = new a . jGraduate . Paint ( R ) ; c . paintBox [ w ] . setPaint ( K ) ;
g . setPaint ( w , K ) ; a ( "#color_picker" ) . hide ( ) } , function ( ) { a ( "#color_picker" ) . hide ( ) } ) } ; q = function ( n , w ) { var C = document . getElementById ( "canvas_background" ) , K = { color : "fff" , opacity : 1 } ; if ( w == "stroke" ) K = curConfig . initStroke ; if ( w == "fill" ) K = curConfig . initFill ; if ( w == "canvas" && C ) if ( C = C . getAttribute ( "fill" ) . match ( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ ) ) K = { color : ( "0" + parseInt ( C [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( C [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( C [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) , opacity : 1 } ; C = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#' +
K . color + '" opacity="' + K . opacity + '"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>' , "text/xml" ) . documentElement ; C = a ( n ) [ 0 ] . appendChild ( document . importNode ( C , true ) ) ; w === "canvas" ? C . setAttribute ( "width" , 60.5 ) : C . setAttribute ( "width" , "100%" ) ; this . rect = C . firstChild ; this . defs = C . getElementsByTagName ( "defs" ) [ 0 ] ; this . grad = this . defs . firstChild ; this . paint = new a . jGraduate . Paint ( { solidColor : K . color } ) ; this . type = w ; this . setPaint = function ( R , Q ) { this . paint = R ; var V = "none" , aa = R . type , fa = R . alpha / 100 ; switch ( aa ) { case "solidColor" : V =
R [ aa ] == "none" || R [ aa ] == "one" ? "none" : "#" + R [ aa ] ; break ; case "linearGradient" : case "radialGradient" : this . defs . removeChild ( this . grad ) ; this . grad = this . defs . appendChild ( R [ aa ] ) ; V = "url(#" + ( this . grad . id = "gradbox_" + this . type ) + ")" } this . rect . setAttribute ( "fill" , V ) ; this . rect . setAttribute ( "opacity" , fa ) ; if ( Q ) { g . setColor ( this . type , V , true ) ; g . setPaintOpacity ( this . type , fa , true ) } if ( this . type == "canvas" ) ( aa = document . getElementById ( "canvas_background" ) ) ? aa . setAttribute ( "fill" , V ) : La ( V ) } ; this . update = function ( R ) { if ( W ) { var Q =
this . type ; switch ( W . tagName ) { case "use" : case "image" : case "foreignObject" : return ; case "g" : case "a" : for ( var V = null , aa = W . getElementsByTagName ( "*" ) , fa = 0 , pa = aa . length ; fa < pa ; fa ++ ) { var sa = aa [ fa ] . getAttribute ( Q ) ; if ( fa === 0 ) V = sa ; else if ( V !== sa ) { V = null ; break } } if ( V === null ) { aa = null ; return } aa = V ; V = 1 ; break ; default : V = parseFloat ( W . getAttribute ( Q + "-opacity" ) ) ; if ( isNaN ( V ) ) V = 1 ; aa = Q === "fill" ? "black" : "none" ; aa = W . getAttribute ( Q ) || aa } if ( R ) { g . setColor ( Q , aa , true ) ; g . setPaintOpacity ( Q , V , true ) } V *= 100 ; this . setPaint ( Ja ( aa , V , Q ) ) } } ;
this . prep = function ( ) { switch ( this . paint . type ) { case "linearGradient" : case "radialGradient" : var R = new a . jGraduate . Paint ( { copy : this . paint } ) ; g . setPaint ( w , R ) } } } ; c . paintBox . fill = new q ( "#fill_color" , "fill" ) ; c . paintBox . stroke = new q ( "#stroke_color" , "stroke" ) ; c . paintBox . canvas = new q ( "#canvas_color" , "canvas" ) ; a ( "#stroke_width" ) . val ( curConfig . initStroke . width ) ; a ( "#group_opacity" ) . val ( curConfig . initOpacity * 100 ) ; q = c . paintBox . fill . rect . cloneNode ( false ) ; q . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; var A =
q . style . vectorEffect === "non-scaling-stroke" ; q . removeAttribute ( "style" ) ; q = c . paintBox . fill . rect . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "feGaussianBlur" ) ; typeof q . stdDeviationX === "undefined" && a ( "#tool_blur" ) . hide ( ) ; a ( q ) . remove ( ) ; setTimeout ( function ( ) { g . embedImage ( "images/placeholder.svg" , function ( n ) { if ( ! n ) { a ( "#image_save_opts [value=embed]" ) . attr ( "disabled" , "disabled" ) ; a ( "#image_save_opts input" ) . val ( [ "ref" ] ) ; s . img _save = "ref" ; a ( "#image_opt_embed" ) . css ( "color" , "#666" ) . attr ( "title" ,
uiStrings . notification . featNotSupported ) } } ) } , 1E3 ) ; a ( "#tool_fill" ) . click ( function ( ) { if ( a ( "#tool_fill" ) . hasClass ( "active" ) ) G ( 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" ) ) G ( a ( "#stroke_color" ) ) ; else { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) } } ) ; a ( "#tool_canvas" ) . on ( "click touchstart" , function ( ) { G ( a ( "#canvas_color" ) ) } ) ; a ( "#tool_stroke" ) . on ( "touchstart" ,
function ( ) { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) ; G ( a ( "#stroke_color" ) ) } ) ; a ( "#tool_fill" ) . on ( "touchstart" , function ( ) { a ( "#tool_fill" ) . addClass ( "active" ) ; a ( "#tool_stroke" ) . removeClass ( "active" ) ; G ( a ( "#fill_color" ) ) } ) ; a ( "#zoom_select" ) . on ( "change" , function ( ) { var n = this . options [ this . selectedIndex ] . text ; n = n . split ( "%" ) [ 0 ] ; a ( "#zoom" ) . val ( n ) . 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 ( ) { S . css ( "line-height" , S . height ( ) + "px" ) } ) ; var u = function ( ) { var n = a ( "#canvas_width" ) , w = a ( "#canvas_height" ) , C = n . val ( ) , K = w . val ( ) ; if ( C != "fit" && ! svgedit . units . isValidUnit ( "width" , C ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; n . parent ( ) . addClass ( "error" ) ; return false } n . parent ( ) . removeClass ( "error" ) ; if ( K != "fit" && ! svgedit . units . isValidUnit ( "height" , K ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; w . parent ( ) . addClass ( "error" ) ; return false } w . parent ( ) . removeClass ( "error" ) ;
if ( ! g . setResolution ( C , K ) ) { a . alert ( uiStrings . notification . noContentToFitTo ) ; C = g . getResolution ( ) ; n . val ( C . w ) ; w . val ( C . h ) ; return false } H ( ) } ; a ( "#resolution" ) . change ( function ( ) { var n = a ( "#canvas_width" ) [ 0 ] , w = a ( "#canvas_height" ) [ 0 ] ; if ( this . selectedIndex ) if ( this . value == "content" ) { n . value = "fit" ; w . value = "fit" ; u ( ) ; var C = g . getResolution ( ) ; n . value = C . w ; w . value = C . h } else { var K = this . value . split ( "x" ) ; K [ 0 ] = parseInt ( K [ 0 ] ) ; K [ 1 ] = parseInt ( K [ 1 ] ) ; var R = K [ 0 ] - n . value , Q = K [ 1 ] - w . value , V = Date . now ( ) , aa = function ( fa ) { fa = ( fa - V ) / 1E3 ;
fa = Math . pow ( fa - 1 , 3 ) + 1 ; n . value = ( K [ 0 ] - R + fa * R ) . toFixed ( 0 ) ; w . value = ( K [ 1 ] - Q + fa * Q ) . toFixed ( 0 ) ; u ( ) ; if ( fa >= 1 ) { fa = g . getResolution ( ) ; a ( "#canvas_width" ) . val ( fa . w . toFixed ( ) ) ; a ( "#canvas_height" ) . val ( fa . h . toFixed ( ) ) ; a ( "#resolution_label" ) . html ( "<div class='pull'>" + fa . w + "<span>\u00d7</span></br>" + fa . h + "</div>" ) } else requestAnimationFrame ( aa ) } ; aa ( Date . now ( ) ) } else { a ( "#resolution_label" ) . html ( "Custom" ) ; n . removeAttribute ( "readonly" ) ; n . focus ( ) ; n . select ( ) ; if ( n . value == "fit" ) { n . value = 100 ; w . value = 100 } } } ) ; a ( "#zoom" ) . change ( function ( ) { xa ( this ) } ) ;
a ( "input,select" ) . attr ( "autocomplete" , "off" ) ; var F = function ( ) { var n = [ { sel : "#tool_select" , fn : wa , evt : "click" , key : [ "V" , true ] } , { sel : "#tool_fhpath" , fn : hb , evt : "click" , key : [ "Q" , true ] } , { sel : "#tool_line" , fn : Ma , evt : "click" , key : [ "L" , true ] } , { sel : "#tool_rect" , fn : Ta , evt : "click" , key : [ "R" , true ] , icon : "rect" } , { sel : "#tool_ellipse" , fn : Fa , evt : "mouseup" , key : [ "C" , true ] , icon : "ellipse" } , { sel : "#tool_path" , fn : Cb , evt : "click" , key : [ "P" , true ] } , { sel : "#tool_text" , fn : bb , evt : "click" , key : [ "T" , true ] } , { sel : "#tool_image" , fn : lb , evt : "mouseup" } ,
{ sel : "#tool_zoom" , fn : tb , evt : "mouseup" , key : [ "Z" , true ] } , { sel : "#tool_clear" , fn : Wa , evt : "mouseup" , key : [ o + "N" , true ] } , { sel : "#tool_save" , fn : function ( ) { ka ? Qb ( ) : clickSave ( ) } , evt : "mouseup" , key : [ o + "S" , true ] } , { sel : "#tool_export" , fn : wb , evt : "mouseup" } , { sel : "#tool_open" , fn : Bb , evt : "mouseup" } , { sel : "#tool_import" , fn : Kb , evt : "mouseup" } , { sel : "#tool_source" , fn : Rb , evt : "click" , key : [ o + "U" , true ] } , { sel : "#tool_wireframe" , fn : Gb , evt : "click" } , { sel : "#tool_snap" , fn : Lb , evt : "click" } , { sel : "#tool_rulers" , fn : Eb , evt : "click" } , { sel : "#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel" ,
fn : l , evt : "click" , key : [ "esc" , false , false ] , hidekey : true } , { sel : "#tool_source_save" , fn : Qb , evt : "click" } , { sel : "#tool_delete,#tool_delete_multi" , fn : ua , evt : "click" , key : [ "del/backspace" , true ] } , { sel : "#tool_reorient" , fn : la , evt : "click" } , { sel : "#tool_node_link" , fn : O , evt : "click" } , { sel : "#tool_node_clone" , fn : T , evt : "click" } , { sel : "#tool_node_delete" , fn : ea , evt : "click" } , { sel : "#tool_openclose_path" , fn : Pa , evt : "click" } , { sel : "#tool_add_subpath" , fn : Ha , evt : "click" } , { sel : "#tool_move_top" , fn : pb , evt : "click" , key : o + "shift+up" } ,
{ sel : "#tool_move_bottom" , fn : gb , evt : "click" , key : o + "shift+down" } , { sel : "#tool_move_up" , fn : ub , evt : "click" , key : [ o + "up" , true ] } , { sel : "#tool_move_down" , fn : vb , evt : "click" , key : [ o + "down" , true ] } , { sel : "#tool_topath" , fn : Ab , evt : "click" } , { sel : "#tool_make_link,#tool_make_link_multi" , fn : ca , evt : "click" } , { sel : "#tool_clone,#tool_clone_multi" , fn : Ob , evt : "click" , key : [ o + "D" , true ] } , { sel : "#tool_group" , fn : Mb , evt : "click" , key : [ o + "G" , true ] } , { sel : "#tool_ungroup" , fn : Mb , evt : "click" , key : o + "shift+G" } , { sel : "#tool_unlink_use" , fn : Mb , evt : "click" } ,
{ sel : "[id^=tool_align]" , fn : Nb , evt : "click" } , { sel : "#tool_undo" , fn : ib , evt : "click" , key : o + "z" } , { sel : "#tool_redo" , fn : Ka , evt : "click" , key : [ "y" , true ] } , { sel : "#tool_cut" , fn : nb , evt : "click" , key : [ o + "x" , true ] } , { sel : "#tool_copy" , fn : kb , evt : "click" , key : o + "c" } , { sel : "#tool_paste" , fn : zb , evt : "click" , key : o + "v" } , { sel : "#tool_switch" , fn : Pb , evt : "click" , key : [ "x" , true ] } , { sel : "#tool_bold" , fn : sb , evt : "mousedown" , key : [ o + "B" , true ] } , { sel : "#tool_italic" , fn : Qa , evt : "mousedown" , key : [ o + "I" , true ] } , { sel : "#copy_save_done" , fn : l , evt : "click" } ,
{ key : "ctrl+left" , fn : function ( ) { ob ( 0 , 1 ) } } , { key : "ctrl+right" , fn : function ( ) { ob ( 1 , 1 ) } } , { key : "ctrl+shift+left" , fn : function ( ) { ob ( 0 , 5 ) } } , { key : "ctrl+shift+right" , fn : function ( ) { ob ( 1 , 5 ) } } , { key : "shift+O" , fn : fb } , { key : "shift+P" , fn : Xa } , { key : [ o + "+" , true ] , fn : function ( ) { Fb ( 2 ) } } , { key : [ o + "-" , true ] , fn : function ( ) { Fb ( 0.5 ) } } , { key : [ "up" , true ] , fn : function ( ) { ja ( 0 , - 1 ) } } , { key : [ "down" , true ] , fn : function ( ) { ja ( 0 , 1 ) } } , { key : [ "left" , true ] , fn : function ( ) { ja ( - 1 , 0 ) } } , { key : [ "right" , true ] , fn : function ( ) { ja ( 1 , 0 ) } } , { key : "shift+up" , fn : function ( ) { ja ( 0 ,
- 10 ) } } , { key : "shift+down" , fn : function ( ) { ja ( 0 , 10 ) } } , { key : "shift+left" , fn : function ( ) { ja ( - 10 , 0 ) } } , { key : "shift+right" , fn : function ( ) { ja ( 10 , 0 ) } } , { key : [ "alt+up" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , - 1 ) } } , { key : [ "alt+down" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , 1 ) } } , { key : [ "alt+left" , true ] , fn : function ( ) { g . cloneSelectedElements ( - 1 , 0 ) } } , { key : [ "alt+right" , true ] , fn : function ( ) { g . cloneSelectedElements ( 1 , 0 ) } } , { key : [ "alt+shift+up" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , - 10 ) } } , { key : [ "alt+shift+down" ,
true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , 10 ) } } , { key : [ "alt+shift+left" , true ] , fn : function ( ) { g . cloneSelectedElements ( - 10 , 0 ) } } , { key : [ "alt+shift+right" , true ] , fn : function ( ) { g . cloneSelectedElements ( 10 , 0 ) } } , { key : o + "A" , fn : function ( ) { g . selectAllInCurrentLayer ( ) } } , { key : o + "shift+z" , fn : Ka } , { key : "esc" , fn : Sb } ] , w = { "4/Shift+4" : "#tools_rect_show" , "5/Shift+5" : "#tools_ellipse_show" } ; return { setAll : function ( ) { var C = { } ; a . each ( n , function ( K , R ) { if ( R . sel ) { var Q = a ( R . sel ) ; if ( Q . length == 0 ) return true ; if ( R . evt ) { if ( svgedit . browser . isTouch ( ) &&
R . evt === "click" ) R . evt = "mousedown" ; Q [ R . evt ] ( R . fn ) } if ( R . parent && a ( R . parent + "_show" ) . length != 0 ) { var V = a ( R . parent ) ; V . length || ( V = ma ( R . parent . substr ( 1 ) ) ) ; V . append ( Q ) ; a . isArray ( C [ R . parent ] ) || ( C [ R . parent ] = [ ] ) ; C [ R . parent ] . push ( R ) } } if ( R . key ) { var aa = R . fn , fa = false ; if ( a . isArray ( R . key ) ) { V = R . key [ 0 ] ; if ( R . key . length > 1 ) fa = R . key [ 1 ] } else V = R . key ; V += "" ; svgedit . browser . isMac && V . indexOf ( "+" ) != - 1 && V . split ( "+" ) [ 0 ] == "ctrl" && V . replace ( "ctrl" , "cmd" ) ; a . each ( V . split ( "/" ) , function ( sa , Za ) { a ( document ) . bind ( "keydown" , Za , function ( Aa ) { aa ( ) ;
fa && Aa . preventDefault ( ) ; return false } ) } ) ; if ( R . sel && ! R . hidekey && Q . attr ( "title" ) ) { var pa = Q . attr ( "title" ) . split ( "[" ) [ 0 ] + " (" + V + ")" ; w [ V ] = R . sel ; Q . parents ( "#main_menu" ) . length || Q . attr ( "title" , pa ) } } } ) ; ra ( C ) ; a ( window ) . bind ( "keydown" , "tab" , function ( K ) { if ( qa === "canvas" ) { K . preventDefault ( ) ; Xa ( ) } } ) . bind ( "keydown" , "shift+tab" , function ( K ) { if ( qa === "canvas" ) { K . preventDefault ( ) ; fb ( ) } } ) ; a ( "#tool_zoom" ) . dblclick ( Ya ) } , setTitles : function ( ) { a . each ( w , function ( C , K ) { var R = a ( K ) . parents ( "#main_menu" ) . length ; a ( K ) . each ( function ( ) { var Q =
R ? a ( this ) . text ( ) . split ( " [" ) [ 0 ] : this . title . split ( " [" ) [ 0 ] , V = "" ; a . each ( C . split ( "/" ) , function ( aa , fa ) { var pa = fa . split ( "+" ) , sa = "" ; if ( pa . length > 1 ) { sa = pa [ 0 ] + "+" ; fa = pa [ 1 ] } V += ( aa ? "/" : "" ) + sa + ( uiStrings [ "key_" + fa ] || fa ) } ) ; if ( R ) this . lastChild . textContent = Q + " [" + V + "]" ; else this . title = Q + " [" + V + "]" } ) } ) } , getButtonData : function ( C ) { var K ; a . each ( n , function ( R , Q ) { if ( Q . sel === C ) K = Q } ) ; return K } } } ( ) ; F . setAll ( ) ; c . ready ( function ( ) { var n = curConfig . initTool , w = a ( "#tools_left, #svg_editor .tools_flyout" ) , C = w . find ( "#tool_" + n ) ; n =
w . find ( "#" + n ) ; ( C . length ? C : n . length ? n : a ( "#tool_select" ) ) . click ( ) . mouseup ( ) ; curConfig . wireframe && a ( "#tool_wireframe" ) . click ( ) ; curConfig . showlayers && toggleSidePanel ( ) ; a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } ) ; a ( "#canvas_height" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : u , cursor : false } ) ; a ( "#canvas_width" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : u , cursor : false } ) ; a ( "#rect_width" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_height" ) . dragInput ( { min : 0 , max : null ,
step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cx" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cy" ) . dragInput ( { min : 0 , 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 : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#selected_x" ) . dragInput ( { min : null ,
2012-07-25 06:32:18 +00:00
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 ,
2012-07-25 08:56:15 +00:00
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 : function ( n ) { g . setRectRadius ( n . value ) } , cursor : true } ) ; a ( "#stroke_width" ) . dragInput ( { min : 0 , max : 99 , step : 1 , callback : function ( n ) { var w = n . value ; if ( w == 0 && W && [ "line" , "polyline" ] . indexOf ( W . nodeName ) >= 0 ) w = n . value = 1 ; g . setStrokeWidth ( w ) } , cursor : true , smallStep : 0.1 , start : 1.5 } ) ; a ( "#angle" ) . dragInput ( { min : - 180 , max : 180 ,
step : 1 , callback : function ( n ) { g . setRotationAngle ( n . value ) ; rotateCursor ( n . value ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , n . value == 0 ) } , cursor : false } ) ; a ( "#font_size" ) . dragInput ( { min : 1 , max : 250 , step : 1 , callback : function ( n ) { g . setFontSize ( n . value ) } , cursor : true , stepfunc : function ( n , w ) { var C = n . value - 0 , K = C + w , R = K >= C ; if ( w === 0 ) return C ; return C >= 24 ? R ? Math . round ( C * 1.1 ) : Math . round ( C / 1.1 ) : C <= 1 ? R ? C * 2 : C / 2 : K } } ) ; a ( "#group_opacity" ) . dragInput ( { min : 0 , max : 100 , step : 5 , callback : function ( n , w ) { if ( w == null ) w = n . value ; a ( "#group_opacity" ) . val ( w ) ;
if ( ! n || ! n . handle ) a ( "#opac_slider" ) . slider ( "option" , "value" , w ) ; g . setOpacity ( w / 100 ) } , cursor : true , start : 100 } ) ; a ( "#blur" ) . dragInput ( { min : 0 , max : 10 , step : 0.1 , callback : function ( n ) { val = n . value ; a ( "#blur" ) . val ( val ) ; window . event . type == "mouseup" ? g . setBlur ( val , true ) : g . setBlurNoUndo ( val ) } , cursor : true , start : 0 } ) ; a ( "#zoom" ) . val ( g . getZoom ( ) * 100 ) ; a ( "#workarea" ) . contextMenu ( { menu : "cmenu_canvas" , inSpeed : 0 } , function ( n ) { switch ( n ) { case "delete" : ua ( ) ; break ; case "cut" : nb ( ) ; break ; case "copy" : kb ( ) ; break ; case "paste" : g . pasteElements ( ) ;
break ; case "paste_in_place" : g . pasteElements ( "in_place" ) ; break ; case "group" : g . groupSelectedElements ( ) ; break ; case "ungroup" : g . ungroupSelectedElement ( ) ; break ; case "move_front" : pb ( ) ; break ; case "move_up" : xb ( "Up" ) ; break ; case "move_down" : xb ( "Down" ) ; break ; case "move_back" : gb ( ) ; break ; default : svgedit . contextmenu && svgedit . contextmenu . hasCustomHandler ( n ) && svgedit . contextmenu . getCustomHandler ( n ) . call ( ) } } ) ; a ( ".contextMenu li" ) . mousedown ( function ( n ) { n . preventDefault ( ) } ) ; a ( "#cmenu_canvas li" ) . disableContextMenu ( ) ;
Y . enableContextMenuItems ( "#delete,#cut,#copy" ) ; window . onbeforeunload = function ( ) { if ( U . getUndoStackSize ( ) === 0 ) c . show _save _warning = false ; if ( ! curConfig . no _save _warning && c . show _save _warning ) return uiStrings . notification . unsavedChanges } ; c . openPrep = function ( n ) { a ( "#main_menu" ) . hide ( ) ; U . getUndoStackSize ( ) === 0 ? n ( true ) : a . confirm ( uiStrings . notification . QwantToOpen , n ) } ; if ( window . FileReader ) { q = a ( '<input type="file">' ) . change ( function ( ) { var n = this ; c . openPrep ( function ( w ) { if ( w ) { g . clear ( ) ; if ( n . files . length == 1 ) { w = new FileReader ;
w . onloadend = function ( C ) { p ( C . target . result ) ; H ( ) } ; w . readAsText ( n . files [ 0 ] ) } } } ) } ) ; a ( "#tool_open" ) . show ( ) . prepend ( q ) ; q = a ( '<input type="file">' ) . change ( function ( ) { a ( "#main_menu" ) . hide ( ) ; if ( this . files . length == 1 ) { var n = new FileReader ; n . onloadend = function ( w ) { g . importSvgString ( w . target . result , true ) ; H ( ) } ; n . readAsText ( this . files [ 0 ] ) } } ) ; a ( "#tool_import" ) . show ( ) . prepend ( q ) } for ( var H = c . updateCanvas = function ( n , w ) { var C = S . width ( ) , K = S . height ( ) , R = C , Q = K , V = g . getZoom ( ) , aa = a ( "#svgcanvas" ) , fa = { x : S [ 0 ] . scrollLeft + R / 2 , y : S [ 0 ] . scrollTop +
Q / 2 } , pa = curConfig . canvas _expansion ; C = Math . max ( R , g . contentW * V * pa ) ; K = Math . max ( Q , g . contentH * V * pa ) ; C == R && K == Q ? S . css ( "overflow" , "hidden" ) : S . css ( "overflow" , "scroll" ) ; pa = aa . height ( ) / 2 ; var sa = aa . width ( ) / 2 ; aa . width ( C ) . height ( K ) ; var Za = K / 2 , Aa = C / 2 , ha = g . updateCanvas ( C , K ) , eb = Aa / sa ; C = C / 2 - R / 2 ; K = K / 2 - Q / 2 ; if ( w ) { w . x += ha . x ; w . y += ha . y } else w = { x : Aa + ( fa . x - sa ) * eb , y : Za + ( fa . y - pa ) * eb } ; if ( n ) if ( g . contentW > S . width ( ) ) { S [ 0 ] . scrollLeft = ha . x - 10 ; S [ 0 ] . scrollTop = ha . y - 10 } else { S [ 0 ] . scrollLeft = C ; S [ 0 ] . scrollTop = K } else { S [ 0 ] . scrollLeft = w . x -
R / 2 ; S [ 0 ] . scrollTop = w . y - Q / 2 } if ( curConfig . showRulers ) { k ( aa , V ) ; S . scroll ( ) } } , D = [ ] , E = 0.1 ; E < 1E5 ; E *= 10 ) { D . push ( 1 * E ) ; D . push ( 2 * E ) ; D . push ( 5 * E ) } H ( true ) ; try { var L = function ( n ) { if ( window . JSON && JSON . stringify ) return JSON . stringify ( n ) ; var w = arguments . callee ; if ( typeof n == "boolean" || typeof n == "number" ) return n + "" ; else if ( typeof n == "string" ) return '"' + n . replace ( /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g , function ( R ) { return "\\u" + ( "0000" + R . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) } ) +
'"' ; else if ( n . length ) { for ( var C = 0 ; C < n . length ; C ++ ) n [ C ] = w ( n [ C ] ) ; return "[" + n . join ( "," ) + "]" } else { C = [ ] ; for ( var K in n ) C . push ( w ( K ) + ":" + w ( n [ K ] ) ) ; return "{" + C . join ( "," ) + "}" } } ; window . addEventListener ( "message" , function ( n ) { var w = parseInt ( n . data . substr ( 0 , n . data . indexOf ( ";" ) ) ) ; try { n . source . postMessage ( "SVGe" + w + ";" + L ( eval ( n . data ) ) , "*" ) } catch ( C ) { n . source . postMessage ( "SVGe" + w + ";error:" + C . message , "*" ) } } , false ) } catch ( N ) { window . embed _error = N } a ( function ( ) { window . svgCanvas = g ; g . ready = svgEditor . ready } ) ; c . setLang = function ( n ,
w ) { a . pref ( "lang" , n ) ; a ( "#lang_select" ) . val ( n ) ; if ( w ) { g . runExtensions ( "langChanged" , n ) ; Ca ( ) ; 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 ( C , K ) { a ( K ) . attr ( "title" , a ( C ) [ 0 ] . title ) } ) ; a ( "#multiselected_panel div[id^=tool_align]" ) . each ( function ( ) { a ( "#tool_pos" + this . id . substr ( 10 ) ) [ 0 ] . title = this . title } ) } } } ; var f = [ ] ; c . ready = function ( d ) { m ? d ( ) : f . push ( d ) } ;
c . runCallbacks = function ( ) { a . each ( f , function ( ) { this ( ) } ) ; m = true } ; c . loadFromString = function ( d ) { c . ready ( function ( ) { p ( d ) } ) } ; c . loadFromURL = function ( d , k ) { k || ( k = { } ) ; var q = k . cache , B = k . callback ; c . ready ( function ( ) { a . ajax ( { url : d , dataType : "text" , cache : ! ! q , success : function ( o ) { p ( o , B ) } , error : function ( o , J , U ) { o . status != 404 && o . responseText ? p ( o . responseText , B ) : a . alert ( uiStrings . notification . URLloadFail + ": \n" + U + "" , B ) } } ) } ) } ; c . loadFromDataURI = function ( d ) { c . ready ( function ( ) { var k = d . substring ( 26 ) ; p ( svgedit . utilities . decode64 ( k ) ) } ) } ;
c . addExtension = function ( ) { var d = arguments ; a ( function ( ) { g && g . addExtension . apply ( this , d ) } ) } ; return c } ( jQuery ) ; $ ( svgEditor . 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 && a . step ? Number ( a . step ) : 1 , stepfunc : a && a . stepfunc ? a . stepfunc : false , page : a && a . page ? Number ( a . page ) : 10 , reset : a && a . reset ? a . reset : this . value , delay : a && a . delay ? Number ( a . delay ) : 500 , interval : a && a . interval ? Number ( a . interval ) : 100 , 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 p = $ ( this ) . parent ( ) , g = $ ( this ) , c = this . dragCfg . height , m = this . dragCfg . min , s = this . dragCfg . max , b = this . dragCfg . step , f = s - m > 0 ? ( s - m ) / b : 200 , d = f / c * b , k = 0 , q = this . getAttribute ( "data-attr" ) , B = svgEditor . canvas , o = B . getSelectedElems ( ) , J = svgedit . browser . isTouch ( ) , U = f && this . dragCfg . cursor ? $ ( "<div class='draginput_cursor' />" ) . appendTo ( p ) : false ; g . attr ( "readonly" ,
"readonly" ) ; U && ! isNaN ( this . dragCfg . start ) && U . css ( "top" , this . dragCfg . start * - 1 / d + c ) ; this . adjustValue = function ( M , I ) { var S ; S = isNaN ( this . value ) ? this . dragCfg . reset : $ . isFunction ( this . dragCfg . stepfunc ) ? this . dragCfg . stepfunc ( this , M ) : Number ( ( Number ( this . value ) + Number ( M ) ) . toFixed ( 5 ) ) ; if ( s !== null ) S = Math . min ( S , s ) ; if ( m !== null ) S = Math . max ( S , m ) ; U && this . updateCursor ( S ) ; this . value = S ; p . attr ( "data-value" , S ) ; $ . isFunction ( this . dragCfg . callback ) && this . dragCfg . callback ( this , I ) } ; p . toggleClass ( "draginput" , p . is ( "label" ) ) ; this . move =
function ( M , I , S ) { if ( J ) M = M . originalEvent . touches [ 0 ] ; if ( k === 0 ) k = I ; I = ( M . pageY - k ) * - 1 ; k = M . pageY ; S = I * d ; this . adjustValue ( S . toFixed ( b < 1 ? 1 : 0 ) ) } ; this . stop = function ( ) { $ ( "body" ) . removeClass ( "dragging" ) ; p . removeClass ( "active" ) ; $ ( window ) . unbind ( "mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput" ) ; k = 0 ; if ( o [ 0 ] ) { var M = B . undoMgr . finishUndoableChange ( ) ; M . isEmpty ( ) || B . undoMgr . addCommandToHistory ( M ) } this . adjustValue ( 0 ) } ; this . updateCursor = function ( ) { var M = parseFloat ( this . value ) * - 1 / d + c ; U . css ( "top" ,
M ) } ; this . start = function ( M ) { if ( J ) M = M . originalEvent . touches [ 0 ] ; var I = M . pageY , S = this . value , Y = this ; B . undoMgr . beginUndoableChange ( q , o ) ; $ ( "body" ) . addClass ( "dragging" ) ; p . addClass ( "active" ) ; $ ( window ) . bind ( "mousemove.draginput touchmove.draginput" , function ( P ) { Y . move ( P , I , parseFloat ( S ) ) } ) ; $ ( window ) . bind ( "mouseup.draginput touchend.draginput" , function ( ) { Y . stop ( ) } ) } ; $ ( this ) . attr ( "readonly" , "readonly" ) . attr ( "data-scale" , d ) . attr ( "data-domain" , c ) . attr ( "data-cursor" , U != false ) . bind ( "mousedown touchstart" , function ( M ) { this . blur ( ) ;
this . start ( M ) } ) . bind ( "dblclick taphold" , function ( ) { this . removeAttribute ( "readonly" , "readonly" ) ; this . focus ( ) ; this . select ( ) } ) . keydown ( function ( M ) { switch ( M . 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 ( M , I , S , Y ) { if ( Y > 0 ) this . adjustValue ( this . dragCfg . step , true ) ; else Y < 0 && this . adjustValue ( - this . dragCfg . step , true ) ; M . preventDefault ( ) } ) } ) } ;
2012-07-25 06:32:18 +00:00
$ . fn . dragInput . updateCursor = function ( a ) { var p = parseFloat ( a . value ) , g = parseFloat ( a . getAttribute ( "data-scale" ) ) , c = parseFloat ( a . getAttribute ( "data-domain" ) ) ; p = p * - 1 / g + c + "px" ; a = a . parentNode . lastChild ; if ( a . className == "draginput_cursor" ) a . style . top = p } ; svgedit = svgedit || { } ;
( function ( ) { var a = this ; if ( ! svgedit . contextmenu ) svgedit . contextmenu = { } ; a . contextMenuExtensions = { } ; svgEditor . ready ( function ( ) { for ( menuItem in contextMenuExtensions ) { var p = contextMenuExtensions [ menuItem ] ; Object . keys ( a . contextMenuExtensions ) . length == 0 && $ ( "#cmenu_canvas" ) . append ( "<li class='separator'>" ) ; var g = p . shortcut || "" ; $ ( "#cmenu_canvas" ) . append ( "<li class='disabled'><a href='#" + p . id + "'>" + p . label + "<span class='shortcut'>" + g + "</span></a></li>" ) } } ) ; svgedit . contextmenu . resetCustomMenus = function ( ) { a . contextMenuExtensions =
{ } } ; svgedit . contextmenu . add = function ( p ) { if ( p && p . id && p . label && p . action && typeof p . action == "function" ) if ( p . id in a . contextMenuExtensions ) console . error ( 'Cannot add extension "' + p . id + '", an extension by that name already exists"' ) ; else { console . log ( "Registed contextmenu item: {id:" + p . id + ", label:" + p . label + "}" ) ; a . contextMenuExtensions [ p . id ] = p } 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 =
2012-07-25 08:56:15 +00:00
function ( p ) { return a . contextMenuExtensions [ p ] && true } ; svgedit . contextmenu . getCustomHandler = function ( p ) { return a . contextMenuExtensions [ p ] . action } } ) ( ) ; ( function ( a , p ) { function g ( m ) { return ! a ( m ) . parents ( ) . andSelf ( ) . filter ( function ( ) { return a . curCSS ( this , "visibility" ) === "hidden" || a . expr . filters . hidden ( this ) } ) . length } function c ( m , s ) { var b = m . nodeName . toLowerCase ( ) ; if ( "area" === b ) { b = m . parentNode ; var f = b . name ; if ( ! m . href || ! f || b . nodeName . toLowerCase ( ) !== "map" ) return false ; b = a ( "img[usemap=#" + f + "]" ) [ 0 ] ; return ! ! b && g ( b ) } return ( /input|select|textarea|button|object/ . test ( b ) ? ! m . disabled : "a" == b ? m . href || s : s ) && g ( m ) } 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 ( m , s ) { return typeof m == "number" ? this . each ( function ( ) { var b =
this ; setTimeout ( function ( ) { a ( b ) . focus ( ) ; s && s . call ( b ) } , m ) } ) : this . _focus . apply ( this , arguments ) } , scrollParent : function ( ) { var m ; a . browser . msie && /(static|relative)/ . test ( this . css ( "position" ) ) || /absolute/ . test ( this . css ( "position" ) ) ? m = 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 ) : m = 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" ) ) || ! m . length ? a ( document ) : m } , zIndex : function ( m ) { if ( m !== p ) return this . css ( "zIndex" , m ) ; if ( this . length ) { m = a ( this [ 0 ] ) ; for ( var s ; m . length && m [ 0 ] !== document ; ) { s = m . css ( "position" ) ; if ( s === "absolute" || s === "relative" || s === "fixed" ) { s = parseInt ( m . css ( "zIndex" ) , 10 ) ; if ( ! isNaN ( s ) && s !== 0 ) return s } m = m . parent ( ) } } return 0 } , disableSelection : function ( ) { return this . bind ( ( a . support . selectstart ? "selectstart" :
"mousedown" ) + ".ui-disableSelection" , function ( m ) { m . preventDefault ( ) } ) } , enableSelection : function ( ) { return this . unbind ( ".ui-disableSelection" ) } } ) , a . each ( [ "Width" , "Height" ] , function ( m , s ) { function b ( q , B , o , J ) { a . each ( f , function ( ) { B -= parseFloat ( a . curCSS ( q , "padding" + this , true ) ) || 0 ; o && ( B -= parseFloat ( a . curCSS ( q , "border" + this + "Width" , true ) ) || 0 ) ; J && ( B -= parseFloat ( a . curCSS ( q , "margin" + this , true ) ) || 0 ) } ) ; return B } var f = s === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] , d = s . toLowerCase ( ) , k = { innerWidth : a . fn . innerWidth , innerHeight : a . fn . innerHeight ,
outerWidth : a . fn . outerWidth , outerHeight : a . fn . outerHeight } ; a . fn [ "inner" + s ] = function ( q ) { if ( q === p ) return k [ "inner" + s ] . call ( this ) ; return this . each ( function ( ) { a ( this ) . css ( d , b ( this , q ) + "px" ) } ) } ; a . fn [ "outer" + s ] = function ( q , B ) { if ( typeof q != "number" ) return k [ "outer" + s ] . call ( this , q ) ; return this . each ( function ( ) { a ( this ) . css ( d , b ( this , q , true , B ) + "px" ) } ) } } ) , a . extend ( a . expr [ ":" ] , { data : function ( m , s , b ) { return ! ! a . data ( m , b [ 3 ] ) } , focusable : function ( m ) { return c ( m , ! isNaN ( a . attr ( m , "tabindex" ) ) ) } , tabbable : function ( m ) { var s = a . attr ( m ,
"tabindex" ) , b = isNaN ( s ) ; return ( b || s >= 0 ) && c ( m , ! b ) } } ) , a ( function ( ) { var m = document . body , s = m . appendChild ( s = document . createElement ( "div" ) ) ; a . extend ( s . style , { minHeight : "100px" , height : "auto" , padding : 0 , borderWidth : 0 } ) ; a . support . minHeight = s . offsetHeight === 100 ; a . support . selectstart = "onselectstart" in s ; m . removeChild ( s ) . style . display = "none" } ) , a . extend ( a . ui , { plugin : { add : function ( m , s , b ) { m = a . ui [ m ] . prototype ; for ( var f in b ) { m . plugins [ f ] = m . plugins [ f ] || [ ] ; m . plugins [ f ] . push ( [ s , b [ f ] ] ) } } , call : function ( m , s , b ) { if ( ( s = m . plugins [ s ] ) &&
m . element [ 0 ] . parentNode ) for ( var f = 0 ; f < s . length ; f ++ ) m . options [ s [ f ] [ 0 ] ] && s [ f ] [ 1 ] . apply ( m . element , b ) } } , contains : function ( m , s ) { return document . compareDocumentPosition ? m . compareDocumentPosition ( s ) & 16 : m !== s && m . contains ( s ) } , hasScroll : function ( m , s ) { if ( a ( m ) . css ( "overflow" ) === "hidden" ) return false ; var b = s && s === "left" ? "scrollLeft" : "scrollTop" , f = false ; if ( m [ b ] > 0 ) return true ; m [ b ] = 1 ; f = m [ b ] > 0 ; m [ b ] = 0 ; return f } , isOverAxis : function ( m , s , b ) { return m > s && m < s + b } , isOver : function ( m , s , b , f , d , k ) { return a . ui . isOverAxis ( m , b , d ) &&
a . ui . isOverAxis ( s , f , k ) } } ) ) } ) ( jQuery ) ;
( function ( a , p ) { if ( a . cleanData ) { var g = a . cleanData ; a . cleanData = function ( m ) { for ( var s = 0 , b ; ( b = m [ s ] ) != null ; s ++ ) try { a ( b ) . triggerHandler ( "remove" ) } catch ( f ) { } g ( m ) } } else { var c = a . fn . remove ; a . fn . remove = function ( m , s ) { return this . each ( function ( ) { s || ( ! m || a . filter ( m , [ this ] ) . length ) && a ( "*" , this ) . add ( [ this ] ) . each ( function ( ) { try { a ( this ) . triggerHandler ( "remove" ) } catch ( b ) { } } ) ; return c . call ( a ( this ) , m , s ) } ) } } a . widget = function ( m , s , b ) { var f = m . split ( "." ) [ 0 ] , d ; m = m . split ( "." ) [ 1 ] ; d = f + "-" + m ; b || ( b = s , s = a . Widget ) ; a . expr [ ":" ] [ d ] =
function ( k ) { return ! ! a . data ( k , m ) } ; a [ f ] = a [ f ] || { } ; a [ f ] [ m ] = function ( k , q ) { arguments . length && this . _createWidget ( k , q ) } ; s = new s ; s . options = a . extend ( true , { } , s . options ) ; a [ f ] [ m ] . prototype = a . extend ( true , s , { namespace : f , widgetName : m , widgetEventPrefix : a [ f ] [ m ] . prototype . widgetEventPrefix || m , widgetBaseClass : d } , b ) ; a . widget . bridge ( m , a [ f ] [ m ] ) } ; a . widget . bridge = function ( m , s ) { a . fn [ m ] = function ( b ) { var f = typeof b == "string" , d = Array . prototype . slice . call ( arguments , 1 ) , k = this ; b = ! f && d . length ? a . extend . apply ( null , [ true , b ] . concat ( d ) ) :
b ; if ( f && b . charAt ( 0 ) === "_" ) return k ; f ? this . each ( function ( ) { var q = a . data ( this , m ) , B = q && a . isFunction ( q [ b ] ) ? q [ b ] . apply ( q , d ) : q ; if ( B !== q && B !== p ) { k = B ; return false } } ) : this . each ( function ( ) { var q = a . data ( this , m ) ; q ? q . option ( b || { } ) . _init ( ) : a . data ( this , m , new s ( b , this ) ) } ) ; return k } } ; a . Widget = function ( m , s ) { arguments . length && this . _createWidget ( m , s ) } ; a . Widget . prototype = { widgetName : "widget" , widgetEventPrefix : "" , options : { disabled : false } , _createWidget : function ( m , s ) { a . data ( s , this . widgetName , this ) ; this . element = a ( s ) ; this . options =
a . extend ( true , { } , this . options , this . _getCreateOptions ( ) , m ) ; 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 ( m , s ) { var b = m ; if ( arguments . length === 0 ) return a . extend ( { } , this . options ) ; if ( typeof m == "string" ) { if ( s === p ) return this . options [ m ] ; b = { } ; b [ m ] = s } this . _setOptions ( b ) ; return this } , _setOptions : function ( m ) { var s = this ; a . each ( m , function ( b , f ) { s . _setOption ( b , f ) } ) ; return this } , _setOption : function ( m , s ) { this . options [ m ] = s ; m === "disabled" && this . widget ( ) [ s ? "addClass" : "removeClass" ] ( this . widgetBaseClass + "-disabled ui-state-disabled" ) . attr ( "aria-disabled" ,
s ) ; return this } , enable : function ( ) { return this . _setOption ( "disabled" , false ) } , disable : function ( ) { return this . _setOption ( "disabled" , true ) } , _trigger : function ( m , s , b ) { var f , d = this . options [ m ] ; b = b || { } ; s = a . Event ( s ) ; s . type = ( m === this . widgetEventPrefix ? m : this . widgetEventPrefix + m ) . toLowerCase ( ) ; s . target = this . element [ 0 ] ; if ( m = s . originalEvent ) for ( f in m ) f in s || ( s [ f ] = m [ f ] ) ; this . element . trigger ( s , b ) ; return ! ( a . isFunction ( d ) && d . call ( this . element [ 0 ] , s , b ) === false || s . isDefaultPrevented ( ) ) } } } ) ( jQuery ) ;
2012-07-25 06:32:18 +00:00
( function ( a ) { var p = false ; a ( document ) . mouseup ( function ( ) { p = false } ) ; a . widget ( "ui.mouse" , { options : { cancel : ":input,option" , distance : 1 , delay : 0 } , _mouseInit : function ( ) { var g = this ; this . element . bind ( "mousedown." + this . widgetName , function ( c ) { return g . _mouseDown ( c ) } ) . bind ( "click." + this . widgetName , function ( c ) { if ( true === a . data ( c . target , g . widgetName + ".preventClickEvent" ) ) { a . removeData ( c . target , g . widgetName + ".preventClickEvent" ) ; c . stopImmediatePropagation ( ) ; return false } } ) ; this . started = false } , _mouseDestroy : function ( ) { this . element . unbind ( "." +
2012-07-25 08:56:15 +00:00
this . widgetName ) } , _mouseDown : function ( g ) { if ( ! p ) { this . _mouseStarted && this . _mouseUp ( g ) ; this . _mouseDownEvent = g ; var c = this , m = g . which == 1 , s = typeof this . options . cancel == "string" && g . target . nodeName ? a ( g . target ) . closest ( this . options . cancel ) . length : false ; if ( ! m || s || ! this . _mouseCapture ( g ) ) return true ; ( this . mouseDelayMet = ! this . options . delay ) || ( this . _mouseDelayTimer = setTimeout ( function ( ) { c . mouseDelayMet = true } , this . options . delay ) ) ; if ( this . _mouseDistanceMet ( g ) && this . _mouseDelayMet ( g ) ) { this . _mouseStarted = this . _mouseStart ( g ) !==
2012-07-25 06:32:18 +00:00
false ; if ( ! this . _mouseStarted ) { g . preventDefault ( ) ; return true } } true === a . data ( g . target , this . widgetName + ".preventClickEvent" ) && a . removeData ( g . 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 ) ; g . preventDefault ( ) ; return p = true } } , _mouseMove : function ( g ) { if ( a . browser . msie &&
2012-07-24 02:30:12 +00:00
! ( document . documentMode >= 9 ) && ! g . button ) return this . _mouseUp ( g ) ; if ( this . _mouseStarted ) { this . _mouseDrag ( g ) ; return g . preventDefault ( ) } this . _mouseDistanceMet ( g ) && this . _mouseDelayMet ( g ) && ( this . _mouseStarted = this . _mouseStart ( this . _mouseDownEvent , g ) !== false , this . _mouseStarted ? this . _mouseDrag ( g ) : this . _mouseUp ( g ) ) ; return ! this . _mouseStarted } , _mouseUp : function ( g ) { a ( document ) . unbind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . unbind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; this . _mouseStarted &&
( this . _mouseStarted = false , g . target == this . _mouseDownEvent . target && a . data ( g . target , this . widgetName + ".preventClickEvent" , true ) , this . _mouseStop ( g ) ) ; return false } , _mouseDistanceMet : function ( g ) { return Math . max ( Math . abs ( this . _mouseDownEvent . pageX - g . pageX ) , Math . abs ( this . _mouseDownEvent . pageY - g . pageY ) ) >= this . options . distance } , _mouseDelayMet : function ( ) { return this . mouseDelayMet } , _mouseStart : function ( ) { } , _mouseDrag : function ( ) { } , _mouseStop : function ( ) { } , _mouseCapture : function ( ) { return true } } ) } ) ( jQuery ) ;
2012-06-23 19:40:40 +00:00
( 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" &&
2012-07-25 06:32:18 +00:00
! /^(?: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 ( p ) { var g = this . options ;
if ( this . helper || g . disabled || a ( p . target ) . is ( ".ui-resizable-handle" ) ) return false ; this . handle = this . _getHandle ( p ) ; if ( ! this . handle ) return false ; g . iframeFix && a ( g . iframeFix === true ? "iframe" : g . 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 ( p ) { var g = this . options ; this . helper =
this . _createHelper ( p ) ; 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 : p . pageX - this . offset . left , top : p . pageY - this . offset . top } , parent : this . _getParentOffset ( ) , relative : this . _getRelativeOffset ( ) } ) ;
this . originalPosition = this . position = this . _generatePosition ( p ) ; this . originalPageX = p . pageX ; this . originalPageY = p . pageY ; g . cursorAt && this . _adjustOffsetFromHelper ( g . cursorAt ) ; g . containment && this . _setContainment ( ) ; if ( this . _trigger ( "start" , p ) === false ) { this . _clear ( ) ; return false } this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ! g . dropBehaviour && a . ui . ddmanager . prepareOffsets ( this , p ) ; this . helper . addClass ( "ui-draggable-dragging" ) ; this . _mouseDrag ( p , true ) ; a . ui . ddmanager && a . ui . ddmanager . dragStart ( this , p ) ; return true } ,
_mouseDrag : function ( p , g ) { this . position = this . _generatePosition ( p ) ; this . positionAbs = this . _convertPositionTo ( "absolute" ) ; if ( ! g ) { var c = this . _uiHash ( ) ; if ( this . _trigger ( "drag" , p , 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 , p ) ; return false } , _mouseStop : function ( p ) { var g =
false ; a . ui . ddmanager && ! this . options . dropBehaviour && ( g = a . ui . ddmanager . drop ( this , p ) ) ; this . dropped && ( g = this . dropped , this . dropped = false ) ; if ( ( ! this . element [ 0 ] || ! this . element [ 0 ] . parentNode ) && this . options . helper == "original" ) return false ; if ( this . options . revert == "invalid" && ! g || this . options . revert == "valid" && g || this . options . revert === true || a . isFunction ( this . options . revert ) && this . options . revert . call ( this . element , g ) ) { var c = this ; a ( this . helper ) . animate ( this . originalPosition , parseInt ( this . options . revertDuration , 10 ) ,
function ( ) { c . _trigger ( "stop" , p ) !== false && c . _clear ( ) } ) } else this . _trigger ( "stop" , p ) !== false && this . _clear ( ) ; return false } , _mouseUp : function ( p ) { this . options . iframeFix === true && a ( "div.ui-draggable-iframeFix" ) . each ( function ( ) { this . parentNode . removeChild ( this ) } ) ; a . ui . ddmanager && a . ui . ddmanager . dragStop ( this , p ) ; return a . ui . mouse . prototype . _mouseUp . call ( this , p ) } , cancel : function ( ) { this . helper . is ( ".ui-draggable-dragging" ) ? this . _mouseUp ( { } ) : this . _clear ( ) ; return this } , _getHandle : function ( p ) { var g = ! this . options . handle ||
! a ( this . options . handle , this . element ) . length ? true : false ; a ( this . options . handle , this . element ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { this == p . target && ( g = true ) } ) ; return g } , _createHelper : function ( p ) { var g = this . options ; p = a . isFunction ( g . helper ) ? a ( g . helper . apply ( this . element [ 0 ] , [ p ] ) ) : g . helper == "clone" ? this . element . clone ( ) . removeAttr ( "id" ) : this . element ; p . parents ( "body" ) . length || p . appendTo ( g . appendTo == "parent" ? this . element [ 0 ] . parentNode : g . appendTo ) ; p [ 0 ] != this . element [ 0 ] && ! /(fixed|absolute)/ . test ( p . css ( "position" ) ) &&
p . css ( "position" , "absolute" ) ; return p } , _adjustOffsetFromHelper : function ( p ) { typeof p == "string" && ( p = p . split ( " " ) ) ; a . isArray ( p ) && ( p = { left : + p [ 0 ] , top : + p [ 1 ] || 0 } ) ; "left" in p && ( this . offset . click . left = p . left + this . margins . left ) ; "right" in p && ( this . offset . click . left = this . helperProportions . width - p . right + this . margins . left ) ; "top" in p && ( this . offset . click . top = p . top + this . margins . top ) ; "bottom" in p && ( this . offset . click . top = this . helperProportions . height - p . bottom + this . margins . top ) } , _getParentOffset : function ( ) { this . offsetParent =
this . helper . offsetParent ( ) ; var p = this . offsetParent . offset ( ) ; this . cssPosition == "absolute" && this . scrollParent [ 0 ] != document && a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) && ( p . left += this . scrollParent . scrollLeft ( ) , p . top += this . scrollParent . scrollTop ( ) ) ; if ( this . offsetParent [ 0 ] == document . body || this . offsetParent [ 0 ] . tagName && this . offsetParent [ 0 ] . tagName . toLowerCase ( ) == "html" && a . browser . msie ) p = { top : 0 , left : 0 } ; return { top : p . top + ( parseInt ( this . offsetParent . css ( "borderTopWidth" ) , 10 ) || 0 ) , left : p . left + ( parseInt ( this . offsetParent . css ( "borderLeftWidth" ) ,
10 ) || 0 ) } } , _getRelativeOffset : function ( ) { if ( this . cssPosition == "relative" ) { var p = this . element . position ( ) ; return { top : p . top - ( parseInt ( this . helper . css ( "top" ) , 10 ) || 0 ) + this . scrollParent . scrollTop ( ) , left : p . 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 p = this . options ; p . containment == "parent" && ( p . containment = this . helper [ 0 ] . parentNode ) ; if ( p . containment == "document" || p . containment == "window" ) this . containment = [ p . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) - this . offset . relative . left - this . offset . parent . left , p . containment == "document" ? 0 : a ( window ) . scrollTop ( ) - this . offset . relative . top - this . offset . parent . top ,
( p . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) ) + a ( p . containment == "document" ? document : window ) . width ( ) - this . helperProportions . width - this . margins . left , ( p . containment == "document" ? 0 : a ( window ) . scrollTop ( ) ) + ( a ( p . containment == "document" ? document : window ) . height ( ) || document . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top ] ; if ( ! /^(document|window|parent)$/ . test ( p . containment ) && p . containment . constructor != Array ) { p = a ( p . containment ) ; var g = p [ 0 ] ; if ( g ) { p . offset ( ) ; var c = a ( g ) . css ( "overflow" ) !=
2012-07-24 12:42:34 +00:00
"hidden" ; this . containment = [ ( parseInt ( a ( g ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( g ) . css ( "paddingLeft" ) , 10 ) || 0 ) , ( parseInt ( a ( g ) . css ( "borderTopWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( g ) . css ( "paddingTop" ) , 10 ) || 0 ) , ( c ? Math . max ( g . scrollWidth , g . offsetWidth ) : g . offsetWidth ) - ( parseInt ( a ( g ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) - ( parseInt ( a ( g ) . css ( "paddingRight" ) , 10 ) || 0 ) - this . helperProportions . width - this . margins . left - this . margins . right , ( c ? Math . max ( g . scrollHeight , g . offsetHeight ) : g . offsetHeight ) - ( parseInt ( a ( g ) . css ( "borderTopWidth" ) ,
2012-07-25 08:56:15 +00:00
10 ) || 0 ) - ( parseInt ( a ( g ) . css ( "paddingBottom" ) , 10 ) || 0 ) - this . helperProportions . height - this . margins . top - this . margins . bottom ] ; this . relative _container = p } } else p . containment . constructor == Array && ( this . containment = p . containment ) } , _convertPositionTo : function ( p , g ) { g || ( g = this . position ) ; var c = p == "absolute" ? 1 : - 1 , m = this . cssPosition == "absolute" && ( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , s = /(html|body)/i . test ( m [ 0 ] . tagName ) ; return { top : g . 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 ( ) : s ? 0 : m . scrollTop ( ) ) * c ) , left : g . 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 ( ) : s ? 0 : m . scrollLeft ( ) ) * c ) } } , _generatePosition : function ( p ) { var g = this . options , c = this . cssPosition == "absolute" &&
( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , m = /(html|body)/i . test ( c [ 0 ] . tagName ) , s = p . pageX , b = p . pageY ; if ( this . originalPosition ) { var f ; if ( this . containment ) { if ( this . relative _container ) { f = this . relative _container . offset ( ) ; f = [ this . containment [ 0 ] + f . left , this . containment [ 1 ] + f . top , this . containment [ 2 ] + f . left , this . containment [ 3 ] + f . top ] } else f = this . containment ; p . pageX - this . offset . click . left < f [ 0 ] && ( s = f [ 0 ] + this . offset . click . left ) ;
2012-07-25 06:32:18 +00:00
p . pageY - this . offset . click . top < f [ 1 ] && ( b = f [ 1 ] + this . offset . click . top ) ; p . pageX - this . offset . click . left > f [ 2 ] && ( s = f [ 2 ] + this . offset . click . left ) ; p . pageY - this . offset . click . top > f [ 3 ] && ( b = f [ 3 ] + this . offset . click . top ) } if ( g . grid ) { b = g . grid [ 1 ] ? this . originalPageY + Math . round ( ( b - this . originalPageY ) / g . grid [ 1 ] ) * g . grid [ 1 ] : this . originalPageY ; b = f ? b - this . offset . click . top < f [ 1 ] || b - this . offset . click . top > f [ 3 ] ? b - this . offset . click . top < f [ 1 ] ? b + g . grid [ 1 ] : b - g . grid [ 1 ] : b : b ; s = g . grid [ 0 ] ? this . originalPageX + Math . round ( ( s - this . originalPageX ) /
2012-07-25 08:56:15 +00:00
g . grid [ 0 ] ) * g . grid [ 0 ] : this . originalPageX ; s = f ? s - this . offset . click . left < f [ 0 ] || s - this . offset . click . left > f [ 2 ] ? s - this . offset . click . left < f [ 0 ] ? s + g . grid [ 0 ] : s - g . grid [ 0 ] : s : s } } 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 ( ) : m ? 0 : c . scrollTop ( ) ) , left : s - 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 ( ) : m ? 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 ( p , g , c ) { c = c || this . _uiHash ( ) ; a . ui . plugin . call ( this , p , [ g , c ] ) ; p == "drag" && ( this . positionAbs = this . _convertPositionTo ( "absolute" ) ) ; return a . Widget . prototype . _trigger . call ( this , p , g ,
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 ( p , g ) { var c = a ( this ) . data ( "draggable" ) , m = c . options , s = a . extend ( { } , g , { item : c . element } ) ; c . sortables = [ ] ; a ( m . 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" , p , s ) ) } ) } , stop : function ( p , g ) { var c = a ( this ) . data ( "draggable" ) , m = a . extend ( { } , g , { 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 ( p ) , 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" , p , m ) ) } ) } , drag : function ( p , g ) { var c = a ( this ) . data ( "draggable" ) , m = 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 ( m ) . clone ( ) . removeAttr ( "id" ) . appendTo ( this . instance . element ) . data ( "sortable-item" ,
2012-07-25 06:32:18 +00:00
true ) , this . instance . options . _helper = this . instance . options . helper , this . instance . options . helper = function ( ) { return g . helper [ 0 ] } , p . target = this . instance . currentItem [ 0 ] , this . instance . _mouseCapture ( p , true ) , this . instance . _mouseStart ( p , 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" , p ) , c . dropped = this . instance . element , c . currentItem = c . element , this . instance . fromOutside = c ) , this . instance . currentItem && this . instance . _mouseDrag ( p ) ) : this . instance . isOver && ( this . instance . isOver = 0 , this . instance . cancelHelperRemoval = true , this . instance . options . revert = false , this . instance . _trigger ( "out" , p , this . instance . _uiHash ( this . instance ) ) , this . instance . _mouseStop ( p , true ) , this . instance . options . helper = this . instance . options . _helper , this . instance . currentItem . remove ( ) , this . instance . placeholder &&
2012-07-25 08:56:15 +00:00
this . instance . placeholder . remove ( ) , c . _trigger ( "fromSortable" , p ) , c . dropped = false ) } ) } } ) ; a . ui . plugin . add ( "draggable" , "cursor" , { start : function ( ) { var p = a ( "body" ) , g = a ( this ) . data ( "draggable" ) . options ; p . css ( "cursor" ) && ( g . _cursor = p . css ( "cursor" ) ) ; p . css ( "cursor" , g . cursor ) } , stop : function ( ) { var p = a ( this ) . data ( "draggable" ) . options ; p . _cursor && a ( "body" ) . css ( "cursor" , p . _cursor ) } } ) ; a . ui . plugin . add ( "draggable" , "opacity" , { start : function ( p , g ) { var c = a ( g . helper ) , m = a ( this ) . data ( "draggable" ) . options ; c . css ( "opacity" ) && ( m . _opacity =
c . css ( "opacity" ) ) ; c . css ( "opacity" , m . opacity ) } , stop : function ( p , g ) { var c = a ( this ) . data ( "draggable" ) . options ; c . _opacity && a ( g . helper ) . css ( "opacity" , c . _opacity ) } } ) ; a . ui . plugin . add ( "draggable" , "scroll" , { start : function ( ) { var p = a ( this ) . data ( "draggable" ) ; p . scrollParent [ 0 ] != document && p . scrollParent [ 0 ] . tagName != "HTML" && ( p . overflowOffset = p . scrollParent . offset ( ) ) } , drag : function ( p ) { var g = a ( this ) . data ( "draggable" ) , c = g . options , m = false ; if ( g . scrollParent [ 0 ] != document && g . scrollParent [ 0 ] . tagName != "HTML" ) { if ( ! c . axis ||
c . axis != "x" ) g . overflowOffset . top + g . scrollParent [ 0 ] . offsetHeight - p . pageY < c . scrollSensitivity ? g . scrollParent [ 0 ] . scrollTop = m = g . scrollParent [ 0 ] . scrollTop + c . scrollSpeed : p . pageY - g . overflowOffset . top < c . scrollSensitivity && ( g . scrollParent [ 0 ] . scrollTop = m = g . scrollParent [ 0 ] . scrollTop - c . scrollSpeed ) ; if ( ! c . axis || c . axis != "y" ) g . overflowOffset . left + g . scrollParent [ 0 ] . offsetWidth - p . pageX < c . scrollSensitivity ? g . scrollParent [ 0 ] . scrollLeft = m = g . scrollParent [ 0 ] . scrollLeft + c . scrollSpeed : p . pageX - g . overflowOffset . left < c . scrollSensitivity &&
( g . scrollParent [ 0 ] . scrollLeft = m = g . scrollParent [ 0 ] . scrollLeft - c . scrollSpeed ) } else { if ( ! c . axis || c . axis != "x" ) p . pageY - a ( document ) . scrollTop ( ) < c . scrollSensitivity ? m = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) - c . scrollSpeed ) : a ( window ) . height ( ) - ( p . pageY - a ( document ) . scrollTop ( ) ) < c . scrollSensitivity && ( m = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) + c . scrollSpeed ) ) ; if ( ! c . axis || c . axis != "y" ) p . pageX - a ( document ) . scrollLeft ( ) < c . scrollSensitivity ? m = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) - c . scrollSpeed ) :
a ( window ) . width ( ) - ( p . pageX - a ( document ) . scrollLeft ( ) ) < c . scrollSensitivity && ( m = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) + c . scrollSpeed ) ) } m !== false && a . ui . ddmanager && ! c . dropBehaviour && a . ui . ddmanager . prepareOffsets ( g , p ) } } ) ; a . ui . plugin . add ( "draggable" , "snap" , { start : function ( ) { var p = a ( this ) . data ( "draggable" ) , g = p . options ; p . snapElements = [ ] ; a ( g . snap . constructor != String ? g . snap . items || ":data(draggable)" : g . snap ) . each ( function ( ) { var c = a ( this ) , m = c . offset ( ) ; this != p . element [ 0 ] && p . snapElements . push ( { item : this ,
width : c . outerWidth ( ) , height : c . outerHeight ( ) , top : m . top , left : m . left } ) } ) } , drag : function ( p , g ) { for ( var c = a ( this ) . data ( "draggable" ) , m = c . options , s = m . snapTolerance , b = g . offset . left , f = b + c . helperProportions . width , d = g . offset . top , k = d + c . helperProportions . height , q = c . snapElements . length - 1 ; q >= 0 ; q -- ) { var B = c . snapElements [ q ] . left , o = B + c . snapElements [ q ] . width , J = c . snapElements [ q ] . top , U = J + c . snapElements [ q ] . height ; if ( B - s < b && b < o + s && J - s < d && d < U + s || B - s < b && b < o + s && J - s < k && k < U + s || B - s < f && f < o + s && J - s < d && d < U + s || B - s < f && f < o + s && J - s < k &&
k < U + s ) { if ( m . snapMode != "inner" ) { var M = Math . abs ( J - k ) <= s , I = Math . abs ( U - d ) <= s , S = Math . abs ( B - f ) <= s , Y = Math . abs ( o - b ) <= s ; M && ( g . position . top = c . _convertPositionTo ( "relative" , { top : J - c . helperProportions . height , left : 0 } ) . top - c . margins . top ) ; I && ( g . position . top = c . _convertPositionTo ( "relative" , { top : U , left : 0 } ) . top - c . margins . top ) ; S && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : B - c . helperProportions . width } ) . left - c . margins . left ) ; Y && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : o } ) . left - c . margins . left ) } var P =
M || I || S || Y ; if ( m . snapMode != "outer" ) { M = Math . abs ( J - d ) <= s ; I = Math . abs ( U - k ) <= s ; S = Math . abs ( B - b ) <= s ; Y = Math . abs ( o - f ) <= s ; M && ( g . position . top = c . _convertPositionTo ( "relative" , { top : J , left : 0 } ) . top - c . margins . top ) ; I && ( g . position . top = c . _convertPositionTo ( "relative" , { top : U - c . helperProportions . height , left : 0 } ) . top - c . margins . top ) ; S && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : B } ) . left - c . margins . left ) ; Y && ( g . position . left = c . _convertPositionTo ( "relative" , { top : 0 , left : o - c . helperProportions . width } ) . left - c . margins . left ) } ! c . snapElements [ q ] . snapping &&
( M || I || S || Y || P ) && c . options . snap . snap && c . options . snap . snap . call ( c . element , p , a . extend ( c . _uiHash ( ) , { snapItem : c . snapElements [ q ] . item } ) ) ; c . snapElements [ q ] . snapping = M || I || S || Y || P } else { c . snapElements [ q ] . snapping && c . options . snap . release && c . options . snap . release . call ( c . element , p , a . extend ( c . _uiHash ( ) , { snapItem : c . snapElements [ q ] . item } ) ) ; c . snapElements [ q ] . snapping = false } } } } ) ; a . ui . plugin . add ( "draggable" , "stack" , { start : function ( ) { var p = a ( this ) . data ( "draggable" ) . options ; p = a . makeArray ( a ( p . stack ) ) . sort ( function ( c ,
m ) { return ( parseInt ( a ( c ) . css ( "zIndex" ) , 10 ) || 0 ) - ( parseInt ( a ( m ) . css ( "zIndex" ) , 10 ) || 0 ) } ) ; if ( p . length ) { var g = parseInt ( p [ 0 ] . style . zIndex ) || 0 ; a ( p ) . each ( function ( c ) { this . style . zIndex = g + c } ) ; this [ 0 ] . style . zIndex = g + p . length } } } ) ; a . ui . plugin . add ( "draggable" , "zIndex" , { start : function ( p , g ) { var c = a ( g . helper ) , m = a ( this ) . data ( "draggable" ) . options ; c . css ( "zIndex" ) && ( m . _zIndex = c . css ( "zIndex" ) ) ; c . css ( "zIndex" , m . zIndex ) } , stop : function ( p , g ) { var c = a ( this ) . data ( "draggable" ) . options ; c . _zIndex && a ( g . 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 p = this , g = this . options , c = this . element . find ( ".ui-slider-handle" ) . addClass ( "ui-state-default ui-corner-all" ) , m = g . values && g . values . length || 1 , s = [ ] ; 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" + ( g . disabled ? " ui-slider-disabled ui-disabled" : "" ) ) ; this . range = a ( [ ] ) ; g . range && ( g . range === true && ( g . values || ( g . values = [ this . _valueMin ( ) , this . _valueMin ( ) ] ) , g . values . length && g . values . length !== 2 && ( g . values = [ g . values [ 0 ] , g . values [ 0 ] ] ) ) , this . range = a ( "<div></div>" ) . appendTo ( this . element ) . addClass ( "ui-slider-range ui-widget-header" + ( g . range === "min" || g . range === "max" ? " ui-slider-range-" + g . range : "" ) ) ) ; for ( var b = c . length ; b < m ; b += 1 ) s . push ( "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>" ) ;
2012-07-25 06:32:18 +00:00
this . handles = c . add ( a ( s . join ( "" ) ) . appendTo ( p . element ) ) ; this . handle = this . handles . eq ( 0 ) ; this . handles . add ( this . range ) . filter ( "a" ) . click ( function ( f ) { f . preventDefault ( ) } ) . hover ( function ( ) { g . disabled || a ( this ) . addClass ( "ui-state-hover" ) } , function ( ) { a ( this ) . removeClass ( "ui-state-hover" ) } ) . focus ( function ( ) { g . 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 ( f ) { a ( this ) . data ( "index.ui-slider-handle" ,
2012-07-25 08:56:15 +00:00
f ) } ) ; this . handles . keydown ( function ( f ) { var d = true , k = a ( this ) . data ( "index.ui-slider-handle" ) , q , B , o ; if ( ! p . options . disabled ) { switch ( f . 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 ( ! p . _keySliding ) { p . _keySliding = true ; a ( this ) . addClass ( "ui-state-active" ) ; q = p . _start ( f , k ) ; if ( q === false ) return } } q = p . options . step ; p . options . values && p . options . values . length ?
B = o = p . values ( k ) : B = o = p . value ( ) ; switch ( f . keyCode ) { case a . ui . keyCode . HOME : o = p . _valueMin ( ) ; break ; case a . ui . keyCode . END : o = p . _valueMax ( ) ; break ; case a . ui . keyCode . PAGE _UP : o = p . _trimAlignValue ( B + ( p . _valueMax ( ) - p . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . PAGE _DOWN : o = p . _trimAlignValue ( B - ( p . _valueMax ( ) - p . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : if ( B === p . _valueMax ( ) ) return ; o = p . _trimAlignValue ( B + q ) ; break ; case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : if ( B === p . _valueMin ( ) ) return ; o = p . _trimAlignValue ( B -
q ) } p . _slide ( f , k , o ) ; return d } } ) . keyup ( function ( f ) { var d = a ( this ) . data ( "index.ui-slider-handle" ) ; p . _keySliding && ( p . _keySliding = false , p . _stop ( f , d ) , p . _change ( f , 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 ( p ) { var g = this . options , c , m , s , b , f ; if ( g . disabled ) return false ; this . elementSize = { width : this . element . outerWidth ( ) , height : this . element . outerHeight ( ) } ; this . elementOffset = this . element . offset ( ) ; c = this . _normValueFromMouse ( { x : p . pageX , y : p . pageY } ) ; m = this . _valueMax ( ) - this . _valueMin ( ) + 1 ; b = this ; this . handles . each ( function ( d ) { var k = Math . abs ( c - b . values ( d ) ) ; m > k && ( m = k , s = a ( this ) , f = d ) } ) ; g . range === true && this . values ( 1 ) === g . min && ( f += 1 , s = a ( this . handles [ f ] ) ) ; if ( this . _start ( p , f ) === false ) return false ;
2012-07-25 06:32:18 +00:00
this . _mouseSliding = true ; b . _handleIndex = f ; s . addClass ( "ui-state-active" ) . focus ( ) ; g = s . offset ( ) ; this . _clickOffset = ! a ( p . target ) . parents ( ) . andSelf ( ) . is ( ".ui-slider-handle" ) ? { left : 0 , top : 0 } : { left : p . pageX - g . left - s . width ( ) / 2 , top : p . pageY - g . top - s . height ( ) / 2 - ( parseInt ( s . css ( "borderTopWidth" ) , 10 ) || 0 ) - ( parseInt ( s . css ( "borderBottomWidth" ) , 10 ) || 0 ) + ( parseInt ( s . css ( "marginTop" ) , 10 ) || 0 ) } ; this . handles . hasClass ( "ui-state-hover" ) || this . _slide ( p , f , c ) ; return this . _animateOff = true } , _mouseStart : function ( ) { return true } , _mouseDrag : function ( p ) { var g =
this . _normValueFromMouse ( { x : p . pageX , y : p . pageY } ) ; this . _slide ( p , this . _handleIndex , g ) ; return false } , _mouseStop : function ( p ) { this . handles . removeClass ( "ui-state-active" ) ; this . _mouseSliding = false ; this . _stop ( p , this . _handleIndex ) ; this . _change ( p , this . _handleIndex ) ; this . _clickOffset = this . _handleIndex = null ; return this . _animateOff = false } , _detectOrientation : function ( ) { this . orientation = this . options . orientation === "vertical" ? "vertical" : "horizontal" } , _normValueFromMouse : function ( p ) { var g , c ; this . orientation === "horizontal" ?
( g = this . elementSize . width , c = p . x - this . elementOffset . left - ( this . _clickOffset ? this . _clickOffset . left : 0 ) ) : ( g = this . elementSize . height , c = p . y - this . elementOffset . top - ( this . _clickOffset ? this . _clickOffset . top : 0 ) ) ; p = c / g ; p > 1 && ( p = 1 ) ; p < 0 && ( p = 0 ) ; this . orientation === "vertical" && ( p = 1 - p ) ; g = this . _valueMax ( ) - this . _valueMin ( ) ; return this . _trimAlignValue ( this . _valueMin ( ) + p * g ) } , _start : function ( p , g ) { var c = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( c . value = this . values ( g ) ,
2012-07-25 08:56:15 +00:00
c . values = this . values ( ) ) ; return this . _trigger ( "start" , p , c ) } , _slide : function ( p , g , c ) { var m , s , b ; this . options . values && this . options . values . length ? ( m = this . values ( g ? 0 : 1 ) , this . options . values . length === 2 && this . options . range === true && ( g === 0 && c > m || g === 1 && c < m ) && ( c = m ) , c !== this . values ( g ) && ( s = this . values ( ) , s [ g ] = c , b = this . _trigger ( "slide" , p , { handle : this . handles [ g ] , value : c , values : s } ) , this . values ( g ? 0 : 1 ) , b !== false && this . values ( g , c , true ) ) ) : c !== this . value ( ) && ( b = this . _trigger ( "slide" , p , { handle : this . handles [ g ] , value : c } ) , b !==
2012-07-25 06:32:18 +00:00
false && this . value ( c ) ) } , _stop : function ( p , g ) { var c = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( c . value = this . values ( g ) , c . values = this . values ( ) ) ; this . _trigger ( "stop" , p , c ) } , _change : function ( p , g ) { if ( ! this . _keySliding && ! this . _mouseSliding ) { var c = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( c . value = this . values ( g ) , c . values = this . values ( ) ) ; this . _trigger ( "change" , p , c ) } } , value : function ( p ) { if ( arguments . length ) { this . options . value =
2012-07-25 08:56:15 +00:00
this . _trimAlignValue ( p ) ; this . _refreshValue ( ) ; this . _change ( null , 0 ) } else return this . _value ( ) } , values : function ( p , g ) { var c , m , s ; if ( arguments . length > 1 ) { this . options . values [ p ] = this . _trimAlignValue ( g ) ; this . _refreshValue ( ) ; this . _change ( null , p ) } else { if ( ! arguments . length ) return this . _values ( ) ; if ( ! a . isArray ( arguments [ 0 ] ) ) return this . options . values && this . options . values . length ? this . _values ( p ) : this . value ( ) ; c = this . options . values ; m = arguments [ 0 ] ; for ( s = 0 ; s < c . length ; s += 1 ) { c [ s ] = this . _trimAlignValue ( m [ s ] ) ; this . _change ( null ,
s ) } this . _refreshValue ( ) } } , _setOption : function ( p , g ) { var c , m = 0 ; a . isArray ( this . options . values ) && ( m = this . options . values . length ) ; a . Widget . prototype . _setOption . apply ( this , arguments ) ; switch ( p ) { case "disabled" : g ? ( 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 < m ; c += 1 ) this . _change ( null , c ) ; this . _animateOff = false } } , _value : function ( ) { var p = this . options . value ; return p = this . _trimAlignValue ( p ) } , _values : function ( p ) { var g , c ; if ( arguments . length ) { g = this . options . values [ p ] ;
2012-07-25 06:32:18 +00:00
return g = this . _trimAlignValue ( g ) } g = this . options . values . slice ( ) ; for ( c = 0 ; c < g . length ; c += 1 ) g [ c ] = this . _trimAlignValue ( g [ c ] ) ; return g } , _trimAlignValue : function ( p ) { if ( p <= this . _valueMin ( ) ) return this . _valueMin ( ) ; if ( p >= this . _valueMax ( ) ) return this . _valueMax ( ) ; var g = this . options . step > 0 ? this . options . step : 1 , c = ( p - this . _valueMin ( ) ) % g ; p = p - c ; Math . abs ( c ) * 2 >= g && ( p += c > 0 ? g : - g ) ; return parseFloat ( p . toFixed ( 5 ) ) } , _valueMin : function ( ) { return this . options . min } , _valueMax : function ( ) { return this . options . max } , _refreshValue : function ( ) { var p =
2012-07-25 08:56:15 +00:00
this . options . range , g = this . options , c = this , m = this . _animateOff ? false : g . animate , s , b = { } , f , d , k , q ; this . options . values && this . options . values . length ? this . handles . each ( function ( B ) { s = ( c . values ( B ) - c . _valueMin ( ) ) / ( c . _valueMax ( ) - c . _valueMin ( ) ) * 100 ; b [ c . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" ; a ( this ) . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( b , g . animate ) ; c . options . range === true && ( c . orientation === "horizontal" ? ( B === 0 && c . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { left : s + "%" } , g . animate ) , B === 1 && c . range [ m ? "animate" : "css" ] ( { width : s -
f + "%" } , { queue : false , duration : g . animate } ) ) : ( B === 0 && c . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { bottom : s + "%" } , g . animate ) , B === 1 && c . range [ m ? "animate" : "css" ] ( { height : s - f + "%" } , { queue : false , duration : g . animate } ) ) ) ; f = s } ) : ( d = this . value ( ) , k = this . _valueMin ( ) , q = this . _valueMax ( ) , s = q !== k ? ( d - k ) / ( q - k ) * 100 : 0 , b [ c . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" , this . handle . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( b , g . animate ) , p === "min" && this . orientation === "horizontal" && this . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { width : s + "%" } , g . animate ) ,
p === "max" && this . orientation === "horizontal" && this . range [ m ? "animate" : "css" ] ( { width : 100 - s + "%" } , { queue : false , duration : g . animate } ) , p === "min" && this . orientation === "vertical" && this . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { height : s + "%" } , g . animate ) , p === "max" && this . orientation === "vertical" && this . range [ m ? "animate" : "css" ] ( { height : 100 - s + "%" } , { queue : false , duration : g . animate } ) ) } } ) ; a . extend ( a . ui . slider , { version : "1.8.17" } ) } ) ( jQuery ) ; ( function ( a ) { Math . precision = function ( b , f ) { if ( f === undefined ) f = 0 ; return Math . round ( b * Math . pow ( 10 , f ) ) / Math . pow ( 10 , f ) } ; var p = function ( b , f ) { var d = this , k = b . find ( "img:first" ) , q = 0 , B = 100 , o = 100 , J = 0 , U = 100 , M = 100 , I = 0 , S = 0 , Y , P , ia = [ ] , qa = function ( X ) { for ( var Z = 0 ; Z < ia . length ; Z ++ ) ia [ Z ] . call ( d , d , X ) } , ga = function ( X ) { var Z = b . offset ( ) ; Y = { l : Z . left | 0 , t : Z . top | 0 } ; clearTimeout ( P ) ; P = setTimeout ( function ( ) { ta . call ( d , X ) } , 0 ) ; a ( document ) . bind ( "mousemove" , ba ) . bind ( "mouseup" , W ) ; X . preventDefault ( ) } , ba = function ( X ) { clearTimeout ( P ) ; P = setTimeout ( function ( ) { ta . call ( d ,
X ) } , 0 ) ; X . stopPropagation ( ) ; X . preventDefault ( ) ; return false } , W = function ( X ) { a ( document ) . unbind ( "mouseup" , W ) . unbind ( "mousemove" , ba ) ; X . stopPropagation ( ) ; X . preventDefault ( ) ; return false } , ta = function ( X ) { var Z = X . pageX - Y . l ; X = X . pageY - Y . t ; var oa = b . w , ra = b . h ; if ( Z < 0 ) Z = 0 ; else if ( Z > oa ) Z = oa ; if ( X < 0 ) X = 0 ; else if ( X > ra ) X = ra ; ka . call ( d , "xy" , { x : Z / oa * o + q , y : X / ra * M + J } ) } , ka = function ( X , Z , oa ) { if ( Z === undefined ) { if ( X === undefined || X == null ) X = "xy" ; switch ( X . toLowerCase ( ) ) { case "x" : return I ; case "y" : return S ; default : return { x : I , y : S } } } if ( ! ( oa !=
null && oa == d ) ) { var ra = false , ma , na ; if ( X == null ) X = "xy" ; switch ( X . toLowerCase ( ) ) { case "x" : ma = Z && ( Z . x && Z . x | 0 || Z | 0 ) || 0 ; break ; case "y" : na = Z && ( Z . y && Z . y | 0 || Z | 0 ) || 0 ; break ; default : ma = Z && Z . x && Z . x | 0 || 0 ; na = Z && Z . y && Z . y | 0 || 0 } if ( ma != null ) { if ( ma < q ) ma = q ; else if ( ma > B ) ma = B ; if ( I != ma ) { I = ma ; ra = true } } if ( na != null ) { if ( na < J ) na = J ; else if ( na > U ) na = U ; if ( S != na ) { S = na ; ra = true } } ra && qa . call ( d , oa || d ) } } , da = function ( X ) { a . isFunction ( X ) && ia . push ( X ) } ; a . extend ( true , d , { val : ka , range : function ( X , Z ) { if ( Z === undefined ) { if ( X === undefined || X == null ) X = "all" ;
switch ( X . toLowerCase ( ) ) { case "minx" : return q ; case "maxx" : return B ; case "rangex" : return { minX : q , maxX : B , rangeX : o } ; case "miny" : return J ; case "maxy" : return U ; case "rangey" : return { minY : J , maxY : U , rangeY : M } ; default : return { minX : q , maxX : B , rangeX : o , minY : J , maxY : U , rangeY : M } } } var oa , ra , ma , na ; if ( X == null ) X = "all" ; switch ( X . toLowerCase ( ) ) { case "minx" : oa = Z && ( Z . minX && Z . minX | 0 || Z | 0 ) || 0 ; break ; case "maxx" : ra = Z && ( Z . maxX && Z . maxX | 0 || Z | 0 ) || 0 ; break ; case "rangex" : oa = Z && Z . minX && Z . minX | 0 || 0 ; ra = Z && Z . maxX && Z . maxX | 0 || 0 ; break ; case "miny" : ma =
Z && ( Z . minY && Z . minY | 0 || Z | 0 ) || 0 ; break ; case "maxy" : na = Z && ( Z . maxY && Z . maxY | 0 || Z | 0 ) || 0 ; break ; case "rangey" : ma = Z && Z . minY && Z . minY | 0 || 0 ; na = Z && Z . maxY && Z . maxY | 0 || 0 ; break ; default : oa = Z && Z . minX && Z . minX | 0 || 0 ; ra = Z && Z . maxX && Z . maxX | 0 || 0 ; ma = Z && Z . minY && Z . minY | 0 || 0 ; na = Z && Z . maxY && Z . maxY | 0 || 0 } if ( oa != null && q != oa ) { q = oa ; o = B - q } if ( ra != null && B != ra ) { B = ra ; o = B - q } if ( ma != null && J != ma ) { J = ma ; M = U - J } if ( na != null && U != na ) { U = na ; M = U - J } } , bind : da , unbind : function ( X ) { if ( a . isFunction ( X ) ) for ( var Z ; ( Z = a . inArray ( X , ia ) ) != - 1 ; ) ia . splice ( Z , 1 ) } , destroy : function ( ) { a ( document ) . unbind ( "mouseup" ,
W ) . unbind ( "mousemove" , ba ) ; b . unbind ( "mousedown" , ga ) ; ia = k = b = null } } ) ; k . src = f . arrow && f . arrow . image ; k . w = f . arrow && f . arrow . width || k . width ( ) ; k . h = f . arrow && f . arrow . height || k . height ( ) ; b . w = f . map && f . map . width || b . width ( ) ; b . h = f . map && f . map . height || b . height ( ) ; b . bind ( "mousedown" , ga ) ; da . call ( d , function ( ) { var X = 0 , Z = 0 , oa = b . w , ra = b . h , ma = k . w , na = k . h ; setTimeout ( function ( ) { if ( o > 0 ) X = I == B ? oa : I / o * oa | 0 ; if ( M > 0 ) Z = S == U ? ra : S / M * ra | 0 ; if ( ma >= oa ) X = ( oa >> 1 ) - ( ma >> 1 ) ; else X -= ma >> 1 ; if ( na >= ra ) Z = ( ra >> 1 ) - ( na >> 1 ) ; else Z -= na >> 1 ; k . css ( { left : X + "px" ,
top : Z + "px" } ) } , 0 ) } ) } , g = function ( b , f , d , k ) { var q = this ; b = b . find ( "td.Text input" ) ; var B = b . eq ( 3 ) , o = b . eq ( 4 ) , J = b . eq ( 5 ) , U = b . length > 7 ? b . eq ( 6 ) : null , M = b . eq ( 0 ) , I = b . eq ( 1 ) , S = b . eq ( 2 ) , Y = b . eq ( b . length > 7 ? 7 : 6 ) , P = b . length > 7 ? b . eq ( 8 ) : null , ia = function ( ka ) { if ( ! ( ka . target . value == "" && ka . target != Y . get ( 0 ) && ( d != null && ka . target != d . get ( 0 ) || d == null ) ) ) { if ( ! ba ( ka ) ) return ka ; switch ( ka . target ) { case B . get ( 0 ) : switch ( ka . keyCode ) { case 38 : B . val ( W . call ( q , ( B . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ka . target ) ; return false ; case 40 : B . val ( W . call ( q ,
( B . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ka . target ) ; return false } break ; case o . get ( 0 ) : switch ( ka . keyCode ) { case 38 : o . val ( W . call ( q , ( o . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "g" , o . val ( ) , ka . target ) ; return false ; case 40 : o . val ( W . call ( q , ( o . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "g" , o . val ( ) , ka . target ) ; return false } break ; case J . get ( 0 ) : switch ( ka . keyCode ) { case 38 : J . val ( W . call ( q , ( J . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "b" , J . val ( ) , ka . target ) ; return false ; case 40 : J . val ( W . call ( q , ( J . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "b" , J . val ( ) , ka . target ) ; return false } break ;
case U && U . get ( 0 ) : switch ( ka . keyCode ) { case 38 : U . val ( W . call ( q , parseFloat ( U . val ( ) ) + 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( U . val ( ) * 255 / 100 , k ) , ka . target ) ; return false ; case 40 : U . val ( W . call ( q , parseFloat ( U . val ( ) ) - 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( U . val ( ) * 255 / 100 , k ) , ka . target ) ; return false } break ; case M . get ( 0 ) : switch ( ka . keyCode ) { case 38 : M . val ( W . call ( q , ( M . val ( ) << 0 ) + 1 , 0 , 360 ) ) ; f . val ( "h" , M . val ( ) , ka . target ) ; return false ; case 40 : M . val ( W . call ( q , ( M . val ( ) << 0 ) - 1 , 0 , 360 ) ) ; f . val ( "h" , M . val ( ) , ka . target ) ; return false } break ; case I . get ( 0 ) : switch ( ka . keyCode ) { case 38 : I . val ( W . call ( q ,
( I . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "s" , I . val ( ) , ka . target ) ; return false ; case 40 : I . val ( W . call ( q , ( I . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "s" , I . val ( ) , ka . target ) ; return false } break ; case S . get ( 0 ) : switch ( ka . keyCode ) { case 38 : S . val ( W . call ( q , ( S . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "v" , S . val ( ) , ka . target ) ; return false ; case 40 : S . val ( W . call ( q , ( S . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "v" , S . val ( ) , ka . target ) ; return false } } } } , qa = function ( ka ) { if ( ! ( ka . target . value == "" && ka . target != Y . get ( 0 ) && ( d != null && ka . target != d . get ( 0 ) || d == null ) ) ) { if ( ! ba ( ka ) ) return ka ; switch ( ka . target ) { case B . get ( 0 ) : B . val ( W . call ( q ,
B . val ( ) , 0 , 255 ) ) ; f . val ( "r" , B . val ( ) , ka . target ) ; break ; case o . get ( 0 ) : o . val ( W . call ( q , o . val ( ) , 0 , 255 ) ) ; f . val ( "g" , o . val ( ) , ka . target ) ; break ; case J . get ( 0 ) : J . val ( W . call ( q , J . val ( ) , 0 , 255 ) ) ; f . val ( "b" , J . val ( ) , ka . target ) ; break ; case U && U . get ( 0 ) : U . val ( W . call ( q , U . val ( ) , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( U . val ( ) * 255 / 100 , k ) , ka . target ) ; break ; case M . get ( 0 ) : M . val ( W . call ( q , M . val ( ) , 0 , 360 ) ) ; f . val ( "h" , M . val ( ) , ka . target ) ; break ; case I . get ( 0 ) : I . val ( W . call ( q , I . val ( ) , 0 , 100 ) ) ; f . val ( "s" , I . val ( ) , ka . target ) ; break ; case S . get ( 0 ) : S . val ( W . call ( q ,
S . val ( ) , 0 , 100 ) ) ; f . val ( "v" , S . val ( ) , ka . target ) ; break ; case Y . get ( 0 ) : Y . val ( Y . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; d && d . val ( Y . val ( ) ) ; f . val ( "hex" , Y . val ( ) != "" ? Y . val ( ) : null , ka . target ) ; break ; case d && d . get ( 0 ) : d . val ( d . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; Y . val ( d . val ( ) ) ; f . val ( "hex" , d . val ( ) != "" ? d . val ( ) : null , ka . target ) ; break ; case P && P . get ( 0 ) : P . val ( P . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 2 ) ) ; f . val ( "a" , P . val ( ) != null ? parseInt ( P . val ( ) , 16 ) :
null , ka . target ) } } } , ga = function ( ka ) { if ( f . val ( ) != null ) switch ( ka . target ) { case B . get ( 0 ) : B . val ( f . val ( "r" ) ) ; break ; case o . get ( 0 ) : o . val ( f . val ( "g" ) ) ; break ; case J . get ( 0 ) : J . val ( f . val ( "b" ) ) ; break ; case U && U . get ( 0 ) : U . val ( Math . precision ( f . val ( "a" ) * 100 / 255 , k ) ) ; break ; case M . get ( 0 ) : M . val ( f . val ( "h" ) ) ; break ; case I . get ( 0 ) : I . val ( f . val ( "s" ) ) ; break ; case S . get ( 0 ) : S . val ( f . val ( "v" ) ) ; break ; case Y . get ( 0 ) : case d && d . get ( 0 ) : Y . val ( f . val ( "hex" ) ) ; d && d . val ( f . val ( "hex" ) ) ; break ; case P && P . get ( 0 ) : P . val ( f . val ( "ahex" ) . substring ( 6 ) ) } } , ba =
function ( ka ) { switch ( ka . keyCode ) { case 9 : case 16 : case 29 : case 37 : case 39 : return false ; case "c" . charCodeAt ( ) : case "v" . charCodeAt ( ) : if ( ka . ctrlKey ) return false } return true } , W = function ( ka , da , X ) { if ( ka == "" || isNaN ( ka ) ) return da ; if ( ka > X ) return X ; if ( ka < da ) return da ; return ka } , ta = function ( ka , da ) { var X = ka . val ( "all" ) ; if ( da != B . get ( 0 ) ) B . val ( X != null ? X . r : "" ) ; if ( da != o . get ( 0 ) ) o . val ( X != null ? X . g : "" ) ; if ( da != J . get ( 0 ) ) J . val ( X != null ? X . b : "" ) ; if ( U && da != U . get ( 0 ) ) U . val ( X != null ? Math . precision ( X . a * 100 / 255 , k ) : "" ) ; if ( da != M . get ( 0 ) ) M . val ( X !=
null ? X . h : "" ) ; if ( da != I . get ( 0 ) ) I . val ( X != null ? X . s : "" ) ; if ( da != S . get ( 0 ) ) S . val ( X != null ? X . v : "" ) ; if ( da != Y . get ( 0 ) && ( d && da != d . get ( 0 ) || ! d ) ) Y . val ( X != null ? X . hex : "" ) ; if ( d && da != d . get ( 0 ) && da != Y . get ( 0 ) ) d . val ( X != null ? X . hex : "" ) ; if ( P && da != P . get ( 0 ) ) P . val ( X != null ? X . ahex . substring ( 6 ) : "" ) } ; a . extend ( true , q , { destroy : function ( ) { B . add ( o ) . add ( J ) . add ( U ) . add ( M ) . add ( I ) . add ( S ) . add ( Y ) . add ( d ) . add ( P ) . unbind ( "keyup" , qa ) . unbind ( "blur" , ga ) ; B . add ( o ) . add ( J ) . add ( U ) . add ( M ) . add ( I ) . add ( S ) . unbind ( "keydown" , ia ) ; f . unbind ( ta ) ; P = Y = S = I = M = U = J = o = B =
null } } ) ; B . add ( o ) . add ( J ) . add ( U ) . add ( M ) . add ( I ) . add ( S ) . add ( Y ) . add ( d ) . add ( P ) . bind ( "keyup" , qa ) . bind ( "blur" , ga ) ; B . add ( o ) . add ( J ) . add ( U ) . add ( M ) . add ( I ) . add ( S ) . bind ( "keydown" , ia ) ; f . bind ( ta ) } ; a . jPicker = { List : [ ] , Color : function ( b ) { var f = this , d , k , q , B , o , J , U , M = [ ] , I = function ( Y ) { for ( var P = 0 ; P < M . length ; P ++ ) M [ P ] . call ( f , f , Y ) } , S = function ( Y , P , ia ) { if ( P === undefined ) { if ( Y === undefined || Y == null || Y == "" ) Y = "all" ; if ( d == null ) return null ; switch ( Y . toLowerCase ( ) ) { case "ahex" : return s . rgbaToHex ( { r : d , g : k , b : q , a : B } ) ; case "hex" : return S ( "ahex" ) . substring ( 0 ,
6 ) ; case "all" : return { r : d , g : k , b : q , a : B , h : o , s : J , v : U , hex : S . call ( f , "hex" ) , ahex : S . call ( f , "ahex" ) } ; default : P = { } ; for ( var qa = 0 ; qa < Y . length ; qa ++ ) switch ( Y . charAt ( qa ) ) { case "r" : if ( Y . length == 1 ) P = d ; else P . r = d ; break ; case "g" : if ( Y . length == 1 ) P = k ; else P . g = k ; break ; case "b" : if ( Y . length == 1 ) P = q ; else P . b = q ; break ; case "a" : if ( Y . length == 1 ) P = B ; else P . a = B ; break ; case "h" : if ( Y . length == 1 ) P = o ; else P . h = o ; break ; case "s" : if ( Y . length == 1 ) P = J ; else P . s = J ; break ; case "v" : if ( Y . length == 1 ) P = U ; else P . v = U } return P == { } ? S . call ( f , "all" ) : P } } if ( ! ( ia !=
null && ia == f ) ) { var ga = false ; if ( Y == null ) Y = "" ; if ( P == null ) { if ( d != null ) { d = null ; ga = true } if ( k != null ) { k = null ; ga = true } if ( q != null ) { q = null ; ga = true } if ( B != null ) { B = null ; ga = true } if ( o != null ) { o = null ; ga = true } if ( J != null ) { J = null ; ga = true } if ( U != null ) { U = null ; ga = true } ga && I . call ( f , ia || f ) } else switch ( Y . toLowerCase ( ) ) { case "ahex" : case "hex" : P = s . hexToRgba ( P && ( P . ahex || P . hex ) || P || "00000000" ) ; S . call ( f , "rgba" , { r : P . r , g : P . g , b : P . b , a : Y == "ahex" ? P . a : B != null ? B : 255 } , ia ) ; break ; default : if ( P && ( P . ahex != null || P . hex != null ) ) { S . call ( f , "ahex" , P . ahex ||
P . hex || "00000000" , ia ) ; break } var ba = { } , W = false , ta = false ; if ( P . r !== undefined && ! Y . indexOf ( "r" ) == - 1 ) Y += "r" ; if ( P . g !== undefined && ! Y . indexOf ( "g" ) == - 1 ) Y += "g" ; if ( P . b !== undefined && ! Y . indexOf ( "b" ) == - 1 ) Y += "b" ; if ( P . a !== undefined && ! Y . indexOf ( "a" ) == - 1 ) Y += "a" ; if ( P . h !== undefined && ! Y . indexOf ( "h" ) == - 1 ) Y += "h" ; if ( P . s !== undefined && ! Y . indexOf ( "s" ) == - 1 ) Y += "s" ; if ( P . v !== undefined && ! Y . indexOf ( "v" ) == - 1 ) Y += "v" ; for ( qa = 0 ; qa < Y . length ; qa ++ ) switch ( Y . charAt ( qa ) ) { case "r" : if ( ta ) continue ; W = true ; ba . r = P && P . r && P . r | 0 || P && P | 0 || 0 ; if ( ba . r < 0 ) ba . r =
0 ; else if ( ba . r > 255 ) ba . r = 255 ; if ( d != ba . r ) { d = ba . r ; ga = true } break ; case "g" : if ( ta ) continue ; W = true ; ba . g = P && P . g && P . g | 0 || P && P | 0 || 0 ; if ( ba . g < 0 ) ba . g = 0 ; else if ( ba . g > 255 ) ba . g = 255 ; if ( k != ba . g ) { k = ba . g ; ga = true } break ; case "b" : if ( ta ) continue ; W = true ; ba . b = P && P . b && P . b | 0 || P && P | 0 || 0 ; if ( ba . b < 0 ) ba . b = 0 ; else if ( ba . b > 255 ) ba . b = 255 ; if ( q != ba . b ) { q = ba . b ; ga = true } break ; case "a" : ba . a = P && P . a != null ? P . a | 0 : P != null ? P | 0 : 255 ; if ( ba . a < 0 ) ba . a = 0 ; else if ( ba . a > 255 ) ba . a = 255 ; if ( B != ba . a ) { B = ba . a ; ga = true } break ; case "h" : if ( W ) continue ; ta = true ; ba . h = P && P . h &&
P . h | 0 || P && P | 0 || 0 ; if ( ba . h < 0 ) ba . h = 0 ; else if ( ba . h > 360 ) ba . h = 360 ; if ( o != ba . h ) { o = ba . h ; ga = true } break ; case "s" : if ( W ) continue ; ta = true ; ba . s = P && P . s != null ? P . s | 0 : P != null ? P | 0 : 100 ; if ( ba . s < 0 ) ba . s = 0 ; else if ( ba . s > 100 ) ba . s = 100 ; if ( J != ba . s ) { J = ba . s ; ga = true } break ; case "v" : if ( W ) continue ; ta = true ; ba . v = P && P . v != null ? P . v | 0 : P != null ? P | 0 : 100 ; if ( ba . v < 0 ) ba . v = 0 ; else if ( ba . v > 100 ) ba . v = 100 ; if ( U != ba . v ) { U = ba . v ; ga = true } } if ( ga ) { if ( W ) { d = d || 0 ; k = k || 0 ; q = q || 0 ; P = s . rgbToHsv ( { r : d , g : k , b : q } ) ; o = P . h ; J = P . s ; U = P . v } else if ( ta ) { o = o || 0 ; J = J != null ? J : 100 ; U = U !=
null ? U : 100 ; P = s . hsvToRgb ( { h : o , s : J , v : U } ) ; d = P . r ; k = P . g ; q = P . b } B = B != null ? B : 255 ; I . call ( f , ia || f ) } } } } ; a . extend ( true , f , { val : S , bind : function ( Y ) { a . isFunction ( Y ) && M . push ( Y ) } , unbind : function ( Y ) { if ( a . isFunction ( Y ) ) for ( var P ; ( P = a . inArray ( Y , M ) ) != - 1 ; ) M . splice ( P , 1 ) } , destroy : function ( ) { M = null } } ) ; if ( b ) if ( b . ahex != null ) S ( "ahex" , b ) ; else if ( b . hex != null ) S ( ( b . a != null ? "a" : "" ) + "hex" , b . a != null ? { ahex : b . hex + s . intToHex ( b . a ) } : b ) ; else if ( b . r != null && b . g != null && b . b != null ) S ( "rgb" + ( b . a != null ? "a" : "" ) , b ) ; else if ( b . h != null && b . s != null && b . v !=
null ) S ( "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 f = "00" , d = "00" , k = "00" , q = "255" ; if ( b . length == 6 ) b += "ff" ; if ( b . length > 6 ) { f = b . substring ( 0 , 2 ) ; d = b . substring ( 2 , 4 ) ; k = b . substring ( 4 , 6 ) ; q = b . substring ( 6 , b . length ) } else { if ( b . length > 4 ) { f = 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 ) k = b . substring ( 0 , b . length ) } return { r : this . hexToInt ( f ) , g : this . hexToInt ( d ) ,
b : this . hexToInt ( k ) , a : this . hexToInt ( q ) } } , 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 f = b . r / 255 , d = b . g / 255 ; b = b . b / 255 ; var k = { h : 0 , s : 0 , v : 0 } , q = 0 , B =
0 ; if ( f >= d && f >= b ) { B = f ; q = d > b ? b : d } else if ( d >= b && d >= f ) { B = d ; q = f > b ? b : f } else { B = b ; q = d > f ? f : d } k . v = B ; k . s = B ? ( B - q ) / B : 0 ; if ( k . s ) { q = B - q ; k . h = f == B ? ( d - b ) / q : d == B ? 2 + ( b - f ) / q : 4 + ( f - d ) / q ; k . h = parseInt ( k . h * 60 ) ; if ( k . h < 0 ) k . h += 360 } else k . h = 0 ; k . s = k . s * 100 | 0 ; k . v = k . v * 100 | 0 ; return k } , hsvToRgb : function ( b ) { var f = { r : 0 , g : 0 , b : 0 , a : 100 } , d = b . h , k = b . s ; b = b . v ; if ( k == 0 ) f . r = b == 0 ? f . g = f . b = 0 : f . g = f . b = b * 255 / 100 | 0 ; else { if ( d == 360 ) d = 0 ; d /= 60 ; k /= 100 ; b /= 100 ; var q = d | 0 , B = d - q ; d = b * ( 1 - k ) ; var o = b * ( 1 - k * B ) ; k = b * ( 1 - k * ( 1 - B ) ) ; switch ( q ) { case 0 : f . r = b ; f . g = k ; f . b = d ; break ; case 1 : f . r =
o ; f . g = b ; f . b = d ; break ; case 2 : f . r = d ; f . g = b ; f . b = k ; break ; case 3 : f . r = d ; f . g = o ; f . b = b ; break ; case 4 : f . r = k ; f . g = d ; f . b = b ; break ; case 5 : f . r = b ; f . g = d ; f . b = o } f . r = f . r * 255 | 0 ; f . g = f . g * 255 | 0 ; f . b = f . b * 255 | 0 } return f } } } ; var c = a . jPicker . Color , m = a . jPicker . List , s = a . jPicker . ColorMethods ; a . fn . jPicker = function ( b ) { var f = arguments ; return this . each ( function ( ) { var d = this , k = a . extend ( true , { } , a . fn . jPicker . defaults , b ) ; if ( a ( d ) . get ( 0 ) . nodeName . toLowerCase ( ) == "input" ) { a . extend ( true , k , { window : { bindToInput : true , expandable : true , input : a ( d ) } } ) ; if ( a ( d ) . val ( ) ==
"" ) { k . color . active = new c ( { hex : null } ) ; k . color . current = new c ( { hex : null } ) } else if ( s . validateHex ( a ( d ) . val ( ) ) ) { k . color . active = new c ( { hex : a ( d ) . val ( ) , a : k . color . active . val ( "a" ) } ) ; k . color . current = new c ( { hex : a ( d ) . val ( ) , a : k . color . active . val ( "a" ) } ) } } if ( k . 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 k . window . liveUpdate = false ; var q = parseFloat ( navigator . appVersion . split ( "MSIE" ) [ 1 ] ) < 7 && document . body . filters , B = null , o = null , J = null , U = null , M = null , I = null , S = null , Y = null , P = null , ia = null , qa = null , ga = null , ba = null , W = null , ta = null , ka = null , da = null , X = null , Z = null , oa = null , ra = null , ma = null , na = null , Ca = null , Ga = null , Ja = null , Da = null , La = null , Oa = function ( O ) { var T = ja . active , ea = T . val ( "hex" ) , Ha , Pa ; k . color . mode = O ; switch ( O ) { case "h" : setTimeout ( function ( ) { Ua . call ( d , o , "transparent" ) ; Ea . call ( d , U , 0 ) ; wa . call ( d , U , 100 ) ; Ea . call ( d ,
M , 260 ) ; wa . call ( d , M , 100 ) ; Ua . call ( d , J , "transparent" ) ; Ea . call ( d , S , 0 ) ; wa . call ( d , S , 100 ) ; Ea . call ( d , Y , 260 ) ; wa . call ( d , Y , 100 ) ; Ea . call ( d , P , 260 ) ; wa . call ( d , P , 100 ) ; Ea . call ( d , ia , 260 ) ; wa . call ( d , ia , 100 ) ; Ea . call ( d , ga , 260 ) ; wa . call ( d , ga , 100 ) } , 0 ) ; ba . range ( "all" , { minX : 0 , maxX : 100 , minY : 0 , maxY : 100 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 360 } ) ; if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "s" ) , y : 100 - T . val ( "v" ) } , ba ) ; W . val ( "y" , 360 - T . val ( "h" ) , W ) ; break ; case "s" : setTimeout ( function ( ) { Ua . call ( d , o , "transparent" ) ; Ea . call ( d , U , - 260 ) ; Ea . call ( d ,
M , - 520 ) ; Ea . call ( d , S , - 260 ) ; Ea . call ( d , Y , - 520 ) ; Ea . call ( d , ga , 260 ) ; wa . call ( d , ga , 100 ) } , 0 ) ; ba . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "h" ) , y : 100 - T . val ( "v" ) } , ba ) ; W . val ( "y" , 100 - T . val ( "s" ) , W ) ; break ; case "v" : setTimeout ( function ( ) { Ua . call ( d , o , "000000" ) ; Ea . call ( d , U , - 780 ) ; Ea . call ( d , M , 260 ) ; Ua . call ( d , J , ea ) ; Ea . call ( d , S , - 520 ) ; Ea . call ( d , Y , 260 ) ; wa . call ( d , Y , 100 ) ; Ea . call ( d , ga , 260 ) ; wa . call ( d , ga , 100 ) } , 0 ) ; ba . range ( "all" , { minX : 0 , maxX : 360 ,
minY : 0 , maxY : 100 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "h" ) , y : 100 - T . val ( "s" ) } , ba ) ; W . val ( "y" , 100 - T . val ( "v" ) , W ) ; break ; case "r" : Ha = - 1040 ; Pa = - 780 ; ba . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "b" ) , y : 255 - T . val ( "g" ) } , ba ) ; W . val ( "y" , 255 - T . val ( "r" ) , W ) ; break ; case "g" : Ha = - 1560 ; Pa = - 1820 ; ba . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ;
if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "b" ) , y : 255 - T . val ( "r" ) } , ba ) ; W . val ( "y" , 255 - T . val ( "g" ) , W ) ; break ; case "b" : Ha = - 2080 ; Pa = - 2860 ; ba . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "r" ) , y : 255 - T . val ( "g" ) } , ba ) ; W . val ( "y" , 255 - T . val ( "b" ) , W ) ; break ; case "a" : setTimeout ( function ( ) { Ua . call ( d , o , "transparent" ) ; Ea . call ( d , U , - 260 ) ; Ea . call ( d , M , - 520 ) ; Ea . call ( d , S , 260 ) ; Ea . call ( d , Y , 260 ) ; wa . call ( d , Y , 100 ) ; Ea . call ( d , ga , 0 ) ; wa . call ( d ,
ga , 100 ) } , 0 ) ; ba . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; W . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( T . val ( "ahex" ) == null ) break ; ba . val ( "xy" , { x : T . val ( "h" ) , y : 100 - T . val ( "v" ) } , ba ) ; W . val ( "y" , 255 - T . val ( "a" ) , W ) ; break ; default : throw "Invalid Mode" ; } switch ( O ) { case "s" : case "v" : case "a" : setTimeout ( function ( ) { wa . call ( d , U , 100 ) ; wa . call ( d , S , 100 ) ; Ea . call ( d , P , 260 ) ; wa . call ( d , P , 100 ) ; Ea . call ( d , ia , 260 ) ; wa . call ( d , ia , 100 ) } , 0 ) ; break ; case "r" : case "g" : case "b" : setTimeout ( function ( ) { Ua . call ( d , o , "transparent" ) ; Ua . call ( d , J , "transparent" ) ;
wa . call ( d , S , 100 ) ; wa . call ( d , U , 100 ) ; Ea . call ( d , U , Ha ) ; Ea . call ( d , M , Ha - 260 ) ; Ea . call ( d , S , Pa - 780 ) ; Ea . call ( d , Y , Pa - 520 ) ; Ea . call ( d , P , Pa ) ; Ea . call ( d , ia , Pa - 260 ) ; Ea . call ( d , ga , 260 ) ; wa . call ( d , ga , 100 ) } , 0 ) } T . val ( "ahex" ) != null && Ba . call ( d , T ) } , Ba = function ( O , T ) { if ( T == null || T != W && T != ba ) xa . call ( d , O , T ) ; setTimeout ( function ( ) { rb . call ( d , O ) ; $a . call ( d , O ) ; jb . call ( d , O ) } , 0 ) } , za = function ( O , T ) { var ea = ja . active ; if ( ! ( T != ba && ea . val ( ) == null ) ) { var Ha = O . val ( "all" ) ; switch ( k . color . mode ) { case "h" : ea . val ( "sv" , { s : Ha . x , v : 100 - Ha . y } , T ) ; break ; case "s" : case "a" : ea . val ( "hv" ,
{ h : Ha . x , v : 100 - Ha . y } , T ) ; break ; case "v" : ea . val ( "hs" , { h : Ha . x , s : 100 - Ha . y } , T ) ; break ; case "r" : ea . val ( "gb" , { g : 255 - Ha . y , b : Ha . x } , T ) ; break ; case "g" : ea . val ( "rb" , { r : 255 - Ha . y , b : Ha . x } , T ) ; break ; case "b" : ea . val ( "rg" , { r : Ha . x , g : 255 - Ha . y } , T ) } } } , Ia = function ( O , T ) { var ea = ja . active ; if ( ! ( T != W && ea . val ( ) == null ) ) switch ( k . color . mode ) { case "h" : ea . val ( "h" , { h : 360 - O . val ( "y" ) } , T ) ; break ; case "s" : ea . val ( "s" , { s : 100 - O . val ( "y" ) } , T ) ; break ; case "v" : ea . val ( "v" , { v : 100 - O . val ( "y" ) } , T ) ; break ; case "r" : ea . val ( "r" , { r : 255 - O . val ( "y" ) } , T ) ; break ; case "g" : ea . val ( "g" ,
{ g : 255 - O . val ( "y" ) } , T ) ; break ; case "b" : ea . val ( "b" , { b : 255 - O . val ( "y" ) } , T ) ; break ; case "a" : ea . val ( "a" , 255 - O . val ( "y" ) , T ) } } , xa = function ( O , T ) { if ( T != ba ) switch ( k . color . mode ) { case "h" : var ea = O . val ( "sv" ) ; ba . val ( "xy" , { x : ea != null ? ea . s : 100 , y : 100 - ( ea != null ? ea . v : 100 ) } , T ) ; break ; case "s" : case "a" : ea = O . val ( "hv" ) ; ba . val ( "xy" , { x : ea && ea . h || 0 , y : 100 - ( ea != null ? ea . v : 100 ) } , T ) ; break ; case "v" : ea = O . val ( "hs" ) ; ba . val ( "xy" , { x : ea && ea . h || 0 , y : 100 - ( ea != null ? ea . s : 100 ) } , T ) ; break ; case "r" : ea = O . val ( "bg" ) ; ba . val ( "xy" , { x : ea && ea . b || 0 , y : 255 - ( ea &&
ea . g || 0 ) } , T ) ; break ; case "g" : ea = O . val ( "br" ) ; ba . val ( "xy" , { x : ea && ea . b || 0 , y : 255 - ( ea && ea . r || 0 ) } , T ) ; break ; case "b" : ea = O . val ( "rg" ) ; ba . val ( "xy" , { x : ea && ea . r || 0 , y : 255 - ( ea && ea . g || 0 ) } , T ) } if ( T != W ) switch ( k . color . mode ) { case "h" : W . val ( "y" , 360 - ( O . val ( "h" ) || 0 ) , T ) ; break ; case "s" : ea = O . val ( "s" ) ; W . val ( "y" , 100 - ( ea != null ? ea : 100 ) , T ) ; break ; case "v" : ea = O . val ( "v" ) ; W . val ( "y" , 100 - ( ea != null ? ea : 100 ) , T ) ; break ; case "r" : W . val ( "y" , 255 - ( O . val ( "r" ) || 0 ) , T ) ; break ; case "g" : W . val ( "y" , 255 - ( O . val ( "g" ) || 0 ) , T ) ; break ; case "b" : W . val ( "y" , 255 - ( O . val ( "b" ) ||
0 ) , T ) ; break ; case "a" : ea = O . val ( "a" ) ; W . val ( "y" , 255 - ( ea != null ? ea : 255 ) , T ) } } , rb = function ( O ) { try { var T = O . val ( "all" ) ; oa . css ( { backgroundColor : T && "#" + T . hex || "transparent" } ) ; wa . call ( d , oa , T && Math . precision ( T . a * 100 / 255 , 4 ) || 0 ) } catch ( ea ) { } } , $a = function ( O ) { switch ( k . color . mode ) { case "h" : Ua . call ( d , o , ( new c ( { h : O . val ( "h" ) || 0 , s : 100 , v : 100 } ) ) . val ( "hex" ) ) ; break ; case "s" : case "a" : var T = O . val ( "s" ) ; wa . call ( d , M , 100 - ( T != null ? T : 100 ) ) ; break ; case "v" : T = O . val ( "v" ) ; wa . call ( d , U , T != null ? T : 100 ) ; break ; case "r" : wa . call ( d , M , Math . precision ( ( O . val ( "r" ) ||
0 ) / 255 * 100 , 4 ) ) ; break ; case "g" : wa . call ( d , M , Math . precision ( ( O . val ( "g" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "b" : wa . call ( d , M , Math . precision ( ( O . val ( "b" ) || 0 ) / 255 * 100 ) ) } O = O . val ( "a" ) ; wa . call ( d , I , Math . precision ( ( 255 - ( O || 0 ) ) * 100 / 255 , 4 ) ) } , jb = function ( O ) { switch ( k . color . mode ) { case "h" : var T = O . val ( "a" ) ; wa . call ( d , qa , Math . precision ( ( 255 - ( T || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "s" : T = O . val ( "hva" ) ; var ea = new c ( { h : T && T . h || 0 , s : 100 , v : T != null ? T . v : 100 } ) ; Ua . call ( d , J , ea . val ( "hex" ) ) ; wa . call ( d , Y , 100 - ( T != null ? T . v : 100 ) ) ; wa . call ( d , qa , Math . precision ( ( 255 -
( T && T . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "v" : T = O . val ( "hsa" ) ; ea = new c ( { h : T && T . h || 0 , s : T != null ? T . s : 100 , v : 100 } ) ; Ua . call ( d , J , ea . val ( "hex" ) ) ; wa . call ( d , qa , Math . precision ( ( 255 - ( T && T . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "r" : case "g" : case "b" : ea = T = 0 ; O = O . val ( "rgba" ) ; if ( k . color . mode == "r" ) { T = O && O . b || 0 ; ea = O && O . g || 0 } else if ( k . color . mode == "g" ) { T = O && O . b || 0 ; ea = O && O . r || 0 } else if ( k . color . mode == "b" ) { T = O && O . r || 0 ; ea = O && O . g || 0 } var Ha = ea > T ? T : ea ; wa . call ( d , Y , T > ea ? Math . precision ( ( T - ea ) / ( 255 - ea ) * 100 , 4 ) : 0 ) ; wa . call ( d , P , ea > T ? Math . precision ( ( ea -
T ) / ( 255 - T ) * 100 , 4 ) : 0 ) ; wa . call ( d , ia , Math . precision ( Ha / 255 * 100 , 4 ) ) ; wa . call ( d , qa , Math . precision ( ( 255 - ( O && O . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "a" : T = O . val ( "a" ) ; Ua . call ( d , J , O . val ( "hex" ) || "000000" ) ; wa . call ( d , qa , T != null ? 0 : 100 ) ; wa . call ( d , ga , T != null ? 100 : 0 ) } } , Ua = function ( O , T ) { O . css ( { backgroundColor : T && T . length == 6 && "#" + T || "transparent" } ) } , Sa = function ( O , T ) { if ( q && ( T . indexOf ( "AlphaBar.png" ) != - 1 || T . indexOf ( "Bars.png" ) != - 1 || T . indexOf ( "Maps.png" ) != - 1 ) ) { O . attr ( "pngSrc" , T ) ; O . css ( { backgroundImage : "none" , filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
T + "', sizingMethod='scale')" } ) } else O . css ( { backgroundImage : "url('" + T + "')" } ) } , Ea = function ( O , T ) { O . css ( { top : T + "px" } ) } , wa = function ( O , T ) { O . css ( { visibility : T > 0 ? "visible" : "hidden" } ) ; if ( T > 0 && T < 100 ) if ( q ) { var ea = O . attr ( "pngSrc" ) ; ea != null && ( ea . indexOf ( "AlphaBar.png" ) != - 1 || ea . indexOf ( "Bars.png" ) != - 1 || ea . indexOf ( "Maps.png" ) != - 1 ) ? O . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ea + "', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity=" + T + ")" } ) : O . css ( { opacity : Math . precision ( T /
100 , 4 ) } ) } else O . css ( { opacity : Math . precision ( T / 100 , 4 ) } ) ; else if ( T == 0 || T == 100 ) if ( q ) { ea = O . attr ( "pngSrc" ) ; ea != null && ( ea . indexOf ( "AlphaBar.png" ) != - 1 || ea . indexOf ( "Bars.png" ) != - 1 || ea . indexOf ( "Maps.png" ) != - 1 ) ? O . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ea + "', sizingMethod='scale')" } ) : O . css ( { opacity : "" } ) } else O . css ( { opacity : "" } ) } , hb = function ( ) { ja . active . val ( "ahex" , ja . current . val ( "ahex" ) ) } , Ma = function ( ) { ja . current . val ( "ahex" , ja . active . val ( "ahex" ) ) } , Ta = function ( O ) { a ( this ) . parents ( "tbody:first" ) . find ( 'input:radio[value!="' +
O . target . value + '"]' ) . removeAttr ( "checked" ) ; Oa . call ( d , O . target . value ) } , Fa = function ( ) { hb . call ( d ) } , lb = function ( ) { hb . call ( d ) ; k . window . expandable && xb . call ( d ) ; a . isFunction ( ub ) && ub . call ( d , ja . active , na ) } , tb = function ( ) { Ma . call ( d ) ; k . window . expandable && xb . call ( d ) ; a . isFunction ( pb ) && pb . call ( d , ja . active , ma ) } , Ya = function ( ) { vb . call ( d ) } , bb = function ( O ) { var T = O . val ( "hex" ) ; ra . css ( { backgroundColor : T && "#" + T || "transparent" } ) ; wa . call ( d , ra , Math . precision ( ( O . val ( "a" ) || 0 ) * 100 / 255 , 4 ) ) } , Cb = function ( O ) { var T = O . val ( "hex" ) ; O = O . val ( "va" ) ;
Ga . css ( { backgroundColor : T && "#" + T || "transparent" } ) ; wa . call ( d , Ja , Math . precision ( ( 255 - ( O && O . a || 0 ) ) * 100 / 255 , 4 ) ) ; if ( k . window . bindToInput && k . window . updateInputColor ) k . window . input . css ( { backgroundColor : T && "#" + T || "transparent" , color : O == null || O . v > 75 ? "#000000" : "#ffffff" } ) } , ua = function ( O ) { ka = parseInt ( B . css ( "left" ) ) ; da = parseInt ( B . css ( "top" ) ) ; X = O . pageX ; Z = O . pageY ; a ( document ) . bind ( "mousemove" , nb ) . bind ( "mouseup" , kb ) ; O . preventDefault ( ) } , nb = function ( O ) { B . css ( { left : ka - ( X - O . pageX ) + "px" , top : da - ( Z - O . pageY ) + "px" } ) ; k . window . expandable &&
! a . support . boxModel && B . prev ( ) . css ( { left : B . css ( "left" ) , top : B . css ( "top" ) } ) ; O . stopPropagation ( ) ; O . preventDefault ( ) ; return false } , kb = function ( O ) { a ( document ) . unbind ( "mousemove" , nb ) . unbind ( "mouseup" , kb ) ; O . stopPropagation ( ) ; O . preventDefault ( ) ; return false } , zb = function ( O ) { O . preventDefault ( ) ; O . stopPropagation ( ) ; ja . active . val ( "ahex" , a ( this ) . attr ( "title" ) || null , O . target ) ; return false } , pb = a . isFunction ( f [ 1 ] ) && f [ 1 ] || null , gb = a . isFunction ( f [ 2 ] ) && f [ 2 ] || null , ub = a . isFunction ( f [ 3 ] ) && f [ 3 ] || null , vb = function ( ) { ja . current . val ( "ahex" ,
ja . active . val ( "ahex" ) ) ; var O = function ( ) { if ( ! ( ! k . window . expandable || a . support . boxModel ) ) { var T = B . find ( "table:first" ) ; B . before ( "<iframe/>" ) ; B . prev ( ) . css ( { width : T . width ( ) , height : B . height ( ) , opacity : 0 , position : "absolute" , left : B . css ( "left" ) , top : B . css ( "top" ) } ) } } ; if ( k . window . expandable ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; B . css ( { zIndex : 20 } ) } switch ( k . window . effects . type ) { case "fade" : B . fadeIn ( k . window . effects . speed . show , O ) ; break ; case "slide" : B . slideDown ( k . window . effects . speed . show ,
O ) ; break ; default : B . show ( k . window . effects . speed . show , O ) } } , xb = function ( ) { var O = function ( ) { k . window . expandable && B . css ( { zIndex : 10 } ) ; ! k . window . expandable || a . support . boxModel || B . prev ( ) . remove ( ) } ; switch ( k . window . effects . type ) { case "fade" : B . fadeOut ( k . window . effects . speed . hide , O ) ; break ; case "slide" : B . slideUp ( k . window . effects . speed . hide , O ) ; break ; default : B . hide ( k . window . effects . speed . hide , O ) } } , Ab = function ( ) { var O = k . window , T = O . expandable ? a ( d ) . next ( ) . find ( ".Container:first" ) : null ; B = O . expandable ? a ( "<div/>" ) : a ( d ) ;
B . addClass ( "jPicker Container" ) ; O . expandable && B . hide ( ) ; B . get ( 0 ) . onselectstart = function ( Qa ) { if ( Qa . target . nodeName . toLowerCase ( ) !== "input" ) return false } ; var ea = ja . active . val ( "all" ) ; if ( O . alphaPrecision < 0 ) O . alphaPrecision = 0 ; else if ( O . alphaPrecision > 2 ) O . alphaPrecision = 2 ; var Ha = '<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + ( O . expandable ? '<tr><td class="Move" colspan="5"> </td></tr>' : "" ) + '<tr><td rowspan="9"><h2 class="Title">' + ( O . title || ca . text . title ) + '</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="' +
la . clientPath + la . 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="' + la . clientPath + la . colorBar . arrow . file + '" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">' + ca . text . newColor + '<div class="color_preview"><span class="Active" title="' + ca . tooltips . colors . newColor +
'"> </span><span class="Current" title="' + ca . tooltips . colors . currentColor + '"> </span></div></div>' + ca . text . currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + ca . text . ok + '" title="' + ca . tooltips . buttons . ok + '"/><input type="button" class="Cancel" value="' + ca . text . cancel + '" title="' + ca . tooltips . buttons . cancel + '"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="' + ca . tooltips . hue . radio + '"><input type="radio" value="h"' +
( k . color . mode == "h" ? ' checked="checked"' : "" ) + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . h : "" ) + '" title="' + ca . tooltips . hue . textbox + '"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="' + ca . tooltips . saturation . radio + '"><input type="radio" value="s"' + ( k . color . mode == "s" ? ' checked="checked"' : "" ) + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . s : "" ) + '" title="' + ca . tooltips . saturation . textbox +
'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="' + ca . tooltips . value . radio + '"><input type="radio" value="v"' + ( k . color . mode == "v" ? ' checked="checked"' : "" ) + '/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . v : "" ) + '" title="' + ca . tooltips . value . textbox + '"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + ca . tooltips . red . radio + '"><input type="radio" value="r"' + ( k . color . mode == "r" ? ' checked="checked"' : "" ) + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' +
( ea != null ? ea . r : "" ) + '" title="' + ca . tooltips . red . textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + ca . tooltips . green . radio + '"><input type="radio" value="g"' + ( k . color . mode == "g" ? ' checked="checked"' : "" ) + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . g : "" ) + '" title="' + ca . tooltips . green . textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' + ca . tooltips . blue . radio + '"><input type="radio" value="b"' + ( k . color . mode == "b" ? ' checked="checked"' :
"" ) + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( ea != null ? ea . b : "" ) + '" title="' + ca . tooltips . blue . textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + ( O . alphaSupport ? '<label title="' + ca . tooltips . alpha . radio + '"><input type="radio" value="a"' + ( k . color . mode == "a" ? ' checked="checked"' : "" ) + "/>A:</label>" : " " ) + '</td><td class="Text">' + ( O . alphaSupport ? '<input type="text" maxlength="' + ( 3 + O . alphaPrecision ) + '" value="' + ( ea != null ? Math . precision ( ea . a * 100 / 255 , O . alphaPrecision ) :
"" ) + '" title="' + ca . tooltips . alpha . textbox + '"/> %' : " " ) + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + ca . tooltips . hex . textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + ( ea != null ? ea . hex : "" ) + '"/></label>' + ( O . alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + ( ea != null ? ea . ahex . substring ( 6 ) : "" ) + '" title="' + ca . tooltips . hex . alpha + '"/></td>' : " " ) + "</tr></tbody></table>" ; if ( O . expandable ) { B . html ( Ha ) ; a ( document . body ) . children ( "div.jPicker.Container" ) . length ==
0 ? a ( document . body ) . prepend ( B ) : a ( document . body ) . children ( "div.jPicker.Container:last" ) . after ( B ) ; B . mousedown ( function ( ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; B . css ( { zIndex : 20 } ) } ) ; B . css ( { left : O . position . x == "left" ? T . offset ( ) . left - 530 - ( O . position . y == "center" ? 25 : 0 ) + "px" : O . position . x == "center" ? T . offset ( ) . left - 260 + "px" : O . position . x == "right" ? T . offset ( ) . left - 10 + ( O . position . y == "center" ? 25 : 0 ) + "px" : O . position . x == "screenCenter" ? ( a ( document ) . width ( ) >> 1 ) - 260 + "px" : T . offset ( ) . left + parseInt ( O . position . x ) +
"px" , position : "absolute" , top : O . position . y == "top" ? T . offset ( ) . top - 312 + "px" : O . position . y == "center" ? T . offset ( ) . top - 156 + "px" : O . position . y == "bottom" ? T . offset ( ) . top + 25 + "px" : T . offset ( ) . top + parseInt ( O . position . y ) + "px" } ) } else { B = a ( d ) ; B . html ( Ha ) } Ha = B . find ( "tbody:first" ) ; o = Ha . find ( "div.Map:first" ) ; J = Ha . find ( "div.Bar:first" ) ; var Pa = o . find ( "span" ) , Xa = J . find ( "span" ) ; U = Pa . filter ( ".Map1:first" ) ; M = Pa . filter ( ".Map2:first" ) ; I = Pa . filter ( ".Map3:first" ) ; S = Xa . filter ( ".Map1:first" ) ; Y = Xa . filter ( ".Map2:first" ) ; P = Xa . filter ( ".Map3:first" ) ;
ia = Xa . filter ( ".Map4:first" ) ; qa = Xa . filter ( ".Map5:first" ) ; ga = Xa . filter ( ".Map6:first" ) ; ba = new p ( o , { map : { width : la . colorMap . width , height : la . colorMap . height } , arrow : { image : la . clientPath + la . colorMap . arrow . file , width : la . colorMap . arrow . width , height : la . colorMap . arrow . height } } ) ; ba . bind ( za ) ; W = new p ( J , { map : { width : la . colorBar . width , height : la . colorBar . height } , arrow : { image : la . clientPath + la . colorBar . arrow . file , width : la . colorBar . arrow . width , height : la . colorBar . arrow . height } } ) ; W . bind ( Ia ) ; ta = new g ( Ha , ja . active , O . expandable &&
O . bindToInput ? O . input : null , O . alphaPrecision ) ; Pa = ea != null ? ea . hex : null ; var fb = Ha . find ( ".Preview" ) ; Xa = Ha . find ( ".Button" ) ; oa = fb . find ( ".Active:first" ) . css ( { backgroundColor : Pa && "#" + Pa || "transparent" } ) ; ra = fb . find ( ".Current:first" ) . css ( { backgroundColor : Pa && "#" + Pa || "transparent" } ) . bind ( "click" , Fa ) ; wa . call ( d , ra , Math . precision ( ja . current . val ( "a" ) * 100 ) / 255 , 4 ) ; ma = Xa . find ( ".Ok:first" ) . bind ( "click touchstart" , tb ) ; na = Xa . find ( ".Cancel:first" ) . bind ( "click touchstart" , lb ) ; Ca = Xa . find ( ".Grid:first" ) ; setTimeout ( function ( ) { Sa . call ( d ,
U , la . clientPath + "Maps.png" ) ; Sa . call ( d , M , la . clientPath + "Maps.png" ) ; Sa . call ( d , I , la . clientPath + "map-opacity.png" ) ; Sa . call ( d , S , la . clientPath + "Bars.png" ) ; Sa . call ( d , Y , la . clientPath + "Bars.png" ) ; Sa . call ( d , P , la . clientPath + "Bars.png" ) ; Sa . call ( d , ia , la . clientPath + "Bars.png" ) ; Sa . call ( d , qa , la . clientPath + "bar-opacity.png" ) ; Sa . call ( d , ga , la . clientPath + "AlphaBar.png" ) ; Sa . call ( d , fb . find ( "div:last" ) , la . clientPath + "preview-opacity.png" ) } , 0 ) ; Ha . find ( "td.Radio input" ) . bind ( "click touchstart" , Ta ) ; if ( ja . quickList && ja . quickList . length >
0 ) { Xa = "" ; for ( i = 0 ; i < ja . quickList . length ; i ++ ) { if ( ( typeof ja . quickList [ i ] ) . toString ( ) . toLowerCase ( ) == "string" ) ja . quickList [ i ] = new c ( { hex : ja . quickList [ i ] } ) ; var ob = ja . quickList [ i ] . val ( "a" ) , Wa = ja . quickList [ i ] . val ( "ahex" ) ; if ( ! O . alphaSupport && Wa ) Wa = Wa . substring ( 0 , 6 ) + "ff" ; var sb = ja . quickList [ i ] . val ( "hex" ) ; Xa += '<span class="QuickColor"' + ( Wa && ' title="#' + Wa + '"' || "" ) + ' style="background-color:' + ( sb && "#" + sb || "" ) + ";" + ( sb ? "" : "background-image:url(" + la . clientPath + "NoColor.png)" ) + ( O . alphaSupport && ob && ob < 255 ? ";opacity:" +
Math . precision ( ob / 255 , 4 ) + ";filter:Alpha(opacity=" + Math . precision ( ob / 2.55 , 4 ) + ")" : "" ) + '"> </span>' } Sa . call ( d , Ca , la . clientPath + "bar-opacity.png" ) ; Ca . html ( Xa ) ; Ca . find ( ".QuickColor" ) . click ( zb ) } Oa . call ( d , k . color . mode ) ; ja . active . bind ( Ba ) ; a . isFunction ( gb ) && ja . active . bind ( gb ) ; ja . current . bind ( bb ) ; if ( O . expandable ) { d . icon = T . parents ( ".Icon:first" ) ; Ga = d . icon . find ( ".Color:first" ) . css ( { backgroundColor : Pa && "#" + Pa || "transparent" } ) ; Ja = d . icon . find ( ".Alpha:first" ) ; Sa . call ( d , Ja , la . clientPath + "bar-opacity.png" ) ; wa . call ( d ,
Ja , Math . precision ( ( 255 - ( ea != null ? ea . a : 0 ) ) * 100 / 255 , 4 ) ) ; Da = d . icon . find ( ".Image:first" ) . css ( { backgroundImage : "url('" + la . clientPath + la . picker . file + "')" } ) . bind ( "click" , Ya ) ; if ( O . bindToInput && O . updateInputColor ) O . input . css ( { backgroundColor : Pa && "#" + Pa || "transparent" , color : ea == null || ea . v > 75 ? "#000000" : "#ffffff" } ) ; La = Ha . find ( ".Move:first" ) . bind ( "mousedown" , ua ) ; ja . active . bind ( Cb ) } else vb . call ( d ) } , la = k . images , ca = k . localization , ja = { active : ( typeof k . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new c ( { ahex : ! k . window . alphaSupport &&
k . color . active ? k . color . active . substring ( 0 , 6 ) + "ff" : k . color . active } ) : new c ( { ahex : ! k . window . alphaSupport && k . color . active . val ( "ahex" ) ? k . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : k . color . active . val ( "ahex" ) } ) , current : ( typeof k . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new c ( { ahex : ! k . window . alphaSupport && k . color . active ? k . color . active . substring ( 0 , 6 ) + "ff" : k . color . active } ) : new c ( { ahex : ! k . window . alphaSupport && k . color . active . val ( "ahex" ) ? k . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : k . color . active . val ( "ahex" ) } ) ,
quickList : k . color . quickList } ; a . extend ( true , d , { commitCallback : pb , liveCallback : gb , cancelCallback : ub , color : ja , show : vb , hide : xb , destroy : function ( ) { B . find ( "td.Radio input touchstart" ) . unbind ( "click" , Ta ) ; ra . unbind ( "click touchstart" , Fa ) ; na . unbind ( "click touchstart" , lb ) ; ma . unbind ( "click touchstart" , tb ) ; if ( k . window . expandable ) { Da . unbind ( "click" , Ya ) ; La . unbind ( "mousedown" , ua ) ; d . icon = null } B . find ( ".QuickColor" ) . unbind ( "click" , zb ) ; ga = qa = ia = P = Y = S = I = M = U = J = o = null ; ba . destroy ( ) ; ba = null ; W . destroy ( ) ; W = null ; ta . destroy ( ) ;
gb = ub = pb = Ca = na = ma = ra = oa = ta = null ; B . html ( "" ) ; for ( i = 0 ; i < m . length ; i ++ ) m [ i ] == d && m . splice ( i , 1 ) } } ) ; m . push ( d ) ; setTimeout ( function ( ) { Ab . 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 p ( m ) { var s = m || window . event , b = [ ] . slice . call ( arguments , 1 ) , f = 0 , d = 0 , k = 0 ; m = a . event . fix ( s ) ; m . type = "mousewheel" ; if ( s . wheelDelta ) f = s . wheelDelta / 120 ; if ( s . detail ) f = - s . detail / 3 ; k = f ; if ( s . axis !== undefined && s . axis === s . HORIZONTAL _AXIS ) { k = 0 ; d = - 1 * f } if ( s . wheelDeltaY !== undefined ) k = s . wheelDeltaY / 120 ; if ( s . wheelDeltaX !== undefined ) d = - 1 * s . wheelDeltaX / 120 ; b . unshift ( m , f , d , k ) ; return ( a . event . dispatch || a . event . handle ) . apply ( this , b ) } var g = [ "DOMMouseScroll" , "mousewheel" ] ; if ( a . event . fixHooks ) for ( var c = g . length ; c ; ) a . event . fixHooks [ g [ -- c ] ] =
a . event . mouseHooks ; a . event . special . mousewheel = { setup : function ( ) { if ( this . addEventListener ) for ( var m = g . length ; m ; ) this . addEventListener ( g [ -- m ] , p , false ) ; else this . onmousewheel = p } , teardown : function ( ) { if ( this . removeEventListener ) for ( var m = g . length ; m ; ) this . removeEventListener ( g [ -- m ] , p , false ) ; else this . onmousewheel = null } } ; a . fn . extend ( { mousewheel : function ( m ) { return m ? this . bind ( "mousewheel" , m ) : this . trigger ( "mousewheel" ) } , unmousewheel : function ( m ) { return this . unbind ( "mousewheel" , m ) } } ) } ) ( jQuery ) ; svgEditor . addExtension ( "eyedropper" , function ( a ) { function p ( b ) { if ( g . getMode ( ) != "eyedropper" ) { var f = $ ( "#tool_eyedropper" ) ; b . elems [ 0 ] && $ . inArray ( b . elems [ 0 ] . nodeName , [ "svg" , "g" , "use" ] ) == - 1 ? f . removeClass ( "disabled" ) : f . addClass ( "disabled" ) } } var g = svgEditor . canvas , c = svgedit . history . ChangeElementCommand , m = { fillPaint : "red" , fillOpacity : 1 , strokePaint : "black" , strokeOpacity : 1 , strokeWidth : 5 , strokeDashArray : null , opacity : 1 , strokeLinecap : "butt" , strokeLinejoin : "miter" } , s = function ( b , f , d ) { var k = null ; console . log ( b ) ; if ( b . indexOf ( "url(#" ) ===
0 ) { b = ( b = g . getRefElem ( b ) ) ? b . cloneNode ( true ) : $ ( "#" + d + "_color defs *" ) [ 0 ] ; k = { alpha : f } ; k [ b . tagName ] = b } else k = b . indexOf ( "#" ) === 0 ? { alpha : f , solidColor : b . substr ( 1 ) } : { alpha : f , solidColor : "none" } ; return new $ . jGraduate . Paint ( k ) } ; return { name : "eyedropper" , svgicons : "extensions/eyedropper-icon.xml" , buttons : [ { id : "tool_eyedropper" , type : "mode" , title : "Eye Dropper Tool" , key : "I" , "class" : "disabled" , events : { click : function ( ) { g . setMode ( "eyedropper" ) } } } ] , selectedChanged : p , elementChanged : p , mouseDown : function ( b ) { var f = g . getMode ( ) ,
d = b . event ; d = d . target . id === "svgroot" ? document . getElementById ( "canvas_background" ) : d . target ; if ( f == "eyedropper" && d ) { m . fillPaint = d . getAttribute ( "fill" ) || "white" ; m . fillOpacity = d . getAttribute ( "fill-opacity" ) || 1 ; m . strokePaint = d . getAttribute ( "stroke" ) || "none" ; m . strokeOpacity = d . getAttribute ( "stroke-opacity" ) || 1 ; m . strokeWidth = d . getAttribute ( "stroke-width" ) ; m . strokeDashArray = d . getAttribute ( "stroke-dasharray" ) ; m . strokeLinecap = d . getAttribute ( "stroke-linecap" ) ; m . strokeLinejoin = d . getAttribute ( "stroke-linejoin" ) ;
m . opacity = d . getAttribute ( "opacity" ) || 1 ; if ( $ . inArray ( b . selectedElements . nodeName , [ "g" , "use" ] ) == - 1 ) { var k = { } , q = function ( o , J , U ) { k [ J ] = o . getAttribute ( J ) ; o . setAttribute ( J , U ) } , B = new a . BatchCommand ; b . selectedElements . forEach ( function ( o ) { m . fillPaint && q ( o , "fill" , m . fillPaint ) ; m . fillOpacity && q ( o , "fill-opacity" , m . fillOpacity ) ; m . strokePaint && q ( o , "stroke" , m . strokePaint ) ; m . strokeOpacity && q ( o , "stroke-opacity" , m . strokeOpacity ) ; m . strokeWidth && q ( o , "stroke-width" , m . strokeWidth ) ; m . strokeDashArray && q ( o , "stroke-dasharray" ,
m . strokeDashArray ) ; m . opacity && q ( o , "opacity" , m . opacity ) ; m . strokeLinecap && q ( o , "stroke-linecap" , m . strokeLinecap ) ; m . strokeLinejoin && q ( o , "stroke-linejoin" , m . strokeLinejoin ) ; B . addSubCommand ( new c ( o , k ) ) ; console . log ( k ) ; k = { } } ) ; s ( m . fillPaint , m . fillOpacity * 100 , "fill" ) ; s ( m . strokePaint , m . strokeOpacity * 100 , "stroke" ) ; svgEditor . paintBox . fill . update ( true ) ; svgEditor . paintBox . stroke . update ( true ) ; g . undoMgr . addCommandToHistory ( B ) } } } } } ) ; svgEditor . addExtension ( "view_grid" , function ( a ) { function p ( d ) { b . attr ( "width" ) ; b . attr ( "height" ) ; var k = svgedit . units . getTypeMap ( ) [ svgEditor . curConfig . baseUnit ] , q = [ 0.01 , 0.1 , 1 , 10 , 100 , 1E3 ] ; svgCanvas . getContentElem ( ) . getAttribute ( "x" ) ; var B = m ; k = k * d ; var o = 100 / k , J = 1 ; for ( d = 0 ; d < q . length ; d ++ ) { var U = q [ d ] ; J = U ; if ( o <= U ) break } q = J * k ; B . width = q ; B . height = q ; k = B . getContext ( "2d" ) ; o = q / 10 ; k . globalAlpha = 0.2 ; k . strokeStyle = "#000" ; for ( d = 1 ; d < 10 ; d ++ ) { J = Math . round ( o * d ) + 0.5 ; k . moveTo ( J , q ) ; k . lineTo ( J , 0 ) ; k . moveTo ( q , J ) ; k . lineTo ( 0 , J ) } k . stroke ( ) ;
k . beginPath ( ) ; k . globalAlpha = 0.5 ; k . moveTo ( 0.5 , q ) ; k . lineTo ( 0.5 , 0 ) ; k . moveTo ( q , 0.5 ) ; k . lineTo ( 0 , 0.5 ) ; k . stroke ( ) ; B = B . toDataURL ( "image/png" ) ; f . setAttribute ( "width" , q ) ; f . setAttribute ( "height" , q ) ; f . parentNode . setAttribute ( "width" , q ) ; f . parentNode . setAttribute ( "height" , q ) ; svgCanvas . setHref ( f , B ) } if ( ! document . getElementById ( "canvasGrid" ) ) { var g = document . getElementById ( "svgcanvas" ) . ownerDocument , c = false ; a = a . assignAttributes ; var m = document . createElement ( "canvas" ) ; $ ( m ) . hide ( ) . appendTo ( "body" ) ; var s = g . createElementNS ( "http://www.w3.org/2000/svg" ,
2012-07-24 12:42:34 +00:00
"g" ) ; a ( s , { id : "canvasGrid" , width : "100%" , height : "100%" , x : 0 , y : 0 , overflow : "visible" , display : "none" } ) ; var b = $ ( "#canvas_background" ) ; b . after ( s ) ; s = g . createElementNS ( "http://www.w3.org/2000/svg" , "pattern" ) ; a ( s , { id : "gridpattern" , patternUnits : "userSpaceOnUse" , x : 0 , y : 0 , width : 100 , height : 100 } ) ; var f = g . createElementNS ( "http://www.w3.org/2000/svg" , "image" ) ; a ( f , { x : 0 , y : 0 , width : 100 , height : 100 } ) ; s . appendChild ( f ) ; $ ( "#svgroot defs" ) . append ( s ) ; g = g . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; a ( g , { width : "100%" , height : "100%" ,
2012-07-25 06:32:18 +00:00
x : 0 , y : 0 , "stroke-width" : 0 , stroke : "none" , fill : "url(#gridpattern)" , style : "pointer-events: none; display:visible;" } ) ; $ ( "#canvasGrid" ) . append ( g ) } return { name : "view_grid" , zoomChanged : function ( d ) { c && p ( d ) } , 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" ) ) { svgEditor . curConfig . showGrid = c = false ; $ ( "#view_grid" ) . removeClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "none" ) } else { svgEditor . curConfig . showGrid =
2012-07-25 08:56:15 +00:00
c = true ; $ ( "#view_grid" ) . addClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "normal" ) ; p ( svgCanvas . getZoom ( ) ) } } } } ] } } ) ; svgEditor . addExtension ( "shapes" , function ( ) { function a ( ) { $ ( "#shape_buttons" ) . empty ( ) ; $ ( "#shape_buttons" ) . append ( J . buttons ) } function p ( M ) { var I = o [ M ] ; if ( I ) { J = I ; I . buttons . length || g ( M , I ) ; a ( ) } else { $ ( "#shape_buttons" ) . html ( "Loading..." ) ; $ . getJSON ( "extensions/shapelib/" + M + ".json" , function ( S ) { J = o [ M ] = { data : S . data , size : S . size , fill : S . fill } ; g ( M , S ) ; a ( ) } ) } } function g ( M , I ) { var S = J . size || 300 , Y = J . fill || false , P = S * 0.05 ; P = [ - P , - P , S + P * 2 , S + P * 2 ] . join ( " " ) ; S = Y ? 0 : S / 30 ; S = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' +
P + '"><path fill="#333" stroke="transparent" stroke-width="' + S + '" /></svg></svg>' , "text/xml" ) ; S . documentElement . setAttribute ( "width" , 40 ) ; S . documentElement . setAttribute ( "height" , 40 ) ; Y = $ ( document . importNode ( S . documentElement , true ) ) ; var ia = I . data ; J . buttons = [ ] ; for ( var qa in ia ) { var ga = ia [ qa ] , ba = Y . clone ( ) ; if ( ga . charAt ( ga . length - 1 ) == "x" ) { S = 32 ; P = S * 0.05 ; P = [ - P , - P , S + P * 2 , S + P * 2 ] . join ( " " ) ; ba . find ( "svg" ) . attr ( "viewBox" , P ) ; ga . replace ( "x" , "" ) } ba . find ( "path" ) . attr ( "d" , ga ) ; S = ba . wrap ( '<div class="tool_button">' ) . parent ( ) . attr ( { id : U +
"_" + qa , title : qa } ) ; J . buttons . push ( S [ 0 ] ) } } var c , m , s = svgEditor . canvas , b , f , d , k = s . getRootElem ( ) , q = { } , B = { 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" } , o = { 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" ,
2012-07-19 15:25:04 +00:00
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" ,
2012-07-25 08:56:15 +00:00
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 : [ ] } } , J = o . basic , U = "shapelib" ; return { svgicons : "extensions/ext-shapes.xml" , buttons : [ { id : "tool_shapelib" , type : "mode_flyout" , position : 6 , title : "Shape library" , events : { click : function ( ) { s . setMode ( U ) } } } ] , callback : function ( ) { var M = $ ( '<div id="shape_buttons">' ) ;
$ ( "#tools_shapelib > *" ) . wrapAll ( M ) ; var I = $ ( "#tools_shapelib_show" ) ; p ( "basic" ) ; $ ( "#shape_buttons" ) . mouseup ( function ( Y ) { Y = $ ( Y . target ) . closest ( "div.tool_button" ) ; if ( Y . length ) { var P = Y . children ( ) . clone ( ) . attr ( { width : 24 , height : 24 } ) ; I . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; I . append ( P ) . attr ( "data-curopt" , "#" + Y [ 0 ] . id ) . mouseup ( ) ; s . setMode ( U ) ; m = Y [ 0 ] . id . substr ( ( U + "_" ) . length ) ; c = J . data [ m ] ; $ ( ".tools_flyout" ) . fadeOut ( ) } } ) ; M = $ ( '<div id="shape_cats">' ) ; var S = "" ; $ . each ( B , function ( Y , P ) { S += "<div data-cat=" +
Y + ">" + P + "</div>" } ) ; M . html ( S ) . children ( ) . bind ( "mouseup" , function ( ) { var Y = $ ( this ) ; Y . siblings ( ) . removeClass ( "current" ) ; Y . addClass ( "current" ) ; p ( Y . attr ( "data-cat" ) ) ; return false } ) ; M . children ( ) . eq ( 0 ) . addClass ( "current" ) ; $ ( "#tools_shapelib" ) . prepend ( M ) ; I . mouseup ( function ( ) { s . setMode ( c ? U : "select" ) } ) ; $ ( "#tool_shapelib" ) . remove ( ) ; M = $ ( "#tools_shapelib" ) . height ( ) ; $ ( "#tools_shapelib" ) . css ( { "margin-top" : - ( M / 2 ) , "margin-left" : 3 } ) } , mouseDown : function ( M ) { if ( s . getMode ( ) === U ) { var I = f = M . start _x ; M = d = M . start _y ; var S = s . getStyle ( ) ;
b = s . addSvgElementFromJson ( { element : "path" , curStyles : true , attr : { d : c , id : s . getNextId ( ) , opacity : S . opacity / 2 , style : "pointer-events:none" } } ) ; b . setAttribute ( "d" , c ) ; if ( /[a-z]/ . test ( c ) ) { c = J . data [ m ] = s . pathActions . convertPath ( b ) ; b . setAttribute ( "d" , c ) ; s . pathActions . fixEnd ( b ) } b . setAttribute ( "transform" , "translate(" + I + "," + M + ") scale(0.005) translate(" + - I + "," + - M + ")" ) ; s . recalculateDimensions ( b ) ; s . getTransformList ( b ) ; q = b . getBBox ( ) ; totalScale = { sx : 1 , sy : 1 } ; return { started : true } } } , mouseMove : function ( M ) { if ( s . getMode ( ) ===
U ) { var I = s . getZoom ( ) , S = M . event , Y = M . mouse _x / I , P = M . mouse _y / I ; M = s . getTransformList ( b ) ; var ia = b . getBBox ( ) ; I = ia . x ; var qa = ia . y , ga = ia . width , ba = ia . height , W = Y - f , ta = P - d , ka = { x : Math . min ( f , Y ) , y : Math . min ( d , P ) , width : Math . abs ( Y - f ) , height : Math . abs ( P - d ) } , da = ia = 0 ; ba = ba ? ( ba + ta ) / ba : 1 ; ga = ga ? ( ga + W ) / ga : 1 ; ga = ka . width / q . width ; ba = ka . height / q . height ; ga = ga || 1 ; ba = ba || 1 ; if ( Y < f ) ia = q . width ; if ( P < d ) da = q . height ; Y = k . createSVGTransform ( ) ; P = k . createSVGTransform ( ) ; ka = k . createSVGTransform ( ) ; Y . setTranslate ( - ( I + ia ) , - ( qa + da ) ) ; if ( S . shiftKey ) { replaced =
true ; S = Math . min ( Math . abs ( ga ) , Math . abs ( ba ) ) ; ga = S * ( ga < 0 ? - 1 : 1 ) ; ba = S * ( ba < 0 ? - 1 : 1 ) ; if ( totalScale . sx != totalScale . sy ) { S = totalScale . sx > totalScale . sy ? 1 : totalScale . sx / totalScale . sy ; W = totalScale . sy > totalScale . sx ? 1 : totalScale . sy / totalScale . sx ; ga *= W ; ba *= S ; console . log ( S , W ) } } totalScale . sx *= ga ; totalScale . sy *= ba ; P . setScale ( ga , ba ) ; ka . setTranslate ( I + ia , qa + da ) ; M . appendItem ( ka ) ; M . appendItem ( P ) ; M . appendItem ( Y ) ; s . recalculateDimensions ( b ) ; q = b . getBBox ( ) } } , mouseUp : function ( M ) { if ( s . getMode ( ) === U ) { if ( M . mouse _x == f && M . mouse _y ==
d ) return { keep : false , element : b , started : false } ; s . setMode ( "select" ) ; return { keep : true , element : b , started : false } } } } } ) ; ( function ( ) { for ( var a = 0 , p = [ "ms" , "moz" , "webkit" , "o" ] , g = 0 ; g < p . length && ! window . requestAnimationFrame ; ++ g ) { window . requestAnimationFrame = window [ p [ g ] + "RequestAnimationFrame" ] ; window . cancelAnimationFrame = window [ p [ g ] + "CancelAnimationFrame" ] || window [ p [ g ] + "CancelRequestAnimationFrame" ] } if ( ! window . requestAnimationFrame ) window . requestAnimationFrame = function ( c ) { var m = ( new Date ) . getTime ( ) , s = Math . max ( 0 , 16 - ( m - a ) ) , b = window . setTimeout ( function ( ) { c ( m + s ) } , s ) ; a = m + s ; return b } ; if ( ! window . cancelAnimationFrame ) window . cancelAnimationFrame =
function ( c ) { clearTimeout ( c ) } } ) ( ) ; ( function ( a ) { function p ( o ) { var J = o . originalEvent ; if ( ! J . touches || J . targetTouches . length === 1 && J . touches . length === 1 ) { b . call ( this , o ) ; o = a ( this ) ; o . bind ( q , g ) ; o . bind ( k , c ) } else { clearTimeout ( B ) ; s . call ( this ) } } function g ( o ) { if ( B != null ) { var J = o . originalEvent ; o = J . changedTouches ? J . changedTouches [ 0 ] . pageX : J . pageX ; J = J . changedTouches ? J . changedTouches [ 0 ] . pageY : J . pageY ; var U = a ( this ) . data ( "taphold.point" ) ; o = o - U . x ; J = J - U . y ; if ( Math . sqrt ( o * o + J * J ) > d ) { clearTimeout ( B ) ; s . call ( this ) } } } function c ( ) { clearTimeout ( B ) ; s . call ( this ) }
function m ( o ) { s . call ( this ) ; a ( this ) . data ( "taphold.handler" ) . call ( this , o ) } function s ( ) { B = null ; a ( this ) . unbind ( q , g ) ; a ( this ) . unbind ( k , c ) } function b ( o ) { if ( B == null ) { var J = this ; B = setTimeout ( function ( ) { m . call ( J , o ) } , f ) ; var U = o . originalEvent , M = { } ; M . x = U . changedTouches ? U . changedTouches [ 0 ] . pageX : U . pageX ; M . y = U . changedTouches ? U . changedTouches [ 0 ] . pageY : U . pageY ; a ( this ) . data ( "taphold.point" , M ) } } var f = 1E3 , d = 5 , k = "touchend" , q = "touchmove" , B = null ; a . event . special . taphold = { setup : function ( ) { } , add : function ( o ) { a ( this ) . data ( "taphold.handler" ,
2012-07-25 06:32:18 +00:00
o . handler ) ; o . data ? a ( this ) . bind ( "touchstart" , o . data , p ) : a ( this ) . bind ( "touchstart" , p ) } , remove : function ( o ) { clearTimeout ( B ) ; s . call ( this ) ; o . data ? a ( this ) . unbind ( "touchstart" , o . data , p ) : a ( this ) . unbind ( "touchstart" , p ) } , teardown : function ( ) { } } } ) ( jQuery ) ;