diff --git a/search-app/live-search.js b/search-app/live-search.js index c41344e..b0fe736 100644 --- a/search-app/live-search.js +++ b/search-app/live-search.js @@ -255,11 +255,24 @@ } // --- Search --- - async function doSearch(query) { + async function doSearch(query, opts) { if (abortCtrl) abortCtrl.abort(); abortCtrl = new AbortController(); currentQuery = query; + if (opts && opts.forceMap) { + currentView = 'map'; + updateToggleButtons(); + const gridEl = panel ? panel.querySelector('.ls-grid') : null; + const mapWrap = panel ? panel.querySelector('.ls-map-wrap') : null; + const bodyEl = panel ? panel.querySelector('.ls-body') : null; + if (gridEl && mapWrap && bodyEl) { + gridEl.style.display = 'none'; + mapWrap.style.display = ''; + bodyEl.style.overflowY = 'hidden'; + } + } + const statusEl = getOrCreatePanel().querySelector('.ls-status'); const gridEl = getOrCreatePanel().querySelector('.ls-grid'); gridEl.innerHTML = ''; @@ -625,6 +638,7 @@ // Initial scan scanForSearchInputs(); + hijackLocationSection(); // Watch for dynamically added inputs (SPA navigation) const observer = new MutationObserver((mutations) => { @@ -638,9 +652,87 @@ } } } + // Always re-check for the Place section (modal mounts/unmounts) + hijackLocationSection(); }); observer.observe(document.body, { childList: true, subtree: true }); + // --- Replace the search filter modal's Place section (Country/State/City + // dropdowns) with a single text input that opens the live-search overlay + // directly in map view. + function hijackLocationSection() { + const section = document.getElementById('location-selection'); + if (!section || section.dataset.lsHijacked === '1') return; + section.dataset.lsHijacked = '1'; + + // Hide every original child (heading + combobox grid) + for (const child of Array.from(section.children)) { + child.style.display = 'none'; + } + + const wrap = document.createElement('div'); + wrap.className = 'ls-place-hijack'; + wrap.innerHTML = ` + +