# HG changeset patch # User robcast # Date 1295008716 -3600 # Node ID 435f81210a33e1a73f1a17aba3f848e24b54f714 # Parent 774a3f60efd595284afb4125416399b580089c43 start work on scaler call diff -r 774a3f60efd5 -r 435f81210a33 client/digitallibrary/jquery/jquery-test-full.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/jquery/jquery-test-full.html Fri Jan 14 13:38:36 2011 +0100 @@ -0,0 +1,45 @@ + + + + + Digilib jQuery Test HTML + + + + + + + + + + + + + +
+ +
+ + + diff -r 774a3f60efd5 -r 435f81210a33 client/digitallibrary/jquery/jquery-test.html --- a/client/digitallibrary/jquery/jquery-test.html Fri Jan 14 11:23:56 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ - - - - - Digilib jQuery Test HTML - - - - - - - - - - - - -
- -
-
- -
-
- -
-
- -
- - - diff -r 774a3f60efd5 -r 435f81210a33 client/digitallibrary/jquery/jquery.digilib.js --- a/client/digitallibrary/jquery/jquery.digilib.js Fri Jan 14 11:23:56 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Fri Jan 14 13:38:36 2011 +0100 @@ -9,9 +9,8 @@ // base URL to Scaler servlet 'scalerBaseUrl' : 'http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler', // list of Scaler parameters - 'scalerParamNames' : ['fn','pn','dw','dh','ww','wh','wx','wy','ws','mo'], - // digilib image path - 'fn' : '', + 'scalerParamNames' : ['fn','pn','dw','dh','ww','wh','wx','wy','ws','mo', + 'rot','cont','brgt','rgbm','rgba','ddpi','ddpix','ddpiy'], // mode of operation. // fullscreen: takes parameters from page URL, keeps state in page URL // embedded: takes parameters from Javascript options, keeps state inside object @@ -81,7 +80,7 @@ var query = (pos < 0) ? '' : src.substring(pos + 1); var scalerUrl = src.substring(0, pos); var hash = parseQueryString(query); - hash.scalerUrl = scalerUrl; + hash.scalerBaseUrl = scalerUrl; // console.log(hash); return hash; }; @@ -101,18 +100,54 @@ // returns URL and query string for Scaler var getScalerString = function (settings) { - var url = settings.scalerUrl; - + var url = settings.scalerBaseUrl + '?'; + var i, parm, latter; + // go through param names and get values from settings + for (i = 0; i < settings.scalerParamNames.length; ++i) { + parm = settings.scalerParamNames[i]; + if (settings[parm]) { + // first parm gets no '&' + url += latter ? '&' : ''; + latter = 1; + // add parm=val + url += parm + '=' + settings[parm]; + } + } + return url; + }; + + // returns maximum size for scaler img in fullscreen mode + var getFullscreenImgSize = function($elem) { + var winH = $(window).height(); + var winW = $(window).width(); + // TODO: account for borders? + return geom.size(winW, winH); }; // creates HTML structure for digilib in elem var setupScalerDiv = function ($elem, settings) { if (settings.interactionMode === 'fullscreen') { - // fullscreen -- create new + // fullscreen + var imgSize = getFullscreenImgSize($elem); + settings.dw = imgSize.width; + settings.dh = imgSize.height; + // create new html $elem.empty(); // TODO: should we keep stuff for customization? + var scalerUrl = getScalerString(settings); var scalerHTML = '
'; - $elem.add(scalerHTML); - + $elem.append(scalerHTML); + var $img = $elem.find("img.pic"); + $img.attr('src', scalerUrl); + //$img.load(scalerImgLoaded); + } else { + // embedded mode -- keep inner img + var $img = $elem.detach('img'); + $elem.empty(); // TODO: should we keep stuff for customization? + $img.addClass('pic'); + var $scaler = $('
'); + $scaler.append($img); + $elem.append($scaler); + //$img.load(scalerImgLoaded); } };