q78kgblog 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/.github/workflows/HexoSeoAutoPush.yml +36 -0
  2. package/404.html +933 -0
  3. package/BingSiteAuth.xml +4 -0
  4. package/CNAME +1 -0
  5. package/about/index.html +1096 -0
  6. package/archives/2022/06/index.html +942 -0
  7. package/archives/2022/index.html +942 -0
  8. package/archives/2023/02/index.html +942 -0
  9. package/archives/2023/04/index.html +942 -0
  10. package/archives/2023/05/index.html +942 -0
  11. package/archives/2023/08/index.html +942 -0
  12. package/archives/2023/09/index.html +942 -0
  13. package/archives/2023/index.html +942 -0
  14. package/archives/2024/01/index.html +942 -0
  15. package/archives/2024/02/index.html +942 -0
  16. package/archives/2024/index.html +942 -0
  17. package/archives/index.html +942 -0
  18. package/assets/css/APlayer.min.css +3 -0
  19. package/assets/douban-loading.gif +0 -0
  20. package/assets/js/APlayer.min.js +2 -0
  21. package/assets/js/Meting.min.js +1 -0
  22. package/atom.xml +311 -0
  23. package/baidusitemap.xml +43 -0
  24. package/bangumis/index.html +1247 -0
  25. package/bigpie/index.html +714 -0
  26. package/bing.json +1 -0
  27. package/categories/Hello-World/index.html +954 -0
  28. package/categories/Hexo/index.html +954 -0
  29. package/categories/index.html +710 -0
  30. package/categories//345/271/264/347/273/210/346/200/273/347/273/223/index.html +954 -0
  31. package/categories//346/201/260/351/245/255/index.html +954 -0
  32. package/categories//347/264/240/346/235/220/index.html +954 -0
  33. package/categories//351/227/262/350/201/212/346/235/202/350/260/210/index.html +954 -0
  34. package/content.json +1 -0
  35. package/css/404page.css +65 -0
  36. package/css/ariasakablog.css +5632 -0
  37. package/css/commentBarrage.css +111 -0
  38. package/css/danmaku.css +89 -0
  39. package/css/essay.css +306 -0
  40. package/css/iconfont.css +55 -0
  41. package/css/iconfont.ttf +0 -0
  42. package/css/iconfont.woff +0 -0
  43. package/css/iconfont.woff2 +0 -0
  44. package/css/index.css +7006 -0
  45. package/css/people.css +18 -0
  46. package/css/stylessimple.css +40 -0
  47. package/css/swiper.min.css +701 -0
  48. package/css/swiperstyle.css +567 -0
  49. package/css/var.css +0 -0
  50. package/essay/index.html +701 -0
  51. package/favicon.ico +0 -0
  52. package/fcircle/index.html +733 -0
  53. package/fontawesome/index.html +716 -0
  54. package/google.txt +10 -0
  55. package/googlebe706248808ee393.html +1 -0
  56. package/img/144.png +0 -0
  57. package/img/16.png +0 -0
  58. package/img/1666416625095-iPhone X.png +0 -0
  59. package/img/1666416702650-Macbook Pro 2016 (1).png +0 -0
  60. package/img/1666416764216-Nexus 9.png +0 -0
  61. package/img/180.png +0 -0
  62. package/img/192.png +0 -0
  63. package/img/20200904222157.png +0 -0
  64. package/img/20200924153652.png +0 -0
  65. package/img/256.png +0 -0
  66. package/img/36.png +0 -0
  67. package/img/48.png +0 -0
  68. package/img/512.png +0 -0
  69. package/img/72.png +0 -0
  70. package/img/72645310.jpg +0 -0
  71. package/img/8DSTSS20990281646044689944.PNG +0 -0
  72. package/img/96.png +0 -0
  73. package/img/O35HOG22090681654187900371.jpg +0 -0
  74. package/img/a.webp +0 -0
  75. package/img/ad.png +0 -0
  76. package/img/apple-touch-icon.png +0 -0
  77. package/img/avatar.jpg +0 -0
  78. package/img/buYgVO22990681624844309044.jpg +0 -0
  79. package/img/comment.png +0 -0
  80. package/img/favicon.ico +0 -0
  81. package/img/favicon.jpg +0 -0
  82. package/img/friend_404.gif +0 -0
  83. package/img/mqaizf23990681654186719414.jpeg +0 -0
  84. package/img/nyancat.gif +0 -0
  85. package/img/siteshot.png +0 -0
  86. package/img/uTools_1666416859497-iMac.png +0 -0
  87. package/img-col/index.html +802 -0
  88. package/index.html +1056 -0
  89. package/js/aplayersave.js +268 -0
  90. package/js/baiduhistory.js +76 -0
  91. package/js/bbtalk.js +11354 -0
  92. package/js/bbtalklunbo.js +78 -0
  93. package/js/browser.js +35 -0
  94. package/js/calendar.js +380 -0
  95. package/js/cate.js +22 -0
  96. package/js/commentBarrage.js +240 -0
  97. package/js/commentsCount.js +43 -0
  98. package/js/copy.js +23 -0
  99. package/js/countup.js +209 -0
  100. package/js/cursor.js +82 -0
  101. package/js/danmaku.js +106 -0
  102. package/js/day.js +199 -0
  103. package/js/dianzan.js +249 -0
  104. package/js/dis.js +255 -0
  105. package/js/dist/baiduhistory.dev.js +102 -0
  106. package/js/dist/bbtalk.dev.js +12876 -0
  107. package/js/dist/bbtalklunbo.dev.js +45 -0
  108. package/js/dist/calendar.dev.js +395 -0
  109. package/js/dist/fixbugpjax.dev.js +8 -0
  110. package/js/dist/gongnong.dev.js +565 -0
  111. package/js/dist/heimu.dev.js +19 -0
  112. package/js/dist/links.dev.js +13 -0
  113. package/js/dist/main.dev.js +845 -0
  114. package/js/dist/resizeTop.dev.js +50 -0
  115. package/js/dist/seo.dev.js +33 -0
  116. package/js/dist/twikoo.all.min.dev.js +1 -0
  117. package/js/fixbugpjax.js +7 -0
  118. package/js/fixed_card_widget.js +46 -0
  119. package/js/fps.js +58 -0
  120. package/js/gitalker.js +11 -0
  121. package/js/gsap.min.js +11 -0
  122. package/js/heimu.js +16 -0
  123. package/js/hide.show.js +17 -0
  124. package/js/jike.js +121 -0
  125. package/js/jikewater.js +60 -0
  126. package/js/languages.js +511 -0
  127. package/js/latest.js +49 -0
  128. package/js/local-search.js +476 -0
  129. package/js/lunar.js +1071 -0
  130. package/js/lyxTalk.js +12 -0
  131. package/js/main.js +783 -0
  132. package/js/nav.js +30 -0
  133. package/js/noie.js +3 -0
  134. package/js/owo.js +52 -0
  135. package/js/people.js +175 -0
  136. package/js/pikaday.js +109 -0
  137. package/js/random.js +1 -0
  138. package/js/randomFriend.js +95 -0
  139. package/js/resizeTop.js +43 -0
  140. package/js/rightmenu.js +335 -0
  141. package/js/sakura.js +164 -0
  142. package/js/search/algolia.js +155 -0
  143. package/js/search/local-search.js +188 -0
  144. package/js/settings.js +353 -0
  145. package/js/sitetime.js +25 -0
  146. package/js/smooth-scrolling.js +546 -0
  147. package/js/sw-toolbox.js +16 -0
  148. package/js/swiperinit.js +23 -0
  149. package/js/tw_cn.js +100 -0
  150. package/js/twikoo.all.min.js +2 -0
  151. package/js/utils.js +278 -0
  152. package/js/welcome.js +107 -0
  153. package/js/welcomeconsole.js +23 -0
  154. package/links/index.html +842 -0
  155. package/live2d-widget/LICENSE +674 -0
  156. package/live2d-widget/README.md +188 -0
  157. package/live2d-widget/assets/screenshot-1.png +0 -0
  158. package/live2d-widget/assets/screenshot-2.png +0 -0
  159. package/live2d-widget/assets/screenshot-3.png +0 -0
  160. package/live2d-widget/autoload.js +63 -0
  161. package/live2d-widget/demo/demo.html +34 -0
  162. package/live2d-widget/demo/login.html +271 -0
  163. package/live2d-widget/live2d.min.js +1 -0
  164. package/live2d-widget/package.json +31 -0
  165. package/live2d-widget/rollup.config.js +38 -0
  166. package/live2d-widget/src/index.js +178 -0
  167. package/live2d-widget/src/message.js +22 -0
  168. package/live2d-widget/src/model.js +75 -0
  169. package/live2d-widget/src/tools.js +78 -0
  170. package/live2d-widget/src/utils.js +5 -0
  171. package/live2d-widget/src/waifu-tips.js +3 -0
  172. package/live2d-widget/waifu-tips.js +5 -0
  173. package/live2d-widget/waifu-tips.json +255 -0
  174. package/live2d-widget/waifu.css +310 -0
  175. package/manifest.json +1 -0
  176. package/noie.html +69 -0
  177. package/othersite/index.html +779 -0
  178. package/owo.json +1 -0
  179. package/package.json +1 -0
  180. package/people.html +24 -0
  181. package/posts/164ef646/index.html +1027 -0
  182. package/posts/228c2ef8/index.html +1014 -0
  183. package/posts/4a17b156/index.html +1010 -0
  184. package/posts/6f3c565b/index.html +1013 -0
  185. package/posts/7da7c3f6/index.html +1070 -0
  186. package/posts/a9a6c1fb/index.html +1041 -0
  187. package/posts/c262e439/index.html +1002 -0
  188. package/posts/c81531cf/index.html +1080 -0
  189. package/posts/da2093a1/index.html +1022 -0
  190. package/posts/e54f7476/index.html +1052 -0
  191. package/projects.html +424 -0
  192. package/random.html +32 -0
  193. package/robots.txt +17 -0
  194. package/search.xml +309 -0
  195. package/sitemap.txt +62 -0
  196. package/sitemap.xml +488 -0
  197. package/sw.js +190 -0
  198. package/swReg.js +29 -0
  199. package/tags/AI/index.html +955 -0
  200. package/tags/Butterfly/index.html +955 -0
  201. package/tags/Cloudflare/index.html +955 -0
  202. package/tags/DiffSinger/index.html +955 -0
  203. package/tags/Hexo/index.html +955 -0
  204. package/tags/Next/index.html +955 -0
  205. package/tags/RAID/index.html +955 -0
  206. package/tags/VPS/index.html +955 -0
  207. package/tags/Vercel/index.html +955 -0
  208. package/tags/Workers/index.html +955 -0
  209. package/tags/hello-world/index.html +955 -0
  210. package/tags/index.html +710 -0
  211. package/tags//344/270/273/351/242/230/index.html +955 -0
  212. package/tags//344/272/221/346/234/215/345/212/241/345/231/250/index.html +955 -0
  213. package/tags//344/276/277/345/256/234/index.html +955 -0
  214. package/tags//345/206/231/344/275/234/index.html +955 -0
  215. package/tags//345/245/263/346/200/247/346/204/217/350/257/206/index.html +955 -0
  216. package/tags//345/255/246/344/271/240/index.html +955 -0
  217. package/tags//345/256/266/351/207/214/344/272/221/index.html +955 -0
  218. package/tags//345/271/264/347/273/210/346/200/273/347/273/223/index.html +955 -0
  219. package/tags//346/200/247/344/273/267/346/257/224/index.html +955 -0
  220. package/tags//346/212/230/350/205/276/index.html +955 -0
  221. package/tags//346/217/220/344/276/233/345/225/206/index.html +955 -0
  222. package/tags//346/227/245/345/270/270/index.html +955 -0
  223. package/tags//346/234/215/345/212/241/345/231/250/index.html +955 -0
  224. package/tags//346/265/252/346/275/256/index.html +955 -0
  225. package/tags//347/256/200/347/210/261/index.html +955 -0
  226. package/tags//350/207/252/345/212/250/346/240/207/346/263/250/index.html +955 -0
  227. package/tags//350/256/272/346/226/207/index.html +955 -0
  228. package/tags//350/260/267/346/255/214/347/277/273/350/257/221/index.html +955 -0
  229. package/tags//350/264/237/350/275/275/345/235/207/350/241/241/index.html +955 -0
  230. package/tags//351/207/221/345/217/245/index.html +955 -0
  231. package/tags//351/255/224/346/224/271/index.html +955 -0
@@ -0,0 +1,240 @@
1
+ document.addEventListener('pjax:complete', startbarrage);
2
+ document.addEventListener('DOMContentLoaded', startbarrage);
3
+
4
+ function startbarrage(){
5
+ try{
6
+ clearInterval(timer);
7
+ document.querySelector('.comment-barrage').innerHTML="";
8
+ delete sw;
9
+ }catch(err){}
10
+ const commentBarrageConfig = {
11
+ //浅色模式和深色模式颜色,务必保持一致长度,前面是背景颜色,后面是字体,随机选择,默认这个颜色还好
12
+ lightColors:[
13
+ ['#ffffffaa!important','var(--lyx-black)'],
14
+ ],
15
+ darkColors:[
16
+ ['#000a!important','var(--lyx-white)'],
17
+ ],
18
+ //同时最多显示弹幕数
19
+ maxBarrage: 1,
20
+ //弹幕显示间隔时间,单位ms
21
+ barrageTime: 3000,
22
+ //twikoo部署地址(Vercel、私有部署),腾讯云的为环境ID
23
+ twikooUrl: "https://twikoo.anjiurine.top",
24
+ //token获取见前文
25
+ accessToken: "f0fac9b52af34219af509d087ea72c4a",
26
+ pageUrl: window.location.pathname,
27
+ barrageTimer: [],
28
+ barrageList: [],
29
+ barrageIndex: 0,
30
+ // 没有设置过头像时返回的默认头像,见cravatar文档 https://cravatar.cn/developers/api,可以不改以免出错
31
+ noAvatarType: "retro",
32
+ dom: document.querySelector('.comment-barrage'),
33
+ //是否默认显示留言弹幕
34
+ displayBarrage: true,
35
+ //头像cdn,默认cravatar
36
+ avatarCDN: "cravatar.cn",
37
+ }
38
+ function checkURL(URL){
39
+ var str=URL;
40
+ //判断URL地址的正则表达式为:http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
41
+ //下面的代码中应用了转义字符"\"输出一个字符"/"
42
+ var Expression=/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
43
+ var objExp=new RegExp(Expression);
44
+ if(objExp.test(str)==true){
45
+ return true;
46
+ }else{
47
+ return false;
48
+ }
49
+ }
50
+ function isInViewPortOfOne (el) {
51
+ const viewPortHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
52
+ const offsetTop = el.offsetTop
53
+ const scrollTop = document.documentElement.scrollTop
54
+ const top = offsetTop - scrollTop
55
+ return top <= viewPortHeight
56
+ }
57
+ if(location.href.indexOf("posts")!=-1||location.href.indexOf("posts")!=-1)
58
+ document.onscroll = function() {
59
+ if(commentBarrageConfig.displayBarrage){
60
+ if(isInViewPortOfOne(document.getElementById("post-comment"))){
61
+ document.getElementsByClassName("barrageswiper")[0].style.transform="translateX(514px)";
62
+ document.getElementsByClassName("barrageswiper")[0].style.opacity="0";
63
+ }
64
+ else{
65
+ document.getElementsByClassName("barrageswiper")[0].style.transform="";
66
+ document.getElementsByClassName("barrageswiper")[0].style.opacity="1";
67
+ }
68
+ }
69
+ }
70
+ function initCommentBarrage(){
71
+
72
+ var data = JSON.stringify({
73
+ "event": "COMMENT_GET",
74
+ "commentBarrageConfig.accessToken": commentBarrageConfig.accessToken,
75
+ "url": commentBarrageConfig.pageUrl
76
+ });
77
+ var xhr = new XMLHttpRequest();
78
+ xhr.withCredentials = true;
79
+ xhr.addEventListener("readystatechange", function() {
80
+ if(this.readyState === 4) {
81
+ commentBarrageConfig.barrageList = commentLinkFilter(JSON.parse(this.responseText).data);
82
+ commentBarrageConfig.dom.innerHTML = '';
83
+ for(commentBarrageConfig.barrageIndex=0;commentBarrageConfig.barrageIndex<commentBarrageConfig.barrageList.length;commentBarrageConfig.barrageIndex++){
84
+ popCommentBarrage(commentBarrageConfig.barrageList[commentBarrageConfig.barrageIndex]);
85
+ }
86
+ kkksc03=new Swiper('.barrageswiper', {
87
+ direction: "vertical",
88
+ loop: true,
89
+ mousewheel:true,
90
+ autoplay: {
91
+ delay: 3000,
92
+ stopOnLastSlide: false,
93
+ disableOnInteraction: false,
94
+ },
95
+ })
96
+ kkksc03.el.onmouseover = function(){
97
+ kkksc03.autoplay.stop();
98
+ }
99
+ kkksc03.el.onmouseout = function(){
100
+ kkksc03.autoplay.start();
101
+ }
102
+ }
103
+ });
104
+ xhr.open("POST", commentBarrageConfig.twikooUrl);
105
+ xhr.setRequestHeader("Content-Type", "application/json");
106
+ xhr.send(data);
107
+ // timer=setInterval(()=>{
108
+ // if(commentBarrageConfig.barrageList.length){
109
+ // popCommentBarrage(commentBarrageConfig.barrageList[commentBarrageConfig.barrageIndex]);
110
+ // commentBarrageConfig.barrageIndex += 1;
111
+ // commentBarrageConfig.barrageIndex %= commentBarrageConfig.barrageList.length;
112
+ // }
113
+ // if(commentBarrageConfig.barrageTimer.length > (commentBarrageConfig.barrageList.length > commentBarrageConfig.maxBarrage?commentBarrageConfig.maxBarrage:commentBarrageConfig.barrageList.length)){
114
+ // removeCommentBarrage(commentBarrageConfig.barrageTimer.shift())
115
+ // }
116
+ // },commentBarrageConfig.barrageTime)
117
+
118
+ }
119
+ function commentLinkFilter(data){
120
+ data.sort((a,b)=>{
121
+ return a.created - b.created;
122
+ })
123
+ let newData = [];
124
+ data.forEach(item=>{
125
+ newData.push(...getCommentReplies(item));
126
+ });
127
+ return newData;
128
+ }
129
+ function getCommentReplies(item){
130
+ if(item.replies){
131
+ let replies = [item];
132
+ item.replies.forEach(item=>{
133
+ replies.push(...getCommentReplies(item));
134
+ })
135
+ return replies;
136
+ }else{
137
+ return [];
138
+ }
139
+ }
140
+ function popCommentBarrage(data){
141
+ let barrage = document.createElement('div');
142
+ let width = commentBarrageConfig.dom.clientWidth;
143
+ let height = commentBarrageConfig.dom.clientHeight;
144
+ barrage.className = 'comment-barrage-item'
145
+ let ran = Math.floor(Math.random()*commentBarrageConfig.lightColors.length)
146
+ document.getElementById("barragesColor").innerHTML=`[data-theme='light'] .comment-barrage-item { background-color:${commentBarrageConfig.lightColors[ran][0]};color:${commentBarrageConfig.lightColors[ran][1]}}[data-theme='dark'] .comment-barrage-item{ background-color:${commentBarrageConfig.darkColors[ran][0]};color:${commentBarrageConfig.darkColors[ran][1]}}`;
147
+ if(data.avatar!=undefined){
148
+ if(data.link!=undefined){
149
+ if(!checkURL(data.link)){
150
+ data.link="http://"+data.link;
151
+ }
152
+ barrage.innerHTML = `
153
+ <div class="barrageHead">
154
+ <img class="barrageAvatar" src="${data.avatar}"/>
155
+ <a href="${data.link}" class="barrageNick" target="_blank">${data.nick}</a>
156
+ <a href="javascript:switchCommentBarrage()" style="font-size:20px">×</a>
157
+ </div>
158
+ `
159
+ }
160
+ else{
161
+ barrage.innerHTML = `
162
+ <div class="barrageHead">
163
+ <img class="barrageAvatar" src="${data.avatar}"/>
164
+ <div class="barrageNick">${data.nick}</div>
165
+ <a href="javascript:switchCommentBarrage()" style="font-size:20px">×</a>
166
+ </div>
167
+ `
168
+ }
169
+ }
170
+ else{
171
+ if(data.link!=undefined){
172
+ if(!checkURL(data.link)){
173
+ data.link="http://"+data.link;
174
+ }
175
+ barrage.innerHTML = `
176
+ <div class="barrageHead">
177
+ <img class="barrageAvatar" src="https://${commentBarrageConfig.avatarCDN}/avatar/${data.mailMd5}?d=${commentBarrageConfig.noAvatarType}"/>
178
+ <a href="${data.link}" class="barrageNick" target="_blank">${data.nick}</a>
179
+ <a href="javascript:switchCommentBarrage()" style="font-size:20px">×</a>
180
+ </div>
181
+ `
182
+ }
183
+ else{
184
+ barrage.innerHTML = `
185
+ <div class="barrageHead">
186
+ <img class="barrageAvatar" src="https://${commentBarrageConfig.avatarCDN}/avatar/${data.mailMd5}?d=${commentBarrageConfig.noAvatarType}"/>
187
+ <div class="barrageNick">${data.nick}</div>
188
+ <a href="javascript:switchCommentBarrage()" style="font-size:20px">×</a>
189
+ </div>
190
+ `
191
+ }
192
+ }
193
+ barrageContent=document.createElement('a');
194
+ barrageContent.className="barrageContent";
195
+ barrageContent.href="#"+data.id;
196
+ barrageContent.innerHTML=data.comment;
197
+ barrage.appendChild(barrageContent);
198
+ // commentBarrageConfig.barrageTimer.push(barrage);
199
+ aswiper = document.createElement('div');
200
+ aswiper.className="swiper-slide";
201
+ // aswiper.setAttribute("data-swiper-slide-index","8")
202
+ aswiper.setAttribute("style","height: 150px;");
203
+ // aswiper.setAttribute("role","group")
204
+ // aswiper.setAttribute("aria-label","9 / 19");
205
+ aswiper.append(barrage);
206
+ commentBarrageConfig.dom.append(aswiper);
207
+ }
208
+ switchCommentBarrage = function () {
209
+ localStorage.setItem("isBarrageToggle",Number(!Number(localStorage.getItem("isBarrageToggle"))))
210
+ if(!isInViewPortOfOne(document.getElementById("post-comment"))){
211
+ commentBarrageConfig.displayBarrage=!(commentBarrageConfig.displayBarrage);
212
+ let commentBarrage = document.querySelector('.comment-barrage');
213
+ if (commentBarrage) {
214
+ $(commentBarrage).fadeToggle()
215
+ }
216
+ }
217
+
218
+ }
219
+ // $(".comment-barrage").hover(function(){
220
+ // clearInterval(timer);
221
+ // },function () {
222
+ // timer=setInterval(()=>{
223
+ // if(commentBarrageConfig.barrageList.length){
224
+ // popCommentBarrage(commentBarrageConfig.barrageList[commentBarrageConfig.barrageIndex]);
225
+ // commentBarrageConfig.barrageIndex += 1;
226
+ // commentBarrageConfig.barrageIndex %= commentBarrageConfig.barrageList.length;
227
+ // }
228
+ // if(commentBarrageConfig.barrageTimer.length > (commentBarrageConfig.barrageList.length > commentBarrageConfig.maxBarrage?commentBarrageConfig.maxBarrage:commentBarrageConfig.barrageList.length)){
229
+ // removeCommentBarrage(commentBarrageConfig.barrageTimer.shift())
230
+ // }
231
+ // },commentBarrageConfig.barrageTime)
232
+ // })
233
+ if(localStorage.getItem("isBarrageToggle")==undefined){
234
+ localStorage.setItem("isBarrageToggle","0");
235
+ }else if(localStorage.getItem("isBarrageToggle")=="1"){
236
+ localStorage.setItem("isBarrageToggle","0");
237
+ switchCommentBarrage()
238
+ }
239
+ initCommentBarrage()
240
+ }
@@ -0,0 +1,43 @@
1
+ // 更新的晚了一点,因为我发现如果不存起来的话会导致每进一次页面就重新获取一次,所以我们把它给存到本地。10分钟获取一次(当然,可以自定义时长)
2
+ function comCount() {
3
+ let d = loadData('comCount', 10) // 10为10分钟获取一次,可自定义时长
4
+ if (d) document.querySelectorAll('.card_comment').forEach(i => { i.innerHTML = d; })
5
+ else {
6
+ fetch('https://twikoo.anjiurine.top/', { // 此处更换url
7
+ method: "POST",
8
+ body: JSON.stringify({
9
+ "event": "COMMENT_GET_FOR_ADMIN",
10
+ "accessToken": "1059857c25a2ce9fba9cff298f4f33ee", // 此处更换accessToken
11
+ "per": 1,
12
+ "page": 1,
13
+ }),
14
+ headers: { 'Content-Type': 'application/json' }
15
+ }).then(res => res.json()).then(data => {
16
+ document.querySelectorAll('.card_comment').forEach(i => { i.innerHTML = data.count; })
17
+ document.getElementsByClassName("card_comment").innerText=data.count;
18
+ saveData('comCount', data.count)
19
+ })
20
+ }
21
+ }
22
+
23
+ // 存数据
24
+ // name:命名 data:数据
25
+ function saveData(name, data) {
26
+ localStorage.setItem(name, JSON.stringify({ 'time': Date.now(), 'data': data }))
27
+ }
28
+
29
+ // 下面两个函数如果你有其他需要存取数据的功能,也可以直接使用
30
+ // 取数据
31
+ // name:命名 time:过期时长,单位分钟,如传入30,即加载数据时如果超出30分钟返回0,否则返回数据
32
+ function loadData(name, time) {
33
+ let data = JSON.parse(localStorage.getItem(name));
34
+ // 过期或有错误返回 0
35
+ let t = 0
36
+ if (data != null) t = Date.now() - data.time
37
+ if (t < time * 60 * 1000 && t > 0) return data.data;
38
+ // 没过期返回数据
39
+ return 0;
40
+ }
41
+
42
+ window.addEventListener("pjax:complete",comCount)
43
+ window.addEventListener("DOMContentLoaded",comCount)
package/js/copy.js ADDED
@@ -0,0 +1,23 @@
1
+ document.oncopy = function () {
2
+ Snackbar.show({
3
+ text: '复制成功,如转载请注明出处!',
4
+ pos: 'top-right',
5
+ onActionClick: function (element) {
6
+ window.open("/license")
7
+ },
8
+ actionText: "查看博客声明",
9
+ });
10
+ };
11
+ document.onkeydown = function (event) {
12
+ event = (event || window.event);
13
+ if (event.keyCode == 123) {
14
+ Snackbar.show({
15
+ text: '已打开开发者模式,扒源请谨记MIT协议!',
16
+ pos: 'top-right',
17
+ onActionClick: function (element) {
18
+ window.open("/license")
19
+ },
20
+ actionText: "查看博客声明",
21
+ });
22
+ }
23
+ }
package/js/countup.js ADDED
@@ -0,0 +1,209 @@
1
+ var CountUp = function (target, startVal, endVal, decimals, duration, options) {
2
+ var self = this;
3
+ self.version = function () {
4
+ return "1.9.2";
5
+ };
6
+ self.options = {
7
+ useEasing: true,
8
+ useGrouping: true,
9
+ separator: ",",
10
+ decimal: ".",
11
+ easingFn: easeOutExpo,
12
+ formattingFn: formatNumber,
13
+ prefix: "",
14
+ suffix: "",
15
+ numerals: [],
16
+ };
17
+ if (options && typeof options === "object") {
18
+ for (var key in self.options) {
19
+ if (options.hasOwnProperty(key) && options[key] !== null) {
20
+ self.options[key] = options[key];
21
+ }
22
+ }
23
+ }
24
+ if (self.options.separator === "") {
25
+ self.options.useGrouping = false;
26
+ } else {
27
+ self.options.separator = "" + self.options.separator;
28
+ }
29
+ var lastTime = 0;
30
+ var vendors = ["webkit", "moz", "ms", "o"];
31
+ for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
32
+ window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"];
33
+ window.cancelAnimationFrame =
34
+ window[vendors[x] + "CancelAnimationFrame"] || window[vendors[x] + "CancelRequestAnimationFrame"];
35
+ }
36
+ if (!window.requestAnimationFrame) {
37
+ window.requestAnimationFrame = function (callback, element) {
38
+ var currTime = new Date().getTime();
39
+ var timeToCall = Math.max(0, 16 - (currTime - lastTime));
40
+ var id = window.setTimeout(function () {
41
+ callback(currTime + timeToCall);
42
+ }, timeToCall);
43
+ lastTime = currTime + timeToCall;
44
+ return id;
45
+ };
46
+ }
47
+ if (!window.cancelAnimationFrame) {
48
+ window.cancelAnimationFrame = function (id) {
49
+ clearTimeout(id);
50
+ };
51
+ }
52
+ function formatNumber(num) {
53
+ num = num.toFixed(self.decimals);
54
+ num += "";
55
+ var x, x1, x2, x3, i, l;
56
+ x = num.split(".");
57
+ x1 = x[0];
58
+ x2 = x.length > 1 ? self.options.decimal + x[1] : "";
59
+ if (self.options.useGrouping) {
60
+ x3 = "";
61
+ for (i = 0, l = x1.length; i < l; ++i) {
62
+ if (i !== 0 && i % 3 === 0) {
63
+ x3 = self.options.separator + x3;
64
+ }
65
+ x3 = x1[l - i - 1] + x3;
66
+ }
67
+ x1 = x3;
68
+ }
69
+ if (self.options.numerals.length) {
70
+ x1 = x1.replace(/[0-9]/g, function (w) {
71
+ return self.options.numerals[+w];
72
+ });
73
+ x2 = x2.replace(/[0-9]/g, function (w) {
74
+ return self.options.numerals[+w];
75
+ });
76
+ }
77
+ return self.options.prefix + x1 + x2 + self.options.suffix;
78
+ }
79
+ function easeOutExpo(t, b, c, d) {
80
+ return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
81
+ }
82
+ function ensureNumber(n) {
83
+ return typeof n === "number" && !isNaN(n);
84
+ }
85
+ self.initialize = function () {
86
+ if (self.initialized) {
87
+ return true;
88
+ }
89
+ self.error = "";
90
+ self.d = typeof target === "string" ? document.getElementById(target) : target;
91
+ if (!self.d) {
92
+ self.error = "[CountUp] target is null or undefined";
93
+ return false;
94
+ }
95
+ self.startVal = Number(startVal);
96
+ self.endVal = Number(endVal);
97
+ if (ensureNumber(self.startVal) && ensureNumber(self.endVal)) {
98
+ self.decimals = Math.max(0, decimals || 0);
99
+ self.dec = Math.pow(10, self.decimals);
100
+ self.duration = Number(duration) * 1000 || 2000;
101
+ self.countDown = self.startVal > self.endVal;
102
+ self.frameVal = self.startVal;
103
+ self.initialized = true;
104
+ return true;
105
+ } else {
106
+ self.error = "[CountUp] startVal (" + startVal + ") or endVal (" + endVal + ") is not a number";
107
+ return false;
108
+ }
109
+ };
110
+ self.printValue = function (value) {
111
+ var result = self.options.formattingFn(value);
112
+ if (self.d.tagName === "INPUT") {
113
+ this.d.value = result;
114
+ } else {
115
+ if (self.d.tagName === "text" || self.d.tagName === "tspan") {
116
+ this.d.textContent = result;
117
+ } else {
118
+ this.d.innerHTML = result;
119
+ }
120
+ }
121
+ };
122
+ self.count = function (timestamp) {
123
+ if (!self.startTime) {
124
+ self.startTime = timestamp;
125
+ }
126
+ self.timestamp = timestamp;
127
+ var progress = timestamp - self.startTime;
128
+ self.remaining = self.duration - progress;
129
+ if (self.options.useEasing) {
130
+ if (self.countDown) {
131
+ self.frameVal = self.startVal - self.options.easingFn(progress, 0, self.startVal - self.endVal, self.duration);
132
+ } else {
133
+ self.frameVal = self.options.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration);
134
+ }
135
+ } else {
136
+ if (self.countDown) {
137
+ self.frameVal = self.startVal - (self.startVal - self.endVal) * (progress / self.duration);
138
+ } else {
139
+ self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration);
140
+ }
141
+ }
142
+ if (self.countDown) {
143
+ self.frameVal = self.frameVal < self.endVal ? self.endVal : self.frameVal;
144
+ } else {
145
+ self.frameVal = self.frameVal > self.endVal ? self.endVal : self.frameVal;
146
+ }
147
+ self.frameVal = Math.round(self.frameVal * self.dec) / self.dec;
148
+ self.printValue(self.frameVal);
149
+ if (progress < self.duration) {
150
+ self.rAF = requestAnimationFrame(self.count);
151
+ } else {
152
+ if (self.callback) {
153
+ self.callback();
154
+ }
155
+ }
156
+ };
157
+ self.start = function (callback) {
158
+ if (!self.initialize()) {
159
+ return;
160
+ }
161
+ self.callback = callback;
162
+ self.rAF = requestAnimationFrame(self.count);
163
+ };
164
+ self.pauseResume = function () {
165
+ if (!self.paused) {
166
+ self.paused = true;
167
+ cancelAnimationFrame(self.rAF);
168
+ } else {
169
+ self.paused = false;
170
+ delete self.startTime;
171
+ self.duration = self.remaining;
172
+ self.startVal = self.frameVal;
173
+ requestAnimationFrame(self.count);
174
+ }
175
+ };
176
+ self.reset = function () {
177
+ self.paused = false;
178
+ delete self.startTime;
179
+ self.initialized = false;
180
+ if (self.initialize()) {
181
+ cancelAnimationFrame(self.rAF);
182
+ self.printValue(self.startVal);
183
+ }
184
+ };
185
+ self.update = function (newEndVal) {
186
+ if (!self.initialize()) {
187
+ return;
188
+ }
189
+ newEndVal = Number(newEndVal);
190
+ if (!ensureNumber(newEndVal)) {
191
+ self.error = "[CountUp] update() - new endVal is not a number: " + newEndVal;
192
+ return;
193
+ }
194
+ self.error = "";
195
+ if (newEndVal === self.frameVal) {
196
+ return;
197
+ }
198
+ cancelAnimationFrame(self.rAF);
199
+ self.paused = false;
200
+ delete self.startTime;
201
+ self.startVal = self.frameVal;
202
+ self.endVal = newEndVal;
203
+ self.countDown = self.startVal > self.endVal;
204
+ self.rAF = requestAnimationFrame(self.count);
205
+ };
206
+ if (self.initialize()) {
207
+ self.printValue(self.startVal);
208
+ }
209
+ };
package/js/cursor.js ADDED
@@ -0,0 +1,82 @@
1
+ var CURSOR;
2
+
3
+ Math.lerp = (a, b, n) => (1 - n) * a + n * b;
4
+
5
+ const getStyle2 = (el, attr) => {
6
+ try {
7
+ return window.getComputedStyle
8
+ ? window.getComputedStyle(el)[attr]
9
+ : el.currentStyle[attr];
10
+ } catch (e) {}
11
+ return "";
12
+ };
13
+
14
+ class Cursor {
15
+ constructor() {
16
+ this.pos = {curr: null, prev: null};
17
+ this.pt = [];
18
+ this.create();
19
+ this.init();
20
+ this.render();
21
+ }
22
+
23
+ move(left, top) {
24
+ this.cursor.style["left"] = `${left}px`;
25
+ this.cursor.style["top"] = `${top}px`;
26
+ }
27
+
28
+ create() {
29
+ if (!this.cursor) {
30
+ this.cursor = document.createElement("div");
31
+ this.cursor.id = "cursor";
32
+ this.cursor.classList.add("hidden");
33
+ document.body.append(this.cursor);
34
+ }
35
+
36
+ var el = document.getElementsByTagName('*');
37
+ for (let i = 0; i < el.length; i++)
38
+ if (getStyle2(el[i], "cursor") == "pointer")
39
+ this.pt.push(el[i].outerHTML);
40
+
41
+ document.body.appendChild((this.scr = document.createElement("style")));
42
+ this.scr.innerHTML = `* {cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' width='8px' height='8px'><style>circle {fill: white;}</style><circle cx='4' cy='4' r='4' opacity='.5'/></svg>") 4 4, auto!important}`;
43
+ }
44
+
45
+ refresh() {
46
+ this.scr.remove();
47
+ this.cursor.classList.remove("hover");
48
+ this.cursor.classList.remove("active");
49
+ this.pos = {curr: null, prev: null};
50
+ this.pt = [];
51
+
52
+ this.create();
53
+ this.init();
54
+ this.render();
55
+ }
56
+
57
+ init() {
58
+ document.onmouseover = e => this.pt.includes(e.target.outerHTML) && this.cursor.classList.add("hover");
59
+ document.onmouseout = e => this.pt.includes(e.target.outerHTML) && this.cursor.classList.remove("hover");
60
+ document.onmousemove = e => {(this.pos.curr == null) && this.move(e.clientX - 8, e.clientY - 8); this.pos.curr = {x: e.clientX - 8, y: e.clientY - 8}; this.cursor.classList.remove("hidden");};
61
+ document.onmouseenter = e => this.cursor.classList.remove("hidden");
62
+ document.onmouseleave = e => this.cursor.classList.add("hidden");
63
+ document.onmousedown = e => this.cursor.classList.add("active");
64
+ document.onmouseup = e => this.cursor.classList.remove("active");
65
+ }
66
+
67
+ render() {
68
+ if (this.pos.prev) {
69
+ this.pos.prev.x = Math.lerp(this.pos.prev.x, this.pos.curr.x, 0.15);
70
+ this.pos.prev.y = Math.lerp(this.pos.prev.y, this.pos.curr.y, 0.15);
71
+ this.move(this.pos.prev.x, this.pos.prev.y);
72
+ } else {
73
+ this.pos.prev = this.pos.curr;
74
+ }
75
+ requestAnimationFrame(() => this.render());
76
+ }
77
+ }
78
+
79
+ (() => {
80
+ CURSOR = new Cursor();
81
+ // 需要重新获取列表时,使用 CURSOR.refresh()
82
+ })();