Przeglądaj źródła

refactor(appjs): no need to check if always present elements are always present

jvoisin 10 miesięcy temu
rodzic
commit
93b17af78b
1 zmienionych plików z 9 dodań i 15 usunięć
  1. 9 15
      internal/ui/static/js/app.js

+ 9 - 15
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);
-
-        const toastElementWrapper = document.getElementById("toast-wrapper");
-        if (toastElementWrapper) {
-            toastElementWrapper.classList.remove('toast-animate');
-            setTimeout(() => {
-                toastElementWrapper.classList.add('toast-animate');
-            }, 100);
-        }
-    }
+    toastMsgElement.replaceChildren(iconElement.content.cloneNode(true));
+    appendIconLabel(toastMsgElement, label);
+
+    const toastElementWrapper = document.getElementById("toast-wrapper");
+    toastElementWrapper.classList.remove('toast-animate');
+    setTimeout(() => {
+        toastElementWrapper.classList.add('toast-animate');
+    }, 100);
 }
 
 /** Navigate to the new subscription page. */