# HG changeset patch # User hertzhaft # Date 1473181898 -7200 # Node ID 3a11aadd443c90444245e59e989e5793729f32a7 # Parent 09b851740c70716f27c3416b7c8b10e1ae766b54 more map tests diff -r 09b851740c70 -r 3a11aadd443c webapp/src/main/webapp/jquery/digilib-map.html --- 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);