Peach: Local-first video metadata scraper and media manager.
fix: restore home facets after routed pages
Peach local maintenancee6045dc53691
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex da3231666..b9fc4d561 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -102,6 +102,14 @@ class WebUiSourceTests(unittest.TestCase):self.assertIn('class="relatedpeople"', self.page)self.assertIn("data-related-performer", self.page)+ def test_every_home_navigation_restores_the_shared_facets(self):+ self.assertIn("function showHomeSurfaces()", self.page)+ self.assertIn("$('#tiers').style.display='';$('#tagbar').style.display=''", self.page)+ self.assertIn("function closeStats(push=true){if(push)route('/');showHomeSurfaces();load(true)}", self.page)+ self.assertIn("async function load(reset)", self.page)+ self.assertIn("showHomeSurfaces();\n if(reset)offset=0", self.page)+ self.assertIn("showHomeSurfaces();disposeStage(false)", self.page)+def test_entity_tags_filter_inside_the_current_entity_page(self):self.assertIn("if(entityTag)p.set('tag',entityTag)", self.page)self.assertIn("async function updateEntityCollection", self.page)diff --git a/web/index.html b/web/index.htmlindex a5c3f6135..b4253b8cb 100644--- a/web/index.html+++ b/web/index.html@@ -1291,8 +1291,12 @@ async function openStats(push=true){closeStats(); toggleTag(b.dataset.k)});window.scrollTo({top:0,behavior:'smooth'});}-function closeStats(push=true){if(push)route('/');$('#stats').hidden=true;- $('#tiers').style.display='';$('#tagbar').style.display='';load(true)}+function showHomeSurfaces(){+ document.body.classList.remove('entity-open');+ $('#stats').hidden=true;$('#index').hidden=true;+ $('#tiers').style.display='';$('#tagbar').style.display='';+}+function closeStats(push=true){if(push)route('/');showHomeSurfaces();load(true)}/* ── 全部艺人 / 创作者 / 标签索引页 ── */let tagIndexMode='alphabet',tagIndexCategory='all',indexRequestSeq=0;@@ -1536,9 +1540,9 @@ async function load(reset){if(!reset&&listLoading)return;if(!reset)listLoading=true;try{- document.body.classList.remove('entity-open');+ showHomeSurfaces();if(reset)offset=0;- $('#index').hidden=true; $('#stats').hidden=true; renderCombo();+ renderCombo();if(state.state==='ads'){if(reset||!adsBatch){const nextAds=await api('/api/ads?limit=200');if(requestSeq!==loadRequestSeq)return;adsBatch=nextAds;cache(adsBatch.items)}@@ -1976,7 +1980,7 @@ async function restoreRoute(){await openIndex(path.slice(1),params.get('q')||'',false);return}if(path==='/stats'){await openStats(false);return}if(path==='/immerse'){await openTok(undefined,false);return}- document.body.classList.remove('entity-open');$('#stats').hidden=true;$('#index').hidden=true;disposeStage(false);+ showHomeSurfaces();disposeStage(false);}window.addEventListener('popstate',restoreRoute);buildEdge();