aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/status-footer.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/pages/settings/status-footer.js')
-rw-r--r--ext/js/pages/settings/status-footer.js34
1 files changed, 28 insertions, 6 deletions
diff --git a/ext/js/pages/settings/status-footer.js b/ext/js/pages/settings/status-footer.js
index 6c64794f..a8f1a8c4 100644
--- a/ext/js/pages/settings/status-footer.js
+++ b/ext/js/pages/settings/status-footer.js
@@ -19,34 +19,52 @@
import {PanelElement} from '../../dom/panel-element.js';
export class StatusFooter extends PanelElement {
+ /**
+ * @param {HTMLElement} node
+ */
constructor(node) {
super({
node,
closingAnimationDuration: 375 // Milliseconds; includes buffer
});
- this._body = node.querySelector('.status-footer');
+ /** @type {HTMLElement} */
+ this._body = /** @type {HTMLElement} */ (node.querySelector('.status-footer'));
}
+ /** */
prepare() {
- this.on('closeCompleted', this._onCloseCompleted.bind(this), false);
- this._body.querySelector('.status-footer-header-close').addEventListener('click', this._onCloseClick.bind(this), false);
+ const closeButton = /** @type {HTMLElement} */ (this._body.querySelector('.status-footer-header-close'));
+ this.on('closeCompleted', this._onCloseCompleted.bind(this));
+ closeButton.addEventListener('click', this._onCloseClick.bind(this), false);
}
+ /**
+ * @param {string} selector
+ * @returns {?HTMLElement}
+ */
getTaskContainer(selector) {
return this._body.querySelector(selector);
}
+ /**
+ * @param {string} selector
+ * @returns {boolean}
+ */
isTaskActive(selector) {
const target = this.getTaskContainer(selector);
- return (target !== null && target.dataset.active);
+ return (target !== null && !!target.dataset.active);
}
+ /**
+ * @param {string} selector
+ * @param {boolean} active
+ */
setTaskActive(selector, active) {
const target = this.getTaskContainer(selector);
if (target === null) { return; }
const activeElements = new Set();
- for (const element of this._body.querySelectorAll('.status-footer-item')) {
+ for (const element of /** @type {NodeListOf<HTMLElement>} */ (this._body.querySelectorAll('.status-footer-item'))) {
if (element.dataset.active) {
activeElements.add(element);
}
@@ -68,13 +86,17 @@ export class StatusFooter extends PanelElement {
// Private
+ /**
+ * @param {MouseEvent} e
+ */
_onCloseClick(e) {
e.preventDefault();
this.setVisible(false);
}
+ /** */
_onCloseCompleted() {
- for (const element of this._body.querySelectorAll('.status-footer-item')) {
+ for (const element of /** @type {NodeListOf<HTMLElement>} */ (this._body.querySelectorAll('.status-footer-item'))) {
if (!element.dataset.active) {
element.hidden = true;
}