Mercurial > hg > digilib-old
changeset 134:1a0496201c75
unified scripts, nice xul sidebar, bugfixes
author | luginbue |
---|---|
date | Tue, 08 Jul 2003 03:00:57 +0200 |
parents | 28f96364040f |
children | 68e88c3bc575 |
files | client/digitallibrary/modules/fitGIFs.js client/digitallibrary/modules/pagesTotal.js |
diffstat | 2 files changed, 84 insertions(+), 113 deletions(-) [+] |
line wrap: on
line diff
--- a/client/digitallibrary/modules/fitGIFs.js Tue Jul 08 03:00:57 2003 +0200 +++ b/client/digitallibrary/modules/fitGIFs.js Tue Jul 08 03:00:57 2003 +0200 @@ -1,4 +1,5 @@ /* + Copyright (C) 2003 WTWG, Uni Bern This program is free software; you can redistribute it and/or @@ -15,14 +16,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3 +Author: Christian Luginbuehl, 22.05.2003 , Version Alcatraz 0.4 + */ -/**************************************************************************** - * - fitGIFs module for digilib * - * * - * christian luginbuehl (luginbuehl@student.unibe.ch) * - ****************************************************************************/ +/************************************************************************* + * fitGIFs.js : digilib-module * + * * + * desc: enable od disable the fitting of GIF/PNG images to the * + * drawing area. + * * + *************************************************************************/ /** @@ -30,25 +34,25 @@ */ function fitGIFs() { - if (att.mo != "") { + if ( dlParams.mo.value != '' ) { - idx_plus_after = att.mo.indexOf("fit,"); - idx_plus_before = att.mo.indexOf(",fit"); - idx_noplus = att.mo.indexOf("fit"); + idx_plus_after = dlParams.mo.value.indexOf("fit,"); + idx_plus_before = dlParams.mo.value.indexOf(",fit"); + idx_noplus = dlParams.mo.value.indexOf("fit"); - if (idx_plus_after > -1) { - att.mo = att.mo.slice(0, idx_plus_after) + att.mo.slice(idx_plus_after+5); - } else if (idx_plus_before > -1) { - att.mo = att.mo.slice(0, idx_plus_before) + att.mo.slice(idx_plus_before+5); - } else if (idx_noplus > -1) { - att.mo = att.mo.slice(0, idx_noplus) + att.mo.slice(idx_noplus+4); + if ( idx_plus_after > -1 ) { + dlParams.mo.value = dlParams.mo.value.slice(0, idx_plus_after) + dlParams.mo.value.slice(idx_plus_after+5); + } else if ( idx_plus_before > -1 ) { + dlParams.mo.value = dlParams.mo.value.slice(0, idx_plus_before) + dlParams.mo.value.slice(idx_plus_before+5); + } else if ( idx_noplus > -1 ) { + dlParams.mo.value = dlParams.mo.value.slice(0, idx_noplus) + dlParams.mo.value.slice(idx_noplus+4); } else { - att.mo += ",fit"; + dlParams.mo.value += ",fit"; } } else { - att.mo = "fit"; + dlParams.mo.value = "fit"; } - loadPicture(2); + display(3); -} +} \ No newline at end of file
--- a/client/digitallibrary/modules/pagesTotal.js Tue Jul 08 03:00:57 2003 +0200 +++ b/client/digitallibrary/modules/pagesTotal.js Tue Jul 08 03:00:57 2003 +0200 @@ -1,4 +1,5 @@ /* + Copyright (C) 2003 WTWG, Uni Bern This program is free software; you can redistribute it and/or @@ -15,118 +16,84 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3 +Author: Christian Luginbuehl, 22.05.2003 , Version Alcatraz 0.4 + */ -/**************************************************************************** - * - sample module for digilib * - * * - * christian luginbuehl (luginbuehl@student.unibe.ch) * - ****************************************************************************/ - -// overriding (some kind of inheriting) init in navigation13_XX.js -function init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt) { - // debug window to check the parameters passed - //alert ("DEBUG message (parameters in init pagesTotal.js):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh + "\npt = " + pt); - - // calling original init - init(pu, pn, ws, mo, mk, wx, wy, ww, wh); - - att.pt = parseInt(pt); - - pagesTotal(); - - focus(); -} +/************************************************************************* + * pagesTotal.js : digilib-module * + * * + * desc: displaying the total number of pages in a designated frame, * + * when calling pagesTotal(). also overrides nextPage() and * + * page() functions, by adding last-page tests. * + * * + *************************************************************************/ /** - * shows page XX of YY in a dedicated frame - * - * ATTENTION: some stuff is still to do, because of some incompatibilities between servlet and client - * i should be able to read the total number of pages in dlImage.jsp + * shows 'page XX of YY' in a designated frame */ -function pagesTotal() { +function showTotalPages() { + + var pf = parent.pageFrame; - if (parent.pageFrame) { - parent.pageFrame.document.open(); - parent.pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">'); - parent.pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">'); - parent.pageFrame.document.write(att.pn + '<b> of </b>' + att.pt + '</p></body></html>'); - parent.pageFrame.document.close(); - } + if ( pf ) { + pf.document.open(); + pf.document.write('<html><head></head>'); + pf.document.write('<body bgcolor="#CCCCCC" topmargin="5" marginheight="5">'); + pf.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">'); + pf.document.write(dlParams.pn.value + '<b> of </b>' + dlParams.pt.value + '</p></body></html>'); + pf.document.close(); + } + } /** - * overriding nextPage in navigation + * extending init from novaigation.js */ -function nextPage(keepArea) { - - att.pn = parseInt(att.pn) + 1; - - if (att.pn <= att.pt || isNaN(att.pt)) { - loadPicture(0, keepArea); - } else { - att.pn = parseInt(att.pn) - 1; - alert("You are already on the last page!"); - } -} - +function init_pagesTotal() { -/** - * overriding 'page' in navigation - */ -function page(keepArea) { + init(); + + showTotalPages(); - do { - var page = prompt("Goto Page (1 - " + att.pt + "):", 1); - - } while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att.pt))); - - if ((page != null) && (page != att.pn)) { - att.pn = page; - loadPicture(0, keepArea); - } } /** - * overriding 'loadPicture' in navigation + * overriding 'page' in navigation.js */ -function loadPicture(detailGrade, keepArea) { +function page(page, details) { - // the different detailGrades: - // 0 -> back, next, page - // 1 -> zoomout - // 2 -> zoomarea, zoompoint, moveto, scaledef - - var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo; - - if (detailGrade == 0) { - att.mk = "0/0"; - } + if ( details == null ) { + details = 1; + } + + if ( page && page.indexOf('-') == 0 ) { + if ( dlParams.pn.value > 1 ) { + page = Math.max(parseInt(dlParams.pn.value) - parseInt(page.slice(1)), 1); + dlParams.pn.value = page; + display(details); + } else { + alert("You are already on the first page!"); + } - if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) { - att.wx = 0; - att.wy = 0; - att.ww = 1; - att.wh = 1; - } - - newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh; + } else if ( page && page.indexOf('+') == 0 ) { + if ( parseInt(dlParams.pn.value) < parseInt(dlParams.pt.value) ) { + page = Math.min(parseInt(dlParams.pn.value) + parseInt(page.slice(1)), dlParams.pt.value); + dlParams.pn.value = page; + display(details); + } else { + alert("You are already on the last page!"); + } + } else if ( page && page == parseInt(page) ) { + if ( (page > 0) && (page <= parseInt(dlParams.pt.value)) ) { + dlParams.pn.value = parseInt(page); + display(details); + } else { + alert ("Illegal page number (1 - " + dlParams.pt.value + ")!"); + } + } - if (navigator.appName.toLowerCase() == "netscape") { // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.) - newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30); - } else { // ie, opera - newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30); - } - - newQuery += "&pt=" + att.pt; - newQuery += "&lv=1"; - - // debug window - checking the parameters passed to the next image - //alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery); - - location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery; -} +} \ No newline at end of file