diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 0c212ce..9d00fb9 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -48,8 +48,14 @@ drupal: js: misc/drupal.js: { weight: -18 } dependencies: + - core/drupal-init - core/domready +drupal-init: + version: VERSION + js: + misc/drupal-init.js: { weight: -19 } + drupalSettings: version: VERSION drupalSettings: diff --git a/core/misc/drupal-init.js b/core/misc/drupal-init.js new file mode 100644 index 0000000..45725c4 --- /dev/null +++ b/core/misc/drupal-init.js @@ -0,0 +1,23 @@ +/** + * @file + * + * Base framework for Drupal-specific JavaScript, behaviors. + */ +(function (window) { + + "use strict"; + + window.Drupal = { behaviors: {}, locale: {} }; + + // Allows users to turn off animations. + var noAnimate = localStorage.getItem('Drupal.noAnimate') === 'true'; + // Class indicating that JS is enabled; used for styling purpose. + document.documentElement.className += ' js' + (noAnimate ? ' no-animate' : ''); + + // Allow other JavaScript libraries to use $. + if (window.jQuery) { + jQuery.noConflict(); + jQuery.fx.off = noAnimate; + } + +})(window); diff --git a/core/misc/drupal.js b/core/misc/drupal.js index dcfad00..1b6e023 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -1,18 +1,8 @@ /** - * Base framework for Drupal-specific JavaScript, behaviors, and settings. + * @file + * + * Drupal object API. */ -window.Drupal = { behaviors: {}, locale: {} }; - -// Class indicating that JS is enabled; used for styling purpose. -document.documentElement.className += ' js'; - -// Allow other JavaScript libraries to use $. -if (window.jQuery) { - jQuery.noConflict(); -} - -// JavaScript should be made compatible with libraries other than jQuery by -// wrapping it in an anonymous closure. (function (domready, Drupal, drupalSettings) { "use strict"; diff --git a/core/modules/system/css/system.module.css b/core/modules/system/css/system.module.css index cea7a25..cd05c4d 100644 --- a/core/modules/system/css/system.module.css +++ b/core/modules/system/css/system.module.css @@ -4,6 +4,14 @@ */ /** + * Accessibility styling. + */ +.no-animate * { + -webkit-transition: none !important; + transition: none !important; +} + +/** * Autocomplete. * * @see autocomplete.js