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.
This commit is contained in:
Kumi 2024-07-02 17:58:00 +02:00
parent ffb3945e19
commit 1f00277f60
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -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 <i title="Required field">
$('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