X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fgraphs%2Fjsmenu%2FHM_ScriptDOM.js;fp=helm%2Fgraphs%2Fjsmenu%2FHM_ScriptDOM.js;h=498a5912b25af117f6b7ed29b424ed48266100ba;hb=652fae70919845d39be446a18175715c8ce83831;hp=0000000000000000000000000000000000000000;hpb=ec8fa0609fdbac7c909f6e4c93de06a8ee205092;p=helm.git diff --git a/helm/graphs/jsmenu/HM_ScriptDOM.js b/helm/graphs/jsmenu/HM_ScriptDOM.js new file mode 100644 index 000000000..498a5912b --- /dev/null +++ b/helm/graphs/jsmenu/HM_ScriptDOM.js @@ -0,0 +1,962 @@ +/*HM_ScriptDOM.js +* by Peter Belesis. v4.1.1 011002 +* Copyright (c) 2001 Peter Belesis. All Rights Reserved. +* Originally published and documented at http://www.dhtmlab.com/ +* Available solely from INT Media Group. Incorporated under exclusive license. +* Contact licensing@internet.com for more information. +*/ + +HM_IE5M = HM_IE && HM_Mac; +HM_IE5W = HM_IE && !HM_Mac; +HM_NS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko")); +HM_IEpos = HM_IE || (HM_NS6 && parseInt(navigator.productSub)>=20010710); +HM_IEDTD = (HM_IE && document.doctype) ? document.doctype.name.indexOf(".dtd")!=-1 : false; +HM_IEnoDTD = HM_IE && !HM_IEDTD; + +HM_a_Parameters = [ + ["MenuWidth", 150, "number"], + ["FontFamily", "Arial,sans-serif"], + ["FontSize", 10, "number"], + ["FontBold", false, "boolean"], + ["FontItalic", false, "boolean"], + ["FontColor", "black"], + ["FontColorOver", "white"], + ["BGColor", "white"], + ["BGColorOver", "black"], + ["ItemPadding", 3, "number"], + ["BorderWidth", 2, "number"], + ["BorderColor", "red"], + ["BorderStyle", "solid"], + ["SeparatorSize", 1, "number"], + ["SeparatorColor", "yellow"], + ["ImageSrc", "HM_More_black_right.gif"], + ["ImageSrcOver", null], + ["ImageSrcLeft", "HM_More_black_left.gif"], + ["ImageSrcLeftOver", null], + ["ImageSize", 5, "number"], + ["ImageHorizSpace", 0, "number"], + ["ImageVertSpace", 0, "number"], + ["KeepHilite", false, "boolean"], + ["ClickStart", false, "boolean"], + ["ClickKill", true, "boolean"], + ["ChildOverlap", 20, "number"], + ["ChildOffset", 10, "number"], + ["ChildPerCentOver", null, "number"], + ["TopSecondsVisible", .5, "number"], + ["ChildSecondsVisible",.3, "number"], + ["StatusDisplayBuild", 1, "boolean"], + ["StatusDisplayLink", 1, "boolean"], + ["UponDisplay", null, "delayed"], + ["UponHide", null, "delayed"], + ["RightToLeft", false, "boolean"], + ["CreateTopOnly", 0, "boolean"], + ["ShowLinkCursor", false, "boolean"] +] + +HM_MenuIDPrefix = "HM_Menu"; +HM_ItemIDPrefix = "HM_Item"; +HM_ArrayIDPrefix = "HM_Array"; + +Function.prototype.isFunction = true; +Function.prototype.isString = false; +String.prototype.isFunction = false; +String.prototype.isString = true; +String.prototype.isBoolean = false; +String.prototype.isNumber = false; +Number.prototype.isString = false; +Number.prototype.isFunction = false; +Number.prototype.isBoolean = false; +Number.prototype.isNumber = true; +Boolean.prototype.isString = false; +Boolean.prototype.isFunction = false; +Boolean.prototype.isBoolean = true; +Boolean.prototype.isNumber = false; +Array.prototype.itemValidation = false; +Array.prototype.isArray = true; + +if(HM_IE) { + HM_a_ElementsCreated = []; + + function HM_f_StoreElement(el){ + HM_a_ElementsCreated[HM_a_ElementsCreated.length] = el; + } +} + +function HM_f_AssignParameters(paramarray){ + var ParamName = paramarray[0]; + var DefaultValue = paramarray[1]; + var FullParamName = "HM_" + ParamName; + + if (typeof eval("window.HM_PG_" + ParamName) == "undefined") { + if (typeof eval("window.HM_GL_" + ParamName) == "undefined") { + eval(FullParamName + "= DefaultValue"); + } + else { + eval(FullParamName + "= HM_GL_" + ParamName); + } + } + else { + eval(FullParamName + "= HM_PG_" + ParamName); + } + + paramarray[0] = FullParamName; + paramarray[1] = eval(FullParamName); +} + +function HM_f_EvalParameters(valuenew,valueold,valuetype){ + var TestString, ParPosition; + + if(typeof valuenew == "undefined" || valuenew == null || (valuenew.isString && valuenew.length == 0)){ + return valueold; + } + + if(valuetype != "delayed"){ + while(valuenew.isString) { + ParPosition = valuenew.indexOf("("); + if(ParPosition !=-1) { + TestString = "window." + valuenew.substr(0,ParPosition); + if (typeof eval(TestString) != "undefined" && eval(TestString).isFunction) { + valuenew = eval(valuenew); + } + } + else break + } + } + + while(valuenew.isFunction) {valuenew = valuenew()} + + switch(valuetype){ + case "number": + while (valuenew.isString) {valuenew = eval(valuenew)} + break; + case "boolean": + while (!valuenew.isBoolean) { + valuenew = (valuenew.isNumber) ? valuenew ? true : false : eval(valuenew); + } + break; + } + + return valuenew; +} + +for (i=0;i 1) { + MenuArrayIsValid = true; + if(!TheMenuArray.itemValidation) { + while((typeof TheMenuArray[TheMenuArray.length-1] != "object") || (!TheMenuArray[TheMenuArray.length-1].isArray)) { + TheMenuArray.length--; + } + TheMenuArray.itemValidation = true; + } + } + } + return MenuArrayIsValid; +} + +if(!window.HM_a_TreesToBuild) { + HM_a_TreesToBuild = []; + for(i=1; i<100; i++){ + if(HM_f_ValidateArray(HM_ArrayIDPrefix + i)) HM_a_TreesToBuild[HM_a_TreesToBuild.length] = i; + } +} + +HM_CurrentArray = null; +HM_CurrentTree = null; +HM_CurrentMenu = null; +HM_CurrentItem = null; +HM_a_TopMenus = []; +HM_AreLoaded = false; +HM_AreCreated = false; +HM_BeingCreated = false; +HM_UserOverMenu = false; +HM_HideAllTimer = null; +HM_TotalTrees = 0; +HM_ZIndex = 5000; + +function HM_f_StartIt() { + if(HM_AreCreated) return; + if((typeof(document.body) == "undefined") || (document.body == null)) return; + HM_AreLoaded = true; + if (HM_ClickKill) { + HM_f_OtherMouseDown = (document.onmousedown) ? document.onmousedown : new Function; + document.onmousedown = function(){HM_f_PageClick();HM_f_OtherMouseDown()} + } + else { + HM_TopMilliSecondsVisible = HM_TopSecondsVisible * 1000; + } + HM_f_MakeTrees(); + HM_f_OtherOnLoad(); +} + +function HM_f_MakeTrees(){ + HM_BeingCreated = true; + var TreeParams = null; + var TreeHasChildren = false; + var ItemArray = null; + + for(var t=0; t WindowRightEdge) { + if (this.hasParent) { + this.xPos = ((ParentLeftEdge - this.parentItem.DistanceToLeftEdge) + this.parentItem.ChildOverlap) - this.offsetWidth; + } + else { + dif = MenuRightEdge - WindowRightEdge; + this.xPos -= dif; + } + this.xPos = Math.max(5,this.xPos); + } + + if (MenuBottomEdge > WindowBottomEdge) { + dif = MenuBottomEdge - WindowBottomEdge; + this.yPos -= dif; + } + + if (MenuLeftEdge < WindowLeftEdge) { + if (this.hasParent) { + this.xPos = (ParentLeftEdge + this.parentItem.DistanceToRightEdge) - this.parentItem.ChildOverlap; + MenuRightEdge = this.xPos + this.offsetWidth; + if(MenuRightEdge > WindowRightEdge) this.xPos -= (MenuRightEdge - WindowRightEdge); + } + else {this.xPos = 5} + } +} + +function HM_f_LinkIt() { + if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText) + else { + HM_f_HideAll(); + location.href = this.linkText; + } +} + +function HM_f_PopDown(menuname){ + if (!HM_AreLoaded || !HM_AreCreated) return; + menuname = menuname.replace("elMenu",HM_MenuIDPrefix); + var MenuToHide = document.getElementById(menuname); + if(!MenuToHide)return; + MenuToHide.isOn = false; + if (!HM_ClickKill) MenuToHide.hideTop(); +} + +function HM_f_HideAll(callingmenu) { + for(var i=0; i=0; i--){ + TempElement = HM_a_ElementsCreated[i]; + TempElement.parentMenu = null; + TempElement.parentItem = null; + TempElement.itemElement = null; + TempElement.currentItem = null; + TempElement.child = null; + TempElement.siblingBelow = null; + TempElement.imgLyr = null; + } + TempElement = null; + + for(var i=0; i