Opened 3 years ago

Closed 3 years ago

#1486610 closed Bugs (fixed)

Patch for splitter.js to support resize with an iframe at left or right

Reported by: epinter Owned by:
Priority: 5 Milestone: 0.4-beta
Component: User Interface Version: 0.3.1
Severity: normal Keywords:
Cc:

Description

--- splitter.js.old	2010-03-07 14:42:09.000000000 -0300
+++ splitter.js	2010-04-02 15:28:07.937980136 -0300
@@ -106,36 +106,16 @@
     rcube_event.add_listener({element:document, event:'mousemove', object:this, method:'onDrag'});
     rcube_event.add_listener({element:document, event:'mouseup', object:this, method:'onDragStop'});
 
-    // need to listen in any iframe documents too, b/c otherwise the splitter stops moving when we move over an iframe
-    var iframes = document.getElementsByTagName('iframe');
-    this.iframe_events = Object();
-    for (var n in iframes)
-      {
-      var iframedoc = null;
-      if (iframes[n].contentDocument)
-        iframedoc = iframes[n].contentDocument;
-      else if (iframes[n].contentWindow)
-        iframedoc = iframes[n].contentWindow.document;
-      else if (iframes[n].document)
-        iframedoc = iframes[n].document;
-      if (iframedoc)
-        {
-        // I don't use the add_listener function for this one because I need to create closures to fetch
-        // the position of each iframe when the event is received
-        var s = this;
-        var id = '#'+iframes[n].id;
-        this.iframe_events[n] = function(e){ e._offset = $(id).offset(); return s.onDrag(e); };
-
-        if (iframedoc.addEventListener)
-          iframedoc.addEventListener('mousemove', this.iframe_events[n], false);
-        else if (iframes[n].attachEvent)
-          iframedoc.attachEvent('onmousemove', this.iframe_events[n]);
-        else
-          iframedoc.onmousemove = this.iframe_events[n];
+    $("iframe").each(function() { 
+    $('<div class="iframeFix-splitter-rc-move000" style="background: #fff;"></div>') 
+    .css({ 
+    width: this.offsetWidth+"px", height: this.offsetHeight+"px", 
+    position: "absolute", opacity: "0.001", zIndex: 1000 
+    }) 
+    .css($(this).offset()) 
+    .appendTo("body"); 
+    }); 
 
-        rcube_event.add_listener({element:iframedoc, event:'mouseup', object:this, method:'onDragStop'});
-        }
-      }
     }
 
   /**
@@ -190,32 +170,7 @@
     rcube_event.remove_listener({element:document, event:'mouseup', object:this, method:'onDragStop'});
     this.drag_active = false;
 
-    var iframes = document.getElementsByTagName('iframe');
-
-    for (var n in iframes)
-      {
-      var iframedoc;
-      if (iframes[n].contentDocument)
-        iframedoc = iframes[n].contentDocument;
-      else if (iframes[n].contentWindow)
-        iframedoc = iframes[n].contentWindow.document;
-      else if (iframes[n].document)
-        iframedoc = iframes[n].document;
-
-      if (iframedoc)
-        {
-        if (this.iframe_events[n]) {
-          if (iframedoc.removeEventListener)
-            iframedoc.removeEventListener('mousemove', this.iframe_events[n], false);
-          else if (iframedoc.detachEvent)
-            iframedoc.detachEvent('onmousemove', this.iframe_events[n]);
-          else
-            iframedoc.onmousemove = null;
-          }
-
-        rcube_event.remove_listener({element:iframedoc, event:'mouseup', object:this, method:'onDragStop'});
-        }
-      }
+    $("div.iframeFix-splitter-rc-move000").each(function() { this.parentNode.removeChild(this); });
 
     this.set_cookie();
 

Change History (3)

comment:1 Changed 3 years ago by alec

  • Milestone changed from later to 0.4-beta

But why do we need this? Splitter with an iframe at right side is working. Could you please, explain this more precisselly?

comment:2 Changed 3 years ago by epinter

If we need to create another area with splitter below the folder list, the only way is use this patch...
Flexibility...

comment:3 Changed 3 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [ed60fef2].

Note: See TracTickets for help on using tickets.