aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-25 12:39:09 -0500
committerGitHub <noreply@github.com>2020-11-25 12:39:09 -0500
commitc6c4631817247c44f788b1ffa2bc1d9f644802eb (patch)
treef0b637dd762301386bfdb89476eb3b4826be85be /ext/mixed/js/display.js
parentf7d1d2deb52a6b129c71ec139d3e1e74544d3be6 (diff)
Display button improvements (#1065)
* Use hidden and disabled properties instead of custom classes * Enable transitions on buttons
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 2f24d7bd..807f585a 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -1051,8 +1051,8 @@ class Display extends EventDispatcher {
if (Array.isArray(noteIds) && noteIds.length > 0) {
noteId = noteIds[0];
}
- button.classList.toggle('disabled', !canAdd);
- button.classList.remove('pending');
+ button.disabled = !canAdd;
+ button.hidden = false;
}
if (noteId !== null) {
this._viewerButtonShow(i, noteId);
@@ -1115,14 +1115,14 @@ class Display extends EventDispatcher {
if (index < 0 || index >= this._definitions.length) { return; }
const button = this._adderButtonFind(index, mode);
- if (button !== null && !button.classList.contains('disabled')) {
+ if (button !== null && !button.disabled) {
this._noteAdd(this._definitions[index], mode);
}
}
_noteTryView() {
const button = this._viewerButtonFind(this._index);
- if (button !== null && !button.classList.contains('disabled')) {
+ if (button !== null && !button.disabled) {
api.noteView(button.dataset.noteId);
}
}
@@ -1136,7 +1136,7 @@ class Display extends EventDispatcher {
const index = this._definitions.indexOf(definition);
const adderButton = this._adderButtonFind(index, mode);
if (adderButton !== null) {
- adderButton.classList.add('disabled');
+ adderButton.disabled = true;
}
this._viewerButtonShow(index, noteId);
} else {
@@ -1271,7 +1271,8 @@ class Display extends EventDispatcher {
if (viewerButton === null) {
return;
}
- viewerButton.classList.remove('pending', 'disabled');
+ viewerButton.disabled = false;
+ viewerButton.hidden = false;
viewerButton.dataset.noteId = noteId;
}