X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.drupal7.js;h=8f172f23b9798ff9f57cd9a3d86ea8da227d361e;hb=1a10d7ed9e639131ccd758c5130a06c26101037a;hp=4be65e41065e27201a0c8fb9245bb3dec818b5a2;hpb=da1ad7aad9f3b6496444899dabcaa03e223224e3;p=civicrm-core.git diff --git a/js/crm.drupal7.js b/js/crm.drupal7.js index 4be65e4106..8f172f23b9 100644 --- a/js/crm.drupal7.js +++ b/js/crm.drupal7.js @@ -1,15 +1,18 @@ -// http://civicrm.org/licensing -CRM.$(function($) { - $(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', ''); +// https://civicrm.org/licensing +(function($) { + "use strict"; + + $(document).on('crmLoad', '#civicrm-menu', hideMenuToggleButtonForNonAdminUsers); + + /** + * Hides the Menu Toggle Button when the Admin Menu is not available for the user. + */ + function hideMenuToggleButtonForNonAdminUsers() { + $(document).ready(function() { + if (!$('#toolbar').length) { + CRM.menubar.removeToggleButton(); } }); - $('#civicrm-menu').css({'width': '97%'}); -}); + } + +})(CRM.$);