summaryrefslogtreecommitdiff
path: root/search.html
diff options
context:
space:
mode:
authormayx <mayx@outlook.com>2026-05-21 07:38:17 +0000
committermayx <mayx@outlook.com>2026-05-21 07:38:17 +0000
commitc4ae25dcb16513f76870d07c95ebc94ba6e7cf49 (patch)
tree88f925621c8f9927530ba6856c7798bf86b9a96e /search.html
parent862bffac806a5f7ee0e12cc3f13a36178c003db1 (diff)
Update 10 files
- /assets/js/jquery.pjax.min.js - /assets/js/main.js - /assets/js/pjax.js - /_layouts/default.html - /_layouts/post.html - /_data/proxylist.yml - /_data/other_repo_list.csv - /Live2dHistoire/live2d/js/message.js - /index.html - /search.html
Diffstat (limited to 'search.html')
-rw-r--r--search.html19
1 files changed, 18 insertions, 1 deletions
diff --git a/search.html b/search.html
index be69f4d..ccf4bbf 100644
--- a/search.html
+++ b/search.html
@@ -27,7 +27,7 @@ if (mykeyword) {
</script>
<script src="/assets/js/simple-jekyll-search.min.js"></script>
<script>
-getSearchJSON(function(json){
+function _doSearch(json) {
var sjs = SimpleJekyllSearch({
searchInput: sbox,
resultsContainer: document.getElementById('results-container'),
@@ -37,5 +37,22 @@ getSearchJSON(function(json){
});
sjs.search(mykeyword);
document.getElementById('search-loading').style.display = "none";
+}
+getSearchJSON(function(json) {
+ if (typeof SimpleJekyllSearch !== 'undefined') {
+ _doSearch(json);
+ } else {
+ // PJAX 场景:外部脚本通过 pjax 库异步加载,需要等待加载完成
+ var _poll = 0;
+ var _waitSJS = setInterval(function() {
+ if (typeof SimpleJekyllSearch !== 'undefined') {
+ clearInterval(_waitSJS);
+ _doSearch(json);
+ } else if (++_poll > 100) {
+ clearInterval(_waitSJS);
+ document.getElementById('search-loading').style.display = "none";
+ }
+ }, 50);
+ }
});
</script> \ No newline at end of file