From d73f877d18783a50e7b71f51508f1f1b053850ed Mon Sep 17 00:00:00 2001 From: ghassan Date: Sat, 16 May 2026 13:29:01 +0300 Subject: [PATCH] Add SPA autoplay + no-refresh clicks to Up Next recommendations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Autoplay toggle button in the Up Next header (defaults Off, persisted in localStorage as ytpAutoplay_solo) - When autoplay is On and video ends (_plOnVideoEnd hook), automatically loads the first recommended video via SPA — no page refresh - Clicking any recommended video uses recGoTo() → recTransitionTo() instead of window.location.href: swaps video source, resets progress bar, updates title, then background-swaps description, channel row, comments, and the entire sidebar with fresh recommendations from the next page - First card gets a red ▶ indicator while autoplay is On so the user can see what will play next - Browser back/forward work via popstate Co-Authored-By: Claude Sonnet 4.6 --- .../views/videos/types/generic.blade.php | 151 +++++++++++++++++- 1 file changed, 147 insertions(+), 4 deletions(-) diff --git a/resources/views/videos/types/generic.blade.php b/resources/views/videos/types/generic.blade.php index 98b4338..3bb792b 100644 --- a/resources/views/videos/types/generic.blade.php +++ b/resources/views/videos/types/generic.blade.php @@ -263,6 +263,16 @@ border-left: 3px solid #ef4444; } + .sidebar-video-card.rec-next-up { + border-left: 3px solid var(--brand-red); + } + + .sidebar-video-card.rec-next-up .sidebar-title::before { + content: '▶ '; + color: var(--brand-red); + font-size: 10px; + } + .sidebar-thumb { width: 168px; aspect-ratio: 16/9; @@ -676,12 +686,26 @@ @endif @else -

Up Next

+ {{-- Up Next header + autoplay toggle --}} +
+

+ Up Next +

+
+ +
+
+ @if ($recommendedVideos && $recommendedVideos->count() > 0) -