# HG changeset patch # User hertzhaft # Date 1332716165 -7200 # Node ID 4aa90cccb3e4be2a07092fe25dbf4a5c9dc212b1 # Parent 4f17420392a95b54f284f3241586103a99c787f5 make plugins independent from buttons plugin diff -r 4f17420392a9 -r 4aa90cccb3e4 webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js Sun Mar 25 22:05:23 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js Mon Mar 26 00:56:05 2012 +0200 @@ -62,7 +62,8 @@ // add buttons $.extend(digilib.buttons, buttons); // insert in button list -- not elegant - if (digilib.defaults.buttonSettings != null) { + if (digilib.plugins.buttons != null) { + // if (digilib.defaults.buttonSettings != null) { digilib.defaults.buttonSettings.fullscreen.standardSet.splice(9, 0, 'bird'); digilib.defaults.buttonSettings.embedded.standardSet.splice(5, 0, 'bird'); } diff -r 4f17420392a9 -r 4aa90cccb3e4 webapp/src/main/webapp/jquery/jquery.digilib.css --- a/webapp/src/main/webapp/jquery/jquery.digilib.css Sun Mar 25 22:05:23 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.css Mon Mar 26 00:56:05 2012 +0200 @@ -104,7 +104,7 @@ display: none; } -div.dl-digilib div.dl-regionHTML { +div.dl-digilib div.dl-regionInfo { display: none; position: absolute; top: 100px; @@ -117,7 +117,7 @@ z-index: 1000; } -div.dl-digilib div.dl-regionHTML a { +div.dl-digilib div.dl-regionInfo a { color: white; text-decoration: none; font-size: 11px; @@ -177,6 +177,7 @@ display: none; border: 1px solid lightcyan; background-color: lightgrey; + background: transparent; width: 300px; padding:10px; } diff -r 4f17420392a9 -r 4aa90cccb3e4 webapp/src/main/webapp/jquery/jquery.digilib.dialogs.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.dialogs.js Sun Mar 25 22:05:23 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.dialogs.js Mon Mar 26 00:56:05 2012 +0200 @@ -145,6 +145,17 @@ }); }; + var setButtonActions = function () { + if (fn.setButtonAction == null) { + console.debug('dialogs: could not assign button actions. Maybe jquery.digilib.buttons.js was not loaded?'); + return; + } + console.debug('dialogs: assign new button actions. digilib:', digilib); + fn.setButtonAction('calibrationx', 'dialogCalibration'); + fn.setButtonAction('scale', 'dialogScaleMode'); + }; + + // plugin installation called by digilib on plugin object. var install = function (plugin) { digilib = plugin; @@ -155,8 +166,7 @@ // add defaults, actions, buttons $.extend(true, digilib.defaults, defaults); // make deep copy $.extend(digilib.actions, actions); - fn.setButtonAction('calibrationx', 'dialogCalibration'); - fn.setButtonAction('scale', 'dialogScaleMode'); + setButtonActions(); // export functions fn.showCalibrationDialog = showCalibrationDialog; fn.showScaleModeDialog = showScaleModeDialog; diff -r 4f17420392a9 -r 4aa90cccb3e4 webapp/src/main/webapp/jquery/jquery.digilib.regions.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.regions.js Sun Mar 25 22:05:23 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.regions.js Mon Mar 26 00:56:05 2012 +0200 @@ -17,7 +17,12 @@ // the digilib object var digilib = null; // the functions made available by digilib - var fn = null; + var fn = { + // dummy function to avoid errors, gets overwritten by buttons plugin + highlightButtons : function () { + console.debug('regions: dummy function - highlightButtons'); + } + }; // affine geometry plugin var geom = null; @@ -37,7 +42,7 @@ tooltip : "show or hide regions", icon : "regions.png" }, - regionhtml : { + regioninfo : { onclick : "showRegionInfo", tooltip : "show information about regions", icon : "regioninfo.png" @@ -49,8 +54,6 @@ 'isRegionVisible' : true, // are region numbers shown? 'showRegionNumbers' : true, - // is window with region HTML shown? - 'showRegionInfo' : false, // is there region content in the page? 'processHtmlRegions' : false, // region defined by users and in the URL @@ -62,7 +65,7 @@ // css selector for area elements (should additionally be marked with class "keep") 'regionContentSelector' : 'map.dl-regioncontent area', // buttonset of this plugin - 'regionSet' : ['regions', 'addregion', 'delregion', 'regionhtml', 'lessoptions'], + 'regionSet' : ['regions', 'addregion', 'delregion', 'regioninfo', 'lessoptions'], // url param for regions 'rg' : null }; @@ -157,22 +160,43 @@ renderRegions(data, 1); }, - // show/hide region HTML code + // show region info in a window "showRegionInfo" : function (data) { - var show = !data.settings.showRegionInfo; - data.settings.showRegionInfo = show; - fn.highlightButtons(data, 'regionhtml', show); - var $html = data.$htmlDiv; - if (!show) { - // empty the div - $html.fadeOut(function () { - $html.contents().remove(); + var $elem = data.$elem; + var cssPrefix = data.settings.cssPrefix; + var $info = $elem.find('#'+cssPrefix+'regionInfo'); + if ($info.length > 0) { + fn.withdraw($info); + return; + } + var html = '\ +