Index: lams_tool_doku/web/pages/learning/learning.jsp
===================================================================
diff -u -r52a6369ce66a2ea70d38bfa2e627dfcde6354b10 -r8969536d397a74ec1c26188bdd4b207dc605c569
--- lams_tool_doku/web/pages/learning/learning.jsp (.../learning.jsp) (revision 52a6369ce66a2ea70d38bfa2e627dfcde6354b10)
+++ lams_tool_doku/web/pages/learning/learning.jsp (.../learning.jsp) (revision 8969536d397a74ec1c26188bdd4b207dc605c569)
@@ -68,41 +68,43 @@
});
- let timeLimitExceeded = ${timeLimitExceeded};
- initWebsocket('dokuTimeLimit${sessionMap.toolContentID}',
- ''.replace('http', 'ws')
- + 'learningWebsocket?toolContentID=${sessionMap.toolContentID}',
- function (e) {
- // create JSON object
- var input = JSON.parse(e.data);
+
+ let timeLimitExceeded = ${timeLimitExceeded};
+ initWebsocket('dokuTimeLimit${sessionMap.toolContentID}',
+ ''.replace('http', 'ws') + 'learningWebsocket?toolContentID=${sessionMap.toolContentID}',
+ function (e) {
+ // create JSON object
+ var input = JSON.parse(e.data);
+
+ if (input.clearTimer == true) {
+ // teacher stopped the timer, destroy it
+ $('#countdown').countdown('destroy').remove();
+ } else if (typeof input.secondsLeft != 'undefined'){
+ // teacher updated the timer
+ var secondsLeft = +input.secondsLeft,
+ counterInitialised = $('#countdown').length > 0;
+
+ if (counterInitialised) {
+ // just set the new time
+ $('#countdown').countdown('option', 'until', secondsLeft + 'S');
+ } else if (timeLimitExceeded){
+ if (secondsLeft > 0) {
+ // teacher gave extra time, reload to writable Etherpad
+ location.reload();
+ return;
+ }
+ } else {
+ // initialise the timer
+ displayCountdown(secondsLeft);
+ }
+ }
+
+ // reset ping timer
+ websocketPing('dokuTimeLimit${sessionMap.toolContentID}', true);
+ }
+ );
+
- if (input.clearTimer == true) {
- // teacher stopped the timer, destroy it
- $('#countdown').countdown('destroy').remove();
- } else if (typeof input.secondsLeft != 'undefined'){
- // teacher updated the timer
- var secondsLeft = +input.secondsLeft,
- counterInitialised = $('#countdown').length > 0;
-
- if (counterInitialised) {
- // just set the new time
- $('#countdown').countdown('option', 'until', secondsLeft + 'S');
- } else if (timeLimitExceeded){
- if (secondsLeft > 0) {
- // teacher gave extra time, reload to writable Etherpad
- location.reload();
- return;
- }
- } else {
- // initialise the timer
- displayCountdown(secondsLeft);
- }
- }
-
- // reset ping timer
- websocketPing('dokuTimeLimit${sessionMap.toolContentID}', true);
- });
-
$('[data-bs-toggle="tooltip"]').each((i, el) => {
new bootstrap.Tooltip($(el))
});