]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7600 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 26 Jun 2025 15:12:23 +0000 (17:12 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 26 Jun 2025 15:12:23 +0000 (17:12 +0200)
resources/elearningmedia/js/app.js
resources/views/elearningmedia/index.blade.php

index ed969adcd08da8da8b3d7df957f13e7401fdc688..5a63fe8546b294879e4f04109ba8309a4554f8f8 100644 (file)
@@ -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() {
index 706a7dc44e862ac0b98c6db0bfb807f8f80a5c0e..cace5a243a54ecfc4c786900277544acf57211f9 100644 (file)
@@ -12,8 +12,7 @@
 <body>
 @if($type==='pdf')
     <iframe id="player" frameborder="0" src="pdfjs/web/viewer.html?file=../../media.pdf#page=1"></iframe>
-    <a href="javascript:markComplete();"
-       id="completeButton">{{ __('Click here once you have completed your learning session') }}</a>
+    <a href="#" id="completeButton">{{ __('Click here once you have completed your learning session') }}</a>
 @elseif($type==='audio')
     <button type="button" id="audiobigplay" class="plyr__control plyr__control--overlaid" data-plyr="play"
             aria-label="Play">