Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 57e69d7

Browse files
committed
Added support to hide clock 10 minutes after presentation finishes
1 parent cd48253 commit 57e69d7

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

README

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ FULL POWER - Starts the timer at the time specified for the length specified and
2020
warnAt: 2
2121
}
2222
};
23-
var t = PresentationTimer();
23+
var t = PresentationTimer();
24+
25+
26+
27+
CHANGE LOG
28+
2011-09-20: added support to hide the clock 10 minutes after the presentation finishes.

test.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#cClock:hover {
2222
opacity: 1.0;
2323
}
24+
25+
#cClock.hidden {
26+
display: none;
27+
}
2428

2529
</style>
2630
</head>
@@ -29,7 +33,8 @@
2933
<script src="config.js"></script>
3034
<script src="timer.js"></script>
3135
<script type="text/javascript">
32-
var t = PresentationTimer(10, true);
36+
var t = PresentationTimer();
37+
t.start();
3338
</script>
3439
</body>
3540
</html>

timer.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
opacity: 1.0;
1313
}
1414
15+
#cClock.hidden {
16+
display: none;
17+
}
18+
1519
window.timerConfig = window.timerConfig || {
1620
settings : {
1721
date: new Date('Sept 18 2011 16:22'),
@@ -66,7 +70,13 @@ var PresentationTimer = function(minutes, startImmediately) {
6670
setTimeout(timerTick, tickLength);
6771
} else if (currentTime > stopTime) {
6872
//console.log("after");
69-
drawClock(0, "#f00");
73+
var minOver = (currentTime.getTime() - stopTime.getTime()) / 1000 / 60;
74+
if (minOver <= 10) {
75+
drawClock(Math.ceil(minOver), "#f00");
76+
setTimeout(timerTick, 15000);
77+
} else {
78+
showClock(false);
79+
}
7080
} else {
7181
//console.log("during");
7282
minLeft = (stopTime.getTime() - currentTime.getTime()) / 1000 / 60;
@@ -95,6 +105,15 @@ var PresentationTimer = function(minutes, startImmediately) {
95105
ctx.fillText(min, 15, 15);
96106
}
97107

108+
var showClock = function(visible) {
109+
var canvas = document.getElementById("cClock");
110+
if (visible) {
111+
canvas.classList.remove("hidden");
112+
} else {
113+
canvas.classList.add("hidden");
114+
}
115+
}
116+
98117
var toRadians = function(val) {
99118
return (Math.PI / 180) * val;
100119
}

0 commit comments

Comments
 (0)