diff --git a/app/static/js/nopaque.js b/app/static/js/nopaque.js index 7b878f99..3e3e1829 100644 --- a/app/static/js/nopaque.js +++ b/app/static/js/nopaque.js @@ -22,7 +22,7 @@ nopaque.user.isAuthenticated = undefined; nopaque.user.settings = {} nopaque.user.settings.darkMode = undefined; -nopaque.flashedMessages = [] +nopaque.flashedMessages = undefined; // nopaque functions nopaque.socket = {}; @@ -82,14 +82,6 @@ nopaque.socket.init = function() { }); } -nopaque.Workarounds = {}; -nopaque.Workarounds.apply = function() { - // Disable all option elements with no value - for (let optionElement of document.querySelectorAll('option[value=""]')) { - optionElement.disabled = true; - } -} - nopaque.Forms = {}; nopaque.Forms.init = function() { var abortRequestElement, parentElement, progressElement, progressModal, @@ -174,7 +166,7 @@ nopaque.Navigation.init = function() { } -nopaque.toast = function(message, color="") { +nopaque.flash = function(message, color="") { var toast, toastActionElement; toast = M.toast({classes: color, @@ -189,10 +181,14 @@ nopaque.toast = function(message, color="") { }); } } +nopaque.toast = nopaque.flash document.addEventListener("DOMContentLoaded", function() { - nopaque.Workarounds.apply(); + // Disable all option elements with no value + for (let optionElement of document.querySelectorAll('option[value=""]')) { + optionElement.disabled = true; + } M.AutoInit(); M.CharacterCounter.init(document.querySelectorAll('input[data-length][type="text"]')); M.Dropdown.init(document.querySelectorAll("#nav-notifications, #nav-account"), @@ -200,7 +196,7 @@ document.addEventListener("DOMContentLoaded", function() { nopaque.Forms.init(); nopaque.Navigation.init(); while (nopaque.flashedMessages.length) { - nopaque.toast(nopaque.flashedMessages.shift().message); + nopaque.flash(nopaque.flashedMessages.shift()[1]); } if (nopaque.user.isAuthenticated) { if (nopaque.user.settings.darkMode) { diff --git a/app/templates/nopaque.html.j2 b/app/templates/nopaque.html.j2 index 28f71758..2fbc18b6 100644 --- a/app/templates/nopaque.html.j2 +++ b/app/templates/nopaque.html.j2 @@ -51,9 +51,7 @@