Mercurial > hg > digilib-old
changeset 34:84a481a388bb
first update of new client-version
author | luginbue |
---|---|
date | Thu, 21 Feb 2002 02:27:06 +0100 |
parents | 054ebc851059 |
children | aa19a358e58e |
files | client/digitallibrary/buttons/fw_menu.js client/digitallibrary/digilib.jsp client/digitallibrary/navcat_ie.js client/digitallibrary/navcat_n4.js client/digitallibrary/navcat_n6.js client/digitallibrary/navigation_ie.js client/digitallibrary/navigation_n4.js client/digitallibrary/navigation_n6.js |
diffstat | 8 files changed, 487 insertions(+), 1535 deletions(-) [+] |
line wrap: on
line diff
--- a/client/digitallibrary/buttons/fw_menu.js Thu Feb 21 02:27:06 2002 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,744 +0,0 @@ -/* fw_menu -- JS library for digilib buttons - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh) { - this.version = "990702 [Menu; menu.js]"; - this.type = "Menu"; - this.menuWidth = mw; - this.menuItemHeight = mh; - this.fontSize = fs||12; - this.fontWeight = "plain"; - this.fontFamily = fnt||"arial,helvetica,verdana,sans-serif"; - this.fontColor = fclr||"#000000"; - this.fontColorHilite = fhclr||"#ffffff"; - this.bgColor = "#555555"; - this.menuBorder = 1; - this.menuItemBorder = 1; - this.menuItemBgColor = bg||"#cccccc"; - this.menuLiteBgColor = "#ffffff"; - this.menuBorderBgColor = "#777777"; - this.menuHiliteBgColor = bgh||"#000084"; - this.menuContainerBgColor = "#cccccc"; - this.childMenuIcon = "arrows.gif"; - this.items = new Array(); - this.actions = new Array(); - this.childMenus = new Array(); - - this.hideOnMouseOut = true; - - this.addMenuItem = addMenuItem; - this.addMenuSeparator = addMenuSeparator; - this.writeMenus = writeMenus; - this.FW_showMenu = FW_showMenu; - this.onMenuItemOver = onMenuItemOver; - this.onMenuItemAction = onMenuItemAction; - this.hideMenu = hideMenu; - this.hideChildMenu = hideChildMenu; - - if (!window.menus) window.menus = new Array(); - this.label = label || "menuLabel" + window.menus.length; - window.menus[this.label] = this; - window.menus[window.menus.length] = this; - if (!window.activeMenus) window.activeMenus = new Array(); -} - -function addMenuItem(label, action) { - this.items[this.items.length] = label; - this.actions[this.actions.length] = action; -} - -function addMenuSeparator() { - this.items[this.items.length] = "separator"; - this.actions[this.actions.length] = ""; - this.menuItemBorder = 0; -} - -// For NS6. -function FIND(item) { - if (document.all) return(document.all[item]); - if (document.getElementById) return(document.getElementById(item)); - return(false); -} - -function writeMenus(container) { - if (window.triedToWriteMenus) return; - - if (!container && document.layers) { - window.delayWriteMenus = this.writeMenus; - var timer = setTimeout('delayWriteMenus()', 250); - container = new Layer(100); - clearTimeout(timer); - } else if (document.all || document.hasChildNodes) { - document.writeln('<SPAN ID="menuContainer"></SPAN>'); - container = FIND("menuContainer"); - } - - window.fwHideMenuTimer = null; - if (!container) return; - window.triedToWriteMenus = true; - container.isContainer = true; - container.menus = new Array(); - for (var i=0; i<window.menus.length; i++) - container.menus[i] = window.menus[i]; - window.menus.length = 0; - var countMenus = 0; - var countItems = 0; - var top = 0; - var content = ''; - var lrs = false; - var theStat = ""; - var tsc = 0; - if (document.layers) lrs = true; - for (var i=0; i<container.menus.length; i++, countMenus++) { - var menu = container.menus[i]; - if (menu.bgImageUp) { - menu.menuBorder = 0; - menu.menuItemBorder = 0; - } - if (lrs) { - var menuLayer = new Layer(100, container); - var lite = new Layer(100, menuLayer); - lite.top = menu.menuBorder; - lite.left = menu.menuBorder; - var body = new Layer(100, lite); - body.top = menu.menuBorder; - body.left = menu.menuBorder; - } else { - content += ''+ - '<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;z-index:1;left:10;top:'+ (i * 100) +';visibility:hidden;">\n'+ - ' <DIV ID="menuLite'+ countMenus +'" STYLE="position:absolute;z-index:1;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;" onMouseOut="mouseoutMenu();">\n'+ - ' <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;">\n'+ - ''; - } - var x=i; - for (var i=0; i<menu.items.length; i++) { - var item = menu.items[i]; - var childMenu = false; - var defaultHeight = menu.fontSize+6; - var defaultIndent = menu.fontSize; - if (item.label) { - item = item.label; - childMenu = true; - } - menu.menuItemHeight = menu.menuItemHeight || defaultHeight; - menu.menuItemIndent = menu.menuItemIndent || defaultIndent; - var itemProps = 'font-family:' + menu.fontFamily +';font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + ';'; - if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';'; - if (document.all) - itemProps += 'font-size:' + menu.fontSize + ';" onMouseOver="onMenuItemOver(null,this);" onClick="onMenuItemAction(null,this);'; - else if (!document.layers) { - itemProps += 'font-size:' + menu.fontSize + 'px;'; // zilla wants 12px. - } - var l; - if (lrs) { - l = new Layer(800,body); - } - var dTag = '<DIV ID="menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">'; - var dClose = '</DIV>' - if (menu.bgImageUp) { - menu.menuBorder = 0; - menu.menuItemBorder = 0; - dTag = '<DIV ID="menuItem'+ countItems +'" STYLE="background:url('+menu.bgImageUp+');position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">'; - if (document.layers) { - dTag = '<LAYER BACKGROUND="'+menu.bgImageUp+'" ID="menuItem'+ countItems +'" TOP="'+ (i * menu.menuItemHeight) +'" style="' + itemProps +'">'; - dClose = '</LAYER>'; - } - } - var textProps = 'position:absolute;left:' + menu.menuItemIndent + ';top:1;'; - if (lrs) { - textProps +=itemProps; - dTag = ""; - dClose = ""; - } - - var dText = '<DIV ID="menuItemText'+ countItems +'" STYLE="' + textProps + 'color:'+ menu.fontColor +';">'+ item +' </DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="' + textProps + 'top:1;color:'+ menu.fontColorHilite +';visibility:hidden;">'+ item +' </DIV>'; - if (item == "separator") { - content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n' + dClose); - } else if (childMenu) { - content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;"><IMG SRC="'+ menu.childMenuIcon +'"></DIV>\n' + dClose); - } else { - content += ( dTag + dText + dClose); - } - if (lrs) { - l.document.open("text/html"); - l.document.writeln(content); - l.document.close(); - content = ''; - theStat += "-"; - tsc++; - if (tsc > 50) { - tsc = 0; - theStat = ""; - } - status = theStat; - } - countItems++; - } - if (lrs) { - // focus layer - var focusItem = new Layer(100, body); - focusItem.visiblity="hidden"; - focusItem.document.open("text/html"); - focusItem.document.writeln(" "); - focusItem.document.close(); - } else { - content += ' <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);"> </DIV>\n'; - content += ' </DIV>\n </DIV>\n</DIV>\n'; - } - i=x; - } - if (document.layers) { - container.clip.width = window.innerWidth; - container.clip.height = window.innerHeight; - container.onmouseout = mouseoutMenu; - container.menuContainerBgColor = this.menuContainerBgColor; - for (var i=0; i<container.document.layers.length; i++) { - proto = container.menus[i]; - var menu = container.document.layers[i]; - container.menus[i].menuLayer = menu; - container.menus[i].menuLayer.Menu = container.menus[i]; - container.menus[i].menuLayer.Menu.container = container; - var body = menu.document.layers[0].document.layers[0]; - body.clip.width = proto.menuWidth || body.clip.width; - body.clip.height = proto.menuHeight || body.clip.height; - for (var n=0; n<body.document.layers.length-1; n++) { - var l = body.document.layers[n]; - l.Menu = container.menus[i]; - l.menuHiliteBgColor = proto.menuHiliteBgColor; - l.document.bgColor = proto.menuItemBgColor; - l.saveColor = proto.menuItemBgColor; - l.onmouseover = proto.onMenuItemOver; - l.onclick = proto.onMenuItemAction; - l.action = container.menus[i].actions[n]; - l.focusItem = body.document.layers[body.document.layers.length-1]; - l.clip.width = proto.menuWidth || body.clip.width + proto.menuItemIndent; - l.clip.height = proto.menuItemHeight || l.clip.height; - if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder; - l.hilite = l.document.layers[1]; - if (proto.bgImageUp) l.background.src = proto.bgImageUp; - l.document.layers[1].isHilite = true; - if (l.document.layers[0].id.indexOf("menuSeparator") != -1) { - l.hilite = null; - l.clip.height -= l.clip.height / 2; - l.document.layers[0].document.bgColor = proto.bgColor; - l.document.layers[0].clip.width = l.clip.width -2; - l.document.layers[0].clip.height = 1; - l.document.layers[1].document.bgColor = proto.menuLiteBgColor; - l.document.layers[1].clip.width = l.clip.width -2; - l.document.layers[1].clip.height = 1; - l.document.layers[1].top = l.document.layers[0].top + 1; - } else if (l.document.layers.length > 2) { - l.childMenu = container.menus[i].items[n].menuLayer; - l.document.layers[2].left = l.clip.width -13; - l.document.layers[2].top = (l.clip.height / 2) -4; - l.document.layers[2].clip.left += 3; - l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu; - } - } - body.document.bgColor = proto.bgColor; - body.clip.width = l.clip.width +proto.menuBorder; - body.clip.height = l.top + l.clip.height +proto.menuBorder; - var focusItem = body.document.layers[n]; - focusItem.clip.width = body.clip.width; - focusItem.Menu = l.Menu; - focusItem.top = -30; - focusItem.captureEvents(Event.MOUSEDOWN); - focusItem.onmousedown = onMenuItemDown; - menu.document.bgColor = proto.menuBorderBgColor; - var lite = menu.document.layers[0]; - lite.document.bgColor = proto.menuLiteBgColor; - lite.clip.width = body.clip.width +1; - lite.clip.height = body.clip.height +1; - menu.clip.width = body.clip.width + (proto.menuBorder * 3) ; - menu.clip.height = body.clip.height + (proto.menuBorder * 3); - } - } else { - if ((!document.all) && (container.hasChildNodes)) { - container.innerHTML=content; - } else { - container.document.open("text/html"); - container.document.writeln(content); - container.document.close(); - } - if (!FIND("menuLayer0")) return; - var menuCount = 0; - for (var x=0; x<container.menus.length; x++) { - var menuLayer = FIND("menuLayer" + x); - container.menus[x].menuLayer = "menuLayer" + x; - menuLayer.Menu = container.menus[x]; - menuLayer.Menu.container = "menuLayer" + x; - menuLayer.style.zIndex = 1; - var s = menuLayer.style; - s.top = s.pixelTop = -300; - s.left = s.pixelLeft = -300; - - var menu = container.menus[x]; - menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140; - menuLayer.style.backgroundColor = menu.menuBorderBgColor; - var top = 0; - for (var i=0; i<container.menus[x].items.length; i++) { - var l = FIND("menuItem" + menuCount); - l.Menu = container.menus[x]; - if (l.addEventListener) { // ns6 - l.style.width = menu.menuItemWidth; - l.style.height = menu.menuItemHeight; - l.style.top = top; - l.addEventListener("mouseover", onMenuItemOver, false); - l.addEventListener("click", onMenuItemAction, false); - l.addEventListener("mouseout", mouseoutMenu, false); - } else { //ie - l.style.pixelWidth = menu.menuItemWidth; - l.style.pixelHeight = menu.menuItemHeight; - l.style.pixelTop = top; - } - top = top + menu.menuItemHeight+menu.menuItemBorder; - l.style.fontSize = menu.fontSize; - l.style.backgroundColor = menu.menuItemBgColor; - l.style.visibility = "inherit"; - l.saveColor = menu.menuItemBgColor; - l.menuHiliteBgColor = menu.menuHiliteBgColor; - l.action = container.menus[x].actions[i]; - l.hilite = FIND("menuItemHilite" + menuCount); - l.focusItem = FIND("focusItem" + x); - l.focusItem.style.pixelTop = l.focusItem.style.top = -30; - var childItem = FIND("childMenu" + menuCount); - if (childItem) { - l.childMenu = container.menus[x].items[i].menuLayer; - childItem.style.pixelLeft = childItem.style.left = menu.menuItemWidth -11; - childItem.style.pixelTop = childItem.style.top =(menu.menuItemHeight /2) -4; - //childItem.style.pixelWidth = 30 || 7; - //childItem.style.clip = "rect(0 7 7 3)"; - l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu; - } - var sep = FIND("menuSeparator" + menuCount); - if (sep) { - sep.style.clip = "rect(0 " + (menu.menuItemWidth - 3) + " 1 0)"; - sep.style.width = sep.style.pixelWidth = menu.menuItemWidth; - sep.style.backgroundColor = menu.bgColor; - sep = FIND("menuSeparatorLite" + menuCount); - sep.style.clip = "rect(1 " + (menu.menuItemWidth - 3) + " 2 0)"; - sep.style.width = sep.style.pixelWidth = menu.menuItemWidth; - sep.style.backgroundColor = menu.menuLiteBgColor; - l.style.height = l.style.pixelHeight = menu.menuItemHeight/2; - l.isSeparator = true - top -= (menu.menuItemHeight - l.style.pixelHeight) - } else { - l.style.cursor = "hand" - } - menuCount++; - } - menu.menuHeight = top-1; - var lite = FIND("menuLite" + x); - var s = lite.style; - s.height = s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2); - s.width = s.pixelWidth = menu.menuItemWidth + (menu.menuBorder * 2); - s.backgroundColor = menu.menuLiteBgColor; - - var body = FIND("menuFg" + x); - s = body.style; - s.height = s.pixelHeight = menu.menuHeight + menu.menuBorder; - s.width = s.pixelWidth = menu.menuItemWidth + menu.menuBorder; - s.backgroundColor = menu.bgColor; - - s = menuLayer.style; - s.width = s.pixelWidth = menu.menuItemWidth + (menu.menuBorder * 4); - s.height = s.pixelHeight = menu.menuHeight+(menu.menuBorder*4); - } - } - if (document.captureEvents) { - document.captureEvents(Event.MOUSEUP); - } - if (document.addEventListener) { - document.addEventListener("mouseup", onMenuItemOver, false); - } - if (document.layers && window.innerWidth) { - window.onresize = NS4resize; - window.NS4sIW = window.innerWidth; - window.NS4sIH = window.innerHeight; - } - document.onmouseup = mouseupMenu; - window.fwWroteMenu = true; - status = ""; -} - -function NS4resize() { - if (NS4sIW < window.innerWidth || - NS4sIW > window.innerWidth || - NS4sIH > window.innerHeight || - NS4sIH < window.innerHeight ) - { - window.location.reload(); - } -} - -function onMenuItemOver(e, l) { - FW_clearTimeout(); - l = l || this; - a = window.ActiveMenuItem; - if (document.layers) { - if (a) { - a.document.bgColor = a.saveColor; - if (a.hilite) a.hilite.visibility = "hidden"; - if (a.Menu.bgImageOver) { - a.background.src = a.Menu.bgImageUp; - } - a.focusItem.top = -100; - a.clicked = false; - } - if (l.hilite) { - l.document.bgColor = l.menuHiliteBgColor; - l.zIndex = 1; - l.hilite.visibility = "inherit"; - l.hilite.zIndex = 2; - l.document.layers[1].zIndex = 1; - l.focusItem.zIndex = this.zIndex +2; - } - if (l.Menu.bgImageOver) { - l.background.src = l.Menu.bgImageOver; - } - l.focusItem.top = this.top; - l.Menu.hideChildMenu(l); - } else if (l.style && l.Menu) { - if (a) { - a.style.backgroundColor = a.saveColor; - if (a.hilite) a.hilite.style.visibility = "hidden"; - if (a.Menu.bgImageUp) { - a.style.background = "url(" + a.Menu.bgImageUp +")";; - } - } - if (l.isSeparator) return; - l.style.backgroundColor = l.menuHiliteBgColor; - l.zIndex = 1; // magic IE 4.5 mac happy doohicky. jba - if (l.Menu.bgImageOver) { - l.style.background = "url(" + l.Menu.bgImageOver +")"; - } - if (l.hilite) { - l.style.backgroundColor = l.menuHiliteBgColor; - l.hilite.style.visibility = "inherit"; - } - l.focusItem.style.top = l.focusItem.style.pixelTop = l.style.pixelTop; - l.focusItem.style.zIndex = l.zIndex +1; - l.Menu.hideChildMenu(l); - } else { - return; // not a menu - magic IE 4.5 mac happy doohicky. jba - } - window.ActiveMenuItem = l; -} - -function onMenuItemAction(e, l) { - l = window.ActiveMenuItem; - // hier wird die action bei menuclick gemacht - if (!l) return; - hideActiveMenus(); - if (l.action) { - eval("" + l.action); - } - window.ActiveMenuItem = 0; -} - -function FW_clearTimeout() -{ - if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer); - fwHideMenuTimer = null; - fwDHFlag = false; -} -function FW_startTimeout() -{ - fwStart = new Date(); - fwDHFlag = true; - fwHideMenuTimer = setTimeout("FW_doHide()", 1000); -} - -function FW_doHide() -{ - if (!fwDHFlag) return; - var elapsed = new Date() - fwStart; - if (elapsed < 1000) { - fwHideMenuTimer = setTimeout("FW_doHide()", 1100-elapsed); - return; - } - fwDHFlag = false; - hideActiveMenus(); - window.ActiveMenuItem = 0; -} - -function FW_showMenu(menu, x, y, child) { - if (!window.fwWroteMenu) return; - FW_clearTimeout(); - if (document.layers) { - if (menu) { - var l = menu.menuLayer || menu; - l.left = 1; - l.top = 1; - hideActiveMenus(); - if (this.visibility) l = this; - window.ActiveMenu = l; - } else { - var l = child; - } - if (!l) return; - for (var i=0; i<l.layers.length; i++) { - if (!l.layers[i].isHilite) - l.layers[i].visibility = "inherit"; - if (l.layers[i].document.layers.length > 0) - FW_showMenu(null, "relative", "relative", l.layers[i]); - } - if (l.parentLayer) { - if (x != "relative") - l.parentLayer.left = x || window.pageX || 0; - if (l.parentLayer.left + l.clip.width > window.innerWidth) - l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth); - if (y != "relative") - l.parentLayer.top = y || window.pageY || 0; - if (l.parentLayer.isContainer) { - l.Menu.xOffset = window.pageXOffset; - l.Menu.yOffset = window.pageYOffset; - l.parentLayer.clip.width = window.ActiveMenu.clip.width +2; - l.parentLayer.clip.height = window.ActiveMenu.clip.height +2; - if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor; - } - } - l.visibility = "inherit"; - if (l.Menu) l.Menu.container.visibility = "inherit"; - } else if (FIND("menuItem0")) { - var l = menu.menuLayer || menu; - hideActiveMenus(); - if (typeof(l) == "string") { - l = FIND(l); - } - window.ActiveMenu = l; - var s = l.style; - s.visibility = "inherit"; - if (x != "relative") - s.left = s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0; - if (y != "relative") - s.top = s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0; - l.Menu.xOffset = document.body.scrollLeft; - l.Menu.yOffset = document.body.scrollTop; - } - if (menu) { - window.activeMenus[window.activeMenus.length] = l; - } -} - -function onMenuItemDown(e, l) { - var a = window.ActiveMenuItem; - if (document.layers) { - if (a) { - a.eX = e.pageX; - a.eY = e.pageY; - a.clicked = true; - } - } -} - -function mouseupMenu(e) -{ - hideMenu(true, e); - hideActiveMenus(); - return true; -} - -function mouseoutMenu() -{ - hideMenu(false, false); - return true; -} - - -function hideMenu(mouseup, e) { - var a = window.ActiveMenuItem; - if (a && document.layers) { - a.document.bgColor = a.saveColor; - a.focusItem.top = -30; - if (a.hilite) a.hilite.visibility = "hidden"; - if (mouseup && a.action && a.clicked && window.ActiveMenu) { - if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) { - setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2); - } - } - a.clicked = false; - if (a.Menu.bgImageOver) { - a.background.src = a.Menu.bgImageUp; - } - } else if (window.ActiveMenu && FIND("menuItem0")) { - if (a) { - a.style.backgroundColor = a.saveColor; - if (a.hilite) a.hilite.style.visibility = "hidden"; - if (a.Menu.bgImageUp) { - a.style.background = "url(" + a.Menu.bgImageUp +")";; - } - } - } - if (!mouseup && window.ActiveMenu) { - if (window.ActiveMenu.Menu) { - if (window.ActiveMenu.Menu.hideOnMouseOut) { - FW_startTimeout(); - } - return(true); - } - } - return(true); -} - -function PxToNum(pxStr) -{ // pxStr == 27px, we want 27. - if (pxStr.length > 2) { - n = Number(pxStr.substr(0, pxStr.length-2)); - return(n); - } - return(0); -} - -function hideChildMenu(hcmLayer) { - FW_clearTimeout(); - var l = hcmLayer; - for (var i=0; i < l.Menu.childMenus.length; i++) { - var theLayer = l.Menu.childMenus[i]; - if (document.layers) { - theLayer.visibility = "hidden"; - } else { - theLayer = FIND(theLayer); - theLayer.style.visibility = "hidden"; - } - theLayer.Menu.hideChildMenu(theLayer); - } - - if (l.childMenu) { - var childMenu = l.childMenu; - if (document.layers) { - l.Menu.FW_showMenu(null,null,null,childMenu.layers[0]); - childMenu.zIndex = l.parentLayer.zIndex +1; - childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top + l.Menu.menuItemHeight/3; - if (childMenu.left + childMenu.clip.width > window.innerWidth) { - childMenu.left = l.parentLayer.left - childMenu.clip.width + l.Menu.menuLayer.left + 15; - l.Menu.container.clip.left -= childMenu.clip.width; - } else { - childMenu.left = l.parentLayer.left + l.parentLayer.clip.width + l.Menu.menuLayer.left -5; - } - var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left; - if (w > l.Menu.container.clip.width) - l.Menu.container.clip.width = w; - var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top; - if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h; - l.document.layers[1].zIndex = 0; - childMenu.visibility = "inherit"; - } else if (FIND("menuItem0")) { - childMenu = FIND(l.childMenu); - var menuLayer = FIND(l.Menu.menuLayer); - var s = childMenu.style; - s.zIndex = menuLayer.style.zIndex+1; - if (document.all) { // ie case. - s.pixelTop = l.style.pixelTop + menuLayer.style.pixelTop + l.Menu.menuItemHeight/3; - s.left = s.pixelLeft = (menuLayer.style.pixelWidth) + menuLayer.style.pixelLeft -5; - } else { // zilla case - var top = PxToNum(l.style.top) + PxToNum(menuLayer.style.top) + l.Menu.menuItemHeight/3; - var left = (PxToNum(menuLayer.style.width)) + PxToNum(menuLayer.style.left) -5; - s.top = top; - s.left = left; - } - childMenu.style.visibility = "inherit"; - } else { - return; - } - window.activeMenus[window.activeMenus.length] = childMenu; - } -} - -function hideActiveMenus() { - if (!window.activeMenus) return; - for (var i=0; i < window.activeMenus.length; i++) { - if (!activeMenus[i]) continue; - if (activeMenus[i].visibility && activeMenus[i].Menu) { - activeMenus[i].visibility = "hidden"; - activeMenus[i].Menu.container.visibility = "hidden"; - activeMenus[i].Menu.container.clip.left = 0; - } else if (activeMenus[i].style) { - var s = activeMenus[i].style; - s.visibility = "hidden"; - s.left = -200; - s.top = -200; - } - } - if (window.ActiveMenuItem) { - hideMenu(false, false); - } - window.activeMenus.length = 0; -} - -function MM_findObj(n, d) { //v3.0 - var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { - d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} - if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; - for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; -} -function MM_swapImage() { //v3.0 - var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) - if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} -} -function MM_swapImgRestore() { //v3.0 - var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; -} - -function MM_preloadImages() { //v3.0 - var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); - var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) - if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} -} - - -// additional help for the different buttens. makes a floating window with content given by helpText - -// just to be sure, that no buffer overflow can arrive -var semaphor = true; - -function contextHelp(helpText, relX, relY) { - - if (showHelp && semaphor) { - semaphor = false; - var help = helpText.split("|"); - - var helpWindowWidth = 270; - var helpWindowHeight = 130; - - var xScreen = relX*(screen.width-helpWindowWidth); - var yScreen = relY*(screen.height-helpWindowHeight); - - var helpWindow = window.open("", "ContextHelp", "width=" + helpWindowWidth + ",height=" + helpWindowHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen); - - helpWindow.focus(); - helpWindow.document.open(); - helpWindow.document.write('<html><head><title>Context Help</title>'); - helpWindow.document.write('<style type="text/css">'); - helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}'); - helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}'); - helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7" onLoad="opener.semaphor = true;">'); - helpWindow.document.write('<table width="' + (helpWindowWidth-8) + '" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">'); - helpWindow.document.write(help[0] + '</tr><tr><td class="text">'); - helpWindow.document.write(help[1] + '</tr></td></table></body></html>'); - helpWindow.document.close(); - } - - // stupid workaround because of netscape 6, that doesen't know the opener property - // this workaround is still ok cause netscape 6 has eventbuffer check (no overflow) - if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) >= 5.0)) { - semaphor = true; - } -}
--- a/client/digitallibrary/digilib.jsp Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/digilib.jsp Thu Feb 21 02:27:06 2002 +0100 @@ -1,49 +1,53 @@ -<html> -<title>Digital Document Library</title> -<head> -<jsp:useBean id="DB" scope="page" class="digilib.servlet.DocumentBean" /> - -<% -// set servlet init-parameter -DB.setConfig(getServletConfig()); -// check if authentication is needed and redirect if necessary -DB.doAuthentication(request, response); -%> - -<script language="JavaScript"> - -// the document's query string (minus "?") -var query = location.search.substring(1); - -// feel free to uncomment - i have never seen a problem so... -// // DEBUG -// alert('DIR: <%= DB.getDocuPath(request) %> PAGES: <%= DB.getNumPages(request) %>'); - -// number of pages of the document -var numPages = <%= DB.getNumPages(request) %>; - -// browser version test to include the corresponding navigation-file -if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) < 5.0)) { - top.document.write('<script src="navigation_n4.js"><\/script>'); -} else if (navigator.appName.toLowerCase() == "netscape") { - top.document.write('<script src="navigation_n6.js"><\/script>'); -} else if ((navigator.appName.toLowerCase() == "microsoft internet explorer") && (parseFloat(navigator.appVersion) >= 4.0)) { - top.document.write('<script src="navigation_ie.js"><\/script>'); -} else { - alert('Your browser is not directly supported by this client right now.\n\nLoading now the optimised version for Netscape 6, that sticks the most to the w3c specifications.'); - top.document.write('<script src="navigation_n6.js"><\/script>'); -} - -</script> - -</head> - -<frameset cols="*,90" border="0" onLoad="whichFrame = parent.mainFrame; initPicture(query); loadPicture(2); initScripts();"> - <frame name="mainFrame" src="about:blank" scrolling="auto"> - <frameset rows="20,*" border="0"> - <frame name="pageFrame" src="about:blank" scrolling="no" noresize> - <frame name="rightFrame" src="navigation.html" scrolling="no" noresize> - </frameset> -</frameset> - -</html> +<%@ page language="java" import="java.util.*" %> + +<html> +<head> +<title>Digital Document Library</title> +</head> + +<jsp:useBean id="DB" scope="page" class="digilib.servlet.DocumentBean" /> + +<% +// authentication stuff - robert +// ----------------------------- + +// set servlet init-parameter +DB.setConfig(getServletConfig()); +// check if authentication is needed and redirect if necessary +DB.doAuthentication(request, response); + + +// parsing the query +// ----------------- + +String query = ""; + +if (request.getQueryString() != null) { + StringTokenizer tokenizer = new StringTokenizer(request.getQueryString(), "+"); + + int numTokens = tokenizer.countTokens(); + + if (numTokens >= 1) query += "fn=" + tokenizer.nextToken(); + if (numTokens >= 2) query += "&pn=" + tokenizer.nextToken(); + if (numTokens >= 3) query += "&ws=" + tokenizer.nextToken(); + if (numTokens >= 4) query += "&mo=" + tokenizer.nextToken(); + if (numTokens >= 5) query += "&mk=" + tokenizer.nextToken(); + if (numTokens >= 6) query += "&wx=" + tokenizer.nextToken(); + if (numTokens >= 7) query += "&wy=" + tokenizer.nextToken(); + if (numTokens >= 8) query += "&ww=" + tokenizer.nextToken(); + if (numTokens >= 9) query += "&wh=" + tokenizer.nextToken(); + + // a module update for total number of pages + query += "&pt=" + DB.getNumPages(request); +} +%> + +<frameset cols="*,90" border="0"> + <frame name="mainFrame" src="dlImage.jsp?<%= query %>" scrolling="auto"> + <frameset rows="20,*" border="0"> + <frame name="pageFrame" src="about:blank" scrolling="no" noresize> + <frame name="rightFrame" src="dlMenu.html" scrolling="no" noresize> + </frameset> +</frameset> + +</html>
--- a/client/digitallibrary/navcat_ie.js Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/navcat_ie.js Thu Feb 21 02:27:06 2002 +0100 @@ -1,23 +1,3 @@ -/* navcat_ie -- JS library for digilib (IE version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - // these two global variables have to be initialised before the frist use of the functions below // to fill in the attributes you can use the function initPicture provided below // - array with all attributes
--- a/client/digitallibrary/navcat_n4.js Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/navcat_n4.js Thu Feb 21 02:27:06 2002 +0100 @@ -1,23 +1,3 @@ -/* navcat_n4 -- JS library for digilib (Netscape4 version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - // these two global variables have to be initialised before the frist use of the functions below // to fill in the attributes you can use the function initPicture provided below // - array with all attributes
--- a/client/digitallibrary/navcat_n6.js Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/navcat_n6.js Thu Feb 21 02:27:06 2002 +0100 @@ -1,23 +1,3 @@ -/* navcat_n6 -- JS library for digilib (Mozilla version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - // these two global variables have to be initialised before the frist use of the functions below // to fill in the attributes you can use the function initPicture provided below // - array with all attributes
--- a/client/digitallibrary/navigation_ie.js Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/navigation_ie.js Thu Feb 21 02:27:06 2002 +0100 @@ -1,34 +1,63 @@ -/* navigation_ie -- JS library for digilib (IE version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -// these two global variables have to be initialised before the frist use of the functions below -// to fill in the attributes you can use the function initPicture provided below +// this global variable has to be initialised before the frist use of the functions below +// to fill in the attributes you can use the function init provided below // - array with all attributes var att = new Array(); -// - variable to store the path to the frame, in which the pictures should be created -var whichFrame = parent.mainFrame; +// fill in the values of the "att"-array +function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) { + + // debug window to check the parameters passed + //alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh); + + // attaching the values to the att-array + att[0] = fn; + att[1] = parseInt(pn); + att[2] = parseFloat(ws); + att[3] = mo; + att[4] = mk; + att[5] = parseFloat(wx); + att[6] = parseFloat(wy); + att[7] = parseFloat(ww); + att[8] = parseFloat(wh); + + // compatablility issue + if (att[3].indexOf("f") > -1) { + att[3] = "fit"; + } -// give a name to the window containing digilib - this way one can test if there is already a -// digilib-window open and replace the contents of it (ex. digicat) -window.name = "digilib"; + // converts the old mark format (0-1000) to new format(0.0 - 1.0) + // could even be useless now + if (att[4] != "0/0") { + var tmp = att[4].split(";"); + + att[4] = ""; + + for (i = 0; i < tmp.length; i++) { + tmp[i] = tmp[i].split("/"); + + if (tmp[i][0] > 1 && tmp[i][1] > 1) { + tmp[i][0] /= 1000; + tmp[i][1] /= 1000; + } + + att[4] += tmp[i][0] + "/" + tmp[i][1] + ";"; + } + att[4] = att[4].slice(0, -1); + } + + // initialisation stuff + // ==================== + + setMarks(); + + this.document.onkeypress = parseKeypress; + focus(); + + // give a name to the window containing digilib - this way one can test if there is already a + // digilib-window open and replace the contents of it (ex. digicat) + top.window.name = "digilib"; +} + // function that launches the ScaleServlet // the different detailGrades: @@ -38,16 +67,8 @@ function loadPicture(detailGrade, keepArea) { -// alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]); - - // sorry about that, but IE needs to have a document body to calc the frames width and height - whichFrame.document.open(); - whichFrame.document.write('<html><head></head><body bgcolor="#666666" topmargin="10" leftmargin="10" marginwidth="10" magrinheight="10">'); - - var newPicture = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/" - newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2]; - newPicture += "&dw=" + (whichFrame.document.body.clientWidth-30) + "&dh=" + (whichFrame.document.body.clientHeight-30); - newPicture += "&mo=" + att[3]; + var newURL = "dlImage.jsp?" + newURL += "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3]; if (detailGrade == 0) { att[4] = "0/0"; @@ -59,35 +80,18 @@ att[7] = 1; att[8] = 1; } - newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + + newURL += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + newURL += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30); - whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10; top:10; visibility:visible"><img name="pic" src="' + newPicture + '"></div>'); - whichFrame.document.write('<div ID="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark1.gif"></div>'); - whichFrame.document.write('<div ID="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark2.gif"></div>'); - whichFrame.document.write('<div ID="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark3.gif"></div>'); - whichFrame.document.write('<div ID="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark4.gif"></div>'); - whichFrame.document.write('<div ID="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark5.gif"></div>'); - whichFrame.document.write('<div ID="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark6.gif"></div>'); - whichFrame.document.write('<div ID="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark7.gif"></div>'); - whichFrame.document.write('<div ID="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark8.gif"></div>'); - whichFrame.document.write('<div ID="eck1" style="position:absolute; left:-20; top:120; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/olinks.gif"></div>'); - whichFrame.document.write('<div ID="eck2" style="position:absolute; left:-20; top:140; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/orechts.gif"></div>'); - whichFrame.document.write('<div ID="eck3" style="position:absolute; left:-20; top:160; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/ulinks.gif"></div>'); - whichFrame.document.write('<div ID="eck4" style="position:absolute; left:-20; top:180; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/urechts.gif"></div>'); + // debug window - checking the parameters passed to the next image + //alert ("DEBUG MESSAGE (complete URL in loadPicture):\n\n" + newURL); - whichFrame.document.write('</body></html>'); - - whichFrame.document.close(); - - initScripts(); - - pageInfo(); - - setmark(); + location.href = newURL; } -function Backpage(keepArea) { +function backPage(keepArea) { att[1] = parseInt(att[1]) - 1; @@ -100,24 +104,19 @@ } -function Nextpage(keepArea) { +function nextPage(keepArea) { att[1] = parseInt(att[1]) + 1; - if (att[1] <= parent.numPages) { - loadPicture(0, keepArea); - } else { - att[1] = parseInt(att[1]) - 1; - alert("You are already on the last page!"); - } + loadPicture(0, keepArea); } -function Page(keepArea) { +function page(keepArea) { do { - page = prompt("Goto Page (1 - " + parent.numPages + "):", 1); - } while ((page != null) && ((page < 1) || (page > parent.numPages))); + page = prompt("Goto Page:", 1); + } while ((page != null) && (page < 1)); if (page != null && page != att[1]) { att[1] = page; @@ -126,14 +125,14 @@ } -function Digicat() { +function digicat() { var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1]; win = window.open(url, "digicat"); win.focus(); } -function Ref(refselect) { +function ref(refselect) { var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?"; hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4]; @@ -150,15 +149,15 @@ } -function Mark(refselect) { +function mark(refselect) { if (att[4].split(";").length > 7) { alert("Only 8 marks are possible at the moment!"); return; } - whichFrame.document.all.lay1.onmousedown = function() { - e = whichFrame.event; + document.all.lay1.onmousedown = function() { + e = event; if ((att[4] != "") && (att[4] != "0/0")) { att[4] += ";"; @@ -166,71 +165,71 @@ att[4] = ""; } - markX = cropFloat(att[5]+att[7]*(whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left))/whichFrame.document.all.lay1.offsetWidth); - markY = cropFloat(att[6]+att[8]*(whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.top))/whichFrame.document.all.lay1.offsetHeight); + markX = cropFloat(att[5]+att[7]*(document.body.scrollLeft+e.x-parseInt(document.all.lay1.style.left))/document.all.lay1.offsetWidth); + markY = cropFloat(att[6]+att[8]*(document.body.scrollTop+e.y-parseInt(document.all.lay1.style.top))/document.all.lay1.offsetHeight); att[4] += markX + "/" + markY; - whichFrame.document.all.lay1.cancleBubble = true; + document.all.lay1.cancleBubble = true; - setmark(); + setMarks(); } } -function Zoomrect() { +function zoomArea() { var state = 0; var x1, y1, x2, y2; - function Click() { - e = whichFrame.event; + function click() { + e = event; if (state == 0) { state = 1; - x1 = whichFrame.document.body.scrollLeft+e.x; - y1 = whichFrame.document.body.scrollTop+e.y; + x1 = document.body.scrollLeft+e.x; + y1 = document.body.scrollTop+e.y; x2 = x1; y2 = y1; - whichFrame.document.all.eck1.style.left = x1; - whichFrame.document.all.eck1.style.top = y1; - whichFrame.document.all.eck2.style.left = x2-12; - whichFrame.document.all.eck2.style.top = y1; - whichFrame.document.all.eck3.style.left = x1; - whichFrame.document.all.eck3.style.top = y2-12; - whichFrame.document.all.eck4.style.left = x2-12; - whichFrame.document.all.eck4.style.top = y2-12; + document.all.eck1.style.left = x1; + document.all.eck1.style.top = y1; + document.all.eck2.style.left = x2-12; + document.all.eck2.style.top = y1; + document.all.eck3.style.left = x1; + document.all.eck3.style.top = y2-12; + document.all.eck4.style.left = x2-12; + document.all.eck4.style.top = y2-12; - whichFrame.document.all.eck1.style.visibility="visible"; - whichFrame.document.all.eck2.style.visibility="visible"; - whichFrame.document.all.eck3.style.visibility="visible"; - whichFrame.document.all.eck4.style.visibility="visible"; + document.all.eck1.style.visibility="visible"; + document.all.eck2.style.visibility="visible"; + document.all.eck3.style.visibility="visible"; + document.all.eck4.style.visibility="visible"; - whichFrame.document.all.lay1.onmousemove = Move; - whichFrame.document.all.eck4.onmousemove = Move; + document.all.lay1.onmousemove = move; + document.all.eck4.onmousemove = move; } else { - x1 -= parseInt(whichFrame.document.all.lay1.style.left); - y1 -= parseInt(whichFrame.document.all.lay1.style.top); + x1 -= parseInt(document.all.lay1.style.left); + y1 -= parseInt(document.all.lay1.style.top); - x2 = whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left); - y2 = whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.left); + x2 = document.body.scrollLeft+e.x-parseInt(document.all.lay1.style.left); + y2 = document.body.scrollTop+e.y-parseInt(document.all.lay1.style.left); - whichFrame.document.all.eck1.visibility="hidden"; - whichFrame.document.all.eck2.visibility="hidden"; - whichFrame.document.all.eck3.visibility="hidden"; - whichFrame.document.all.eck4.visibility="hidden"; + document.all.eck1.visibility="hidden"; + document.all.eck2.visibility="hidden"; + document.all.eck3.visibility="hidden"; + document.all.eck4.visibility="hidden"; - whichFrame.document.all.lay1.cancleBubble = true; - whichFrame.document.all.eck4.cancleBubble = true; + document.all.lay1.cancleBubble = true; + document.all.eck4.cancleBubble = true; - att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.all.lay1.offsetWidth); - att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.all.lay1.offsetHeight); + att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/document.all.lay1.offsetWidth); + att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/document.all.lay1.offsetHeight); - att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.all.lay1.offsetWidth); - att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.all.lay1.offsetHeight); + att[7] = cropFloat(att[7]*Math.abs(x1-x2)/document.all.lay1.offsetWidth); + att[8] = cropFloat(att[8]*Math.abs(y1-y2)/document.all.lay1.offsetHeight); if (att[7] != 0 && att[8] != 0) { loadPicture(2); @@ -238,34 +237,34 @@ } } - function Move() { - e = whichFrame.event; + function move() { + e = event; - x2 = whichFrame.document.body.scrollLeft+e.x; - y2 = whichFrame.document.body.scrollTop+e.y; + x2 = document.body.scrollLeft+e.x; + y2 = document.body.scrollTop+e.y; - whichFrame.document.all.eck1.style.left = ((x1 < x2) ? x1 : x2); - whichFrame.document.all.eck1.style.top = ((y1 < y2) ? y1 : y2); - whichFrame.document.all.eck2.style.left = ((x1 < x2) ? x2 : x1)-12; - whichFrame.document.all.eck2.style.top = ((y1 < y2) ? y1 : y2); - whichFrame.document.all.eck3.style.left = ((x1 < x2) ? x1 : x2); - whichFrame.document.all.eck3.style.top = ((y1 < y2) ? y2 : y1)-12; - whichFrame.document.all.eck4.style.left = ((x1 < x2) ? x2 : x1)-12; - whichFrame.document.all.eck4.style.top = ((y1 < y2) ? y2 : y1)-12; + document.all.eck1.style.left = ((x1 < x2) ? x1 : x2); + document.all.eck1.style.top = ((y1 < y2) ? y1 : y2); + document.all.eck2.style.left = ((x1 < x2) ? x2 : x1)-12; + document.all.eck2.style.top = ((y1 < y2) ? y1 : y2); + document.all.eck3.style.left = ((x1 < x2) ? x1 : x2); + document.all.eck3.style.top = ((y1 < y2) ? y2 : y1)-12; + document.all.eck4.style.left = ((x1 < x2) ? x2 : x1)-12; + document.all.eck4.style.top = ((y1 < y2) ? y2 : y1)-12; } - whichFrame.document.all.lay1.onmousedown = Click; - whichFrame.document.all.eck4.onmousedown = Click; + document.all.lay1.onmousedown = click; + document.all.eck4.onmousedown = click; } -function Zoomin() { +function zoomPoint() { - whichFrame.document.all.lay1.onmousedown = function() { - e = whichFrame.event; + document.all.lay1.onmousedown = function() { + e = event; - att[5] = cropFloat(att[5]+att[7]*(whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left))/whichFrame.document.all.lay1.offsetWidth-0.5*att[7]*0.7); - att[6] = cropFloat(att[6]+att[8]*(whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.top))/whichFrame.document.all.lay1.offsetHeight-0.5*att[8]*0.7); + att[5] = cropFloat(att[5]+att[7]*(document.body.scrollLeft+e.x-parseInt(document.all.lay1.style.left))/document.all.lay1.offsetWidth-0.5*att[7]*0.7); + att[6] = cropFloat(att[6]+att[8]*(document.body.scrollTop+e.y-parseInt(document.all.lay1.style.top))/document.all.lay1.offsetHeight-0.5*att[8]*0.7); att[7] = cropFloat(att[7]*0.7); att[8] = cropFloat(att[8]*0.7); @@ -283,25 +282,25 @@ att[6] = 1-att[8]; } - whichFrame.document.all.lay1.cancleBubble = true; + document.all.lay1.cancleBubble = true; loadPicture(2); } } -function Zoomout() { +function zoomOut() { loadPicture(1); } -function Moveto() { +function moveTo() { - whichFrame.document.all.lay1.onmousedown = function() { - e = whichFrame.event; + document.all.lay1.onmousedown = function() { + e = event; - att[5] = cropFloat(att[5]+att[7]*(whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left))/whichFrame.document.all.lay1.offsetWidth-0.5*att[7]); - att[6] = cropFloat(att[6]+att[8]*(whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.top))/whichFrame.document.all.lay1.offsetHeight-0.5*att[8]); + att[5] = cropFloat(att[5]+att[7]*(document.body.scrollLeft+e.x-parseInt(document.all.lay1.style.left))/document.all.lay1.offsetWidth-0.5*att[7]); + att[6] = cropFloat(att[6]+att[8]*(document.body.scrollTop+e.y-parseInt(document.all.lay1.style.top))/document.all.lay1.offsetHeight-0.5*att[8]); if (att[5] < 0) { att[5] = 0; @@ -316,21 +315,21 @@ att[6] = 1-att[8]; } - whichFrame.document.all.lay1.cancleBubble = true; + document.all.lay1.cancleBubble = true; loadPicture(2); } } -function Scaledef(scaledef) { +function scale(scaledef) { att[2] = scaledef; loadPicture(2); } -function setmark() { +function setMarks() { if ((att[4] != "") && (att[4] != "0/0")) { var mark = att[4].split(";"); @@ -340,15 +339,15 @@ // we do not report this error because this is already done in func. "Mark" if (countMarks > 8) countMarks = 8; - var picWidth = whichFrame.document.all.lay1.offsetWidth; - var picHeight = whichFrame.document.all.lay1.offsetHeight; + var picWidth = document.all.lay1.offsetWidth; + var picHeight = document.all.lay1.offsetHeight; // catch the cases where the picture had not been loaded already and // make a timeout so that the coordinates are calculated with the real dimensions if (picWidth > 30) { - var xoffset = parseInt(whichFrame.document.all.lay1.style.left); - var yoffset = parseInt(whichFrame.document.all.lay1.style.top); + var xoffset = parseInt(document.all.lay1.style.left); + var yoffset = parseInt(document.all.lay1.style.top); for (var i = 0; i < countMarks; i++) { mark[i] = mark[i].split("/"); @@ -358,13 +357,13 @@ mark[i][0] = parseInt(xoffset+picWidth*(mark[i][0]-att[5])/att[7]); mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att[6])/att[8]); - whichFrame.document.getElementById("dot" + i).style.left = mark[i][0]-5; - whichFrame.document.getElementById("dot" + i).style.top = mark[i][1]-5; - whichFrame.document.getElementById("dot" + i).style.visibility = "visible"; + document.getElementById("dot" + i).style.left = mark[i][0]-5; + document.getElementById("dot" + i).style.top = mark[i][1]-5; + document.getElementById("dot" + i).style.visibility = "visible"; } } } else { - setTimeout("setmark()", 100); + setTimeout("setMarks()", 100); } } } @@ -372,7 +371,7 @@ // capturing keypresses for next and previous page function parseKeypress() { - e = whichFrame.event; + e = event; if (e.keyCode == 110) { Nextpage(); @@ -380,7 +379,7 @@ if (e.keyCode == 98) { Backpage(); } - whichFrame.document.cancleBubble = true; + document.cancleBubble = true; } @@ -388,85 +387,3 @@ function cropFloat(tmp) { return parseInt(10000*tmp)/10000; } - - -// initialize browser specific things (keypress caputring) -function initScripts() { - whichFrame.document.onkeypress = parseKeypress; - whichFrame.focus(); -} - - -// fill in the values of the "att"-array -function initPicture(picURL) { - att = picURL.split("+"); - - if (att[0].lastIndexOf("/") == att[0].length-1) { - att[0] = att[0].substring(0, att[0].length-1); - } - - if (att.length < 2 || att[1] == "") { - att[1] = 1; - } - if (att.length < 3 || att[2] == "") { - att[2] = "1.0"; - } - - if (att.length < 4) { - att[3] = ""; - } - - if (att[3].indexOf("f") > -1) { - att[3] = "fit"; - } - - if (att.length < 5 || att[4] == "") { - att[4] = "0/0"; - } - - // converts the old mark format (0-1000) to new format(0.0 - 1.0) - if (att[4] != "0/0") { - var tmp = att[4].split(";"); - - att[4] = ""; - - for (i = 0; i < tmp.length; i++) { - tmp[i] = tmp[i].split("/"); - - if (tmp[i][0] > 1 && tmp[i][1] > 1) { - tmp[i][0] /= 1000; - tmp[i][1] /= 1000; - } - - att[4] += tmp[i][0] + "/" + tmp[i][1] + ";"; - } - att[4] = att[4].slice(0, -1); - } - - if (att.length < 7) { - att[5] = 0; - att[6] = 0; - att[7] = 1; - att[8] = 1; - } else { - att[5] = parseFloat(att[5]); - att[6] = parseFloat(att[6]); - att[7] = parseFloat(att[7]); - att[8] = parseFloat(att[8]); - } -} - - -function pageInfo() { - - // bug in netscape 4.xx (confunding px and pt) - var fontsize = document.layers ? "11pt" : "11px"; - - if (window.pageFrame) { - pageFrame.document.open(); - pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">'); - pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">'); - pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>'); - pageFrame.document.close(); - } -}
--- a/client/digitallibrary/navigation_n4.js Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/navigation_n4.js Thu Feb 21 02:27:06 2002 +0100 @@ -1,34 +1,65 @@ -/* navigation_ie -- JS library for digilib (Netscape4 version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -// these two global variables have to be initialised before the frist use of the functions below -// to fill in the attributes you can use the function initPicture provided below +// this global variable has to be initialised before the frist use of the functions below +// to fill in the attributes you can use the function init provided below // - array with all attributes var att = new Array(); -// - variable to store the path to the frame, in which the pictures should be created -var whichFrame = parent.mainFrame; +// fill in the values of the "att"-array +function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) { + + // debug window to check the parameters passed + //alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh); + + // attaching the values to the att-array + att[0] = fn; + att[1] = parseInt(pn); + att[2] = parseFloat(ws); + att[3] = mo; + att[4] = mk; + att[5] = parseFloat(wx); + att[6] = parseFloat(wy); + att[7] = parseFloat(ww); + att[8] = parseFloat(wh); + + // compatablility issue + if (att[3].indexOf("f") > -1) { + att[3] = "fit"; + } -// give a name to the window containing digilib - this way one can test if there is already a -// digilib-window open and replace the contents of it (ex. digicat) -window.name = "digilib"; + // converts the old mark format (0-1000) to new format(0.0 - 1.0) + // could even be useless now + if (att[4] != "0/0") { + var tmp = att[4].split(";"); + + att[4] = ""; + + for (i = 0; i < tmp.length; i++) { + tmp[i] = tmp[i].split("/"); + + if (tmp[i][0] > 1 && tmp[i][1] > 1) { + tmp[i][0] /= 1000; + tmp[i][1] /= 1000; + } + + att[4] += tmp[i][0] + "/" + tmp[i][1] + ";"; + } + att[4] = att[4].slice(0, -1); + } + + // initialisation stuff + // ==================== + + setMarks(); + + window.captureEvents(Event.KEYDOWN); + window.onkeydown = parseKeypress; + + focus(); + + // give a name to the window containing digilib - this way one can test if there is already a + // digilib-window open and replace the contents of it (ex. digicat) + top.window.name = "digilib"; +} + // function that launches the ScaleServlet // the different detailGrades: @@ -38,12 +69,8 @@ function loadPicture(detailGrade, keepArea) { -// alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]); - - var newPicture = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/" - newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2]; - newPicture += "&dw=" + (whichFrame.innerWidth-30) + "&dh=" + (whichFrame.innerHeight-30); - newPicture += "&mo=" + att[3]; + var newURL = "dlImage.jsp?" + newURL += "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3]; if (detailGrade == 0) { att[4] = "0/0"; @@ -55,35 +82,18 @@ att[7] = 1; att[8] = 1; } - newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + + newURL += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + newURL += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30); - whichFrame.document.open(); - - whichFrame.document.write('<html><head></head><body bgcolor="#666666">'); - whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10; top:10; visibility:visible"><img src="' + newPicture + '"></div>'); - whichFrame.document.write('<div ID="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark1.gif"></div>'); - whichFrame.document.write('<div ID="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark2.gif"></div>'); - whichFrame.document.write('<div ID="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark3.gif"></div>'); - whichFrame.document.write('<div ID="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark4.gif"></div>'); - whichFrame.document.write('<div ID="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark5.gif"></div>'); - whichFrame.document.write('<div ID="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark6.gif"></div>'); - whichFrame.document.write('<div ID="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark7.gif"></div>'); - whichFrame.document.write('<div ID="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark8.gif"></div>'); - whichFrame.document.write('<div ID="eck1" style="position:absolute; left:-20; top:120; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/olinks.gif"></div>'); - whichFrame.document.write('<div ID="eck2" style="position:absolute; left:-20; top:140; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/orechts.gif"></div>'); - whichFrame.document.write('<div ID="eck3" style="position:absolute; left:-20; top:160; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/ulinks.gif"></div>'); - whichFrame.document.write('<div ID="eck4" style="position:absolute; left:-20; top:180; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/urechts.gif"></div>'); - whichFrame.document.write('</body></html>'); - - whichFrame.document.close(); - - pageInfo(); + // debug window - checking the parameters passed to the next image + //alert ("DEBUG MESSAGE (complete URL in loadPicture):\n\n" + newURL); - setmark(); + location.href = newURL; } -function Backpage(keepArea) { +function backPage(keepArea) { att[1] = parseInt(att[1]) - 1; @@ -96,24 +106,19 @@ } -function Nextpage(keepArea) { +function nextPage(keepArea) { att[1] = parseInt(att[1]) + 1; - if (att[1] <= parent.numPages) { - loadPicture(0, keepArea); - } else { - att[1] = parseInt(att[1]) - 1; - alert("You are already on the last page!"); - } + loadPicture(0, keepArea); } -function Page(keepArea) { +function page(keepArea) { do { - page = prompt("Goto Page (1 - " + parent.numPages + "):", 1); - } while ((page != null) && ((page < 1) || (page > parent.numPages))); + page = prompt("Goto Page:", 1); + } while ((page != null) && (page < 1)); if (page != null && page != att[1]) { att[1] = page; @@ -122,14 +127,14 @@ } -function Digicat() { +function digicat() { var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1]; win = window.open(url, "digicat"); win.focus(); } -function Ref(refselect) { +function ref(refselect) { var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?"; hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4]; @@ -146,15 +151,15 @@ } -function Mark(refselect) { +function mark(refselect) { if (att[4].split(";").length > 7) { alert("Only 8 marks are possible at the moment!"); return; } - whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); - whichFrame.document.lay1.onmousedown = function(event) { + document.lay1.captureEvents(Event.MOUSEDOWN); + document.lay1.onmousedown = function(event) { if ((att[4] != "") && (att[4] != "0/0")) { att[4] += ";"; @@ -162,22 +167,22 @@ att[4] = ""; } - var markX = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width)); - var markY = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height)); + var markX = cropFloat(att[5]+(att[7]*event.x/document.lay1.clip.width)); + var markY = cropFloat(att[6]+(att[8]*event.y/document.lay1.clip.height)); att[4] += markX + "/" + markY; - whichFrame.document.lay1.releaseEvents(Event.MOUSEDOWN); - setmark(); + document.lay1.releaseEvents(Event.MOUSEDOWN); + setMarks(); } } -function Zoomrect() { +function zoomArea() { var state = 0; var x1, y1, x2, y2; - function Click(event) { + function click(event) { if (state == 0) { state = 1; @@ -187,43 +192,43 @@ x2 = x1; y2 = y1; - whichFrame.document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2)); - whichFrame.document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2)); - whichFrame.document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12); - whichFrame.document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12); + document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2)); + document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2)); + document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12); + document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12); - whichFrame.document.eck1.visibility="show"; - whichFrame.document.eck2.visibility="show"; - whichFrame.document.eck3.visibility="show"; - whichFrame.document.eck4.visibility="show"; + document.eck1.visibility="show"; + document.eck2.visibility="show"; + document.eck3.visibility="show"; + document.eck4.visibility="show"; - whichFrame.document.lay1.captureEvents(Event.MOUSEMOVE); - whichFrame.document.eck4.captureEvents(Event.MOUSEMOVE); + document.lay1.captureEvents(Event.MOUSEMOVE); + document.eck4.captureEvents(Event.MOUSEMOVE); - whichFrame.document.lay1.onmousemove = Move; - whichFrame.document.eck4.onmousemove = Move; + document.lay1.onmousemove = move; + document.eck4.onmousemove = move; } else { - x1 -= whichFrame.document.lay1.x; - y1 -= whichFrame.document.lay1.y; + x1 -= document.lay1.x; + y1 -= document.lay1.y; - x2 = event.pageX-whichFrame.document.lay1.x; - y2 = event.pageY-whichFrame.document.lay1.y; + x2 = event.pageX-document.lay1.x; + y2 = event.pageY-document.lay1.y; - whichFrame.document.lay1.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); - whichFrame.document.eck4.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); + document.lay1.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); + document.eck4.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); - whichFrame.document.eck1.visibility="hide"; - whichFrame.document.eck2.visibility="hide"; - whichFrame.document.eck3.visibility="hide"; - whichFrame.document.eck4.visibility="hide"; + document.eck1.visibility="hide"; + document.eck2.visibility="hide"; + document.eck3.visibility="hide"; + document.eck4.visibility="hide"; - att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.lay1.clip.width); - att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.lay1.clip.height); + att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/document.lay1.clip.width); + att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/document.lay1.clip.height); - att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.lay1.clip.width); - att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.lay1.clip.height); + att[7] = cropFloat(att[7]*Math.abs(x1-x2)/document.lay1.clip.width); + att[8] = cropFloat(att[8]*Math.abs(y1-y2)/document.lay1.clip.height); if (att[7] != 0 && att[8] != 0) { loadPicture(2); @@ -231,32 +236,32 @@ } } - function Move(event) { + function move(event) { x2 = event.pageX; y2 = event.pageY; - whichFrame.document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2)); - whichFrame.document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2)); - whichFrame.document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12); - whichFrame.document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12); + document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2)); + document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2)); + document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12); + document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12); } - whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); - whichFrame.document.eck4.captureEvents(Event.MOUSEDOWN); + document.lay1.captureEvents(Event.MOUSEDOWN); + document.eck4.captureEvents(Event.MOUSEDOWN); - whichFrame.document.lay1.onmousedown = Click; - whichFrame.document.eck4.onmousedown = Click; + document.lay1.onmousedown = click; + document.eck4.onmousedown = click; } -function Zoomin() { +function zoomPoint() { - whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); - whichFrame.document.lay1.onmousedown = function(event) { + document.lay1.captureEvents(Event.MOUSEDOWN); + document.lay1.onmousedown = function(event) { - att[5] = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width-0.5*att[7]*0.7)); - att[6] = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height-0.5*att[8]*0.7)); + att[5] = cropFloat(att[5]+(att[7]*event.x/document.lay1.clip.width-0.5*att[7]*0.7)); + att[6] = cropFloat(att[6]+(att[8]*event.y/document.lay1.clip.height-0.5*att[8]*0.7)); att[7] = cropFloat(att[7]*0.7); att[8] = cropFloat(att[8]*0.7); @@ -281,18 +286,18 @@ } -function Zoomout() { +function zoomOut() { loadPicture(1); } -function Moveto() { +function moveTo() { - whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); - whichFrame.document.lay1.onmousedown = function(event) { + document.lay1.captureEvents(Event.MOUSEDOWN); + document.lay1.onmousedown = function(event) { - att[5] = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width-0.5*att[7])); - att[6] = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height-0.5*att[8])); + att[5] = cropFloat(att[5]+(att[7]*event.x/document.lay1.clip.width-0.5*att[7])); + att[6] = cropFloat(att[6]+(att[8]*event.y/document.lay1.clip.height-0.5*att[8])); if (att[5] < 0) { att[5] = 0; @@ -314,14 +319,14 @@ } -function Scaledef(scaledef) { +function scale(scaledef) { att[2] = scaledef; loadPicture(2); } -function setmark() { +function setMarks() { if ((att[4] != "") && (att[4] != "0/0")) { var mark = att[4].split(";"); @@ -331,19 +336,19 @@ // we do not report this error because this is already done in func. "Mark" if (countMarks > 8) countMarks = 8; - var picWidth = whichFrame.document.lay1.clip.width; - var picHeight = whichFrame.document.lay1.clip.height; + var picWidth = document.lay1.clip.width; + var picHeight = document.lay1.clip.height; for (var i = 0; i < countMarks; i++) { mark[i] = mark[i].split("/"); if ((mark[i][0] > att[5]) && (mark[i][1] > att[6]) && (mark[i][0] < (att[5]+att[7])) && (mark[i][1] < (att[6]+att[8]))) { - mark[i][0] = parseInt(whichFrame.document.lay1.x + (picWidth*(mark[i][0]-att[5]))/att[7]); - mark[i][1] = parseInt(whichFrame.document.lay1.y + (picHeight*(mark[i][1]-att[6]))/att[8]); + mark[i][0] = parseInt(document.lay1.x + (picWidth*(mark[i][0]-att[5]))/att[7]); + mark[i][1] = parseInt(document.lay1.y + (picHeight*(mark[i][1]-att[6]))/att[8]); - whichFrame.document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5); - whichFrame.document.layers[i+1].visibility = "show"; + document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5); + document.layers[i+1].visibility = "show"; } } } @@ -366,85 +371,3 @@ function cropFloat(tmp) { return parseInt(10000*tmp)/10000; } - - -// initialize browser specific things (keypress caputring) -function initScripts() { - window.captureEvents(Event.KEYDOWN); - window.onkeydown = parseKeypress; -} - - -// fill in the values of the "att"-array -function initPicture(picURL) { - att = picURL.split("+"); - - if (att[0].lastIndexOf("/") == att[0].length-1) { - att[0] = att[0].substring(0, att[0].length-1); - } - - if (att.length < 2 || att[1] == "") { - att[1] = 1; - } - if (att.length < 3 || att[2] == "") { - att[2] = "1.0"; - } - - if (att.length < 4) { - att[3] = ""; - } - - if (att[3].indexOf("f") > -1) { - att[3] = "fit"; - } - - if (att.length < 5 || att[4] == "") { - att[4] = "0/0"; - } - - // converts the old mark format (0-1000) to new format(0.0 - 1.0) - if (att[4] != "0/0") { - var tmp = att[4].split(";"); - - att[4] = ""; - - for (i = 0; i < tmp.length; i++) { - tmp[i] = tmp[i].split("/"); - - if (tmp[i][0] > 1 && tmp[i][1] > 1) { - tmp[i][0] /= 1000; - tmp[i][1] /= 1000; - } - - att[4] += tmp[i][0] + "/" + tmp[i][1] + ";"; - } - att[4] = att[4].slice(0, -1); - } - - if (att.length < 7) { - att[5] = 0; - att[6] = 0; - att[7] = 1; - att[8] = 1; - } else { - att[5] = parseFloat(att[5]); - att[6] = parseFloat(att[6]); - att[7] = parseFloat(att[7]); - att[8] = parseFloat(att[8]); - } -} - -function pageInfo() { - - // bug in netscape 4.xx (confunding px and pt) - var fontsize = document.layers ? "11pt" : "11px"; - - if (window.pageFrame) { - pageFrame.document.open(); - pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">'); - pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">'); - pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>'); - pageFrame.document.close(); - } -} -
--- a/client/digitallibrary/navigation_n6.js Thu Feb 21 02:27:06 2002 +0100 +++ b/client/digitallibrary/navigation_n6.js Thu Feb 21 02:27:06 2002 +0100 @@ -1,34 +1,63 @@ -/* navigation_ie -- JS library for digilib (Mozilla version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -// these two global variables have to be initialised before the frist use of the functions below -// to fill in the attributes you can use the function initPicture provided below +// this global variable has to be initialised before the frist use of the functions below +// to fill in the attributes you can use the function init provided below // - array with all attributes var att = new Array(); -// - variable to store the path to the frame, in which the pictures should be created -var whichFrame = parent.mainFrame; +// fill in the values of the "att"-array +function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) { + + // debug window to check the parameters passed + //alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh); + + // attaching the values to the att-array + att[0] = fn; + att[1] = parseInt(pn); + att[2] = parseFloat(ws); + att[3] = mo; + att[4] = mk; + att[5] = parseFloat(wx); + att[6] = parseFloat(wy); + att[7] = parseFloat(ww); + att[8] = parseFloat(wh); + + // compatablility issue + if (att[3].indexOf("f") > -1) { + att[3] = "fit"; + } -// give a name to the window containing digilib - this way one can test if there is already a -// digilib-window open and replace the contents of it (ex. digicat) -window.name = "digilib"; + // converts the old mark format (0-1000) to new format(0.0 - 1.0) + // could even be useless now + if (att[4] != "0/0") { + var tmp = att[4].split(";"); + + att[4] = ""; + + for (i = 0; i < tmp.length; i++) { + tmp[i] = tmp[i].split("/"); + + if (tmp[i][0] > 1 && tmp[i][1] > 1) { + tmp[i][0] /= 1000; + tmp[i][1] /= 1000; + } + + att[4] += tmp[i][0] + "/" + tmp[i][1] + ";"; + } + att[4] = att[4].slice(0, -1); + } + + // initialisation stuff + // ==================== + + setMarks(); + + this.document.addEventListener('keypress', parseKeypress, true); + focus(); + + // give a name to the window containing digilib - this way one can test if there is already a + // digilib-window open and replace the contents of it (ex. digicat) + top.window.name = "digilib"; +} + // function that launches the ScaleServlet // the different detailGrades: @@ -38,18 +67,8 @@ function loadPicture(detailGrade, keepArea) { -// alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]); - - // sorry about that, but Mozilla needs to have a document body to calc the frames width and height - whichFrame.document.open(); - whichFrame.document.write('<html><head></head><body bgcolor="#666666" topmargin="10" leftmargin="10" marginwidth="10" magrinheight="10">'); - -// alert(whichFrame.innerWidth); - - var newPicture = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/" - newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2]; - newPicture += "&dw=" + (whichFrame.innerWidth-30) + "&dh=" + (whichFrame.innerHeight-30); - newPicture += "&mo=" + att[3]; + var newURL = "dlImage.jsp?" + newURL += "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3]; if (detailGrade == 0) { att[4] = "0/0"; @@ -61,35 +80,18 @@ att[7] = 1; att[8] = 1; } - newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + + newURL += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + newURL += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30); - whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10; top:10; visibility:visible"><img name="pic" src="' + newPicture + '"></div>'); - whichFrame.document.write('<div ID="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark1.gif"></div>'); - whichFrame.document.write('<div ID="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark2.gif"></div>'); - whichFrame.document.write('<div ID="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark3.gif"></div>'); - whichFrame.document.write('<div ID="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark4.gif"></div>'); - whichFrame.document.write('<div ID="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark5.gif"></div>'); - whichFrame.document.write('<div ID="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark6.gif"></div>'); - whichFrame.document.write('<div ID="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark7.gif"></div>'); - whichFrame.document.write('<div ID="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark8.gif"></div>'); - whichFrame.document.write('<div ID="eck1" style="position:absolute; left:-20; top:120; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/olinks.gif"></div>'); - whichFrame.document.write('<div ID="eck2" style="position:absolute; left:-20; top:140; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/orechts.gif"></div>'); - whichFrame.document.write('<div ID="eck3" style="position:absolute; left:-20; top:160; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/ulinks.gif"></div>'); - whichFrame.document.write('<div ID="eck4" style="position:absolute; left:-20; top:180; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/urechts.gif"></div>'); + // debug window - checking the parameters passed to the next image + //alert ("DEBUG MESSAGE (complete URL in loadPicture):\n\n" + newURL); - whichFrame.document.write('</body></html>'); - - whichFrame.document.close(); - - initScripts(); - - pageInfo(); - - setmark(); + location.href = newURL; } -function Backpage(keepArea) { +function backPage(keepArea) { att[1] = parseInt(att[1]) - 1; @@ -102,24 +104,19 @@ } -function Nextpage(keepArea) { +function nextPage(keepArea) { att[1] = parseInt(att[1]) + 1; - if (att[1] <= parent.numPages) { - loadPicture(0, keepArea); - } else { - att[1] = parseInt(att[1]) - 1; - alert("You are already on the last page!"); - } + loadPicture(0, keepArea); } -function Page(keepArea) { +function page(keepArea) { do { - page = prompt("Goto Page (1 - " + parent.numPages + "):", 1); - } while ((page != null) && ((page < 1) || (page > parent.numPages))); + page = prompt("Goto Page:", 1); + } while ((page != null) && (page < 1)); if (page != null && page != att[1]) { att[1] = page; @@ -128,14 +125,14 @@ } -function Digicat() { +function digicat() { var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1]; win = window.open(url, "digicat"); win.focus(); } -function Ref(refselect) { +function ref(refselect) { var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?"; hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4]; @@ -152,14 +149,14 @@ } -function Mark() { +function mark() { if (att[4].split(";").length > 7) { alert("Only 8 marks are possible at the moment!"); return; } - function MarkEvent(event) { + function markEvent(event) { if ((att[4] != "") && (att[4] != "0/0")) { att[4] += ";"; @@ -167,24 +164,24 @@ att[4] = ""; } - var markX = cropFloat(att[5]+att[7]*(event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left))/whichFrame.document.pic.offsetWidth); - var markY = cropFloat(att[6]+att[8]*(event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top))/whichFrame.document.pic.offsetHeight); + var markX = cropFloat(att[5]+att[7]*(event.pageX-parseInt(document.getElementById("lay1").style.left))/document.pic.offsetWidth); + var markY = cropFloat(att[6]+att[8]*(event.pageY-parseInt(document.getElementById("lay1").style.top))/document.pic.offsetHeight); att[4] += markX + "/" + markY; - whichFrame.document.getElementById("lay1").removeEventListener("mousedown", MarkEvent, true); - setmark(); + document.getElementById("lay1").removeEventListener("mousedown", markEvent, true); + setMarks(); } - whichFrame.document.getElementById("lay1").addEventListener("mousedown", MarkEvent, true); + document.getElementById("lay1").addEventListener("mousedown", markEvent, true); } -function Zoomrect() { +function zoomArea() { var state = 0; var x1, y1, x2, y2; - function Click(event) { + function click(event) { if (state == 0) { state = 1; @@ -194,47 +191,47 @@ x2 = x1; y2 = y1; - whichFrame.document.getElementById("eck1").style.left = x1; - whichFrame.document.getElementById("eck1").style.top = y1; - whichFrame.document.getElementById("eck2").style.left = x2-12; - whichFrame.document.getElementById("eck2").style.top = y1; - whichFrame.document.getElementById("eck3").style.left = x1; - whichFrame.document.getElementById("eck3").style.top = y2-12; - whichFrame.document.getElementById("eck4").style.left = x2-12; - whichFrame.document.getElementById("eck4").style.top = y2-12; + document.getElementById("eck1").style.left = x1; + document.getElementById("eck1").style.top = y1; + document.getElementById("eck2").style.left = x2-12; + document.getElementById("eck2").style.top = y1; + document.getElementById("eck3").style.left = x1; + document.getElementById("eck3").style.top = y2-12; + document.getElementById("eck4").style.left = x2-12; + document.getElementById("eck4").style.top = y2-12; - whichFrame.document.getElementById("eck1").style.visibility="visible"; - whichFrame.document.getElementById("eck2").style.visibility="visible"; - whichFrame.document.getElementById("eck3").style.visibility="visible"; - whichFrame.document.getElementById("eck4").style.visibility="visible"; + document.getElementById("eck1").style.visibility="visible"; + document.getElementById("eck2").style.visibility="visible"; + document.getElementById("eck3").style.visibility="visible"; + document.getElementById("eck4").style.visibility="visible"; - whichFrame.document.getElementById("lay1").addEventListener("mousemove", Move, true); - whichFrame.document.getElementById("eck4").addEventListener("mousemove", Move, true); + document.getElementById("lay1").addEventListener("mousemove", move, true); + document.getElementById("eck4").addEventListener("mousemove", move, true); } else { - x1 -= parseInt(whichFrame.document.getElementById("lay1").style.left); - y1 -= parseInt(whichFrame.document.getElementById("lay1").style.top); + x1 -= parseInt(document.getElementById("lay1").style.left); + y1 -= parseInt(document.getElementById("lay1").style.top); - x2 = event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left); - y2 = event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top); + x2 = event.pageX-parseInt(document.getElementById("lay1").style.left); + y2 = event.pageY-parseInt(document.getElementById("lay1").style.top); - whichFrame.document.getElementById("lay1").removeEventListener("mousedown", Click, true); - whichFrame.document.getElementById("eck4").removeEventListener("mousedown", Click, true); + document.getElementById("lay1").removeEventListener("mousedown", click, true); + document.getElementById("eck4").removeEventListener("mousedown", click, true); - whichFrame.document.getElementById("lay1").removeEventListener("mousemove", Move, true); - whichFrame.document.getElementById("eck4").removeEventListener("mousemove", Move, true); + document.getElementById("lay1").removeEventListener("mousemove", move, true); + document.getElementById("eck4").removeEventListener("mousemove", move, true); - whichFrame.document.getElementById("eck1").style.visibility="hidden"; - whichFrame.document.getElementById("eck2").style.visibility="hidden"; - whichFrame.document.getElementById("eck3").style.visibility="hidden"; - whichFrame.document.getElementById("eck4").style.visibility="hidden"; + document.getElementById("eck1").style.visibility="hidden"; + document.getElementById("eck2").style.visibility="hidden"; + document.getElementById("eck3").style.visibility="hidden"; + document.getElementById("eck4").style.visibility="hidden"; - att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.pic.offsetWidth); - att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.pic.offsetHeight); + att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/document.pic.offsetWidth); + att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/document.pic.offsetHeight); - att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.pic.offsetWidth); - att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.pic.offsetHeight); + att[7] = cropFloat(att[7]*Math.abs(x1-x2)/document.pic.offsetWidth); + att[8] = cropFloat(att[8]*Math.abs(y1-y2)/document.pic.offsetHeight); if (att[7] != 0 && att[8] != 0) { loadPicture(2); @@ -242,32 +239,32 @@ } } - function Move(event) { + function move(event) { x2 = event.pageX; y2 = event.pageY; - whichFrame.document.getElementById("eck1").style.left = ((x1 < x2) ? x1 : x2); - whichFrame.document.getElementById("eck1").style.top = ((y1 < y2) ? y1 : y2); - whichFrame.document.getElementById("eck2").style.left = ((x1 < x2) ? x2 : x1)-12; - whichFrame.document.getElementById("eck2").style.top = ((y1 < y2) ? y1 : y2); - whichFrame.document.getElementById("eck3").style.left = ((x1 < x2) ? x1 : x2); - whichFrame.document.getElementById("eck3").style.top = ((y1 < y2) ? y2 : y1)-12; - whichFrame.document.getElementById("eck4").style.left = ((x1 < x2) ? x2 : x1)-12; - whichFrame.document.getElementById("eck4").style.top = ((y1 < y2) ? y2 : y1)-12; + document.getElementById("eck1").style.left = ((x1 < x2) ? x1 : x2); + document.getElementById("eck1").style.top = ((y1 < y2) ? y1 : y2); + document.getElementById("eck2").style.left = ((x1 < x2) ? x2 : x1)-12; + document.getElementById("eck2").style.top = ((y1 < y2) ? y1 : y2); + document.getElementById("eck3").style.left = ((x1 < x2) ? x1 : x2); + document.getElementById("eck3").style.top = ((y1 < y2) ? y2 : y1)-12; + document.getElementById("eck4").style.left = ((x1 < x2) ? x2 : x1)-12; + document.getElementById("eck4").style.top = ((y1 < y2) ? y2 : y1)-12; } - whichFrame.document.getElementById("lay1").addEventListener("mousedown", Click, true); - whichFrame.document.getElementById("eck4").addEventListener("mousedown", Click, true); + document.getElementById("lay1").addEventListener("mousedown", click, true); + document.getElementById("eck4").addEventListener("mousedown", click, true); } -function Zoomin() { +function zoomPoint() { - function ZoominEvent(event) { + function zoomPointEvent(event) { - att[5] = cropFloat(att[5]+att[7]*(event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left))/whichFrame.document.pic.offsetWidth-0.5*att[7]*0.7); - att[6] = cropFloat(att[6]+att[8]*(event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top))/whichFrame.document.pic.offsetHeight-0.5*att[8]*0.7); + att[5] = cropFloat(att[5]+att[7]*(event.pageX-parseInt(document.getElementById("lay1").style.left))/document.pic.offsetWidth-0.5*att[7]*0.7); + att[6] = cropFloat(att[6]+att[8]*(event.pageY-parseInt(document.getElementById("lay1").style.top))/document.pic.offsetHeight-0.5*att[8]*0.7); att[7] = cropFloat(att[7]*0.7); att[8] = cropFloat(att[8]*0.7); @@ -285,27 +282,27 @@ att[6] = 1-att[8]; } - whichFrame.document.getElementById("lay1").removeEventListener("mousedown", ZoominEvent, true); + document.getElementById("lay1").removeEventListener("mousedown", zoomPointEvent, true); loadPicture(2); } - whichFrame.document.getElementById("lay1").addEventListener("mousedown", ZoominEvent, true); + document.getElementById("lay1").addEventListener("mousedown", zoomPointEvent, true); } -function Zoomout() { +function zoomOut() { loadPicture(1); } -function Moveto() { +function moveTo() { - function MovetoEvent(event) { + function moveToEvent(event) { - att[5] = cropFloat(att[5]+att[7]*(event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left))/whichFrame.document.pic.offsetWidth-0.5*att[7]); - att[6] = cropFloat(att[6]+att[8]*(event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top))/whichFrame.document.pic.offsetHeight-0.5*att[8]); + att[5] = cropFloat(att[5]+att[7]*(event.pageX-parseInt(document.getElementById("lay1").style.left))/document.pic.offsetWidth-0.5*att[7]); + att[6] = cropFloat(att[6]+att[8]*(event.pageY-parseInt(document.getElementById("lay1").style.top))/document.pic.offsetHeight-0.5*att[8]); if (att[5] < 0) { att[5] = 0; @@ -320,23 +317,23 @@ att[6] = 1-att[8]; } - whichFrame.document.getElementById("lay1").removeEventListener("mousedown", MovetoEvent, true); + document.getElementById("lay1").removeEventListener("mousedown", moveToEvent, true); loadPicture(2); } - whichFrame.document.getElementById("lay1").addEventListener("mousedown", MovetoEvent, true); + document.getElementById("lay1").addEventListener("mousedown", moveToEvent, true); } -function Scaledef(scaledef) { +function scale(scaledef) { att[2] = scaledef; loadPicture(2); } -function setmark() { +function setMarks() { if (att[4] != "" && att[4] != "0/0") { var mark = att[4].split(";"); @@ -347,14 +344,14 @@ // we do not report this error because this is already done in func. "Mark" if (countMarks > 8) countMarks = 8; - var picWidth = whichFrame.document.pic.offsetWidth; - var picHeight = whichFrame.document.pic.offsetHeight; + var picWidth = document.pic.offsetWidth; + var picHeight = document.pic.offsetHeight; // catch the cases where the picture had not been loaded already and // make a timeout so that the coordinates are calculated with the real dimensions - if (whichFrame.document.pic.complete) { - var xoffset = parseInt(whichFrame.document.getElementById("lay1").style.left); - var yoffset = parseInt(whichFrame.document.getElementById("lay1").style.top); + if (document.pic.complete) { + var xoffset = parseInt(document.getElementById("lay1").style.left); + var yoffset = parseInt(document.getElementById("lay1").style.top); for (var i = 0; i < countMarks; i++) { mark[i] = mark[i].split("/"); @@ -365,13 +362,13 @@ mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att[6])/att[8]); - whichFrame.document.getElementById("dot" + i).style.left = mark[i][0]-5; - whichFrame.document.getElementById("dot" + i).style.top = mark[i][1]-5; - whichFrame.document.getElementById("dot" + i).style.visibility = "visible"; + document.getElementById("dot" + i).style.left = mark[i][0]-5; + document.getElementById("dot" + i).style.top = mark[i][1]-5; + document.getElementById("dot" + i).style.visibility = "visible"; } } } else { - setTimeout("setmark()", 100); + setTimeout("setMarks()", 100); } } } @@ -392,88 +389,3 @@ function cropFloat(tmp) { return parseInt(10000*tmp)/10000; } - - -// initialize browser specific things (keypress caputring) -function initScripts() { -// for (var f = 0; f < window.frames.length; f++) { -// window.frames[f].document.addEventListener('keypress', parseKeypress, true); -// } - whichFrame.document.addEventListener('keypress', parseKeypress, true); - whichFrame.focus(); -} - - -// fill in the values of the "att"-array -function initPicture(picURL) { - att = picURL.split("+"); - - if (att[0].lastIndexOf("/") == att[0].length-1) { - att[0] = att[0].substring(0, att[0].length-1); - } - - if (att.length < 2 || att[1] == "") { - att[1] = 1; - } - if (att.length < 3 || att[2] == "") { - att[2] = "1.0"; - } - - if (att.length < 4) { - att[3] = ""; - } - - if (att[3].indexOf("f") > -1) { - att[3] = "fit"; - } - - if (att.length < 5 || att[4] == "") { - att[4] = "0/0"; - } - - // converts the old mark format (0-1000) to new format(0.0 - 1.0) - if (att[4] != "0/0") { - var tmp = att[4].split(";"); - - att[4] = ""; - - for (i = 0; i < tmp.length; i++) { - tmp[i] = tmp[i].split("/"); - - if (tmp[i][0] > 1 && tmp[i][1] > 1) { - tmp[i][0] /= 1000; - tmp[i][1] /= 1000; - } - - att[4] += tmp[i][0] + "/" + tmp[i][1] + ";"; - } - att[4] = att[4].slice(0, -1); - } - - if (att.length < 7) { - att[5] = 0; - att[6] = 0; - att[7] = 1; - att[8] = 1; - } else { - att[5] = parseFloat(att[5]); - att[6] = parseFloat(att[6]); - att[7] = parseFloat(att[7]); - att[8] = parseFloat(att[8]); - } -} - - -function pageInfo() { - - // bug in netscape 4.xx (confunding px and pt) - var fontsize = document.layers ? "11pt" : "11px"; - - if (window.pageFrame) { - pageFrame.document.open(); - pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">'); - pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">'); - pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>'); - pageFrame.document.close(); - } -}