X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Ftoolbar.menu.js;h=5f7345d8d4e80d1aa8f654049a7010e4f17d8797;hb=f3baf763d342a5f82576890e2a8111a5aaf139dc;hp=45cfafbca87c36e0cdc3bf14f53a87d6044b093a;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website
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