point to working video
[slides.git] / eumozcamp-prague2009 / slides.js
... / ...
CommitLineData
1/******************************
2 * JavaScript for talk slides *
3 * by Robert Kaiser *
4 * <kairo@kairo.at> *
5 * (for FOSDEM 2007) *
6 ******************************/
7
8// do timed color variation on slides
9var slide_seconds = 3*60;
10var slide_start = new Date();
11
12function timerFired() {
13 var slide_current = new Date();
14 var seconds_diff = Math.round((slide_current.getTime() - slide_start.getTime()) / 1000);
15 if (seconds_diff >= slide_seconds) {
16 document.getElementById("header-text").className = "overtime";
17 }
18 else if (seconds_diff >= Math.round(2*slide_seconds/3)) {
19 document.getElementById("header-text").className = "ontime";
20 setTimeout("timerFired()", 1000*(slide_seconds/3));
21 }
22 else if (seconds_diff >= Math.round(slide_seconds/3)) {
23 document.getElementById("header-text").className = "neartime";
24 setTimeout("timerFired()", 1000*(slide_seconds/3));
25 }
26 else {
27 // we should never come here, but if we do, go into a 1s loop until we get over the upcoming step
28 setTimeout("timerFired()", 1000);
29 }
30}
31setTimeout("timerFired()", 1000*(slide_seconds/3));
32
33(function() {
34 function go(where) {
35 where = where || "next";
36 var links = document.getElementsByTagName("link");
37 for (var i = 0; i < links.length; ++i) {
38 if (links[i].rel == where) {
39 window.location.href = links[i].href;
40 break;
41 }
42 }
43 }
44
45 function handleClick(e) {
46 e = e || event;
47 var target = (window.event) ? e.srcElement : e.target;
48 if (e.which == 1 && target.nodeName != "A" && target.nodeName != "VIDEO")
49 go("next");
50 }
51
52 function handleKeyPress(e) {
53 e = e || event;
54 switch (e.keyCode) {
55 case e.DOM_VK_LEFT:
56 go("previous"); break;
57 case e.DOM_VK_RIGHT:
58 go("next"); break;
59 }
60 }
61
62 window.onclick = handleClick;
63 window.onkeypress = handleKeyPress;
64})();