q78kgblog 0.0.0-1720441708496 → 0.0.0-1720859005089

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 (133) hide show
  1. package/404.html +3 -3
  2. package/about/index.html +5 -5
  3. package/archives/2023/02/index.html +4 -4
  4. package/archives/2023/04/index.html +4 -4
  5. package/archives/2023/05/index.html +4 -4
  6. package/archives/2023/08/index.html +4 -4
  7. package/archives/2023/09/index.html +4 -4
  8. package/archives/2023/index.html +4 -4
  9. package/archives/2024/01/index.html +4 -4
  10. package/archives/2024/02/index.html +4 -4
  11. package/archives/2024/index.html +4 -4
  12. package/archives/index.html +4 -4
  13. package/atom.xml +9 -9
  14. package/baidusitemap.xml +8 -8
  15. package/bangumis/index.html +4 -4
  16. package/bigpie/index.html +3 -3
  17. package/categories/Hexo/index.html +4 -4
  18. package/categories/index.html +3 -3
  19. package/categories//345/271/264/347/273/210/346/200/273/347/273/223/index.html +4 -4
  20. package/categories//347/264/240/346/235/220/index.html +4 -4
  21. package/categories//351/227/262/350/201/212/346/235/202/350/260/210/index.html +4 -4
  22. package/content.json +1 -1
  23. package/css/404page.css +1 -65
  24. package/css/ariasakablog.css +1 -6669
  25. package/css/commentBarrage.css +1 -118
  26. package/css/danmaku.css +1 -106
  27. package/css/essay.css +1 -306
  28. package/css/iconfont.css +1 -55
  29. package/css/index.css +1 -7006
  30. package/css/people.css +1 -18
  31. package/css/stylessimple.css +1 -40
  32. package/css/swiperstyle.css +1 -567
  33. package/fcircle/index.html +3 -3
  34. package/fontawesome/index.html +3 -3
  35. package/index.html +11 -11
  36. package/js/aplayersave.js +1 -268
  37. package/js/baiduhistory.js +1 -76
  38. package/js/browser.js +1 -35
  39. package/js/calendar.js +1 -380
  40. package/js/cate.js +1 -22
  41. package/js/commentBarrage.js +17 -232
  42. package/js/commentsCount.js +1 -43
  43. package/js/copy.js +1 -23
  44. package/js/countup.js +1 -209
  45. package/js/cursor.js +1 -82
  46. package/js/danmaku.js +0 -106
  47. package/js/day.js +13 -195
  48. package/js/dianzan.js +1 -249
  49. package/js/dis.js +4 -252
  50. package/js/dist/baiduhistory.dev.js +1 -102
  51. package/js/dist/bbtalk.dev.js +159 -12872
  52. package/js/dist/bbtalklunbo.dev.js +1 -45
  53. package/js/dist/calendar.dev.js +1 -395
  54. package/js/dist/fixbugpjax.dev.js +1 -8
  55. package/js/dist/gongnong.dev.js +1 -565
  56. package/js/dist/heimu.dev.js +1 -19
  57. package/js/dist/links.dev.js +1 -13
  58. package/js/dist/main.dev.js +5 -843
  59. package/js/dist/resizeTop.dev.js +1 -50
  60. package/js/dist/seo.dev.js +1 -33
  61. package/js/dist/twikoo.all.min.dev.js +946 -1
  62. package/js/fixbugpjax.js +1 -7
  63. package/js/fixed_card_widget.js +1 -46
  64. package/js/fps.js +1 -58
  65. package/js/gitalker.js +1 -11
  66. package/js/heimu.js +1 -16
  67. package/js/hide.show.js +1 -17
  68. package/js/languages.js +1 -511
  69. package/js/latest.js +1 -49
  70. package/js/local-search.js +2 -476
  71. package/js/lunar.js +1 -1071
  72. package/js/lyxTalk.js +1 -12
  73. package/js/main.js +5 -781
  74. package/js/nav.js +1 -30
  75. package/js/noie.js +1 -3
  76. package/js/owo.js +1 -52
  77. package/js/people.js +2 -175
  78. package/js/randomFriend.js +1 -95
  79. package/js/resizeTop.js +1 -43
  80. package/js/rightmenu.js +3 -333
  81. package/js/sakura.js +1 -164
  82. package/js/search/algolia.js +4 -154
  83. package/js/search/local-search.js +1 -188
  84. package/js/settings.js +3 -343
  85. package/js/sitetime.js +1 -25
  86. package/js/smooth-scrolling.js +1 -546
  87. package/js/sw-toolbox.js +1 -16
  88. package/js/swiperinit.js +1 -23
  89. package/js/tw_cn.js +1 -100
  90. package/js/utils.js +1 -278
  91. package/js/welcome.js +1 -107
  92. package/js/welcomeconsole.js +1 -23
  93. package/links/index.html +3 -3
  94. package/othersite/index.html +3 -3
  95. package/package.json +1 -1
  96. package/posts/164ef646/index.html +6 -6
  97. package/posts/228c2ef8/index.html +6 -6
  98. package/posts/a9a6c1fb/index.html +6 -6
  99. package/posts/c262e439/index.html +6 -6
  100. package/posts/c81531cf/index.html +6 -6
  101. package/posts/ccdf7cfc/index.html +6 -6
  102. package/posts/de1f83f4/index.html +6 -6
  103. package/posts/e54f7476/index.html +6 -6
  104. package/sitemap.xml +49 -49
  105. package/sw.js +2 -193
  106. package/swReg.js +1 -29
  107. package/tags/AI/index.html +5 -5
  108. package/tags/Butterfly/index.html +5 -5
  109. package/tags/Cloudflare/index.html +5 -5
  110. package/tags/DiffSinger/index.html +5 -5
  111. package/tags/Hexo/index.html +5 -5
  112. package/tags/Next/index.html +5 -5
  113. package/tags/RAID/index.html +5 -5
  114. package/tags/Vercel/index.html +5 -5
  115. package/tags/Workers/index.html +5 -5
  116. package/tags/index.html +3 -3
  117. package/tags//344/270/273/351/242/230/index.html +5 -5
  118. package/tags//345/206/231/344/275/234/index.html +5 -5
  119. package/tags//345/245/263/346/200/247/346/204/217/350/257/206/index.html +5 -5
  120. package/tags//345/255/246/344/271/240/index.html +5 -5
  121. package/tags//345/256/266/351/207/214/344/272/221/index.html +5 -5
  122. package/tags//345/271/264/347/273/210/346/200/273/347/273/223/index.html +5 -5
  123. package/tags//346/212/230/350/205/276/index.html +5 -5
  124. package/tags//346/227/245/345/270/270/index.html +5 -5
  125. package/tags//346/234/215/345/212/241/345/231/250/index.html +5 -5
  126. package/tags//346/265/252/346/275/256/index.html +5 -5
  127. package/tags//347/256/200/347/210/261/index.html +5 -5
  128. package/tags//350/207/252/345/212/250/346/240/207/346/263/250/index.html +5 -5
  129. package/tags//350/256/272/346/226/207/index.html +5 -5
  130. package/tags//350/260/267/346/255/214/347/277/273/350/257/221/index.html +5 -5
  131. package/tags//350/264/237/350/275/275/345/235/207/350/241/241/index.html +5 -5
  132. package/tags//351/207/221/345/217/245/index.html +5 -5
  133. package/tags//351/255/224/346/224/271/index.html +5 -5
@@ -1,43 +1 @@
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)
1
+ function comCount(){let t=loadData("comCount",10);t?document.querySelectorAll(".card_comment").forEach(e=>{e.innerHTML=t}):fetch("https://twikoo.anjiurine.top/",{method:"POST",body:JSON.stringify({event:"COMMENT_GET_FOR_ADMIN",accessToken:"1059857c25a2ce9fba9cff298f4f33ee",per:1,page:1}),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{document.querySelectorAll(".card_comment").forEach(n=>{n.innerHTML=e.count}),document.getElementsByClassName("card_comment").innerText=e.count,saveData("comCount",e.count)})}function saveData(t,e){localStorage.setItem(t,JSON.stringify({time:Date.now(),data:e}))}function loadData(t,e){let n=JSON.parse(localStorage.getItem(t)),o=0;return n!=null&&(o=Date.now()-n.time),o<e*60*1e3&&o>0?n.data:0}window.addEventListener("pjax:complete",comCount),window.addEventListener("DOMContentLoaded",comCount);
package/js/copy.js CHANGED
@@ -1,23 +1 @@
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
- }
1
+ document.oncopy=function(){Snackbar.show({text:"\u590D\u5236\u6210\u529F,\u5982\u8F6C\u8F7D\u8BF7\u6CE8\u660E\u51FA\u5904\uFF01",pos:"top-right",onActionClick:function(n){window.open("/license")},actionText:"\u67E5\u770B\u535A\u5BA2\u58F0\u660E"})},document.onkeydown=function(n){n=n||window.event,n.keyCode==123&&Snackbar.show({text:"\u5DF2\u6253\u5F00\u5F00\u53D1\u8005\u6A21\u5F0F\uFF0C\u6252\u6E90\u8BF7\u8C28\u8BB0MIT\u534F\u8BAE\uFF01",pos:"top-right",onActionClick:function(o){window.open("/license")},actionText:"\u67E5\u770B\u535A\u5BA2\u58F0\u660E"})};
package/js/countup.js CHANGED
@@ -1,209 +1 @@
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
- };
1
+ var CountUp=function(f,V,F,g,A,s){var e=this;if(e.version=function(){return"1.9.2"},e.options={useEasing:!0,useGrouping:!0,separator:",",decimal:".",easingFn:b,formattingFn:v,prefix:"",suffix:"",numerals:[]},s&&typeof s=="object")for(var u in e.options)s.hasOwnProperty(u)&&s[u]!==null&&(e.options[u]=s[u]);e.options.separator===""?e.options.useGrouping=!1:e.options.separator=""+e.options.separator;for(var w=0,m=["webkit","moz","ms","o"],l=0;l<m.length&&!window.requestAnimationFrame;++l)window.requestAnimationFrame=window[m[l]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[m[l]+"CancelAnimationFrame"]||window[m[l]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a,t){var n=new Date().getTime(),r=Math.max(0,16-(n-w)),i=window.setTimeout(function(){a(n+r)},r);return w=n+r,i}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});function v(a){a=a.toFixed(e.decimals),a+="";var t,n,r,i,o,c;if(t=a.split("."),n=t[0],r=t.length>1?e.options.decimal+t[1]:"",e.options.useGrouping){for(i="",o=0,c=n.length;o<c;++o)o!==0&&o%3===0&&(i=e.options.separator+i),i=n[c-o-1]+i;n=i}return e.options.numerals.length&&(n=n.replace(/[0-9]/g,function(p){return e.options.numerals[+p]}),r=r.replace(/[0-9]/g,function(p){return e.options.numerals[+p]})),e.options.prefix+n+r+e.options.suffix}function b(a,t,n,r){return n*(-Math.pow(2,-10*a/r)+1)*1024/1023+t}function d(a){return typeof a=="number"&&!isNaN(a)}e.initialize=function(){return e.initialized?!0:(e.error="",e.d=typeof f=="string"?document.getElementById(f):f,e.d?(e.startVal=Number(V),e.endVal=Number(F),d(e.startVal)&&d(e.endVal)?(e.decimals=Math.max(0,g||0),e.dec=Math.pow(10,e.decimals),e.duration=Number(A)*1e3||2e3,e.countDown=e.startVal>e.endVal,e.frameVal=e.startVal,e.initialized=!0,!0):(e.error="[CountUp] startVal ("+V+") or endVal ("+F+") is not a number",!1)):(e.error="[CountUp] target is null or undefined",!1))},e.printValue=function(a){var t=e.options.formattingFn(a);e.d.tagName==="INPUT"?this.d.value=t:e.d.tagName==="text"||e.d.tagName==="tspan"?this.d.textContent=t:this.d.innerHTML=t},e.count=function(a){e.startTime||(e.startTime=a),e.timestamp=a;var t=a-e.startTime;e.remaining=e.duration-t,e.options.useEasing?e.countDown?e.frameVal=e.startVal-e.options.easingFn(t,0,e.startVal-e.endVal,e.duration):e.frameVal=e.options.easingFn(t,e.startVal,e.endVal-e.startVal,e.duration):e.countDown?e.frameVal=e.startVal-(e.startVal-e.endVal)*(t/e.duration):e.frameVal=e.startVal+(e.endVal-e.startVal)*(t/e.duration),e.countDown?e.frameVal=e.frameVal<e.endVal?e.endVal:e.frameVal:e.frameVal=e.frameVal>e.endVal?e.endVal:e.frameVal,e.frameVal=Math.round(e.frameVal*e.dec)/e.dec,e.printValue(e.frameVal),t<e.duration?e.rAF=requestAnimationFrame(e.count):e.callback&&e.callback()},e.start=function(a){e.initialize()&&(e.callback=a,e.rAF=requestAnimationFrame(e.count))},e.pauseResume=function(){e.paused?(e.paused=!1,delete e.startTime,e.duration=e.remaining,e.startVal=e.frameVal,requestAnimationFrame(e.count)):(e.paused=!0,cancelAnimationFrame(e.rAF))},e.reset=function(){e.paused=!1,delete e.startTime,e.initialized=!1,e.initialize()&&(cancelAnimationFrame(e.rAF),e.printValue(e.startVal))},e.update=function(a){if(e.initialize()){if(a=Number(a),!d(a)){e.error="[CountUp] update() - new endVal is not a number: "+a;return}e.error="",a!==e.frameVal&&(cancelAnimationFrame(e.rAF),e.paused=!1,delete e.startTime,e.startVal=e.frameVal,e.endVal=a,e.countDown=e.startVal>e.endVal,e.rAF=requestAnimationFrame(e.count))}},e.initialize()&&e.printValue(e.startVal)};
package/js/cursor.js CHANGED
@@ -1,82 +1 @@
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
- })();
1
+ var CURSOR;Math.lerp=(e,s,t)=>(1-t)*e+t*s;const getStyle2=(e,s)=>{try{return window.getComputedStyle?window.getComputedStyle(e)[s]:e.currentStyle[s]}catch{}return""};class Cursor{constructor(){this.pos={curr:null,prev:null},this.pt=[],this.create(),this.init(),this.render()}move(s,t){this.cursor.style.left=`${s}px`,this.cursor.style.top=`${t}px`}create(){this.cursor||(this.cursor=document.createElement("div"),this.cursor.id="cursor",this.cursor.classList.add("hidden"),document.body.append(this.cursor));var s=document.getElementsByTagName("*");for(let t=0;t<s.length;t++)getStyle2(s[t],"cursor")=="pointer"&&this.pt.push(s[t].outerHTML);document.body.appendChild(this.scr=document.createElement("style")),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}`}refresh(){this.scr.remove(),this.cursor.classList.remove("hover"),this.cursor.classList.remove("active"),this.pos={curr:null,prev:null},this.pt=[],this.create(),this.init(),this.render()}init(){document.onmouseover=s=>this.pt.includes(s.target.outerHTML)&&this.cursor.classList.add("hover"),document.onmouseout=s=>this.pt.includes(s.target.outerHTML)&&this.cursor.classList.remove("hover"),document.onmousemove=s=>{this.pos.curr==null&&this.move(s.clientX-8,s.clientY-8),this.pos.curr={x:s.clientX-8,y:s.clientY-8},this.cursor.classList.remove("hidden")},document.onmouseenter=s=>this.cursor.classList.remove("hidden"),document.onmouseleave=s=>this.cursor.classList.add("hidden"),document.onmousedown=s=>this.cursor.classList.add("active"),document.onmouseup=s=>this.cursor.classList.remove("active")}render(){this.pos.prev?(this.pos.prev.x=Math.lerp(this.pos.prev.x,this.pos.curr.x,.15),this.pos.prev.y=Math.lerp(this.pos.prev.y,this.pos.curr.y,.15),this.move(this.pos.prev.x,this.pos.prev.y)):this.pos.prev=this.pos.curr,requestAnimationFrame(()=>this.render())}}CURSOR=new Cursor;
package/js/danmaku.js CHANGED
@@ -1,106 +0,0 @@
1
- // //这里可以定义弹幕的背景色与字体色
2
- // const danmakuColors = [
3
- // ['#0008','white']
4
- // ]
5
- // //这两个是与随机位置的范围相关的
6
- // const maxdanmakuWidth = 150;
7
- // const maxdanmakuHeight = 100;
8
- // //每个弹幕的间隔时间
9
- // const danmakuTime = 1000;
10
- // //我用的是Vercel部署,这里链接就是Vercel的链接,腾讯云的自己琢磨一下哈,应该也差不多
11
- // const twikooUrl = "https://tkapi.yisous.xyz";
12
- // //token要手动获取(反正我是开发者工具里获取的,教程在下面
13
- // const accessToken = "1059857c25a2ce9fba9cff298f4f33ee";
14
- // const pageUrl = "/messageboard/"
15
-
16
- // //同屏密度限制
17
- // const maxdanmaku=25;
18
-
19
- // const danmakuTimer = [];
20
- // let danmakuList = [];
21
- // let danmakuIndex = 0;
22
-
23
- // function getStyle(obj,name){
24
- // if(window.getComputedStyle){
25
- // return getComputedStyle(obj,null)[name];
26
- // }else{
27
- // return obj.currentStyle[name];
28
- // }
29
- // }
30
-
31
- // const danmakuDom = document.getElementById('danmaku-container');
32
- // window.addEventListener('load',()=>{
33
-
34
- // var data = JSON.stringify({
35
- // "event": "COMMENT_GET",
36
- // "accessToken": accessToken,
37
- // "url": pageUrl
38
- // });
39
-
40
- // var xhr = new XMLHttpRequest();
41
- // xhr.withCredentials = true;
42
-
43
- // xhr.addEventListener("readystatechange", function() {
44
- // if(this.readyState === 4) {
45
- // danmakuList = linkFilter(JSON.parse(this.responseText).data);
46
- // danmakuDom.innerHTML = '';
47
- // }
48
- // });
49
-
50
- // xhr.open("POST", twikooUrl);
51
- // xhr.setRequestHeader("Content-Type", "application/json");
52
-
53
- // xhr.send(data);
54
-
55
- // setInterval(()=>{
56
- // if(danmakuList.length){
57
- // popdanmaku(danmakuList[danmakuIndex]);
58
- // danmakuIndex += 1;
59
- // danmakuIndex %= danmakuList.length;
60
- // }
61
-
62
- // if(danmakuTimer.length > (danmakuList.length > maxdanmaku?maxdanmaku:danmakuList.length)){
63
- // removedanmaku(danmakuTimer.shift())
64
- // }
65
- // },danmakuTime)
66
- // })
67
-
68
-
69
-
70
-
71
-
72
- // function toggleDanmaku(){
73
- // $("#danmaku-container").toggle()
74
- // }
75
- // function linkFilter(data){
76
- // const newData = data.filter((comment)=>{
77
- // return !comment.master;
78
- // })
79
- // return newData;
80
- // }
81
- // function popdanmaku(data){
82
- // let danmaku = document.createElement('div');
83
- // let width = danmakuDom.clientWidth;
84
- // let height = danmakuDom.clientHeight;
85
- // danmaku.className = 'danmaku'
86
- // danmaku.style.top = Math.floor(Math.random()*(height - maxdanmakuHeight))+'px';
87
- // danmaku.style.left = width+'px';
88
- // let ran = Math.floor(Math.random()*danmakuColors.length)
89
- // danmaku.style.background = danmakuColors[ran][0];
90
- // danmaku.style.color = danmakuColors[ran][1];
91
- // danmaku.innerHTML = `
92
- // <div class="danmakuHead">
93
- // <div class="danmakuNick">${data.nick}</div>
94
- // <img class="danmakuAvatar" src="https://cravatar.cn/avatar/${data.mailMd5}"/>
95
- // </div>
96
- // <div class="danmakuContent">${data.comment}</div>
97
- // `
98
- // danmakuTimer.push(danmaku);
99
- // danmakuDom.append(danmaku);
100
- // setTimeout(()=>{
101
- // danmaku.style.left=-(danmaku.clientWidth*3+500).toString()+"px";
102
- // setTimeout(()=>{
103
- // danmaku.style.left=-(danmaku.clientWidth*3+500).toString()+"px";
104
- // },15000)
105
- // },50)
106
- // }