aboutsummaryrefslogtreecommitdiff
path: root/static/js/stork_config.js
diff options
context:
space:
mode:
authorJieiku2023-08-17 12:16:18 -0700
committerJieiku2023-08-17 12:16:18 -0700
commit3e5d8a96e9eae21a799f327cd8a52adb891ebe66 (patch)
tree6a1377b5207e4e3555f65ca162014468c64d6985 /static/js/stork_config.js
parent1d9be812c25508a5dc36afb9e80669b668a47190 (diff)
parent0983915e23793c28dd0bee149fd2ec05a7e96a94 (diff)
downloadabridge-3e5d8a96e9eae21a799f327cd8a52adb891ebe66.tar.gz
abridge-3e5d8a96e9eae21a799f327cd8a52adb891ebe66.tar.bz2
abridge-3e5d8a96e9eae21a799f327cd8a52adb891ebe66.zip
resolve merge conflicts
Diffstat (limited to 'static/js/stork_config.js')
-rw-r--r--static/js/stork_config.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/static/js/stork_config.js b/static/js/stork_config.js
new file mode 100644
index 0000000..3c589c2
--- /dev/null
+++ b/static/js/stork_config.js
@@ -0,0 +1,25 @@
+function loadStork() {
+ var baseUrl = document.querySelector("meta[name='base']").getAttribute("content");
+ if (baseUrl.slice(-1) == "/") {
+ baseUrl = baseUrl.slice(0, -1);
+ }
+ stork.initialize(baseUrl + "/stork.wasm").then(() => {
+ console.log("Finished downloading WASM");
+ })
+ .catch(e => {
+ console.error(e);
+ }); // download WASM
+ stork.register("stork",baseUrl + "/stork.st");
+}
+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 = '';
+ }
+};