Merge pull request #8101 from colemanw/CRM-18379
[civicrm-core.git] / js / crm.drupal.js
index 0e352f996a814b9501b8e8056d82cbaa8deb9228..2f14c499216e2e38bba0c202fc3a4d9b8cc9201d 100644 (file)
@@ -1,7 +1,14 @@
 // http://civicrm.org/licensing
 CRM.$(function($) {
-  $(document).on('crmLoad', function() {
-    // This is drupal's old-school way of listening for 'load' type events. It has to be called manually.
-    Drupal.attachBehaviors(this);
-  });
+  $(document)
+    .on('dialogopen', function(e) {
+      // D7 hack to get the toolbar out of the way (CRM-15341)
+      $('#toolbar').css('z-index', '100');
+    })
+    .on('dialogclose', function(e) {
+      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
+        // D7 hack, restore toolbar position (CRM-15341)
+        $('#toolbar').css('z-index', '');
+      }
+    });
 });