-
Notifications
You must be signed in to change notification settings - Fork 0
/
terminal.js
36 lines (34 loc) · 1.17 KB
/
terminal.js
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
const terminal = (function() {
const self = {};
const output = document.getElementById('console-output');
const debug = document.getElementById('console-debug');
const output_button = document.querySelectorAll('#console-tabs span')[0];
const debug_button = document.querySelectorAll('#console-tabs span')[1];
self.showOutput = function(str) {
output.innerText = str;
}
self.showDebug = function(str) {
debug.innerText = str;
}
output_button.onclick = function() {
let classList = output_button.classList;
if (classList.contains('selected')) {
return;
}
classList.add('selected');
debug_button.classList.remove('selected');
output.style.visibility = 'visible';
debug.style.visibility = 'hidden' ;
}
debug_button.onclick = function() {
let classList = debug_button.classList;
if (classList.contains('selected')) {
return;
}
classList.add('selected');
output_button.classList.remove('selected');
debug.style.visibility = 'visible';
output.style.visibility = 'hidden' ;
}
return self;
})();