Merge pull request #4532 from colemanw/CRM-15346
[civicrm-core.git] / js / crm.drupal.js
1 // http://civicrm.org/licensing
2 CRM.$(function($) {
3 $(document)
4 .on('crmLoad', function(e) {
5 // This is drupal's old-school way of listening for 'load' type events. It has to be called manually.
6 Drupal.attachBehaviors(e.target);
7 })
8 .on('crmUnload', function(e) {
9 // This function doesn't exist in D6 so call conditionally
10 if (typeof Drupal.detachBehaviors === 'function') {
11 Drupal.detachBehaviors(e.target);
12 }
13 })
14 .on('dialogopen', function(e) {
15 // D7 hack to get the toolbar out of the way (CRM-15341)
16 $('#toolbar').css('z-index', '100');
17 })
18 .on('dialogclose', function(e) {
19 if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
20 // D7 hack, restore toolbar position (CRM-15341)
21 $('#toolbar').css('z-index', '');
22 }
23 })
24 });