-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
55 lines (54 loc) · 1.77 KB
/
index.html
File metadata and controls
55 lines (54 loc) · 1.77 KB
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
53
54
55
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Titillium+Web:600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/dabbie.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="container">
<div id="mask"></div>
<div id="log">
<div id="banner">drunk.ai</div>
<ul id="chat"></ul>
</div>
<div id="input">
<input type="text" id="message_input" placeholder="Reply...">
</div>
</div>
<script src="scripts/drunk.js"></script>
<script>
var dabbie = new Dabbie(false)
var input = document.getElementById("message_input");
var chat = document.getElementById("chat");
var last = "";
var next = "";
input.onkeydown = function (e) {
if (e.keyCode == 13) {
last = input.value;
var r = last;
var el = "<li class='right'><span>" + r + '</span?</li>\n';
chat.innerHTML += el;
input.value = "";
setTimeout(function () {
write_response(dabbie.transform(r));
}, 500)
}
else if (e.keyCode == 38) {
next = input.value;
input.value = last;
} else if (e.keyCode == 40) {
console.log("down")
last = input.value;
input.value = next;
}
}
var write_response = function (r) {
var el = "<li><span>" + r + '</span></li>\n';
chat.innerHTML += el;
}
write_response(dabbie.getInitial())
</script>
</body>
</html>