comparison client/digitallibrary/jquery/svg/jquery.svg.compat-1.0.1.js @ 756:ccf67eaf97ee jquery

added jQuery ui and svg javascripts
author hertzhaft
date Sun, 06 Feb 2011 22:17:41 +0100
parents
children
comparison
equal deleted inserted replaced
755:4c0cc97a6399 756:ccf67eaf97ee
1 /* http://keith-wood.name/svg.html
2 SVG for jQuery compatibility from v1.0.1 to v1.4.0.
3 Written by Keith Wood (kbwood{at}iinet.com.au) May 2008.
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 var svgManager = null;
9 var svgGraphing = null;
10
11 (function($) { // Hide scope, no $ conflict
12
13 svgManager = $.svg;
14 svgGraphing = $.svg.graphing;
15 $.svg._rootClass = $.svg._wrapperClass;
16
17 $.extend($.svg, {
18 /* Retrieve the SVG wrapper for a given division.
19 @param input element - division to look for or
20 jQuery - jQuery collection containing the division or
21 string - jQuery selector for the division
22 @return SVGRoot - the associated SVG wrapper */
23 getSVGFor: function(input) {
24 input = (input.jquery ? input : $(input));
25 return $.svg._getSVG(input);
26 }
27 });
28
29 $.extend($.svg._rootClass.prototype, {
30 /* Draw a rounded rectangle.
31 @param parent element - the parent node for the new shape
32 @param x number - the x-coordinate for the left edge of the rectangle
33 @param y number - the y-coordinate for the top edge of the rectangle
34 @param width number - the width of the rectangle
35 @param height number - the height of the rectangle
36 @param rx number - the x-radius of the ellipse for the rounded corners
37 @param ry number - the y-radius of the ellipse for the rounded corners
38 @param settings object - additional settings for the shape (optional)
39 @return the new shape node */
40 roundrect: function(parent, x, y, width, height, rx, ry, settings) {
41 return this.rect(parent, x, y, width, height, rx, ry, settings);
42 },
43 });
44
45 /* Attach the SVG functionality to a jQuery selection.
46 @param loadURL string - the URL of the initial document to load (optional)
47 @param onLoad function - a callback functional invoked following loading (optional)
48 @param settings object - the new settings to use for this SVG instance (optional)
49 @return jQuery object - for chaining further calls */
50 $.fn.svg = function(loadURL, onLoad, settings) {
51 if (typeof loadURL == 'function') {
52 settings = onLoad;
53 onLoad = loadURL;
54 loadURL = null;
55 }
56 if (loadURL && typeof loadURL == 'object') {
57 settings = loadURL;
58 loadURL = onLoad = null;
59 }
60 if (onLoad && typeof onLoad == 'object') {
61 settings = onLoad;
62 onLoad = null;
63 }
64 return this.each(function() {
65 $.svg._attachSVG(this, {loadURL: loadURL, onLoad: onLoad, settings: settings});
66 });
67 };
68
69 })(jQuery);