jquery-svg-rails 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ /* http://keith-wood.name/svg.html
2
+ SVG attribute animations for jQuery v1.5.0.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) June 2008.
4
+ Available under the MIT (http://keith-wood.name/licence.html) license.
5
+ Please attribute the author if you use it. */
6
+ (function($){var h=parseInt($.fn.jquery,10)>1||parseInt($.fn.jquery.substring(2),10)>5;$.each(['x','y','width','height','rx','ry','cx','cy','r','x1','y1','x2','y2','stroke-width','strokeWidth','opacity','fill-opacity','fillOpacity','stroke-opacity','strokeOpacity','stroke-dashoffset','strokeDashOffset','font-size','fontSize','font-weight','fontWeight','letter-spacing','letterSpacing','word-spacing','wordSpacing'],function(i,f){var g=f.charAt(0).toUpperCase()+f.substr(1);if($.cssProps){$.cssProps['svg'+g]=$.cssProps['svg-'+f]=f}$.fx.step['svg'+g]=$.fx.step['svg-'+f]=function(a){var b=$.svg._attrNames[f]||f;var c=a.elem.attributes.getNamedItem(b);if(!a.set){a.start=(c?parseFloat(c.nodeValue):0);var d=(h?'':a.options.curAnim['svg'+g]||a.options.curAnim['svg-'+f]);if(/^[+-]=/.exec(d)){a.end=a.start+parseFloat(d.replace(/=/,''))}$(a.elem).css(b,'');a.set=true}var e=(a.pos*(a.end-a.start)+a.start)+(a.unit==='%'?'%':'');(c?c.nodeValue=e:a.elem.setAttribute(b,e))}});$.fx.step['svgStrokeDashArray']=$.fx.step['svg-strokeDashArray']=$.fx.step['svgStroke-dasharray']=$.fx.step['svg-stroke-dasharray']=function(a){var b=a.elem.attributes.getNamedItem('stroke-dasharray');if(!a.set){a.start=parseDashArray(b?b.nodeValue:'');var c=(h?a.end:a.options.curAnim['svgStrokeDashArray']||a.options.curAnim['svg-strokeDashArray']||a.options.curAnim['svgStroke-dasharray']||a.options.curAnim['svg-stroke-dasharray']);a.end=parseDashArray(c);if(/^[+-]=/.exec(c)){c=c.split(/[, ]+/);if(c.length%2===1){var d=c.length;for(var i=0;i<d;i++){c.push(c[i])}}for(var i=0;i<c.length;i++){if(/^[+-]=/.exec(c[i])){a.end[i]=a.start[i]+parseFloat(c[i].replace(/=/,''))}}}a.set=true}var e=$.map(a.start,function(n,i){return(a.pos*(a.end[i]-n)+n)}).join(',');(b?b.nodeValue=e:a.elem.setAttribute('stroke-dasharray',e))};function parseDashArray(a){var b=a.split(/[, ]+/);for(var i=0;i<b.length;i++){b[i]=parseFloat(b[i]);if(isNaN(b[i])){b[i]=0}}if(b.length%2===1){var c=b.length;for(var i=0;i<c;i++){b.push(b[i])}}return b}$.fx.step['svgViewBox']=$.fx.step['svg-viewBox']=function(a){var b=a.elem.attributes.getNamedItem('viewBox');if(!a.set){a.start=parseViewBox(b?b.nodeValue:'');var c=(h?a.end:a.options.curAnim['svgViewBox']||a.options.curAnim['svg-viewBox']);a.end=parseViewBox(c);if(/^[+-]=/.exec(c)){c=c.split(/[, ]+/);while(c.length<4){c.push('0')}for(var i=0;i<4;i++){if(/^[+-]=/.exec(c[i])){a.end[i]=a.start[i]+parseFloat(c[i].replace(/=/,''))}}}a.set=true}var d=$.map(a.start,function(n,i){return(a.pos*(a.end[i]-n)+n)}).join(' ');(b?b.nodeValue=d:a.elem.setAttribute('viewBox',d))};function parseViewBox(a){var b=a.split(/[, ]+/);for(var i=0;i<b.length;i++){b[i]=parseFloat(b[i]);if(isNaN(b[i])){b[i]=0}}while(b.length<4){b.push(0)}return b}$.fx.step['svgTransform']=$.fx.step['svg-transform']=function(a){var b=a.elem.attributes.getNamedItem('transform');if(!a.set){a.start=parseTransform(b?b.nodeValue:'');a.end=parseTransform(a.end,a.start);a.set=true}var c='';for(var i=0;i<a.end.order.length;i++){switch(a.end.order.charAt(i)){case't':c+=' translate('+(a.pos*(a.end.translateX-a.start.translateX)+a.start.translateX)+','+(a.pos*(a.end.translateY-a.start.translateY)+a.start.translateY)+')';break;case's':c+=' scale('+(a.pos*(a.end.scaleX-a.start.scaleX)+a.start.scaleX)+','+(a.pos*(a.end.scaleY-a.start.scaleY)+a.start.scaleY)+')';break;case'r':c+=' rotate('+(a.pos*(a.end.rotateA-a.start.rotateA)+a.start.rotateA)+','+(a.pos*(a.end.rotateX-a.start.rotateX)+a.start.rotateX)+','+(a.pos*(a.end.rotateY-a.start.rotateY)+a.start.rotateY)+')';break;case'x':c+=' skewX('+(a.pos*(a.end.skewX-a.start.skewX)+a.start.skewX)+')';case'y':c+=' skewY('+(a.pos*(a.end.skewY-a.start.skewY)+a.start.skewY)+')';break;case'm':var d='';for(var j=0;j<6;j++){d+=','+(a.pos*(a.end.matrix[j]-a.start.matrix[j])+a.start.matrix[j])}c+=' matrix('+d.substr(1)+')';break}}(b?b.nodeValue=c:a.elem.setAttribute('transform',c))};function parseTransform(a,b){a=a||'';if(typeof a==='object'){a=a.nodeValue}var c=$.extend({translateX:0,translateY:0,scaleX:0,scaleY:0,rotateA:0,rotateX:0,rotateY:0,skewX:0,skewY:0,matrix:[0,0,0,0,0,0]},b||{});c.order='';var d=/([a-zA-Z]+)\(\s*([+-]?[\d\.]+)\s*(?:[\s,]\s*([+-]?[\d\.]+)\s*(?:[\s,]\s*([+-]?[\d\.]+)\s*(?:[\s,]\s*([+-]?[\d\.]+)\s*[\s,]\s*([+-]?[\d\.]+)\s*[\s,]\s*([+-]?[\d\.]+)\s*)?)?)?\)/g;var e=d.exec(a);while(e){switch(e[1]){case'translate':c.order+='t';c.translateX=parseFloat(e[2]);c.translateY=(e[3]?parseFloat(e[3]):0);break;case'scale':c.order+='s';c.scaleX=parseFloat(e[2]);c.scaleY=(e[3]?parseFloat(e[3]):c.scaleX);break;case'rotate':c.order+='r';c.rotateA=parseFloat(e[2]);c.rotateX=(e[3]?parseFloat(e[3]):0);c.rotateY=(e[4]?parseFloat(e[4]):0);break;case'skewX':c.order+='x';c.skewX=parseFloat(e[2]);break;case'skewY':c.order+='y';c.skewY=parseFloat(e[2]);break;case'matrix':c.order+='m';c.matrix=[parseFloat(e[2]),parseFloat(e[3]),parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),parseFloat(e[7])];break}e=d.exec(a)}if(c.order==='m'&&Math.abs(c.matrix[0])===Math.abs(c.matrix[3])&&c.matrix[1]!==0&&Math.abs(c.matrix[1])===Math.abs(c.matrix[2])){var f=Math.acos(c.matrix[0])*180/Math.PI;f=(c.matrix[1]<0?360-f:f);c.order='rt';c.rotateA=f;c.rotateX=c.rotateY=0;c.translateX=c.matrix[4];c.translateY=c.matrix[5]}return c}$.each(['fill','stroke'],function(i,e){var f=e.charAt(0).toUpperCase()+e.substr(1);$.fx.step['svg'+f]=$.fx.step['svg-'+e]=function(a){if(!a.set){a.start=$.svg._getColour(a.elem,e);var b=(a.end==='none');a.end=(b?$.svg._getColour(a.elem.parentNode,e):$.svg._getRGB(a.end));a.end[3]=b;$(a.elem).css(e,'');a.set=true}var c='rgb('+[Math.min(Math.max(parseInt((a.pos*(a.end[0]-a.start[0]))+a.start[0],10),0),255),Math.min(Math.max(parseInt((a.pos*(a.end[1]-a.start[1]))+a.start[1],10),0),255),Math.min(Math.max(parseInt((a.pos*(a.end[2]-a.start[2]))+a.start[2],10),0),255)].join(',')+')';c=(a.end[3]&&a.state===1?'none':c);var d=a.elem.attributes.getNamedItem(e);(d?d.nodeValue=c:a.elem.setAttribute(e,c))}});$.svg._getColour=function(a,b){a=$(a);var c;do{c=a.attr(b)||a.css(b);if((c!==''&&c!=='none')||a.hasClass($.svg.markerClassName)){break}}while(a=a.parent());return $.svg._getRGB(c)};$.svg._getRGB=function(a){var b;if(a&&a.constructor===Array){return(a.length===3||a.length===4?a:k['none'])}if(b=/^rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)$/.exec(a)){return[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10)]}if(b=/^rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)$/.exec(a)){return[parseFloat(b[1])*2.55,parseFloat(b[2])*2.55,parseFloat(b[3])*2.55]}if(b=/^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(a)){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}if(b=/^#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(a)){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}return k[$.trim(a).toLowerCase()]||k['none']};var k={'':[255,255,255,1],none:[255,255,255,1],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}})(jQuery);
@@ -0,0 +1,239 @@
1
+ /* http://keith-wood.name/svg.html
2
+ jQuery DOM compatibility for jQuery SVG v1.5.0.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) April 2009.
4
+ Available under the MIT (http://keith-wood.name/licence.html) license.
5
+ Please attribute the author if you use it. */
6
+
7
+ (function($) { // Hide scope, no $ conflict
8
+
9
+ var rclass = /[\t\r\n]/g,
10
+ rspace = /\s+/,
11
+ rwhitespace = "[\\x20\\t\\r\\n\\f]";
12
+
13
+ /** Retrieve the element classes.
14
+ @private
15
+ @param elem {Element} The element to examine.
16
+ @return {string} The class names. */
17
+ function getClassNames(elem) {
18
+ return (!$.svg.isSVGElem(elem) ? elem.className :
19
+ (elem.className ? elem.className.baseVal : elem.getAttribute('class'))) || '';
20
+ }
21
+
22
+ /** Set the element classes.
23
+ @private
24
+ @param elem {Element} The element to update.
25
+ @param classes {string} The new class names. */
26
+ function setClassNames(elem, classes) {
27
+ (elem.className ? elem.className.baseVal = classes : elem.setAttribute('class', classes));
28
+ }
29
+
30
+ /** Support adding class names to SVG nodes.
31
+ @param classNames {string} The classes to add. */
32
+ $.fn.addClass = function(origAddClass) {
33
+ return function(classNames) {
34
+ if ($.isFunction(classNames)) {
35
+ return this.each(function(i) {
36
+ $(this).addClass(classNames.call(this, i, getClassNames(this)));
37
+ });
38
+ }
39
+ var origArgs = arguments;
40
+ classNames = classNames || '';
41
+ return this.each(function() {
42
+ if ($.svg.isSVGElem(this)) {
43
+ var node = this;
44
+ $.each(classNames.split(/\s+/), function(i, className) {
45
+ var classes = getClassNames(node);
46
+ if ($.inArray(className, classes.split(/\s+/)) === -1) {
47
+ setClassNames(node, classes += (classes ? ' ' : '') + className);
48
+ }
49
+ });
50
+ }
51
+ else {
52
+ origAddClass.apply($(this), origArgs);
53
+ }
54
+ });
55
+ };
56
+ }($.fn.addClass);
57
+
58
+ /** Support removing class names from SVG nodes.
59
+ @param classNames {string} The classes to remove. */
60
+ $.fn.removeClass = function(origRemoveClass) {
61
+ return function(classNames) {
62
+ if ($.isFunction(classNames)) {
63
+ return this.each(function(i) {
64
+ $(this).removeClass(classNames.call(this, i, getClassNames(this)));
65
+ });
66
+ }
67
+ var origArgs = arguments;
68
+ classNames = classNames || '';
69
+ return this.each(function() {
70
+ if ($.svg.isSVGElem(this)) {
71
+ var node = this;
72
+ $.each(classNames.split(/\s+/), function(i, className) {
73
+ var classes = getClassNames(node);
74
+ classes = $.grep(classes.split(/\s+/), function(n, i) { return n !== className; }).join(' ');
75
+ setClassNames(node, classes);
76
+ });
77
+ }
78
+ else {
79
+ origRemoveClass.apply($(this), origArgs);
80
+ }
81
+ });
82
+ };
83
+ }($.fn.removeClass);
84
+
85
+ /** Support toggling class names on SVG nodes.
86
+ @param classNames {string} The classes to toggle. */
87
+ $.fn.toggleClass = function(origToggleClass) {
88
+ return function(classNames, state) {
89
+ if ($.isFunction(classNames)) {
90
+ return this.each(function(i) {
91
+ $(this).toggleClass(classNames.call(this, i, getClassNames(this), state), state);
92
+ });
93
+ }
94
+ var origArgs = arguments;
95
+ var hasState = (typeof state === 'boolean');
96
+ return this.each(function() {
97
+ if ($.svg.isSVGElem(this)) {
98
+ if (typeof classNames === 'string') {
99
+ var node = $(this);
100
+ $.each(classNames.split(/\s+/), function(i, className) {
101
+ if (!hasState) {
102
+ state = !node.hasClass(className);
103
+ }
104
+ node[(state ? 'add' : 'remove') + 'Class'](className);
105
+ });
106
+ }
107
+ else {
108
+ var classes = getClassNames(this);
109
+ if (classes) {
110
+ $._data(this, '__className__', classes); // store className if set
111
+ }
112
+ // toggle whole className
113
+ setClassNames(this, classes || classNames === false ? '' : $._data(this, '__className__') || '');
114
+ }
115
+ }
116
+ else {
117
+ origToggleClass.apply($(this), origArgs);
118
+ }
119
+ });
120
+ };
121
+ }($.fn.toggleClass);
122
+
123
+ /** Support checking class names on SVG nodes.
124
+ @param className {string} The class to check.
125
+ @return {boolean} <code>true</code> if this class is present, <code>false</code> if not. */
126
+ $.fn.hasClass = function(origHasClass) {
127
+ return function(className) {
128
+ className = className || '';
129
+ var found = false;
130
+ this.each(function() {
131
+ if ($.svg.isSVGElem(this)) {
132
+ found = ($.inArray(className, getClassNames(this).split(/\s+/)) > -1);
133
+ }
134
+ else {
135
+ found = (origHasClass.apply($(this), [className]));
136
+ }
137
+ return !found;
138
+ });
139
+ return found;
140
+ };
141
+ }($.fn.hasClass);
142
+
143
+ /** Support attributes on SVG nodes.
144
+ @param name {string} The attribute name.
145
+ @param [value] {any} The new attribute value.
146
+ @param type {boolean} Internal flag.
147
+ @return {any} If an attribute value is requested. */
148
+ $.fn.attr = function(origAttr) {
149
+ return function(name, value, type) {
150
+ if (typeof name === 'string' && value === undefined) { // Return attribute value
151
+ var val = origAttr.apply(this, arguments);
152
+ if (val && val.baseVal && val.baseVal.numberOfItems != null) { // Multiple values
153
+ value = '';
154
+ val = val.baseVal;
155
+ if (name === 'transform') {
156
+ for (var i = 0; i < val.numberOfItems; i++) {
157
+ var item = val.getItem(i);
158
+ switch (item.type) {
159
+ case 1: value += ' matrix(' + item.matrix.a + ',' + item.matrix.b + ',' +
160
+ item.matrix.c + ',' + item.matrix.d + ',' +
161
+ item.matrix.e + ',' + item.matrix.f + ')';
162
+ break;
163
+ case 2: value += ' translate(' + item.matrix.e + ',' + item.matrix.f + ')'; break;
164
+ case 3: value += ' scale(' + item.matrix.a + ',' + item.matrix.d + ')'; break;
165
+ case 4: value += ' rotate(' + item.angle + ')'; break; // Doesn't handle new origin
166
+ case 5: value += ' skewX(' + item.angle + ')'; break;
167
+ case 6: value += ' skewY(' + item.angle + ')'; break;
168
+ }
169
+ }
170
+ val = value.substring(1);
171
+ }
172
+ else {
173
+ val = val.getItem(0).valueAsString;
174
+ }
175
+ }
176
+ return (val && val.baseVal ? val.baseVal.valueAsString : val);
177
+ }
178
+
179
+ var options = name;
180
+ if (typeof name === 'string') {
181
+ options = {};
182
+ options[name] = value;
183
+ }
184
+ if ($.isFunction(value)) {
185
+ return $(this).each(function(i) {
186
+ $(this).attr(name, value.call(this, i, $(this).attr(name)));
187
+ });
188
+ }
189
+ var origArgs = arguments;
190
+ return $(this).each(function() {
191
+ if ($.svg.isSVGElem(this)) {
192
+ for (var n in options) {
193
+ (type ? this.style[n] = options[n] : this.setAttribute(n, options[n]));
194
+ }
195
+ }
196
+ else {
197
+ origAttr.apply($(this), origArgs);
198
+ }
199
+ });
200
+ };
201
+ }($.fn.attr);
202
+
203
+ /** Support removing attributes on SVG nodes.
204
+ @param names {string} The names of the attributes to remove. */
205
+ $.fn.removeAttr = function(origRemoveAttr) {
206
+ return function(names) {
207
+ var origArgs = arguments;
208
+ return this.each(function() {
209
+ if ($.svg.isSVGElem(this)) {
210
+ var node = this;
211
+ $.each(names.split(/\s+/), function(i, name) {
212
+ (node[name] && node[name].baseVal ? node[name].baseVal.value = null : node.removeAttribute(name));
213
+ });
214
+ }
215
+ else {
216
+ origRemoveAttr.apply($(this), origArgs);
217
+ }
218
+ });
219
+ };
220
+ }($.fn.removeAttr);
221
+
222
+ /* Add numeric only properties. */
223
+ $.extend($.cssNumber, {
224
+ 'stopOpacity': true,
225
+ 'strokeMitrelimit': true,
226
+ 'strokeOpacity': true
227
+ });
228
+
229
+ /* Support retrieving CSS/attribute values on SVG nodes. */
230
+ if ($.cssProps) {
231
+ $.css = function(origCSS) {
232
+ return function(elem, name, numeric, extra) {
233
+ var value = (name.match(/^svg.*/) ? $(elem).attr($.cssProps[name] || name) : '');
234
+ return value || origCSS(elem, name, numeric, extra);
235
+ };
236
+ }($.css);
237
+ }
238
+
239
+ })(jQuery);
@@ -0,0 +1,6 @@
1
+ /* http://keith-wood.name/svg.html
2
+ jQuery DOM compatibility for jQuery SVG v1.5.0.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) April 2009.
4
+ Available under the MIT (http://keith-wood.name/licence.html) license.
5
+ Please attribute the author if you use it. */
6
+ (function($){var j=/[\t\r\n]/g,rspace=/\s+/,rwhitespace="[\\x20\\t\\r\\n\\f]";function getClassNames(a){return(!$.svg.isSVGElem(a)?a.className:(a.className?a.className.baseVal:a.getAttribute('class')))||''}function setClassNames(a,b){(a.className?a.className.baseVal=b:a.setAttribute('class',b))}$.fn.addClass=function(f){return function(d){if($.isFunction(d)){return this.each(function(i){$(this).addClass(d.call(this,i,getClassNames(this)))})}var e=arguments;d=d||'';return this.each(function(){if($.svg.isSVGElem(this)){var c=this;$.each(d.split(/\s+/),function(i,a){var b=getClassNames(c);if($.inArray(a,b.split(/\s+/))===-1){setClassNames(c,b+=(b?' ':'')+a)}})}else{f.apply($(this),e)}})}}($.fn.addClass);$.fn.removeClass=function(f){return function(d){if($.isFunction(d)){return this.each(function(i){$(this).removeClass(d.call(this,i,getClassNames(this)))})}var e=arguments;d=d||'';return this.each(function(){if($.svg.isSVGElem(this)){var c=this;$.each(d.split(/\s+/),function(i,a){var b=getClassNames(c);b=$.grep(b.split(/\s+/),function(n,i){return n!==a}).join(' ');setClassNames(c,b)})}else{f.apply($(this),e)}})}}($.fn.removeClass);$.fn.toggleClass=function(h){return function(d,e){if($.isFunction(d)){return this.each(function(i){$(this).toggleClass(d.call(this,i,getClassNames(this),e),e)})}var f=arguments;var g=(typeof e==='boolean');return this.each(function(){if($.svg.isSVGElem(this)){if(typeof d==='string'){var b=$(this);$.each(d.split(/\s+/),function(i,a){if(!g){e=!b.hasClass(a)}b[(e?'add':'remove')+'Class'](a)})}else{var c=getClassNames(this);if(c){$._data(this,'__className__',c)}setClassNames(this,c||d===false?'':$._data(this,'__className__')||'')}}else{h.apply($(this),f)}})}}($.fn.toggleClass);$.fn.hasClass=function(c){return function(a){a=a||'';var b=false;this.each(function(){if($.svg.isSVGElem(this)){b=($.inArray(a,getClassNames(this).split(/\s+/))>-1)}else{b=(c.apply($(this),[a]))}return!b});return b}}($.fn.hasClass);$.fn.attr=function(h){return function(a,b,c){if(typeof a==='string'&&b===undefined){var d=h.apply(this,arguments);if(d&&d.baseVal&&d.baseVal.numberOfItems!=null){b='';d=d.baseVal;if(a==='transform'){for(var i=0;i<d.numberOfItems;i++){var e=d.getItem(i);switch(e.type){case 1:b+=' matrix('+e.matrix.a+','+e.matrix.b+','+e.matrix.c+','+e.matrix.d+','+e.matrix.e+','+e.matrix.f+')';break;case 2:b+=' translate('+e.matrix.e+','+e.matrix.f+')';break;case 3:b+=' scale('+e.matrix.a+','+e.matrix.d+')';break;case 4:b+=' rotate('+e.angle+')';break;case 5:b+=' skewX('+e.angle+')';break;case 6:b+=' skewY('+e.angle+')';break}}d=b.substring(1)}else{d=d.getItem(0).valueAsString}}return(d&&d.baseVal?d.baseVal.valueAsString:d)}var f=a;if(typeof a==='string'){f={};f[a]=b}if($.isFunction(b)){return $(this).each(function(i){$(this).attr(a,b.call(this,i,$(this).attr(a)))})}var g=arguments;return $(this).each(function(){if($.svg.isSVGElem(this)){for(var n in f){(c?this.style[n]=f[n]:this.setAttribute(n,f[n]))}}else{h.apply($(this),g)}})}}($.fn.attr);$.fn.removeAttr=function(e){return function(c){var d=arguments;return this.each(function(){if($.svg.isSVGElem(this)){var b=this;$.each(c.split(/\s+/),function(i,a){(b[a]&&b[a].baseVal?b[a].baseVal.value=null:b.removeAttribute(a))})}else{e.apply($(this),d)}})}}($.fn.removeAttr);$.extend($.cssNumber,{'stopOpacity':true,'strokeMitrelimit':true,'strokeOpacity':true});if($.cssProps){$.css=function(f){return function(a,b,c,d){var e=(b.match(/^svg.*/)?$(a).attr($.cssProps[b]||b):'');return e||f(a,b,c,d)}}($.css)}})(jQuery);
@@ -0,0 +1,368 @@
1
+ /* http://keith-wood.name/svg.html
2
+ SVG filters for jQuery v1.5.0.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
4
+ Available under the MIT (http://keith-wood.name/licence.html) license.
5
+ Please attribute the author if you use it. */
6
+
7
+ (function($) { // Hide scope, no $ conflict
8
+
9
+ $.svg.addExtension('filters', SVGFilter);
10
+
11
+ $.extend($.svg._wrapperClass.prototype, {
12
+
13
+ /** Add a filter definition.
14
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
15
+ @param id {string} The ID for this filter.
16
+ @param x {number} The x-coordinate for the left edge of the filter.
17
+ @param y {number} The y-coordinate for the top edge of the filter.
18
+ @param width {number} The width of the filter.
19
+ @param height {number} The height of the filter.
20
+ @param [settings] {object} Additional settings for this node.
21
+ @return {SVGElement} The new filter node. */
22
+ filter: function(parent, id, x, y, width, height, settings) {
23
+ var args = this._args(arguments, ['id', 'x', 'y', 'width', 'height']);
24
+ return this._makeNode(args.parent, 'filter', $.extend(
25
+ {id: args.id, x: args.x, y: args.y, width: args.width, height: args.height}, args.settings || {}));
26
+ }
27
+ });
28
+
29
+ /** The SVG filters manager.
30
+ <p>Use the singleton instance of this class, $.svg.filters,
31
+ to interact with the SVG filters functionality.</p>
32
+ @module SVGFilter */
33
+ function SVGFilter(wrapper) {
34
+ this._wrapper = wrapper; // The attached SVG wrapper object
35
+ }
36
+
37
+ $.extend(SVGFilter.prototype, {
38
+
39
+ /** Add a distant light filter.
40
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
41
+ @param result {string} The ID of this filter.
42
+ @param azimuth {number} The angle (degrees) in the XY plane for the light source.
43
+ @param elevation {number} The angle (degrees) in the YZ plane for the light source.
44
+ @param [settings] {object} Additional settings for this node.
45
+ @return {SVGElement} The new filter node. */
46
+ distantLight: function(parent, result, azimuth, elevation, settings) {
47
+ var args = this._wrapper._args(arguments, ['result', 'azimuth', 'elevation']);
48
+ return this._wrapper._makeNode(args.parent, 'feDistantLight', $.extend(
49
+ {result: args.result, azimuth: args.azimuth, elevation: args.elevation}, args.settings || {}));
50
+ },
51
+
52
+ /** Add a point light filter.
53
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
54
+ @param result {string} The ID of this filter.
55
+ @param x {number} The x-coordinate for the light source.
56
+ @param y {number} The y-coordinate for the light source.
57
+ @param z {number} The z-coordinate for the light source.
58
+ @param [settings] {object} Additional settings for this node.
59
+ @return {SVGElement} The new filter node. */
60
+ pointLight: function(parent, result, x, y, z, settings) {
61
+ var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'z']);
62
+ return this._wrapper._makeNode(args.parent, 'fePointLight', $.extend(
63
+ {result: args.result, x: args.x, y: args.y, z: args.z}, args.settings || {}));
64
+ },
65
+
66
+ /** Add a spot light filter.
67
+ <p>Specify all of <code>toX</code>, <code>toY</code>, <code>toZ</code> or none of them.</p>
68
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
69
+ @param result {string} The ID of this filter.
70
+ @param x {number} The x-coordinate for the light source.
71
+ @param y {number} The y-coordinate for the light source.
72
+ @param z {number} The z-coordinate for the light source.
73
+ @param [toX] {number} The x-coordinate for where the light is pointing.
74
+ @param [toY] {number} The y-coordinate for where the light is pointing.
75
+ @param [toZ] {number} The z-coordinate for where the light is pointing.
76
+ @param [settings] {object} Additional settings for this node.
77
+ @return {SVGElement} The new filter node. */
78
+ spotLight: function(parent, result, x, y, z, toX, toY, toZ, settings) {
79
+ var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'z', 'toX', 'toY', 'toZ'], ['toX']);
80
+ var sets = $.extend({result: args.result, x: args.x, y: args.y, z: args.z},
81
+ (args.toX != null ? {pointsAtX: args.toX, pointsAtY: args.toY, pointsAtZ: args.toZ} : {}));
82
+ return this._wrapper._makeNode(args.parent, 'feSpotLight', $.extend(sets, args.settings || {}));
83
+ },
84
+
85
+ /** Add a blend filter.
86
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
87
+ @param result {string} The ID of this filter.
88
+ @param mode {string} One of 'normal', 'multiply', 'screen', 'darken', 'lighten'.
89
+ @param in1 {string} The first image to blend.
90
+ @param in2 {string} The second image to blend.
91
+ @param [settings] {object} Additional settings for this node.
92
+ @return {SVGElement} The new filter node. */
93
+ blend: function(parent, result, mode, in1, in2, settings) {
94
+ var args = this._wrapper._args(arguments, ['result', 'mode', 'in1', 'in2']);
95
+ return this._wrapper._makeNode(args.parent, 'feBlend', $.extend(
96
+ {result: args.result, mode: args.mode, in_: args.in1, in2: args.in2}, args.settings || {}));
97
+ },
98
+
99
+ /** Add a colour matrix filter.
100
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
101
+ @param result {string} The ID of this filter.
102
+ @param in1 {string} The source to colour.
103
+ @param type {string} One of 'matrix', 'saturate', 'hueRotate', 'luminanceToAlpha'.
104
+ @param values {number[][]|number} For 'matrix' the matrix (5x4) values to apply, for 'saturate' 0.0 to 1.0,
105
+ for 'hueRotate' degrees, for 'luminanceToAlpha' nothing.
106
+ @param [settings] {object} Additional settings for this node.
107
+ @return {SVGElement} The new filter node. */
108
+ colorMatrix: function(parent, result, in1, type, values, settings) {
109
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'type', 'values']);
110
+ if ($.isArray(args.values)) {
111
+ var vs = '';
112
+ for (var i = 0; i < args.values.length; i++) {
113
+ vs += (i === 0 ? '' : ' ') + args.values[i].join(' ');
114
+ }
115
+ args.values = vs;
116
+ }
117
+ else if (typeof args.values === 'object') {
118
+ args.settings = args.values;
119
+ args.values = null;
120
+ }
121
+ var sets = $.extend({result: args.result, in_: args.in1, type: args.type},
122
+ (args.values != null ? {values: args.values} : {}));
123
+ return this._wrapper._makeNode(args.parent, 'feColorMatrix', $.extend(sets, args.settings || {}));
124
+ },
125
+
126
+ /** Add a component transfer filter.
127
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
128
+ @param result {string} The ID of this filter.
129
+ @param functions {object[]} One for each of RGB and A (alpha, optional), for each entry:
130
+ [0] {string} one of 'identity', 'table', 'discrete', 'linear', 'gamma',
131
+ [1] {number[]|number} for 'table' or 'discrete' the list of interpolation or step values OR
132
+ for 'linear' the slope, for 'gamma' the amplitude,
133
+ [2] {number} for 'linear' the intercept, for 'gamma' the exponent,
134
+ [3] {number} for 'gamma' the offset.
135
+ @param [settings] {object} Additional settings for this node.
136
+ @return {SVGElement} The new filter node. */
137
+ componentTransfer: function(parent, result, functions, settings) {
138
+ var args = this._wrapper._args(arguments, ['result', 'functions']);
139
+ var node = this._wrapper._makeNode(args.parent, 'feComponentTransfer',
140
+ $.extend({result: args.result}, args.settings || {}));
141
+ var rgba = ['R', 'G', 'B', 'A'];
142
+ for (var i = 0; i < Math.min(4, args.functions.length); i++) {
143
+ var props = args.functions[i];
144
+ var sets = $.extend({type: props[0]},
145
+ (props[0] === 'table' || props[0] === 'discrete' ? {tableValues: props[1].join(' ')} :
146
+ (props[0] === 'linear' ? {slope: props[1], intercept: props[2]} :
147
+ (props[0] === 'gamma' ? {amplitude: props[1], exponent: props[2], offset: props[3]} : {}))));
148
+ this._wrapper._makeNode(node, 'feFunc' + rgba[i], sets);
149
+ }
150
+ return node;
151
+ },
152
+
153
+ /** Add a composite filter.
154
+ <p>Specify all of <code>k1</code>, <code>k2</code>, <code>k3</code>, <code>k4</code> or none of them.</p>
155
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
156
+ @param result {string} The ID of this filter.
157
+ @param operator {string} One of 'over', 'in', 'out', 'atop', 'xor', 'arithmetic'.
158
+ @param in1 {string} The first filter to compose.
159
+ @param in2 {string} The second filter to compose.
160
+ @param [k1] {number} For 'arithmetic'.
161
+ @param [k2] {number} For 'arithmetic'.
162
+ @param [k3] {number} For 'arithmetic'.
163
+ @param [k4] {number} For 'arithmetic'.
164
+ @param [settings] {object} Additional settings for this node.
165
+ @return {SVGElement} The new filter node. */
166
+ composite: function(parent, result, operator, in1, in2, k1, k2, k3, k4, settings) {
167
+ var args = this._wrapper._args(arguments, ['result', 'operator', 'in1', 'in2', 'k1', 'k2', 'k3', 'k4'], ['k1']);
168
+ var sets = $.extend({result: args.result, operator: args.operator, 'in': args.in1, in2: args.in2},
169
+ (args.k1 != null ? {k1: args.k1, k2: args.k2, k3: args.k3, k4: args.k4} : {}));
170
+ return this._wrapper._makeNode(args.parent, 'feComposite', $.extend(sets, args.settings || {}));
171
+ },
172
+
173
+ /** Add a convolve matrix filter.
174
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
175
+ @param result {string} The ID of this filter
176
+ @param order {number|string} The size(s) of the matrix
177
+ optionally separated into x- and y-components ('number number').
178
+ @param matrix {number[][]} The kernel matrix for the convolution.
179
+ @param [settings] {object} Additional settings for this node.
180
+ @return {SVGElement} The new filter node. */
181
+ convolveMatrix: function(parent, result, order, matrix, settings) {
182
+ var args = this._wrapper._args(arguments, ['result', 'order', 'matrix']);
183
+ var mx = '';
184
+ for (var i = 0; i < args.matrix.length; i++) {
185
+ mx += (i === 0 ? '' : ' ') + args.matrix[i].join(' ');
186
+ }
187
+ args.matrix = mx;
188
+ return this._wrapper._makeNode(args.parent, 'feConvolveMatrix', $.extend(
189
+ {result: args.result, order: args.order, kernelMatrix: args.matrix}, args.settings || {}));
190
+ },
191
+
192
+ /** Add a diffuse lighting filter.
193
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
194
+ @param result {string} The ID of this filter.
195
+ @param [colour] {string} The lighting colour.
196
+ @param [settings] {object} Additional settings for this node.
197
+ @return {SVGElement} The new filter node. */
198
+ diffuseLighting: function(parent, result, colour, settings) {
199
+ var args = this._wrapper._args(arguments, ['result', 'colour'], ['colour']);
200
+ return this._wrapper._makeNode(args.parent, 'feDiffuseLighting', $.extend($.extend({result: args.result},
201
+ (args.colour ? {lightingColor: args.colour} : {})), args.settings || {}));
202
+ },
203
+
204
+ /** Add a displacement map filter.
205
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
206
+ @param result {string} The ID of this filter.
207
+ @param in1 {string} The source image.
208
+ @param in2 {string} The displacement image.
209
+ @param [settings] {object} Additional settings for this node.
210
+ @return {SVGElement} The new filter node. */
211
+ displacementMap: function(parent, result, in1, in2, settings) {
212
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'in2']);
213
+ return this._wrapper._makeNode(args.parent, 'feDisplacementMap',
214
+ $.extend({result: args.result, in_: args.in1, in2: args.in2}, args.settings || {}));
215
+ },
216
+
217
+ /** Add a flood filter.
218
+ <p>Specify all of <code>x</code>, <code>y</code>, <code>width</code>, <code>height</code> or none of them.</p>
219
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
220
+ @param result {string} The ID of this filter.
221
+ @param [x] {number} The left coordinate of the rectangle.
222
+ @param [y] {number} The top coordinate of the rectangle.
223
+ @param [width] {number} The width of the rectangle.
224
+ @param [height] {number} The height of the rectangle.
225
+ @param colour {string} The colour to fill with.
226
+ @param opacity {number} The opacity 0.0-1.0.
227
+ @param [settings] {object} Additional settings for this node.
228
+ @return {SVGElement} The new filter node. */
229
+ flood: function(parent, result, x, y, width, height, colour, opacity, settings) {
230
+ var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'width', 'height', 'colour', 'opacity']);
231
+ if (arguments.length < 6) {
232
+ args.colour = args.x;
233
+ args.opacity = args.y;
234
+ args.settings = args.width;
235
+ args.x = null;
236
+ }
237
+ var sets = $.extend({result: args.result, floodColor: args.colour,
238
+ floodOpacity: args.opacity}, (args.x != null ?
239
+ {x: args.x, y: args.y, width: args.width, height: args.height} : {}));
240
+ return this._wrapper._makeNode(args.parent, 'feFlood', $.extend(sets, args.settings || {}));
241
+ },
242
+
243
+ /** Add a Gaussian blur filter.
244
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
245
+ @param result {string} The ID of this filter.
246
+ @param in1 {string} The source filter.
247
+ @param stdDevX {number} The standard deviation along the x-axis.
248
+ @param [stdDevY] {number} The standard deviation along the y-axis.
249
+ @param [settings] {object} Additional settings for this node.
250
+ @return {SVGElement} The new filter node. */
251
+ gaussianBlur: function(parent, result, in1, stdDevX, stdDevY, settings) {
252
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'stdDevX', 'stdDevY'], ['stdDevY']);
253
+ return this._wrapper._makeNode(args.parent, 'feGaussianBlur', $.extend(
254
+ {result: args.result, in_: args.in1, stdDeviation: args.stdDevX +
255
+ (args.stdDevY ? ' ' + args.stdDevY : '')}, args.settings || {}));
256
+ },
257
+
258
+ /** Add an image filter.
259
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
260
+ @param result {string} the ID of this filter.
261
+ @param href {string} The URL of the image.
262
+ @param [settings] {object} Additional settings for this node.
263
+ @return {SVGElement} The new filter node. */
264
+ image: function(parent, result, href, settings) {
265
+ var args = this._wrapper._args(arguments, ['result', 'href']);
266
+ var node = this._wrapper._makeNode(args.parent, 'feImage', $.extend({result: args.result}, args.settings || {}));
267
+ node.setAttributeNS($.svg.xlinkNS, 'href', args.href);
268
+ return node;
269
+ },
270
+
271
+ /** Add a merge filter.
272
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
273
+ @param result {string} The ID of this filter.
274
+ @param refs {string[])} The IDs of the filters to merge.
275
+ @param [settings] {object} Additional settings for this node.
276
+ @return {SVGElement} The new filter node. */
277
+ merge: function(parent, result, refs, settings) {
278
+ var args = this._wrapper._args(arguments, ['result', 'refs']);
279
+ var node = this._wrapper._makeNode(args.parent, 'feMerge', $.extend({result: args.result}, args.settings || {}));
280
+ for (var i = 0; i < args.refs.length; i++) {
281
+ this._wrapper._makeNode(node, 'feMergeNode', {in_: args.refs[i]});
282
+ }
283
+ return node;
284
+ },
285
+
286
+ /** Add a morphology filter.
287
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
288
+ @param result {string} The ID of this filter.
289
+ @param in1 {string} The source filter.
290
+ @param operator {string} One of 'erode', 'dilate'.
291
+ @param radiusX {number} The size of the operation in the x-axis.
292
+ @param [radiusY] {number} The size of the operation in the y-axis.
293
+ @param [settings] {object} Additional settings for this node.
294
+ @return {SVGElement} The new filter node. */
295
+ morphology: function(parent, result, in1, operator, radiusX, radiusY, settings) {
296
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'operator', 'radiusX', 'radiusY'], ['radiusY']);
297
+ return this._wrapper._makeNode(args.parent, 'feMorphology', $.extend(
298
+ {result: args.result, in_: args.in1, operator: args.operator,
299
+ radius: args.radiusX + (args.radiusY ? ' ' + args.radiusY : '')}, args.settings || {}));
300
+ },
301
+
302
+ /** Add an offset filter.
303
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
304
+ @param result {string} The ID of this filter.
305
+ @param in1 {string} The source filter.
306
+ @param dX {number} The offset in the x-axis.
307
+ @param dY {number} The offset in the y-axis.
308
+ @param [settings] {object} Additional settings for this node.
309
+ @return {SVGElement} The new filter node. */
310
+ offset: function(parent, result, in1, dx, dy, settings) {
311
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'dx', 'dy']);
312
+ return this._wrapper._makeNode(args.parent, 'feOffset', $.extend(
313
+ {result: args.result, in_: args.in1, dx: args.dx, dy: args.dy}, args.settings || {}));
314
+ },
315
+
316
+ /** Add a specular lighting filter.
317
+ <p>Numeric params are only optional if following numeric params are also omitted.</p>
318
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
319
+ @param result {string}The ID of this filter.
320
+ @param in1 {string} The source filter.
321
+ @param [surfaceScale] {number} The surface height when Ain = 1.
322
+ @param [specularConstant] {number} The ks in Phong lighting model.
323
+ @param [specularExponent] {number} The shininess 1.0-128.0.
324
+ @param [settings] {object} Additional settings for this node.
325
+ @return {SVGElement} The new filter node. */
326
+ specularLighting: function(parent, result, in1, surfaceScale, specularConstant, specularExponent, settings) {
327
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'surfaceScale', 'specularConstant', 'specularExponent'],
328
+ ['surfaceScale', 'specularConstant', 'specularExponent']);
329
+ return this._wrapper._makeNode(args.parent, 'feSpecularLighting', $.extend(
330
+ {result: args.result, in_: args.in1, surfaceScale: args.surfaceScale,
331
+ specularConstant: args.specularConstant, specularExponent: args.specularExponent}, args.settings || {}));
332
+ },
333
+
334
+ /** Add a tile filter.
335
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
336
+ @param result {string} The ID of this filter.
337
+ @param in1 {string} The source filter.
338
+ @param x {number} The left coordinate of the rectangle.
339
+ @param y {number} The top coordinate of the rectangle.
340
+ @param width {number} The width of the rectangle.
341
+ @param height {number} The height of the rectangle.
342
+ @param [settings] {object} Additional settings for this node.
343
+ @return {SVGElement} The new filter node. */
344
+ tile: function(parent, result, in1, x, y, width, height, settings) {
345
+ var args = this._wrapper._args(arguments, ['result', 'in1', 'x', 'y', 'width', 'height']);
346
+ return this._wrapper._makeNode(args.parent, 'feTile', $.extend(
347
+ {result: args.result, in_: args.in1, x: args.x, y: args.y,
348
+ width: args.width, height: args.height}, args.settings || {}));
349
+ },
350
+
351
+ /** Add a turbulence filter.
352
+ @param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
353
+ @param result {string} The ID of this filter.
354
+ @param type {string} One of 'fractalNoise', 'turbulence'.
355
+ @param [baseFreq] {number|string} The base frequency,
356
+ optionally separated into x- and y-components ('number number').
357
+ @param [octaves] {number} The amount of turbulence.
358
+ @param [settings] {object} Additional settings for this node.
359
+ @return {SVGElement} The new filter node. */
360
+ turbulence: function(parent, result, type, baseFreq, octaves, settings) {
361
+ var args = this._wrapper._args(arguments, ['result', 'type', 'baseFreq', 'octaves'], ['octaves']);
362
+ return this._wrapper._makeNode(args.parent, 'feTurbulence', $.extend(
363
+ {result: args.result, type: args.type, baseFrequency: args.baseFreq,
364
+ numOctaves: args.octaves}, args.settings || {}));
365
+ }
366
+ });
367
+
368
+ })(jQuery)