Created
April 20, 2016 01:19
-
-
Save nodegin/7da258700355f18aed2090bdff00bb3f to your computer and use it in GitHub Desktop.
Raphael export minified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(h){function p(a){if("number"===typeof a)return a.toString();var f={"<":"lt",">":"gt",'"':"quot","'":"apos"},c;for(c in f)a=a.replace(new RegExp(c,"g"),"&"+f[c]+";");return a}function t(a,f){var c=[],b;if("undefined"!=typeof a.unshift){var k=a.length;for(b=0;b<k;b++)if("undefined"!=typeof a[b]){var e=f.call(this,a[b],b);null!==e&&c.push(e)}}else for(b in a)a.hasOwnProperty(b)&&(e=f.call(this,a[b],b),null!==e&&c.push(e));return c}function u(a,f,c){for(var b in a)a.hasOwnProperty(b)&&(c=f.call(this, | |
c,a[b],b));return c}function r(a,f,c,b){if("undefined"===typeof b||null===b)b="";"object"===typeof f&&(f=t(f,function(a,b){switch(b){case "transform":return;case "fill":if(a.match(/^hsb/)){var c=a.replace(/^hsb\(|\)$/g,"").split(",");3===c.length&&(a=h.hsb2rgb(c[0],c[1],c[2]).toString())}}return b+'="'+p(a)+'"'}).join(" "));return"<"+a+(c?' transform="matrix('+c.toString().replace(/^matrix\(|\)$/g,"")+')" ':" ")+f+">"+b+"</"+a+">"}function w(a){return{font:{family:"undefined"===typeof a.attrs.font? | |
null:a.attrs.font.replace(/^.?"(\w+)".$/,"$1"),size:"undefined"===typeof a.attrs["font-size"]?null:parseInt(a.attrs["font-size"]),style:"undefined"===typeof a.attrs["font-style"]?null:a.attrs["font-style"],weight:"undefined"===typeof a.attrs["font-weight"]?null:a.attrs["font-weight"]},anchor:"undefined"===typeof a.attrs["text-anchor"]?null:a.attrs["text-anchor"]}}function x(a){var f=a.font;return"text-anchor: "+(a.anchor||"middle")+"; "+["font:",f.style||"normal","normal",f.weight||"normal",(f.size? | |
f.size+"px":"10px")+"/normal",f.family].join(" ")}function q(a){/^[0-9A-F]{6}$/i.test(a)&&(a="#"+a);return a}function y(a,f,c){null===a&&(a=10);return 4.5*a/13*(f-.2-c/2)*3.5}var v={text:function(a){var f=w(a),c=[],b=a.attrs.text.toString().split("\n"),h=b.length;t(b,function(b,g){var n=u(a.attrs,function(a,b,c){"text"!==c&&"w"!==c&&"h"!==c&&("font-size"===c&&(b=parseInt(b)+"px"),"stroke"===c&&(b=q(b)),a[c]=p(b.toString()));return a},{style:x(f)+";"});""!=a.node.className.baseVal&&(n["class"]=a.node.className.baseVal); | |
c.push(r("text",n,a.matrix,r("tspan",{dy:y(f.font.size,g+1,h)},null,b.replace(/&/g,"&"))))});return c},path:function(a){return r("path",u(a.attrs,function(a,c,b){"path"===b&&(b="d");"stroke"===b&&(c=q(c));a[b]=c.toString();return a},{}),a.matrix)}};h.fn.toSVG=function(){var a=h.svg,f=h.vml,c='<svg style="overflow: hidden; position: relative;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+this.width+'" version="1.1" height="'+this.height+'">';h.svg=!0;h.vml= | |
!1;for(var b=this.bottom;null!=b;b=b.next)if("none"!==b.node.style.display){var k="";if("function"===typeof v[b.type])c+=v[b.type](b);else{switch(b.type){case "image":k+=' preserveAspectRatio="none"'}for(i in b.attrs){var e=i,g="";switch(i){case "r":if("rect"!=b.type)break;g=b.attrs.r;b.attrs.rx=g;b.attrs.ry=g;continue;case "src":e="xlink:href";break;case "transform":e="";break;case "fill":if(b.attrs.gradient)continue;break;case "gradient":var g=b.id,e=b.attrs.gradient,n=.5,l=.5,e=String(e).replace(h._radial_gradient, | |
function(a,b,c){type="radial";b&&c&&(n=parseFloat(b),l=parseFloat(c),a=2*(.5<l)-1,.25<Math.pow(n-.5,2)+Math.pow(l-.5,2)&&(l=Math.sqrt(.25-Math.pow(n-.5,2))*a+.5)&&.5!=l&&(l=l.toFixed(5)-1E-5*a));return""}),e=e.split(/\s*\-\s*/);if(b.attrs.gradient.match(/^r/g)){e=h._parseDots(e);if(!e)continue;for(var c=c+"<defs>",c=c+('\t <radialGradient id="radialgradient'+g+'" fx="'+n+'" fy="'+l+'" >'),d=0;d<e.length;d++){var m=d/(e.length-1)*100+"%";e[d].offset&&(m=e[d].offset);c+='<stop stop-color="'+e[d].color+ | |
'" offset="'+m+'"/>'}c+=" </radialGradient>";c+="</defs>";e="fill";g="url(#radialgradient"+g+")"}else{d=e.shift();d=-1*parseFloat(d);if(isNaN(d))continue;e=h._parseDots(e);if(!e)continue;d=[0,0,Math.cos(h.rad(d)),Math.sin(h.rad(d))];m=1/(Math.max(Math.abs(d[2]),Math.abs(d[3]))||1);d[2]*=m;d[3]*=m;0>d[2]&&(d[0]=-d[2],d[2]=0);0>d[3]&&(d[1]=-d[3],d[3]=0);c+="<defs>";c+='\t <linearGradient id="lineargradient'+g+'" x1="'+d[0]+'" y1="'+d[1]+'" x2="'+d[2]+'" y2="'+d[3]+'">';for(d=0;d<e.length;d++)m= | |
d/(e.length-1)*100+"%",e[d].offset&&(m=e[d].offset),c+='<stop stop-color="'+e[d].color+'" offset="'+m+'"/>';c+=" </linearGradient>";c+="</defs>";e="fill";g="url(#lineargradient"+g+")"}break;case "stroke":g=g?q(g):q(b.attrs[i].toString())}e&&(k=g?k+(" "+e+'="'+p(g)+'"'):k+(" "+e+'="'+p(b.attrs[i].toString())+'"'))}""!=b.node.className.baseVal&&(k+=' class="'+b.node.className.baseVal+'"');c+="<"+b.type+' transform="matrix('+b.matrix.toString().replace(/^matrix\(|\)$/g,"")+')"'+k+"></"+b.type+">"}}h.svg= | |
a;h.vml=f;return c+"</svg>"}})(window.Raphael); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment