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');
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',
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));
}
});
}
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');
};
Drupal.theme.toolbarMenuItemToggle = function (options) {
- return '<button class="' + options.class + '"><span class="action">' + options.action + '</span><span class="label">' + options.text + '</span></button>';
+ return '<button class="' + options.class + '"><span class="action">' + options.action + '</span> <span class="label">' + options.text + '</span></button>';
};
})(jQuery, Drupal, drupalSettings);
\ No newline at end of file