[TYPO3-core] G/T-MENU_LAYERS and Opera

Martin Kutschker Martin.Kutschker at blackbox.net
Tue Jul 5 10:09:00 CEST 2005


This is a CVS patch request.

Type: Bugfix

Description:
The patch detects newer versions of Opera and makes use of the improved interoperability. Layer menus will work now with 7 and 8, and may work with 5 and 6 (if you set height and with with CSS).

Branches: HEAD, TYPO3_3-8 (TYPO3_3-7?)

Bugtracker reference: http://bugs.typo3.org/view.php?id=24

Files:
jsfunc.layermenu.js.opera-patch

Masi 
-------------- next part --------------
--- jsfunc.layermenu.js.orig	2005-02-01 18:08:13.000000000 +0100
+++ jsfunc.layermenu.js	2005-07-05 09:49:28.044110144 +0200
@@ -51,14 +51,31 @@
 	//browsercheck...
 function GL_checkBrowser(){
 	this.dom= (document.getElementById);
-	this.op=this.opera= (navigator.userAgent.indexOf("Opera")>-1);
+
+		// detect version (even if Opera disguises as Mozilla or IE)
+	if (op = (navigator.userAgent.indexOf("Opera")>-1))	{
+		switch (parseInt(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6)))	{
+			case 5:
+			case 6:
+				this.op5= true;
+				break;
+			case 7:
+			case 8:
+				this.op7= true;
+				break;
+			default:
+				this.op4= true;
+		}
+	}
 	this.konq=  (navigator.userAgent.indexOf("Konq")>-1);
-	this.ie4= (document.all && !this.dom && !this.op && !this.konq);
-	this.ie5= (document.all && this.dom && !this.op && !this.konq);
+	this.ie4= (document.all && !this.dom && !op && !this.konq);
+	this.ie5= (document.all && this.dom && !op && !this.konq);
+	this.ie6= (this.ie5);
 	this.ns4= (document.layers && !this.dom && !this.konq);
-	this.ns5= (!document.all && this.dom && !this.op && !this.konq);
+	this.ns5= (!document.all && this.dom && !op && !this.konq);
 	this.ns6= (this.ns5);
-	this.bw=  (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.op || this.konq);
+	this.bw=  (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.konq || op);
+
 	return this;
 }
 bw= new GL_checkBrowser();
@@ -77,17 +94,18 @@
 	if (flag)	return true;
 };
 function GL_getObj(obj){
-//	nest= (!nest)?"":"document."+nest+".";
 	nest="";
 	this.el= bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document."+obj):document.getElementById(obj);	
-   	this.css= bw.ns4?this.el:this.el.style;
+	this.css= bw.ns4?this.el:this.el.style;
 	this.ref= bw.ns4?this.el.document:document;		
-	this.x= (bw.ns4||bw.op)?this.css.left:this.el.offsetLeft;
-	this.y= (bw.ns4||bw.op)?this.css.top:this.el.offsetTop;
-	this.height= (bw.ie4||bw.ie5||bw.ns6)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.op?this.css.pixelHeight:0;
-	this.width= (bw.ie4||bw.ie5||bw.ns6)?this.el.offsetWidth:bw.ns4?this.ref.width:bw.op?this.css.pixelWidth:0;
+	this.x= (bw.ns4||bw.op5)?this.css.left:this.el.offsetLeft;
+	this.y= (bw.ns4||bw.op5)?this.css.top:this.el.offsetTop;
+	this.height= (bw.ie4||bw.ie5||bw.ns6||bw.op7)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.op4?this.css.pixelHeight:0;
+	this.width= (bw.ie4||bw.ie5||bw.ns6||bw.op7)?this.el.offsetWidth:bw.ns4?this.ref.width:bw.op4?this.css.pixelWidth:0;
+
 	return this;
 }
+
 function GL_initLayers() {
 	if(bw.ns4) document.captureEvents(Event.MOUSEMOVE);
 	GL_timeout_func();
@@ -155,8 +173,8 @@
 }
 	//Capturing mousemove
 function GL_getMouse(e) {
-	GLV_x= (bw.ns4||bw.ns5)?e.pageX:(bw.ie4||bw.op)?event.x:(event.x-2)+document.body.scrollLeft;
-	GLV_y= (bw.ns4||bw.ns5)?e.pageY:(bw.ie4||bw.op)?event.y:(event.y-2)+document.body.scrollTop;
+	GLV_x= (bw.ns4||bw.ns5)?e.pageX:(bw.ie4||bw.op4)?event.x:(event.x-2)+document.body.scrollLeft;
+	GLV_y= (bw.ns4||bw.ns5)?e.pageY:(bw.ie4||bw.op4)?event.y:(event.y-2)+document.body.scrollTop;
 }
 function GL_mouseMoveEvaluate(WMid)	{
 	if (GLV_gap[WMid] && GLV_currentLayer[WMid]!=null)	{


More information about the TYPO3-team-core mailing list