escapeAdmin.js 919 B

1234567891011121314151617181920212223242526272829
  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. (function ($, Drupal, drupalSettings) {
  8. var pathInfo = drupalSettings.path;
  9. var escapeAdminPath = sessionStorage.getItem('escapeAdminPath');
  10. var windowLocation = window.location;
  11. if (!pathInfo.currentPathIsAdmin && !/destination=/.test(windowLocation.search)) {
  12. sessionStorage.setItem('escapeAdminPath', windowLocation);
  13. }
  14. Drupal.behaviors.escapeAdmin = {
  15. attach: function attach() {
  16. var $toolbarEscape = $('[data-toolbar-escape-admin]').once('escapeAdmin');
  17. if ($toolbarEscape.length && pathInfo.currentPathIsAdmin) {
  18. if (escapeAdminPath !== null) {
  19. $toolbarEscape.attr('href', escapeAdminPath);
  20. } else {
  21. $toolbarEscape.text(Drupal.t('Home'));
  22. }
  23. }
  24. }
  25. };
  26. })(jQuery, Drupal, drupalSettings);