Added Entity and Entity Reference Revisions which got dropped somewhere along the...
[yaffs-website] / web / core / modules / toolbar / js / escapeAdmin.js
1 /**
2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
5 * @preserve
6 **/
7
8 (function ($, Drupal, drupalSettings) {
9   var pathInfo = drupalSettings.path;
10   var escapeAdminPath = sessionStorage.getItem('escapeAdminPath');
11   var windowLocation = window.location;
12
13   if (!pathInfo.currentPathIsAdmin && !/destination=/.test(windowLocation.search)) {
14     sessionStorage.setItem('escapeAdminPath', windowLocation);
15   }
16
17   Drupal.behaviors.escapeAdmin = {
18     attach: function attach() {
19       var $toolbarEscape = $('[data-toolbar-escape-admin]').once('escapeAdmin');
20       if ($toolbarEscape.length && pathInfo.currentPathIsAdmin) {
21         if (escapeAdminPath !== null) {
22           $toolbarEscape.attr('href', escapeAdminPath);
23         } else {
24           $toolbarEscape.text(Drupal.t('Home'));
25         }
26       }
27     }
28   };
29 })(jQuery, Drupal, drupalSettings);