aboutsummaryrefslogtreecommitdiff
path: root/static/js/elasticlunr_bridge.js
diff options
context:
space:
mode:
authorJieiku2026-08-15 11:29:36 -0700
committerJieiku2026-08-15 11:29:36 -0700
commit9ebaff82f0bbdb3409eb9910a4353a8a66422ff1 (patch)
tree3df37f3c6904291d6811e6daf4e4d3ffcecfeeb5 /static/js/elasticlunr_bridge.js
parentb6e10040f5e8fffe10ec0a01a12196d56337707f (diff)
downloadabridge-9ebaff82f0bbdb3409eb9910a4353a8a66422ff1.tar.gz
abridge-9ebaff82f0bbdb3409eb9910a4353a8a66422ff1.tar.bz2
abridge-9ebaff82f0bbdb3409eb9910a4353a8a66422ff1.zip
Update for Elasticlunr
Diffstat (limited to 'static/js/elasticlunr_bridge.js')
-rw-r--r--static/js/elasticlunr_bridge.js14
1 files changed, 4 insertions, 10 deletions
diff --git a/static/js/elasticlunr_bridge.js b/static/js/elasticlunr_bridge.js
index e2ff7ae..c20bc6a 100644
--- a/static/js/elasticlunr_bridge.js
+++ b/static/js/elasticlunr_bridge.js
@@ -1,17 +1,11 @@
-// Include immediately after elasticlunr.min.js in the JS bundle.
-//
-// elasticlunr's UMD assigns window.elasticlunr. Keep a local binding for search.js
-// in this same bundle, and expose window.lunr only long enough for optional
-// on-demand language packs (lunr.stemmer.support.min.js, lunr.fr.min.js, …).
-// Those scripts mutate the same object; after they run we drop the global name.
+// Runs inside the IIFE opened by elasticlunr_scope_begin.js, after elasticlunr.min.js.
+// Capture the UMD export, drop window.elasticlunr, keep a temporary window.lunr for
+// on-demand language packs (stemmer.support, lunr.fr, …), then remove lunr after load.
var elasticlunr = window.elasticlunr;
try { delete window.elasticlunr; } catch (e) {}
window.lunr = elasticlunr;
-// head_js loads language scripts with defer, after this bundle. Deferred scripts
-// run in document order before DOMContentLoaded, so stemmer/lang packs attach
-// first; then we remove the temporary global. Local `elasticlunr` still has
-// stemmerSupport / language plugins for search.
+// Language scripts use defer and run before DOMContentLoaded, in document order.
document.addEventListener("DOMContentLoaded", function () {
try { delete window.lunr; } catch (e) {}
});