From 1f00277f6078d35181ef0f1efefc7239d3d81e06 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 2 Jul 2024 17:58:00 +0200 Subject: [PATCH] fix: correct parameter usage for modal detection Replaced the incorrect parameter check from 'embed' to 'modal' for determining if the quiz is in a modal. This resolves the issue where modals weren't closing as expected when the 'modal' parameter was set in the URL. --- global.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/global.js b/global.js index 7fc73d7..259a95f 100644 --- a/global.js +++ b/global.js @@ -54,6 +54,7 @@ document.addEventListener("DOMContentLoaded", function () { console.log("Bootstrap loaded successfully"); $(document).ready(function () { var embedded = getUrlParameter("embed"); + var inModal = getUrlParameter("modal"); // Set required attribute on inputs associated with labels containing $('label:has(i[title="Required field"])').each(function () { @@ -100,7 +101,7 @@ document.addEventListener("DOMContentLoaded", function () { data: formData, success: function (response) { // Close the modal if `modal=1` is set - if (embedded === "1") { + if (inModal === "1") { window.top.closeQuizModal(); } else { // Else call the nextContent function