X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.drupal8.js;h=91c7080fbe293a5f50f466857b2e50ed230a911e;hb=4a2e07fa9f9e267278903fa93b31f540bce90eff;hp=ea8dadd79f6215d0f6b43aa586d600387b4e9259;hpb=1c1c8792890051ffcd8ae85e7781b0952bbf2907;p=civicrm-core.git diff --git a/js/crm.drupal8.js b/js/crm.drupal8.js index ea8dadd79f..91c7080fbe 100644 --- a/js/crm.drupal8.js +++ b/js/crm.drupal8.js @@ -17,13 +17,16 @@ localStorage.setItem('Drupal.toolbar.activeTabID', JSON.stringify('toolbar-item- // Wait for document.ready so Drupal's jQuery is available to this script $(function($) { - // Need Drupal's jQuery to listen to this event - jQuery(document).on('drupalToolbarTabChange', function(event, tab) { - if (CRM.menubar && CRM.menubar.position === 'below-cms-menu') { - var action = jQuery(tab).is('#toolbar-item-civicrm') ? 'show' : 'hide'; - CRM.menubar[action](); - } - }); + // If Drupal's jQuery isn't loaded (e.g. on a stripped-down front-end page), we don't need to worry about the toolbar + if (window.jQuery) { + // This event is only triggered by Drupal's copy of jQuery. CRM.$ won't pick it up. + jQuery(document).on('drupalToolbarTabChange', function (event, tab) { + if (CRM.menubar && CRM.menubar.position === 'below-cms-menu') { + var action = jQuery(tab).is('#toolbar-item-civicrm') ? 'show' : 'hide'; + CRM.menubar[action](); + } + }); + } }); })(CRM.$);