Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / toolbar / js / toolbar.menu.js
index 45cfafbca87c36e0cdc3bf14f53a87d6044b093a..5f7345d8d4e80d1aa8f654049a7010e4f17d8797 100644 (file)
       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',
@@ -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');
   };
 
   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