diff --git a/clipfront2/src/App.svelte b/clipfront2/src/App.svelte index 1a1d7e1..4725f30 100644 --- a/clipfront2/src/App.svelte +++ b/clipfront2/src/App.svelte @@ -86,7 +86,7 @@ {/each}
- +
@@ -120,8 +120,8 @@ let queryTerms = [] const focusEl = el => el.focus() - const newTextQuery = () => { - queryTerms.push({ type: "text", weight: 1, sign: "+", text: "" }) + const newTextQuery = (content="") => { + queryTerms.push({ type: "text", weight: 1, sign: "+", text: content }) queryTerms = queryTerms } const removeTerm = term => { @@ -149,7 +149,6 @@ let resultPromise let results let displayedResults = [] - let query = "" const runSearch = async () => { if (!resultPromise) { let args = {} @@ -214,4 +213,10 @@ pendingImageLoads -= 1 redrawGrid() } + + const queryStringParams = new URLSearchParams(window.location.search) + if (queryStringParams.get("q")) { + newTextQuery(queryStringParams.get("q")) + runSearch() + }