1 /******************************
2 * JavaScript for talk slides *
6 ******************************/
8 // do timed color variation on slides
9 var slide_seconds = 3*60;
10 var slide_start = new Date();
12 function 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";
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));
22 else if (seconds_diff >= Math.round(slide_seconds/3)) {
23 document.getElementById("header-text").className = "neartime";
24 setTimeout("timerFired()", 1000*(slide_seconds/3));
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);
31 setTimeout("timerFired()", 1000*(slide_seconds/3));
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;
45 function handleClick(e) {
47 var target = (window.event) ? e.srcElement : e.target;
48 if (e.which == 1 && target.nodeName != "A" && target.nodeName != "VIDEO")
52 function handleKeyPress(e) {
56 go("previous"); break;
62 window.onclick = handleClick;
63 window.onkeypress = handleKeyPress;