X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Ftoolbar.menu.js;fp=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Ftoolbar.menu.js;h=5f7345d8d4e80d1aa8f654049a7010e4f17d8797;hp=45cfafbca87c36e0cdc3bf14f53a87d6044b093a;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/toolbar/js/toolbar.menu.js b/web/core/modules/toolbar/js/toolbar.menu.js index 45cfafbca..5f7345d8d 100644 --- a/web/core/modules/toolbar/js/toolbar.menu.js +++ b/web/core/modules/toolbar/js/toolbar.menu.js @@ -14,6 +14,17 @@ handleClose: Drupal.t('Collapse') }; + function toggleList($item, switcher) { + var $toggle = $item.children('.toolbar-box').children('.toolbar-handle'); + switcher = typeof switcher !== 'undefined' ? switcher : !$item.hasClass('open'); + + $item.toggleClass('open', switcher); + + $toggle.toggleClass('open', switcher); + + $toggle.find('.action').text(switcher ? ui.handleClose : ui.handleOpen); + } + function toggleClickHandler(event) { var $toggle = $(event.target); var $item = $toggle.closest('li'); @@ -32,17 +43,6 @@ event.stopPropagation(); } - function toggleList($item, switcher) { - var $toggle = $item.children('.toolbar-box').children('.toolbar-handle'); - switcher = typeof switcher !== 'undefined' ? switcher : !$item.hasClass('open'); - - $item.toggleClass('open', switcher); - - $toggle.toggleClass('open', switcher); - - $toggle.find('.action').text(switcher ? ui.handleClose : ui.handleOpen); - } - function initItems($menu) { var options = { class: 'toolbar-icon toolbar-handle', @@ -56,7 +56,9 @@ var $item = $(element); if ($item.children('ul.toolbar-menu').length) { var $box = $item.children('.toolbar-box'); - options.text = Drupal.t('@label', { '@label': $box.find('a').text() }); + options.text = Drupal.t('@label', { + '@label': $box.find('a').text() + }); $item.children('.toolbar-box').append(Drupal.theme('toolbarMenuItemToggle', options)); } }); @@ -72,9 +74,9 @@ } function openActiveItem($menu) { - var pathItem = $menu.find('a[href="' + location.pathname + '"]'); + var pathItem = $menu.find('a[href="' + window.location.pathname + '"]'); if (pathItem.length && !activeItem) { - activeItem = location.pathname; + activeItem = window.location.pathname; } if (activeItem) { var $activeItem = $menu.find('a[href="' + activeItem + '"]').addClass('menu-item--active'); @@ -98,6 +100,6 @@ }; Drupal.theme.toolbarMenuItemToggle = function (options) { - return ''; + return ''; }; })(jQuery, Drupal, drupalSettings); \ No newline at end of file