diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 41406af..5b469dc 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -197,6 +197,12 @@ drupal.machine-name: - core/drupal - core/drupalSettings +drupal.no-animate: + version: VERSION + css: + base: + misc/no-animate.css: {} + drupal.progress: version: VERSION js: diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 34dbdc2..efebe5d 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1385,6 +1385,17 @@ function template_preprocess_html(&$variables) { 'name' => String::checkPlain($site_config->get('name')), ); } + + // Turn off animations. + if (TRUE || $site_config->get('no_animate')) { + $variables['attributes']['class'][] = 'no-animate'; + $variables['html']['#attached']['library'][] = 'core/drupal.no-animate'; + $variables['html']['#attached']['js'][] = [ + 'type' => 'setting', + 'data' => ['noAnimate' => TRUE], + ]; + } + // @todo Remove once views is not bypassing the view subscriber anymore. // @see http://drupal.org/node/2068471 elseif (drupal_is_front_page()) { diff --git a/core/misc/drupal.js b/core/misc/drupal.js index ce13994..194b3f2 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -9,6 +9,9 @@ document.documentElement.className += ' js'; // Allow other JavaScript libraries to use $. if (window.jQuery) { jQuery.noConflict(); + if (window.drupalSettings) { + jQuery.fx.off = drupalSettings.noAnimate; + } } // JavaScript should be made compatible with libraries other than jQuery by diff --git a/core/misc/no-animate.css b/core/misc/no-animate.css new file mode 100644 index 0000000..ac3f5b2 --- /dev/null +++ b/core/misc/no-animate.css @@ -0,0 +1,4 @@ +.no-animate * { + -webkit-transition: none !important; + transition: none !important; +}