witty/assets/replay.html

82 lines
2.6 KiB
HTML
Raw Normal View History

2022-01-15 13:14:17 +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/replay.js"></script>
<link rel="stylesheet" href="/assets/external/xterm.css" />
<link href="/assets/external/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/assets/main.css" />
<title>Replay</title>
</head>
<body>
<header>
<nav class="navbar navbar-dark bg-dark shadow-sm navbar-xs">
<div class="container-fluid">
<a class="navbar-brand mx-auto" href="https://github.com/syssecfsu/witty" target="_blank">
<img src="/assets/logo.svg" style="margin-right: 0.5rem;" height="28"
class="d-inline-block align-text-top">
replay terminal
</a>
</div>
</nav>
</header>
<div class="d-flex flex-column align-items-center" style="margin-top: 2rem;">
<div id="terminal">
<div id="terminal_view"></div>
</div>
<div class="d-flex align-items-center">
2022-01-16 00:54:15 +01:00
<button type="button" class="btn btn-primary btn-sm" style="margin-right: 3px;" onclick="playbtn()">
2022-01-15 13:14:17 +01:00
<img src="/assets/play.svg" id="play-btn" height="18px">
</button>
2022-01-16 00:54:15 +01:00
<input type="range" class="form-range" min="0" max="100" id="replay-control"
onchange="console.log(this.value)">
2022-01-15 13:14:17 +01:00
</div>
</div>
<script>
2022-01-16 00:54:15 +01:00
term = Init()
var rc = document.querySelector("#replay-control")
rc.value = 0
var icon = document.getElementById("play-btn")
2022-01-16 22:46:01 +01:00
var path = "/records/{{.fname}}"
2022-01-16 00:54:15 +01:00
var pause = false
function playbtn() {
if (icon.src.includes("play")) {
icon.src = "/assets/pause.svg"
pause = false
replay_session(term, path, rc.value,
function () {
return pause
},
function (percent) {
rc.value = percent
2022-01-16 03:17:03 +01:00
},
function () {
icon.src = "/assets/play.svg"
rc.value = 0
2022-01-16 00:54:15 +01:00
})
} else {
icon.src = "/assets/play.svg"
pause = true
}
2022-01-15 13:14:17 +01:00
}
</script>
</body>
</html>