51
43
// HTML code to the left of the regular item
53
45
// HTML code to the right of the regular item
56
48
// sub menu display attributes
58
50
// HTML code to the left of the folder item
60
52
// HTML code to the right of the folder item
62
54
// HTML code to the left of the regular item
64
56
// HTML code to the right of the regular item
66
58
// cell spacing for main menu
68
60
// cell spacing for sub menus
64
// If not set, use the default
70
66
// auto disappear time for submenus in milli-seconds
69
// 1st layer sub menu starting index
71
// z-index incremental step for subsequent layers
74
// sub menu header appears before the sub menu table
76
// sub menu header appears after the sub menu table
79
// submenu location adjustments
81
// offsetHMainAdjust for adjusting the first submenu
83
// offsetVMainAdjust for adjusting the first submenu
85
// offsetSubAdjust for subsequent level of submenus
87
offsetHMainAdjust: [0, 0],
88
offsetVMainAdjust: [0, 0],
89
offsetSubAdjust: [0, 0],
91
// act on click to open sub menu
92
// not yet implemented
93
// 0 : use default behavior
94
// 1 : hover open in all cases
95
// 2 : click on main, hover on sub
96
// 3 : click open in all cases (illegal as of 1.5)
99
// special effects on open/closing a sub menu
105
var _cmIDName = 'cmSubMenuID'; // for creating submenu id
107
var _cmTimeOut = null; // how long the menu would stay
108
var _cmCurrentItem = null; // the current menu item being selected;
110
var _cmNoAction = new Object (); // indicate that the item cannot be hovered.
111
var _cmNoClick = new Object (); // similar to _cmNoAction but does not respond to mouseup/mousedown events
112
var _cmSplit = new Object (); // indicate that the item is a menu split
114
var _cmMenuList = new Array (); // a list of the current menus
115
var _cmItemList = new Array (); // a simple list of items
117
var _cmFrameList = new Array (); // a pool of reusable iframes
118
var _cmFrameListSize = 0; // keep track of the actual size
119
var _cmFrameIDCount = 0; // keep track of the frame id
120
var _cmFrameMasking = true; // use the frame masking
122
// disable iframe masking for IE7
124
@if (@_jscript_version >= 5.6)
127
var v = navigator.appVersion;
128
var i = v.indexOf ("MSIE ");
131
if (parseInt (navigator.appVersion.substring (i + 5)) >= 7)
132
_cmFrameMasking = false;
138
var _cmClicked = false; // for onClick
140
// flag for turning on off hiding objects
145
var _cmHideObjects = 0;
147
// Utility function to do a shallow copy a node property
148
function cmClone (nodeProperties)
150
var returnVal = new Object ();
151
for (v in nodeProperties)
152
returnVal[v] = nodeProperties[v];
157
// store the new menu information into a structure to retrieve it later
159
function cmAllocMenu (id, menu, orient, nodeProperties, prefix)
161
var info = new Object ();
164
info.orient = orient;
165
info.nodeProperties = nodeProperties;
166
info.prefix = prefix;
167
var menuID = _cmMenuList.length;
168
_cmMenuList[menuID] = info;
175
function cmAllocFrame ()
177
if (_cmFrameListSize > 0)
178
return cmGetObject (_cmFrameList[--_cmFrameListSize]);
179
var frameObj = document.createElement ('iframe');
180
var id = _cmFrameIDCount++;
181
frameObj.id = 'cmFrame' + id;
182
frameObj.frameBorder = '0';
183
frameObj.style.display = 'none';
184
frameObj.src = 'javascript:false';
185
document.body.appendChild (frameObj);
186
frameObj.style.filter = 'alpha(opacity=0)';
187
frameObj.style.zIndex = 99;
188
frameObj.style.position = 'absolute';
189
frameObj.style.border = '0';
190
frameObj.scrolling = 'no';
195
// make a frame resuable later
197
function cmFreeFrame (frameObj)
199
_cmFrameList[_cmFrameListSize++] = frameObj.id;
74
202
//////////////////////////////////////////////////////////////////////
76
204
// Drawing Functions and Utility Functions
89
217
// return the property string for the menu item
91
function cmActionItem (item, prefix, isMain, idSub, orient, nodeProperties)
219
function cmActionItem (item, isMain, idSub, menuInfo, menuID)
93
// var index = _cmItemList.push (item) - 1;
94
221
_cmItemList[_cmItemList.length] = item;
95
222
var index = _cmItemList.length - 1;
96
223
idSub = (!idSub) ? 'null' : ('\'' + idSub + '\'');
97
orient = '\'' + orient + '\'';
98
prefix = '\'' + prefix + '\'';
99
return ' onmouseover="cmItemMouseOver (this,' + prefix + ',' + isMain + ',' + idSub + ',' + orient + ',' + index + ')" onmouseout="cmItemMouseOut (this,' + nodeProperties.delay + ')" onmousedown="cmItemMouseDown (this,' + index + ')" onmouseup="cmItemMouseUp (this,' + index + ')"';
225
var clickOpen = menuInfo.nodeProperties.clickOpen;
226
var onClick = (clickOpen == 3) || (clickOpen == 2 && isMain);
228
var param = 'this,' + isMain + ',' + idSub + ',' + menuID + ',' + index;
232
returnStr = ' onmouseover="cmItemMouseOver(' + param + ',false)" onmousedown="cmItemMouseDownOpenSub (' + param + ')"';
234
returnStr = ' onmouseover="cmItemMouseOverOpenSub (' + param + ')" onmousedown="cmItemMouseDown (' + param + ')"';
235
return returnStr + ' onmouseout="cmItemMouseOut (' + param + ')" onmouseup="cmItemMouseUp (' + param + ')"';
103
239
// this one is used by _cmNoClick to only take care of onmouseover and onmouseout
104
240
// events which are associated with menu but not actions associated with menu clicking/closing
106
function cmNoClickItem (item, prefix, isMain, idSub, orient, nodeProperties)
242
function cmNoClickItem (item, isMain, idSub, menuInfo, menuID)
108
244
// var index = _cmItemList.push (item) - 1;
109
245
_cmItemList[_cmItemList.length] = item;
110
246
var index = _cmItemList.length - 1;
111
247
idSub = (!idSub) ? 'null' : ('\'' + idSub + '\'');
112
orient = '\'' + orient + '\'';
113
prefix = '\'' + prefix + '\'';
114
return ' onmouseover="cmItemMouseOver (this,' + prefix + ',' + isMain + ',' + idSub + ',' + orient + ',' + index + ')" onmouseout="cmItemMouseOut (this,' + nodeProperties.delay + ')"';
249
var param = 'this,' + isMain + ',' + idSub + ',' + menuID + ',' + index;
251
return ' onmouseover="cmItemMouseOver (' + param + ')" onmouseout="cmItemMouseOut (' + param + ')"';
117
function cmNoActionItem (item, prefix)
254
function cmNoActionItem (item)
302
if (item == _cmSplit)
303
item = cmSplitItem (prefix, 0, true);
304
item.parentItem = subMenu;
161
307
hasChild = (item.length > 5);
162
308
idSub = hasChild ? cmNewID () : null;
164
310
str += '<tr class="' + prefix + 'MenuItem"';
165
311
if (item[0] != _cmNoClick)
166
str += cmActionItem (item, prefix, 0, idSub, orient, nodeProperties);
312
str += cmActionItem (item, 0, idSub, menuInfo, menuID);
168
str += cmNoClickItem (item, prefix, 0, idSub, orient, nodeProperties);
171
if (item == _cmSplit)
173
str += cmSplitItem (prefix, 0, true);
314
str += cmNoClickItem (item, 0, idSub, menuInfo, menuID);
178
317
if (item[0] == _cmNoAction || item[0] == _cmNoClick)
180
str += cmNoActionItem (item, prefix);
319
str += cmNoActionItem (item);
193
332
str += hasChild ? nodeProperties.folderLeft : nodeProperties.itemLeft;
195
str += '<td class="' + classStr + 'Text">' + item[1];
334
str += '</td><td class="' + classStr + 'Text">' + item[1];
197
str += '<td class="' + classStr + 'Right">';
336
str += '</td><td class="' + classStr + 'Right">';
201
340
str += nodeProperties.folderRight;
202
strSub += cmDrawSubMenu (item, prefix, idSub, orient, nodeProperties);
341
strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, zIndexStart + nodeProperties.zIndexInc, menuInfo, menuID);
205
344
str += nodeProperties.itemRight;
206
345
str += '</td></tr>';
209
str += '</table></div>' + strSub;
350
if (nodeProperties.subMenuFooter)
351
str += nodeProperties.subMenuFooter;
352
str += '</div>' + strSub;
214
357
// The function that builds the menu inside the specified element id.
216
// @param id id of the element
217
// orient orientation of the menu in [hv][ab][lr] format
218
// menu the menu object to be drawn
219
// nodeProperties properties for each menu node
359
// id id of the element
360
// orient orientation of the menu in [hv][ub][lr] format
361
// menu the menu object to be drawn
362
// nodeProperties properties for the theme
363
// prefix prefix of the theme
221
365
function cmDraw (id, menu, orient, nodeProperties, prefix)
223
367
var obj = cmGetObject (id);
370
prefix = nodeProperties.prefix;
225
373
if (!nodeProperties)
226
374
nodeProperties = _cmNodeProperties;
230
var str = '<table summary="main menu" class="' + prefix + 'Menu" cellspacing="' + nodeProperties.mainSpacing + '">';
236
var orientStr = String (orient);
378
var menuID = cmAllocMenu (id, menu, orient, nodeProperties, prefix);
379
var menuInfo = _cmMenuList[menuID];
381
// setup potentially missing properties
382
if (!nodeProperties.delay)
383
nodeProperties.delay = _cmNodeProperties.delay;
384
if (!nodeProperties.clickOpen)
385
nodeProperties.clickOpen = _cmNodeProperties.clickOpen;
386
if (!nodeProperties.zIndexStart)
387
nodeProperties.zIndexStart = _cmNodeProperties.zIndexStart;
388
if (!nodeProperties.zIndexInc)
389
nodeProperties.zIndexInc = _cmNodeProperties.zIndexInc;
390
if (!nodeProperties.offsetHMainAdjust)
391
nodeProperties.offsetHMainAdjust = _cmNodeProperties.offsetHMainAdjust;
392
if (!nodeProperties.offsetVMainAdjust)
393
nodeProperties.offsetVMainAdjust = _cmNodeProperties.offsetVMainAdjust;
394
if (!nodeProperties.offsetSubAdjust)
395
nodeProperties.offsetSubAdjust = _cmNodeProperties.offsetSubAdjust;
396
// save user setting on frame masking
397
menuInfo.cmFrameMasking = _cmFrameMasking;
399
var str = '<table summary="main menu" class="' + prefix + 'Menu" cellspacing="' + nodeProperties.mainSpacing + '">';
240
404
// draw the main menu items
241
if (orientStr.charAt (0) == 'h')
405
if (orient.charAt (0) == 'h')
244
orientSub = 'v' + orientStr.substr (1, 2);
246
408
vertical = false;
251
orientSub = 'v' + orientStr.substr (1, 2);
269
432
str += vertical ? '<tr' : '<td';
270
433
str += ' class="' + prefix + 'MainItem"';
272
435
hasChild = (item.length > 5);
273
436
idSub = hasChild ? cmNewID () : null;
275
str += cmActionItem (item, prefix, 1, idSub, orient, nodeProperties) + '>';
438
str += cmActionItem (item, 1, idSub, menuInfo, menuID) + '>';
277
440
if (item == _cmSplit)
279
str += cmSplitItem (prefix, 1, vertical);
280
str += vertical? '</tr>' : '</td>';
441
item = cmSplitItem (prefix, 1, vertical);
284
443
if (item[0] == _cmNoAction || item[0] == _cmNoClick)
286
str += cmNoActionItem (item, prefix);
445
str += cmNoActionItem (item);
287
446
str += vertical? '</tr>' : '</td>';
313
472
str += vertical ? '</tr>' : '</td>';
316
strSub += cmDrawSubMenu (item, prefix, idSub, orientSub, nodeProperties);
475
strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, nodeProperties.zIndexStart, menuInfo, menuID);
320
479
str += '</table>' + strSub;
321
480
obj.innerHTML = str;
322
//document.write ("<xmp>" + str + "</xmp>");
484
// The function builds the menu inside the specified element id.
486
// This function is similar to cmDraw except that menu is taken from HTML node
487
// rather a javascript tree. This feature allows links to be scanned by search
490
// This function basically converts HTML node to a javascript tree, and then calls
491
// cmDraw to draw the actual menu, replacing the hidden menu tree.
495
// <ul style="visibility: hidden">
496
// <li><span>icon</span><a href="link" title="description">main menu text</a>
498
// <li><span>icon</span><a href="link" title="description">submenu item</a>
505
function cmDrawFromText (id, orient, nodeProperties, prefix)
507
var domMenu = cmGetObject (id);
509
for (var currentDomItem = domMenu.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling)
511
if (!currentDomItem.tagName)
513
var tag = currentDomItem.tagName.toLowerCase ();
514
if (tag != 'ul' && tag != 'ol')
516
menu = cmDrawFromTextSubMenu (currentDomItem);
520
cmDraw (id, menu, orient, nodeProperties, prefix);
524
// a recursive function that build menu tree structure
526
function cmDrawFromTextSubMenu (domMenu)
528
var items = new Array ();
529
for (var currentDomItem = domMenu.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling)
531
if (!currentDomItem.tagName || currentDomItem.tagName.toLowerCase () != 'li')
533
if (currentDomItem.firstChild == null)
535
items[items.length] = _cmSplit;
538
var item = new Array ();
539
var currentItem = currentDomItem.firstChild;
540
var hasAction = false;
541
for (; currentItem; currentItem = currentItem.nextSibling)
543
// scan for span or div tag
544
if (!currentItem.tagName)
546
if (currentItem.className == 'cmNoClick')
548
item[0] = _cmNoClick;
549
item[1] = getActionHTML (currentItem);
553
if (currentItem.className == 'cmNoAction')
555
item[0] = _cmNoAction;
556
item[1] = getActionHTML (currentItem);
560
var tag = currentItem.tagName.toLowerCase ();
563
if (!currentItem.firstChild)
566
item[0] = currentItem.innerHTML;
567
currentItem = currentItem.nextSibling;
572
items[items.length] = item;
577
for (; currentItem; currentItem = currentItem.nextSibling)
579
if (!currentItem.tagName)
581
var tag = currentItem.tagName.toLowerCase ();
584
item[1] = currentItem.innerHTML;
585
item[2] = currentItem.href;
586
item[3] = currentItem.target;
587
item[4] = currentItem.title;
591
else if (tag == 'span' || tag == 'div')
593
item[1] = currentItem.innerHTML;
601
for (; currentItem; currentItem = currentItem.nextSibling)
604
if (!currentItem.tagName)
606
var tag = currentItem.tagName.toLowerCase ();
607
if (tag != 'ul' && tag != 'ol')
609
var subMenuItems = cmDrawFromTextSubMenu (currentItem);
610
for (i = 0; i < subMenuItems.length; ++i)
611
item[i + 5] = subMenuItems[i];
614
items[items.length] = item;
620
// obtain the actual action item's action, which is inside a
621
// table. The first row should be it
623
function getActionHTML (htmlNode)
625
var returnVal = '<td></td><td></td><td></td>';
627
// find the table first
628
for (currentDomItem = htmlNode.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling)
630
if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'table')
636
for (currentDomItem = currentDomItem.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling)
638
if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'tbody')
644
for (currentDomItem = currentDomItem.firstChild; currentDomItem; currentDomItem = currentDomItem.nextSibling)
646
if (currentDomItem.tagName && currentDomItem.tagName.toLowerCase () == 'tr')
651
return currentDomItem.innerHTML;
655
// get the DOM object associated with the item
657
function cmGetMenuItem (item)
661
var subMenu = cmGetObject (item.subMenuID);
662
// we are dealing with a main menu item
665
var menu = item.menu;
666
// skip over table, tbody, tr, reach td
667
subMenu = subMenu.firstChild.firstChild.firstChild.firstChild;
669
for (i = 0; i < menu.length; ++i)
673
subMenu = subMenu.nextSibling;
676
else if (item.parentItem) // sub menu item
678
var menu = item.parentItem;
679
var table = cmGetObject (item.subMenuID + 'Table');
682
// skip over table, tbody, reach tr
683
subMenu = table.firstChild.firstChild;
685
for (i = 5; i < menu.length; ++i)
689
subMenu = subMenu.nextSibling;
696
// disable a menu item
698
function cmDisableItem (item, prefix)
702
var menuItem = cmGetMenuItem (item);
706
menuItem.className = prefix + 'MainItemDisabled';
708
menuItem.className = prefix + 'MenuItemDisabled';
709
item.isDisabled = true;
713
// enable a menu item
715
function cmEnableItem (item, prefix)
719
var menuItem = cmGetMenuItem (item);
723
menu.className = prefix + 'MainItem';
725
menu.className = prefix + 'MenuItem';
726
item.isDisabled = false;
325
729
//////////////////////////////////////////////////////////////////////
396
819
obj.className = prefix + 'MenuItemHover';
826
// action should be taken for mouse moving in to the menu item
828
// This function also opens sub menu
830
function cmItemMouseOverOpenSub (obj, isMain, idSub, menuID, index)
832
clearTimeout (_cmTimeOut);
834
if (_cmItemList[index].isDisabled)
837
cmItemMouseOver (obj, isMain, idSub, menuID, index, true);
401
841
var subMenu = cmGetObject (idSub);
402
cmShowSubMenu (obj, prefix, subMenu, orient);
842
var menuInfo = _cmMenuList[menuID];
843
var orient = menuInfo.orient;
844
var prefix = menuInfo.prefix;
845
cmShowSubMenu (obj, isMain, subMenu, menuInfo);
407
descript = (item[4] != null) ? item[4] : (item[2] ? item[2] : descript);
408
else if (item.length > 2)
409
descript = (item[2] ? item[2] : descript);
411
window.defaultStatus = descript;
415
850
// action should be taken for mouse moving out of the menu item
417
function cmItemMouseOut (obj, delayTime)
852
function cmItemMouseOut (obj, isMain, idSub, menuID, index)
420
delayTime = _cmNodeProperties.delay;
854
var delayTime = _cmMenuList[menuID].nodeProperties.delay;
421
855
_cmTimeOut = window.setTimeout ('cmHideMenuTime ()', delayTime);
422
856
window.defaultStatus = '';
426
860
// action should be taken for mouse button down at a menu item
428
function cmItemMouseDown (obj, index)
862
function cmItemMouseDown (obj, isMain, idSub, menuID, index)
864
if (_cmItemList[index].isDisabled)
430
867
if (cmIsDefaultItem (_cmItemList[index]))
869
var prefix = _cmMenuList[menuID].prefix;
432
870
if (obj.cmIsMain)
433
obj.className = obj.cmPrefix + 'MainItemActive';
871
obj.className = prefix + 'MainItemActive';
435
obj.className = obj.cmPrefix + 'MenuItemActive';
873
obj.className = prefix + 'MenuItemActive';
878
// action should be taken for mouse button down at a menu item
879
// this is one also opens submenu if needed
881
function cmItemMouseDownOpenSub (obj, isMain, idSub, menuID, index)
883
if (_cmItemList[index].isDisabled)
887
cmItemMouseDown (obj, isMain, idSub, menuID, index);
891
var subMenu = cmGetObject (idSub);
892
var menuInfo = _cmMenuList[menuID];
893
cmShowSubMenu (obj, isMain, subMenu, menuInfo);
440
898
// action should be taken for mouse button up at a menu item
442
function cmItemMouseUp (obj, index)
900
function cmItemMouseUp (obj, isMain, idSub, menuID, index)
902
if (_cmItemList[index].isDisabled)
444
905
var item = _cmItemList[index];
446
907
var link = null, target = '_self';
492
955
// move submenu to the appropriate location
494
// @param obj the menu item that opens up the subMenu
495
// subMenu the sub menu to be shown
496
// orient the orientation of the subMenu
498
function cmMoveSubMenu (obj, subMenu, orient)
957
function cmMoveSubMenu (obj, isMain, subMenu, menuInfo)
959
var orient = menuInfo.orient;
965
if (orient.charAt (0) == 'h')
966
offsetAdjust = menuInfo.nodeProperties.offsetHMainAdjust;
968
offsetAdjust = menuInfo.nodeProperties.offsetVMainAdjust;
971
offsetAdjust = menuInfo.nodeProperties.offsetSubAdjust;
973
if (!isMain && orient.charAt (0) == 'h')
974
orient = 'v' + orient.charAt (1) + orient.charAt (2);
500
976
var mode = String (orient);
501
977
var p = subMenu.offsetParent;
502
978
var subMenuWidth = cmGetWidth (subMenu);
504
980
if (mode.charAt (0) == 'h')
506
982
if (mode.charAt (1) == 'b')
507
subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj)) + 'px';
983
subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) + offsetAdjust[1]) + 'px';
509
subMenu.style.top = (cmGetYAt (obj, p) - cmGetHeight (subMenu)) + 'px';
985
subMenu.style.top = (cmGetYAt (obj, p) - cmGetHeight (subMenu) - offsetAdjust[1]) + 'px';
510
986
if (horiz == 'r')
511
subMenu.style.left = (cmGetXAt (obj, p)) + 'px';
987
subMenu.style.left = (cmGetXAt (obj, p) + offsetAdjust[0]) + 'px';
513
subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) - subMenuWidth) + 'px';
989
subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) - subMenuWidth - offsetAdjust[0]) + 'px';
517
993
if (horiz == 'r')
518
subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj)) + 'px';
994
subMenu.style.left = (cmGetXAt (obj, p) + cmGetWidth (obj) + offsetAdjust[0]) + 'px';
520
subMenu.style.left = (cmGetXAt (obj, p) - subMenuWidth) + 'px';
996
subMenu.style.left = (cmGetXAt (obj, p) - subMenuWidth - offsetAdjust[0]) + 'px';
521
997
if (mode.charAt (1) == 'b')
522
subMenu.style.top = (cmGetYAt (obj, p)) + 'px';
998
subMenu.style.top = (cmGetYAt (obj, p) + offsetAdjust[1]) + 'px';
524
subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) - cmGetHeight (subMenu)) + 'px';
1000
subMenu.style.top = (cmGetYAt (obj, p) + cmGetHeight (obj) - cmGetHeight (subMenu) + offsetAdjust[1]) + 'px';
1003
// IE specific iframe masking method
1005
@if (@_jscript_version >= 5.5)
1006
if (menuInfo.cmFrameMasking)
1008
if (!subMenu.cmFrameObj)
1010
var frameObj = cmAllocFrame ();
1011
subMenu.cmFrameObj = frameObj;
1014
var frameObj = subMenu.cmFrameObj;
1015
frameObj.style.zIndex = subMenu.style.zIndex - 1;
1016
frameObj.style.left = (cmGetX (subMenu) - cmGetX (frameObj.offsetParent)) + 'px';
1017
frameObj.style.top = (cmGetY (subMenu) - cmGetY (frameObj.offsetParent)) + 'px';
1018
frameObj.style.width = cmGetWidth (subMenu) + 'px';
1019
frameObj.style.height = cmGetHeight (subMenu) + 'px';
1020
frameObj.style.display = 'block';
1024
if (horiz != orient.charAt (2))
1025
orient = orient.charAt (0) + orient.charAt (1) + horiz;
585
1084
subMenu.cmParentMenu = thisMenu;
586
1085
if (!thisMenu.cmSubMenu)
587
1086
thisMenu.cmSubMenu = new Array ();
588
//thisMenu.cmSubMenu.push (subMenu);
589
1087
thisMenu.cmSubMenu[thisMenu.cmSubMenu.length] = subMenu;
592
// position the sub menu
593
cmMoveSubMenu (obj, subMenu, orient);
594
subMenu.style.visibility = 'visible';
597
// On IE, controls such as SELECT, OBJECT, IFRAME (before 5.5)
598
// are window based controls. So, if the sub menu and these
599
// controls overlap, sub menu would be hidden behind them. Thus
600
// one needs to turn the visibility of these controls off when the
601
// sub menu is showing, and turn their visibility back on
602
// when the sub menu is hiding.
604
if (document.all) // it is IE
606
/* part of Felix Zaslavskiy's fix on hiding controls
607
not really sure if this part is necessary, but shouldn't
1090
var effectInstance = subMenu.cmEffect;
1092
effectInstance.showEffect (true);
1095
// position the sub menu only if we are not already showing the submenu
1096
var orient = cmMoveSubMenu (obj, isMain, subMenu, menuInfo);
1097
subMenu.cmOrient = orient;
1099
var forceShow = false;
1100
if (subMenu.style.visibility != 'visible' && menuInfo.nodeProperties.effect)
1104
effectInstance = menuInfo.nodeProperties.effect.getInstance (subMenu, orient);
1105
effectInstance.showEffect (false);
1110
subMenu.cmEffect = null;
1118
subMenu.style.visibility = 'visible';
1120
@if (@_jscript_version >= 5.5)
1121
if (subMenu.cmFrameObj)
1122
subMenu.cmFrameObj.style.display = 'block';
1128
if (!_cmHideObjects)
1130
_cmHideObjects = 2; // default = not hide, may change behavior later
1135
if (parseInt (navigator.appVersion) < 9)
1144
if (_cmHideObjects == 1)
609
1146
if (!subMenu.cmOverlap)
610
1147
subMenu.cmOverlap = new Array ();
612
/*@if (@_jscript_version >= 5.5)
614
1148
cmHideControl ("IFRAME", subMenu);
616
cmHideControl ("SELECT", subMenu);
617
1149
cmHideControl ("OBJECT", subMenu);
646
1188
function cmHideMenuTime ()
648
1191
if (_cmCurrentItem)
650
var prefix = _cmCurrentItem.cmPrefix;
651
cmHideMenu (cmGetThisMenu (_cmCurrentItem, prefix), null, prefix);
1193
var menuInfo = _cmMenuList[_cmCurrentItem.cmMenuID];
1194
var prefix = menuInfo.prefix;
1195
cmHideMenu (cmGetThisMenu (_cmCurrentItem, prefix), null, menuInfo);
1196
_cmCurrentItem = null;
1201
// Only hides this menu
1203
function cmHideThisMenu (thisMenu, menuInfo)
1205
var effectInstance = thisMenu.cmEffect;
1207
effectInstance.hideEffect (true);
1210
thisMenu.style.visibility = 'hidden';
1211
thisMenu.style.top = '0px';
1212
thisMenu.style.left = '0px';
1213
thisMenu.cmOrient = null;
1215
@if (@_jscript_version >= 5.5)
1216
if (thisMenu.cmFrameObj)
1218
var frameObj = thisMenu.cmFrameObj;
1219
frameObj.style.display = 'none';
1220
frameObj.style.width = '1px';
1221
frameObj.style.height = '1px';
1222
thisMenu.cmFrameObj = null;
1223
cmFreeFrame (frameObj);
1229
cmShowControl (thisMenu);
1230
thisMenu.cmItems = null;
1550
/* v2.0.4 1. Fixed the bug that cmEnableItem setting the wrong isDisabled value.
1551
2. Fixed a missing semicolon issue.
1553
/* v2.0.3 1. Fix an issue with IE6 displaying menu over HTTPS connection.
1554
Thanks to Paul Horton for reporting the bug and testing
1557
/* v2.0.2 1. Minor clean up and some attempts to reduce memory leak in IE.
1559
/* v2.0.1 1. Disable iframe masking for IE7 since it is no longer necessary.
1561
/* v2.0 1. improves the way handling flash/iframe/select boxes in IE
1562
and firefox and Opera 9. Hiding these elements is no
1563
longer necessary. For older versions of Opera, flash/iframe
1564
still need to be hidden.
1565
2. Improves cmDrawFromText (). Also allows custom actions.
1566
3. Improves clickOpen behavior. Now once a submenu is opened,
1567
opening other sub menus no longer requires clicking.
1568
4. Special Effects. This version has hooks that allow people
1569
to install special effects to various themes.
1570
5. For a given menu item, cmGetMenuitem(item) provides the ability
1571
to find the corresponding DOM element.
1572
6. Disable API. If you know which item to disable, you can call
1573
cmDisableItem(item, themePrefix) and cmEnableItem(item, themePrefix).
1574
However, you will have to provide your own CSS for the item.
1575
For purposes other than to disable an item, cmGetMenuItem (item)
1576
is provided for locating HTML DOM element of the menu item in concern.
1577
7. Better z-index. Now you can specify in the theme property the
1578
starting z-index and incremental step for submenus.
1579
8. Allow themes to insert additional elements before and after
1581
9. Improved themes. More organized and easier to customize.
1582
10. Add a flag to control hiding/nohiding objects/iframes. By default,
1583
only Opera before 9 hides objects.
1584
11. Add new property options to control submenu positions to fine tune
1586
12. It is no longer necessary to specify the theme name while calling
1587
cmDraw and cmDrawFromText. Currently it still accepts it, but it
1588
will not in the future.
1590
/* v1.4.4 1. a quick fix for a bug for _cmSplit checking. reported by
1593
/* v1.4.3 1. changed how _cmSplit is handled a bit so that _cmNoClick can work
1594
properly. All splits in predefined themes are changed to use
1595
_cmNoClick instead of _cmNoAction.
1597
/* v1.4.2 1. fixed _cmNoClick mouse hoover bug.
1598
2. fixed a statusbar text problem that cause text to disappear when
1599
hoovering mouse within the same menu item.
1600
3. changed the behavior of cmDrawFromText s.t. if the title of the
1601
of a link is empty, the actual url is used as text. To clear
1602
this link information, title needs to be ' '.
1604
/* v1.4.1 1. fixed a problem introduced in 1.4 where re-entering a main menu
1605
item which doesn't have a child can disable its hover setting.
1606
Apparently I deleted an extra line of code when I was doing
1607
cleaning up. Reported by David Maliachi and a few others.
1609
/* JSCookMenu v1.4 1. fixed a minor td cell closure problem. Thanks to Georg Lorenz
1610
<georg@lonux.de> for discovering that.
1611
2. added clickOpen to nodeProperties. See _cmNodeProperties for
1612
description. Basically menus can be opened on click only.
1613
3. added an ability to draw menu from an html node instead of a javascript
1614
tree, making this script search bot friendly (I hope?).
925
1616
/* JSCookMenu v1.31 1. fix a bug on IE with causes submenus to display at the top
926
1617
left corner due to doctype. The fix was provided by
927
1618
Burton Strauss <Burton@ntopsupport.com>.