Permalink
Browse files

MDL-42663 mod_lesson: Move definitions to show_clock()

Seems that the required data is not always set
before timer.js is included.
  • Loading branch information...
1 parent 150735f commit 9ab44b3f990cd58059dc7442bb52683e880d94c6 @dmonllao dmonllao committed Nov 1, 2013
Showing with 15 additions and 15 deletions.
  1. +15 −15 mod/lesson/timer.js
View
@@ -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 = "";
@@ -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";

0 comments on commit 9ab44b3

Please sign in to comment.