forked from shariq/burgundy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (40 loc) · 1.17 KB
/
index.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
52
$(document).ready(function() {
var loaded = [4];
var intervalVar;
function hmmDotting() {
if (loaded[0] > 0) {
$('#suggestion')[0].textContent = 'hmm' + ['', '.', '..', '...'][4 - loaded[0]];
loaded[0] = loaded[0] - 1;
} else {
clearInterval(intervalVar);
}
}
intervalVar = window.setInterval(function() {
hmmDotting();
}, 300);
function changeWord() {
$.get('http://burgundy.io:8080/', function(data) {
loaded[0] = 0;
$('#suggestion')[0].textContent = data;
clearInterval(intervalVar);
});
}
document.body.addEventListener("mousedown", tapOrClick, false);
document.body.addEventListener("touchstart", tapOrClick, false);
function tapOrClick(event) {
changeWord();
event.preventDefault();
return false;
}
changeWord();
var down = {};
$(document).keydown(function(event){
if (down[event.which] == null) {
changeWord();
down[event.which] = true;
}
});
$(document).keyup(function(event) {
down[event.which] = null;
});
});