witty/assets/term.html

74 lines
2.4 KiB
HTML
Raw Normal View History

2022-01-11 16:08:32 +01:00
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<script src="/assets/external/xterm.js"></script>
<script src="/assets/external/xterm-addon-attach.js"></script>
<script src="/assets/external/xterm-addon-fit.js"></script>
<script src="/assets/external/xterm-addon-web-links.js"></script>
<script src="/assets/main.js"></script>
<link rel="stylesheet" href="/assets/external/xterm.css" />
2022-01-13 23:58:41 +01:00
<link href="/assets/external/bootstrap.min.css" rel="stylesheet">
2022-01-11 16:08:32 +01:00
<link rel="stylesheet" href="/assets/main.css" />
2022-01-13 23:58:41 +01:00
<title>{{.title}}</title>
2022-01-11 16:08:32 +01:00
</head>
<body>
2022-01-13 23:58:41 +01:00
<header>
2022-01-17 12:52:09 +01:00
<nav class="navbar navbar-light bg-light shadow-sm navbar-xs">
2022-01-13 23:58:41 +01:00
<div class="container-fluid">
<a class="navbar-brand mx-auto" href="https://github.com/syssecfsu/witty" target="_blank">
2022-01-17 12:52:09 +01:00
<img src="/assets/img/{{.logo}}.svg" style="margin-right: 0.5rem;" height="32" class="d-inline-block align-text-top">
2022-01-13 23:58:41 +01:00
{{.title}}
</a>
2022-01-14 19:35:10 +01:00
<button type="button" id="record_onoff" class="btn btn-primary btn-sm float-end" value="Record"
onclick="recordOnOff()">Record</button>
2022-01-13 23:58:41 +01:00
</div>
</nav>
</header>
2022-01-11 21:22:24 +01:00
2022-01-17 12:52:09 +01:00
<div style="margin-top: 2em;">
2022-01-11 21:22:24 +01:00
<div id="terminal">
<div id="terminal_view"></div>
</div>
</div>
2022-01-11 16:08:32 +01:00
<script>
2022-01-14 19:35:10 +01:00
function recordOnOff(on) {
var btn = document.getElementById("record_onoff");
if (btn.value == "Record") {
btn.value = "Stop";
btn.innerHTML = btn.value
fetch("/record/{{.id}}")
} else {
2022-01-15 13:13:42 +01:00
btn.value = "Record";
2022-01-14 19:35:10 +01:00
btn.innerHTML = btn.value
fetch("/stop/{{.id}}")
}
}
function Init() {
term = createTerminal("{{.path}}");
// print something to test output and scroll
var str = [
' ┌────────────────────────────────────────────────────────────────────────────┐\n',
2022-01-15 13:13:42 +01:00
' │ \u001b[32;1mhttps://github.com/syssecfsu/witty\x1b[0m <- click it! \n',
2022-01-14 19:35:10 +01:00
' └────────────────────────────────────────────────────────────────────────────┘\n',
''
].join('');
2022-01-15 13:13:42 +01:00
term.writeln (str)
2022-01-14 19:35:10 +01:00
}
Init()
2022-01-11 16:08:32 +01:00
</script>
2022-01-11 21:22:24 +01:00
2022-01-11 16:08:32 +01:00
</body>
</html>