gantt_rails 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/gantt/ganttDrawerSVG.js +992 -0
- data/app/assets/gantt/ganttGridEditor.js +666 -0
- data/app/assets/gantt/ganttMaster.js +1131 -0
- data/app/assets/gantt/ganttTask.js +1034 -0
- data/app/assets/gantt/ganttUtilities.js +304 -0
- data/app/assets/gantt/libs/JST/jquery.JST.js +167 -0
- data/app/assets/gantt/libs/date.js +584 -0
- data/app/assets/gantt/libs/dateField/jquery.dateField.js +213 -0
- data/app/assets/gantt/libs/i18nJs.js +139 -0
- data/app/assets/gantt/libs/jquery.1.8.js +9472 -0
- data/app/assets/gantt/libs/jquery.livequery.min.js +11 -0
- data/app/assets/gantt/libs/jquery.svg.js +1394 -0
- data/app/assets/gantt/libs/jquery.svg.min.js +7 -0
- data/app/assets/gantt/libs/jquery.svgdom.1.8.js +406 -0
- data/app/assets/gantt/libs/jquery.svgdom.js +406 -0
- data/app/assets/gantt/libs/jquery.svgdom.pack.js +7 -0
- data/app/assets/gantt/libs/jquery.timers.js +142 -0
- data/app/assets/gantt/libs/platform.js +954 -0
- data/gantt_rails.gemspec +2 -1
- data/lib/gantt_rails/version.rb +1 -1
- metadata +34 -2
@@ -0,0 +1,7 @@
|
|
1
|
+
/* http://keith-wood.name/svg.html
|
2
|
+
SVG for jQuery v1.4.5.
|
3
|
+
Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
|
4
|
+
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
|
5
|
+
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
|
6
|
+
Please attribute the author if you use it. */
|
7
|
+
(function($){function SVGManager(){this._settings=[];this._extensions=[];this.regional=[];this.regional['']={errorLoadingText:'Error loading',notSupportedText:'This browser does not support SVG'};this.local=this.regional[''];this._uuid=new Date().getTime();this._renesis=detectActiveX('RenesisX.RenesisCtrl')}function detectActiveX(a){try{return!!(window.ActiveXObject&&new ActiveXObject(a))}catch(e){return false}}var q='svgwrapper';$.extend(SVGManager.prototype,{markerClassName:'hasSVG',svgNS:'http://www.w3.org/2000/svg',xlinkNS:'http://www.w3.org/1999/xlink',_wrapperClass:SVGWrapper,_attrNames:{class_:'class',in_:'in',alignmentBaseline:'alignment-baseline',baselineShift:'baseline-shift',clipPath:'clip-path',clipRule:'clip-rule',colorInterpolation:'color-interpolation',colorInterpolationFilters:'color-interpolation-filters',colorRendering:'color-rendering',dominantBaseline:'dominant-baseline',enableBackground:'enable-background',fillOpacity:'fill-opacity',fillRule:'fill-rule',floodColor:'flood-color',floodOpacity:'flood-opacity',fontFamily:'font-family',fontSize:'font-size',fontSizeAdjust:'font-size-adjust',fontStretch:'font-stretch',fontStyle:'font-style',fontVariant:'font-variant',fontWeight:'font-weight',glyphOrientationHorizontal:'glyph-orientation-horizontal',glyphOrientationVertical:'glyph-orientation-vertical',horizAdvX:'horiz-adv-x',horizOriginX:'horiz-origin-x',imageRendering:'image-rendering',letterSpacing:'letter-spacing',lightingColor:'lighting-color',markerEnd:'marker-end',markerMid:'marker-mid',markerStart:'marker-start',stopColor:'stop-color',stopOpacity:'stop-opacity',strikethroughPosition:'strikethrough-position',strikethroughThickness:'strikethrough-thickness',strokeDashArray:'stroke-dasharray',strokeDashOffset:'stroke-dashoffset',strokeLineCap:'stroke-linecap',strokeLineJoin:'stroke-linejoin',strokeMiterLimit:'stroke-miterlimit',strokeOpacity:'stroke-opacity',strokeWidth:'stroke-width',textAnchor:'text-anchor',textDecoration:'text-decoration',textRendering:'text-rendering',underlinePosition:'underline-position',underlineThickness:'underline-thickness',vertAdvY:'vert-adv-y',vertOriginY:'vert-origin-y',wordSpacing:'word-spacing',writingMode:'writing-mode'},_attachSVG:function(a,b){var c=(a.namespaceURI==this.svgNS?a:null);var a=(c?null:a);if($(a||c).hasClass(this.markerClassName)){return}if(typeof b=='string'){b={loadURL:b}}else if(typeof b=='function'){b={onLoad:b}}$(a||c).addClass(this.markerClassName);try{if(!c){c=document.createElementNS(this.svgNS,'svg');c.setAttribute('version','1.1');if(a.clientWidth>0){c.setAttribute('width',a.clientWidth)}if(a.clientHeight>0){c.setAttribute('height',a.clientHeight)}a.appendChild(c)}this._afterLoad(a,c,b||{})}catch(e){if($.browser.msie){if(!a.id){a.id='svg'+(this._uuid++)}this._settings[a.id]=b;a.innerHTML='<embed type="image/svg+xml" width="100%" '+'height="100%" src="'+(b.initPath||'')+'blank.svg" '+'pluginspage="http://www.adobe.com/svg/viewer/install/main.html"/>'}else{a.innerHTML='<p class="svg_error">'+this.local.notSupportedText+'</p>'}}},_registerSVG:function(){for(var i=0;i<document.embeds.length;i++){var a=document.embeds[i].parentNode;if(!$(a).hasClass($.svg.markerClassName)||$.data(a,q)){continue}var b=null;try{b=document.embeds[i].getSVGDocument()}catch(e){setTimeout($.svg._registerSVG,250);return}b=(b?b.documentElement:null);if(b){$.svg._afterLoad(a,b)}}},_afterLoad:function(a,b,c){var c=c||this._settings[a.id];this._settings[a?a.id:'']=null;var d=new this._wrapperClass(b,a);$.data(a||b,q,d);try{if(c.loadURL){d.load(c.loadURL,c)}if(c.settings){d.configure(c.settings)}if(c.onLoad&&!c.loadURL){c.onLoad.apply(a||b,[d])}}catch(e){alert(e)}},_getSVG:function(a){a=(typeof a=='string'?$(a)[0]:(a.jquery?a[0]:a));return $.data(a,q)},_destroySVG:function(a){var b=$(a);if(!b.hasClass(this.markerClassName)){return}b.removeClass(this.markerClassName);if(a.namespaceURI!=this.svgNS){b.empty()}$.removeData(a,q)},addExtension:function(a,b){this._extensions.push([a,b])},isSVGElem:function(a){return(a.nodeType==1&&a.namespaceURI==$.svg.svgNS)}});function SVGWrapper(a,b){this._svg=a;this._container=b;for(var i=0;i<$.svg._extensions.length;i++){var c=$.svg._extensions[i];this[c[0]]=new c[1](this)}}$.extend(SVGWrapper.prototype,{_width:function(){return(this._container?this._container.clientWidth:this._svg.width)},_height:function(){return(this._container?this._container.clientHeight:this._svg.height)},root:function(){return this._svg},configure:function(a,b,c){if(!a.nodeName){c=b;b=a;a=this._svg}if(c){for(var i=a.attributes.length-1;i>=0;i--){var d=a.attributes.item(i);if(!(d.nodeName=='onload'||d.nodeName=='version'||d.nodeName.substring(0,5)=='xmlns')){a.attributes.removeNamedItem(d.nodeName)}}}for(var e in b){a.setAttribute($.svg._attrNames[e]||e,b[e])}return this},getElementById:function(a){return this._svg.ownerDocument.getElementById(a)},change:function(a,b){if(a){for(var c in b){if(b[c]==null){a.removeAttribute($.svg._attrNames[c]||c)}else{a.setAttribute($.svg._attrNames[c]||c,b[c])}}}return this},_args:function(b,c,d){c.splice(0,0,'parent');c.splice(c.length,0,'settings');var e={};var f=0;if(b[0]!=null&&b[0].jquery){b[0]=b[0][0]}if(b[0]!=null&&!(typeof b[0]=='object'&&b[0].nodeName)){e['parent']=null;f=1}for(var i=0;i<b.length;i++){e[c[i+f]]=b[i]}if(d){$.each(d,function(i,a){if(typeof e[a]=='object'){e.settings=e[a];e[a]=null}})}return e},title:function(a,b,c){var d=this._args(arguments,['text']);var e=this._makeNode(d.parent,'title',d.settings||{});e.appendChild(this._svg.ownerDocument.createTextNode(d.text));return e},describe:function(a,b,c){var d=this._args(arguments,['text']);var e=this._makeNode(d.parent,'desc',d.settings||{});e.appendChild(this._svg.ownerDocument.createTextNode(d.text));return e},defs:function(a,b,c){var d=this._args(arguments,['id'],['id']);return this._makeNode(d.parent,'defs',$.extend((d.id?{id:d.id}:{}),d.settings||{}))},symbol:function(a,b,c,d,e,f,g){var h=this._args(arguments,['id','x1','y1','width','height']);return this._makeNode(h.parent,'symbol',$.extend({id:h.id,viewBox:h.x1+' '+h.y1+' '+h.width+' '+h.height},h.settings||{}))},marker:function(a,b,c,d,e,f,g,h){var i=this._args(arguments,['id','refX','refY','mWidth','mHeight','orient'],['orient']);return this._makeNode(i.parent,'marker',$.extend({id:i.id,refX:i.refX,refY:i.refY,markerWidth:i.mWidth,markerHeight:i.mHeight,orient:i.orient||'auto'},i.settings||{}))},style:function(a,b,c){var d=this._args(arguments,['styles']);var e=this._makeNode(d.parent,'style',$.extend({type:'text/css'},d.settings||{}));e.appendChild(this._svg.ownerDocument.createTextNode(d.styles));if($.browser.opera){$('head').append('<style type="text/css">'+d.styles+'</style>')}return e},script:function(a,b,c,d){var e=this._args(arguments,['script','type'],['type']);var f=this._makeNode(e.parent,'script',$.extend({type:e.type||'text/javascript'},e.settings||{}));f.appendChild(this._svg.ownerDocument.createTextNode(e.script));if(!$.browser.mozilla){$.globalEval(e.script)}return f},linearGradient:function(a,b,c,d,e,f,g,h){var i=this._args(arguments,['id','stops','x1','y1','x2','y2'],['x1']);var j=$.extend({id:i.id},(i.x1!=null?{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}:{}));return this._gradient(i.parent,'linearGradient',$.extend(j,i.settings||{}),i.stops)},radialGradient:function(a,b,c,d,e,r,f,g,h){var i=this._args(arguments,['id','stops','cx','cy','r','fx','fy'],['cx']);var j=$.extend({id:i.id},(i.cx!=null?{cx:i.cx,cy:i.cy,r:i.r,fx:i.fx,fy:i.fy}:{}));return this._gradient(i.parent,'radialGradient',$.extend(j,i.settings||{}),i.stops)},_gradient:function(a,b,c,d){var e=this._makeNode(a,b,c);for(var i=0;i<d.length;i++){var f=d[i];this._makeNode(e,'stop',$.extend({offset:f[0],stopColor:f[1]},(f[2]!=null?{stopOpacity:f[2]}:{})))}return e},pattern:function(a,b,x,y,c,d,e,f,g,h,i){var j=this._args(arguments,['id','x','y','width','height','vx','vy','vwidth','vheight'],['vx']);var k=$.extend({id:j.id,x:j.x,y:j.y,width:j.width,height:j.height},(j.vx!=null?{viewBox:j.vx+' '+j.vy+' '+j.vwidth+' '+j.vheight}:{}));return this._makeNode(j.parent,'pattern',$.extend(k,j.settings||{}))},clipPath:function(a,b,c,d){var e=this._args(arguments,['id','units']);e.units=e.units||'userSpaceOnUse';return this._makeNode(e.parent,'clipPath',$.extend({id:e.id,clipPathUnits:e.units},e.settings||{}))},mask:function(a,b,x,y,c,d,e){var f=this._args(arguments,['id','x','y','width','height']);return this._makeNode(f.parent,'mask',$.extend({id:f.id,x:f.x,y:f.y,width:f.width,height:f.height},f.settings||{}))},createPath:function(){return new SVGPath()},createText:function(){return new SVGText()},svg:function(a,x,y,b,c,d,e,f,g,h){var i=this._args(arguments,['x','y','width','height','vx','vy','vwidth','vheight'],['vx']);var j=$.extend({x:i.x,y:i.y,width:i.width,height:i.height},(i.vx!=null?{viewBox:i.vx+' '+i.vy+' '+i.vwidth+' '+i.vheight}:{}));return this._makeNode(i.parent,'svg',$.extend(j,i.settings||{}))},group:function(a,b,c){var d=this._args(arguments,['id'],['id']);return this._makeNode(d.parent,'g',$.extend({id:d.id},d.settings||{}))},use:function(a,x,y,b,c,d,e){var f=this._args(arguments,['x','y','width','height','ref']);if(typeof f.x=='string'){f.ref=f.x;f.settings=f.y;f.x=f.y=f.width=f.height=null}var g=this._makeNode(f.parent,'use',$.extend({x:f.x,y:f.y,width:f.width,height:f.height},f.settings||{}));g.setAttributeNS($.svg.xlinkNS,'href',f.ref);return g},link:function(a,b,c){var d=this._args(arguments,['ref']);var e=this._makeNode(d.parent,'a',d.settings);e.setAttributeNS($.svg.xlinkNS,'href',d.ref);return e},image:function(a,x,y,b,c,d,e){var f=this._args(arguments,['x','y','width','height','ref']);var g=this._makeNode(f.parent,'image',$.extend({x:f.x,y:f.y,width:f.width,height:f.height},f.settings||{}));g.setAttributeNS($.svg.xlinkNS,'href',f.ref);return g},path:function(a,b,c){var d=this._args(arguments,['path']);return this._makeNode(d.parent,'path',$.extend({d:(d.path.path?d.path.path():d.path)},d.settings||{}))},rect:function(a,x,y,b,c,d,e,f){var g=this._args(arguments,['x','y','width','height','rx','ry'],['rx']);return this._makeNode(g.parent,'rect',$.extend({x:g.x,y:g.y,width:g.width,height:g.height},(g.rx?{rx:g.rx,ry:g.ry}:{}),g.settings||{}))},circle:function(a,b,c,r,d){var e=this._args(arguments,['cx','cy','r']);return this._makeNode(e.parent,'circle',$.extend({cx:e.cx,cy:e.cy,r:e.r},e.settings||{}))},ellipse:function(a,b,c,d,e,f){var g=this._args(arguments,['cx','cy','rx','ry']);return this._makeNode(g.parent,'ellipse',$.extend({cx:g.cx,cy:g.cy,rx:g.rx,ry:g.ry},g.settings||{}))},line:function(a,b,c,d,e,f){var g=this._args(arguments,['x1','y1','x2','y2']);return this._makeNode(g.parent,'line',$.extend({x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2},g.settings||{}))},polyline:function(a,b,c){var d=this._args(arguments,['points']);return this._poly(d.parent,'polyline',d.points,d.settings)},polygon:function(a,b,c){var d=this._args(arguments,['points']);return this._poly(d.parent,'polygon',d.points,d.settings)},_poly:function(a,b,c,d){var e='';for(var i=0;i<c.length;i++){e+=c[i].join()+' '}return this._makeNode(a,b,$.extend({points:$.trim(e)},d||{}))},text:function(a,x,y,b,c){var d=this._args(arguments,['x','y','value']);if(typeof d.x=='string'&&arguments.length<4){d.value=d.x;d.settings=d.y;d.x=d.y=null}return this._text(d.parent,'text',d.value,$.extend({x:(d.x&&isArray(d.x)?d.x.join(' '):d.x),y:(d.y&&isArray(d.y)?d.y.join(' '):d.y)},d.settings||{}))},textpath:function(a,b,c,d){var e=this._args(arguments,['path','value']);var f=this._text(e.parent,'textPath',e.value,e.settings||{});f.setAttributeNS($.svg.xlinkNS,'href',e.path);return f},_text:function(a,b,c,d){var e=this._makeNode(a,b,d);if(typeof c=='string'){e.appendChild(e.ownerDocument.createTextNode(c))}else{for(var i=0;i<c._parts.length;i++){var f=c._parts[i];if(f[0]=='tspan'){var g=this._makeNode(e,f[0],f[2]);g.appendChild(e.ownerDocument.createTextNode(f[1]));e.appendChild(g)}else if(f[0]=='tref'){var g=this._makeNode(e,f[0],f[2]);g.setAttributeNS($.svg.xlinkNS,'href',f[1]);e.appendChild(g)}else if(f[0]=='textpath'){var h=$.extend({},f[2]);h.href=null;var g=this._makeNode(e,f[0],h);g.setAttributeNS($.svg.xlinkNS,'href',f[2].href);g.appendChild(e.ownerDocument.createTextNode(f[1]));e.appendChild(g)}else{e.appendChild(e.ownerDocument.createTextNode(f[1]))}}}return e},other:function(a,b,c){var d=this._args(arguments,['name']);return this._makeNode(d.parent,d.name,d.settings||{})},_makeNode:function(a,b,c){a=a||this._svg;var d=this._svg.ownerDocument.createElementNS($.svg.svgNS,b);for(var b in c){var e=c[b];if(e!=null&&e!=null&&(typeof e!='string'||e!='')){d.setAttribute($.svg._attrNames[b]||b,e)}}a.appendChild(d);return d},add:function(b,c){var d=this._args((arguments.length==1?[null,b]:arguments),['node']);var f=this;d.parent=d.parent||this._svg;d.node=(d.node.jquery?d.node:$(d.node));try{if($.svg._renesis){throw'Force traversal';}d.parent.appendChild(d.node.cloneNode(true))}catch(e){d.node.each(function(){var a=f._cloneAsSVG(this);if(a){d.parent.appendChild(a)}})}return this},clone:function(b,c){var d=this;var e=this._args((arguments.length==1?[null,b]:arguments),['node']);e.parent=e.parent||this._svg;e.node=(e.node.jquery?e.node:$(e.node));var f=[];e.node.each(function(){var a=d._cloneAsSVG(this);if(a){a.id='';e.parent.appendChild(a);f.push(a)}});return f},_cloneAsSVG:function(a){var b=null;if(a.nodeType==1){b=this._svg.ownerDocument.createElementNS($.svg.svgNS,this._checkName(a.nodeName));for(var i=0;i<a.attributes.length;i++){var c=a.attributes.item(i);if(c.nodeName!='xmlns'&&c.nodeValue){if(c.prefix=='xlink'){b.setAttributeNS($.svg.xlinkNS,c.localName||c.baseName,c.nodeValue)}else{b.setAttribute(this._checkName(c.nodeName),c.nodeValue)}}}for(var i=0;i<a.childNodes.length;i++){var d=this._cloneAsSVG(a.childNodes[i]);if(d){b.appendChild(d)}}}else if(a.nodeType==3){if($.trim(a.nodeValue)){b=this._svg.ownerDocument.createTextNode(a.nodeValue)}}else if(a.nodeType==4){if($.trim(a.nodeValue)){try{b=this._svg.ownerDocument.createCDATASection(a.nodeValue)}catch(e){b=this._svg.ownerDocument.createTextNode(a.nodeValue.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'))}}}return b},_checkName:function(a){a=(a.substring(0,1)>='A'&&a.substring(0,1)<='Z'?a.toLowerCase():a);return(a.substring(0,4)=='svg:'?a.substring(4):a)},load:function(j,k){k=(typeof k=='boolean'?{addTo:k}:(typeof k=='function'?{onLoad:k}:(typeof k=='string'?{parent:k}:(typeof k=='object'&&k.nodeName?{parent:k}:(typeof k=='object'&&k.jquery?{parent:k}:k||{})))));if(!k.parent&&!k.addTo){this.clear(false)}var l=[this._svg.getAttribute('width'),this._svg.getAttribute('height')];var m=this;var n=function(a){a=$.svg.local.errorLoadingText+': '+a;if(k.onLoad){k.onLoad.apply(m._container||m._svg,[m,a])}else{m.text(null,10,20,a)}};var o=function(a){var b=new ActiveXObject('Microsoft.XMLDOM');b.validateOnParse=false;b.resolveExternals=false;b.async=false;b.loadXML(a);if(b.parseError.errorCode!=0){n(b.parseError.reason);return null}return b};var p=function(a){if(!a){return}if(a.documentElement.nodeName!='svg'){var b=a.getElementsByTagName('parsererror');var c=(b.length?b[0].getElementsByTagName('div'):[]);n(!b.length?'???':(c.length?c[0]:b[0]).firstChild.nodeValue);return}var d=(k.parent?$(k.parent)[0]:m._svg);var f={};for(var i=0;i<a.documentElement.attributes.length;i++){var g=a.documentElement.attributes.item(i);if(!(g.nodeName=='version'||g.nodeName.substring(0,5)=='xmlns')){f[g.nodeName]=g.nodeValue}}m.configure(d,f,!k.parent);var h=a.documentElement.childNodes;for(var i=0;i<h.length;i++){try{if($.svg._renesis){throw'Force traversal';}d.appendChild(m._svg.ownerDocument.importNode(h[i],true));if(h[i].nodeName=='script'){$.globalEval(h[i].textContent)}}catch(e){m.add(d,h[i])}}if(!k.changeSize){m.configure(d,{width:l[0],height:l[1]})}if(k.onLoad){k.onLoad.apply(m._container||m._svg,[m])}};if(j.match('<svg')){p($.browser.msie?o(j):new DOMParser().parseFromString(j,'text/xml'))}else{$.ajax({url:j,dataType:($.browser.msie?'text':'xml'),success:function(a){p($.browser.msie?o(a):a)},error:function(a,b,c){n(b+(c?' '+c.message:''))}})}return this},remove:function(a){a=(a.jquery?a[0]:a);a.parentNode.removeChild(a);return this},clear:function(a){if(a){this.configure({},true)}while(this._svg.firstChild){this._svg.removeChild(this._svg.firstChild)}return this},toSVG:function(a){a=a||this._svg;return(typeof XMLSerializer=='undefined'?this._toSVG(a):new XMLSerializer().serializeToString(a))},_toSVG:function(a){var b='';if(!a){return b}if(a.nodeType==3){b=a.nodeValue}else if(a.nodeType==4){b='<![CDATA['+a.nodeValue+']]>'}else{b='<'+a.nodeName;if(a.attributes){for(var i=0;i<a.attributes.length;i++){var c=a.attributes.item(i);if(!($.trim(c.nodeValue)==''||c.nodeValue.match(/^\[object/)||c.nodeValue.match(/^function/))){b+=' '+(c.namespaceURI==$.svg.xlinkNS?'xlink:':'')+c.nodeName+'="'+c.nodeValue+'"'}}}if(a.firstChild){b+='>';var d=a.firstChild;while(d){b+=this._toSVG(d);d=d.nextSibling}b+='</'+a.nodeName+'>'}else{b+='/>'}}return b}});function SVGPath(){this._path=''}$.extend(SVGPath.prototype,{reset:function(){this._path='';return this},move:function(x,y,a){a=(isArray(x)?y:a);return this._coords((a?'m':'M'),x,y)},line:function(x,y,a){a=(isArray(x)?y:a);return this._coords((a?'l':'L'),x,y)},horiz:function(x,a){this._path+=(a?'h':'H')+(isArray(x)?x.join(' '):x);return this},vert:function(y,a){this._path+=(a?'v':'V')+(isArray(y)?y.join(' '):y);return this},curveC:function(a,b,c,d,x,y,e){e=(isArray(a)?b:e);return this._coords((e?'c':'C'),a,b,c,d,x,y)},smoothC:function(a,b,x,y,c){c=(isArray(a)?b:c);return this._coords((c?'s':'S'),a,b,x,y)},curveQ:function(a,b,x,y,c){c=(isArray(a)?b:c);return this._coords((c?'q':'Q'),a,b,x,y)},smoothQ:function(x,y,a){a=(isArray(x)?y:a);return this._coords((a?'t':'T'),x,y)},_coords:function(a,b,c,d,e,f,g){if(isArray(b)){for(var i=0;i<b.length;i++){var h=b[i];this._path+=(i==0?a:' ')+h[0]+','+h[1]+(h.length<4?'':' '+h[2]+','+h[3]+(h.length<6?'':' '+h[4]+','+h[5]))}}else{this._path+=a+b+','+c+(d==null?'':' '+d+','+e+(f==null?'':' '+f+','+g))}return this},arc:function(a,b,c,d,e,x,y,f){f=(isArray(a)?b:f);this._path+=(f?'a':'A');if(isArray(a)){for(var i=0;i<a.length;i++){var g=a[i];this._path+=(i==0?'':' ')+g[0]+','+g[1]+' '+g[2]+' '+(g[3]?'1':'0')+','+(g[4]?'1':'0')+' '+g[5]+','+g[6]}}else{this._path+=a+','+b+' '+c+' '+(d?'1':'0')+','+(e?'1':'0')+' '+x+','+y}return this},close:function(){this._path+='z';return this},path:function(){return this._path}});SVGPath.prototype.moveTo=SVGPath.prototype.move;SVGPath.prototype.lineTo=SVGPath.prototype.line;SVGPath.prototype.horizTo=SVGPath.prototype.horiz;SVGPath.prototype.vertTo=SVGPath.prototype.vert;SVGPath.prototype.curveCTo=SVGPath.prototype.curveC;SVGPath.prototype.smoothCTo=SVGPath.prototype.smoothC;SVGPath.prototype.curveQTo=SVGPath.prototype.curveQ;SVGPath.prototype.smoothQTo=SVGPath.prototype.smoothQ;SVGPath.prototype.arcTo=SVGPath.prototype.arc;function SVGText(){this._parts=[]}$.extend(SVGText.prototype,{reset:function(){this._parts=[];return this},string:function(a){this._parts[this._parts.length]=['text',a];return this},span:function(a,b){this._parts[this._parts.length]=['tspan',a,b];return this},ref:function(a,b){this._parts[this._parts.length]=['tref',a,b];return this},path:function(a,b,c){this._parts[this._parts.length]=['textpath',b,$.extend({href:a},c||{})];return this}});$.fn.svg=function(a){var b=Array.prototype.slice.call(arguments,1);if(typeof a=='string'&&a=='get'){return $.svg['_'+a+'SVG'].apply($.svg,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){$.svg['_'+a+'SVG'].apply($.svg,[this].concat(b))}else{$.svg._attachSVG(this,a||{})}})};function isArray(a){return(a&&a.constructor==Array)}$.svg=new SVGManager()})(jQuery);
|
@@ -0,0 +1,406 @@
|
|
1
|
+
/* http://keith-wood.name/svg.html
|
2
|
+
jQuery DOM compatibility for jQuery SVG v1.4.5.
|
3
|
+
Written by Keith Wood (kbwood{at}iinet.com.au) April 2009.
|
4
|
+
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
|
5
|
+
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
|
6
|
+
Please attribute the author if you use it. */
|
7
|
+
|
8
|
+
(function ($) { // Hide scope, no $ conflict
|
9
|
+
|
10
|
+
var rclass = /[\t\r\n]/g,
|
11
|
+
rspace = /\s+/,
|
12
|
+
rwhitespace = "[\\x20\\t\\r\\n\\f]";
|
13
|
+
|
14
|
+
/* Support adding class names to SVG nodes. */
|
15
|
+
$.fn.addClass = function (origAddClass) {
|
16
|
+
return function (value) {
|
17
|
+
var classNames, i, l, elem,
|
18
|
+
setClass, c, cl;
|
19
|
+
|
20
|
+
if (jQuery.isFunction(value)) {
|
21
|
+
return this.each(function (j) {
|
22
|
+
jQuery(this).addClass(value.call(this, j, this.className));
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
if (value && typeof value === "string") {
|
27
|
+
classNames = value.split(rspace);
|
28
|
+
|
29
|
+
for (i = 0, l = this.length; i < l; i++) {
|
30
|
+
elem = this[ i ];
|
31
|
+
|
32
|
+
if (elem.nodeType === 1) {
|
33
|
+
if (!(elem.className && elem.getAttribute('class')) && classNames.length === 1) {
|
34
|
+
if ($.svg.isSVGElem(elem)) {
|
35
|
+
(elem.className ? elem.className.baseVal = value
|
36
|
+
: elem.setAttribute('class', value));
|
37
|
+
} else {
|
38
|
+
elem.className = value;
|
39
|
+
}
|
40
|
+
} else {
|
41
|
+
setClass = !$.svg.isSVGElem(elem) ? elem.className :
|
42
|
+
elem.className ? elem.className.baseVal :
|
43
|
+
elem.getAttribute('class');
|
44
|
+
|
45
|
+
setClass = (" " + setClass + " ");
|
46
|
+
for (c = 0, cl = classNames.length; c < cl; c++) {
|
47
|
+
if (setClass.indexOf(" " + classNames[ c ] + " ") < 0) {
|
48
|
+
setClass += classNames[ c ] + " ";
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
setClass = jQuery.trim(setClass);
|
53
|
+
if ($.svg.isSVGElem(elem)) {
|
54
|
+
|
55
|
+
(elem.className ? elem.className.baseVal = setClass
|
56
|
+
: elem.setAttribute('class', setClass));
|
57
|
+
} else {
|
58
|
+
elem.className = setClass;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return this;
|
66
|
+
};
|
67
|
+
}($.fn.addClass);
|
68
|
+
|
69
|
+
/* Support removing class names from SVG nodes. */
|
70
|
+
$.fn.removeClass = function (origRemoveClass) {
|
71
|
+
return function (value) {
|
72
|
+
var classNames, i, l, elem, className, c, cl;
|
73
|
+
|
74
|
+
if (jQuery.isFunction(value)) {
|
75
|
+
return this.each(function (j) {
|
76
|
+
jQuery(this).removeClass(value.call(this, j, this.className));
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
if ((value && typeof value === "string") || value === undefined) {
|
81
|
+
classNames = ( value || "" ).split(rspace);
|
82
|
+
|
83
|
+
for (i = 0, l = this.length; i < l; i++) {
|
84
|
+
elem = this[ i ];
|
85
|
+
|
86
|
+
if (elem.nodeType === 1 && (elem.className || elem.getAttribute('class'))) {
|
87
|
+
if (value) {
|
88
|
+
className = !$.svg.isSVGElem(elem) ? elem.className :
|
89
|
+
elem.className ? elem.className.baseVal :
|
90
|
+
elem.getAttribute('class');
|
91
|
+
|
92
|
+
className = (" " + className + " ").replace(rclass, " ");
|
93
|
+
|
94
|
+
for (c = 0, cl = classNames.length; c < cl; c++) {
|
95
|
+
// Remove until there is nothing to remove,
|
96
|
+
while (className.indexOf(" " + classNames[ c ] + " ") >= 0) {
|
97
|
+
className = className.replace(" " + classNames[ c ] + " ", " ");
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
className = jQuery.trim(className);
|
102
|
+
} else {
|
103
|
+
className = "";
|
104
|
+
}
|
105
|
+
|
106
|
+
if ($.svg.isSVGElem(elem)) {
|
107
|
+
(elem.className ? elem.className.baseVal = className
|
108
|
+
: elem.setAttribute('class', className));
|
109
|
+
} else {
|
110
|
+
elem.className = className;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
return this;
|
117
|
+
};
|
118
|
+
}($.fn.removeClass);
|
119
|
+
|
120
|
+
/* Support toggling class names on SVG nodes. */
|
121
|
+
$.fn.toggleClass = function (origToggleClass) {
|
122
|
+
return function (className, state) {
|
123
|
+
return this.each(function () {
|
124
|
+
if ($.svg.isSVGElem(this)) {
|
125
|
+
if (typeof state !== 'boolean') {
|
126
|
+
state = !$(this).hasClass(className);
|
127
|
+
}
|
128
|
+
$(this)[(state ? 'add' : 'remove') + 'Class'](className);
|
129
|
+
}
|
130
|
+
else {
|
131
|
+
origToggleClass.apply($(this), [className, state]);
|
132
|
+
}
|
133
|
+
});
|
134
|
+
};
|
135
|
+
}($.fn.toggleClass);
|
136
|
+
|
137
|
+
/* Support checking class names on SVG nodes. */
|
138
|
+
$.fn.hasClass = function (origHasClass) {
|
139
|
+
return function (selector) {
|
140
|
+
|
141
|
+
var className = " " + selector + " ",
|
142
|
+
i = 0,
|
143
|
+
l = this.length,
|
144
|
+
elem, classes;
|
145
|
+
|
146
|
+
for (; i < l; i++) {
|
147
|
+
elem = this[i];
|
148
|
+
if (elem.nodeType === 1) {
|
149
|
+
classes = !$.svg.isSVGElem(elem) ? elem.className :
|
150
|
+
elem.className ? elem.className.baseVal :
|
151
|
+
elem.getAttribute('class');
|
152
|
+
if ((" " + classes + " ").replace(rclass, " ").indexOf(className) > -1) {
|
153
|
+
return true;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
return false;
|
159
|
+
};
|
160
|
+
}($.fn.hasClass);
|
161
|
+
|
162
|
+
/* Support attributes on SVG nodes. */
|
163
|
+
$.fn.attr = function (origAttr) {
|
164
|
+
return function (name, value, type) {
|
165
|
+
var origArgs = arguments;
|
166
|
+
if (typeof name === 'string' && value === undefined) {
|
167
|
+
var val = origAttr.apply(this, origArgs);
|
168
|
+
if (val && val.baseVal && val.baseVal.numberOfItems != null) { // Multiple values
|
169
|
+
value = '';
|
170
|
+
val = val.baseVal;
|
171
|
+
if (name == 'transform') {
|
172
|
+
for (var i = 0; i < val.numberOfItems; i++) {
|
173
|
+
var item = val.getItem(i);
|
174
|
+
switch (item.type) {
|
175
|
+
case 1:
|
176
|
+
value += ' matrix(' + item.matrix.a + ',' + item.matrix.b + ',' +
|
177
|
+
item.matrix.c + ',' + item.matrix.d + ',' +
|
178
|
+
item.matrix.e + ',' + item.matrix.f + ')';
|
179
|
+
break;
|
180
|
+
case 2:
|
181
|
+
value += ' translate(' + item.matrix.e + ',' + item.matrix.f + ')';
|
182
|
+
break;
|
183
|
+
case 3:
|
184
|
+
value += ' scale(' + item.matrix.a + ',' + item.matrix.d + ')';
|
185
|
+
break;
|
186
|
+
case 4:
|
187
|
+
value += ' rotate(' + item.angle + ')';
|
188
|
+
break; // Doesn't handle new origin
|
189
|
+
case 5:
|
190
|
+
value += ' skewX(' + item.angle + ')';
|
191
|
+
break;
|
192
|
+
case 6:
|
193
|
+
value += ' skewY(' + item.angle + ')';
|
194
|
+
break;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
val = value.substring(1);
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
val = val.getItem(0).valueAsString;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
return (val && val.baseVal ? val.baseVal.valueAsString : val);
|
204
|
+
}
|
205
|
+
|
206
|
+
var options = name;
|
207
|
+
if (typeof name === 'string') {
|
208
|
+
options = {};
|
209
|
+
options[name] = value;
|
210
|
+
}
|
211
|
+
return $(this).each(function () {
|
212
|
+
if ($.svg.isSVGElem(this)) {
|
213
|
+
for (var n in options) {
|
214
|
+
var val = ($.isFunction(options[n]) ? options[n]() : options[n]);
|
215
|
+
(type ? this.style[n] = val : this.setAttribute(n, val));
|
216
|
+
}
|
217
|
+
}
|
218
|
+
else {
|
219
|
+
origAttr.apply($(this), origArgs);
|
220
|
+
}
|
221
|
+
});
|
222
|
+
};
|
223
|
+
}($.fn.attr);
|
224
|
+
|
225
|
+
/* Support removing attributes on SVG nodes. */
|
226
|
+
$.fn.removeAttr = function (origRemoveAttr) {
|
227
|
+
return function (name) {
|
228
|
+
return this.each(function () {
|
229
|
+
if ($.svg.isSVGElem(this)) {
|
230
|
+
(this[name] && this[name].baseVal ? this[name].baseVal.value = '' :
|
231
|
+
this.setAttribute(name, ''));
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
origRemoveAttr.apply($(this), [name]);
|
235
|
+
}
|
236
|
+
});
|
237
|
+
};
|
238
|
+
}($.fn.removeAttr);
|
239
|
+
|
240
|
+
/* Add numeric only properties. */
|
241
|
+
$.extend($.cssNumber, {
|
242
|
+
'stopOpacity': true,
|
243
|
+
'strokeMitrelimit':true,
|
244
|
+
'strokeOpacity': true
|
245
|
+
});
|
246
|
+
|
247
|
+
/* Support retrieving CSS/attribute values on SVG nodes. */
|
248
|
+
if ($.cssProps) {
|
249
|
+
$.css = function (origCSS) {
|
250
|
+
return function (elem, name, numeric, extra) {
|
251
|
+
var value = (name.match(/^svg.*/) ? $(elem).attr($.cssProps[name] || name) : '');
|
252
|
+
return value || origCSS(elem, name, numeric, extra);
|
253
|
+
};
|
254
|
+
}($.css);
|
255
|
+
}
|
256
|
+
|
257
|
+
$.find.isXML = function (origIsXml) {
|
258
|
+
return function (elem) {
|
259
|
+
return $.svg.isSVGElem(elem) || origIsXml(elem);
|
260
|
+
}
|
261
|
+
}($.find.isXML)
|
262
|
+
|
263
|
+
var div = document.createElement('div');
|
264
|
+
div.appendChild(document.createComment(''));
|
265
|
+
if (div.getElementsByTagName('*').length > 0) { // Make sure no comments are found
|
266
|
+
$.expr.find.TAG = function (match, context) {
|
267
|
+
var results = context.getElementsByTagName(match[1]);
|
268
|
+
if (match[1] === '*') { // Filter out possible comments
|
269
|
+
var tmp = [];
|
270
|
+
for (var i = 0; results[i] || results.item(i); i++) {
|
271
|
+
if ((results[i] || results.item(i)).nodeType === 1) {
|
272
|
+
tmp.push(results[i] || results.item(i));
|
273
|
+
}
|
274
|
+
}
|
275
|
+
results = tmp;
|
276
|
+
}
|
277
|
+
return results;
|
278
|
+
};
|
279
|
+
}
|
280
|
+
|
281
|
+
$.expr.filter.CLASS = function (className) {
|
282
|
+
var pattern = new RegExp("(^|" + rwhitespace + ")" + className + "(" + rwhitespace + "|$)");
|
283
|
+
return function (elem) {
|
284
|
+
var elemClass = (!$.svg.isSVGElem(elem) ? elem.className || (typeof elem.getAttribute !== "undefined" && elem.getAttribute("class")) || "" :
|
285
|
+
(elem.className ? elem.className.baseVal : elem.getAttribute('class')));
|
286
|
+
|
287
|
+
return pattern.test(elemClass);
|
288
|
+
};
|
289
|
+
};
|
290
|
+
|
291
|
+
/*
|
292
|
+
In the removeData function (line 1881, v1.7.2):
|
293
|
+
|
294
|
+
if ( jQuery.support.deleteExpando ) {
|
295
|
+
delete elem[ internalKey ];
|
296
|
+
} else {
|
297
|
+
try { // SVG
|
298
|
+
elem.removeAttribute( internalKey );
|
299
|
+
} catch (e) {
|
300
|
+
elem[ internalKey ] = null;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
In the event.add function (line 2985, v1.7.2):
|
305
|
+
|
306
|
+
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
307
|
+
// Bind the global event handler to the element
|
308
|
+
try { // SVG
|
309
|
+
elem.addEventListener( type, eventHandle, false );
|
310
|
+
} catch(e) {
|
311
|
+
if ( elem.attachEvent ) {
|
312
|
+
elem.attachEvent( "on" + type, eventHandle );
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
In the event.remove function (line 3074, v1.7.2):
|
318
|
+
|
319
|
+
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
|
320
|
+
try { // SVG
|
321
|
+
elem.removeEventListener(type, elemData.handle, false);
|
322
|
+
}
|
323
|
+
catch (e) {
|
324
|
+
if (elem.detachEvent) {
|
325
|
+
elem.detachEvent("on" + type, elemData.handle);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
In the event.fix function (line 3394, v1.7.2):
|
331
|
+
|
332
|
+
if (event.target.namespaceURI == 'http://www.w3.org/2000/svg') { // SVG
|
333
|
+
event.button = [1, 4, 2][event.button];
|
334
|
+
}
|
335
|
+
|
336
|
+
// Add which for click: 1 === left; 2 === middle; 3 === right
|
337
|
+
// Note: button is not normalized, so don't use it
|
338
|
+
if ( !event.which && button !== undefined ) {
|
339
|
+
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
340
|
+
}
|
341
|
+
|
342
|
+
In the Sizzle function (line 4083, v1.7.2):
|
343
|
+
|
344
|
+
if ( toString.call(checkSet) === "[object Array]" ) {
|
345
|
+
if ( !prune ) {
|
346
|
+
results.push.apply( results, checkSet );
|
347
|
+
|
348
|
+
} else if ( context && context.nodeType === 1 ) {
|
349
|
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
350
|
+
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
|
351
|
+
results.push( set[i] || set.item(i) ); // SVG
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
} else {
|
356
|
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
357
|
+
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
|
358
|
+
results.push( set[i] || set.item(i) ); // SVG
|
359
|
+
}
|
360
|
+
}
|
361
|
+
}
|
362
|
+
} else {...
|
363
|
+
|
364
|
+
In the fallback for the Sizzle makeArray function (line 4877, v1.7.2):
|
365
|
+
|
366
|
+
if ( toString.call(array) === "[object Array]" ) {
|
367
|
+
Array.prototype.push.apply( ret, array );
|
368
|
+
|
369
|
+
} else {
|
370
|
+
if ( typeof array.length === "number" ) {
|
371
|
+
for ( var l = array.length; i < l; i++ ) {
|
372
|
+
ret.push( array[i] || array.item(i) ); // SVG
|
373
|
+
}
|
374
|
+
|
375
|
+
} else {
|
376
|
+
for ( ; array[i]; i++ ) {
|
377
|
+
ret.push( array[i] );
|
378
|
+
}
|
379
|
+
}
|
380
|
+
}
|
381
|
+
|
382
|
+
In the jQuery.cleandata function (line 6538, v1.7.2):
|
383
|
+
|
384
|
+
if ( deleteExpando ) {
|
385
|
+
delete elem[ jQuery.expando ];
|
386
|
+
|
387
|
+
} else {
|
388
|
+
try { // SVG
|
389
|
+
elem.removeAttribute( jQuery.expando );
|
390
|
+
} catch (e) {
|
391
|
+
// Ignore
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
In the fallback getComputedStyle function (line 6727, v1.7.2):
|
396
|
+
|
397
|
+
defaultView = (elem.ownerDocument ? elem.ownerDocument.defaultView : elem.defaultView); // SVG
|
398
|
+
if ( defaultView &&
|
399
|
+
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
|
400
|
+
|
401
|
+
ret = computedStyle.getPropertyValue( name );
|
402
|
+
...
|
403
|
+
|
404
|
+
*/
|
405
|
+
|
406
|
+
})(jQuery);
|
@@ -0,0 +1,406 @@
|
|
1
|
+
/* http://keith-wood.name/svg.html
|
2
|
+
jQuery DOM compatibility for jQuery SVG v1.4.5.
|
3
|
+
Written by Keith Wood (kbwood{at}iinet.com.au) April 2009.
|
4
|
+
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
|
5
|
+
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
|
6
|
+
Please attribute the author if you use it. */
|
7
|
+
|
8
|
+
(function($) { // Hide scope, no $ conflict
|
9
|
+
|
10
|
+
/* Support adding class names to SVG nodes. */
|
11
|
+
$.fn.addClass = function(origAddClass) {
|
12
|
+
return function(classNames) {
|
13
|
+
classNames = classNames || '';
|
14
|
+
return this.each(function() {
|
15
|
+
if ($.svg.isSVGElem(this)) {
|
16
|
+
var node = this;
|
17
|
+
$.each(classNames.split(/\s+/), function(i, className) {
|
18
|
+
var classes = (node.className ? node.className.baseVal : node.getAttribute('class'));
|
19
|
+
if ($.inArray(className, classes.split(/\s+/)) == -1) {
|
20
|
+
classes += (classes ? ' ' : '') + className;
|
21
|
+
(node.className ? node.className.baseVal = classes :
|
22
|
+
node.setAttribute('class', classes));
|
23
|
+
}
|
24
|
+
});
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
origAddClass.apply($(this), [classNames]);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
};
|
31
|
+
}($.fn.addClass);
|
32
|
+
|
33
|
+
/* Support removing class names from SVG nodes. */
|
34
|
+
$.fn.removeClass = function(origRemoveClass) {
|
35
|
+
return function(classNames) {
|
36
|
+
classNames = classNames || '';
|
37
|
+
return this.each(function() {
|
38
|
+
if ($.svg.isSVGElem(this)) {
|
39
|
+
var node = this;
|
40
|
+
$.each(classNames.split(/\s+/), function(i, className) {
|
41
|
+
var classes = (node.className ? node.className.baseVal : node.getAttribute('class'));
|
42
|
+
classes = $.grep(classes.split(/\s+/), function(n, i) { return n != className; }).
|
43
|
+
join(' ');
|
44
|
+
(node.className ? node.className.baseVal = classes :
|
45
|
+
node.setAttribute('class', classes));
|
46
|
+
});
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
origRemoveClass.apply($(this), [classNames]);
|
50
|
+
}
|
51
|
+
});
|
52
|
+
};
|
53
|
+
}($.fn.removeClass);
|
54
|
+
|
55
|
+
/* Support toggling class names on SVG nodes. */
|
56
|
+
$.fn.toggleClass = function(origToggleClass) {
|
57
|
+
return function(className, state) {
|
58
|
+
return this.each(function() {
|
59
|
+
if ($.svg.isSVGElem(this)) {
|
60
|
+
if (typeof state !== 'boolean') {
|
61
|
+
state = !$(this).hasClass(className);
|
62
|
+
}
|
63
|
+
$(this)[(state ? 'add' : 'remove') + 'Class'](className);
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
origToggleClass.apply($(this), [className, state]);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
};
|
70
|
+
}($.fn.toggleClass);
|
71
|
+
|
72
|
+
/* Support checking class names on SVG nodes. */
|
73
|
+
$.fn.hasClass = function(origHasClass) {
|
74
|
+
return function(className) {
|
75
|
+
className = className || '';
|
76
|
+
var found = false;
|
77
|
+
this.each(function() {
|
78
|
+
if ($.svg.isSVGElem(this)) {
|
79
|
+
var classes = (this.className ? this.className.baseVal :
|
80
|
+
this.getAttribute('class')).split(/\s+/);
|
81
|
+
found = ($.inArray(className, classes) > -1);
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
found = (origHasClass.apply($(this), [className]));
|
85
|
+
}
|
86
|
+
return !found;
|
87
|
+
});
|
88
|
+
return found;
|
89
|
+
};
|
90
|
+
}($.fn.hasClass);
|
91
|
+
|
92
|
+
/* Support attributes on SVG nodes. */
|
93
|
+
$.fn.attr = function(origAttr) {
|
94
|
+
return function(name, value, type) {
|
95
|
+
if (typeof name === 'string' && value === undefined) {
|
96
|
+
var val = origAttr.apply(this, [name]);
|
97
|
+
if (val && val.baseVal && val.baseVal.numberOfItems != null) { // Multiple values
|
98
|
+
value = '';
|
99
|
+
val = val.baseVal;
|
100
|
+
if (name == 'transform') {
|
101
|
+
for (var i = 0; i < val.numberOfItems; i++) {
|
102
|
+
var item = val.getItem(i);
|
103
|
+
switch (item.type) {
|
104
|
+
case 1: value += ' matrix(' + item.matrix.a + ',' + item.matrix.b + ',' +
|
105
|
+
item.matrix.c + ',' + item.matrix.d + ',' +
|
106
|
+
item.matrix.e + ',' + item.matrix.f + ')';
|
107
|
+
break;
|
108
|
+
case 2: value += ' translate(' + item.matrix.e + ',' + item.matrix.f + ')'; break;
|
109
|
+
case 3: value += ' scale(' + item.matrix.a + ',' + item.matrix.d + ')'; break;
|
110
|
+
case 4: value += ' rotate(' + item.angle + ')'; break; // Doesn't handle new origin
|
111
|
+
case 5: value += ' skewX(' + item.angle + ')'; break;
|
112
|
+
case 6: value += ' skewY(' + item.angle + ')'; break;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
val = value.substring(1);
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
val = val.getItem(0).valueAsString;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
return (val && val.baseVal ? val.baseVal.valueAsString : val);
|
122
|
+
}
|
123
|
+
|
124
|
+
var options = name;
|
125
|
+
if (typeof name === 'string') {
|
126
|
+
options = {};
|
127
|
+
options[name] = value;
|
128
|
+
}
|
129
|
+
return this.each(function() {
|
130
|
+
if ($.svg.isSVGElem(this)) {
|
131
|
+
for (var n in options) {
|
132
|
+
var val = ($.isFunction(options[n]) ? options[n]() : options[n]);
|
133
|
+
(type ? this.style[n] = val : this.setAttribute(n, val));
|
134
|
+
}
|
135
|
+
}
|
136
|
+
else {
|
137
|
+
origAttr.apply($(this), [name, value, type]);
|
138
|
+
}
|
139
|
+
});
|
140
|
+
};
|
141
|
+
}($.fn.attr);
|
142
|
+
|
143
|
+
/* Support removing attributes on SVG nodes. */
|
144
|
+
$.fn.removeAttr = function(origRemoveAttr) {
|
145
|
+
return function(name) {
|
146
|
+
return this.each(function() {
|
147
|
+
if ($.svg.isSVGElem(this)) {
|
148
|
+
(this[name] && this[name].baseVal ? this[name].baseVal.value = '' :
|
149
|
+
this.setAttribute(name, ''));
|
150
|
+
}
|
151
|
+
else {
|
152
|
+
origRemoveAttr.apply($(this), [name]);
|
153
|
+
}
|
154
|
+
});
|
155
|
+
};
|
156
|
+
}($.fn.removeAttr);
|
157
|
+
|
158
|
+
/* Add numeric only properties. */
|
159
|
+
$.extend($.cssNumber, {
|
160
|
+
'stopOpacity': true,
|
161
|
+
'strokeMitrelimit': true,
|
162
|
+
'strokeOpacity': true
|
163
|
+
});
|
164
|
+
|
165
|
+
/* Support retrieving CSS/attribute values on SVG nodes. */
|
166
|
+
if ($.cssProps) {
|
167
|
+
$.css = function(origCSS) {
|
168
|
+
return function(elem, name, extra) {
|
169
|
+
var value = (name.match(/^svg.*/) ? $(elem).attr($.cssProps[name] || name) : '');
|
170
|
+
return value || origCSS(elem, name, extra);
|
171
|
+
};
|
172
|
+
}($.css);
|
173
|
+
}
|
174
|
+
|
175
|
+
/* Determine if any nodes are SVG nodes. */
|
176
|
+
function anySVG(checkSet) {
|
177
|
+
for (var i = 0; i < checkSet.length; i++) {
|
178
|
+
if (checkSet[i].nodeType == 1 && checkSet[i].namespaceURI == $.svg.svgNS) {
|
179
|
+
return true;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
return false;
|
183
|
+
}
|
184
|
+
|
185
|
+
/* Update Sizzle selectors. */
|
186
|
+
|
187
|
+
$.expr.relative['+'] = function(origRelativeNext) {
|
188
|
+
return function(checkSet, part, isXML) {
|
189
|
+
origRelativeNext(checkSet, part, isXML || anySVG(checkSet));
|
190
|
+
};
|
191
|
+
}($.expr.relative['+']);
|
192
|
+
|
193
|
+
$.expr.relative['>'] = function(origRelativeChild) {
|
194
|
+
return function(checkSet, part, isXML) {
|
195
|
+
origRelativeChild(checkSet, part, isXML || anySVG(checkSet));
|
196
|
+
};
|
197
|
+
}($.expr.relative['>']);
|
198
|
+
|
199
|
+
$.expr.relative[''] = function(origRelativeDescendant) {
|
200
|
+
return function(checkSet, part, isXML) {
|
201
|
+
origRelativeDescendant(checkSet, part, isXML || anySVG(checkSet));
|
202
|
+
};
|
203
|
+
}($.expr.relative['']);
|
204
|
+
|
205
|
+
$.expr.relative['~'] = function(origRelativeSiblings) {
|
206
|
+
return function(checkSet, part, isXML) {
|
207
|
+
origRelativeSiblings(checkSet, part, isXML || anySVG(checkSet));
|
208
|
+
};
|
209
|
+
}($.expr.relative['~']);
|
210
|
+
|
211
|
+
$.expr.find.ID = function(origFindId) {
|
212
|
+
return function(match, context, isXML) {
|
213
|
+
return ($.svg.isSVGElem(context) ?
|
214
|
+
[context.ownerDocument.getElementById(match[1])] :
|
215
|
+
origFindId(match, context, isXML));
|
216
|
+
};
|
217
|
+
}($.expr.find.ID);
|
218
|
+
|
219
|
+
var div = document.createElement('div');
|
220
|
+
div.appendChild(document.createComment(''));
|
221
|
+
if (div.getElementsByTagName('*').length > 0) { // Make sure no comments are found
|
222
|
+
$.expr.find.TAG = function(match, context) {
|
223
|
+
var results = context.getElementsByTagName(match[1]);
|
224
|
+
if (match[1] === '*') { // Filter out possible comments
|
225
|
+
var tmp = [];
|
226
|
+
for (var i = 0; results[i] || results.item(i); i++) {
|
227
|
+
if ((results[i] || results.item(i)).nodeType === 1) {
|
228
|
+
tmp.push(results[i] || results.item(i));
|
229
|
+
}
|
230
|
+
}
|
231
|
+
results = tmp;
|
232
|
+
}
|
233
|
+
return results;
|
234
|
+
};
|
235
|
+
}
|
236
|
+
|
237
|
+
$.expr.preFilter.CLASS = function(match, curLoop, inplace, result, not, isXML) {
|
238
|
+
match = ' ' + match[1].replace(/\\/g, '') + ' ';
|
239
|
+
if (isXML) {
|
240
|
+
return match;
|
241
|
+
}
|
242
|
+
for (var i = 0, elem = {}; elem != null; i++) {
|
243
|
+
elem = curLoop[i];
|
244
|
+
if (!elem) {
|
245
|
+
try {
|
246
|
+
elem = curLoop.item(i);
|
247
|
+
}
|
248
|
+
catch (e) {
|
249
|
+
// Ignore
|
250
|
+
}
|
251
|
+
}
|
252
|
+
if (elem) {
|
253
|
+
var className = (!$.svg.isSVGElem(elem) ? elem.className :
|
254
|
+
(elem.className ? elem.className.baseVal : '') || elem.getAttribute('class'));
|
255
|
+
if (not ^ (className && (' ' + className + ' ').indexOf(match) > -1)) {
|
256
|
+
if (!inplace)
|
257
|
+
result.push(elem);
|
258
|
+
}
|
259
|
+
else if (inplace) {
|
260
|
+
curLoop[i] = false;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
return false;
|
265
|
+
};
|
266
|
+
|
267
|
+
$.expr.filter.CLASS = function(elem, match) {
|
268
|
+
var className = (!$.svg.isSVGElem(elem) ? elem.className :
|
269
|
+
(elem.className ? elem.className.baseVal : elem.getAttribute('class')));
|
270
|
+
return (' ' + className + ' ').indexOf(match) > -1;
|
271
|
+
};
|
272
|
+
|
273
|
+
$.expr.filter.ATTR = function(origFilterAttr) {
|
274
|
+
return function(elem, match) {
|
275
|
+
var handler = null;
|
276
|
+
if ($.svg.isSVGElem(elem)) {
|
277
|
+
handler = match[1];
|
278
|
+
$.expr.attrHandle[handler] = function(elem){
|
279
|
+
var attr = elem.getAttribute(handler);
|
280
|
+
return attr && attr.baseVal || attr;
|
281
|
+
};
|
282
|
+
}
|
283
|
+
var filter = origFilterAttr(elem, match);
|
284
|
+
if (handler) {
|
285
|
+
$.expr.attrHandle[handler] = null;
|
286
|
+
}
|
287
|
+
return filter;
|
288
|
+
};
|
289
|
+
}($.expr.filter.ATTR);
|
290
|
+
|
291
|
+
/*
|
292
|
+
In the removeData function (line 1881, v1.7.2):
|
293
|
+
|
294
|
+
if ( jQuery.support.deleteExpando ) {
|
295
|
+
delete elem[ internalKey ];
|
296
|
+
} else {
|
297
|
+
try { // SVG
|
298
|
+
elem.removeAttribute( internalKey );
|
299
|
+
} catch (e) {
|
300
|
+
elem[ internalKey ] = null;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
In the event.add function (line 2985, v1.7.2):
|
305
|
+
|
306
|
+
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
307
|
+
// Bind the global event handler to the element
|
308
|
+
try { // SVG
|
309
|
+
elem.addEventListener( type, eventHandle, false );
|
310
|
+
} catch(e) {
|
311
|
+
if ( elem.attachEvent ) {
|
312
|
+
elem.attachEvent( "on" + type, eventHandle );
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
In the event.remove function (line 3074, v1.7.2):
|
318
|
+
|
319
|
+
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
|
320
|
+
try { // SVG
|
321
|
+
elem.removeEventListener(type, elemData.handle, false);
|
322
|
+
}
|
323
|
+
catch (e) {
|
324
|
+
if (elem.detachEvent) {
|
325
|
+
elem.detachEvent("on" + type, elemData.handle);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
In the event.fix function (line 3394, v1.7.2):
|
331
|
+
|
332
|
+
if (event.target.namespaceURI == 'http://www.w3.org/2000/svg') { // SVG
|
333
|
+
event.button = [1, 4, 2][event.button];
|
334
|
+
}
|
335
|
+
|
336
|
+
// Add which for click: 1 === left; 2 === middle; 3 === right
|
337
|
+
// Note: button is not normalized, so don't use it
|
338
|
+
if ( !event.which && button !== undefined ) {
|
339
|
+
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
340
|
+
}
|
341
|
+
|
342
|
+
In the Sizzle function (line 4083, v1.7.2):
|
343
|
+
|
344
|
+
if ( toString.call(checkSet) === "[object Array]" ) {
|
345
|
+
if ( !prune ) {
|
346
|
+
results.push.apply( results, checkSet );
|
347
|
+
|
348
|
+
} else if ( context && context.nodeType === 1 ) {
|
349
|
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
350
|
+
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
|
351
|
+
results.push( set[i] || set.item(i) ); // SVG
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
} else {
|
356
|
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
357
|
+
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
|
358
|
+
results.push( set[i] || set.item(i) ); // SVG
|
359
|
+
}
|
360
|
+
}
|
361
|
+
}
|
362
|
+
} else {...
|
363
|
+
|
364
|
+
In the fallback for the Sizzle makeArray function (line 4877, v1.7.2):
|
365
|
+
|
366
|
+
if ( toString.call(array) === "[object Array]" ) {
|
367
|
+
Array.prototype.push.apply( ret, array );
|
368
|
+
|
369
|
+
} else {
|
370
|
+
if ( typeof array.length === "number" ) {
|
371
|
+
for ( var l = array.length; i < l; i++ ) {
|
372
|
+
ret.push( array[i] || array.item(i) ); // SVG
|
373
|
+
}
|
374
|
+
|
375
|
+
} else {
|
376
|
+
for ( ; array[i]; i++ ) {
|
377
|
+
ret.push( array[i] );
|
378
|
+
}
|
379
|
+
}
|
380
|
+
}
|
381
|
+
|
382
|
+
In the jQuery.cleandata function (line 6538, v1.7.2):
|
383
|
+
|
384
|
+
if ( deleteExpando ) {
|
385
|
+
delete elem[ jQuery.expando ];
|
386
|
+
|
387
|
+
} else {
|
388
|
+
try { // SVG
|
389
|
+
elem.removeAttribute( jQuery.expando );
|
390
|
+
} catch (e) {
|
391
|
+
// Ignore
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
In the fallback getComputedStyle function (line 6727, v1.7.2):
|
396
|
+
|
397
|
+
defaultView = (elem.ownerDocument ? elem.ownerDocument.defaultView : elem.defaultView); // SVG
|
398
|
+
if ( defaultView &&
|
399
|
+
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
|
400
|
+
|
401
|
+
ret = computedStyle.getPropertyValue( name );
|
402
|
+
...
|
403
|
+
|
404
|
+
*/
|
405
|
+
|
406
|
+
})(jQuery);
|