This commit is contained in:
Frank Dillon 2006-06-14 16:06:10 +00:00
parent b024a8f67d
commit bb1be82c7c
3 changed files with 1391 additions and 1440 deletions

View file

@ -1,8 +1,8 @@
/* /*
jsDOMenu Version 1.3.1 jsDOMenu Version 1.3
Copyright (C) 2003 - 2005 Toh Zhiqiang Copyright (C) 2003 - 2005 Toh Zhiqiang
Released on 12 February 2005 Released on 16 January 2005
jsDOMenu is distributed under the terms of the GNU GPL license jsDOMenu is distributed under the terms of the GNU GPL license
Refer to license.txt for more informatiom Refer to license.txt for more informatiom
@ -57,14 +57,6 @@ function isSafari() { // Private method
return navigator.userAgent.indexOf("Safari") > -1; return navigator.userAgent.indexOf("Safari") > -1;
} }
/*
Determine if is konqueror
*/
function isKonqueror() { // Private method
return navigator.userAgent.indexOf("Konqueror") > -1;
}
/* /*
Determine the page render mode. Determine the page render mode.
@ -112,7 +104,7 @@ Get the x-coordinate of the cursor position relative to the window.
*/ */
function getX(e) { // Private method function getX(e) { // Private method
if (!e) { if (!e) {
var e = window.event || window.Event; var e = window.event;
} }
if (safari) { if (safari) {
return e.clientX - getScrollLeft(); return e.clientX - getScrollLeft();
@ -127,7 +119,7 @@ Get the y-coordinate of the cursor position relative to the window.
*/ */
function getY(e) { // Private method function getY(e) { // Private method
if (!e) { if (!e) {
var e = window.event || window.Event; var e = window.event;
} }
if (safari) { if (safari) {
return e.clientY - getScrollTop(); return e.clientY - getScrollTop();
@ -451,7 +443,7 @@ function menuItemClick(e) { // Private method
} }
} }
if (!e) { if (!e) {
var e = window.event || window.Event; var e = window.event;
e.cancelBubble = true; e.cancelBubble = true;
} }
if (e.stopPropagation) { if (e.stopPropagation) {
@ -548,9 +540,8 @@ function activatePopUpMenu(e) { // Private method
} }
else { else {
if (!e) { if (!e) {
e = window.event || window.Event; var e = window.event;
} }
setPopUpMenu(getPopUpMenuObj(e));if (popUpMenuObj==null) return;//DAMIANO
var targetElm = (e.target) ? e.target : e.srcElement; var targetElm = (e.target) ? e.target : e.srcElement;
if (targetElm.nodeType == 3) { if (targetElm.nodeType == 3) {
targetElm = targetElm.parentNode; targetElm = targetElm.parentNode;
@ -565,25 +556,19 @@ function activatePopUpMenu(e) { // Private method
Event handler that handles left click event. Event handler that handles left click event.
*/ */
function leftClickHandler(e) { // Private method function leftClickHandler(e) { // Private method
if (!e) { if (getX(e) > getClientWidth() || getY(e) > getClientHeight()) {
e = window.event || window.Event;
}
if (e.button && e.button == 2) {
return; return;
} }
if (!e) {
if (getX(e) > getClientWidth() || getY(e) > getClientHeight()) { var e = window.event;
}
if (e.button && e.button == 2) {
return; return;
} }
hideVisibleMenus(); hideVisibleMenus();
if (typeof(hideMenuBarMenus) == "function") { if (typeof(hideMenuBarMenus) == "function") {
hideMenuBarMenus(); hideMenuBarMenus();
} }
if (popUpMenuObj==null) {
//alert("getting popup in leftClickHandler");
setPopUpMenu(getPopUpMenuObj(e));//DAMIANO
}
if (popUpMenuObj) { if (popUpMenuObj) {
var state = popUpMenuObj.menuObj.style.visibility; var state = popUpMenuObj.menuObj.style.visibility;
if (state == "visible" && (hideValue == 0 || hideValue == 2)) { if (state == "visible" && (hideValue == 0 || hideValue == 2)) {
@ -595,16 +580,10 @@ function leftClickHandler(e) { // Private method
} }
} }
/* /*
Event handler that handles right click event. Event handler that handles right click event.
*/ */
function rightClickHandler(e) { // Private method function rightClickHandler(e) { // Private method
if (!e) {
e = window.event || window.Event;
}
if (getX(e) > getClientWidth() || getY(e) > getClientHeight()) { if (getX(e) > getClientWidth() || getY(e) > getClientHeight()) {
return; return;
} }
@ -612,12 +591,6 @@ function rightClickHandler(e) { // Private method
if (typeof(hideMenuBarMenus) == "function") { if (typeof(hideMenuBarMenus) == "function") {
hideMenuBarMenus(); hideMenuBarMenus();
} }
if (popUpMenuObj==null) {
//alert("getting popup in rightClickHandler");
setPopUpMenu(getPopUpMenuObj(e)); //DAMIANO
}
if (popUpMenuObj) { if (popUpMenuObj) {
var state = popUpMenuObj.menuObj.style.visibility; var state = popUpMenuObj.menuObj.style.visibility;
if (state == "visible" && (hideValue == 1 || hideValue == 2)) { if (state == "visible" && (hideValue == 1 || hideValue == 2)) {
@ -748,7 +721,7 @@ function addMenuItem(menuItemObj) { // Public method
}; };
itemElm.onclick = function(e) { // Private method itemElm.onclick = function(e) { // Private method
if (!e) { if (!e) {
var e = window.event || window.Event; var e = window.event;
e.cancelBubble = true; e.cancelBubble = true;
} }
if (e.stopPropagation) { if (e.stopPropagation) {
@ -825,7 +798,14 @@ classNameOver : Optional. String that specifies the CSS class selector for
*/ */
function menuItem() { // Public method function menuItem() { // Public method
this.displayText = arguments[0]; this.displayText = arguments[0];
if (this.displayText == "-") {
this.id = "menuSep" + (++sepCount);
this.className = sepClassName;
}
else {
this.id = "menuItem" + (++menuItemCount);
this.className = menuItemClassName;
}
this.itemName = ""; this.itemName = "";
this.actionOnClick = ""; this.actionOnClick = "";
this.enabled = true; this.enabled = true;
@ -853,18 +833,6 @@ function menuItem() { // Public method
if (len > 5 && arguments[5].length > 0) { if (len > 5 && arguments[5].length > 0) {
this.classNameOver = arguments[5]; this.classNameOver = arguments[5];
} }
if (this.displayText == "-") {
this.id = "menuSep" + (++sepCount);
this.className = sepClassName;
}
else {
this.id = "menuItem" + (++menuItemCount);
if (this.enabled)
this.className = menuItemClassName;
else
this.className = menuItemClassNameDisabled;
}
} }
/* /*
@ -1131,7 +1099,6 @@ function hideVisibleMenus() { // Public method
refreshMenuBarItems(getElmId(staticMenuBarId[i])); refreshMenuBarItems(getElmId(staticMenuBarId[i]));
} }
} }
hideVisibleCallback();
} }
/* /*
@ -1202,10 +1169,6 @@ if (typeof(menuItemClassName) == "undefined") {
var menuItemClassName = "jsdomenuitem"; // Public field var menuItemClassName = "jsdomenuitem"; // Public field
} }
if (typeof(menuItemClassNameDisabled) == "undefined") {
var menuItemClassNameDisabled = "jsdomenuitemdisabled"; // Public field
}
if (typeof(menuItemClassNameOver) == "undefined") { if (typeof(menuItemClassNameOver) == "undefined") {
var menuItemClassNameOver = "jsdomenuitemover"; // Public field var menuItemClassNameOver = "jsdomenuitemover"; // Public field
} }

View file

@ -55,8 +55,9 @@ function sortableInit(id)
*/ */
function getPopUpMenuObj(e) { function getPopUpMenuObj(e) {
if(!e) e = window.event || window.Event; if(!e) e = window.event || window.Event;
//alert(e);
targetElm = (e.target) ? e.target : e.srcElement; targetElm = (e.target) ? e.target : e.srcElement;
//alert(targetElm);
if(!targetElm) return null; if(!targetElm) return null;
if (targetElm.nodeType==3) //Text Node returned by Konqueror if (targetElm.nodeType==3) //Text Node returned by Konqueror

View file

@ -27,19 +27,6 @@ Menu related selectors
position: relative; /* Do not alter this line! */ position: relative; /* Do not alter this line! */
} }
.jsdomenuitemdisabled {
background: transparent;
border: none;
color: #B5B5B5;
font-family: Tahoma, Helvetica, sans, Arial, sans-serif;
font-size: 12px;
padding-bottom: 3px;
padding-left: 30px;
padding-right: 15px;
padding-top: 3px;
position: relative; /* Do not alter this line! */
}
.jsdomenuitemover { .jsdomenuitemover {
background-color: #C1D2EE; background-color: #C1D2EE;
border: 1px solid #316AC5; border: 1px solid #316AC5;