witty/assets/template/replay.html

88 lines
2.8 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>
2022-01-17 12:52:09 +01:00
<nav class="navbar navbar-light bg-light shadow-sm navbar-xs">
2022-01-15 13:14:17 +01:00
<div class="container-fluid">
<a class="navbar-brand mx-auto" href="https://github.com/syssecfsu/witty" target="_blank">
2022-01-18 14:43:10 +01:00
<img src="/assets/img/record.svg" style="margin-right: 0.5rem;" height="32"
2022-01-15 13:14:17 +01:00
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-17 12:52:09 +01:00
<img src="/assets/img/play.svg" id="play-btn" height="18px">
2022-01-15 13:14:17 +01:00
</button>
2022-01-16 00:54:15 +01:00
<input type="range" class="form-range" min="0" max="100" id="replay-control"
2022-01-18 19:06:25 +01:00
onchange="clicked = 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
2022-01-18 19:06:25 +01:00
var clicked = -1
2022-01-16 00:54:15 +01:00
function playbtn() {
if (icon.src.includes("play")) {
2022-01-17 12:52:09 +01:00
icon.src = "/assets/img/pause.svg"
2022-01-16 00:54:15 +01:00
pause = false
replay_session(term, path, rc.value,
function () {
return pause
},
2022-01-18 19:06:25 +01:00
function(){
var tmp = clicked
clicked = -1
return tmp
},
2022-01-16 00:54:15 +01:00
function (percent) {
rc.value = percent
2022-01-16 03:17:03 +01:00
},
function () {
2022-01-17 12:52:09 +01:00
icon.src = "/assets/img/play.svg"
2022-01-16 03:17:03 +01:00
rc.value = 0
2022-01-16 00:54:15 +01:00
})
} else {
2022-01-17 12:52:09 +01:00
icon.src = "/assets/img/play.svg"
2022-01-16 00:54:15 +01:00
pause = true
}
2022-01-15 13:14:17 +01:00
}
</script>
</body>
</html>