From 96140bca5e4adf73004e867cc1232a77dc8aa1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20Yak=C4=B1=C5=9Ft=C4=B1r?= Date: Sun, 18 Oct 2026 22:47:33 +0300 Subject: [PATCH] fix(categories): preserve category bar on homepage navigation and overview route (v1.6.3) --- client.js | 43 +++++++++++++++++++++++++++++++++++++++++-- package.json | 2 +- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/client.js b/client.js index d7e788a..adbc374 100644 --- a/client.js +++ b/client.js @@ -3172,6 +3172,9 @@ try { var isBrowsePage = path === '/' || + path === '' || + path === '/videos/overview' || + path.indexOf('/videos/overview') === 0 || path === '/videos/browse' || path.indexOf('/videos/browse') === 0 || path.indexOf('/search') === 0 || @@ -3188,8 +3191,11 @@ try { var targetElem = document.querySelector('my-video-filters-header') || document.querySelector('my-videos-list') || + document.querySelector('my-video-overview') || + document.querySelector('my-home-menu') || document.querySelector('my-search-results') || document.querySelector('my-search') || + document.querySelector('.main-row') || document.querySelector('.main-col') || document.querySelector('main'); @@ -3201,6 +3207,26 @@ try { var activeKey = getActiveCategoryKey(); var existingBar = document.getElementById('yaktube-category-chips-bar'); + if (existingBar) { + var isDetached = !existingBar.isConnected || !document.body.contains(existingBar); + var isWrongParent = + targetElem && targetElem.parentElement && existingBar.parentElement !== targetElem.parentElement; + + if (isDetached) { + try { + existingBar.remove(); + } catch (e) {} + existingBar = null; + } else if (isWrongParent) { + try { + targetElem.parentElement.insertBefore(existingBar, targetElem); + } catch (e) { + existingBar.remove(); + existingBar = null; + } + } + } + if (existingBar) { var chips = existingBar.querySelectorAll('.yaktube-category-chip'); chips.forEach(function (chip) { @@ -3269,7 +3295,12 @@ try { chip.addEventListener('click', function (e) { e.preventDefault(); - if (cat.key === getActiveCategoryKey()) return; + if ( + cat.key === getActiveCategoryKey() && + (window.location.pathname === '/videos/browse' || + (cat.url && window.location.pathname + window.location.search === cat.url)) + ) + return; announce(cat.label + ' kategorisi seçildi.'); @@ -3319,6 +3350,8 @@ try { if ( tag === 'my-video-filters-header' || tag === 'my-videos-list' || + tag === 'my-video-overview' || + tag === 'my-home-menu' || tag === 'my-search-results' || tag === 'my-search' ) { @@ -5645,7 +5678,13 @@ try { scheduleUnifiedCycle(true); setTimeout(function () { scheduleUnifiedCycle(false, 0); - }, 350); + }, 150); + setTimeout(function () { + scheduleUnifiedCycle(false, 0); + }, 450); + setTimeout(function () { + scheduleUnifiedCycle(false, 0); + }, 950); } window.addEventListener('popstate', onLocationChange); diff --git a/package.json b/package.json index 68eeb73..037e29d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-yaktube-ondemand", - "version": "1.6.2", + "version": "1.6.3", "description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations, Sleep Timer, Touch Gestures, Voice Assistant & A11y Engine for PeerTube", "main": "main.js", "library": "./main.js",