diff --git a/src/build/assets/navigation.js b/src/build/assets/navigation.js index 98ea791..ac4341d 100644 --- a/src/build/assets/navigation.js +++ b/src/build/assets/navigation.js @@ -16,8 +16,6 @@ const siteTreeElements = siteTree.querySelector('.elements'); const siteTreeStatus = siteTree.querySelector('[role="status"]'); const indexSuffix = window.location.pathname.endsWith('index.html') ? 'index.html' : ''; -const rootPrefix = document.querySelector('.home').dataset.rootPrefix; -const sitePath = document.querySelector('.home').dataset.sitePath; // We only render the site tree elements (which are displayed during // browsing/searching) into the DOM when, or shortly before, we need them, @@ -75,7 +73,7 @@ function initializeSiteTree() { let image; if (video.image) { image = document.createElement('img'); - image.src = rootPrefix + video.sitePath + video.image; + image.src = window.hyper8.rootPrefix + video.sitePath + video.image; if (video.lqip) { image.style.background = lqipToRadialGradient(video.lqip); @@ -105,11 +103,11 @@ function initializeSiteTree() { video.element = document.createElement('a'); video.element.classList.add('video'); - video.element.href = rootPrefix + video.sitePath + indexSuffix; + video.element.href = window.hyper8.rootPrefix + video.sitePath + indexSuffix; video.element.appendChild(image); video.element.appendChild(divTitleDetails); - if (video.sitePath === sitePath) { + if (video.sitePath === window.hyper8.sitePath) { video.element.classList.add('current'); } @@ -145,7 +143,7 @@ function initializeSiteTree() { playlist.element = document.createElement('a'); playlist.element.classList.add('playlist'); - playlist.element.href = rootPrefix + playlist.sitePath + indexSuffix; + playlist.element.href = window.hyper8.rootPrefix + playlist.sitePath + indexSuffix; playlist.element.appendChild(playlist.expandToggle); playlist.element.appendChild(spanTitle); playlist.element.appendChild(spanInfo); @@ -160,7 +158,7 @@ function initializeSiteTree() { }); } - if (playlist.sitePath === sitePath) { + if (playlist.sitePath === window.hyper8.sitePath) { playlist.element.classList.add('current'); } @@ -197,7 +195,7 @@ function initializeSiteTree() { collection.element = document.createElement('a'); collection.element.classList.add('collection'); - collection.element.href = rootPrefix + collection.sitePath + indexSuffix; + collection.element.href = window.hyper8.rootPrefix + collection.sitePath + indexSuffix; collection.element.appendChild(collection.expandToggle); collection.element.appendChild(spanTitle); @@ -216,7 +214,7 @@ function initializeSiteTree() { }); } - if (collection.sitePath === sitePath) { + if (collection.sitePath === window.hyper8.sitePath) { collection.element.classList.add('current'); } diff --git a/src/build/assets/site.css b/src/build/assets/site.css index f2d62bc..a83f055 100644 --- a/src/build/assets/site.css +++ b/src/build/assets/site.css @@ -289,10 +289,6 @@ img { padding: .5rem; } .medium_font { font-size: 1.2rem; } -.outline { - flex-shrink: 0; - min-width: 20rem; -} .outro_playlist_context > a, .outro_playlist_context > button { align-items: center; @@ -634,9 +630,10 @@ img { .search input:focus::placeholder { opacity: 0; } .search:not(.query_present) button { display: none; } .sidebar { - display: flex; - flex-direction: column; + flex-shrink: 0; + min-width: 20rem; } +.sidebar.hidden { display: none; } .site_title { color: var(--fg-2); font-size: 1.17rem; @@ -974,7 +971,7 @@ video { .feed_grid { gap: 2rem; } } @media (min-width: 80rem) { - .outline { + .sidebar { max-height: calc(100dvh - 4rem); overflow-y: auto; width: 24rem; diff --git a/src/build/assets/video.js b/src/build/assets/video.js index c324f81..a56e6d5 100644 --- a/src/build/assets/video.js +++ b/src/build/assets/video.js @@ -20,6 +20,7 @@ const speedControl = document.querySelector('#speed'); const speedMultiplier = document.querySelector('#speed .multiplier'); const timelineInput = document.querySelector('.timeline input'); const togglePlaybackButton = document.querySelector('#toggle_playback'); +const togglePlaylistButton = document.querySelector('#toggle_playlist'); const versionSelectorControl = document.querySelector('.selector_control.version'); const versionSlices = document.querySelectorAll('.versions_ring g[data-src]'); const versionsRing = document.querySelector('.versions_ring'); @@ -436,6 +437,23 @@ speedControl.addEventListener('wheel', event => { togglePlaybackButton.addEventListener('click', togglePlayback); +if (togglePlaylistButton) { + const sidebar = document.querySelector('.sidebar'); + const storageKey = `hyper8HidePlaylist:${togglePlaylistButton.dataset.sitePath}`; + + function togglePlaylist() { + if (sidebar.classList.contains('hidden')) { + sessionStorage.removeItem(storageKey); + sidebar.classList.remove('hidden'); + } else { + sessionStorage.setItem(storageKey, '') + sidebar.classList.add('hidden'); + } + } + + togglePlaylistButton.addEventListener('click', togglePlaylist); +} + video.addEventListener('ended', () => { playerWrapper.dataset.state = 'outro'; clearInterval(playbackUpdateInterval); diff --git a/src/build/layout.rs b/src/build/layout.rs index e7c5960..d4f8ccf 100644 --- a/src/build/layout.rs +++ b/src/build/layout.rs @@ -208,10 +208,13 @@ impl Layout { let t_video_player = translations.video_player; let body = formatdoc!(r##" +