summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-10-10 10:47:02 -0400
committerGitHub <noreply@github.com>2020-10-10 10:47:02 -0400
commit6799b87cc6bc9c456b65e37d72f3003f45c47737 (patch)
treeffcaa1a1f5795a7f053ddb816167bceda47550d6 /ext/bg/js
parent591253d783f12850587c0d2202ee7c0a5bc62531 (diff)
Make animation optional for Modal.setVisible (#903)
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/settings/modal.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/ext/bg/js/settings/modal.js b/ext/bg/js/settings/modal.js
index 0cba167d..0b09f6ca 100644
--- a/ext/bg/js/settings/modal.js
+++ b/ext/bg/js/settings/modal.js
@@ -41,7 +41,7 @@ class Modal extends EventDispatcher {
}
}
- setVisible(value) {
+ setVisible(value, animate=true) {
value = !!value;
if (this._useJqueryModal()) {
this._getWrappedNode().modal(value ? 'show' : 'hide');
@@ -55,19 +55,21 @@ class Modal extends EventDispatcher {
}
if (value) {
- classList.add(this._openingClassName);
+ if (animate) { classList.add(this._openingClassName); }
+ classList.remove(this._closingClassName);
getComputedStyle(this._node).getPropertyValue('display'); // Force update of CSS display property, allowing animation
classList.add(this._visibleClassName);
- classList.remove(this._closingClassName);
- classList.remove(this._openingClassName);
+ if (animate) { classList.remove(this._openingClassName); }
this._node.focus();
} else {
- classList.add(this._closingClassName);
+ if (animate) { classList.add(this._closingClassName); }
classList.remove(this._visibleClassName);
- this._closeTimer = setTimeout(() => {
- this._closeTimer = null;
- classList.remove(this._closingClassName);
- }, this._closingAnimationDuration);
+ if (animate) {
+ this._closeTimer = setTimeout(() => {
+ this._closeTimer = null;
+ classList.remove(this._closingClassName);
+ }, this._closingAnimationDuration);
+ }
}
}
}