diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-02-12 18:03:20 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-02-12 18:04:46 -0400 |
| commit | 4e49f28f75a5ae280c1b32f7109e4911da439905 (patch) | |
| tree | c8b141c76298b8e7de812060c0ce778594b4cc50 /src/static/js | |
| parent | e82707fadb8a441c9ef8dc2de85a34d53d7c5abe (diff) | |
client: sidebar-search: don't record homepage as context
Diffstat (limited to 'src/static/js')
| -rw-r--r-- | src/static/js/client/sidebar-search.js | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js index 5b3c0ee1..519fd269 100644 --- a/src/static/js/client/sidebar-search.js +++ b/src/static/js/client/sidebar-search.js @@ -701,16 +701,7 @@ async function activateSidebarSearch(query) { state.searchStage = 'complete'; updateSidebarSearchStatus(); - session.activeQueryContextPageName = - document.querySelector('title').dataset.withoutWikiName ?? - document.title; - - session.activeQueryContextPagePathname = - location.pathname; - - session.activeQueryContextPageColor = - document.querySelector('.color-style')?.dataset.color ?? - null; + recordActiveQueryContext(); session.activeQuery = query; session.activeQueryResults = results; @@ -725,6 +716,25 @@ async function activateSidebarSearch(query) { } } +function recordActiveQueryContext() { + const {session} = info; + + if (document.documentElement.dataset.urlKey === 'localized.home') { + return; + } + + session.activeQueryContextPageName = + document.querySelector('title').dataset.withoutWikiName ?? + document.title; + + session.activeQueryContextPagePathname = + location.pathname; + + session.activeQueryContextPageColor = + document.querySelector('.color-style')?.dataset.color ?? + null; +} + function clearSidebarSearch() { const {session, state} = info; |