sinzmise-cetastories 2.0.0-1731114112124 → 2.0.0-1731114615672
Sign up to get free protection for your applications and to get access to all the features.
- package/404/index.html +1 -4033
- package/about/index.html +1 -4041
- package/album/index.html +1 -4050
- package/archives/2021/12/index.html +1 -3917
- package/archives/2021/index.html +1 -3917
- package/archives/2022/12/index.html +1 -3917
- package/archives/2022/index.html +1 -3917
- package/archives/2023/01/index.html +1 -4072
- package/archives/2023/02/index.html +1 -3917
- package/archives/2023/03/index.html +1 -4063
- package/archives/2023/04/index.html +1 -3992
- package/archives/2023/07/index.html +1 -4217
- package/archives/2023/08/index.html +1 -4067
- package/archives/2023/09/index.html +1 -3917
- package/archives/2023/10/index.html +1 -3917
- package/archives/2023/11/index.html +1 -3917
- package/archives/2023/12/index.html +1 -3918
- package/archives/2023/index.html +1 -4591
- package/archives/2023/page/2/index.html +1 -4572
- package/archives/2023/page/3/index.html +1 -3930
- package/archives/2024/01/index.html +1 -4142
- package/archives/2024/02/index.html +1 -3922
- package/archives/2024/03/index.html +1 -3916
- package/archives/2024/04/index.html +1 -3997
- package/archives/2024/05/index.html +1 -4065
- package/archives/2024/06/index.html +1 -3917
- package/archives/2024/07/index.html +1 -3917
- package/archives/2024/08/index.html +1 -3992
- package/archives/2024/09/index.html +1 -3917
- package/archives/2024/10/index.html +1 -3984
- package/archives/2024/index.html +1 -4576
- package/archives/2024/page/2/index.html +1 -4433
- package/archives/index.html +1 -4560
- package/archives/page/2/index.html +1 -4560
- package/archives/page/3/index.html +1 -4560
- package/archives/page/4/index.html +1 -4560
- package/archives/page/5/index.html +1 -4560
- package/assets/algolia/algoliasearch.js +3 -7182
- package/assets/algolia/algoliasearchLite.js +3 -4445
- package/atom.xml +31 -31
- package/bbs/bbs.html +1 -4012
- package/bbs/bbs.js +2 -12
- package/bbs/index.html +1 -4031
- package/categories/index.html +1 -4050
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -4570
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -4485
- package/categories//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -3920
- package/categories//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -4148
- package/categories//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -4610
- package/categories//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -4148
- package/categories//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -4072
- package/charts/index.html +1 -4039
- package/comments/index.html +1 -4052
- package/css/custom2.css +2 -3
- package/css/first.css +2 -1868
- package/css/pace/big-counter.css +2 -39
- package/css/pace/corner-indicator.css +2 -72
- package/css/pace/flash.css +2 -76
- package/css/pace/mac-osx.css +2 -86
- package/css/pace/pace.css +2 -50
- package/css/plane.css +2 -59
- package/css/style.css +2 -8585
- package/css/tags.css +2 -3516
- package/essay/index.html +1 -4050
- package/fcircle/index.html +1 -4075
- package/games +2 -2
- package/index.html +1 -4717
- package/js/app.js +2 -1341
- package/js/autoload.js +2 -62
- package/js/ceta/fancybox.css +2 -2
- package/js/ceta/fancybox.umd.js +2 -2
- package/js/ceta/iconfontInkss.js +2 -1
- package/js/ceta/message.css +2 -6
- package/js/ceta/message.js +2 -6
- package/js/clock.js +2 -1
- package/js/kslink.js +2 -38
- package/js/newyear.js +2 -76
- package/js/plane.js +2 -2200
- package/js/plugins/aplayer.js +2 -186
- package/js/plugins/parallax.js +2 -191
- package/js/plugins/rightMenus.js +2 -623
- package/js/plugins/tags/contributors.js +2 -92
- package/js/plugins/tags/friends.js +2 -93
- package/js/plugins/tags/sites.js +2 -96
- package/js/search/algolia.js +2 -239
- package/js/search/hexo.js +2 -195
- package/js/search/meilisearch.js +2 -220
- package/js/txmap.js +2 -248
- package/link/index.html +1 -6180
- package/load.html +1 -294
- package/maps/assets/algolia/algoliasearch.js.map +1 -0
- package/maps/assets/algolia/algoliasearchLite.js.map +1 -0
- package/maps/bbs/bbs.js.map +1 -0
- package/maps/css/custom2.css.map +1 -0
- package/maps/css/first.css.map +1 -0
- package/maps/css/pace/big-counter.css.map +1 -0
- package/maps/css/pace/corner-indicator.css.map +1 -0
- package/maps/css/pace/flash.css.map +1 -0
- package/maps/css/pace/mac-osx.css.map +1 -0
- package/maps/css/pace/pace.css.map +1 -0
- package/maps/css/plane.css.map +1 -0
- package/maps/css/style.css.map +1 -0
- package/maps/css/tags.css.map +1 -0
- package/maps/js/app.js.map +1 -0
- package/maps/js/autoload.js.map +1 -0
- package/maps/js/ceta/fancybox.css.map +1 -0
- package/maps/js/ceta/fancybox.umd.js.map +1 -0
- package/maps/js/ceta/iconfontInkss.js.map +1 -0
- package/maps/js/ceta/message.css.map +1 -0
- package/maps/js/ceta/message.js.map +1 -0
- package/maps/js/clock.js.map +1 -0
- package/maps/js/kslink.js.map +1 -0
- package/maps/js/newyear.js.map +1 -0
- package/maps/js/plane.js.map +1 -0
- package/maps/js/plugins/aplayer.js.map +1 -0
- package/maps/js/plugins/parallax.js.map +1 -0
- package/maps/js/plugins/rightMenus.js.map +1 -0
- package/maps/js/plugins/tags/contributors.js.map +1 -0
- package/maps/js/plugins/tags/friends.js.map +1 -0
- package/maps/js/plugins/tags/sites.js.map +1 -0
- package/maps/js/search/algolia.js.map +1 -0
- package/maps/js/search/hexo.js.map +1 -0
- package/maps/js/search/meilisearch.js.map +1 -0
- package/maps/js/txmap.js.map +1 -0
- package/maps/sw.js.map +1 -0
- package/maps/weichuncai/css/style.css.map +1 -0
- package/maps/weichuncai/js/common.js.map +1 -0
- package/maps/weichuncai/js/jquery.js.map +1 -0
- package/maps/weichuncai/wcc-config.js.map +1 -0
- package/music/index.html +1 -4033
- package/package.json +1 -1
- package/page/2/index.html +1 -4578
- package/page/3/index.html +1 -4575
- package/page/4/index.html +1 -4572
- package/page/5/index.html +1 -3924
- package/posts/10021/index.html +5 -4130
- package/posts/10045/index.html +1 -4224
- package/posts/10733/index.html +1 -4125
- package/posts/10996/index.html +5 -4127
- package/posts/12779/index.html +1 -4134
- package/posts/13624/index.html +1 -4179
- package/posts/15688/index.html +1 -4133
- package/posts/15748/index.html +5 -4121
- package/posts/15799/index.html +1 -4130
- package/posts/15842/index.html +5 -4121
- package/posts/16107/index.html +1 -4111
- package/posts/18063/index.html +1 -4124
- package/posts/20412/index.html +1 -4134
- package/posts/21375/index.html +1 -4124
- package/posts/22945/index.html +4 -4169
- package/posts/23021/index.html +1 -4104
- package/posts/27531/index.html +5 -4121
- package/posts/28536/index.html +1 -4116
- package/posts/28733/index.html +1 -4168
- package/posts/29196/index.html +1 -4106
- package/posts/38917/index.html +1 -4144
- package/posts/38964/index.html +1 -4208
- package/posts/42487/index.html +1 -4135
- package/posts/42580/index.html +1 -4128
- package/posts/45875/index.html +1 -4118
- package/posts/46640/index.html +1 -4147
- package/posts/48762/index.html +1 -4109
- package/posts/50710/index.html +1 -4114
- package/posts/52677/index.html +1 -4125
- package/posts/53662/index.html +1 -4123
- package/posts/54386/index.html +1 -4116
- package/posts/54481/index.html +1 -4133
- package/posts/54787/index.html +5 -4124
- package/posts/56467/index.html +1 -4121
- package/posts/57692/index.html +1 -4143
- package/posts/58203/index.html +1 -4116
- package/posts/61417/index.html +1 -4117
- package/posts/61712/index.html +1 -4113
- package/posts/646/index.html +1 -4106
- package/posts/64856/index.html +1 -4120
- package/posts/64935/index.html +1 -4120
- package/search.xml +95 -95
- package/seas/index.html +1 -4050
- package/sw.js +2 -798
- package/tags/Flash/347/233/270/345/205/263/index.html +1 -3924
- package/tags/Steam/346/270/270/346/210/217/index.html +1 -3924
- package/tags/Windows/350/275/257/344/273/266/index.html +1 -3997
- package/tags/index.html +1 -4033
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -4570
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -4485
- package/tags//345/205/266/345/256/203/346/270/270/346/210/217/index.html +1 -4073
- package/tags//345/212/240/350/275/275/345/212/250/347/224/273/index.html +1 -3924
- package/tags//346/202/254/346/265/256/345/256/240/347/211/251-/347/234/213/346/235/277/345/250/230/index.html +1 -3925
- package/tags//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -3920
- package/tags//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -4148
- package/tags//347/253/231/347/202/271/345/272/225/351/203/250/351/255/224/346/224/271/index.html +1 -3924
- package/tags//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -4610
- package/tags//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -4148
- package/tags//350/207/252/345/273/272/351/203/250/347/275/262/index.html +1 -4224
- package/tags//351/241/265/351/235/242/351/255/224/346/224/271/index.html +1 -4075
- package/tags//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -4072
- package/update/index.html +1 -4112
- package/weichuncai/css/style.css +2 -25
- package/weichuncai/js/common.js +2 -449
- package/weichuncai/js/jquery.js +2 -139
- package/weichuncai/wcc-config.js +2 -17
@@ -1,92 +1,2 @@
|
|
1
|
-
const ContributorsJS = {
|
2
|
-
|
3
|
-
let retryTimes = 5;
|
4
|
-
|
5
|
-
function request() {
|
6
|
-
return new Promise((resolve, reject) => {
|
7
|
-
let status = 0; // 0 等待 1 完成 2 超时
|
8
|
-
let timer = setTimeout(() => {
|
9
|
-
if (status === 0) {
|
10
|
-
status = 2;
|
11
|
-
timer = null;
|
12
|
-
reject('请求超时');
|
13
|
-
if (retryTimes == 0) {
|
14
|
-
timeout();
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}, 5000);
|
18
|
-
fetch(url).then(function (response) {
|
19
|
-
if (status !== 2) {
|
20
|
-
clearTimeout(timer);
|
21
|
-
resolve(response);
|
22
|
-
timer = null;
|
23
|
-
status = 1;
|
24
|
-
}
|
25
|
-
if (response.ok) {
|
26
|
-
return response.json();
|
27
|
-
}
|
28
|
-
throw new Error('Network response was not ok.');
|
29
|
-
}).then(function (data) {
|
30
|
-
retryTimes = 0;
|
31
|
-
callback(data);
|
32
|
-
}).catch(function (error) {
|
33
|
-
if (retryTimes > 0) {
|
34
|
-
retryTimes -= 1;
|
35
|
-
setTimeout(() => {
|
36
|
-
request();
|
37
|
-
}, 5000);
|
38
|
-
} else {
|
39
|
-
timeout();
|
40
|
-
}
|
41
|
-
});
|
42
|
-
});
|
43
|
-
}
|
44
|
-
request();
|
45
|
-
},
|
46
|
-
layout: (cfg) => {
|
47
|
-
const el = cfg.el;
|
48
|
-
ContributorsJS.requestAPI(cfg.api, function (data) {
|
49
|
-
el.querySelector('.loading-wrap').remove();
|
50
|
-
var cellALL = "";
|
51
|
-
(data || []).forEach((item, i) => {
|
52
|
-
var user = '<div class="user-card">';
|
53
|
-
user += '<a class="card-link" target="_blank" rel="external noopener noreferrer"';
|
54
|
-
user += ' href="' + item.html_url + '">';
|
55
|
-
user += '<img alt="' + item.login + '" src="' + (item.avatar_url || cfg.avatar) + '" onerror="errorImgAvatar(this)">';
|
56
|
-
user += '<div class="name"><span>' + item.login + '</span></div>';
|
57
|
-
user += '</a>';
|
58
|
-
user += '</div>';
|
59
|
-
cellALL += user;
|
60
|
-
});
|
61
|
-
el.querySelector('.group-body').innerHTML = cellALL;
|
62
|
-
}, function () {
|
63
|
-
try {
|
64
|
-
el.querySelector('.loading-wrap svg').remove();
|
65
|
-
el.querySelector('.loading-wrap p').innerText('加载失败,请稍后重试。');
|
66
|
-
} catch (e) { }
|
67
|
-
});
|
68
|
-
},
|
69
|
-
start: () => {
|
70
|
-
const els = document.getElementsByClassName('contributorsjs-wrap');
|
71
|
-
for (var i = 0; i < els.length; i++) {
|
72
|
-
const el = els[i];
|
73
|
-
const api = el.getAttribute('api');
|
74
|
-
if (api == null) {
|
75
|
-
continue;
|
76
|
-
}
|
77
|
-
var cfg = new Object();
|
78
|
-
cfg.el = el;
|
79
|
-
cfg.api = api;
|
80
|
-
cfg.class = el.getAttribute('class');
|
81
|
-
cfg.avatar = volantis.GLOBAL_CONFIG.default.avatar;
|
82
|
-
ContributorsJS.layout(cfg);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
ContributorsJS.start();
|
90
|
-
document.addEventListener('pjax:complete', function () {
|
91
|
-
ContributorsJS.start();
|
92
|
-
});
|
1
|
+
const ContributorsJS={requestAPI:(t,r,e)=>{let n=5;!function o(){return new Promise(((a,s)=>{let l=0,i=setTimeout((()=>{0===l&&(l=2,i=null,s("请求超时"),0==n&&e())}),5e3);fetch(t).then((function(t){if(2!==l&&(clearTimeout(i),a(t),i=null,l=1),t.ok)return t.json();throw new Error("Network response was not ok.")})).then((function(t){n=0,r(t)})).catch((function(t){n>0?(n-=1,setTimeout((()=>{o()}),5e3)):e()}))}))}()},layout:t=>{const r=t.el;ContributorsJS.requestAPI(t.api,(function(e){r.querySelector(".loading-wrap").remove();var n="";(e||[]).forEach(((r,e)=>{var o='<div class="user-card">';o+='<a class="card-link" target="_blank" rel="external noopener noreferrer"',o+=' href="'+r.html_url+'">',o+='<img alt="'+r.login+'" src="'+(r.avatar_url||t.avatar)+'" onerror="errorImgAvatar(this)">',o+='<div class="name"><span>'+r.login+"</span></div>",o+="</a>",n+=o+="</div>"})),r.querySelector(".group-body").innerHTML=n}),(function(){try{r.querySelector(".loading-wrap svg").remove(),r.querySelector(".loading-wrap p").innerText("加载失败,请稍后重试。")}catch(t){}}))},start:()=>{const t=document.getElementsByClassName("contributorsjs-wrap");for(var r=0;r<t.length;r++){const n=t[r],o=n.getAttribute("api");if(null!=o){var e=new Object;e.el=n,e.api=o,e.class=n.getAttribute("class"),e.avatar=volantis.GLOBAL_CONFIG.default.avatar,ContributorsJS.layout(e)}}}};ContributorsJS.start(),document.addEventListener("pjax:complete",(function(){ContributorsJS.start()}));
|
2
|
+
//# sourceMappingURL=../../../maps/js/plugins/tags/contributors.js.map
|
@@ -1,93 +1,2 @@
|
|
1
|
-
const FriendsJS = {
|
2
|
-
|
3
|
-
let retryTimes = 5;
|
4
|
-
|
5
|
-
function request() {
|
6
|
-
return new Promise((resolve, reject) => {
|
7
|
-
let status = 0; // 0 等待 1 完成 2 超时
|
8
|
-
let timer = setTimeout(() => {
|
9
|
-
if (status === 0) {
|
10
|
-
status = 2;
|
11
|
-
timer = null;
|
12
|
-
reject('请求超时');
|
13
|
-
if (retryTimes == 0) {
|
14
|
-
timeout();
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}, 5000);
|
18
|
-
fetch(url).then(function (response) {
|
19
|
-
if (status !== 2) {
|
20
|
-
clearTimeout(timer);
|
21
|
-
resolve(response);
|
22
|
-
timer = null;
|
23
|
-
status = 1;
|
24
|
-
}
|
25
|
-
if (response.ok) {
|
26
|
-
return response.json();
|
27
|
-
}
|
28
|
-
throw new Error('Network response was not ok.');
|
29
|
-
}).then(function (data) {
|
30
|
-
retryTimes = 0;
|
31
|
-
callback(data);
|
32
|
-
}).catch(function (error) {
|
33
|
-
if (retryTimes > 0) {
|
34
|
-
retryTimes -= 1;
|
35
|
-
setTimeout(() => {
|
36
|
-
request();
|
37
|
-
}, 5000);
|
38
|
-
} else {
|
39
|
-
timeout();
|
40
|
-
}
|
41
|
-
});
|
42
|
-
});
|
43
|
-
}
|
44
|
-
request();
|
45
|
-
},
|
46
|
-
layout: (cfg) => {
|
47
|
-
const el = cfg.el;
|
48
|
-
FriendsJS.requestAPI(cfg.api, function (data) {
|
49
|
-
el.querySelector('.loading-wrap').remove();
|
50
|
-
const arr = data.content;
|
51
|
-
var cellALL = "";
|
52
|
-
arr.forEach((item, i) => {
|
53
|
-
var user = '<div class="user-card">';
|
54
|
-
user += '<a class="card-link" target="_blank" rel="external noopener noreferrer"';
|
55
|
-
user += ' href="' + item.url + '">';
|
56
|
-
user += '<img alt="' + item.title + '" src="' + (item.avatar || cfg.avatar) + '" onerror="errorImgAvatar(this)">';
|
57
|
-
user += '<div class="name"><span>' + item.title + '</span></div>';
|
58
|
-
user += '</a>';
|
59
|
-
user += '</div>';
|
60
|
-
cellALL += user;
|
61
|
-
});
|
62
|
-
el.querySelector('.group-body').innerHTML = cellALL;
|
63
|
-
}, function () {
|
64
|
-
try {
|
65
|
-
el.querySelector('.loading-wrap svg').remove();
|
66
|
-
el.querySelector('.loading-wrap p').innerText('加载失败,请稍后重试。');
|
67
|
-
} catch (e) { }
|
68
|
-
});
|
69
|
-
},
|
70
|
-
start: () => {
|
71
|
-
const els = document.getElementsByClassName('friendsjs-wrap');
|
72
|
-
for (var i = 0; i < els.length; i++) {
|
73
|
-
const el = els[i];
|
74
|
-
const api = el.getAttribute('api');
|
75
|
-
if (api == null) {
|
76
|
-
continue;
|
77
|
-
}
|
78
|
-
var cfg = new Object();
|
79
|
-
cfg.el = el;
|
80
|
-
cfg.api = api;
|
81
|
-
cfg.class = el.getAttribute('class');
|
82
|
-
cfg.avatar = volantis.GLOBAL_CONFIG.default.avatar;
|
83
|
-
FriendsJS.layout(cfg);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
FriendsJS.start();
|
91
|
-
document.addEventListener('pjax:complete', function () {
|
92
|
-
FriendsJS.start();
|
93
|
-
});
|
1
|
+
const FriendsJS={requestAPI:(e,t,r)=>{let n=5;!function a(){return new Promise(((o,s)=>{let i=0,l=setTimeout((()=>{0===i&&(i=2,l=null,s("请求超时"),0==n&&r())}),5e3);fetch(e).then((function(e){if(2!==i&&(clearTimeout(l),o(e),l=null,i=1),e.ok)return e.json();throw new Error("Network response was not ok.")})).then((function(e){n=0,t(e)})).catch((function(e){n>0?(n-=1,setTimeout((()=>{a()}),5e3)):r()}))}))}()},layout:e=>{const t=e.el;FriendsJS.requestAPI(e.api,(function(r){t.querySelector(".loading-wrap").remove();const n=r.content;var a="";n.forEach(((t,r)=>{var n='<div class="user-card">';n+='<a class="card-link" target="_blank" rel="external noopener noreferrer"',n+=' href="'+t.url+'">',n+='<img alt="'+t.title+'" src="'+(t.avatar||e.avatar)+'" onerror="errorImgAvatar(this)">',n+='<div class="name"><span>'+t.title+"</span></div>",n+="</a>",a+=n+="</div>"})),t.querySelector(".group-body").innerHTML=a}),(function(){try{t.querySelector(".loading-wrap svg").remove(),t.querySelector(".loading-wrap p").innerText("加载失败,请稍后重试。")}catch(e){}}))},start:()=>{const e=document.getElementsByClassName("friendsjs-wrap");for(var t=0;t<e.length;t++){const n=e[t],a=n.getAttribute("api");if(null!=a){var r=new Object;r.el=n,r.api=a,r.class=n.getAttribute("class"),r.avatar=volantis.GLOBAL_CONFIG.default.avatar,FriendsJS.layout(r)}}}};FriendsJS.start(),document.addEventListener("pjax:complete",(function(){FriendsJS.start()}));
|
2
|
+
//# sourceMappingURL=../../../maps/js/plugins/tags/friends.js.map
|
package/js/plugins/tags/sites.js
CHANGED
@@ -1,96 +1,2 @@
|
|
1
|
-
const SitesJS = {
|
2
|
-
|
3
|
-
let retryTimes = 5;
|
4
|
-
|
5
|
-
function request() {
|
6
|
-
return new Promise((resolve, reject) => {
|
7
|
-
let status = 0; // 0 等待 1 完成 2 超时
|
8
|
-
let timer = setTimeout(() => {
|
9
|
-
if (status === 0) {
|
10
|
-
status = 2;
|
11
|
-
timer = null;
|
12
|
-
reject('请求超时');
|
13
|
-
if (retryTimes == 0) {
|
14
|
-
timeout();
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}, 5000);
|
18
|
-
fetch(url).then(function (response) {
|
19
|
-
if (status !== 2) {
|
20
|
-
clearTimeout(timer);
|
21
|
-
resolve(response);
|
22
|
-
timer = null;
|
23
|
-
status = 1;
|
24
|
-
}
|
25
|
-
if (response.ok) {
|
26
|
-
return response.json();
|
27
|
-
}
|
28
|
-
throw new Error('Network response was not ok.');
|
29
|
-
}).then(function (data) {
|
30
|
-
retryTimes = 0;
|
31
|
-
callback(data);
|
32
|
-
}).catch(function (error) {
|
33
|
-
if (retryTimes > 0) {
|
34
|
-
retryTimes -= 1;
|
35
|
-
setTimeout(() => {
|
36
|
-
request();
|
37
|
-
}, 5000);
|
38
|
-
} else {
|
39
|
-
timeout();
|
40
|
-
}
|
41
|
-
});
|
42
|
-
});
|
43
|
-
}
|
44
|
-
request();
|
45
|
-
},
|
46
|
-
layout: (cfg) => {
|
47
|
-
const el = cfg.el;
|
48
|
-
SitesJS.requestAPI(cfg.api, function (data) {
|
49
|
-
el.querySelector('.loading-wrap').remove();
|
50
|
-
const arr = data.content;
|
51
|
-
var cellALL = "";
|
52
|
-
arr.forEach((item, i) => {
|
53
|
-
var cell = '<div class="site-card">';
|
54
|
-
cell += '<a class="card-link" target="_blank" rel="external noopener noreferrer" href="' + item.url + '">';
|
55
|
-
cell += '<img alt="' + item.title + '" src="' + (item.screenshot || ('https://image.thum.io/get/width/1024/crop/768/' + item.url)) + '" onerror="errorImgCover(this)"/>';
|
56
|
-
cell += '<div class="info">';
|
57
|
-
cell += '<img alt="' + item.title + '" src="' + (item.avatar || cfg.avatar) + '" onerror="errorImgAvatar(this)"/>';
|
58
|
-
cell += '<span class="title">' + item.title + '</span>';
|
59
|
-
cell += '<span class="desc">' + (item.description || item.url) + '</span>';
|
60
|
-
cell += '</div>';
|
61
|
-
cell += '</a>';
|
62
|
-
cell += '</div>';
|
63
|
-
cellALL += cell;
|
64
|
-
});
|
65
|
-
el.querySelector('.group-body').innerHTML = cellALL;
|
66
|
-
}, function () {
|
67
|
-
try {
|
68
|
-
el.querySelector('.loading-wrap svg').remove();
|
69
|
-
el.querySelector('.loading-wrap p').innerText('加载失败,请稍后重试。');
|
70
|
-
} catch (e) { }
|
71
|
-
});
|
72
|
-
},
|
73
|
-
start: (cfg) => {
|
74
|
-
const els = document.getElementsByClassName('sitesjs-wrap');
|
75
|
-
for (var i = 0; i < els.length; i++) {
|
76
|
-
const el = els[i];
|
77
|
-
const api = el.getAttribute('api');
|
78
|
-
if (api == null) {
|
79
|
-
continue;
|
80
|
-
}
|
81
|
-
var cfg = new Object();
|
82
|
-
cfg.class = el.getAttribute('class');
|
83
|
-
cfg.el = el;
|
84
|
-
cfg.api = api;
|
85
|
-
cfg.avatar = volantis.GLOBAL_CONFIG.default.link;
|
86
|
-
cfg.screenshot = volantis.GLOBAL_CONFIG.default.cover;
|
87
|
-
SitesJS.layout(cfg);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
|
93
|
-
SitesJS.start();
|
94
|
-
document.addEventListener('pjax:complete', function () {
|
95
|
-
SitesJS.start();
|
96
|
-
});
|
1
|
+
const SitesJS={requestAPI:(e,t,r)=>{let n=5;!function a(){return new Promise(((o,s)=>{let i=0,l=setTimeout((()=>{0===i&&(i=2,l=null,s("请求超时"),0==n&&r())}),5e3);fetch(e).then((function(e){if(2!==i&&(clearTimeout(l),o(e),l=null,i=1),e.ok)return e.json();throw new Error("Network response was not ok.")})).then((function(e){n=0,t(e)})).catch((function(e){n>0?(n-=1,setTimeout((()=>{a()}),5e3)):r()}))}))}()},layout:e=>{const t=e.el;SitesJS.requestAPI(e.api,(function(r){t.querySelector(".loading-wrap").remove();const n=r.content;var a="";n.forEach(((t,r)=>{var n='<div class="site-card">';n+='<a class="card-link" target="_blank" rel="external noopener noreferrer" href="'+t.url+'">',n+='<img alt="'+t.title+'" src="'+(t.screenshot||"https://image.thum.io/get/width/1024/crop/768/"+t.url)+'" onerror="errorImgCover(this)"/>',n+='<div class="info">',n+='<img alt="'+t.title+'" src="'+(t.avatar||e.avatar)+'" onerror="errorImgAvatar(this)"/>',n+='<span class="title">'+t.title+"</span>",n+='<span class="desc">'+(t.description||t.url)+"</span>",n+="</div>",n+="</a>",a+=n+="</div>"})),t.querySelector(".group-body").innerHTML=a}),(function(){try{t.querySelector(".loading-wrap svg").remove(),t.querySelector(".loading-wrap p").innerText("加载失败,请稍后重试。")}catch(e){}}))},start:e=>{const t=document.getElementsByClassName("sitesjs-wrap");for(var r=0;r<t.length;r++){const n=t[r],a=n.getAttribute("api");if(null!=a)(e=new Object).class=n.getAttribute("class"),e.el=n,e.api=a,e.avatar=volantis.GLOBAL_CONFIG.default.link,e.screenshot=volantis.GLOBAL_CONFIG.default.cover,SitesJS.layout(e)}}};SitesJS.start(),document.addEventListener("pjax:complete",(function(){SitesJS.start()}));
|
2
|
+
//# sourceMappingURL=../../../maps/js/plugins/tags/sites.js.map
|
package/js/search/algolia.js
CHANGED
@@ -1,239 +1,2 @@
|
|
1
|
-
let SearchService = (() => {
|
2
|
-
|
3
|
-
let search, algolia, timerId;
|
4
|
-
fn.queryText = null;
|
5
|
-
fn.template = `<div id="u-search">
|
6
|
-
<div class="modal">
|
7
|
-
<header class="modal-header" class="clearfix">
|
8
|
-
<button type="submit" id="u-search-modal-btn-submit" class="u-search-btn-submit">
|
9
|
-
<span class="fa-solid fa-search"></span>
|
10
|
-
</button>
|
11
|
-
<div id="algolia-search-input"></div>
|
12
|
-
<a id="u-search-btn-close" class="btn-close"> <span class="fa-solid fa-times"></span> </a>
|
13
|
-
</header>
|
14
|
-
<main class="modal-body">
|
15
|
-
<div id="algolia-search-results">
|
16
|
-
<div id="algolia-hits">
|
17
|
-
<div class="search-icon"><i class="fa-sharp fa-solid fa-telescope"></i></i></div>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
</main>
|
21
|
-
<footer>
|
22
|
-
<div id="algolia-pagination"></div>
|
23
|
-
<hr>
|
24
|
-
<div id="algolia-info">
|
25
|
-
<div class="algolia-stats"></div>
|
26
|
-
<div class="algolia-poweredBy"></div>
|
27
|
-
</div>
|
28
|
-
</footer>
|
29
|
-
</div>
|
30
|
-
<div id="modal-overlay" class="modal-overlay"></div>
|
31
|
-
</div>
|
32
|
-
`;
|
33
|
-
|
34
|
-
fn.init = () => {
|
35
|
-
let div = document.createElement("div");
|
36
|
-
div.innerHTML += fn.template;
|
37
|
-
document.body.append(div);
|
38
|
-
|
39
|
-
algolia = volantis.GLOBAL_CONFIG.search;
|
40
|
-
if (algolia.appId && algolia.apiKey && algolia.indexName) {
|
41
|
-
fn.event();
|
42
|
-
fn.setAlgolia();
|
43
|
-
} else {
|
44
|
-
document.querySelector('#u-search main.modal-body').innerHTML = 'Algolia setting is invalid!';
|
45
|
-
document.querySelector('#u-search main.modal-body').style.textAlign = 'center';
|
46
|
-
document.querySelector('#u-search .modal').style.maxHeight = '128px';
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
fn.event = () => {
|
51
|
-
document
|
52
|
-
.querySelector("#u-search-btn-close")
|
53
|
-
.addEventListener("click", fn.close, false);
|
54
|
-
document
|
55
|
-
.querySelector("#modal-overlay")
|
56
|
-
.addEventListener("click", fn.close, false);
|
57
|
-
document.querySelectorAll(".u-search-form").forEach((e) => {
|
58
|
-
e.addEventListener("submit", fn.onSubmit, false);
|
59
|
-
});
|
60
|
-
document.querySelector("#algolia-search-input").addEventListener("input", event => {
|
61
|
-
let input = event.target.querySelector(".ais-SearchBox-input");
|
62
|
-
if (input) {
|
63
|
-
fn.queryText = input.value;
|
64
|
-
} else {
|
65
|
-
fn.queryText = event.target.value;
|
66
|
-
}
|
67
|
-
})
|
68
|
-
}
|
69
|
-
|
70
|
-
fn.setAlgolia = () => {
|
71
|
-
search = instantsearch({
|
72
|
-
indexName: algolia.indexName,
|
73
|
-
searchClient: algoliasearch(algolia.appId, algolia.apiKey),
|
74
|
-
searchFunction(helper) {
|
75
|
-
helper.state.query && helper.search()
|
76
|
-
},
|
77
|
-
})
|
78
|
-
|
79
|
-
const configure = instantsearch.widgets.configure({
|
80
|
-
hitsPerPage: algolia.hitsPerPage
|
81
|
-
})
|
82
|
-
|
83
|
-
const searchBox = instantsearch.widgets.searchBox({
|
84
|
-
container: '#algolia-search-input',
|
85
|
-
autofocus: true,
|
86
|
-
showReset: false,
|
87
|
-
showSubmit: false,
|
88
|
-
showLoadingIndicator: false,
|
89
|
-
searchAsYouType: algolia.searchAsYouType,
|
90
|
-
placeholder: algolia.placeholder,
|
91
|
-
templates: {
|
92
|
-
input: 'algolia-input'
|
93
|
-
},
|
94
|
-
queryHook(query, refine) {
|
95
|
-
clearTimeout(timerId)
|
96
|
-
timerId = setTimeout(() => refine(query), 500)
|
97
|
-
}
|
98
|
-
})
|
99
|
-
|
100
|
-
const hits = instantsearch.widgets.hits({
|
101
|
-
container: '#algolia-hits',
|
102
|
-
templates: {
|
103
|
-
item(data) {
|
104
|
-
const keyword = !!fn.queryText ? `?keyword=${fn.queryText}` : ''
|
105
|
-
const link = data.permalink ? data.permalink : `${volantis.GLOBAL_CONFIG.root}${data.path}`
|
106
|
-
const result = data._highlightResult
|
107
|
-
const content = result.contentStripTruncate
|
108
|
-
? fn.cutContent(result.contentStripTruncate.value)
|
109
|
-
: result.contentStrip
|
110
|
-
? fn.cutContent(result.contentStrip.value)
|
111
|
-
: result.content
|
112
|
-
? fn.cutContent(result.content.value)
|
113
|
-
: ''
|
114
|
-
return `
|
115
|
-
<a href="${link}${keyword}" class="result">
|
116
|
-
<span class="title">${result.title.value || 'no-title'}</span>
|
117
|
-
<span class="digest">${content}</span>
|
118
|
-
</a>`
|
119
|
-
},
|
120
|
-
empty: function (data) {
|
121
|
-
return (
|
122
|
-
`<div id="resule-hits-empty"><i class="fa-solid fa-box-open"></i><p>${volantis.GLOBAL_CONFIG.languages.search.hits_empty.replace(/\$\{query}/, data.query)}</p></div>`
|
123
|
-
)
|
124
|
-
}
|
125
|
-
}
|
126
|
-
})
|
127
|
-
|
128
|
-
const stats = instantsearch.widgets.stats({
|
129
|
-
container: '#algolia-info > .algolia-stats',
|
130
|
-
templates: {
|
131
|
-
text: function (data) {
|
132
|
-
const stats = volantis.GLOBAL_CONFIG.languages.search.hits_stats
|
133
|
-
.replace(/\$\{hits}/, data.nbHits)
|
134
|
-
.replace(/\$\{time}/, data.processingTimeMS)
|
135
|
-
return (
|
136
|
-
`${stats}`
|
137
|
-
)
|
138
|
-
}
|
139
|
-
}
|
140
|
-
})
|
141
|
-
|
142
|
-
const powerBy = instantsearch.widgets.poweredBy({
|
143
|
-
container: '#algolia-info > .algolia-poweredBy',
|
144
|
-
theme: volantis.dark?.mode === 'dark' ? 'dark' : 'light'
|
145
|
-
})
|
146
|
-
|
147
|
-
const pagination = instantsearch.widgets.pagination({
|
148
|
-
container: '#algolia-pagination',
|
149
|
-
totalPages: 5,
|
150
|
-
templates: {
|
151
|
-
first: '<i class="fas fa-angle-double-left"></i>',
|
152
|
-
last: '<i class="fas fa-angle-double-right"></i>',
|
153
|
-
previous: '<i class="fas fa-angle-left"></i>',
|
154
|
-
next: '<i class="fas fa-angle-right"></i>'
|
155
|
-
}
|
156
|
-
})
|
157
|
-
|
158
|
-
search.addWidgets([configure, searchBox, hits, stats, powerBy, pagination])
|
159
|
-
|
160
|
-
search.start()
|
161
|
-
|
162
|
-
window.pjax && search.on('render', () => {
|
163
|
-
window.pjax.refresh(document.getElementById('algolia-hits'))
|
164
|
-
})
|
165
|
-
}
|
166
|
-
|
167
|
-
fn.setQueryText = queryText => {
|
168
|
-
fn.queryText = queryText;
|
169
|
-
if (!search) {
|
170
|
-
fn.init()
|
171
|
-
}
|
172
|
-
search?.setUiState({
|
173
|
-
[algolia.indexName]: {
|
174
|
-
query: queryText
|
175
|
-
}
|
176
|
-
})
|
177
|
-
}
|
178
|
-
|
179
|
-
fn.search = () => {
|
180
|
-
document.querySelector("#u-search").style.display = "block";
|
181
|
-
document.addEventListener("keydown", event => {
|
182
|
-
if (event.code === "Escape") {
|
183
|
-
fn.close();
|
184
|
-
}
|
185
|
-
}, { once: true })
|
186
|
-
}
|
187
|
-
|
188
|
-
fn.onSubmit = (event) => {
|
189
|
-
event.preventDefault();
|
190
|
-
let input = event.target.querySelector(".u-search-input");
|
191
|
-
fn.setQueryText(input?.value ? input.value : event.target.value)
|
192
|
-
fn.search();
|
193
|
-
};
|
194
|
-
|
195
|
-
fn.cutContent = content => {
|
196
|
-
if (content === '') return ''
|
197
|
-
|
198
|
-
const firstOccur = content.indexOf('<mark>')
|
199
|
-
|
200
|
-
let start = firstOccur - 30
|
201
|
-
let end = firstOccur + 120
|
202
|
-
let pre = ''
|
203
|
-
let post = ''
|
204
|
-
|
205
|
-
if (start <= 0) {
|
206
|
-
start = 0
|
207
|
-
end = 140
|
208
|
-
} else {
|
209
|
-
pre = '...'
|
210
|
-
}
|
211
|
-
|
212
|
-
if (end > content.length) {
|
213
|
-
end = content.length
|
214
|
-
} else {
|
215
|
-
post = '...'
|
216
|
-
}
|
217
|
-
|
218
|
-
let matchContent = pre + content.substring(start, end) + post
|
219
|
-
return matchContent
|
220
|
-
}
|
221
|
-
|
222
|
-
fn.close = () => {
|
223
|
-
document.querySelector("#u-search").style.display = "none";
|
224
|
-
};
|
225
|
-
|
226
|
-
return {
|
227
|
-
init: fn.init,
|
228
|
-
setQueryText: queryText => {
|
229
|
-
fn.setQueryText(queryText);
|
230
|
-
},
|
231
|
-
search: fn.search,
|
232
|
-
close: fn.close
|
233
|
-
}
|
234
|
-
})()
|
235
|
-
|
236
|
-
Object.freeze(SearchService);
|
237
|
-
|
238
|
-
SearchService.init();
|
239
|
-
document.addEventListener("pjax:send", SearchService.close);
|
1
|
+
let SearchService=(()=>{const e={};let t,a,n;return e.queryText=null,e.template='<div id="u-search">\n <div class="modal">\n <header class="modal-header" class="clearfix">\n <button type="submit" id="u-search-modal-btn-submit" class="u-search-btn-submit">\n <span class="fa-solid fa-search"></span>\n </button>\n <div id="algolia-search-input"></div>\n <a id="u-search-btn-close" class="btn-close"> <span class="fa-solid fa-times"></span> </a>\n </header>\n <main class="modal-body">\n <div id="algolia-search-results">\n <div id="algolia-hits">\n <div class="search-icon"><i class="fa-sharp fa-solid fa-telescope"></i></i></div>\n </div>\n </div>\n </main>\n <footer>\n <div id="algolia-pagination"></div>\n <hr>\n <div id="algolia-info">\n <div class="algolia-stats"></div>\n <div class="algolia-poweredBy"></div>\n </div>\n </footer>\n </div>\n <div id="modal-overlay" class="modal-overlay"></div>\n </div>\n ',e.init=()=>{let t=document.createElement("div");t.innerHTML+=e.template,document.body.append(t),a=volantis.GLOBAL_CONFIG.search,a.appId&&a.apiKey&&a.indexName?(e.event(),e.setAlgolia()):(document.querySelector("#u-search main.modal-body").innerHTML="Algolia setting is invalid!",document.querySelector("#u-search main.modal-body").style.textAlign="center",document.querySelector("#u-search .modal").style.maxHeight="128px")},e.event=()=>{document.querySelector("#u-search-btn-close").addEventListener("click",e.close,!1),document.querySelector("#modal-overlay").addEventListener("click",e.close,!1),document.querySelectorAll(".u-search-form").forEach((t=>{t.addEventListener("submit",e.onSubmit,!1)})),document.querySelector("#algolia-search-input").addEventListener("input",(t=>{let a=t.target.querySelector(".ais-SearchBox-input");e.queryText=a?a.value:t.target.value}))},e.setAlgolia=()=>{t=instantsearch({indexName:a.indexName,searchClient:algoliasearch(a.appId,a.apiKey),searchFunction(e){e.state.query&&e.search()}});const i=instantsearch.widgets.configure({hitsPerPage:a.hitsPerPage}),s=instantsearch.widgets.searchBox({container:"#algolia-search-input",autofocus:!0,showReset:!1,showSubmit:!1,showLoadingIndicator:!1,searchAsYouType:a.searchAsYouType,placeholder:a.placeholder,templates:{input:"algolia-input"},queryHook(e,t){clearTimeout(n),n=setTimeout((()=>t(e)),500)}}),l=instantsearch.widgets.hits({container:"#algolia-hits",templates:{item(t){const a=e.queryText?`?keyword=${e.queryText}`:"",n=t.permalink?t.permalink:`${volantis.GLOBAL_CONFIG.root}${t.path}`,i=t._highlightResult,s=i.contentStripTruncate?e.cutContent(i.contentStripTruncate.value):i.contentStrip?e.cutContent(i.contentStrip.value):i.content?e.cutContent(i.content.value):"";return`\n <a href="${n}${a}" class="result">\n <span class="title">${i.title.value||"no-title"}</span>\n <span class="digest">${s}</span>\n </a>`},empty:function(e){return`<div id="resule-hits-empty"><i class="fa-solid fa-box-open"></i><p>${volantis.GLOBAL_CONFIG.languages.search.hits_empty.replace(/\$\{query}/,e.query)}</p></div>`}}}),r=instantsearch.widgets.stats({container:"#algolia-info > .algolia-stats",templates:{text:function(e){return`${volantis.GLOBAL_CONFIG.languages.search.hits_stats.replace(/\$\{hits}/,e.nbHits).replace(/\$\{time}/,e.processingTimeMS)}`}}}),o=instantsearch.widgets.poweredBy({container:"#algolia-info > .algolia-poweredBy",theme:"dark"===volantis.dark?.mode?"dark":"light"}),c=instantsearch.widgets.pagination({container:"#algolia-pagination",totalPages:5,templates:{first:'<i class="fas fa-angle-double-left"></i>',last:'<i class="fas fa-angle-double-right"></i>',previous:'<i class="fas fa-angle-left"></i>',next:'<i class="fas fa-angle-right"></i>'}});t.addWidgets([i,s,l,r,o,c]),t.start(),window.pjax&&t.on("render",(()=>{window.pjax.refresh(document.getElementById("algolia-hits"))}))},e.setQueryText=n=>{e.queryText=n,t||e.init(),t?.setUiState({[a.indexName]:{query:n}})},e.search=()=>{document.querySelector("#u-search").style.display="block",document.addEventListener("keydown",(t=>{"Escape"===t.code&&e.close()}),{once:!0})},e.onSubmit=t=>{t.preventDefault();let a=t.target.querySelector(".u-search-input");e.setQueryText(a?.value?a.value:t.target.value),e.search()},e.cutContent=e=>{if(""===e)return"";const t=e.indexOf("<mark>");let a=t-30,n=t+120,i="",s="";return a<=0?(a=0,n=140):i="...",n>e.length?n=e.length:s="...",i+e.substring(a,n)+s},e.close=()=>{document.querySelector("#u-search").style.display="none"},{init:e.init,setQueryText:t=>{e.setQueryText(t)},search:e.search,close:e.close}})();Object.freeze(SearchService),SearchService.init(),document.addEventListener("pjax:send",SearchService.close);
|
2
|
+
//# sourceMappingURL=../../maps/js/search/algolia.js.map
|