From e375034f0dcee0e5b08346d386e6402ee6bb0818 Mon Sep 17 00:00:00 2001 From: Arie Peterson <arie@greenhost.nl> Date: Thu, 12 Sep 2024 13:42:55 +0200 Subject: [PATCH] Auto-detect error message in javascript alerts --- backend/web/static/base.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/web/static/base.js b/backend/web/static/base.js index 1b9cf6bc..92095ef1 100644 --- a/backend/web/static/base.js +++ b/backend/web/static/base.js @@ -706,5 +706,9 @@ $.urlParam = function (name) { window.alert = function(message) { window.console.log("Alert: " + message); - renderMessage('', message, "info"); + var className = "info"; + if ((new RegExp("error", "i")).test(message)) { + className = "danger"; + } + renderMessage('', message, className); }; -- GitLab