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:
parent
762edec903
commit
85c509e567
1 changed files with 7 additions and 3 deletions
10
script.js
10
script.js
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue