From 054a2f683f8240063a8d6e1c9c5864ebac8eaa41 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Sun, 28 Oct 2001 22:48:19 +0000 Subject: [PATCH 1/1] New copyright free implementation of menus in JavaScript. --- helm/on-line/javascript/Makefile | 2 +- helm/on-line/javascript/helmjsmenu.js | 58 +++++++++++++ helm/on-line/xslt/makeGraphLinks.xsl | 115 +++++++------------------- 3 files changed, 89 insertions(+), 86 deletions(-) create mode 100644 helm/on-line/javascript/helmjsmenu.js diff --git a/helm/on-line/javascript/Makefile b/helm/on-line/javascript/Makefile index de7e0aa76..1a6baf65e 100644 --- a/helm/on-line/javascript/Makefile +++ b/helm/on-line/javascript/Makefile @@ -1,5 +1,5 @@ -TARGETS = control.js_xml defaults.js_xml utils.js_xml graphLinks.js_xml +TARGETS = control.js_xml defaults.js_xml utils.js_xml graphLinks.js_xml helmjsmenu.js_xml .SUFFIXES: .SUFFIXES: .js .js_xml diff --git a/helm/on-line/javascript/helmjsmenu.js b/helm/on-line/javascript/helmjsmenu.js new file mode 100644 index 000000000..0d7654315 --- /dev/null +++ b/helm/on-line/javascript/helmjsmenu.js @@ -0,0 +1,58 @@ +// Global variables. +var HJMmenu; + +function initializeMenu() { + HJMmenu = + document.getElementById ? + // A DOM browser + document.getElementById("HJMmenu").style + : // Probably Netscape Navigator 4.0 + document.HJMmenu; + HJMmenu.visibility="hidden"; +} + +function showMenu() { + HJMmenu.visibility="visible"; +} + +function hideMenu() { + HJMmenu.visibility="hidden"; +} + +function moveMenu(x,y) { + var y2 = y - 25; + var x2 = x - 25; + if (document.getElementById) { + // Not Netscape Navigator 4.0 + HJMmenu.left = x2 + "px"; + HJMmenu.top = y2 + "px"; + } else { + // Probably Netscape Navigator 4.0 + HJMmenu.left = x2; + HJMmenu.top = y2; + } +} + +function getX(event) { + if(!event.pageX) + // Probably Internet Explorer + return event.clientX + document.body.scrollLeft; + else + // Probably Netscape Navigator + return event.pageX; +} + +function getY(event) { + if(!event.pageY) + // Probably Internet Explorer + return event.clientY + document.body.scrollTop; + else + // Probably Netscape Navigator + return event.pageY; +} + +if (!document.getElementById) { + // Probably Netscape Navigator + document.captureEvents(Event.MOUSEDOWN); + document.onmousedown = hideMenu; +} diff --git a/helm/on-line/xslt/makeGraphLinks.xsl b/helm/on-line/xslt/makeGraphLinks.xsl index 3a74babdb..49122be2b 100644 --- a/helm/on-line/xslt/makeGraphLinks.xsl +++ b/helm/on-line/xslt/makeGraphLinks.xsl @@ -28,8 +28,10 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:subst="http://www.cs.unibo.it/helm/subst"> + + - + @@ -48,68 +50,10 @@ - - - @@ -124,36 +68,37 @@ HM_PG_NSFontOver = true; + hideMenu(); - - + + - + + + + + - - selectedURI="";lastEvent=event;HM_f_PopUp('elMenu1',event) - HM_f_PopDown('elMenu1') - javascript: HM_f_PopUp('elMenu1',lastEvent); void(0); + lastX = getX(event); lastY = getY(event);selectedURI=''; + javascript:moveMenu(lastX,lastY); showMenu(); -- 2.39.2