From 673a44245c06e3115097a9b7fc9a360aa2ec2ea7 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 26 Jun 2025 17:12:23 +0200 Subject: [PATCH] wip #7600 @0.25 --- resources/elearningmedia/js/app.js | 16 ++++++++++++---- resources/views/elearningmedia/index.blade.php | 3 +-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/resources/elearningmedia/js/app.js b/resources/elearningmedia/js/app.js index ed969adcd..5a63fe854 100644 --- a/resources/elearningmedia/js/app.js +++ b/resources/elearningmedia/js/app.js @@ -65,10 +65,10 @@ document.addEventListener("DOMContentLoaded", function () { let container = pdfViewer.container; container.addEventListener('scroll', function () { + resize(); let progress = container.scrollTop / (container.scrollHeight - container.offsetHeight); if (pc === 'button') { if (progress >= 0.95) { - resize(); showCompleteButton(); } } else if (progress >= pc) { @@ -90,12 +90,20 @@ document.addEventListener("DOMContentLoaded", function () { }); function showCompleteButton() { - document.getElementById('completeButton').classList.add('visible') + const btn = document.getElementById('completeButton'); + if (btn.classList.contains('visible')) { + return; + } + btn.classList.add('visible'); + btn.addEventListener('click', function (e) { + markComplete(); + e.preventDefault(); + return false; + }); } -function markComplete(interval) { +function markComplete() { cubeSCORM.scormMarkAsComplete(); - clearInterval(interval); } function resize() { diff --git a/resources/views/elearningmedia/index.blade.php b/resources/views/elearningmedia/index.blade.php index 706a7dc44..cace5a243 100644 --- a/resources/views/elearningmedia/index.blade.php +++ b/resources/views/elearningmedia/index.blade.php @@ -12,8 +12,7 @@ @if($type==='pdf') - {{ __('Click here once you have completed your learning session') }} + {{ __('Click here once you have completed your learning session') }} @elseif($type==='audio')