From dab2ff28f88c37561d7e6c829141459ac48e52fa Mon Sep 17 00:00:00 2001 From: crccheck Date: Tue, 11 Feb 2014 22:10:05 -0600 Subject: [PATCH] bump version to v0.2.1 --- package.json | 5 +++-- raphael-svg-import.min.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a0d9a76..f762907 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "raphael-svg-import-classic", "description": "Import SVG files to Raphel", - "version": "0.2.0", + "version": "0.2.1", "main": "raphael-svg-import.js", "repository": { "type": "git", @@ -9,7 +9,8 @@ }, "author": "Chris Chang", "contributors": [ - "Ingvar Stepanyan" + "Ingvar Stepanyan", + "Miguel González" ], "license": "MIT", "readmeFilename": "README.markdown", diff --git a/raphael-svg-import.min.js b/raphael-svg-import.min.js index e67754a..74d1009 100644 --- a/raphael-svg-import.min.js +++ b/raphael-svg-import.min.js @@ -1,2 +1,2 @@ -/* raphael-svg-import-classic - v0.2.0 - 2014-02-07 */ -Raphael.fn.importSVG=function(a){"use strict";var b=this.set(),c={},d={"text-anchor":"start"};this.parseElement=function(a){if(3!==a.nodeType){var e,f,g={stroke:"none","stroke-width":1,fill:"black"};if(a.attributes)for(e=0,f=a.attributes.length;f>e;e++)g[a.attributes[e].name]=a.attributes[e].value;var h,i=a.nodeName;switch(i){case"svg":case"g":var j=a.getAttribute("id"),k=a.getAttribute("class");if(j||k){var l=a.childNodes;for(e=0,f=l.length;f>e;e++){var m=l[e];3!==m.nodeType&&(j&&m.setAttribute("data-svg-group",j),k&&m.setAttribute("class",(m.getAttribute("class")||"")+" "+k))}}var n=this.set();for(e=0,f=a.childNodes.length;f>e;e++)n.push(this.parseElement(a.childNodes.item(e)));if(g.transform){var o=/translate\(([^,]+),([^,]+)\)/.exec(g.transform);3==o.length&&n.translate(o[1],o[2])}return"none"===g.display&&n.hide(),void(j&&a.childNodes.length&&(c[j]=n));case"rect":g.rx&&g.ry?(g.r=(+(g.rx||0)+ +(g.ry||0))/2,delete g.rx,delete g.ry):(g.r=g.rx||g.ry||0,delete g.rx,delete g.ry);case"circle":case"ellipse":h=this[i]();break;case"path":h=this.path(g.d),delete g.d;break;case"polygon":h=this.polygon(g);break;case"polyline":h=this.polyline(g);break;case"line":h=this.line(g);break;case"image":h=this.image();break;case"text":for(var p in d)!g[p]&&d.hasOwnProperty(p)&&(g[p]=d[p]);h=this.text(g.x,g.y,a.text||a.textContent);break;default:var q=a.getElementsByTagName("svg");return void(q.length&&(q[0].normalize(),this.parseElement(q[0])))}var r=g.transform;if(r){r=r.substring(7,r.length-1).split(" ").map(function(a){return parseFloat(a)});var s=h.matrix;s.add.apply(s,r),h.transform(s.toTransformString()),delete g.transform}h.attr(g);var t=a.getAttribute("class");t&&h.node.setAttribute("class",(h.node.getAttribute("class")||"")+" "+t),h.node.setAttribute("data-svg",i);var u=a.getAttribute("data-svg-group");u&&h.node.setAttribute("data-svg-group",u);var v=a.getAttribute("id");return v&&(h.node.id=v),b.push(h),h}},this.parseElement(a);var e=Function.prototype.bind&&Array.prototype.forEach?Function.prototype.call.bind(Array.prototype.forEach):function(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c,a)},f=this;e(a.getElementsByTagName("style"),function(a){var b=document.createElement("style"),c=a.textContent||a.text;b.type="text/css",document.head.appendChild(b);var d;b.styleSheet?(b.styleSheet.cssText=c,d=b.styleSheet.rules):(b.appendChild(document.createTextNode(c)),d=b.sheet.cssRules),e(d,function(a){var b=a.style,c=document.querySelectorAll(a.selectorText),d={};for(var g in Raphael._availableAttrs){var h=b[g];h&&(d[g]="number"==typeof Raphael._availableAttrs[g]?parseFloat(h):h)}e(c,function(a){f.getById(a.raphaelid).attr(d)})})});var g,h=!1;for(g in c){h=!0;break}return h&&(b.groups=c),b},Raphael.fn.line=function(a){var b=["M",a.x1,a.y1,"L",a.x2,a.y2,"Z"];return delete a.x1,delete a.y1,delete a.x2,delete a.y2,this.path(b)},Raphael.fn.polygon=function(a){for(var b=a.points,c=["M"],d=b.split(" "),e=0;ef;f++)j[a.attributes[f].name]=a.attributes[f].value;switch(k){case"svg":case"g":var l=a.getAttribute("id"),m=a.getAttribute("class");if(l||m){var n=a.childNodes;for(f=0,g=n.length;g>f;f++){var o=n[f];3!==o.nodeType&&(l&&o.setAttribute("data-svg-group",l),m&&o.setAttribute("class",(o.getAttribute("class")||"")+" "+m))}}var p=this.set();for(f=0,g=a.childNodes.length;g>f;f++)p.push(this.parseElement(a.childNodes.item(f)));if(j.transform){var q=/translate\(([^,]+),([^,]+)\)/.exec(j.transform);3==q.length&&p.translate(q[1],q[2])}return"none"===j.display&&p.hide(),l&&a.childNodes.length&&(d[l]=p),void 0;case"rect":j.rx&&j.ry?(j.r=(+(j.rx||0)+ +(j.ry||0))/2,delete j.rx,delete j.ry):(j.r=j.rx||j.ry||0,delete j.rx,delete j.ry);case"circle":case"ellipse":i=this[k]();break;case"path":i=this.path(j.d),delete j.d;break;case"polygon":i=this.polygon(j);break;case"polyline":i=this.polyline(j);break;case"line":i=this.line(j);break;case"image":i=this.image();break;case"text":for(h in e)!j[h]&&e.hasOwnProperty(h)&&(j[h]=e[h]);i=this.text(j.x,j.y,a.text||a.textContent);break;default:var r=a.getElementsByTagName("svg");return r.length&&(r[0].normalize(),this.parseElement(r[0])),void 0}var s=j.transform;if(s){s=s.substring(7,s.length-1).split(" ").map(function(a){return parseFloat(a)});var t=i.matrix;t.add.apply(t,s),i.transform(t.toTransformString()),delete j.transform}if(j.style){var u,v=j.style.split(";");for(f=0;fc;c++)b(a[c],c,a)},g=this;f(a.getElementsByTagName("style"),function(a){var b=document.createElement("style"),c=a.textContent||a.text;b.type="text/css",document.head.appendChild(b);var d;b.styleSheet?(b.styleSheet.cssText=c,d=b.styleSheet.rules):(b.appendChild(document.createTextNode(c)),d=b.sheet.cssRules),f(d,function(a){var b=a.style,c=document.querySelectorAll(a.selectorText),d={};for(var e in Raphael._availableAttrs){var h=b[e];h&&(d[e]="number"==typeof Raphael._availableAttrs[e]?parseFloat(h):h)}f(c,function(a){g.getById(a.raphaelid).attr(d)})})});var h,i=!1;for(h in d){i=!0;break}return i&&(c.groups=d),c},Raphael.fn.line=function(a){var b=["M",a.x1,a.y1,"L",a.x2,a.y2,"Z"];return delete a.x1,delete a.y1,delete a.x2,delete a.y2,this.path(b)},Raphael.fn.polygon=function(a){for(var b=a.points,c=["M"],d=b.split(" "),e=0;e