changeset 641:8f40f7b6fd20 jquery

some small aboutdiv fixes
author hertzhaft
date Wed, 19 Jan 2011 15:53:08 +0100
parents fcb887110471
children c1306f6d6a79
files client/digitallibrary/jquery/jquery-test-full.html client/digitallibrary/jquery/jquery.digilib.js
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery-test-full.html	Wed Jan 19 14:49:27 2011 +0100
+++ b/client/digitallibrary/jquery/jquery-test-full.html	Wed Jan 19 15:53:08 2011 +0100
@@ -66,7 +66,7 @@
                  $('div.digilib').each(function(){
                          console.log($(this).data('digilib').settings);
                     });
-                 $('div.digilib').digilib('toggleAboutDiv');
+                 $('div.digilib').digilib('showAboutDiv', 1);
             });
 
         </script>
--- a/client/digitallibrary/jquery/jquery.digilib.js	Wed Jan 19 14:49:27 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Wed Jan 19 15:53:08 2011 +0100
@@ -227,7 +227,7 @@
                     setupButtons(data, 'actionsStandard');
                     // bird's eye view creation
                     if (settings.isBirdDivVisible) {
-                        setupBirdDiv(data);                        
+                        setupBirdDiv(data);
                     }
                     // about window creation - TODO: could be deferred? restrict to only one item?
                     setupAboutDiv(data);
@@ -294,6 +294,7 @@
 
     // sets a key to a value (relative values with +/- if relative=true)
     var setNumValue = function(settings, key, value) {
+        if (isNumber(value)) return settings[key] = value; 
         var sign = value.substring(0,1);
         if (sign === '+' || sign === '-') {
             if (settings[key] == null) {
@@ -621,8 +622,9 @@
             // show birds eye view
             //showDiv(settings.isBirdDivVisible);
             //digilib.showArrows(); // show arrow overlays for zoom navigation
-            // done -- hide about div
-            settings.isAboutDivVisible = showDiv(null, data.$aboutDiv, 0);
+            // done -- hide about div --- 
+            // --- why? This only leads to suprise effects when displayed programmatically
+            // settings.isAboutDivVisible = showDiv(null, data.$aboutDiv, 0);
         };
     };
 
@@ -643,6 +645,11 @@
         }
     };
     
+    // auxiliary function (from Douglas Crockford, A.10)
+    var isNumber = function isNumber(value) {
+            return typeof value === 'number' && isFinite(value);
+    };
+    
     // auxiliary function to crop senseless precision
     var cropFloat = function (x) {
         return parseInt(10000 * x, 10) / 10000;