diff --git a/interface/devtools/style.css b/interface/devtools/style.css index fe9b493..76a787e 100644 --- a/interface/devtools/style.css +++ b/interface/devtools/style.css @@ -14,6 +14,12 @@ body { font-size: 1em; overflow: hidden; } +.notransition *, .notransition *::before { + -webkit-transition: none !important; + -moz-transition: none !important; + -o-transition: none !important; + transition: none !important; +} #cookie-container { overflow-y: auto; flex: 1 1 auto; diff --git a/interface/lib/animate.js b/interface/lib/animate.js index d3fef75..f5d9cba 100644 --- a/interface/lib/animate.js +++ b/interface/lib/animate.js @@ -110,6 +110,7 @@ export class Animate { * @param {Element} newPage Page that will be inserted in the container. * @param {string} direction Which direction to slide the old page towards. * @param {function} callback Called after the animation is done. + * @param {boolean} animationsEnabled If the animations are enabled or not. */ static transitionPage( container, @@ -117,7 +118,16 @@ export class Animate { newPage, direction = 'left', callback = null, + animationsEnabled = true, ) { + if (!animationsEnabled) { + if (oldPage) { + oldPage.remove(); + } + container.appendChild(newPage); + callback(); + return; + } const animationTime = '0.3s'; container.addEventListener( diff --git a/interface/lib/options/options.js b/interface/lib/options/options.js index f2f226e..425e1df 100644 --- a/interface/lib/options/options.js +++ b/interface/lib/options/options.js @@ -12,6 +12,7 @@ export class Options { constructor() { this.advancedCookies = false; this.devtoolsEnabled = true; + this.animationsEnabled = true; this.exportFormat = ExportFormats.Ask; this.extraInfo = ExtraInfos.Nothing; this.theme = Themes.Auto; diff --git a/interface/lib/optionsHandler.js b/interface/lib/optionsHandler.js index afee126..5bde3f9 100644 --- a/interface/lib/optionsHandler.js +++ b/interface/lib/optionsHandler.js @@ -67,6 +67,25 @@ export class OptionsHandler extends EventEmitter { this.saveOptions(); } + /** + * Gets whether the animations are enabled or not. + * @return {boolean} True if the animations are enabled, otherwise false. + */ + getAnimationsEnabled() { + // Uses `!==` false in order to be opt-in by default, since it was added at + // a later time. + return this.options.animationsEnabled !== false; + } + /** + * Sets whether the animations are enabled or not. + * @param {boolean} animationsEnabled True if the animations are enabled, + * otherwise false. + */ + setAnimationsEnabled(animationsEnabled) { + this.options.animationsEnabled = animationsEnabled; + this.saveOptions(); + } + /** * Gets the export format used by the export button. * @return {ExportFormats} One of the supported export format. @@ -207,7 +226,9 @@ export class OptionsHandler extends EventEmitter { * @return {boolean} True if ads are enabled, otherwise false. */ getAdsEnabled() { - return this.options.adsEnabled; + // Uses `!==` false in order to be opt-in by default, since it was added at + // a later time. + return this.options.adsEnabled !== false; } /** * Sets whether the ads are enabled or not. diff --git a/interface/options/options.html b/interface/options/options.html index 9c788fe..a22d3dd 100644 --- a/interface/options/options.html +++ b/interface/options/options.html @@ -42,6 +42,18 @@ +
+ + +
+ When Enabled, Cookie-Editor will show transitions and other various + animations in the interface. This is for appearance only. +
+
+