summary refs log tree commit diff
path: root/_layouts
diff options
context:
space:
mode:
authormayx2024-09-29 15:20:22 +0000
committermayx2024-09-29 15:20:22 +0000
commit550321e80acceb1d4b0bc442964014f80e1d88d3 (patch)
treef191b2c07322f1ebb5069a4a5878dc98098a3845 /_layouts
parent50c6c49c4c9e71eb9b4ddf22dd59233c9731e8aa (diff)
Update 2 files
- /_layouts/default.html
- /search.html
Diffstat (limited to '_layouts')
-rw-r--r--_layouts/default.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/_layouts/default.html b/_layouts/default.html
index ab90993..ff80871 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -27,6 +27,18 @@
 
   gtag('config', '{{ site.google_analytics }}');
   var lastUpdated = new Date("{{ site.time | date: "%FT%T%z" }}");
+  function getSearchJSON(callback) {
+    var searchData = JSON.parse(localStorage.getItem(lastUpdated));
+    if (!searchData) {
+      localStorage.clear();
+      $.getJSON("search.json", function (data) {
+          localStorage.setItem(lastUpdated, JSON.stringify(data));
+          callback(data);
+      });
+    } else {
+      callback(searchData);
+    }
+  }
   </script>
   {% endif %}
   <style>