changeset 1017:c3931ec5485f

write a console error when a button is not defined
author hertzhaft
date Sat, 18 Feb 2012 20:14:51 +0100
parents 168e8aa7e9a5
children 7f8aaae89f9b
files webapp/src/main/webapp/jquery/jquery-test-embedded.html webapp/src/main/webapp/jquery/jquery.digilib.buttons.js
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery-test-embedded.html	Sat Feb 18 19:57:04 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery-test-embedded.html	Sat Feb 18 20:14:51 2012 +0100
@@ -12,7 +12,7 @@
                 /* padding for buttons and bird-div */
                 padding-right: 18px;
                 padding-bottom: 100px;
-                /* width: 220px; */
+                width: 220px;
             }
 
             div.svg {
@@ -55,6 +55,7 @@
         <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="jquery.digilib.marks.js"></script>
         <script type="text/javascript" src="jquery.digilib.buttons.js"></script>
         <script type="text/javascript" src="jquery.digilib.birdseye.js"></script>
         <script type="text/javascript" src="jquery.digilib.regions.js"></script>
--- a/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js	Sat Feb 18 19:57:04 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js	Sat Feb 18 20:14:51 2012 +0100
@@ -79,7 +79,7 @@
             },
         rot : {
             onclick : "rotate",
-            //onclick : ["slider", "rot"],
+            onclick : ["slider", "rot"],
             tooltip : "rotate image",
             icon : "rotate.png"
             },
@@ -146,7 +146,6 @@
             label : "Rotation angle",
             tooltip : "rotate image",
             icon : "rotate.png",
-            okcancel : true,
             'min' : 0,
             'max' : 360,
             'start' : 90
@@ -155,7 +154,6 @@
             label : "Brightness",
             tooltip : "set numeric value to be added",
             icon : "brightness.png",
-            okcancel : true,
             'min' : -255,
             'max' : 255,
             'start' : 0
@@ -164,7 +162,6 @@
             label : "Contrast",
             tooltip : "set numeric value to be multiplied",
             icon : "contrast.png",
-            okcancel : true,
             'min' : -8,
             'max' : 8,
             'start' : 0
@@ -173,7 +170,6 @@
             label : "Red value",
             tooltip : "set red value",
             icon : "rgb.png",
-            okcancel : false,
             'min' : 0,
             'max' : 255,
             'start' : 127
@@ -183,7 +179,6 @@
             label : "Green value",
             tooltip : "set green value",
             icon : "rgb.png",
-            okcancel : false,
             'min' : 0,
             'max' : 255,
             'start' : 127
@@ -193,7 +188,6 @@
             label : "Blue value",
             tooltip : "set blue value",
             icon : "rgb.png",
-            okcancel : false,
             'min' : 0,
             'max' : 255,
             'start' : 127
@@ -662,6 +656,10 @@
         	imagePath = settings.digilibBaseUrl + '/jquery/' + imagePath;
         }
         var buttonConfig = settings.buttons[buttonName];
+        if (buttonConfig == null) {
+            console.error('Could not create button: ' + buttonName);
+            return;
+            }
         // button properties
         var action = buttonConfig.onclick;
         var tooltip = buttonConfig.tooltip;