diff --git a/core/core.libraries.yml b/core/core.libraries.yml index a6d963c..afc83f6 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -47,9 +47,15 @@ drupal: js: misc/drupal.js: { weight: -18 } dependencies: + - core/drupal-init - core/domready - core/drupalSettings +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 61d3299..312bef5 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -1,5 +1,7 @@ /** - * Base framework for Drupal-specific JavaScript, behaviors, and settings. + * @file + * + * Drupal object API. */ window.Drupal = {behaviors: {}}; diff --git a/core/modules/system/css/system.module.css b/core/modules/system/css/system.module.css index 9eb87dc..a641cf1 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