Skip to content

Commit

Permalink
Correct the timer.
Browse files Browse the repository at this point in the history
Comment on autoplay in the pop-up.
  • Loading branch information
ilatypov committed Jan 10, 2022
1 parent b3b14b0 commit 76555d5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions shells/onstage.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
};

Dz.init = function() {
this.clock_start = 0;
this.resetClock();
this.startClock();
this.loadIframes();
}
Expand Down Expand Up @@ -290,6 +290,9 @@
}

Dz.popup = function() {
// The pop-up window disables its video autoplay.
// With Firefox, using iframe src="..." allow="autoplay" throws a warning
// that the feature is not supported either.
this.views.remote = window.open(this.url + "#" + this.idx, 'slides', 'width=800,height=600,personalbar=0,toolbar=0,scrollbars=1,resizable=1');
}

Expand All @@ -300,19 +303,19 @@
aWin.postMessage(aMsg.join(" "), "*");
}

Dz.resetClock = function() { // + 3600000, because Date(0) is 01:00:00
this.clock_start = (new Date()).getTime() + 3600000;
Dz.resetClock = function() {
this.clock_start = (new Date()).getTime();
}

Dz.startClock = function() {
var addZero = function(num) {
return num < 10 ? '0' + num : num;
}
setInterval(function() {
var now = new Date((new Date()).getTime() - this.Dz.clock_start);
$("#hours").innerHTML = addZero(now.getHours());
$("#minutes").innerHTML = addZero(now.getMinutes());
$("#seconds").innerHTML = addZero(now.getSeconds());
var elapsed = Math.floor(((new Date()).getTime() - Dz.clock_start) / 1000);
$("#hours").innerHTML = addZero(Math.floor(elapsed / 3600));
$("#minutes").innerHTML = addZero(Math.floor(elapsed / 60) % 60);
$("#seconds").innerHTML = addZero(elapsed % 60);
}, 1000);
}

Expand Down

0 comments on commit 76555d5

Please sign in to comment.