From 37649ec98e88430e5b7ea2ea16f8128357c83b64 Mon Sep 17 00:00:00 2001 From: Spacelord Date: Sun, 21 May 2023 01:45:27 +0200 Subject: [PATCH] Fixed formatting in toastHandler --- static/js/toastHandler.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/static/js/toastHandler.js b/static/js/toastHandler.js index 6150424..5fbb8fb 100644 --- a/static/js/toastHandler.js +++ b/static/js/toastHandler.js @@ -8,11 +8,11 @@ currentToasts = []; * @param {Boolean} autoReload Should the page reload after the toast is hidden, default is true (for compatibility with old code) * @returns {String} The id of the created toast, format: toast- */ -function createNewToast(message, colorSelector, autoHideTime = 3000, autoReload = true){ +function createNewToast(message, colorSelector, autoHideTime = 3000, autoReload = true) { const targetContainer = document.getElementById('toastMainController'); const masterToast = document.getElementById('masterToast'); const newToast = masterToast.cloneNode(true); - newToast.classList.add(colorSelector) + newToast.classList.add(colorSelector); newToast.id = `toast-${currentToasts.length}`; console.log(newToast.childNodes[1]); newToast.childNodes[1].childNodes[1].innerHTML = message; @@ -21,7 +21,7 @@ function createNewToast(message, colorSelector, autoHideTime = 3000, autoReload $(newToast).toast('show'); setTimeout(() => { destroyToast(newToast.id); - if(autoReload){ + if (autoReload) { location.reload(); } }, autoHideTime); @@ -32,7 +32,7 @@ function createNewToast(message, colorSelector, autoHideTime = 3000, autoReload * Generic function to destroy a toast * @param {String} id The id of the toast to destroy */ -function destroyToast(id){ +function destroyToast(id) { const targetContainer = document.getElementById('toastMainController'); const targetToast = document.getElementById(id); targetContainer.removeChild(targetToast); @@ -40,8 +40,8 @@ function destroyToast(id){ } // Moved here -function normalizeToast(){ - console.warn("Something is using the deprecated function normalizeToast(). Please use createNewToast() instead.") +function normalizeToast() { + console.warn('Something is using the deprecated function normalizeToast(). Please use createNewToast() instead.'); $('#generalToast').removeClass('text-bg-primary'); $('#generalToast').removeClass('text-bg-success'); $('#generalToast').removeClass('text-bg-danger');