annotate client/digitallibrary/jquery/svg/jquery.svg.compat-1.0.1.js @ 791:304488c72344 jquery

first step to birdseye view as a plugin.
author robcast
date Fri, 18 Feb 2011 10:39:40 +0100
parents ccf67eaf97ee
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
756
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
1 /* http://keith-wood.name/svg.html
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
2 SVG for jQuery compatibility from v1.0.1 to v1.4.0.
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
3 Written by Keith Wood (kbwood{at}iinet.com.au) May 2008.
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
4 Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
5 MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
6 Please attribute the author if you use it. */
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
7
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
8 var svgManager = null;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
9 var svgGraphing = null;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
10
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
11 (function($) { // Hide scope, no $ conflict
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
12
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
13 svgManager = $.svg;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
14 svgGraphing = $.svg.graphing;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
15 $.svg._rootClass = $.svg._wrapperClass;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
16
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
17 $.extend($.svg, {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
18 /* Retrieve the SVG wrapper for a given division.
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
19 @param input element - division to look for or
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
20 jQuery - jQuery collection containing the division or
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
21 string - jQuery selector for the division
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
22 @return SVGRoot - the associated SVG wrapper */
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
23 getSVGFor: function(input) {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
24 input = (input.jquery ? input : $(input));
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
25 return $.svg._getSVG(input);
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
26 }
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
27 });
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
28
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
29 $.extend($.svg._rootClass.prototype, {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
30 /* Draw a rounded rectangle.
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
31 @param parent element - the parent node for the new shape
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
32 @param x number - the x-coordinate for the left edge of the rectangle
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
33 @param y number - the y-coordinate for the top edge of the rectangle
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
34 @param width number - the width of the rectangle
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
35 @param height number - the height of the rectangle
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
36 @param rx number - the x-radius of the ellipse for the rounded corners
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
37 @param ry number - the y-radius of the ellipse for the rounded corners
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
38 @param settings object - additional settings for the shape (optional)
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
39 @return the new shape node */
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
40 roundrect: function(parent, x, y, width, height, rx, ry, settings) {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
41 return this.rect(parent, x, y, width, height, rx, ry, settings);
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
42 },
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
43 });
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
44
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
45 /* Attach the SVG functionality to a jQuery selection.
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
46 @param loadURL string - the URL of the initial document to load (optional)
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
47 @param onLoad function - a callback functional invoked following loading (optional)
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
48 @param settings object - the new settings to use for this SVG instance (optional)
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
49 @return jQuery object - for chaining further calls */
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
50 $.fn.svg = function(loadURL, onLoad, settings) {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
51 if (typeof loadURL == 'function') {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
52 settings = onLoad;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
53 onLoad = loadURL;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
54 loadURL = null;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
55 }
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
56 if (loadURL && typeof loadURL == 'object') {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
57 settings = loadURL;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
58 loadURL = onLoad = null;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
59 }
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
60 if (onLoad && typeof onLoad == 'object') {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
61 settings = onLoad;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
62 onLoad = null;
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
63 }
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
64 return this.each(function() {
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
65 $.svg._attachSVG(this, {loadURL: loadURL, onLoad: onLoad, settings: settings});
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
66 });
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
67 };
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
68
ccf67eaf97ee added jQuery ui and svg javascripts
hertzhaft
parents:
diff changeset
69 })(jQuery);