Mercurial > hg > isophonics-drupal-site
annotate core/modules/toolbar/js/escapeAdmin.js @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 /** |
Chris@0 | 2 * DO NOT EDIT THIS FILE. |
Chris@0 | 3 * See the following change record for more information, |
Chris@0 | 4 * https://www.drupal.org/node/2815083 |
Chris@0 | 5 * @preserve |
Chris@0 | 6 **/ |
Chris@0 | 7 |
Chris@0 | 8 (function ($, Drupal, drupalSettings) { |
Chris@0 | 9 var pathInfo = drupalSettings.path; |
Chris@0 | 10 var escapeAdminPath = sessionStorage.getItem('escapeAdminPath'); |
Chris@0 | 11 var windowLocation = window.location; |
Chris@0 | 12 |
Chris@0 | 13 if (!pathInfo.currentPathIsAdmin && !/destination=/.test(windowLocation.search)) { |
Chris@0 | 14 sessionStorage.setItem('escapeAdminPath', windowLocation); |
Chris@0 | 15 } |
Chris@0 | 16 |
Chris@0 | 17 Drupal.behaviors.escapeAdmin = { |
Chris@0 | 18 attach: function attach() { |
Chris@0 | 19 var $toolbarEscape = $('[data-toolbar-escape-admin]').once('escapeAdmin'); |
Chris@0 | 20 if ($toolbarEscape.length && pathInfo.currentPathIsAdmin) { |
Chris@0 | 21 if (escapeAdminPath !== null) { |
Chris@0 | 22 $toolbarEscape.attr('href', escapeAdminPath); |
Chris@0 | 23 } else { |
Chris@0 | 24 $toolbarEscape.text(Drupal.t('Home')); |
Chris@0 | 25 } |
Chris@0 | 26 } |
Chris@0 | 27 } |
Chris@0 | 28 }; |
Chris@0 | 29 })(jQuery, Drupal, drupalSettings); |