From 90924aa30da384a302ca0ef7e5585047370e6371 Mon Sep 17 00:00:00 2001 From: grey Date: Fri, 7 Jul 2023 14:02:54 +0200 Subject: [PATCH] - added method to force disable reload --- static/js/toastHandler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/toastHandler.js b/static/js/toastHandler.js index 5fbb8fb..60dc1f1 100644 --- a/static/js/toastHandler.js +++ b/static/js/toastHandler.js @@ -1,5 +1,5 @@ currentToasts = []; - +var forceSkipReload = false; /** * Generic function to create a new toast * @param {String} message The message to be displayed @@ -8,7 +8,7 @@ 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 = 1500, autoReload = true) { const targetContainer = document.getElementById('toastMainController'); const masterToast = document.getElementById('masterToast'); const newToast = masterToast.cloneNode(true); @@ -21,7 +21,7 @@ function createNewToast(message, colorSelector, autoHideTime = 3000, autoReload $(newToast).toast('show'); setTimeout(() => { destroyToast(newToast.id); - if (autoReload) { + if (autoReload && !forceSkipReload) { location.reload(); } }, autoHideTime);