Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b65a230d

Von Sven Schöling vor fast 15 Jahren hinzugefügt

  • ID b65a230d60e86d2c18a3ab7222379905aea5ecd7
  • Vorgänger 3cbc223a
  • Nachfolger 7e9a98a0

Tabs aus *.pl Dateien entfernt.

Unterschiede anzeigen:

bin/mozilla/menujs.pl
181 181
//var KO = (navigator.appName=="Konqueror" \|\| navigator.appName=="Opera") ;
182 182
var KO = ((navigator.userAgent.indexOf('Opera',0) != -1) \|\| (navigator.userAgent.indexOf('Konqueror',0) != -1));
183 183
function getRef(id) {
184
	if (isDOM) return document.getElementById(id);
185
	if (isIE4) return document.all[id];
186
	if (isNS4) return document.layers[id];
184
  if (isDOM) return document.getElementById(id);
185
  if (isIE4) return document.all[id];
186
  if (isNS4) return document.layers[id];
187 187
}
188 188
function getSty(id) {
189
	return (isNS4 ? getRef(id) : getRef(id).style);
189
  return (isNS4 ? getRef(id) : getRef(id).style);
190 190
}
191 191
var popTimer = 0;
192 192
var litNow = new Array();
193 193
function popOver(menuNum, itemNum) {
194
	if (KO) document.getElementById("win1").style.visibility = "hidden";
195
	clearTimeout(popTimer);
196
	hideAllBut(menuNum);
197
	litNow = getTree(menuNum, itemNum);
198
	changeCol(litNow, true);
199
	targetNum = menu[menuNum][itemNum].target;
200
	if (targetNum > 0) {
201
		thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
202
		thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
203
		with (menu[targetNum][0].ref) {
204
			left = parseInt(thisX + menu[targetNum][0].x);
205
			top = parseInt(thisY + menu[targetNum][0].y);
206
			visibility = 'visible';
207
		}
208
	}
194
  if (KO) document.getElementById("win1").style.visibility = "hidden";
195
  clearTimeout(popTimer);
196
  hideAllBut(menuNum);
197
  litNow = getTree(menuNum, itemNum);
198
  changeCol(litNow, true);
199
  targetNum = menu[menuNum][itemNum].target;
200
  if (targetNum > 0) {
201
    thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
202
    thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
203
    with (menu[targetNum][0].ref) {
204
      left = parseInt(thisX + menu[targetNum][0].x);
205
      top = parseInt(thisY + menu[targetNum][0].y);
206
      visibility = 'visible';
207
    }
208
  }
209 209
}
210 210
function popOut(menuNum, itemNum) {
211
	if ((menuNum == 0) && !menu[menuNum][itemNum].target)
212
		hideAllBut(0)
213
		if (KO) document.getElementById("win1").style.visibility = "visible";
214
	else
215
		popTimer = setTimeout('hideAllBut(0)', 500);
211
  if ((menuNum == 0) && !menu[menuNum][itemNum].target)
212
    hideAllBut(0)
213
    if (KO) document.getElementById("win1").style.visibility = "visible";
214
  else
215
    popTimer = setTimeout('hideAllBut(0)', 500);
216 216
}
217 217
function getTree(menuNum, itemNum) {
218
	itemArray = new Array(menu.length);
219
	while(1) {
220
		itemArray[menuNum] = itemNum;
221
		if (menuNum == 0) return itemArray;
222
		itemNum = menu[menuNum][0].parentItem;
223
		menuNum = menu[menuNum][0].parentMenu;
224
	}
218
  itemArray = new Array(menu.length);
219
  while(1) {
220
    itemArray[menuNum] = itemNum;
221
    if (menuNum == 0) return itemArray;
222
    itemNum = menu[menuNum][0].parentItem;
223
    menuNum = menu[menuNum][0].parentMenu;
224
  }
225 225
}
226 226
function changeCol(changeArray, isOver) {
227
	for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
228
		if (changeArray[menuCount]) {
229
			newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
230
			with (menu[menuCount][changeArray[menuCount]].ref) {
231
				if (isNS4) bgColor = newCol;
232
				else backgroundColor = newCol;
233
			}
234
		}
235
	}
227
  for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
228
    if (changeArray[menuCount]) {
229
      newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
230
      with (menu[menuCount][changeArray[menuCount]].ref) {
231
        if (isNS4) bgColor = newCol;
232
        else backgroundColor = newCol;
233
      }
234
    }
235
  }
236 236
}
237 237
function hideAllBut(menuNum) {
238
	var keepMenus = getTree(menuNum, 1);
239
	for (count = 0; count < menu.length; count++)
240
		if (!keepMenus[count])
241
			menu[count][0].ref.visibility = 'hidden';
242
	changeCol(litNow, false);
238
  var keepMenus = getTree(menuNum, 1);
239
  for (count = 0; count < menu.length; count++)
240
    if (!keepMenus[count])
241
      menu[count][0].ref.visibility = 'hidden';
242
  changeCol(litNow, false);
243 243
}
244 244

  
245 245
function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) {
246
	this.isVert = isVert;
247
	this.popInd = popInd
248
	this.x = x;
249
	this.y = y;
250
	this.width = width;
251
	this.overCol = overCol;
252
	this.backCol = backCol;
253
	this.borderClass = borderClass;
254
	this.textClass = textClass;
255
	this.parentMenu = null;
256
	this.parentItem = null;
257
	this.ref = null;
246
  this.isVert = isVert;
247
  this.popInd = popInd
248
  this.x = x;
249
  this.y = y;
250
  this.width = width;
251
  this.overCol = overCol;
252
  this.backCol = backCol;
253
  this.borderClass = borderClass;
254
  this.textClass = textClass;
255
  this.parentMenu = null;
256
  this.parentItem = null;
257
  this.ref = null;
258 258
}
259 259
function Item(text, href, frame, length, spacing, target) {
260
	this.text = text;
261
	this.href = href;
262
	this.frame = frame;
263
	this.length = length;
264
	this.spacing = spacing;
265
	this.target = target;
266
	this.ref = null;
260
  this.text = text;
261
  this.href = href;
262
  this.frame = frame;
263
  this.length = length;
264
  this.spacing = spacing;
265
  this.target = target;
266
  this.ref = null;
267 267
}
268 268
function go(link,frame) {
269
	tmp=eval("top."+frame);
270
	tmp.location=link;
269
  tmp=eval("top."+frame);
270
  tmp.location=link;
271 271
        //top.main_window.location=link;
272 272
}
273 273
function writeMenus() {
274
	if (!isDOM && !isIE4 && !isNS4) return;
275
	for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
276
		var str = '', itemX = 0, itemY = 0;
277
		for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
278
			var itemID = 'menu' + currMenu + 'item' + currItem;
279
			var w = (isVert ? width : length);
280
			var h = (isVert ? length : width);
281
			if (isDOM \|\| isIE4) {
282
				str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
283
				if (backCol) str += 'background: ' + backCol + '; ';
284
				str += '" ';
285
			}
286
			if (isNS4) {
287
				str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
288
				if (backCol) str += 'bgcolor="' + backCol + '" ';
289
			}
290
			if (borderClass) str += 'class="' + borderClass + '" "';
291
			str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';
292
			str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '">';
293
			str +='<tr><td class="' + textClass + '" style="cursor:pointer;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
294
			if (target > 0) {
295
				menu[target][0].parentMenu = currMenu;
296
				menu[target][0].parentItem = currItem;
297
				if (popInd) str += '<td class="' + textClass + '" align="right">' + popInd + '</td>';
298
			}
299
			str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
300
			if (isVert) itemY += length + spacing;
301
			else itemX += length + spacing;
302
		}
303
		if (isDOM) {
304
			var newDiv = document.createElement('div');
305
			document.getElementsByTagName('body').item(0).appendChild(newDiv);
306
			newDiv.innerHTML = str;
307
			ref = newDiv.style;
308
			ref.position = 'absolute';
309
			ref.visibility = 'hidden';
310
		}
311
		if (isIE4) {
312
			document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
313
			ref = getSty('menu' + currMenu + 'div');
314
		}
315
		if (isNS4) {
316
			ref = new Layer(0);
317
			ref.document.write(str);
318
			ref.document.close();
319
		}
320
		for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
321
			itemName = 'menu' + currMenu + 'item' + currItem;
322
			if (isDOM \|\| isIE4) menu[currMenu][currItem].ref = getSty(itemName);
323
			if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
324
		}
325
	}
326
	with(menu[0][0]) {
327
		ref.left = x;
328
		ref.top = y;
329
		ref.visibility = 'visible';
274
  if (!isDOM && !isIE4 && !isNS4) return;
275
  for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
276
    var str = '', itemX = 0, itemY = 0;
277
    for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
278
      var itemID = 'menu' + currMenu + 'item' + currItem;
279
      var w = (isVert ? width : length);
280
      var h = (isVert ? length : width);
281
      if (isDOM \|\| isIE4) {
282
        str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
283
        if (backCol) str += 'background: ' + backCol + '; ';
284
        str += '" ';
285
      }
286
      if (isNS4) {
287
        str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
288
        if (backCol) str += 'bgcolor="' + backCol + '" ';
289
      }
290
      if (borderClass) str += 'class="' + borderClass + '" "';
291
      str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';
292
      str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '">';
293
      str +='<tr><td class="' + textClass + '" style="cursor:pointer;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
294
      if (target > 0) {
295
        menu[target][0].parentMenu = currMenu;
296
        menu[target][0].parentItem = currItem;
297
        if (popInd) str += '<td class="' + textClass + '" align="right">' + popInd + '</td>';
298
      }
299
      str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
300
      if (isVert) itemY += length + spacing;
301
      else itemX += length + spacing;
302
    }
303
    if (isDOM) {
304
      var newDiv = document.createElement('div');
305
      document.getElementsByTagName('body').item(0).appendChild(newDiv);
306
      newDiv.innerHTML = str;
307
      ref = newDiv.style;
308
      ref.position = 'absolute';
309
      ref.visibility = 'hidden';
310
    }
311
    if (isIE4) {
312
      document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
313
      ref = getSty('menu' + currMenu + 'div');
314
    }
315
    if (isNS4) {
316
      ref = new Layer(0);
317
      ref.document.write(str);
318
      ref.document.close();
319
    }
320
    for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
321
      itemName = 'menu' + currMenu + 'item' + currItem;
322
      if (isDOM \|\| isIE4) menu[currMenu][currItem].ref = getSty(itemName);
323
      if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
324
    }
325
  }
326
  with(menu[0][0]) {
327
    ref.left = x;
328
    ref.top = y;
329
    ref.visibility = 'visible';
330 330
   }
331 331
}
332 332
var menu = new Array();
......
346 346
if (isNS4) document.captureEvents(Event.CLICK);
347 347
document.onclick = clickHandle;
348 348
function clickHandle(evt) {
349
	if (isNS4) document.routeEvent(evt);
350
	hideAllBut(0);
351
	if (KO) document.getElementById("win1").style.visibility = "visible";
349
  if (isNS4) document.routeEvent(evt);
350
  hideAllBut(0);
351
  if (KO) document.getElementById("win1").style.visibility = "visible";
352 352
}
353 353
function moveRoot() {
354
	with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
354
  with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
355 355
}
356 356
//  End -->
357 357
</script>
......
399 399

  
400 400
      # Untermen
401 401
      if ($mlz{"s$ml"} > 1) {
402
		$z++;
403
		$sm = 1;
402
        $z++;
403
        $sm = 1;
404 404
      } else {
405
		$z = $sm;
406
		$mlz{"s$ml"}++;
405
        $z = $sm;
406
        $mlz{"s$ml"}++;
407 407
      }
408 408
      print
409 409
        qq|menu[$mlz{$ml}][$z] = new Item('$label', '#', '', defLength, 0, |
......
435 435
        $sm    = 1;
436 436
        my $breit = 15 + length($label) * 6;
437 437
        print
438
          qq|menu[0][$mm] = new Item('  $label', '#', '', $breit, 10, $pm);	\n|;
438
          qq|menu[0][$mm] = new Item('  $label', '#', '', $breit, 10, $pm); \n|;
439 439
        print qq|menu[$pm] = new Array();\n|;
440 440
        print
441 441
          qq|menu[$pm][0] = new Menu(true, '>', 0, 20, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;

Auch abrufbar als: Unified diff