-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
111 lines (95 loc) · 2.75 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
109
110
111
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Brainfuck asm.js JQuery Terminal Emulator</title>
<meta name="author" content="Jakub Jankiewicz - jcubic@onet.pl"/>
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jquery.mousewheel-min.js"></script>
<script src="js/jquery.terminal.min.js"></script>
<script src="bf.js"></script>
<link href="css/jquery.terminal.css" rel="stylesheet"/>
<style>/* Increase text size by 33% */
.terminal,
.terminal-output > :not(.raw) span,
.terminal-output > :not(.raw) a,
.terminal-output > :not(.raw) div,
.cmd,
.cmd span,
.cmd div {
font-family: monospace;
font-size: 16px;
line-height: 20px;
}
</style>
<script>//<!--
var BFinputPtr = 0;
var BFinputText = '';
var BFoutputText = ''; // Lines of text to be output with printf "%s\n"
var BFoutputChar = ''; // Save the '\n' for when we're joining lines.
var BFoutputLine = ''; // Characters on this line, the official prompt.
// Need the last two to reverse the bad effects of the input and echo functions.
jQuery(document).ready(function($) {
var do_clear = 0;
$('body').terminal(function(command, term) {
if (do_clear) {
do_clear = 0;
term.clear();
}
BFinputPtr = 0;
BFinputText = command + String.fromCharCode(10);
if (BFprogram.run() < 0)
do_clear = 1;
term.echo (BFoutputText);
BFoutputText = "";
if (do_clear) {
if (BFoutputLine != "") term.echo(BFoutputLine);
BFoutputLine = 'Press return to restart:';
}
term.set_prompt(BFoutputLine);
BFoutputText = BFoutputLine = BFoutputChar = '';
}, {
greetings: '',
onBlur: function() {
// prevent losing focus
return false;
},
clear: false,
exit: false,
prompt: '',
onInit: function(term) {
BFinputText = '';
BFoutputText = BFoutputLine = BFoutputChar = '';
$("#bare").remove();
try {
BFprogram.reset();
if (BFprogram.run() < 0)
do_clear = 1;
} catch (error) {
term.echo('ERROR: ' + error.message);
}
term.echo (BFoutputText);
BFoutputText = '';
if (do_clear) {
if (BFoutputLine != "") term.echo(BFoutputLine);
BFoutputLine = 'Press return to restart:';
}
term.set_prompt(BFoutputLine);
BFoutputText = BFoutputLine = BFoutputChar = '';
}
});
});
//--></script>
</head>
<body class="terminal">
<div id="bare" class="terminal-output">
<div>Starting BF program ...<br\>
<br\>
<br\>
Please enable Javascript and cookies.</div>
</div>
<a href="https://github.com/rdebath/LostKingdom/">
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 101"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"
alt="Fork me on GitHub"></a>
</body>