forked from Superalgos/Superalgos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.html
45 lines (40 loc) · 1.49 KB
/
console.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
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8"/>
<title>Console Logs</title>
<style>
/* #log-container { overflow: auto; } */
.log-warn { color: orange }
.log-error { color: red }
.log-info { color: skyblue }
.log-log { color: silver}
.log-warn, .log-error { font-weight: bold; }
</style>
</head>
<body>
<div id="log-container">
<pre id="log"></pre>
</div>
<script>
window.onload = () => {
window.api.receive('fromMain', (data) => {
if(data.includes('[ERROR]')) {
document.getElementById('log').insertAdjacentHTML('beforeend', "<span class=\"log-error\">" + data + "</span><br>");
}
else if(data.includes('[WARN]')) {
document.getElementById('log').insertAdjacentHTML('beforeend',"<span class=\"log-warn\">" + data + "</span><br>");
}
else if(data.includes('[INFO]')) {
document.getElementById('log').insertAdjacentHTML('beforeend',"<span class=\"log-info\">" + data + "</span><br>");
}
else {
document.getElementById('log').insertAdjacentHTML('beforeend',"<span class=\"log-log\">" + data + "</span><br>");
}
window.scrollTo(0, document.querySelector("#log-container").scrollHeight)
})
window.api.send("toMain", "ImAlive!")
}
</script>
</body>
</html>