File: controls.js

package info (click to toggle)
libbio-chado-schema-perl 0.10010-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,800 kB
  • sloc: perl: 15,043; makefile: 7; sql: 3
file content (52 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (8)
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
52
// BEGIN controls.js
function nextSlide() {
    window.location = '[% next_slide %]';
}

function prevSlide() {
    window.location = '[% prev_slide %]';
}

function indexSlide() {
    window.location = 'index.html';
}

function startSlide() {
    window.location = 'start.html';
}

function closeSlide() {
    window.close();
}

function handleKey(e) {
    var key;
    if (e == null) {
        // IE
        key = event.keyCode
    } 
    else {
        // Mozilla
        if (e.altKey || e.ctrlKey) {
            return true
        }
        key = e.which
    }
    switch(key) {
        case 8: prevSlide(); break
        case 13: nextSlide(); break
        case 32: nextSlide(); break
        case 81: closeSlide(); break
        case 105: indexSlide(); break
        case 110: nextSlide(); break
        case 112: prevSlide(); break
        case 115: startSlide(); break
        default: //xxx(e.which)
    }
}

document.onkeypress = handleKey
[% IF mouse_controls -%]
document.onclick = nextSlide
[% END -%]
// END controls.js