From 93b17af78b21c1d1e7ae6d091d2056ba064fbd18 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 20 Jun 2025 14:51:48 +0200 Subject: [PATCH] refactor(appjs): no need to check if always present elements are always present --- internal/ui/static/js/app.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/internal/ui/static/js/app.js b/internal/ui/static/js/app.js index bf1dbcca..690f3e23 100644 --- a/internal/ui/static/js/app.js +++ b/internal/ui/static/js/app.js @@ -147,9 +147,7 @@ function handleSubmitButtons() { // Show modal dialog with the list of keyboard shortcuts. function showKeyboardShortcuts() { const template = document.getElementById("keyboard-shortcuts"); - if (template !== null) { - ModalHandler.open(template.content, "dialog-title"); - } + ModalHandler.open(template.content, "dialog-title"); } // Mark as read visible items of the current page. @@ -694,18 +692,14 @@ function showToast(label, iconElement) { } const toastMsgElement = document.getElementById("toast-msg"); - if (toastMsgElement) { - toastMsgElement.replaceChildren(iconElement.content.cloneNode(true)); - appendIconLabel(toastMsgElement, label); + toastMsgElement.replaceChildren(iconElement.content.cloneNode(true)); + appendIconLabel(toastMsgElement, label); - const toastElementWrapper = document.getElementById("toast-wrapper"); - if (toastElementWrapper) { - toastElementWrapper.classList.remove('toast-animate'); - setTimeout(() => { - toastElementWrapper.classList.add('toast-animate'); - }, 100); - } - } + const toastElementWrapper = document.getElementById("toast-wrapper"); + toastElementWrapper.classList.remove('toast-animate'); + setTimeout(() => { + toastElementWrapper.classList.add('toast-animate'); + }, 100); } /** Navigate to the new subscription page. */