From fe7b406cb327f182a3acdc48e87f5d8c4854ca3a Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 26 Apr 2024 16:11:17 +0200 Subject: [PATCH] Return the message modal selector for better DOM handling if needed --- assets/js/utils/message.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/js/utils/message.js b/assets/js/utils/message.js index 54045cd3..6188fa4f 100644 --- a/assets/js/utils/message.js +++ b/assets/js/utils/message.js @@ -27,10 +27,12 @@ window.App.Utils.Message = (function () { * @param {String} message The message of the dialog. * @param {Array} [buttons] Contains the dialog buttons along with their functions. * @param {Boolean} [isDismissible] If true, the button will show the close X in the header and close with the press of the Escape button. + * + * @return {jQuery|null} Return the #message-modal selector or null if the arguments are invalid. */ function show(title, message, buttons = null, isDismissible = true) { if (!title || !message) { - return; + return null; } if (!buttons) { @@ -105,7 +107,9 @@ window.App.Utils.Message = (function () { messageModal.show(); - $('#message-modal').css('z-index', '99999').next().css('z-index', '9999'); + $messageModal.css('z-index', '99999').next().css('z-index', '9999'); + + return $messageModal; } return {