diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-10-07 21:49:58 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-10-07 21:49:58 +0900 |
| commit | c778f0e87e61dafbbc0920fa3fc7dfc765a9996f (patch) | |
| tree | 2fe0bb34b79699ea53b018f490dc269f205ac110 | |
| parent | 25a84af387f594cfc8d42c2e77b9fd0126efb4a7 (diff) | |
modified hugo.toml, modified recordings/recordings-plain.html, modified recordings/single.html
| -rw-r--r-- | hugo.toml | 5 | ||||
| -rw-r--r-- | layouts/recordings/recordings-plain.html | 2 | ||||
| -rw-r--r-- | layouts/recordings/single.html | 39 |
3 files changed, 45 insertions, 1 deletions
@@ -6,6 +6,11 @@ pagination.pagerSize = "7" theme = "spectral" #googleAnalytics = "G-XXXXXXXXXX" +[markup] + [markup.goldmark] + [markup.goldmark.renderer] + hardWraps = true + [params] fancyTitle = "THESIAH" # title for frontpage, may include image copyright = "Soomin Im" diff --git a/layouts/recordings/recordings-plain.html b/layouts/recordings/recordings-plain.html index 232c3e0..d72fdcd 100644 --- a/layouts/recordings/recordings-plain.html +++ b/layouts/recordings/recordings-plain.html @@ -213,7 +213,7 @@ {{ range $f := $files }} {{ $ext := path.Ext $f.Name | lower }} <li> - <a href="{{ $f.RelPermalink }}" data-name="{{ $f.Name }}" + <a href="{{ $f.RelPermalink }}" data-name="{{ $f.Name }}" {{ if eq $folderName "hidden" }}class="hidden-file"{{ else }}{{ if in (slice ".mp4" ".mov") $ext }}class="vid"{{ else if in (slice ".jpg" ".jpeg" ".png" ".gif" ".webp" ".svg") $ext }}class="img"{{ else if in (slice ".heic") $ext }}class="heic"{{ end }}{{ end }} >{{ $f.Name }}</a > diff --git a/layouts/recordings/single.html b/layouts/recordings/single.html index e784306..6e52caa 100644 --- a/layouts/recordings/single.html +++ b/layouts/recordings/single.html @@ -43,6 +43,45 @@ <div></div> </footer> + {{/* Determine background audio for this page: prefer page resources, then section subfolder */}} + {{ $folder := path.Base (printf "%s" .File.Dir) }} + {{ $paudios := .Resources.Match "*.{mp3,m4a,ogg,wav,opus,OPUS,OGG,WAV,MP3,M4A}" }} + {{ $audio := index $paudios 0 }} + {{ if not $audio }} + {{ $secAudios := .CurrentSection.Resources.Match (printf "**/%s/*.{mp3,m4a,ogg,wav,opus,OPUS,OGG,WAV,MP3,M4A}" $folder) }} + {{ $audio = index $secAudios 0 }} + {{ end }} + {{ with $audio }} + <audio id="bgm" src="{{ .RelPermalink }}" preload="auto" loop style="display:none"></audio> + <div style="position:fixed;right:16px;bottom:16px;z-index:10"> + <button id="bgm-toggle" class="btn" style="opacity:.8">BGM ▷</button> + </div> + <script> + // Try to autoplay; if blocked, enable on first user interaction + document.addEventListener('DOMContentLoaded', () => { + const bgm = document.getElementById('bgm'); + const toggle = document.getElementById('bgm-toggle'); + if (!bgm) return; + const tryPlay = () => bgm.play().catch(() => {}); + tryPlay(); + const onFirst = () => { tryPlay(); document.removeEventListener('click', onFirst); }; + document.addEventListener('click', onFirst, { once: true }); + if (toggle) { + toggle.addEventListener('click', (e) => { + e.preventDefault(); + if (bgm.paused) { + bgm.play().then(()=>{ toggle.textContent = 'BGM ❚❚'; }).catch(()=>{}); + } else { + bgm.pause(); + bgm.currentTime = 0; + toggle.textContent = 'BGM ▷'; + } + }); + } + }); + </script> + {{ end }} + <script> // 선택: 키보드 좌우 화살표로 이전/다음 이동 document.addEventListener("keydown", e => { |
