sinzmise-cetastories 2.0.0-1731066602594 → 2.0.0-1731114112124

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. package/404/index.html +4033 -1
  2. package/about/index.html +4041 -1
  3. package/album/index.html +4050 -1
  4. package/archives/2021/12/index.html +3917 -1
  5. package/archives/2021/index.html +3917 -1
  6. package/archives/2022/12/index.html +3917 -1
  7. package/archives/2022/index.html +3917 -1
  8. package/archives/2023/01/index.html +4072 -1
  9. package/archives/2023/02/index.html +3917 -1
  10. package/archives/2023/03/index.html +4063 -1
  11. package/archives/2023/04/index.html +3992 -1
  12. package/archives/2023/07/index.html +4217 -1
  13. package/archives/2023/08/index.html +4067 -1
  14. package/archives/2023/09/index.html +3917 -1
  15. package/archives/2023/10/index.html +3917 -1
  16. package/archives/2023/11/index.html +3917 -1
  17. package/archives/2023/12/index.html +3918 -1
  18. package/archives/2023/index.html +4591 -1
  19. package/archives/2023/page/2/index.html +4572 -1
  20. package/archives/2023/page/3/index.html +3930 -1
  21. package/archives/2024/01/index.html +4142 -1
  22. package/archives/2024/02/index.html +3922 -1
  23. package/archives/2024/03/index.html +3916 -1
  24. package/archives/2024/04/index.html +3997 -1
  25. package/archives/2024/05/index.html +4065 -1
  26. package/archives/2024/06/index.html +3917 -1
  27. package/archives/2024/07/index.html +3917 -1
  28. package/archives/2024/08/index.html +3992 -1
  29. package/archives/2024/09/index.html +3917 -1
  30. package/archives/2024/10/index.html +3984 -1
  31. package/archives/2024/index.html +4576 -1
  32. package/archives/2024/page/2/index.html +4433 -1
  33. package/archives/index.html +4560 -1
  34. package/archives/page/2/index.html +4560 -1
  35. package/archives/page/3/index.html +4560 -1
  36. package/archives/page/4/index.html +4560 -1
  37. package/archives/page/5/index.html +4560 -1
  38. package/assets/algolia/algoliasearch.js +7182 -3
  39. package/assets/algolia/algoliasearchLite.js +4445 -3
  40. package/atom.xml +31 -31
  41. package/bbs/bbs.html +4012 -1
  42. package/bbs/bbs.js +12 -2
  43. package/bbs/index.html +4031 -1
  44. package/categories/index.html +4050 -1
  45. package/categories//344/270/252/344/272/272/345/260/217/350/256/260/index.html +4570 -1
  46. package/categories//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +4485 -1
  47. package/categories//346/255/214/346/233/262/346/224/266/351/233/206/index.html +3920 -1
  48. package/categories//346/270/270/346/210/217/347/233/270/345/205/263/index.html +4148 -1
  49. package/categories//347/253/231/347/202/271/346/212/230/350/205/276/index.html +4610 -1
  50. package/categories//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +4148 -1
  51. package/categories//351/241/271/347/233/256/346/212/230/350/205/276/index.html +4072 -1
  52. package/charts/index.html +4039 -1
  53. package/comments/index.html +4052 -1
  54. package/content.json +1 -0
  55. package/css/custom2.css +3 -2
  56. package/css/first.css +1868 -2
  57. package/css/pace/big-counter.css +39 -2
  58. package/css/pace/corner-indicator.css +72 -2
  59. package/css/pace/flash.css +76 -2
  60. package/css/pace/mac-osx.css +86 -2
  61. package/css/pace/pace.css +50 -2
  62. package/css/plane.css +59 -2
  63. package/css/style.css +8585 -2
  64. package/css/tags.css +3516 -2
  65. package/essay/index.html +4050 -1
  66. package/fcircle/index.html +4075 -1
  67. package/games +61 -19
  68. package/index.html +4717 -1
  69. package/js/app.js +1341 -2
  70. package/js/autoload.js +62 -2
  71. package/js/ceta/fancybox.css +2 -2
  72. package/js/ceta/fancybox.umd.js +2 -2
  73. package/js/ceta/iconfontInkss.js +1 -2
  74. package/js/ceta/message.css +6 -2
  75. package/js/ceta/message.js +6 -2
  76. package/js/clock.js +1 -2
  77. package/js/kslink.js +38 -2
  78. package/js/newyear.js +76 -2
  79. package/js/plane.js +2200 -2
  80. package/js/plugins/aplayer.js +186 -2
  81. package/js/plugins/parallax.js +191 -2
  82. package/js/plugins/rightMenus.js +623 -2
  83. package/js/plugins/tags/contributors.js +92 -2
  84. package/js/plugins/tags/friends.js +93 -2
  85. package/js/plugins/tags/sites.js +96 -2
  86. package/js/search/algolia.js +239 -2
  87. package/js/search/hexo.js +195 -2
  88. package/js/search/meilisearch.js +220 -2
  89. package/js/txmap.js +248 -2
  90. package/link/index.html +6180 -1
  91. package/load.html +294 -1
  92. package/music/index.html +4033 -1
  93. package/package.json +1 -1
  94. package/page/2/index.html +4578 -1
  95. package/page/3/index.html +4575 -1
  96. package/page/4/index.html +4572 -1
  97. package/page/5/index.html +3924 -1
  98. package/posts/10021/index.html +4130 -5
  99. package/posts/10045/index.html +4224 -1
  100. package/posts/10733/index.html +4125 -1
  101. package/posts/10996/index.html +4127 -5
  102. package/posts/12779/index.html +4134 -1
  103. package/posts/13624/index.html +4179 -1
  104. package/posts/15688/index.html +4133 -1
  105. package/posts/15748/index.html +4121 -5
  106. package/posts/15799/index.html +4130 -1
  107. package/posts/15842/index.html +4121 -5
  108. package/posts/16107/index.html +4111 -1
  109. package/posts/18063/index.html +4124 -1
  110. package/posts/20412/index.html +4134 -1
  111. package/posts/21375/index.html +4124 -1
  112. package/posts/22945/index.html +4169 -4
  113. package/posts/23021/index.html +4104 -1
  114. package/posts/27531/index.html +4121 -5
  115. package/posts/28536/index.html +4116 -1
  116. package/posts/28733/index.html +4168 -1
  117. package/posts/29196/index.html +4106 -1
  118. package/posts/38917/index.html +4144 -1
  119. package/posts/38964/index.html +4208 -1
  120. package/posts/42487/index.html +4135 -1
  121. package/posts/42580/index.html +4128 -1
  122. package/posts/45875/index.html +4118 -1
  123. package/posts/46640/index.html +4147 -1
  124. package/posts/48762/index.html +4109 -1
  125. package/posts/50710/index.html +4114 -1
  126. package/posts/52677/index.html +4125 -1
  127. package/posts/53662/index.html +4123 -1
  128. package/posts/54386/index.html +4116 -1
  129. package/posts/54481/index.html +4133 -1
  130. package/posts/54787/index.html +4124 -5
  131. package/posts/56467/index.html +4121 -1
  132. package/posts/57692/index.html +4143 -1
  133. package/posts/58203/index.html +4116 -1
  134. package/posts/61417/index.html +4117 -1
  135. package/posts/61712/index.html +4113 -1
  136. package/posts/646/index.html +4106 -1
  137. package/posts/64856/index.html +4120 -1
  138. package/posts/64935/index.html +4120 -1
  139. package/search.xml +78 -78
  140. package/seas/index.html +4050 -1
  141. package/sw.js +798 -2
  142. package/tags/Flash/347/233/270/345/205/263/index.html +3924 -1
  143. package/tags/Steam/346/270/270/346/210/217/index.html +3924 -1
  144. package/tags/Windows/350/275/257/344/273/266/index.html +3997 -1
  145. package/tags/index.html +4033 -1
  146. package/tags//344/270/252/344/272/272/345/260/217/350/256/260/index.html +4570 -1
  147. package/tags//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +4485 -1
  148. package/tags//345/205/266/345/256/203/346/270/270/346/210/217/index.html +4073 -1
  149. package/tags//345/212/240/350/275/275/345/212/250/347/224/273/index.html +3924 -1
  150. 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 +3925 -1
  151. package/tags//346/255/214/346/233/262/346/224/266/351/233/206/index.html +3920 -1
  152. package/tags//346/270/270/346/210/217/347/233/270/345/205/263/index.html +4148 -1
  153. package/tags//347/253/231/347/202/271/345/272/225/351/203/250/351/255/224/346/224/271/index.html +3924 -1
  154. package/tags//347/253/231/347/202/271/346/212/230/350/205/276/index.html +4610 -1
  155. package/tags//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +4148 -1
  156. package/tags//350/207/252/345/273/272/351/203/250/347/275/262/index.html +4224 -1
  157. package/tags//351/241/265/351/235/242/351/255/224/346/224/271/index.html +4075 -1
  158. package/tags//351/241/271/347/233/256/346/212/230/350/205/276/index.html +4072 -1
  159. package/update/index.html +4112 -1
  160. package/weichuncai/css/style.css +25 -2
  161. package/weichuncai/js/common.js +449 -2
  162. package/weichuncai/js/jquery.js +139 -2
  163. package/weichuncai/wcc-config.js +17 -2
  164. package/maps/assets/algolia/algoliasearch.js.map +0 -1
  165. package/maps/assets/algolia/algoliasearchLite.js.map +0 -1
  166. package/maps/bbs/bbs.js.map +0 -1
  167. package/maps/css/custom2.css.map +0 -1
  168. package/maps/css/first.css.map +0 -1
  169. package/maps/css/pace/big-counter.css.map +0 -1
  170. package/maps/css/pace/corner-indicator.css.map +0 -1
  171. package/maps/css/pace/flash.css.map +0 -1
  172. package/maps/css/pace/mac-osx.css.map +0 -1
  173. package/maps/css/pace/pace.css.map +0 -1
  174. package/maps/css/plane.css.map +0 -1
  175. package/maps/css/style.css.map +0 -1
  176. package/maps/css/tags.css.map +0 -1
  177. package/maps/js/app.js.map +0 -1
  178. package/maps/js/autoload.js.map +0 -1
  179. package/maps/js/ceta/fancybox.css.map +0 -1
  180. package/maps/js/ceta/fancybox.umd.js.map +0 -1
  181. package/maps/js/ceta/iconfontInkss.js.map +0 -1
  182. package/maps/js/ceta/message.css.map +0 -1
  183. package/maps/js/ceta/message.js.map +0 -1
  184. package/maps/js/clock.js.map +0 -1
  185. package/maps/js/kslink.js.map +0 -1
  186. package/maps/js/newyear.js.map +0 -1
  187. package/maps/js/plane.js.map +0 -1
  188. package/maps/js/plugins/aplayer.js.map +0 -1
  189. package/maps/js/plugins/parallax.js.map +0 -1
  190. package/maps/js/plugins/rightMenus.js.map +0 -1
  191. package/maps/js/plugins/tags/contributors.js.map +0 -1
  192. package/maps/js/plugins/tags/friends.js.map +0 -1
  193. package/maps/js/plugins/tags/sites.js.map +0 -1
  194. package/maps/js/search/algolia.js.map +0 -1
  195. package/maps/js/search/hexo.js.map +0 -1
  196. package/maps/js/search/meilisearch.js.map +0 -1
  197. package/maps/js/txmap.js.map +0 -1
  198. package/maps/sw.js.map +0 -1
  199. package/maps/weichuncai/css/style.css.map +0 -1
  200. package/maps/weichuncai/js/common.js.map +0 -1
  201. package/maps/weichuncai/js/jquery.js.map +0 -1
  202. package/maps/weichuncai/wcc-config.js.map +0 -1
@@ -1,2 +1,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
+ const ContributorsJS = {
2
+ requestAPI: (url, callback, timeout) => {
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,2 +1,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
1
+ const FriendsJS = {
2
+ requestAPI: (url, callback, timeout) => {
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,2 +1,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
1
+ const SitesJS = {
2
+ requestAPI: (url, callback, timeout) => {
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,2 +1,239 @@
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
1
+ let SearchService = (() => {
2
+ const fn = {};
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);