From 14a3f2813acf25c07e1ee861b564f826fe83fe20 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sat, 25 Feb 2012 10:20:36 -0500
Subject: [PATCH] Make popups disapear when clicking on an iframe; adapt IE hacks (#1488354)

---
 skins/larry/ie7hacks.css |    4 ++++
 skins/larry/iehacks.css  |    2 +-
 skins/larry/ui.js        |   46 ++++++++++++++++++++++++++++++----------------
 3 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/skins/larry/ie7hacks.css b/skins/larry/ie7hacks.css
index 0238d56..a5df38d 100644
--- a/skins/larry/ie7hacks.css
+++ b/skins/larry/ie7hacks.css
@@ -61,6 +61,10 @@
 	width: 140px;
 }
 
+.dropbutton .dropbuttontip {
+	right: 0;
+}
+
 #threadselectmenu li a {
 	width: 160px;
 }
diff --git a/skins/larry/iehacks.css b/skins/larry/iehacks.css
index 14f8556..b773967 100644
--- a/skins/larry/iehacks.css
+++ b/skins/larry/iehacks.css
@@ -128,7 +128,7 @@
 	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#82acb5', endColorstr='#6a939f', GradientType=0);
 }
 
-#mailboxlist li.mailbox.selected .unreadcount {
+#mailboxlist li.mailbox.selected > a .unreadcount {
 	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#005d76', endColorstr='#004558', GradientType=0);
 }
 
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 333dd50..86c1b0c 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -173,22 +173,7 @@
     // turn a group of fieldsets into tabs
     $('.tabbed').each(function(idx, elem){ init_tabs(elem); })
 
-    $(document.body).bind('mouseup', function(e){
-      var config, obj, target = e.target;
-      for (var id in popups) {
-        obj = popups[id];
-        config = popupconfig[id];
-        if (obj.is(':visible')
-          && target.id != id+'link'
-          && !config.toggle
-          && (!config.editable || !target_overlaps(target, obj.get(0)))
-          && (!config.sticky || !rcube_mouse_is_over(e, obj.get(0)))
-        ) {
-          var myid = id+'';
-          window.setTimeout(function(){ show_popupmenu(myid, false) }, 10);
-        }
-      }
-    })
+    $(document.body).bind('mouseup', body_mouseup)
     .bind('keyup', function(e){
       if (e.keyCode == 27) {
         for (var id in popups) {
@@ -198,6 +183,13 @@
       }
     });
 
+    $('iframe').load(function(e){
+      // this = iframe
+      var doc = this.contentDocument ? this.contentDocument : this.contentWindow ? this.contentWindow.document : null;
+      $(doc).mouseup(body_mouseup);
+    })
+    .contents().mouseup(body_mouseup);
+
     $(window).resize(function(e) {
       // check target due to bugs in jquery
       // http://bugs.jqueryui.com/ticket/7514
@@ -207,6 +199,28 @@
   }
 
   /**
+   * Handler for mouse-up events on the document body.
+   * This will close all open popup menus
+   */
+  function body_mouseup(e)
+  {
+    var config, obj, target = e.target;
+    for (var id in popups) {
+      obj = popups[id];
+      config = popupconfig[id];
+      if (obj.is(':visible')
+        && target.id != id+'link'
+        && !config.toggle
+        && (!config.editable || !target_overlaps(target, obj.get(0)))
+        && (!config.sticky || !rcube_mouse_is_over(e, obj.get(0)))
+      ) {
+        var myid = id+'';
+        window.setTimeout(function(){ show_popupmenu(myid, false) }, 10);
+      }
+    }
+  }
+
+  /**
    * Update UI on window resize
    */
   function resize()

--
Gitblit v1.9.1