version 1.6, 2005/11/08 10:13:31
|
version 1.11, 2011/07/26 18:10:24
|
Line 17 Foundation, Inc., 59 Temple Place - Suit
|
Line 17 Foundation, Inc., 59 Temple Place - Suit
|
Authors: |
Authors: |
Christian Luginbuehl, 01.05.2003 (first version) |
Christian Luginbuehl, 01.05.2003 (first version) |
DW 24.03.2004 (Changed for digiLib in Zope) |
DW 24.03.2004 (Changed for digiLib in Zope) |
Robert Casties, 2.11.2004 |
Robert Casties, 14.7.2006 |
|
|
! Requires baselib.js ! |
! Requires baselib.js ! |
|
|
Line 178 function bestPicSize(elem, inset) {
|
Line 178 function bestPicSize(elem, inset) {
|
inset = 25; |
inset = 25; |
} |
} |
var ws = getWinSize(); |
var ws = getWinSize(); |
|
var wsold = ws.copy(); |
var es = getElementPosition(elem); |
var es = getElementPosition(elem); |
if (es) { |
if (es) { |
|
if ((es.x > ws.width)||(es.y > ws.height)) { |
|
alert("es="+es+" is outside ws="+ws+" fixing..."); |
|
ws.width = ws.width - inset; |
|
ws.height = ws.height - inset; |
|
} else { |
ws.width = ws.width - es.x - inset; |
ws.width = ws.width - es.x - inset; |
ws.height = ws.height - es.y - inset; |
ws.height = ws.height - es.y - inset; |
} |
} |
|
} |
|
//alert("ws="+wsold+" es="+es+" -> ws="+ws); |
|
//alert("ws="+ws+"("+typeof(ws)+") es="+es); |
return ws; |
return ws; |
} |
} |
|
|
function setDLParam(e, s) { |
function setDLParam(e, s, relative) { |
// sets parameter based on HTML event |
// sets parameter based on HTML event |
var nam; |
var nam; |
var val; |
var val; |
Line 198 function setDLParam(e, s) {
|
Line 207 function setDLParam(e, s) {
|
val = s.value; |
val = s.value; |
} |
} |
if (nam && val) { |
if (nam && val) { |
setParameter(nam, val); |
setParameter(nam, val, relative); |
display(); |
display(); |
} else { |
} else { |
alert("unable to process event!"); |
alert("ERROR: unable to process event!"); |
} |
} |
return true; |
return true; |
} |
} |
Line 217 function dl_param_init() {
|
Line 226 function dl_param_init() {
|
if (!baseScriptVersion) { |
if (!baseScriptVersion) { |
base_init(); |
base_init(); |
} |
} |
dlScriptVersion = "1.1b"; |
dlScriptVersion = "1.3a"; |
dlArea = new Rectangle(0.0, 0.0, 1.0, 1.0); |
dlArea = new Rectangle(0.0, 0.0, 1.0, 1.0); |
dlMaxArea = new Rectangle(0.0, 0.0, 1.0, 1.0); |
dlMaxArea = new Rectangle(0.0, 0.0, 1.0, 1.0); |
dlTrafo = new Transform(); |
dlTrafo = new Transform(); |
Line 228 function dl_param_init() {
|
Line 237 function dl_param_init() {
|
ZOOMFACTOR = Math.sqrt(2); |
ZOOMFACTOR = Math.sqrt(2); |
|
|
// put the query parameters (sans "?") in the parameters array |
// put the query parameters (sans "?") in the parameters array |
parseParameters(location.search.slice(1)); |
// non-digilib parameters get detail level 32 |
|
parseParameters(location.search.slice(1),32); |
// treat special parameters |
// treat special parameters |
dlMarks = parseMarks(); |
dlMarks = parseMarks(); |
dlArea = parseArea(); |
dlArea = parseArea(); |
dlFlags = parseFlags(); |
dlFlags = parseFlags(); |
|
// mask for parameters when creating new URL |
|
dlUrlParamMask = 255; |
} |
} |
|
|
|
|
Line 258 function dl_init() {
|
Line 270 function dl_init() {
|
window.name = "digilib"; |
window.name = "digilib"; |
} |
} |
// put the query parameters (sans "?") in the parameters array |
// put the query parameters (sans "?") in the parameters array |
parseParameters(location.search.slice(1)); |
//parseParameters(location.search.slice(1),32); |
// treat special parameters |
// treat special parameters |
dlMarks = parseMarks(); |
dlMarks = parseMarks(); |
dlArea = parseArea(); |
dlArea = parseArea(); |
Line 274 function dl_init() {
|
Line 286 function dl_init() {
|
function display(detail) { |
function display(detail) { |
// redisplay the page |
// redisplay the page |
if (! detail) { |
if (! detail) { |
detail = 9; |
detail = 255; |
} |
} |
var queryString = getAllParameters(detail); |
var queryString = getAllParameters(detail & dlUrlParamMask); |
location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; |
location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; |
} |
} |
|
|
Line 460 function zoomFullpage() {
|
Line 472 function zoomFullpage() {
|
function moveCenter() { |
function moveCenter() { |
// move visible area so that it's centered around the clicked point |
// move visible area so that it's centered around the clicked point |
if ( (dlArea.width == 1.0) && (dlArea.height == 1.0) ) { |
if ( (dlArea.width == 1.0) && (dlArea.height == 1.0) ) { |
// noting to do |
// nothing to do |
return; |
return; |
} |
} |
window.focus(); |
window.focus(); |
Line 503 function getRef() {
|
Line 515 function getRef() {
|
var baseUrl = location.protocol + "//" + location.host + location.pathname; |
var baseUrl = location.protocol + "//" + location.host + location.pathname; |
} |
} |
var hyperlinkRef = baseUrl; |
var hyperlinkRef = baseUrl; |
var par = getAllParameters(9); |
var par = getAllParameters((7+32+64) & dlUrlParamMask); // all without ddpi, pt |
if (par.length > 0) { |
if (par.length > 0) { |
hyperlinkRef += "?" + par; |
hyperlinkRef += "?" + par; |
} |
} |
Line 563 function mirror(dir) {
|
Line 575 function mirror(dir) {
|
display(); |
display(); |
} |
} |
|
|
function gotoPage(gopage) { |
function gotoPage(gopage, keep) { |
// goto given page nr (+/- relative) |
// goto given page nr (+/-: relative) |
setParameter("pn", gopage); |
var oldpn = parseInt(getParameter("pn")); |
|
setParameter("pn", gopage, true); |
var pn = parseInt(getParameter("pn")); |
var pn = parseInt(getParameter("pn")); |
if (pn < 1) { |
if (pn < 1) { |
pn = 1; |
alert("No such page! (Page number too low)"); |
setParameter("pn", pn); |
setParameter("pn", oldpn); |
|
return; |
|
} |
|
if (hasParameter("pt")) { |
|
pt = parseInt(getParameter("pt")) |
|
if (pn > pt) { |
|
alert("No such page! (Page number too high)"); |
|
setParameter("pn", oldpn); |
|
return; |
|
} |
|
} |
|
if (keep) { |
|
display(63+128); // all, no mark |
|
} else { |
|
display(3+32+128); // fn, pn, ws, mo + pt |
} |
} |
// TODO: check for last page |
|
display(1); |
|
} |
} |
|
|
function gotoPageWin() { |
function gotoPageWin() { |
// dialog to ask for new page nr |
// dialog to ask for new page nr |
var pn = getParameter('pn'); |
var pn = getParameter("pn"); |
var gopage = window.prompt("Go to page", pn); |
var gopage = window.prompt("Go to page", pn); |
if (gopage) { |
if (gopage) { |
gotoPage(gopage); |
gotoPage(gopage); |
} |
} |
} |
} |
|
|
function setParamWin(param, text) { |
function setParamWin(param, text, relative) { |
// dialog to ask for new parameter value |
// dialog to ask for new parameter value |
var val = getParameter(param); |
var val = getParameter(param); |
var newval = window.prompt(text, val); |
var newval = window.prompt(text, val); |
if (newval) { |
if (newval) { |
setParameter(param, newval); |
setParameter(param, newval, relative); |
display(); |
display(); |
} |
} |
} |
} |
Line 599 function showOptions(show) {
|
Line 624 function showOptions(show) {
|
var elem = getElement("dloptions"); |
var elem = getElement("dloptions"); |
showElement(elem, show); |
showElement(elem, show); |
} |
} |
|
|
|
|
|
function toggleOptions() { |
|
// toggle option div |
|
var elem = getElement("dloptions"); |
|
showOptions(! isElementVisible(elem)); |
|
} |