comparison core/modules/toolbar/js/escapeAdmin.js @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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);