diff webapp/src/main/webapp/jquery/jquery.digilib.js @ 1011:5f35e97d8ae3

oops, worked on wrong version
author hertzhaft
date Sat, 18 Feb 2012 10:00:26 +0100
parents ba9d90589ee8
children dc09bccf8357
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Sat Feb 18 09:54:12 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Sat Feb 18 10:00:26 2012 +0100
@@ -38,7 +38,7 @@
 
     var defaults = {
         // version of this script
-        'version' : 'jquery.digilib.js 2.1.4b1',
+        'version' : 'jquery.digilib.js 2.1.5b2',
         // logo url
         'logoUrl' : 'img/digilib-logo-text1.png',
         // homepage url (behind logo)
@@ -108,7 +108,7 @@
     var buttons = {};
 
     var actions = {
-
+            
         /** init: digilib initialization
          * 
          * @param options
@@ -341,7 +341,6 @@
             setFitMode(data, mode);
             // zoom full only works in screen mode
             setScaleMode(data, 'screen');
-            // bird's eye off for full zoom 
             data.settings.isBirdDivVisible = false;
             redisplay(data);
         },
@@ -452,10 +451,33 @@
             var url = getDigilibUrl(data);
             if (noprompt == null) {
                 window.prompt("URL reference to the current view", url);
+                // return nothing so we can use is in javascript: url without reload
+                return;
             }
             return url;
         },
 
+        /** 
+         * Returns URL to the full digilib.html with the current parameters.
+         * Redirects immediately with mode=open.
+         * 
+         * @param data
+         * @param mode
+         */
+        digilibUrl : function (data, mode) {
+            var url = getDigilibUrl(data, '/jquery/digilib.html');
+            if (mode === 'open') {
+                // redirect
+                window.location = url;
+            } else if (mode === 'open_new') {
+                // open new window
+                window.open(url);
+                return;
+            }
+            return url;
+        },
+        
+        
         /** set image quality
          * 
          * @param data
@@ -613,31 +635,39 @@
         return url;
     };
 
-    /** returns URL and query string for current digilib
+    /** 
+     * returns URL and query string for current digilib.
+     * if digilibPage != null returns URL to page in digilib installation with digilib parameters,
+     * otherwise using current URL and parameters.
      * 
      */
-    var getDigilibUrl = function (data) {
+    var getDigilibUrl = function (data, digilibPage) {
         packParams(data);
         var settings = data.settings;
-        var paramList = settings.additionalParamNames.concat(settings.digilibParamNames);
-        if (settings.suppressParamNames != null) {
-        	// eliminate suppressed parameters from list
-        	paramList = $.map(paramList, function(e, idx) {
-        		if ($.inArray(e, settings.suppressParamNames) >= 0) {
-        			return null;
-        		} else {
-        			return e;
-        		}
-        	});
+        var paramList = settings.digilibParamNames;
+        if (digilibPage != null) {
+            var baseUrl = data.settings.digilibBaseUrl + digilibPage;
+        } else {
+            paramList = settings.additionalParamNames.concat(settings.digilibParamNames);
+            if (settings.suppressParamNames != null) {
+                // eliminate suppressed parameters from list
+                paramList = $.map(paramList, function(e, idx) {
+                    if ($.inArray(e, settings.suppressParamNames) >= 0) {
+                        return null;
+                    } else {
+                        return e;
+                    }
+                });
+            }
+            // take url from current location
+            var baseUrl = window.location.href;
+            var pos = baseUrl.indexOf('?');
+            if (pos > -1) {
+                baseUrl = baseUrl.substring(0, pos);
+            }
         }
         var queryString = getParamString(settings, paramList, defaults);
-        // take url from current location
-        var url = window.location.href;
-        var pos = url.indexOf('?');
-        if (pos > -1) {
-        	url = url.substring(0, pos);
-        }
-        return url + '?' + queryString;
+        return baseUrl + '?' + queryString;
     };
 
     /** loads image information from digilib server via HTTP