From c7b914505b6505b013610cc71e3b50d68c4a5473 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Tue, 23 Aug 2022 13:41:41 -0700 Subject: Optimizations, Update Readme YellowLabTools --- static/tinysearch.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'static/tinysearch.js') diff --git a/static/tinysearch.js b/static/tinysearch.js index 80e8984..ab099ca 100644 --- a/static/tinysearch.js +++ b/static/tinysearch.js @@ -1,7 +1,3 @@ -var baseUrl = document.querySelector("meta[name='base']").getAttribute("content"); -if (baseUrl.slice(-1) == "/") { - baseUrl = baseUrl.slice(0, -1); -} // in page results when press enter or click search icon from search box function closeSearchNow() { const main = document.querySelector("main"); @@ -36,6 +32,10 @@ window.onload = function() { }; async function lazyLoad() { + var baseUrl = document.querySelector("meta[name='base']").getAttribute("content"); + if (baseUrl.slice(-1) == "/") { + baseUrl = baseUrl.slice(0, -1); + } await init(baseUrl + "/tinysearch_engine_bg.wasm") } @@ -223,6 +223,10 @@ async function load(e, t) { } : n } async function init(e) { + var baseUrl = document.querySelector("meta[name='base']").getAttribute("content"); + if (baseUrl.slice(-1) == "/") { + baseUrl = baseUrl.slice(0, -1); + } void 0 === e && (e = new URL(baseUrl + "/tinysearch_engine_bg.wasm", import.meta.url)); const t = { wbg: {} -- cgit v1.3.1