Merge pull request #4677 from colemanw/CRM-15495
[civicrm-core.git] / js / crm.drupal.js
CommitLineData
f9f361d0
CW
1// http://civicrm.org/licensing
2CRM.$(function($) {
63b128df 3 $(document)
2aff1716 4 .on('crmLoad', function(e) {
63b128df 5 // This is drupal's old-school way of listening for 'load' type events. It has to be called manually.
2aff1716 6 Drupal.attachBehaviors(e.target);
63b128df 7 })
2aff1716 8 .on('crmUnload', function(e) {
818383a7
CW
9 // This function doesn't exist in D6 so call conditionally
10 if (typeof Drupal.detachBehaviors === 'function') {
11 Drupal.detachBehaviors(e.target);
12 }
af8c0ebe 13 })
63b128df
CW
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 })
f9f361d0 24});