Skip to content

Commit

Permalink
Improve layout of the terminal example.
Browse files Browse the repository at this point in the history
  • Loading branch information
bamidev committed Mar 11, 2024
1 parent 901ce8b commit 9b5aef7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/northern-lights.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
__ + * `' `'|. `:
"' `---"""----....____,..^---`^``----.,.___ `. `. . ____,.,-
___,--'""`---"' ^ ^ ^ ^ """'---,..___ __,..---""'
--"' ^ ``--..,__ D. Rice
--"' ^ ``--..,__ D. Rice
Empty file modified examples/preview-art.sh
100644 → 100755
Empty file.
19 changes: 13 additions & 6 deletions examples/resources/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,35 @@ function onExecutionEnded() {
is_executing = false
}

function escapeText(text) {
return text
.replaceAll(' ', ' ')
.replaceAll("\r\n", '<br />')
.replaceAll("\n", '<br />')
}

function onOutputReceived( output ) {
let span = document.createElement("span")
span.innerText = output
span.innerHTML = escapeText(output)

document.body.appendChild( span )
document.body.firstElementChild.appendChild( span )
}

function onErrorOutputReceived( output ) {

let span = document.createElement("span")
span.setAttribute("class", "stderr")
span.innerText = output
span.innerHTML = escapeText(output)

document.body.appendChild( span )
document.body.firstElementChild.appendChild( span )
}

function print( text ) {
$('body').append( text )
$('body div').append( text )
}

function printPrefix() {
print( working_dir + '$ ' )
print(working_dir + '$ ')
}


Expand Down
3 changes: 2 additions & 1 deletion examples/resources/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
body {
background-color: #000;
color: #0F0;
font: 1em coolFont;
font: 1.2em coolFont;
margin-top: 0;
word-break: break-all;
word-wrap: break-word;
white-space: pre-line;
Expand Down
4 changes: 3 additions & 1 deletion examples/resources/terminal.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@

<script type="text/javascript" src="main.js"></script>
</head>
<body />
<body>
<div></div>
</body>
</html>

0 comments on commit 9b5aef7

Please sign in to comment.