-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
108 lines (84 loc) · 3.11 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Terminal.js - Little Demo</title>
<!-- Get jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/p5.min.js" type="text/javascript"></script>
<script src="js/p5.sound.min.js" type="text/javascript"></script>
<script src="js/typed-custom.js" type="text/javascript"></script>
<script src="js/terminal.js" type="text/javascript"></script>
<script>
var commandScript = {
start: {
strings: ["This is a terminal emulator.", "It types courtesy of Matt Boldt's typing script.", "It plays sound using the p5 js libraries.", "Commands can be scripted...", "... or they can be individually called.", "Now for the real demo..."],
callback: function() {
executeCommand($("#terminal1"), commandScript.command1);
}
},
command1: {
strings: ["Type commands like this...", 'echo "hello there"'],
callback: function() {
displayResult($("#terminal1"), commandScript.command2);
}
},
command2: {
result: 'and display results like "hello there"',
callback: function() {
executeCommand($("#terminal1"), commandScript.command3);
}
},
command3: {
strings: [,,],
callback: function() {
executeCommand($("#terminal1"), commandScript.command4);
}
},
command4: {
strings: ["You can also clear the screen", "clear"],
callback: function() {
clearTerminal($("#terminal1"));
executeCommand($("#terminal1"), commandScript.command5);
}
},
command5: {
strings: ["Now you have a fresh clean terminal again."],
callback: function() {
executeCommand($("#terminal1"), commandScript.command6);
}
},
command6: {
strings: ["Thank you for checking out this demo."],
callback: function() {
executeCommand($("#terminal1"), commandScript.end);
}
},
end: {
strings: [""],
callback: foo
}
};
window.onload = function() {
executeCommand($("#terminal1"), commandScript.start);
};
function foo(){ console.log("Callback"); }
</script>
<link href="css/terminal.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet"/>
</head>
<body>
<div class="terminal-wrap">
<h1 class="h1">Terminal.js</h1>
<div id="terminal1" class="terminal">
<div class="terminal-header">terminal</div>
<div class="terminal-window">
<!-- terminal is loaded from script :) -->
</div>
</div>
<div class="links">
<a href="https://github.com/awreese/terminal.js">terminal.js source</a> | <a href="http://awreese.github.io/">awreese.github.io</a>
</div>
</div>
</body>
</html>