Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -rca3fa00d5084315963b72ba5db58180fee898754 -r29bc39cd5828fbffdc6a414fd18b91e6a89f66c4 --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision ca3fa00d5084315963b72ba5db58180fee898754) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 29bc39cd5828fbffdc6a414fd18b91e6a89f66c4) @@ -12,7 +12,9 @@ - +<%-- + + --%> @@ -40,6 +42,10 @@ [data-toggle="collapse"].collapsed .if-not-collapsed, [data-toggle="collapse"]:not(.collapsed) .if-collapsed { display: none; } + + .countdown-timeout { + color: #FF3333 !important; + } @@ -127,7 +133,7 @@ - //timelimit feature + // TIME LIMIT // websocket needs pinging and reconnection feature in case it fails // it works pretty much the same as command websocket in Page.tag @@ -180,12 +186,13 @@ var input = JSON.parse(e.data); if (input.clearTimer == true) { - // teacher has stopped the timer, destroy it + // teacher stopped the timer, destroy it $('#countdown').countdown('destroy').remove(); - counterInitialised = false; } else { - // teacher has updated the timer - var secondsLeft = +input.secondsLeft; + // 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'); @@ -202,7 +209,6 @@ } function displayCountdown(secondsLeft){ - counterIntialised = true; var countdown = '
'; $.blockUI({ @@ -226,10 +232,13 @@ compact: true, alwaysExpire : true, onTick: function(periods) { - //check for 30 seconds - if ((periods[4] == 0) && (periods[5] == 0) && (periods[6] <= 30)) { - $('#countdown').css('color', '#FF3333'); - } + // check for 30 seconds or less and display timer in red + var secondsLeft = $.countdown.periodsToSeconds(periods); + if (secondsLeft <= 30) { + $(this).addClass('countdown-timeout'); + } else { + $(this).removeClass('countdown-timeout'); + } }, onExpiry: function(periods) { $.blockUI({ message: '

' });