/
2020.js
51 lines (42 loc) · 1.05 KB
/
2020.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var twentyTwentySetUp = false;
var twentyTwentyRunning = false;
function setUpTwentyTwenty()
{
if (twentyTwentySetUp) { return; }
twentyTwentySetUp = true;
$("#slideInfo").after('<span id="twentyTwentyInfo"></span>');
$(document).keydown(function(event) {
var key = event.keyCode;
if (event.ctrlKey || event.altKey || event.metaKey) { return; }
// p to automatically move to the next slide every twenty seconds
if (key == 80)
{
twentyTwenty();
}
});
}
// For a 20x20 talk
//
// Will go to the next slide every 20 seconds
function twentyTwenty()
{
if (!twentyTwentyRunning) {
twentyTwentyRunning = true
$("#twentyTwentyInfo").text(twentyTwentyStatus(0));
var seconds = 0;
setInterval(function() {
seconds++;
$("#twentyTwentyInfo").text(twentyTwentyStatus(seconds));
if (seconds == 20) {
seconds = 0;
nextStep();
}
}, 1000);
}
}
function twentyTwentyStatus(seconds) {
return ' - 20x20 mode (' + (20 - seconds) + 's)';
}
$(function(){
setUpTwentyTwenty();
});