support shareable search links via a ?q= URL parameter
This commit is contained in:
@@ -9725,6 +9725,24 @@ async function registerServiceWorker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /?q=<query> — a shareable search link (same family as Share's /?v=&t=).
|
||||||
|
// Runs after wireUI() so the search form's submit handler exists; the param
|
||||||
|
// is stripped immediately so a reload doesn't re-run the search.
|
||||||
|
function bootSearchFromUrl() {
|
||||||
|
let query = '';
|
||||||
|
try {
|
||||||
|
query = (new URLSearchParams(location.search).get('q') || '').trim();
|
||||||
|
} catch { return; }
|
||||||
|
if (!query) return;
|
||||||
|
try {
|
||||||
|
const u = new URL(location.href);
|
||||||
|
u.searchParams.delete('q');
|
||||||
|
history.replaceState(null, '', u.pathname + u.search + u.hash);
|
||||||
|
} catch { /* keep */ }
|
||||||
|
els.searchInput.value = query;
|
||||||
|
els.searchForm.requestSubmit();
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Boot
|
// Boot
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -9785,6 +9803,7 @@ async function boot() {
|
|||||||
Presenter.boot();
|
Presenter.boot();
|
||||||
SectionRail.boot();
|
SectionRail.boot();
|
||||||
Share.bootFromUrl();
|
Share.bootFromUrl();
|
||||||
|
bootSearchFromUrl();
|
||||||
Party.boot();
|
Party.boot();
|
||||||
Remote.boot();
|
Remote.boot();
|
||||||
Transition.renderButton();
|
Transition.renderButton();
|
||||||
|
|||||||
Reference in New Issue
Block a user