# HG changeset patch # User robcast # Date 1473335780 -7200 # Node ID b330eafffed6673882fdd4a14df2d8bf52f3b8fd # Parent 08d64f3d1f7650ad2d82003a113fb63de64ac0da# Parent 3a11aadd443c90444245e59e989e5793729f32a7 Merge with 3a11aadd443c90444245e59e989e5793729f32a7 diff -r 08d64f3d1f76 -r b330eafffed6 webapp/src/main/webapp/jquery/digilib-ann.html --- a/webapp/src/main/webapp/jquery/digilib-ann.html Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/digilib-ann.html Thu Sep 08 13:56:20 2016 +0200 @@ -40,13 +40,13 @@ // URL of annotation server 'annotationServerUrl' : '//localhost:18080/AnnotationManagerN4J/annotator', // are annotations read-only? - 'annotationsReadOnly' : false, + 'annotationsReadOnly' : true, // URL of authentication token server - 'annotationTokenUrl' : 'http://localhost:8080/test/annotator/token/getLoginToken', + //'annotationTokenUrl' : 'http://localhost:8080/test/annotator/token/getLoginToken', // list of Annotator plugins - 'annotatorPlugins' : ['Auth', 'GroupPermissions', 'Markdown', 'DigilibIntegrator', 'Store'] + //'annotatorPlugins' : ['Auth', 'GroupPermissions', 'Markdown', 'DigilibIntegrator', 'Store'] //'annotatorPlugins' : ['Auth', 'Permissions', 'Markdown', 'DigilibIntegrator', 'Store'] - //'annotatorPlugins' : ['Store', 'Markdown', 'DigilibIntegrator'] + 'annotatorPlugins' : ['Store', 'Markdown', 'DigilibIntegrator'] }; var $div = $('div#digilib'); $div.digilib(opts); diff -r 08d64f3d1f76 -r b330eafffed6 webapp/src/main/webapp/jquery/digilib-auth.html --- a/webapp/src/main/webapp/jquery/digilib-auth.html Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/digilib-auth.html Thu Sep 08 13:56:20 2016 +0200 @@ -31,7 +31,7 @@ + + + + + + + + + + + + + + + + + + + + + + +
+

digilib doesn't work! Please switch on Javascript or notify the server administrator!

+ +
+ + + diff -r 08d64f3d1f76 -r b330eafffed6 webapp/src/main/webapp/jquery/jquery-test-measure.html --- a/webapp/src/main/webapp/jquery/jquery-test-measure.html Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery-test-measure.html Thu Sep 08 13:56:20 2016 +0200 @@ -36,13 +36,10 @@ $(document).ready(function(){ var opts = { interactionMode : 'fullscreen', - showRegionNumbers : true + showRegionNumbers : true, }; var $div = $('div#digilib'); $div.digilib(opts); - DIGILIB = function (action) { - return $div.digilib(action); - }; }); diff -r 08d64f3d1f76 -r b330eafffed6 webapp/src/main/webapp/jquery/jquery.digilib.annotator.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Thu Sep 08 13:56:20 2016 +0200 @@ -233,7 +233,7 @@ // password entered in JS-prompt password = window.prompt("Please authenticate: Password", ''); // set params for Auth plugin - auth.options.requestData.password = password; + auth.options.requestData.password = password; // try to use the safe url for the password if (data.settings.annotationSafeTokenUrl != null) { auth.options.tokenUrl = data.settings.annotationSafeTokenUrl; @@ -796,11 +796,10 @@ $(document).off("mousedown", annotator.checkForStartSelection); $(document).off("mouseup", annotator.checkForEndSelection); // set plugin parameters - var def = defaults.annotatorPluginSettings; var pluginParams = {}; // merge settings // (deep copy of defaults from plugin and options from HTML) - $.extend(true, pluginParams, defaults.annotatorPluginSettings, data.options.annotatorPluginSettings); + $.extend(true, pluginParams, defaults.annotatorPluginSettings, data.settings.annotatorPluginSettings); // function to evaluate plugin settings var evalParams = function (params) { if (params == null) return; diff -r 08d64f3d1f76 -r b330eafffed6 webapp/src/main/webapp/jquery/jquery.digilib.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.js Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.js Thu Sep 08 13:56:20 2016 +0200 @@ -101,7 +101,9 @@ // parameters used by background image 'previewImgParamNames' : ['fn','pn','dw','dh','mo','rot'], // reserved space in full page display (default value accounts for body margins) - 'scalerInsets' : { 'x' : 26, 'y': 20 } + 'scalerInsets' : { 'x' : 26, 'y': 20 }, + // number of decimal places, for cropping parameters wx,wy,wh,ww + 'decimals' : 4 }; // list of plugins @@ -123,7 +125,7 @@ * @param options * @returns */ - init : function(options) { + init : function(options, hook) { // import geometry classes if (plugins.geometry == null) { $.error("jquery.digilib.geometry plugin not found!"); @@ -221,7 +223,7 @@ pos = url.indexOf('/digilib.html'); if (pos > 0) { elemSettings.digilibBaseUrl = url.substring(0, pos); - } + } } } else { // may be we got the scaler URL from the img @@ -258,6 +260,11 @@ } // create HTML structure for scaler setupScalerDiv(data); + // additional initializations before setup (e.g. for single nested settings) + if (typeof hook === 'function') { + hook(data); + console.debug('init hook', hook, data); + } // send setup event $(data).trigger('setup'); }); @@ -844,22 +851,31 @@ retrieveOptions(data); }; - /** put area into parameters + /** put area dimensions into parameters * */ - var packArea = function (settings, area) { - if (!area) return; - // zoom area - settings.wx = cropFloat(area.x); - settings.wy = cropFloat(area.y); - settings.ww = cropFloat(area.width); - settings.wh = cropFloat(area.height); + var packArea = function (data, area) { + // pack the dimensions of the zoom into parameters + if (!area) return; + // use higher precision if the image is large and mode="lpic" (large picture) + var decimals = defaults.decimals; + var imgInfo = data.imgInfo; + if (data.scalerFlags.lpic != null + && imgInfo != null + && Math.max(imgInfo.width, imgInfo.height) > 10000) { + decimals = 5; + } + var settings = data.settings; + settings.wx = cropFloat(area.x, decimals); + settings.wy = cropFloat(area.y, decimals); + settings.ww = cropFloat(area.width, decimals); + settings.wh = cropFloat(area.height, decimals); }; /** pack scaler flags into parameters * */ - var packScalerFlags = function (settings, flags) { + var packScalerFlags = function (data, flags) { if (!flags) return; var mo = ''; for (var f in flags) { @@ -868,16 +884,15 @@ } mo += f; } - settings.mo = mo; + data.settings.mo = mo; }; /** put objects back into parameters * */ var packParams = function (data) { - var settings = data.settings; - packArea(settings, data.zoomArea); - packScalerFlags(settings, data.scalerFlags); + packArea(data, data.zoomArea); + packScalerFlags(data, data.scalerFlags); // store user interface options in cookie storeOptions(data); // trigger pack handlers @@ -971,7 +986,10 @@ console.debug("cached img.load"); $img.trigger('load'); } - if (data.scalerFlags.clip != null || data.scalerFlags.osize != null) { + if (data.scalerFlags.clip != null + || data.scalerFlags.osize != null + || data.scalerFlags.lpic != null + ) { // we need image info, do we have it? if (data.imgInfo == null) { loadImageInfo(data); @@ -1006,7 +1024,11 @@ console.debug("cached img.load"); $img.trigger('load'); } - if (data.scalerFlags.clip != null || data.scalerFlags.osize != null) { + // parameter "mo" + if (data.scalerFlags.clip != null + || data.scalerFlags.osize != null + || data.scalerFlags.lpic != null) + { // we need image info, do we have it? if (data.imgInfo == null) { loadImageInfo(data); @@ -1755,14 +1777,16 @@ /** return number with reduced precision. * ("crop senseless precision") */ - var cropFloat = function (x) { - return parseInt(10000 * x, 10) / 10000; + var cropFloat = function (x, dec) { + // return parseInt(10000 * x, 10) / 10000; + var decimals = dec || defaults.decimals; + return +(Math.round(x + "e+" + decimals) + "e-" + decimals); }; /** return string from number with reduced precision. */ - var cropFloatStr = function (x) { - return cropFloat(x).toString(); + var cropFloatStr = function (x, dec) { + return cropFloat(x, dec).toString(); }; /** diff -r 08d64f3d1f76 -r b330eafffed6 webapp/src/main/webapp/jquery/jquery.digilib.regions.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.regions.js Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.regions.js Thu Sep 08 13:56:20 2016 +0200 @@ -232,7 +232,7 @@ var show = !data.settings.isRegionVisible; data.settings.isRegionVisible = show; fn.highlightButtons(data, 'regions', show); - renderRegions(data, 1); + renderRegions(data, 0); return show; },