From 6dcec618d0ff0a2270f787f62267a0622275c69d Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 22:37:44 -0700 Subject: Load Tinysearch/Stork On Demand --- static/stork_config.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'static/stork_config.js') diff --git a/static/stork_config.js b/static/stork_config.js index 5480a18..3c589c2 100644 --- a/static/stork_config.js +++ b/static/stork_config.js @@ -11,4 +11,15 @@ function loadStork() { }); // download WASM stork.register("stork",baseUrl + "/stork.st"); } -loadStork(); \ No newline at end of file +var loaded = false; +window.onload = function() { + document.body.contains(document.goSearch) && (document.goSearch.onsubmit = function() { return goSearchNow() }) + document.getElementById('searchinput').onfocus = function() { + if (!loaded) { + loadStork(); + loaded = true; + document.body.contains(document.goSearch) && (document.goSearch.onsubmit = function() { return goSearchNow() }) + } + document.getElementById('searchinput').onfocus = ''; + } +}; -- cgit v1.3.1