refactor(modal): extract iframe URL setting to reusable function

Created openUrlInQuizModal function to centralize and reuse the logic
for setting the iframe's src attribute and displaying the modal.
This change improves code maintainability by reducing redundancy.
This commit is contained in:
Kumi 2024-07-08 10:28:46 +02:00
parent 762edec903
commit 85c509e567
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -128,6 +128,12 @@
hideContent();
}
function openUrlInQuizModal(href) {
$("#regular-modal-iframe").attr("src", href);
$("#regularModal").modal("show");
}
async function openQuizModal(number) {
let href = getFeedbackLinks()[number - 1];
@ -148,9 +154,7 @@
href = href + "&embed=1&modal=1";
$("#regular-modal-iframe").attr("src", href);
$("#regularModal").modal("show");
openUrlInQuizModal(href);
}
function closeQuizModal() {