forked from felixp7/jaiffa
-
Notifications
You must be signed in to change notification settings - Fork 3
/
catch-that-cat.html
47 lines (43 loc) · 1.57 KB
/
catch-that-cat.html
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
<!DOCTYPE html>
<html>
<head>
<title>Javascript Interactive Fiction/Adventure system</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, height=device-height">
<link rel="stylesheet" type="text/css" href="default.css">
<script type="text/javascript" src="jiffo.js"></script>
<script type="text/javascript" src="catch-that-cat.js"></script>
<script type="text/javascript">
window.onload = function () {
var parser = new jiffo.VerbObjectParser(jiffo._STORY);
jiffo._STORY.start();
jiffo._STORY.advance();
for (var i = 0; i < jiffo.output_buffer.length; i++)
document.getElementById("output").innerHTML +=
"<p>" + jiffo.output_buffer[i] + "</p>";
document.getElementById("output").lastChild
.scrollIntoView();
document.getElementById("output").scrollIntoView(false);
document.getElementById('input-form').onsubmit = function() {
jiffo.output_buffer.length = 0;
parser.parse(document.getElementById('input').value);
document.getElementById('input').value = "";
jiffo._STORY.advance();
for (var i = 0; i < jiffo.output_buffer.length; i++)
document.getElementById("output").innerHTML +=
"<p>" + jiffo.output_buffer[i] + "</p>";
document.getElementById("output").lastChild
.scrollIntoView();
document.getElementById("output").scrollIntoView(false);
return false;
}
}
</script>
</head>
<body>
<div id="output"></div>
<form id="input-form">
<input id="input" autofocus><input id="submit" type="submit" value="Do it">
</form>
</body>
</html>