optimized again the code for NS4+

This commit is contained in:
Loïc Chapeaux
2001-06-17 18:11:54 +00:00
parent db8d66976c
commit ba3a2ba015

36
left.js
View File

@@ -81,10 +81,10 @@ if (isIE4) {
*/ */
function nsGetIndex(el) { function nsGetIndex(el) {
var ind = null; var ind = null;
var layersCnt = document.layers.length; var theLayers = document.layers;
var layersCnt = theLayers.length;
for (var i = 0; i < layersCnt; i++) { for (var i = 0; i < layersCnt; i++) {
var whichEl = document.layers[i]; if (theLayers[i].id == el) {
if (whichEl.id == el) {
ind = i; ind = i;
break; break;
} }
@@ -100,13 +100,13 @@ function nsGetIndex(el) {
*/ */
function nsArrangeList() { function nsArrangeList() {
if (firstInd != null) { if (firstInd != null) {
var nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height; var theLayers = document.layers;
var layersCnt = document.layers.length; var layersCnt = theLayers.length;
var nextY = theLayers[firstInd].pageY + theLayers[firstInd].document.height;
for (var i = firstInd + 1; i < layersCnt; i++) { for (var i = firstInd + 1; i < layersCnt; i++) {
var whichEl = document.layers[i]; if (theLayers[i].visibility != 'hide') {
if (whichEl.visibility != 'hide') { theLayers[i].pageY = nextY;
whichEl.pageY = nextY; nextY += theLayers[i].document.height;
nextY += whichEl.document.height;
} }
} }
} }
@@ -119,10 +119,10 @@ function nsArrangeList() {
* @access public * @access public
*/ */
function nsShowAll() { function nsShowAll() {
var layersCnt = document.layers.length; var theLayers = document.layers;
var layersCnt = theLayers.length;
for (i = firstInd; i < layersCnt; i++) { for (i = firstInd; i < layersCnt; i++) {
whichEl = document.layers[i]; theLayers[i].visibility = 'show';
whichEl.visibility = 'show';
} }
} // end of the 'nsShowAll()' function } // end of the 'nsShowAll()' function
@@ -154,13 +154,13 @@ function initIt()
} }
} // end of the IE4 case } // end of the IE4 case
else if (isNS4) { else if (isNS4) {
var layersCnt = document.layers.length; var theLayers = document.layers;
for (var i=0; i<layersCnt; i++) { var layersCnt = theLayers.length;
var whichEl = document.layers[i]; for (var i = 0; i < layersCnt; i++) {
if (whichEl.id.indexOf('Child') != -1) if (theLayers[i].id.indexOf('Child') != -1)
whichEl.visibility = 'hide'; theLayers[i].visibility = 'hide';
else else
whichEl.visibility = 'show'; theLayers[i].visibility = 'show';
} }
nsArrangeList(); nsArrangeList();
} // end of the NS4 case } // end of the NS4 case