-
Notifications
You must be signed in to change notification settings - Fork 73
/
test.html
66 lines (56 loc) · 1.69 KB
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>terminal.js test</title>
<script src="terminal.js"></script>
</head>
<body>
<h1>terminal.js test</h1>
<button onclick="t1.beep()">Play the beep!</button>
<br>
<br>
<script>
var t1 = new Terminal()
t1.setHeight("200px")
t1.setWidth('600px')
document.body.appendChild(t1.html)
var t2 = new Terminal()
t2.setHeight("250px")
t2.setWidth('650px')
t2.setBackgroundColor('blue')
t2.blinkingCursor(false)
document.body.appendChild(t2.html)
t1.print('Hello, world!')
t1.input('Whats your name?', function (input) {
t1.print('Welcome, ' + input)
t2.sleep(1000, function () {
t2.print('Hello again!')
t2.input('Whats your name again?', function (input) {
t2.print('Welcome again, ' + input)
})
})
})
var t3 = new Terminal('terminal_3')
t3.setHeight("180px")
t3.setWidth('550px')
t3.setBackgroundColor('green')
document.body.appendChild(t3.html)
t3.password('Enter password:', function (password) {
t3.print('Your password is: ' + password)
})
var paragraph = document.createElement("p")
var t3bySelector = document.querySelector("#terminal_3")
paragraph.innerHTML = t3bySelector && t3bySelector.id ? 'The 3rd terminal has id: ' + t3bySelector.id : 'Assigning an id at initialization doesnt semm to work!'
document.body.appendChild(paragraph)
var t4 = new Terminal('terminal_3')
t4.setHeight("180px")
t4.setWidth('550px')
t4.setBackgroundColor('green')
document.body.appendChild(t4.html)
t4.confirm('Are you sure?', function (didConfirm) {
t4.print(didConfirm ? 'OK' : 'Why not?')
})
</script>
</body>
</html>