# HG changeset patch # User robcast # Date 1298105778 -3600 # Node ID eb2473a5908bec497e5dc15060e31881cca1dcc4 # Parent 292b2948533f2f6fcdece61120aea9c45ad4b1d1# Parent 52c5595af03ec0dc54f0b3523170ac39a9f84f3f merge from juqery branch 12f790cb30de0ac42ff62fb9921d7a3215243b7b diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/combiner-0.0.1.jar Binary file client/digitallibrary/jquery/combiner-0.0.1.jar has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/img/fullscreen/addregion.png Binary file client/digitallibrary/jquery/img/fullscreen/addregion.png has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/img/fullscreen/delregion.png Binary file client/digitallibrary/jquery/img/fullscreen/delregion.png has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/img/fullscreen/mirror-horizontal-on.png Binary file client/digitallibrary/jquery/img/fullscreen/mirror-horizontal-on.png has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/img/fullscreen/mirror-vertical-on.png Binary file client/digitallibrary/jquery/img/fullscreen/mirror-vertical-on.png has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/img/fullscreen/regioninfo.png Binary file client/digitallibrary/jquery/img/fullscreen/regioninfo.png has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/img/fullscreen/regions.png Binary file client/digitallibrary/jquery/img/fullscreen/regions.png has changed diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery-digilib-plugins.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/jquery/jquery-digilib-plugins.txt Sat Feb 19 09:56:18 2011 +0100 @@ -0,0 +1,42 @@ + +The plugin API of jquery.digilib +-------------------------------- + +* The plugin Javascript file has to be loaded after jquery.digilib.js. + +* The plugin should be written as a closure on jQuery (like a jquery plugin) exporting a plugin object as its interface: + + var plugin = { + name : 'mydigilibplugin', + install : install, + init : init, + buttons : {}, + actions : {}, + fn : {}, + plugins : {}, + defaults : {} + }; + + The "name" string, "install" function and "init" function are provided by the plugin and called by digilib. + "buttons", "actions", "fn" and "plugins" are shared objects provided by digilib. + "buttons" is the array of button objects. The plugin can add its own buttons to this array. + "actions" is the array of action objects. The plugin can add its own actions to this array. + "fn" is an object with functions from digilib. + "plugins" is an object with all digilib plugin objects. + "defaults" is an object with all digilib defaults. + +* the plugin object is passed to digilib in the "plugin" action on loading the plugin javascript file: + + $.fn.digilib('plugin', plugin); + + digilib then calls the "install" function on the populated plugin object (i.e. this = plugin) with the plugin object as parameter. + +* digilib calls the "init" function from the plugin object with the data object instance as a parameter in digilibs init phase. + +* further actions should be implemented as custom events on the data object. + +* events triggered by digilib on the data object: + "setup": in the init phase, after scalerDiv and buttons have been set up. + "update", updateDisplay(): after small updates in the display, e.g. when the scaler-img finished loading. + "redisplay", redisplay(): after changes in the display, e.g. after changing zoom factor. + "dragZoom(newZoomArea)": while dragging the zoom area (with parameter newZoomArea). diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery-test-embedded-rc.html --- a/client/digitallibrary/jquery/jquery-test-embedded-rc.html Fri Feb 11 10:12:41 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-embedded-rc.html Sat Feb 19 09:56:18 2011 +0100 @@ -47,9 +47,10 @@ - + + diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery-test-embedded.html --- a/client/digitallibrary/jquery/jquery-test-embedded.html Fri Feb 11 10:12:41 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-embedded.html Sat Feb 19 09:56:18 2011 +0100 @@ -52,9 +52,10 @@ - + + diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery-test-full-rc.html --- a/client/digitallibrary/jquery/jquery-test-full-rc.html Fri Feb 11 10:12:41 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-full-rc.html Sat Feb 19 09:56:18 2011 +0100 @@ -12,9 +12,10 @@ - + + diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery-test-full.html --- a/client/digitallibrary/jquery/jquery-test-full.html Fri Feb 11 10:12:41 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-full.html Sat Feb 19 09:56:18 2011 +0100 @@ -6,7 +6,7 @@ - + + + diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery-test-svg.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/jquery/jquery-test-svg.html Sat Feb 19 09:56:18 2011 +0100 @@ -0,0 +1,43 @@ + + + + + jQuery.digilibSVG test + + + + + + + + + + + + + + + + + + +
+ +
+
DEBUG
+ + + diff -r 292b2948533f -r eb2473a5908b client/digitallibrary/jquery/jquery.digilib.birdseye.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/jquery/jquery.digilib.birdseye.js Sat Feb 19 09:56:18 2011 +0100 @@ -0,0 +1,323 @@ +/** +digilib bird's eye view plugin + */ + +(function($) { + + // affine geometry plugin stub + var geom; + + var FULL_AREA; + + var buttons = { + bird : { + onclick : "showBirdDiv", + tooltip : "show bird's eye view", + icon : "birds-eye.png" + } + }; + + var defaults = { + // is birdView shown? + 'isBirdDivVisible' : false, + // dimensions of bird's eye div + 'birdDivWidth' : 200, + 'birdDivHeight' : 200, + // parameters used by bird's eye div + 'birdDivParams' : ['fn','pn','dw','dh'] + }; + + var actions = { + // event handler: toggles the visibility of the bird's eye window + showBirdDiv : function (data, show) { + var settings = data.settings; + if (data.$birdDiv == null) { + // no bird div -> create + setupBirdDiv(data); + } + var on = digilib.fn.showDiv(settings.isBirdDivVisible, data.$birdDiv, show); + settings.isBirdDivVisible = on; + digilib.fn.highlightButtons(data, 'bird', on); + updateBirdDiv(data); + digilib.fn.storeOptions(data); + } + }; + + // plugin installation called by digilib on plugin object. + var install = function(digilib) { + // import geometry classes + geom = digilib.fn.geometry; + FULL_AREA = geom.rectangle(0,0,1,1); + // add defaults + $.extend(digilib.defaults, defaults); + // add actions + $.extend(digilib.actions, actions); + // add buttons + $.extend(digilib.buttons, buttons); + // insert in button list -- not elegant + digilib.defaults.buttonSettings.fullscreen.standardSet.splice(9, 0, 'bird'); + digilib.defaults.buttonSettings.embedded.standardSet.splice(5, 0, 'bird'); + }; + + // plugin initialization + var init = function (data) { + var $data = $(data); + // install event handler + $data.bind('setup', handleSetup); + $data.bind('update', handleUpdate); + $data.bind('redisplay', handleRedisplay); + $data.bind('dragZoom', handleDragZoom); + }; + + + var handleSetup = function (evt) { + console.debug("birdseye: handleSetup"); + data = this; + // bird's eye view creation + if (data.settings.isBirdDivVisible) { + setupBirdDiv(data); + data.$birdDiv.show(); + } + }; + + var handleUpdate = function (evt) { + console.debug("birdseye: handleUpdate"); + data = this; + if (data.settings.isBirdDivVisible) { + renderBirdArea(data); + setupBirdDrag(data); + } + }; + + var handleRedisplay = function (evt) { + console.debug("birdseye: handleRedisplay"); + data = this; + if (data.settings.isBirdDivVisible) { + updateBirdDiv(data); + } + }; + + var handleDragZoom = function (evt, zoomArea) { + //console.debug("birdseye: handleDragZoom za="+zoomArea); + data = this; + if (data.settings.isBirdDivVisible) { + setBirdZoom(data, zoomArea); + } + }; + + // returns URL for bird's eye view image + var getBirdImgUrl = function (data) { + var settings = data.settings; + var birdDivOptions = { + dw : settings.birdDivWidth, + dh : settings.birdDivHeight + }; + var birdSettings = $.extend({}, settings, birdDivOptions); + // use only the relevant parameters + var params = digilib.fn.getParamString(birdSettings, settings.birdDivParams, digilib.defaults); + var url = settings.scalerBaseUrl + '?' + params; + return url; + }; + + // creates HTML structure for the bird's eye view in elem + var setupBirdDiv = function (data) { + var $elem = data.$elem; + // the bird's eye div + var $birdDiv = $('