[ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 // PHP Layers Menu 1.0.7 (c) 2001, 2002 Marco Pratesi <pratesi@telug.it> 2 3 DOM = (document.getElementById) ? 1 : 0; 4 NS4 = (document.layers) ? 1 : 0; 5 IE4 = (document.all) ? 1 : 0; 6 var loaded = 0; // to avoid stupid errors of Microsoft browsers 7 Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0; 8 // We need to explicitly detect Konqueror 9 // because Konqueror 3 sets IE4 = 1 ... AAAAAAAAAARGHHH!!! 10 Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1 || navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0; 11 12 // it works with NS4, Mozilla, NS6, Opera 5 and 6, IE 13 currentY = -1; 14 function grabMouse(e) { 15 if ((DOM && !IE4) || Opera5) { 16 currentY = e.clientY; 17 } else if (NS4) { 18 currentY = e.pageY; 19 } else { 20 currentY = event.y; 21 } 22 if (DOM && !IE4 && !Opera5 && !Konqueror) { 23 currentY += window.pageYOffset; 24 } else if (IE4 && DOM && !Opera5 && !Konqueror) { 25 currentY += document.body.scrollTop; 26 } 27 } 28 29 // Replace deprecated captureEvents with addEventListener 30 // by phppp since XOOPS 2.0.17 31 if (document.addEventListener){ 32 document.addEventListener('mousemove', grabMouse, false); 33 } else if (document.attachEvent){ 34 document.attachEvent('onmousemove', grabMouse); 35 } 36 37 function popUp(menuName,on) { 38 if (loaded) { // to avoid stupid errors of Microsoft browsers 39 if (on) { 40 // moveLayers(); 41 if (DOM) { 42 document.getElementById(menuName).style.visibility = "visible"; 43 document.getElementById(menuName).style.zIndex = 1000; 44 } else if (NS4) { 45 document.layers[menuName].visibility = "show"; 46 document.layers[menuName].zIndex = 1000; 47 } else { 48 document.all[menuName].style.visibility = "visible"; 49 document.all[menuName].style.zIndex = 1000; 50 } 51 } else { 52 if (DOM) { 53 document.getElementById(menuName).style.visibility = "hidden"; 54 } else if (NS4) { 55 document.layers[menuName].visibility = "hide"; 56 } else { 57 document.all[menuName].style.visibility = "hidden"; 58 } 59 } 60 } 61 } 62 63 function setleft(layer,x) { 64 if (DOM) { 65 document.getElementById(layer).style.left = x + 'px'; 66 } else if (NS4) { 67 document.layers[layer].left = x; 68 } else { 69 document.all[layer].style.pixelLeft = x; 70 } 71 } 72 73 function settop(layer,y) { 74 if (DOM) { 75 document.getElementById(layer).style.top = y + 'px'; 76 } else if (NS4) { 77 document.layers[layer].top = y; 78 } else { 79 document.all[layer].style.pixelTop = y; 80 } 81 } 82 83 function setwidth(layer,w) { 84 if (DOM) { 85 document.getElementById(layer).style.width = w; 86 document.getElementById(layer).style.width = w + 'px'; 87 } else if (NS4) { 88 // document.layers[layer].width = w; 89 } else { 90 document.all[layer].style.pixelWidth = w; 91 } 92 } 93 94 function moveLayerY(menuName, ordinata, e) { 95 if (loaded) { 96 // to avoid stupid errors of Microsoft browsers 97 //alert (ordinata); 98 // Konqueror: ordinata = -1 according to the initialization currentY = -1 99 // Opera: isNaN(ordinata), currentY is NaN, it seems that Opera ignores the initialization currentY = -1 100 if (ordinata != -1 && !isNaN(ordinata)) { // The browser has detected the mouse position 101 if (DOM) { 102 // attenzione a "px" !!! 103 if (e && e.clientY) { // just use the pos of the mouseOver event if we have it 104 document.getElementById(menuName).style.top = e.clientY + 'px'; 105 } else { 106 appoggio = parseInt(document.getElementById(menuName).style.top); 107 if (isNaN(appoggio)) appoggio = 0; 108 if (Math.abs(appoggio + ordinata_margin - ordinata) > thresholdY) 109 document.getElementById(menuName).style.top = (ordinata - ordinata_margin) + 'px'; 110 } 111 112 } else if (NS4) { 113 if (Math.abs(document.layers[menuName].top + ordinata_margin - ordinata) > thresholdY) 114 document.layers[menuName].top = ordinata - ordinata_margin; 115 } else { 116 if (Math.abs(document.all[menuName].style.pixelTop + ordinata_margin - ordinata) > thresholdY) 117 document.all[menuName].style.pixelTop = ordinata - ordinata_margin; 118 } 119 } 120 } 121 } 122
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |