changeset 788:ddb28f6b066a jquery

make plugins available to other plugins
author hertzhaft
date Thu, 17 Feb 2011 22:50:32 +0100
parents b322f553f92e
children 61e4e5d679ba
files client/digitallibrary/jquery/jquery-test-svg.html client/digitallibrary/jquery/jquery.digilib.geometry.js client/digitallibrary/jquery/jquery.digilib.js client/digitallibrary/jquery/svg/jquery.digilibSVG.js
diffstat 4 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery-test-svg.html	Thu Feb 17 22:36:49 2011 +0100
+++ b/client/digitallibrary/jquery/jquery-test-svg.html	Thu Feb 17 22:50:32 2011 +0100
@@ -8,9 +8,9 @@
         </style>
 
         <script type="text/javascript" src="jquery-1.4.4.js"></script>
-        <script type="text/javascript" src="dlGeometry.js"></script>
         <script type="text/javascript" src="jquery.cookie.js"></script>
         <script type="text/javascript" src="jquery.digilib.js"></script>
+        <script type="text/javascript" src="jquery.digilib.geometry.js"></script>
         <script type="text/javascript" src="svg/jquery.svg.js"></script>
         <script type="text/javascript" src="svg/jquery.digilibSVG.js"></script>
         <link rel="stylesheet" type="text/css" href="jquery.digilib.css" />
--- a/client/digitallibrary/jquery/jquery.digilib.geometry.js	Thu Feb 17 22:36:49 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.geometry.js	Thu Feb 17 22:50:32 2011 +0100
@@ -481,7 +481,7 @@
             position : position,
             rectangle : rectangle,
             transform : transform
-        };        
+        };
     };
     if ($.fn.digilib == null) {
         $.error("jquery.digilib.geometry must be loaded after jquery.digilib!");
--- a/client/digitallibrary/jquery/jquery.digilib.js	Thu Feb 17 22:36:49 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Thu Feb 17 22:50:32 2011 +0100
@@ -253,10 +253,8 @@
 
     // list of plugins
     var plugins = {};
-    
     // object to export functions to plugins
     var fn;
-    
     // affine geometry plugin stub
     var geom;
 
@@ -273,7 +271,7 @@
                 geom = plugins.geometry.init();
             }
             FULL_AREA  = geom.rectangle(0, 0, 1, 1);
-            
+
             // settings for this digilib instance are merged from defaults and options
             var settings = $.extend({}, defaults, options);
             var isFullscreen = settings.interactionMode === 'fullscreen';
@@ -324,7 +322,8 @@
                     data = {
                             $elem : $elem,
                             settings : elemSettings,
-                            queryParams : params
+                            queryParams : params,
+                            plugins : plugins
                     };
                     // store in data element
                     $elem.data('digilib', data);
@@ -1793,7 +1792,7 @@
             setScaleMode : setScaleMode,
             isFullArea : isFullArea
     };
-    
+
     // hook plugin into jquery
     $.fn.digilib = function (action) {
         // plugin extension mechanism
--- a/client/digitallibrary/jquery/svg/jquery.digilibSVG.js	Thu Feb 17 22:36:49 2011 +0100
+++ b/client/digitallibrary/jquery/svg/jquery.digilibSVG.js	Thu Feb 17 22:50:32 2011 +0100
@@ -39,7 +39,7 @@
     console.debug('installing jquery.digilibSVG');
 
     var pluginName = 'digilibSVG';
-    var geom = dlGeometry();
+    var geom;
 
     var defaults = {
         // choice of colors offered by toolbar
@@ -169,6 +169,8 @@
         "init" : function(options) {
             var $digilib = this;
             var data = $digilib.data('digilib');
+            var plugins = data.plugins;
+            geom = plugins.geometry.init();
             var settings = $.extend({}, defaults, options);
             // prepare the AJAX callback
             // TODO: return unless interactiveMode === 'fullscreen'?