X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.drupal7.js;h=8f172f23b9798ff9f57cd9a3d86ea8da227d361e;hb=d80e1bc268c69784ae534cecc31c09449270be60;hp=fe3c5b9ec637d0527b82f5496daa30ce08ac20fd;hpb=7481d51b832ba89932216bcc67bedbc17d7fc651;p=civicrm-core.git diff --git a/js/crm.drupal7.js b/js/crm.drupal7.js index fe3c5b9ec6..8f172f23b9 100644 --- a/js/crm.drupal7.js +++ b/js/crm.drupal7.js @@ -1,19 +1,18 @@ -// http://civicrm.org/licensing +// https://civicrm.org/licensing (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', ''); - } - }) - .on('crmLoad', '#civicrm-menu', function(e) { - if ($('#toolbar a.toggle').length) { - $('#civicrm-menu').css({width: 'calc(100% - 40px)'}); + "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(); } }); + } + })(CRM.$);