Fixed #6955: fileadmin contextual menu doesn't popup well
authorBenni Mack <benni.mack@typo3.org>
Sun, 16 Dec 2007 16:14:54 +0000 (16:14 +0000)
committerBenni Mack <benni.mack@typo3.org>
Sun, 16 Dec 2007 16:14:54 +0000 (16:14 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2842 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/js/clickmenu.js

index 1f1d4ba..4fd78b5 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-12-16  Benjamin Mack  <mack@xnos.org>
+
+       * (bugfix) #6955: fileadmin contextual menu doesn't popup well
+
 2007-12-16  Ingo Renner        <ingo@typo3.org>
 
        * removed width css property from workspace selector toolbar item as it caused layout issues in non english backends
index 228e55b..d554a36 100644 (file)
@@ -37,13 +37,20 @@ window.getDimensions = function() {
 
 
 /**
- * extends prototype's Position object 
+ * extends the window object to identify the scroll offset of the page
  *
  * @return     an object with a top and a left position property
  */
-Position.getScrollOffset = function() {
-       this.prepare();
-       return { top: this.deltaY, left: this.deltaX };
+window.getScrollOffset = function() {
+        var l = window.pageXOffset
+                || document.documentElement.scrollLeft
+                || document.body.scrollLeft
+                || 0;
+        var t = window.pageYOffset
+                || document.documentElement.scrollTop
+                || document.body.scrollTop
+                || 0;
+        return { top: t, left: l };
 }
 
 /**
@@ -124,7 +131,7 @@ var Clickmenu = {
                        dimsWindow.width = dimsWindow.width-20; // saving margin for scrollbars
 
                        var dims = Element.getDimensions(obj); // dimensions for the clickmenu
-                       var offset = Position.getScrollOffset();
+                       var offset = window.getScrollOffset();
                        var relative = { X: this.mousePos.X - offset.left, Y: this.mousePos.Y - offset.top };
 
                        // adjusting the Y position of the layer to fit it into the window frame
@@ -143,8 +150,7 @@ var Clickmenu = {
                                        x -= (dims.width - 10);
                                } else if ((dimsWindow.width - dims.width - relative.X) < offset.left) {
                                        x = offset.left;
-                               }
-                               else {
+                               } else {
                                        x += (dimsWindow.width - dims.width - relative.X);
                                }
                        }
@@ -158,6 +164,7 @@ var Clickmenu = {
                }
        },
 
+
        /**
         * event handler function that saves the actual position of the mouse
         * in the Clickmenu object