changeset 1526:3a11aadd443c

more map tests
author hertzhaft
date Tue, 06 Sep 2016 19:11:38 +0200
parents 09b851740c70
children b330eafffed6
files webapp/src/main/webapp/jquery/digilib-map.html
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/digilib-map.html	Tue Sep 06 14:21:50 2016 +0200
+++ b/webapp/src/main/webapp/jquery/digilib-map.html	Tue Sep 06 19:11:38 2016 +0200
@@ -57,11 +57,28 @@
                     // annotationPageUri
                     // 'annotationPageUri' : function() { return window.location.href }
                 };
+                // store additional data (apart from 'rows') from loadAnnotationsFromSearch
+                var 	_onLoadAnnotationsFromSearch = function (data) {
+                      if (data == null) {
+                        data = {};
+                      }
+                    this.annotator.data = data;
+                    console.log('maps: data', data);
+                    return this._onLoadAnnotations(data.rows || []);
+                    };
+                // monkey patch the annotator Store plugin
+                var handleSetup = function (evt) {
+                    console.log('maps: handleSetup');
+                    this.annotator.plugins.Store._onLoadAnnotationsFromSearch = _onLoadAnnotationsFromSearch;
+                    }
+                // add zoom area params to loadAnnotationsFromSearch url
                 var 	getZoomArea = function (data) {
                     return data.zoomArea.toString();
                     };
+                // monkey patches for annotator_dl.js
                 var hook = function (data) {
                     data.settings.annotatorPluginSettings.Store.loadFromSearch.za = getZoomArea;
+                    $(data).on('setup', handleSetup); // too late, annotations have already been loaded
                     };
                 var $div = $('div#digilib');
                 $div.digilib(settings, hook);