From 9b33c7593b8e00bae956917c8dcf1a408717d10b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 06:18:06 +0000 Subject: [PATCH 1/4] Initial plan From 77be47297f7a203fdfafa9b08eaad39a4aec6da2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 06:25:40 +0000 Subject: [PATCH 2/4] Add autoplay toggle button to video player Agent-Logs-Url: https://github.com/mkelvers/mal/sessions/72375034-49a9-451f-8e30-ee26c9c20eab Co-authored-by: melosh101 <59763532+melosh101@users.noreply.github.com> --- static/player.ts | 23 ++++++++++++++++++++++- web/components/watch/video_player.templ | 14 ++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/static/player.ts b/static/player.ts index 6984e65..fd40cb3 100644 --- a/static/player.ts +++ b/static/player.ts @@ -81,6 +81,7 @@ const initPlayer = (): void => { const forwardBtn = container.querySelector('[data-forward]') as HTMLButtonElement const fullscreenBtn = container.querySelector('[data-fullscreen]') as HTMLButtonElement const skipSegmentBtn = container.querySelector('[data-skip]') as HTMLButtonElement + const autoplayBtn = container.querySelector('[data-autoplay]') as HTMLButtonElement const subtitleText = container.querySelector('[data-subtitle-text]') as HTMLElement const streamURL = container.getAttribute('data-stream-url') || '/watch/proxy/stream' @@ -176,6 +177,15 @@ const initPlayer = (): void => { const skipLabel = (segmentType: string): string => segmentType === 'ed' ? 'Skip outro' : 'Skip intro' + const isAutoplayEnabled = (): boolean => localStorage.getItem('mal:autoplay-enabled') !== 'false' + + const updateAutoplayButton = (): void => { + if (!autoplayBtn) return + const enabled = isAutoplayEnabled() + autoplayBtn.title = enabled ? 'Autoplay: On' : 'Autoplay: Off' + autoplayBtn.classList.toggle('opacity-40', !enabled) + } + const timelineBounds = (): { start: number, end: number, duration: number } => { const duration = Number.isFinite(video.duration) && video.duration > 0 ? video.duration : 0 @@ -803,6 +813,8 @@ const goToNextEpisode = (): void => { return } + if (!isAutoplayEnabled()) return + const nextEpisode = currentEpisodeNumber + 1 markEpisodeTransition(nextEpisode) @@ -862,7 +874,9 @@ const loadNextEpisodeInPlace = async (animeID: number, nextEpisode: number): Pro } video.load() - video.play().catch(() => {}) + if (isAutoplayEnabled()) { + video.play().catch(() => {}) + } parsedSegments = (data.segments || []) .map((segment: SkipSegment) => { @@ -1036,6 +1050,12 @@ const loadNextEpisodeInPlace = async (animeID: number, nextEpisode: number): Pro modeDub?.addEventListener('click', toggleDub) modeSub?.addEventListener('click', toggleSub) + autoplayBtn?.addEventListener('click', () => { + localStorage.setItem('mal:autoplay-enabled', isAutoplayEnabled() ? 'false' : 'true') + updateAutoplayButton() + showControls() + }) + subtitleSelect?.addEventListener('change', async () => { const selected = subtitleSelect.value if (selected === 'none') { @@ -1142,6 +1162,7 @@ const loadNextEpisodeInPlace = async (animeID: number, nextEpisode: number): Pro updatePlayPauseIcons(false) syncVolumeUI() updateSkipButton(0) + updateAutoplayButton() showControls() playerInitialized = true diff --git a/web/components/watch/video_player.templ b/web/components/watch/video_player.templ index f2c5434..4788076 100644 --- a/web/components/watch/video_player.templ +++ b/web/components/watch/video_player.templ @@ -251,6 +251,20 @@ templ VideoPlayer(data shared.WatchPageData, displayTitle string) { + + + + + + Date: Tue, 28 Apr 2026 06:41:15 +0000 Subject: [PATCH 3/4] Move autoplay button below player to the left Agent-Logs-Url: https://github.com/mkelvers/mal/sessions/cb3492f9-64b6-4d16-9c7b-11d9e2c647c3 Co-authored-by: melosh101 <59763532+melosh101@users.noreply.github.com> --- static/player.ts | 10 ++++++++-- web/components/watch/video_player.templ | 14 -------------- web/templates/watch.templ | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/static/player.ts b/static/player.ts index fd40cb3..5eac6cd 100644 --- a/static/player.ts +++ b/static/player.ts @@ -182,8 +182,14 @@ const initPlayer = (): void => { const updateAutoplayButton = (): void => { if (!autoplayBtn) return const enabled = isAutoplayEnabled() - autoplayBtn.title = enabled ? 'Autoplay: On' : 'Autoplay: Off' - autoplayBtn.classList.toggle('opacity-40', !enabled) + const label = enabled ? 'Autoplay: On' : 'Autoplay: Off' + autoplayBtn.title = label + autoplayBtn.classList.remove('opacity-40', 'opacity-50') + if (!enabled) autoplayBtn.classList.add('opacity-50') + const lastChild = autoplayBtn.lastChild + if (lastChild && lastChild.nodeType === Node.TEXT_NODE) { + lastChild.textContent = label + } } const timelineBounds = (): { start: number, end: number, duration: number } => { diff --git a/web/components/watch/video_player.templ b/web/components/watch/video_player.templ index 4788076..f2c5434 100644 --- a/web/components/watch/video_player.templ +++ b/web/components/watch/video_player.templ @@ -251,20 +251,6 @@ templ VideoPlayer(data shared.WatchPageData, displayTitle string) { - - - - - - @watch.VideoPlayer(data, anime.DisplayTitle()) - + + + + + + + Autoplay: On + + if shared.CanGoPrevEpisode(data.CurrentEpisode) { + From ab5cb9f5cb7332e88411794e47adbed41fff8ed4 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Tue, 28 Apr 2026 08:54:53 +0200 Subject: [PATCH 4/4] fix: autoplay button workign! --- static/player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/player.ts b/static/player.ts index 5eac6cd..6fedbb3 100644 --- a/static/player.ts +++ b/static/player.ts @@ -81,7 +81,7 @@ const initPlayer = (): void => { const forwardBtn = container.querySelector('[data-forward]') as HTMLButtonElement const fullscreenBtn = container.querySelector('[data-fullscreen]') as HTMLButtonElement const skipSegmentBtn = container.querySelector('[data-skip]') as HTMLButtonElement - const autoplayBtn = container.querySelector('[data-autoplay]') as HTMLButtonElement + const autoplayBtn = document.querySelector('[data-autoplay]') as HTMLButtonElement const subtitleText = container.querySelector('[data-subtitle-text]') as HTMLElement const streamURL = container.getAttribute('data-stream-url') || '/watch/proxy/stream'