fix(categories): preserve category bar on homepage navigation and overview route (v1.6.3)

This commit is contained in:
Enes Yakıştır
2026-10-18 22:47:33 +03:00
parent 5d719d7b8b
commit 96140bca5e
2 changed files with 42 additions and 3 deletions
+41 -2
View File
@@ -3172,6 +3172,9 @@ try {
var isBrowsePage = var isBrowsePage =
path === '/' || path === '/' ||
path === '' ||
path === '/videos/overview' ||
path.indexOf('/videos/overview') === 0 ||
path === '/videos/browse' || path === '/videos/browse' ||
path.indexOf('/videos/browse') === 0 || path.indexOf('/videos/browse') === 0 ||
path.indexOf('/search') === 0 || path.indexOf('/search') === 0 ||
@@ -3188,8 +3191,11 @@ try {
var targetElem = var targetElem =
document.querySelector('my-video-filters-header') || document.querySelector('my-video-filters-header') ||
document.querySelector('my-videos-list') || document.querySelector('my-videos-list') ||
document.querySelector('my-video-overview') ||
document.querySelector('my-home-menu') ||
document.querySelector('my-search-results') || document.querySelector('my-search-results') ||
document.querySelector('my-search') || document.querySelector('my-search') ||
document.querySelector('.main-row') ||
document.querySelector('.main-col') || document.querySelector('.main-col') ||
document.querySelector('main'); document.querySelector('main');
@@ -3201,6 +3207,26 @@ try {
var activeKey = getActiveCategoryKey(); var activeKey = getActiveCategoryKey();
var existingBar = document.getElementById('yaktube-category-chips-bar'); 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) { if (existingBar) {
var chips = existingBar.querySelectorAll('.yaktube-category-chip'); var chips = existingBar.querySelectorAll('.yaktube-category-chip');
chips.forEach(function (chip) { chips.forEach(function (chip) {
@@ -3269,7 +3295,12 @@ try {
chip.addEventListener('click', function (e) { chip.addEventListener('click', function (e) {
e.preventDefault(); 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.'); announce(cat.label + ' kategorisi seçildi.');
@@ -3319,6 +3350,8 @@ try {
if ( if (
tag === 'my-video-filters-header' || tag === 'my-video-filters-header' ||
tag === 'my-videos-list' || tag === 'my-videos-list' ||
tag === 'my-video-overview' ||
tag === 'my-home-menu' ||
tag === 'my-search-results' || tag === 'my-search-results' ||
tag === 'my-search' tag === 'my-search'
) { ) {
@@ -5645,7 +5678,13 @@ try {
scheduleUnifiedCycle(true); scheduleUnifiedCycle(true);
setTimeout(function () { setTimeout(function () {
scheduleUnifiedCycle(false, 0); scheduleUnifiedCycle(false, 0);
}, 350); }, 150);
setTimeout(function () {
scheduleUnifiedCycle(false, 0);
}, 450);
setTimeout(function () {
scheduleUnifiedCycle(false, 0);
}, 950);
} }
window.addEventListener('popstate', onLocationChange); window.addEventListener('popstate', onLocationChange);
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "peertube-plugin-yaktube-ondemand", "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", "description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations, Sleep Timer, Touch Gestures, Voice Assistant & A11y Engine for PeerTube",
"main": "main.js", "main": "main.js",
"library": "./main.js", "library": "./main.js",