changeset 611:1b6202aba26e jquery

work on button creation (reinstated jquery-test)
author robcast
date Fri, 14 Jan 2011 15:21:15 +0100
parents cd9f657d49fa
children fb94f1b74d59
files client/digitallibrary/jquery/jquery-test.html client/digitallibrary/jquery/jquery.digilib.js
diffstat 2 files changed, 66 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/jquery/jquery-test.html	Fri Jan 14 15:21:15 2011 +0100
@@ -0,0 +1,55 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>Digilib jQuery Test HTML</title>
+        
+        <style type="text/css">
+            body {
+                 background: silver;
+            }
+            
+            div.digilib {
+                float: left;
+                padding: 10px;
+            }
+            
+        </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.digilib.js"></script>
+        
+
+        <script type="text/javascript">
+            $(document).ready(function(){
+                 // $('div.digilib').children('img').attr('src', '');
+                 // $('div.digilib').children('img').remove();
+                 $('div.digilib').digilib({interactionMode : 'embedded'});
+
+                 $('div.digilib').each(function(){
+                         console.log($(this).data('digilib').settings);
+                    });
+              
+            });
+
+        </script>
+    </head>
+
+    <body>
+    
+        <div id="digilib-1" class="digilib single">
+            <img src="http://digilinx:18080/digitallibrary/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/FransHals-WillemVanHeythuysen" />
+        </div>
+        <div id="digilib-2" class="digilib">
+            <img src="http://digilinx:18080/digitallibrary/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/ferrara" />
+        </div>
+        <div id="digilib-3" class="digilib">
+            <img src="http://digilinx:18080/digitallibrary/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/weide" />
+        </div>
+        <div id="digilib-4" class="digilib">
+            <img src="http://digilinx:18080/digitallibrary/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/HansHolbein-NikolausKratzer" />
+        </div>
+    </body>
+</html>
+
--- a/client/digitallibrary/jquery/jquery.digilib.js	Fri Jan 14 13:47:30 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Fri Jan 14 15:21:15 2011 +0100
@@ -152,7 +152,7 @@
         // button groups
         'buttonsStandard' : ["reference","zoomin","zoomout","zoomarea","zoomfull","pagewidth","back","fwd","page","bird","SEP","help","reset","options"],
         'buttonsSpecial' : ["mark","delmark","hmir","vmir","rot","brgt","cont","rgb","quality","size","calibrationx","scale","SEP","options"],
-        'buttonsCustom' : [],
+        'buttonsCustom' : []
         };
  
     // parameters from the query string
@@ -190,6 +190,7 @@
                     }
                     // create HTML structure
                     setupScalerDiv($elem, elemSettings);
+                    setupButtons($elem, elemSettings, 'buttonsStandard');
                 });
             },
 
@@ -299,18 +300,16 @@
             for (var i = 0; i < buttonNames.length; i++) {
                 var buttonName = buttonNames[i];
                 var buttonConfig = settings.buttons[buttonName];
-                var $button = buttondiv.append('<div class="button"/>');
-                $button
-                    .attr('id', 'digilib-button-' + buttonName)
-                    .bind('click', function(){ buttonConfig.onclick })
-                    .append('<a/>')
-                    .attr('title', buttonConfig.toolTip )
-                    .append('<img class="button"/>')
-                    .attr('src', settings.buttonsImagePath + buttonConfig.img);
-                };
-            }
+                var $button = $buttonDiv.append('<div class="button"/>');
+                $button.addClass('digilib-button-' + buttonName);
+                var $link = $button.append('<a/>');
+                $link.bind('click', buttonConfig.onclick)
+                    .attr('title', buttonConfig.toolTip );
+                var $img = $link.append('<img class="button"/>');
+                $img.attr('src', settings.buttonsImagePath + buttonConfig.img);
+            };
+        }
         return $buttonDiv;
-        }
     };
     
     // hook plugin into jquery