From 110ac67686015517a4523da7bcc8b1ff27631e75 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 23 Sep 2024 08:50:58 +0200 Subject: [PATCH] feat: add function to navigate to course by ID Introduce goToCourse function that updates the window location to navigate to a course view page using a given ID. This function is now accessible via window.top as goToCourse, improving navigation throughout the application and promoting code reuse. --- script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script.js b/script.js index 697a45e..552608f 100644 --- a/script.js +++ b/script.js @@ -178,12 +178,17 @@ } } + function goToCourse(id) { + window.top.location.href = "/course/view.php?id=" + id; + } + // Attach global functions to window.top window.top.nextContent = nextContent; window.top.openQuizModal = openQuizModal; window.top.openModal = openQuizModal; window.top.closeQuizModal = closeQuizModal; window.top.goToQuiz = window.top.nextContent; + window.top.goToCourse = goToCourse; var contentName = $(currentScript).attr("data-activity-name");