Subversion Repositories DevTools

Rev

Rev 1281 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1281 Rev 3904
Line 23... Line 23...
23
menuobj.document.close()
23
menuobj.document.close()
24
}
24
}
25
 
25
 
26
menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
26
menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
27
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
27
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
28
eventX=ie4? event.clientX : ns6? e.clientX : e.x
28
//eventX=ie4? event.clientX : ns6? e.clientX : e.x
29
eventY=ie4? event.clientY : ns6? e.clientY : e.y
29
//eventY=ie4? event.clientY : ns6? e.clientY : e.y
-
 
30
 
-
 
31
// Dont use event location as it wobbles around
-
 
32
// Use location of parent element
-
 
33
var targ;
-
 
34
if (e.target) targ = e.target;
-
 
35
else if (e.srcElement) targ = e.srcElement;
-
 
36
if (targ.nodeType == 3) // defeat Safari bug
-
 
37
targ = targ.parentNode;
-
 
38
var rect = targ.getBoundingClientRect();
-
 
39
eventX = rect.left;
-
 
40
eventY = rect.bottom;
30
 
41
 
31
//Find out how close the mouse is to the corner of the window
42
//Find out how close the mouse is to the corner of the window
32
var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
43
var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
33
var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
44
var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
34
 
45
 
35
//if the horizontal distance isn't enough to accomodate the width of the context menu
-
 
36
if (rightedge<menuobj.contentwidth)
-
 
37
//move the horizontal position of the menu to the left by it's width
-
 
38
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
-
 
39
else
-
 
40
//position the horizontal position of the menu where the mouse was clicked
46
//position the horizontal position of the menu where the mouse was clicked
41
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX
47
var left=ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX
-
 
48
 
-
 
49
//if the horizontal distance isn't enough to accomodate the width of the context menu
-
 
50
var delta = rightedge - menuobj.contentwidth;
-
 
51
if ( delta < 0 ) left+=delta;
42
 
52
 
43
//same concept with the vertical position
53
//same concept with the vertical position
-
 
54
var top = menuobj.thestyle.top=ie4? document.body.scrollTop+eventY : ns6? window.pageYOffset+eventY : eventY
-
 
55
 
-
 
56
// Don't adjust top. Assume menus are at the top. All adjusting will do is push the top off the screen
44
if (bottomedge<menuobj.contentheight)
57
//delta = bottomedge-menuobj.contentheight;
45
menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight
58
//if (delta < 0) top += delta;
46
else
59
 
47
menuobj.thestyle.top=ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY
60
menuobj.thestyle.left=left;
-
 
61
menuobj.thestyle.top=top;
48
menuobj.thestyle.visibility="visible"
62
menuobj.thestyle.visibility="visible"
49
return false
63
return false
50
}
64
}
51
 
65
 
52
function contains_ns6(a, b) {
66
function contains_ns6(a, b) {