Skip to content

Commit

Permalink
MDL-42663 mod_lesson: Move definitions to show_clock()
Browse files Browse the repository at this point in the history
Seems that the required data is not always set
before timer.js is included.
  • Loading branch information
David Monllao committed Nov 1, 2013
1 parent 150735f commit 9ab44b3
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions mod/lesson/timer.js
Expand Up @@ -31,21 +31,6 @@
var javatime = javatimeDate.getTime();
javatime = Math.floor(javatime/1000);

if (typeof(clocksettings)!='undefined') {
if (clocksettings.starttime) {
starttime = parseInt(clocksettings.starttime);
}
if (clocksettings.servertime) {
servertime = parseInt(clocksettings.servertime);
}
if (clocksettings.testlength) {
testlength = parseInt(clocksettings.testlength);
}
}

difference = javatime - servertime;
starttime = starttime + difference;

var dn = "";
var old = "";

Expand All @@ -64,6 +49,21 @@

function show_clock() {

if (typeof(clocksettings) != 'undefined') {
if (clocksettings.starttime) {
starttime = parseInt(clocksettings.starttime);
}
if (clocksettings.servertime) {
servertime = parseInt(clocksettings.servertime);
}
if (clocksettings.testlength) {
testlength = parseInt(clocksettings.testlength);
}
}

difference = javatime - servertime;
starttime = starttime + difference;

//show clock in NS 4
if (document.layers)
document.ClockPosNS.visibility="show";
Expand Down

0 comments on commit 9ab44b3

Please sign in to comment.