| 1 |
/* |
/* |
| 2 |
JSCookMenu v2.0.1 (c) Copyright 2002-2006 by Heng Yuan |
JSCookMenu v2.0.3 (c) Copyright 2002-2006 by Heng Yuan |
| 3 |
|
|
| 4 |
http://jscook.sourceforge.net/JSCookMenu/ |
http://jscook.sourceforge.net/JSCookMenu/ |
| 5 |
|
|
| 116 |
|
|
| 117 |
var _cmFrameList = new Array (); // a pool of reusable iframes |
var _cmFrameList = new Array (); // a pool of reusable iframes |
| 118 |
var _cmFrameListSize = 0; // keep track of the actual size |
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 |
var _cmFrameMasking = true; // use the frame masking |
| 121 |
|
|
| 122 |
// disable iframe masking for IE7 |
// disable iframe masking for IE7 |
| 156 |
// |
// |
| 157 |
// store the new menu information into a structure to retrieve it later |
// store the new menu information into a structure to retrieve it later |
| 158 |
// |
// |
| 159 |
function cmAllocMenu (div, menu, orient, nodeProperties, prefix) |
function cmAllocMenu (id, menu, orient, nodeProperties, prefix) |
| 160 |
{ |
{ |
| 161 |
var info = new Object (); |
var info = new Object (); |
| 162 |
info.div = div; |
info.div = id; |
| 163 |
info.menu = menu; |
info.menu = menu; |
| 164 |
info.orient = orient; |
info.orient = orient; |
| 165 |
info.nodeProperties = nodeProperties; |
info.nodeProperties = nodeProperties; |
| 175 |
function cmAllocFrame () |
function cmAllocFrame () |
| 176 |
{ |
{ |
| 177 |
if (_cmFrameListSize > 0) |
if (_cmFrameListSize > 0) |
| 178 |
return _cmFrameList[--_cmFrameListSize]; |
return cmGetObject (_cmFrameList[--_cmFrameListSize]); |
| 179 |
var frameObj = document.createElement ('iframe'); |
var frameObj = document.createElement ('iframe'); |
| 180 |
|
var id = _cmFrameIDCount++; |
| 181 |
|
frameObj.id = 'cmFrame' + id; |
| 182 |
frameObj.frameBorder = '0'; |
frameObj.frameBorder = '0'; |
| 183 |
frameObj.style.display = 'none'; |
frameObj.style.display = 'none'; |
| 184 |
|
frameObj.src = 'javascript:false'; |
| 185 |
document.body.appendChild (frameObj); |
document.body.appendChild (frameObj); |
| 186 |
frameObj.style.filter = 'alpha(opacity=0)'; |
frameObj.style.filter = 'alpha(opacity=0)'; |
| 187 |
frameObj.style.zIndex = 99; |
frameObj.style.zIndex = 99; |
| 196 |
// |
// |
| 197 |
function cmFreeFrame (frameObj) |
function cmFreeFrame (frameObj) |
| 198 |
{ |
{ |
| 199 |
_cmFrameList[_cmFrameListSize++] = frameObj; |
_cmFrameList[_cmFrameListSize++] = frameObj.id; |
| 200 |
} |
} |
| 201 |
|
|
| 202 |
////////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////////// |
| 251 |
return ' onmouseover="cmItemMouseOver (' + param + ')" onmouseout="cmItemMouseOut (' + param + ')"'; |
return ' onmouseover="cmItemMouseOver (' + param + ')" onmouseout="cmItemMouseOut (' + param + ')"'; |
| 252 |
} |
} |
| 253 |
|
|
| 254 |
function cmNoActionItem (item, prefix) |
function cmNoActionItem (item) |
| 255 |
{ |
{ |
| 256 |
return item[1]; |
return item[1]; |
| 257 |
} |
} |
| 275 |
// |
// |
| 276 |
// draw the sub menu recursively |
// draw the sub menu recursively |
| 277 |
// |
// |
| 278 |
function cmDrawSubMenu (subMenu, prefix, id, orient, nodeProperties, zIndexStart, menuInfo, menuID) |
function cmDrawSubMenu (subMenu, prefix, id, nodeProperties, zIndexStart, menuInfo, menuID) |
| 279 |
{ |
{ |
| 280 |
var str = '<div class="' + prefix + 'SubMenu" id="' + id + '" style="z-index: ' + zIndexStart + ';position: absolute; top: 0px; left: 0px;">'; |
var str = '<div class="' + prefix + 'SubMenu" id="' + id + '" style="z-index: ' + zIndexStart + ';position: absolute; top: 0px; left: 0px;">'; |
| 281 |
if (nodeProperties.subMenuHeader) |
if (nodeProperties.subMenuHeader) |
| 316 |
|
|
| 317 |
if (item[0] == _cmNoAction || item[0] == _cmNoClick) |
if (item[0] == _cmNoAction || item[0] == _cmNoClick) |
| 318 |
{ |
{ |
| 319 |
str += cmNoActionItem (item, prefix); |
str += cmNoActionItem (item); |
| 320 |
str += '</tr>'; |
str += '</tr>'; |
| 321 |
continue; |
continue; |
| 322 |
} |
} |
| 338 |
if (hasChild) |
if (hasChild) |
| 339 |
{ |
{ |
| 340 |
str += nodeProperties.folderRight; |
str += nodeProperties.folderRight; |
| 341 |
strSub += cmDrawSubMenu (item, prefix, idSub, orient, nodeProperties, zIndexStart + nodeProperties.zIndexInc, menuInfo, menuID); |
strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, zIndexStart + nodeProperties.zIndexInc, menuInfo, menuID); |
| 342 |
} |
} |
| 343 |
else |
else |
| 344 |
str += nodeProperties.itemRight; |
str += nodeProperties.itemRight; |
| 372 |
prefix = ''; |
prefix = ''; |
| 373 |
if (!nodeProperties) |
if (!nodeProperties) |
| 374 |
nodeProperties = _cmNodeProperties; |
nodeProperties = _cmNodeProperties; |
| 375 |
|
if (!orient) |
| 376 |
|
orient = 'hbr'; |
| 377 |
|
|
| 378 |
var menuID = cmAllocMenu (obj, menu, orient, nodeProperties, prefix); |
var menuID = cmAllocMenu (id, menu, orient, nodeProperties, prefix); |
| 379 |
var menuInfo = _cmMenuList[menuID]; |
var menuInfo = _cmMenuList[menuID]; |
| 380 |
|
|
| 381 |
// setup potentially missing properties |
// setup potentially missing properties |
| 394 |
if (!nodeProperties.offsetSubAdjust) |
if (!nodeProperties.offsetSubAdjust) |
| 395 |
nodeProperties.offsetSubAdjust = _cmNodeProperties.offsetSubAdjust; |
nodeProperties.offsetSubAdjust = _cmNodeProperties.offsetSubAdjust; |
| 396 |
// save user setting on frame masking |
// save user setting on frame masking |
| 397 |
nodeProperties.cmFrameMasking = _cmFrameMasking; |
menuInfo.cmFrameMasking = _cmFrameMasking; |
| 398 |
|
|
| 399 |
var str = '<table summary="main menu" class="' + prefix + 'Menu" cellspacing="' + nodeProperties.mainSpacing + '">'; |
var str = '<table summary="main menu" class="' + prefix + 'Menu" cellspacing="' + nodeProperties.mainSpacing + '">'; |
| 400 |
var strSub = ''; |
var strSub = ''; |
| 401 |
|
|
|
if (!orient) |
|
|
orient = 'hbr'; |
|
|
|
|
|
var orientStr = String (orient); |
|
|
var orientSub; |
|
| 402 |
var vertical; |
var vertical; |
| 403 |
|
|
| 404 |
// draw the main menu items |
// draw the main menu items |
| 405 |
if (orientStr.charAt (0) == 'h') |
if (orient.charAt (0) == 'h') |
| 406 |
{ |
{ |
|
// horizontal menu |
|
|
orientSub = 'v' + orientStr.substr (1, 2); |
|
| 407 |
str += '<tr>'; |
str += '<tr>'; |
| 408 |
vertical = false; |
vertical = false; |
| 409 |
} |
} |
| 410 |
else |
else |
| 411 |
{ |
{ |
|
// vertical menu |
|
|
orientSub = 'v' + orientStr.substr (1, 2); |
|
| 412 |
vertical = true; |
vertical = true; |
| 413 |
} |
} |
| 414 |
|
|
| 442 |
|
|
| 443 |
if (item[0] == _cmNoAction || item[0] == _cmNoClick) |
if (item[0] == _cmNoAction || item[0] == _cmNoClick) |
| 444 |
{ |
{ |
| 445 |
str += cmNoActionItem (item, prefix); |
str += cmNoActionItem (item); |
| 446 |
str += vertical? '</tr>' : '</td>'; |
str += vertical? '</tr>' : '</td>'; |
| 447 |
continue; |
continue; |
| 448 |
} |
} |
| 472 |
str += vertical ? '</tr>' : '</td>'; |
str += vertical ? '</tr>' : '</td>'; |
| 473 |
|
|
| 474 |
if (hasChild) |
if (hasChild) |
| 475 |
strSub += cmDrawSubMenu (item, prefix, idSub, orientSub, nodeProperties, nodeProperties.zIndexStart, menuInfo, menuID); |
strSub += cmDrawSubMenu (item, prefix, idSub, nodeProperties, nodeProperties.zIndexStart, menuInfo, menuID); |
| 476 |
} |
} |
| 477 |
if (!vertical) |
if (!vertical) |
| 478 |
str += '</tr>'; |
str += '</tr>'; |
| 1003 |
// IE specific iframe masking method |
// IE specific iframe masking method |
| 1004 |
/*@cc_on |
/*@cc_on |
| 1005 |
@if (@_jscript_version >= 5.5) |
@if (@_jscript_version >= 5.5) |
| 1006 |
if (menuInfo.nodeProperties.cmFrameMasking) |
if (menuInfo.cmFrameMasking) |
| 1007 |
{ |
{ |
| 1008 |
if (!subMenu.cmFrameObj) |
if (!subMenu.cmFrameObj) |
| 1009 |
{ |
{ |
| 1227 |
} |
} |
| 1228 |
|
|
| 1229 |
cmShowControl (thisMenu); |
cmShowControl (thisMenu); |
| 1230 |
|
thisMenu.cmItems = null; |
| 1231 |
} |
} |
| 1232 |
|
|
| 1233 |
// |
// |
| 1547 |
return msg; |
return msg; |
| 1548 |
} |
} |
| 1549 |
|
|
| 1550 |
|
/* v2.0.3 1. Fix an issue with IE6 displaying menu over HTTPS connection. |
| 1551 |
|
Thanks to Paul Horton for reporting the bug and testing |
| 1552 |
|
possible solutions. */ |
| 1553 |
|
/* v2.0.2 1. Minor clean up and some attempts to reduce memory leak in IE. */ |
| 1554 |
/* v2.0.1 1. Disable iframe masking for IE7 since it is no longer necessary. */ |
/* v2.0.1 1. Disable iframe masking for IE7 since it is no longer necessary. */ |
| 1555 |
/* v2.0 1. improves the way handling flash/iframe/select boxes in IE |
/* v2.0 1. improves the way handling flash/iframe/select boxes in IE |
| 1556 |
and firefox and Opera 9. Hiding these elements is no |
and firefox and Opera 9. Hiding these elements is no |