summaryrefslogtreecommitdiff
path: root/layouts/recordings/recordings-plain.html
blob: 1b1b82b07f899be29c297ccfd67f5b8ede3a72fe (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!doctype html>
<meta charset="utf-8" />
<title>{{ .Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
  body {
    font-family:
      system-ui,
      Segoe UI,
      Roboto,
      Apple SD Gothic Neo,
      AppleGothic,
      sans-serif;
    max-width: 900px;
    margin: 32px auto;
    padding: 0 16px;
  }
  h1 {
    margin-bottom: 12px;
  }
  ul {
    line-height: 1.9;
  }
  a {
    text-decoration: none;
  }
  a:hover {
    text-decoration: underline;
  }
  video {
    width: 100%;
    height: auto;
    margin: 12px 0;
  }
  .meta {
    color: #666;
    margin-top: 4px;
  }
</style>

<h1>Recordings</h1>

<div id="player" style="display: none">
  <video id="video" controls preload="metadata"></video>
  <div id="meta" class="meta"></div>
</div>

<ul id="list">
  {{ range .Resources.Match "*.{mp4,mov}" }}
  <li>
    <a href="{{ .RelPermalink }}" data-name="{{ .Name }}" class="vid">
      {{ .Name }}
    </a>
  </li>
  {{ else }}
  <li>No recordings found.</li>
  {{ end }}
</ul>

<script>
  document.addEventListener("DOMContentLoaded", () => {
    const list = document.getElementById("list");
    const wrap = document.getElementById("player");
    const video = document.getElementById("video");
    const meta = document.getElementById("meta");
    list.addEventListener("click", (e) => {
      const a = e.target.closest("a.vid");
      if (!a) return;
      e.preventDefault();
      video.src = a.getAttribute("href");
      video.play().catch(() => {});
      wrap.style.display = "";
      const name = a.dataset.name || video.src.split("/").pop();
      meta.textContent = name;
    });
  });
</script>