q78kgblog 0.0.0-1732620341025 → 0.0.0-1732800108145

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 (146) hide show
  1. package/404.html +933 -1
  2. package/about/index.html +1085 -1
  3. package/archives/2023/02/index.html +933 -1
  4. package/archives/2023/04/index.html +933 -1
  5. package/archives/2023/05/index.html +933 -1
  6. package/archives/2023/08/index.html +933 -1
  7. package/archives/2023/09/index.html +933 -1
  8. package/archives/2023/index.html +933 -1
  9. package/archives/2024/01/index.html +933 -1
  10. package/archives/2024/02/index.html +933 -1
  11. package/archives/2024/11/index.html +933 -1
  12. package/archives/2024/index.html +933 -1
  13. package/archives/index.html +933 -1
  14. package/archives/page/2/index.html +933 -1
  15. package/assets/css/APlayer.min.css +3 -1
  16. package/assets/js/APlayer.min.js +2 -154
  17. package/assets/js/Meting.min.js +1 -3
  18. package/atom.xml +12 -12
  19. package/baidusitemap.xml +13 -13
  20. package/bangumis/index.html +1055 -1
  21. package/bigpie/index.html +705 -1
  22. package/categories/Hexo/index.html +945 -1
  23. package/categories/index.html +701 -1
  24. package/categories//345/271/264/347/273/210/346/200/273/347/273/223/index.html +945 -1
  25. package/categories//346/212/200/346/234/257/345/210/206/344/272/253/index.html +945 -1
  26. package/categories//347/264/240/346/235/220/index.html +945 -1
  27. package/categories//351/227/262/350/201/212/346/235/202/350/260/210/index.html +945 -1
  28. package/content.json +1 -1
  29. package/css/swiper.min.css +703 -1
  30. package/fcircle/index.html +724 -1
  31. package/fontawesome/index.html +707 -1
  32. package/index.html +1085 -1
  33. package/js/aplayersave.js +1 -1
  34. package/js/baiduhistory.js +1 -1
  35. package/js/browser.js +1 -1
  36. package/js/calendar.js +1 -1
  37. package/js/cate.js +1 -1
  38. package/js/commentBarrage.js +13 -13
  39. package/js/commentsCount.js +1 -1
  40. package/js/copy.js +1 -1
  41. package/js/countup.js +1 -1
  42. package/js/cursor.js +1 -1
  43. package/js/day.js +2 -2
  44. package/js/dianzan.js +1 -1
  45. package/js/dis.js +3 -3
  46. package/js/fixbugpjax.js +1 -1
  47. package/js/fixed_card_widget.js +1 -1
  48. package/js/fps.js +1 -1
  49. package/js/gitalker.js +1 -1
  50. package/js/gsap.min.js +4 -1
  51. package/js/heimu.js +1 -1
  52. package/js/hide.show.js +1 -1
  53. package/js/languages.js +1 -1
  54. package/js/latest.js +1 -1
  55. package/js/local-search.js +2 -2
  56. package/js/lunar.js +1 -1
  57. package/js/lyxTalk.js +1 -1
  58. package/js/main.js +2 -2
  59. package/js/nav.js +1 -1
  60. package/js/noie.js +1 -1
  61. package/js/owo.js +1 -1
  62. package/js/people.js +2 -2
  63. package/js/pikaday.js +109 -1
  64. package/js/random.js +1 -1
  65. package/js/randomFriend.js +1 -1
  66. package/js/resizeTop.js +1 -1
  67. package/js/rightmenu.js +3 -3
  68. package/js/sakura.js +1 -1
  69. package/js/search/algolia.js +4 -4
  70. package/js/search/local-search.js +1 -1
  71. package/js/settings.js +2 -2
  72. package/js/sitetime.js +1 -1
  73. package/js/smooth-scrolling.js +1 -1
  74. package/js/sw-toolbox.js +1 -1
  75. package/js/swiperinit.js +1 -1
  76. package/js/tw_cn.js +1 -1
  77. package/js/utils.js +1 -1
  78. package/js/welcome.js +1 -1
  79. package/js/welcomeconsole.js +1 -1
  80. package/links/index.html +932 -1
  81. package/live2d-widget/autoload.js +63 -19
  82. package/live2d-widget/demo/demo.html +34 -1
  83. package/live2d-widget/demo/login.html +271 -1
  84. package/live2d-widget/live2d.min.js +1 -45
  85. package/live2d-widget/rollup.config.js +35 -2
  86. package/live2d-widget/src/index.js +175 -4
  87. package/live2d-widget/src/message.js +22 -1
  88. package/live2d-widget/src/model.js +75 -1
  89. package/live2d-widget/src/tools.js +78 -1
  90. package/live2d-widget/src/utils.js +5 -1
  91. package/live2d-widget/src/waifu-tips.js +3 -1
  92. package/live2d-widget/waifu-tips.js +2 -7
  93. package/live2d-widget/waifu.css +310 -1
  94. package/noie.html +69 -1
  95. package/othersite/index.html +770 -1
  96. package/package.json +1 -1
  97. package/people.html +24 -1
  98. package/posts/164ef646/index.html +1018 -1
  99. package/posts/1ee472c8/index.html +1006 -1
  100. package/posts/228c2ef8/index.html +1005 -1
  101. package/posts/2b89093e/index.html +1003 -1
  102. package/posts/a9a6c1fb/index.html +1032 -1
  103. package/posts/ad884987/index.html +1005 -1
  104. package/posts/c262e439/index.html +993 -1
  105. package/posts/c81531cf/index.html +1071 -1
  106. package/posts/ce5471fd/index.html +993 -1
  107. package/posts/de1f83f4/index.html +1061 -1
  108. package/posts/e54f7476/index.html +1053 -1
  109. package/random.html +30 -1
  110. package/sitemap.txt +5 -5
  111. package/sitemap.xml +69 -69
  112. package/sw.js +2 -2
  113. package/swReg.js +1 -1
  114. package/tags/AI/index.html +946 -1
  115. package/tags/Abbrlink/index.html +946 -1
  116. package/tags/Butterfly/index.html +946 -1
  117. package/tags/Cloudflare/index.html +946 -1
  118. package/tags/DiffSinger/index.html +946 -1
  119. package/tags/Hexo/index.html +946 -1
  120. package/tags/Markdown/index.html +946 -1
  121. package/tags/Next/index.html +946 -1
  122. package/tags/Obsidian/index.html +946 -1
  123. package/tags/RAID/index.html +946 -1
  124. package/tags/Vercel/index.html +946 -1
  125. package/tags/Workers/index.html +946 -1
  126. package/tags/index.html +701 -1
  127. package/tags//344/270/273/351/242/230/index.html +946 -1
  128. package/tags//345/206/231/344/275/234/index.html +946 -1
  129. package/tags//345/245/263/346/200/247/346/204/217/350/257/206/index.html +946 -1
  130. package/tags//345/255/246/344/271/240/index.html +946 -1
  131. package/tags//345/256/266/351/207/214/344/272/221/index.html +946 -1
  132. package/tags//345/271/264/347/273/210/346/200/273/347/273/223/index.html +946 -1
  133. package/tags//346/212/230/350/205/276/index.html +946 -1
  134. package/tags//346/227/245/345/270/270/index.html +946 -1
  135. package/tags//346/234/215/345/212/241/345/231/250/index.html +946 -1
  136. package/tags//346/260/270/344/271/205/351/223/276/346/216/245/index.html +946 -1
  137. package/tags//346/265/252/346/275/256/index.html +946 -1
  138. package/tags//347/237/255/351/223/276/346/216/245/index.html +946 -1
  139. package/tags//347/256/200/347/210/261/index.html +946 -1
  140. package/tags//347/274/226/350/276/221/345/231/250/index.html +946 -1
  141. package/tags//350/207/252/345/212/250/346/240/207/346/263/250/index.html +946 -1
  142. package/tags//350/256/272/346/226/207/index.html +946 -1
  143. package/tags//350/260/267/346/255/214/347/277/273/350/257/221/index.html +946 -1
  144. package/tags//350/264/237/350/275/275/345/235/207/350/241/241/index.html +946 -1
  145. package/tags//351/207/221/345/217/245/index.html +946 -1
  146. package/tags//351/255/224/346/224/271/index.html +946 -1
@@ -1,5 +1,38 @@
1
- (function(e,n){typeof module=="object"&&typeof module.exports=="object"?n(exports,require("@rollup/plugin-node-resolve"),require("@rollup/pluginutils")):typeof define=="function"&&define.amd?define(["exports","@rollup/plugin-node-resolve","@rollup/pluginutils"],n):(e=typeof globalThis<"u"?globalThis:e||self)&&n(e.rollupConfig={},e.pluginNodeResolve,e.pluginutils)})(this,function(e,n,r){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});function o(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!t.include)throw Error("include option should be specified");var s=(0,r.createFilter)(t.include,t.exclude);return{name:"string",transform:function(i,u){if(s(u))return{code:"export default ".concat(JSON.stringify(i),";"),map:{mappings:""}}},renderChunk:function(i,u){var p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return`/*!
1
+ import { nodeResolve } from "@rollup/plugin-node-resolve";
2
+ import { createFilter } from "@rollup/pluginutils";
3
+
4
+ function string(opts = {}) {
5
+ if (!opts.include) {
6
+ throw Error("include option should be specified");
7
+ }
8
+
9
+ const filter = createFilter(opts.include, opts.exclude);
10
+
11
+ return {
12
+ name: "string",
13
+
14
+ transform(code, id) {
15
+ if (filter(id)) {
16
+ return {
17
+ code: `export default ${JSON.stringify(code)};`,
18
+ map: { mappings: "" }
19
+ };
20
+ }
21
+ },
22
+
23
+ renderChunk(code, chunk, outputOptions = {}) {
24
+ return `/*!
2
25
  * Live2D Widget
3
26
  * https://github.com/stevenjoezhang/live2d-widget
4
27
  */
5
- `+i}}}var l={input:"src/waifu-tips.js",plugins:[(0,n.nodeResolve)(),o({include:"**/*.svg"})]}});
28
+ ` + code;
29
+ }
30
+ };
31
+ }
32
+
33
+ export default {
34
+ input: "src/waifu-tips.js",
35
+ plugins: [nodeResolve(), string({
36
+ include: "**/*.svg",
37
+ })]
38
+ };
@@ -1,7 +1,178 @@
1
- (function(f,p){typeof module=="object"&&typeof module.exports=="object"?p(exports,require("./model.js"),require("./message.js"),require("./utils.js"),require("./tools.js")):typeof define=="function"&&define.amd?define(["exports","./model.js","./message.js","./utils.js","./tools.js"],p):(f=typeof globalThis<"u"?globalThis:f||self)&&p(f.index={},f.modelJs,f.messageJs,f.utilsJs,f.toolsJs)})(this,function(f,p,v,E,I){Object.defineProperty(f,"__esModule",{value:!0}),Object.defineProperty(f,"default",{enumerable:!0,get:function(){return S}}),p=j(p),v=j(v),E=j(E),I=j(I);function j(e){return e&&e.__esModule?e:{default:e}}function T(e){var L=new p.default(e);localStorage.removeItem("waifu-display"),sessionStorage.removeItem("waifu-text"),document.body.insertAdjacentHTML("beforeend",`<div id="waifu">
1
+ import Model from "./model.js";
2
+ import showMessage from "./message.js";
3
+ import randomSelection from "./utils.js";
4
+ import tools from "./tools.js";
5
+
6
+ function loadWidget(config) {
7
+ const model = new Model(config);
8
+ localStorage.removeItem("waifu-display");
9
+ sessionStorage.removeItem("waifu-text");
10
+ document.body.insertAdjacentHTML("beforeend", `<div id="waifu">
2
11
  <div id="waifu-tips"></div>
3
12
  <canvas id="live2d" width="800" height="800"></canvas>
4
13
  <div id="waifu-tool"></div>
5
- </div>`),setTimeout(function(){document.getElementById("waifu").style.bottom=0},0),function(){I.default["switch-model"].callback=function(){return L.loadOtherModel()},I.default["switch-texture"].callback=function(){return L.loadRandModel()},Array.isArray(e.tools)||(e.tools=Object.keys(I.default));var t=!0,l=!1,s=void 0;try{for(var c=e.tools[Symbol.iterator](),h;!(t=(h=c.next()).done);t=!0){var n=h.value;if(I.default[n]){var r=I.default[n],o=r.icon,i=r.callback;document.getElementById("waifu-tool").insertAdjacentHTML("beforeend",'<span id="waifu-tool-'.concat(n,'">').concat(o,"</span>")),document.getElementById("waifu-tool-".concat(n)).addEventListener("click",i)}}}catch(a){l=!0,s=a}finally{try{!t&&c.return!=null&&c.return()}finally{if(l)throw s}}}();function g(d){if(location.pathname==="/"){var t=!0,l=!1,s=void 0;try{for(var c=d[Symbol.iterator](),h;!(t=(h=c.next()).done);t=!0){var n=h.value,r=n.hour,o=n.text,i=new Date,a=r.split("-")[0],m=r.split("-")[1]||a;if(a<=i.getHours()&&i.getHours()<=m)return o}}catch(k){l=!0,s=k}finally{try{!t&&c.return!=null&&c.return()}finally{if(l)throw s}}}var y="\u6B22\u8FCE\u9605\u8BFB<span>\u300C".concat(document.title.split(" - ")[0],"\u300D</span>"),w;if(document.referrer!==""){var u=new URL(document.referrer),b=u.hostname.split(".")[1],x={baidu:"\u767E\u5EA6",so:"360\u641C\u7D22",google:"\u8C37\u6B4C\u641C\u7D22"};return location.hostname===u.hostname?y:(b in x?w=x[b]:w=u.hostname,"Hello\uFF01\u6765\u81EA <span>".concat(w,"</span> \u7684\u670B\u53CB<br>").concat(y))}return y}function A(d){var t=!1,l,s=d.message.default,c;window.addEventListener("mousemove",function(){return t=!0}),window.addEventListener("keydown",function(){return t=!0}),setInterval(function(){t?(t=!1,clearInterval(l),l=null):l||(l=setInterval(function(){(0,v.default)(s,6e3,9)},2e4))},1e3),(0,v.default)(g(d.time),7e3,11),window.addEventListener("mouseover",function(n){var r=!0,o=!1,i=void 0;try{for(var a=d.mouseover[Symbol.iterator](),m;!(r=(m=a.next()).done);r=!0){var y=m.value,w=y.selector,u=y.text;if(n.target.closest(w)){if(c===w)return;c=w,u=(0,E.default)(u),u=u.replace("{text}",n.target.innerText),(0,v.default)(u,4e3,8);return}}}catch(b){o=!0,i=b}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw i}}}),window.addEventListener("click",function(n){var r=!0,o=!1,i=void 0;try{for(var a=d.click[Symbol.iterator](),m;!(r=(m=a.next()).done);r=!0){var y=m.value,w=y.selector,u=y.text;if(n.target.closest(w)){u=(0,E.default)(u),u=u.replace("{text}",n.target.innerText),(0,v.default)(u,4e3,8);return}}}catch(b){o=!0,i=b}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw i}}}),d.seasons.forEach(function(n){var r=n.date,o=n.text,i=new Date,a=r.split("-")[0],m=r.split("-")[1]||a;a.split("/")[0]<=i.getMonth()+1&&i.getMonth()+1<=m.split("/")[0]&&a.split("/")[1]<=i.getDate()&&i.getDate()<=m.split("/")[1]&&(o=(0,E.default)(o),o=o.replace("{year}",i.getFullYear()),s.push(o))});var h=function(){};console.log("%c",h),h.toString=function(){(0,v.default)(d.message.console,6e3,9)},window.addEventListener("copy",function(){(0,v.default)(d.message.copy,6e3,9)}),window.addEventListener("visibilitychange",function(){document.hidden||(0,v.default)(d.message.visibilitychange,6e3,9)})}(function(){var t=localStorage.getItem("modelId"),l=localStorage.getItem("modelTexturesId");t===null&&(t=1,l=53),L.loadModel(t,l),fetch(e.waifuPath).then(function(s){return s.json()}).then(A)})()}function M(e,L){typeof e=="string"&&(e={waifuPath:e,apiPath:L}),document.body.insertAdjacentHTML("beforeend",`<div id="waifu-toggle">
6
- <span>\u770B\u677F\u5A18</span>
7
- </div>`);var g=document.getElementById("waifu-toggle");g.addEventListener("click",function(){g.classList.remove("waifu-toggle-active"),g.getAttribute("first-time")?(T(e),g.removeAttribute("first-time")):(localStorage.removeItem("waifu-display"),document.getElementById("waifu").style.display="",setTimeout(function(){document.getElementById("waifu").style.bottom=0},0))}),localStorage.getItem("waifu-display")&&Date.now()-localStorage.getItem("waifu-display")<=864e5?(g.setAttribute("first-time",!0),setTimeout(function(){g.classList.add("waifu-toggle-active")},0)):T(e)}var S=M});
14
+ </div>`);
15
+ // https://stackoverflow.com/questions/24148403/trigger-css-transition-on-appended-element
16
+ setTimeout(() => {
17
+ document.getElementById("waifu").style.bottom = 0;
18
+ }, 0);
19
+
20
+ (function registerTools() {
21
+ tools["switch-model"].callback = () => model.loadOtherModel();
22
+ tools["switch-texture"].callback = () => model.loadRandModel();
23
+ if (!Array.isArray(config.tools)) {
24
+ config.tools = Object.keys(tools);
25
+ }
26
+ for (let tool of config.tools) {
27
+ if (tools[tool]) {
28
+ const { icon, callback } = tools[tool];
29
+ document.getElementById("waifu-tool").insertAdjacentHTML("beforeend", `<span id="waifu-tool-${tool}">${icon}</span>`);
30
+ document.getElementById(`waifu-tool-${tool}`).addEventListener("click", callback);
31
+ }
32
+ }
33
+ })();
34
+
35
+ function welcomeMessage(time) {
36
+ if (location.pathname === "/") { // 如果是主页
37
+ for (let { hour, text } of time) {
38
+ const now = new Date(),
39
+ after = hour.split("-")[0],
40
+ before = hour.split("-")[1] || after;
41
+ if (after <= now.getHours() && now.getHours() <= before) {
42
+ return text;
43
+ }
44
+ }
45
+ }
46
+ const text = `欢迎阅读<span>「${document.title.split(" - ")[0]}」</span>`;
47
+ let from;
48
+ if (document.referrer !== "") {
49
+ const referrer = new URL(document.referrer),
50
+ domain = referrer.hostname.split(".")[1];
51
+ const domains = {
52
+ "baidu": "百度",
53
+ "so": "360搜索",
54
+ "google": "谷歌搜索"
55
+ };
56
+ if (location.hostname === referrer.hostname) return text;
57
+
58
+ if (domain in domains) from = domains[domain];
59
+ else from = referrer.hostname;
60
+ return `Hello!来自 <span>${from}</span> 的朋友<br>${text}`;
61
+ }
62
+ return text;
63
+ }
64
+
65
+ function registerEventListener(result) {
66
+ // 检测用户活动状态,并在空闲时显示消息
67
+ let userAction = false,
68
+ userActionTimer,
69
+ messageArray = result.message.default,
70
+ lastHoverElement;
71
+ window.addEventListener("mousemove", () => userAction = true);
72
+ window.addEventListener("keydown", () => userAction = true);
73
+ setInterval(() => {
74
+ if (userAction) {
75
+ userAction = false;
76
+ clearInterval(userActionTimer);
77
+ userActionTimer = null;
78
+ } else if (!userActionTimer) {
79
+ userActionTimer = setInterval(() => {
80
+ showMessage(messageArray, 6000, 9);
81
+ }, 20000);
82
+ }
83
+ }, 1000);
84
+ showMessage(welcomeMessage(result.time), 7000, 11);
85
+ window.addEventListener("mouseover", event => {
86
+ for (let { selector, text } of result.mouseover) {
87
+ if (!event.target.closest(selector)) continue;
88
+ if (lastHoverElement === selector) return;
89
+ lastHoverElement = selector;
90
+ text = randomSelection(text);
91
+ text = text.replace("{text}", event.target.innerText);
92
+ showMessage(text, 4000, 8);
93
+ return;
94
+ }
95
+ });
96
+ window.addEventListener("click", event => {
97
+ for (let { selector, text } of result.click) {
98
+ if (!event.target.closest(selector)) continue;
99
+ text = randomSelection(text);
100
+ text = text.replace("{text}", event.target.innerText);
101
+ showMessage(text, 4000, 8);
102
+ return;
103
+ }
104
+ });
105
+ result.seasons.forEach(({ date, text }) => {
106
+ const now = new Date(),
107
+ after = date.split("-")[0],
108
+ before = date.split("-")[1] || after;
109
+ if ((after.split("/")[0] <= now.getMonth() + 1 && now.getMonth() + 1 <= before.split("/")[0]) && (after.split("/")[1] <= now.getDate() && now.getDate() <= before.split("/")[1])) {
110
+ text = randomSelection(text);
111
+ text = text.replace("{year}", now.getFullYear());
112
+ messageArray.push(text);
113
+ }
114
+ });
115
+
116
+ const devtools = () => { };
117
+ console.log("%c", devtools);
118
+ devtools.toString = () => {
119
+ showMessage(result.message.console, 6000, 9);
120
+ };
121
+ window.addEventListener("copy", () => {
122
+ showMessage(result.message.copy, 6000, 9);
123
+ });
124
+ window.addEventListener("visibilitychange", () => {
125
+ if (!document.hidden) showMessage(result.message.visibilitychange, 6000, 9);
126
+ });
127
+ }
128
+
129
+ (function initModel() {
130
+ let modelId = localStorage.getItem("modelId"),
131
+ modelTexturesId = localStorage.getItem("modelTexturesId");
132
+ if (modelId === null) {
133
+ // 首次访问加载 指定模型 的 指定材质
134
+ modelId = 1; // 模型 ID
135
+ modelTexturesId = 53; // 材质 ID
136
+ }
137
+ model.loadModel(modelId, modelTexturesId);
138
+ fetch(config.waifuPath)
139
+ .then(response => response.json())
140
+ .then(registerEventListener);
141
+ })();
142
+ }
143
+
144
+ function initWidget(config, apiPath) {
145
+ if (typeof config === "string") {
146
+ config = {
147
+ waifuPath: config,
148
+ apiPath
149
+ };
150
+ }
151
+ document.body.insertAdjacentHTML("beforeend", `<div id="waifu-toggle">
152
+ <span>看板娘</span>
153
+ </div>`);
154
+ const toggle = document.getElementById("waifu-toggle");
155
+ toggle.addEventListener("click", () => {
156
+ toggle.classList.remove("waifu-toggle-active");
157
+ if (toggle.getAttribute("first-time")) {
158
+ loadWidget(config);
159
+ toggle.removeAttribute("first-time");
160
+ } else {
161
+ localStorage.removeItem("waifu-display");
162
+ document.getElementById("waifu").style.display = "";
163
+ setTimeout(() => {
164
+ document.getElementById("waifu").style.bottom = 0;
165
+ }, 0);
166
+ }
167
+ });
168
+ if (localStorage.getItem("waifu-display") && Date.now() - localStorage.getItem("waifu-display") <= 86400000) {
169
+ toggle.setAttribute("first-time", true);
170
+ setTimeout(() => {
171
+ toggle.classList.add("waifu-toggle-active");
172
+ }, 0);
173
+ } else {
174
+ loadWidget(config);
175
+ }
176
+ }
177
+
178
+ export default initWidget;
@@ -1 +1,22 @@
1
- (function(t,i){typeof module=="object"&&typeof module.exports=="object"?i(exports,require("./utils.js")):typeof define=="function"&&define.amd?define(["exports","./utils.js"],i):(t=typeof globalThis<"u"?globalThis:t||self)&&i(t.message={},t.utilsJs)})(this,function(t,i){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}}),i=f(i);function f(e){return e&&e.__esModule?e:{default:e}}var s;function o(e,r,n){if(!(!e||sessionStorage.getItem("waifu-text")&&sessionStorage.getItem("waifu-text")>n)){s&&(clearTimeout(s),s=null),e=(0,i.default)(e),sessionStorage.setItem("waifu-text",n);var u=document.getElementById("waifu-tips");u.innerHTML=e,u.classList.add("waifu-tips-active"),s=setTimeout(function(){sessionStorage.removeItem("waifu-text"),u.classList.remove("waifu-tips-active")},r)}}var a=o});
1
+ import randomSelection from "./utils.js";
2
+
3
+ let messageTimer;
4
+
5
+ function showMessage(text, timeout, priority) {
6
+ if (!text || (sessionStorage.getItem("waifu-text") && sessionStorage.getItem("waifu-text") > priority)) return;
7
+ if (messageTimer) {
8
+ clearTimeout(messageTimer);
9
+ messageTimer = null;
10
+ }
11
+ text = randomSelection(text);
12
+ sessionStorage.setItem("waifu-text", priority);
13
+ const tips = document.getElementById("waifu-tips");
14
+ tips.innerHTML = text;
15
+ tips.classList.add("waifu-tips-active");
16
+ messageTimer = setTimeout(() => {
17
+ sessionStorage.removeItem("waifu-text");
18
+ tips.classList.remove("waifu-tips-active");
19
+ }, timeout);
20
+ }
21
+
22
+ export default showMessage;
@@ -1 +1,75 @@
1
- (function(s,c){typeof module=="object"&&typeof module.exports=="object"?c(exports,require("./message.js"),require("./utils.js")):typeof define=="function"&&define.amd?define(["exports","./message.js","./utils.js"],c):(s=typeof globalThis<"u"?globalThis:s||self)&&c(s.model={},s.messageJs,s.utilsJs)})(this,function(s,c,f){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return x}}),c=g(c),f=g(f);function b(i,o,n,t,e,l,r){try{var u=i[l](r),d=u.value}catch(a){n(a);return}u.done?o(d):Promise.resolve(d).then(t,e)}function h(i){return function(){var o=this,n=arguments;return new Promise(function(t,e){var l=i.apply(o,n);function r(d){b(l,t,e,r,u,"next",d)}function u(d){b(l,t,e,r,u,"throw",d)}r(void 0)})}}function w(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}function y(i,o){for(var n=0;n<o.length;n++){var t=o[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,t.key,t)}}function M(i,o,n){return o&&y(i.prototype,o),n&&y(i,n),i}function g(i){return i&&i.__esModule?i:{default:i}}function m(i,o){var n,t,e,l,r={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]};return l={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function u(a){return function(v){return d([a,v])}}function d(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,t&&(e=a[0]&2?t.return:a[0]?t.throw||((e=t.return)&&e.call(t),0):t.next)&&!(e=e.call(t,a[1])).done)return e;switch(t=0,e&&(a=[a[0]&2,e.value]),a[0]){case 0:case 1:e=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,t=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(e=r.trys,!(e=e.length>0&&e[e.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!e||a[1]>e[0]&&a[1]<e[3])){r.label=a[1];break}if(a[0]===6&&r.label<e[1]){r.label=e[1],e=a;break}if(e&&r.label<e[2]){r.label=e[2],r.ops.push(a);break}e[2]&&r.ops.pop(),r.trys.pop();continue}a=o.call(i,r)}catch(v){a=[6,v],t=0}finally{n=e=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}var P=function(){"use strict";function i(o){w(this,i);var n=o.apiPath,t=o.cdnPath,e=!1;if(typeof t=="string")e=!0,t.endsWith("/")||(t+="/");else if(typeof n=="string")n.endsWith("/")||(n+="/");else throw"Invalid initWidget argument!";this.useCDN=e,this.apiPath=n,this.cdnPath=t}return M(i,[{key:"loadModelList",value:function(){var n=this;return h(function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,fetch("".concat(n.cdnPath,"model_list.json"))];case 1:return t=e.sent(),[4,t.json()];case 2:return n.modelList=e.sent(),[2]}})})()}},{key:"loadModel",value:function(n,t,e){var l=this;return h(function(){var r;return m(this,function(u){switch(u.label){case 0:return localStorage.setItem("modelId",n),localStorage.setItem("modelTexturesId",t),(0,c.default)(e,4e3,10),l.useCDN?l.modelList?[3,2]:[4,l.loadModelList()]:[3,3];case 1:u.sent(),u.label=2;case 2:return r=(0,f.default)(l.modelList.models[n]),loadlive2d("live2d","".concat(l.cdnPath,"model/").concat(r,"/index.json")),[3,4];case 3:loadlive2d("live2d","".concat(l.apiPath,"get/?id=").concat(n,"-").concat(t)),console.log("Live2D \u6A21\u578B ".concat(n,"-").concat(t," \u52A0\u8F7D\u5B8C\u6210")),u.label=4;case 4:return[2]}})})()}},{key:"loadRandModel",value:function(){var n=this;return h(function(){var t,e,l;return m(this,function(r){switch(r.label){case 0:return t=localStorage.getItem("modelId"),e=localStorage.getItem("modelTexturesId"),n.useCDN?n.modelList?[3,2]:[4,n.loadModelList()]:[3,3];case 1:r.sent(),r.label=2;case 2:return l=(0,f.default)(n.modelList.models[t]),loadlive2d("live2d","".concat(n.cdnPath,"model/").concat(l,"/index.json")),(0,c.default)("\u6211\u7684\u65B0\u8863\u670D\u597D\u770B\u561B\uFF1F",4e3,10),[3,4];case 3:fetch("".concat(n.apiPath,"rand_textures/?id=").concat(t,"-").concat(e)).then(function(u){return u.json()}).then(function(u){u.textures.id===1&&(e===1||e===0)?(0,c.default)("\u6211\u8FD8\u6CA1\u6709\u5176\u4ED6\u8863\u670D\u5462\uFF01",4e3,10):n.loadModel(t,u.textures.id,"\u6211\u7684\u65B0\u8863\u670D\u597D\u770B\u561B\uFF1F")}),r.label=4;case 4:return[2]}})})()}},{key:"loadOtherModel",value:function(){var n=this;return h(function(){var t,e;return m(this,function(l){switch(l.label){case 0:return t=localStorage.getItem("modelId"),n.useCDN?n.modelList?[3,2]:[4,n.loadModelList()]:[3,3];case 1:l.sent(),l.label=2;case 2:return e=++t>=n.modelList.models.length?0:t,n.loadModel(e,0,n.modelList.messages[e]),[3,4];case 3:fetch("".concat(n.apiPath,"switch/?id=").concat(t)).then(function(r){return r.json()}).then(function(r){n.loadModel(r.model.id,0,r.model.message)}),l.label=4;case 4:return[2]}})})()}}]),i}(),x=P});
1
+ import showMessage from "./message.js";
2
+ import randomSelection from "./utils.js";
3
+
4
+ class Model {
5
+ constructor(config) {
6
+ let { apiPath, cdnPath } = config;
7
+ let useCDN = false;
8
+ if (typeof cdnPath === "string") {
9
+ useCDN = true;
10
+ if (!cdnPath.endsWith("/")) cdnPath += "/";
11
+ } else if (typeof apiPath === "string") {
12
+ if (!apiPath.endsWith("/")) apiPath += "/";
13
+ } else {
14
+ throw "Invalid initWidget argument!";
15
+ }
16
+ this.useCDN = useCDN;
17
+ this.apiPath = apiPath;
18
+ this.cdnPath = cdnPath;
19
+ }
20
+
21
+ async loadModelList() {
22
+ const response = await fetch(`${this.cdnPath}model_list.json`);
23
+ this.modelList = await response.json();
24
+ }
25
+
26
+ async loadModel(modelId, modelTexturesId, message) {
27
+ localStorage.setItem("modelId", modelId);
28
+ localStorage.setItem("modelTexturesId", modelTexturesId);
29
+ showMessage(message, 4000, 10);
30
+ if (this.useCDN) {
31
+ if (!this.modelList) await this.loadModelList();
32
+ const target = randomSelection(this.modelList.models[modelId]);
33
+ loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
34
+ } else {
35
+ loadlive2d("live2d", `${this.apiPath}get/?id=${modelId}-${modelTexturesId}`);
36
+ console.log(`Live2D 模型 ${modelId}-${modelTexturesId} 加载完成`);
37
+ }
38
+ }
39
+
40
+ async loadRandModel() {
41
+ const modelId = localStorage.getItem("modelId"),
42
+ modelTexturesId = localStorage.getItem("modelTexturesId");
43
+ if (this.useCDN) {
44
+ if (!this.modelList) await this.loadModelList();
45
+ const target = randomSelection(this.modelList.models[modelId]);
46
+ loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
47
+ showMessage("我的新衣服好看嘛?", 4000, 10);
48
+ } else {
49
+ // 可选 "rand"(随机), "switch"(顺序)
50
+ fetch(`${this.apiPath}rand_textures/?id=${modelId}-${modelTexturesId}`)
51
+ .then(response => response.json())
52
+ .then(result => {
53
+ if (result.textures.id === 1 && (modelTexturesId === 1 || modelTexturesId === 0)) showMessage("我还没有其他衣服呢!", 4000, 10);
54
+ else this.loadModel(modelId, result.textures.id, "我的新衣服好看嘛?");
55
+ });
56
+ }
57
+ }
58
+
59
+ async loadOtherModel() {
60
+ let modelId = localStorage.getItem("modelId");
61
+ if (this.useCDN) {
62
+ if (!this.modelList) await this.loadModelList();
63
+ const index = (++modelId >= this.modelList.models.length) ? 0 : modelId;
64
+ this.loadModel(index, 0, this.modelList.messages[index]);
65
+ } else {
66
+ fetch(`${this.apiPath}switch/?id=${modelId}`)
67
+ .then(response => response.json())
68
+ .then(result => {
69
+ this.loadModel(result.model.id, 0, result.model.message);
70
+ });
71
+ }
72
+ }
73
+ }
74
+
75
+ export default Model;
@@ -1 +1,78 @@
1
- (function(e,s){typeof module=="object"&&typeof module.exports=="object"?s(exports,require("@fortawesome/fontawesome-free/svgs/solid/comment.svg"),require("@fortawesome/fontawesome-free/svgs/solid/paper-plane.svg"),require("@fortawesome/fontawesome-free/svgs/solid/circle-user.svg"),require("@fortawesome/fontawesome-free/svgs/solid/street-view.svg"),require("@fortawesome/fontawesome-free/svgs/solid/camera-retro.svg"),require("@fortawesome/fontawesome-free/svgs/solid/circle-info.svg"),require("@fortawesome/fontawesome-free/svgs/solid/xmark.svg"),require("./message.js")):typeof define=="function"&&define.amd?define(["exports","@fortawesome/fontawesome-free/svgs/solid/comment.svg","@fortawesome/fontawesome-free/svgs/solid/paper-plane.svg","@fortawesome/fontawesome-free/svgs/solid/circle-user.svg","@fortawesome/fontawesome-free/svgs/solid/street-view.svg","@fortawesome/fontawesome-free/svgs/solid/camera-retro.svg","@fortawesome/fontawesome-free/svgs/solid/circle-info.svg","@fortawesome/fontawesome-free/svgs/solid/xmark.svg","./message.js"],s):(e=typeof globalThis<"u"?globalThis:e||self)&&s(e.tools={},e.commentSvg,e.paperPlaneSvg,e.circleUserSvg,e.streetViewSvg,e.cameraRetroSvg,e.circleInfoSvg,e.xmarkSvg,e.messageJs)})(this,function(e,s,i,f,a,r,d,u,n){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return m}}),s=t(s),i=t(i),f=t(f),a=t(a),r=t(r),d=t(d),u=t(u),n=t(n);function t(o){return o&&o.__esModule?o:{default:o}}function c(){fetch("https://v1.hitokoto.cn").then(function(o){return o.json()}).then(function(o){var w="\u8FD9\u53E5\u4E00\u8A00\u6765\u81EA <span>\u300C".concat(o.from,"\u300D</span>\uFF0C\u662F <span>").concat(o.creator,"</span> \u5728 hitokoto.cn \u6295\u7A3F\u7684\u3002");(0,n.default)(o.hitokoto,6e3,9),setTimeout(function(){(0,n.default)(w,4e3,9)},6e3)})}var l={hitokoto:{icon:s.default,callback:c},asteroids:{icon:i.default,callback:function(){if(window.Asteroids)window.ASTEROIDSPLAYERS||(window.ASTEROIDSPLAYERS=[]),window.ASTEROIDSPLAYERS.push(new Asteroids);else{var o=document.createElement("script");o.src="https://fastly.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js",document.head.appendChild(o)}}},"switch-model":{icon:f.default,callback:function(){}},"switch-texture":{icon:a.default,callback:function(){}},photo:{icon:r.default,callback:function(){(0,n.default)("\u7167\u597D\u4E86\u561B\uFF0C\u662F\u4E0D\u662F\u5F88\u53EF\u7231\u5462\uFF1F",6e3,9),Live2D.captureName="photo.png",Live2D.captureFrame=!0}},info:{icon:d.default,callback:function(){open("https://github.com/stevenjoezhang/live2d-widget")}},quit:{icon:u.default,callback:function(){localStorage.setItem("waifu-display",Date.now()),(0,n.default)("\u613F\u4F60\u6709\u4E00\u5929\u80FD\u4E0E\u91CD\u8981\u7684\u4EBA\u91CD\u9022\u3002",2e3,11),document.getElementById("waifu").style.bottom="-500px",setTimeout(function(){document.getElementById("waifu").style.display="none",document.getElementById("waifu-toggle").classList.add("waifu-toggle-active")},3e3)}}},m=l});
1
+ import fa_comment from "@fortawesome/fontawesome-free/svgs/solid/comment.svg";
2
+ import fa_paper_plane from "@fortawesome/fontawesome-free/svgs/solid/paper-plane.svg";
3
+ import fa_user_circle from "@fortawesome/fontawesome-free/svgs/solid/circle-user.svg";
4
+ import fa_street_view from "@fortawesome/fontawesome-free/svgs/solid/street-view.svg";
5
+ import fa_camera_retro from "@fortawesome/fontawesome-free/svgs/solid/camera-retro.svg";
6
+ import fa_info_circle from "@fortawesome/fontawesome-free/svgs/solid/circle-info.svg";
7
+ import fa_xmark from "@fortawesome/fontawesome-free/svgs/solid/xmark.svg";
8
+
9
+ import showMessage from "./message.js";
10
+
11
+ function showHitokoto() {
12
+ // 增加 hitokoto.cn 的 API
13
+ fetch("https://v1.hitokoto.cn")
14
+ .then(response => response.json())
15
+ .then(result => {
16
+ const text = `这句一言来自 <span>「${result.from}」</span>,是 <span>${result.creator}</span> 在 hitokoto.cn 投稿的。`;
17
+ showMessage(result.hitokoto, 6000, 9);
18
+ setTimeout(() => {
19
+ showMessage(text, 4000, 9);
20
+ }, 6000);
21
+ });
22
+ }
23
+
24
+ const tools = {
25
+ "hitokoto": {
26
+ icon: fa_comment,
27
+ callback: showHitokoto
28
+ },
29
+ "asteroids": {
30
+ icon: fa_paper_plane,
31
+ callback: () => {
32
+ if (window.Asteroids) {
33
+ if (!window.ASTEROIDSPLAYERS) window.ASTEROIDSPLAYERS = [];
34
+ window.ASTEROIDSPLAYERS.push(new Asteroids());
35
+ } else {
36
+ const script = document.createElement("script");
37
+ script.src = "https://fastly.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js";
38
+ document.head.appendChild(script);
39
+ }
40
+ }
41
+ },
42
+ "switch-model": {
43
+ icon: fa_user_circle,
44
+ callback: () => {}
45
+ },
46
+ "switch-texture": {
47
+ icon: fa_street_view,
48
+ callback: () => {}
49
+ },
50
+ "photo": {
51
+ icon: fa_camera_retro,
52
+ callback: () => {
53
+ showMessage("照好了嘛,是不是很可爱呢?", 6000, 9);
54
+ Live2D.captureName = "photo.png";
55
+ Live2D.captureFrame = true;
56
+ }
57
+ },
58
+ "info": {
59
+ icon: fa_info_circle,
60
+ callback: () => {
61
+ open("https://github.com/stevenjoezhang/live2d-widget");
62
+ }
63
+ },
64
+ "quit": {
65
+ icon: fa_xmark,
66
+ callback: () => {
67
+ localStorage.setItem("waifu-display", Date.now());
68
+ showMessage("愿你有一天能与重要的人重逢。", 2000, 11);
69
+ document.getElementById("waifu").style.bottom = "-500px";
70
+ setTimeout(() => {
71
+ document.getElementById("waifu").style.display = "none";
72
+ document.getElementById("waifu-toggle").classList.add("waifu-toggle-active");
73
+ }, 3000);
74
+ }
75
+ }
76
+ };
77
+
78
+ export default tools;
@@ -1 +1,5 @@
1
- (function(e,t){typeof module=="object"&&typeof module.exports=="object"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self)&&t(e.utils={})})(this,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});function t(n){return Array.isArray(n)?n[Math.floor(Math.random()*n.length)]:n}var f=t});
1
+ function randomSelection(obj) {
2
+ return Array.isArray(obj) ? obj[Math.floor(Math.random() * obj.length)] : obj;
3
+ }
4
+
5
+ export default randomSelection;
@@ -1 +1,3 @@
1
- (function(i,e){typeof module=="object"&&typeof module.exports=="object"?e(exports,require("./index.js")):typeof define=="function"&&define.amd?define(["exports","./index.js"],e):(i=typeof globalThis<"u"?globalThis:i||self)&&e(i.waifuTips={},i.indexJs)})(this,function(i,e){Object.defineProperty(i,"__esModule",{value:!0}),e=f(e);function f(t){return t&&t.__esModule?t:{default:t}}window.initWidget=e.default});
1
+ import initWidget from "./index.js";
2
+
3
+ window.initWidget = initWidget;
@@ -1,10 +1,5 @@
1
1
  /*!
2
2
  * Live2D Widget
3
3
  * https://github.com/stevenjoezhang/live2d-widget
4
- */(function(C,I){typeof module=="object"&&typeof module.exports=="object"?I():typeof define=="function"&&define.amd?define([],I):(C=typeof globalThis<"u"?globalThis:C||self)&&I()})(this,function(){function C(u,f,r,c,o,p,t){try{var a=u[p](t),n=a.value}catch(e){r(e);return}a.done?f(n):Promise.resolve(n).then(c,o)}function I(u){return function(){var f=this,r=arguments;return new Promise(function(c,o){var p=u.apply(f,r);function t(n){C(p,c,o,t,a,"next",n)}function a(n){C(p,c,o,t,a,"throw",n)}t(void 0)})}}function j(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}function k(u,f){for(var r=0;r<f.length;r++){var c=f[r];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(u,c.key,c)}}function P(u,f,r){return f&&k(u.prototype,f),r&&k(u,r),u}function M(u,f){var r,c,o,p,t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return p={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function a(e){return function(i){return n([e,i])}}function n(e){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,c&&(o=e[0]&2?c.return:e[0]?c.throw||((o=c.return)&&o.call(c),0):c.next)&&!(o=o.call(c,e[1])).done)return o;switch(c=0,o&&(e=[e[0]&2,o.value]),e[0]){case 0:case 1:o=e;break;case 4:return t.label++,{value:e[1],done:!1};case 5:t.label++,c=e[1],e=[0];continue;case 7:e=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(e[0]===6||e[0]===2)){t=0;continue}if(e[0]===3&&(!o||e[1]>o[0]&&e[1]<o[3])){t.label=e[1];break}if(e[0]===6&&t.label<o[1]){t.label=o[1],o=e;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(e);break}o[2]&&t.ops.pop(),t.trys.pop();continue}e=f.call(u,t)}catch(i){e=[6,i],c=0}finally{r=o=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}(function(){"use strict";function u(t){return Array.isArray(t)?t[Math.floor(Math.random()*t.length)]:t}var f;function r(t,a,n){if(!(!t||sessionStorage.getItem("waifu-text")&&sessionStorage.getItem("waifu-text")>n)){f&&(clearTimeout(f),f=null),t=u(t),sessionStorage.setItem("waifu-text",n);var e=document.getElementById("waifu-tips");e.innerHTML=t,e.classList.add("waifu-tips-active"),f=setTimeout(function(){sessionStorage.removeItem("waifu-text"),e.classList.remove("waifu-tips-active")},a)}}var c=function(){function t(a){j(this,t);var n=a.apiPath,e=a.cdnPath,i=!1;if(typeof e=="string")i=!0,e.endsWith("/")||(e+="/");else{if(typeof n!="string")throw"Invalid initWidget argument!";n.endsWith("/")||(n+="/")}this.useCDN=i,this.apiPath=n,this.cdnPath=e}return P(t,[{key:"loadModelList",value:function(){var n=this;return I(function(){var e;return M(this,function(i){switch(i.label){case 0:return[4,fetch("".concat(n.cdnPath,"model_list.json"))];case 1:return e=i.sent(),[4,e.json()];case 2:return n.modelList=i.sent(),[2]}})})()}},{key:"loadModel",value:function(n,e,i){var s=this;return I(function(){var d,m;return M(this,function(l){switch(l.label){case 0:return localStorage.setItem("modelId",n),localStorage.setItem("modelTexturesId",e),r(i,4e3,10),s.useCDN?(d=s.modelList,d?[3,2]:[4,s.loadModelList()]):[3,3];case 1:d=l.sent(),l.label=2;case 2:return m=u(s.modelList.models[n]),loadlive2d("live2d","".concat(s.cdnPath,"model/").concat(m,"/index.json")),[3,4];case 3:loadlive2d("live2d","".concat(s.apiPath,"get/?id=").concat(n,"-").concat(e)),console.log("Live2D \u6A21\u578B ".concat(n,"-").concat(e," \u52A0\u8F7D\u5B8C\u6210")),l.label=4;case 4:return[2]}})})()}},{key:"loadRandModel",value:function(){var n=this;return I(function(){var e,i,s,d;return M(this,function(m){switch(m.label){case 0:return e=localStorage.getItem("modelId"),i=localStorage.getItem("modelTexturesId"),n.useCDN?(s=n.modelList,s?[3,2]:[4,n.loadModelList()]):[3,3];case 1:s=m.sent(),m.label=2;case 2:return d=u(n.modelList.models[e]),loadlive2d("live2d","".concat(n.cdnPath,"model/").concat(d,"/index.json")),r("\u6211\u7684\u65B0\u8863\u670D\u597D\u770B\u561B\uFF1F",4e3,10),[3,4];case 3:fetch("".concat(n.apiPath,"rand_textures/?id=").concat(e,"-").concat(i)).then(function(l){return l.json()}).then(function(l){l.textures.id!==1||i!==1&&i!==0?n.loadModel(e,l.textures.id,"\u6211\u7684\u65B0\u8863\u670D\u597D\u770B\u561B\uFF1F"):r("\u6211\u8FD8\u6CA1\u6709\u5176\u4ED6\u8863\u670D\u5462\uFF01",4e3,10)}),m.label=4;case 4:return[2]}})})()}},{key:"loadOtherModel",value:function(){var n=this;return I(function(){var e,i,s;return M(this,function(d){switch(d.label){case 0:return e=localStorage.getItem("modelId"),n.useCDN?(i=n.modelList,i?[3,2]:[4,n.loadModelList()]):[3,3];case 1:i=d.sent(),d.label=2;case 2:return s=++e>=n.modelList.models.length?0:e,n.loadModel(s,0,n.modelList.messages[s]),[3,4];case 3:fetch("".concat(n.apiPath,"switch/?id=").concat(e)).then(function(m){return m.json()}).then(function(m){n.loadModel(m.model.id,0,m.model.message)}),d.label=4;case 4:return[2]}})})()}}]),t}(),o={hitokoto:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',callback:function(){fetch("https://v1.hitokoto.cn").then(function(a){return a.json()}).then(function(a){var n="\u8FD9\u53E5\u4E00\u8A00\u6765\u81EA <span>\u300C".concat(a.from,"\u300D</span>\uFF0C\u662F <span>").concat(a.creator,"</span> \u5728 hitokoto.cn \u6295\u7A3F\u7684\u3002");r(a.hitokoto,6e3,9),setTimeout(function(){r(n,4e3,9)},6e3)})}},asteroids:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L277.3 424.9l-40.1 74.5c-5.2 9.7-16.3 14.6-27 11.9S192 499 192 488V392c0-5.3 1.8-10.5 5.1-14.7L362.4 164.7c2.5-7.1-6.5-14.3-13-8.4L170.4 318.2l-32 28.9 0 0c-9.2 8.3-22.3 10.6-33.8 5.8l-85-35.4C8.4 312.8 .8 302.2 .1 290s5.5-23.7 16.1-29.8l448-256c10.7-6.1 23.9-5.5 34 1.4z"/></svg>',callback:function(){if(window.Asteroids)window.ASTEROIDSPLAYERS||(window.ASTEROIDSPLAYERS=[]),window.ASTEROIDSPLAYERS.push(new Asteroids);else{var t=document.createElement("script");t.src="https://fastly.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js",document.head.appendChild(t)}}},"switch-model":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM256 272c39.8 0 72-32.2 72-72s-32.2-72-72-72s-72 32.2-72 72s32.2 72 72 72z"/></svg>',callback:function(){}},"switch-texture":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M320 64c0-35.3-28.7-64-64-64s-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"/></svg>',callback:function(){}},photo:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM344 304c0 48.6-39.4 88-88 88s-88-39.4-88-88s39.4-88 88-88s88 39.4 88 88z"/></svg>',callback:function(){r("\u7167\u597D\u4E86\u561B\uFF0C\u662F\u4E0D\u662F\u5F88\u53EF\u7231\u5462\uFF1F",6e3,9),Live2D.captureName="photo.png",Live2D.captureFrame=!0}},info:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-144c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32z"/></svg>',callback:function(){open("https://github.com/stevenjoezhang/live2d-widget")}},quit:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"/></svg>',callback:function(){localStorage.setItem("waifu-display",Date.now()),r("\u613F\u4F60\u6709\u4E00\u5929\u80FD\u4E0E\u91CD\u8981\u7684\u4EBA\u91CD\u9022\u3002",2e3,11),document.getElementById("waifu").style.bottom="-500px",setTimeout(function(){document.getElementById("waifu").style.display="none",document.getElementById("waifu-toggle").classList.add("waifu-toggle-active")},3e3)}}};function p(t){var a=new c(t);function n(e){var i,s=!1,d=e.message.default;window.addEventListener("mousemove",function(){return s=!0}),window.addEventListener("keydown",function(){return s=!0}),setInterval(function(){s?(s=!1,clearInterval(i),i=null):i||(i=setInterval(function(){r(d,6e3,9)},2e4))},1e3),r(function(l){var h=!0,g=!1,v=void 0;if(location.pathname==="/")try{for(var w=l[Symbol.iterator](),L;!(h=(L=w.next()).done);h=!0){var b=L.value,x=b.hour,y=b.text,S=new Date,T=x.split("-")[0],z=x.split("-")[1]||T;if(T<=S.getHours()&&S.getHours()<=z)return y}}catch(D){g=!0,v=D}finally{try{!h&&w.return!=null&&w.return()}finally{if(g)throw v}}var F="\u6B22\u8FCE\u9605\u8BFB<span>\u300C".concat(document.title.split(" - ")[0],"\u300D</span>"),A;if(document.referrer!==""){var E=new URL(document.referrer),B=E.hostname.split(".")[1],H={baidu:"\u767E\u5EA6",so:"360\u641C\u7D22",google:"\u8C37\u6B4C\u641C\u7D22"};return location.hostname===E.hostname?F:(A=B in H?H[B]:E.hostname,"Hello\uFF01\u6765\u81EA <span>".concat(A,"</span> \u7684\u670B\u53CB<br>").concat(F))}return F}(e.time),7e3,11),window.addEventListener("mouseover",function(l){var h=!0,g=!1,v=void 0;try{for(var w=e.mouseover[Symbol.iterator](),L;!(h=(L=w.next()).done);h=!0){var b=L.value,x=b.selector,y=b.text;if(l.target.matches(x))return y=u(y),y=y.replace("{text}",l.target.innerText),void r(y,4e3,8)}}catch(S){g=!0,v=S}finally{try{!h&&w.return!=null&&w.return()}finally{if(g)throw v}}}),window.addEventListener("click",function(l){var h=!0,g=!1,v=void 0;try{for(var w=e.click[Symbol.iterator](),L;!(h=(L=w.next()).done);h=!0){var b=L.value,x=b.selector,y=b.text;if(l.target.matches(x))return y=u(y),y=y.replace("{text}",l.target.innerText),void r(y,4e3,8)}}catch(S){g=!0,v=S}finally{try{!h&&w.return!=null&&w.return()}finally{if(g)throw v}}}),e.seasons.forEach(function(l){var h=l.date,g=l.text,v=new Date,w=h.split("-")[0],L=h.split("-")[1]||w;w.split("/")[0]<=v.getMonth()+1&&v.getMonth()+1<=L.split("/")[0]&&w.split("/")[1]<=v.getDate()&&v.getDate()<=L.split("/")[1]&&(g=(g=u(g)).replace("{year}",v.getFullYear()),d.push(g))});var m=function(){};console.log("%c",m),m.toString=function(){r(e.message.console,6e3,9)},window.addEventListener("copy",function(){r(e.message.copy,6e3,9)}),window.addEventListener("visibilitychange",function(){document.hidden||r(e.message.visibilitychange,6e3,9)})}localStorage.removeItem("waifu-display"),sessionStorage.removeItem("waifu-text"),document.body.insertAdjacentHTML("beforeend",`<div id="waifu">
5
- <div id="waifu-tips"></div>
6
- <canvas id="live2d" width="800" height="800"></canvas>
7
- <div id="waifu-tool"></div>
8
- </div>`),setTimeout(function(){document.getElementById("waifu").style.bottom=0},0),function(){o["switch-model"].callback=function(){return a.loadOtherModel()},o["switch-texture"].callback=function(){return a.loadRandModel()},Array.isArray(t.tools)||(t.tools=Object.keys(o));var e=!0,i=!1,s=void 0;try{for(var d=t.tools[Symbol.iterator](),m;!(e=(m=d.next()).done);e=!0){var l=m.value;if(o[l]){var h=o[l],g=h.icon,v=h.callback;document.getElementById("waifu-tool").insertAdjacentHTML("beforeend",'<span id="waifu-tool-'.concat(l,'">').concat(g,"</span>")),document.getElementById("waifu-tool-".concat(l)).addEventListener("click",v)}}}catch(w){i=!0,s=w}finally{try{!e&&d.return!=null&&d.return()}finally{if(i)throw s}}}(),function(){var e=localStorage.getItem("modelId"),i=localStorage.getItem("modelTexturesId");e===null&&(e=1,i=53),a.loadModel(e,i),fetch(t.waifuPath).then(function(s){return s.json()}).then(n)}()}window.initWidget=function(t,a){typeof t=="string"&&(t={waifuPath:t,apiPath:a}),document.body.insertAdjacentHTML("beforeend",`<div id="waifu-toggle">
9
- <span>\u770B\u677F\u5A18</span>
10
- </div>`);var n=document.getElementById("waifu-toggle");n.addEventListener("click",function(){n.classList.remove("waifu-toggle-active"),n.getAttribute("first-time")?(p(t),n.removeAttribute("first-time")):(localStorage.removeItem("waifu-display"),document.getElementById("waifu").style.display="",setTimeout(function(){document.getElementById("waifu").style.bottom=0},0))}),localStorage.getItem("waifu-display")&&Date.now()-localStorage.getItem("waifu-display")<=864e5?(n.setAttribute("first-time",!0),setTimeout(function(){n.classList.add("waifu-toggle-active")},0)):p(t)}})()});
4
+ */
5
+ !function(){"use strict";function e(e){return Array.isArray(e)?e[Math.floor(Math.random()*e.length)]:e}let t;function o(o,s,n){if(!o||sessionStorage.getItem("waifu-text")&&sessionStorage.getItem("waifu-text")>n)return;t&&(clearTimeout(t),t=null),o=e(o),sessionStorage.setItem("waifu-text",n);const i=document.getElementById("waifu-tips");i.innerHTML=o,i.classList.add("waifu-tips-active"),t=setTimeout((()=>{sessionStorage.removeItem("waifu-text"),i.classList.remove("waifu-tips-active")}),s)}class s{constructor(e){let{apiPath:t,cdnPath:o}=e,s=!1;if("string"==typeof o)s=!0,o.endsWith("/")||(o+="/");else{if("string"!=typeof t)throw"Invalid initWidget argument!";t.endsWith("/")||(t+="/")}this.useCDN=s,this.apiPath=t,this.cdnPath=o}async loadModelList(){const e=await fetch(`${this.cdnPath}model_list.json`);this.modelList=await e.json()}async loadModel(t,s,n){if(localStorage.setItem("modelId",t),localStorage.setItem("modelTexturesId",s),o(n,4e3,10),this.useCDN){this.modelList||await this.loadModelList();const o=e(this.modelList.models[t]);loadlive2d("live2d",`${this.cdnPath}model/${o}/index.json`)}else loadlive2d("live2d",`${this.apiPath}get/?id=${t}-${s}`),console.log(`Live2D 模型 ${t}-${s} 加载完成`)}async loadRandModel(){const t=localStorage.getItem("modelId"),s=localStorage.getItem("modelTexturesId");if(this.useCDN){this.modelList||await this.loadModelList();const s=e(this.modelList.models[t]);loadlive2d("live2d",`${this.cdnPath}model/${s}/index.json`),o("我的新衣服好看嘛?",4e3,10)}else fetch(`${this.apiPath}rand_textures/?id=${t}-${s}`).then((e=>e.json())).then((e=>{1!==e.textures.id||1!==s&&0!==s?this.loadModel(t,e.textures.id,"我的新衣服好看嘛?"):o("我还没有其他衣服呢!",4e3,10)}))}async loadOtherModel(){let e=localStorage.getItem("modelId");if(this.useCDN){this.modelList||await this.loadModelList();const t=++e>=this.modelList.models.length?0:e;this.loadModel(t,0,this.modelList.messages[t])}else fetch(`${this.apiPath}switch/?id=${e}`).then((e=>e.json())).then((e=>{this.loadModel(e.model.id,0,e.model.message)}))}}const n={hitokoto:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',callback:function(){fetch("https://v1.hitokoto.cn").then((e=>e.json())).then((e=>{const t=`这句一言来自 <span>「${e.from}」</span>,是 <span>${e.creator}</span> 在 hitokoto.cn 投稿的。`;o(e.hitokoto,6e3,9),setTimeout((()=>{o(t,4e3,9)}),6e3)}))}},asteroids:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L277.3 424.9l-40.1 74.5c-5.2 9.7-16.3 14.6-27 11.9S192 499 192 488V392c0-5.3 1.8-10.5 5.1-14.7L362.4 164.7c2.5-7.1-6.5-14.3-13-8.4L170.4 318.2l-32 28.9 0 0c-9.2 8.3-22.3 10.6-33.8 5.8l-85-35.4C8.4 312.8 .8 302.2 .1 290s5.5-23.7 16.1-29.8l448-256c10.7-6.1 23.9-5.5 34 1.4z"/></svg>',callback:()=>{if(window.Asteroids)window.ASTEROIDSPLAYERS||(window.ASTEROIDSPLAYERS=[]),window.ASTEROIDSPLAYERS.push(new Asteroids);else{const e=document.createElement("script");e.src="https://fastly.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js",document.head.appendChild(e)}}},"switch-model":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM256 272c39.8 0 72-32.2 72-72s-32.2-72-72-72s-72 32.2-72 72s32.2 72 72 72z"/></svg>',callback:()=>{}},"switch-texture":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M320 64c0-35.3-28.7-64-64-64s-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"/></svg>',callback:()=>{}},photo:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM344 304c0 48.6-39.4 88-88 88s-88-39.4-88-88s39.4-88 88-88s88 39.4 88 88z"/></svg>',callback:()=>{o("照好了嘛,是不是很可爱呢?",6e3,9),Live2D.captureName="photo.png",Live2D.captureFrame=!0}},info:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-144c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32z"/></svg>',callback:()=>{open("https://github.com/stevenjoezhang/live2d-widget")}},quit:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">\x3c!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path d="M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"/></svg>',callback:()=>{localStorage.setItem("waifu-display",Date.now()),o("愿你有一天能与重要的人重逢。",2e3,11),document.getElementById("waifu").style.bottom="-500px",setTimeout((()=>{document.getElementById("waifu").style.display="none",document.getElementById("waifu-toggle").classList.add("waifu-toggle-active")}),3e3)}}};function i(t){const i=new s(t);function c(t){let s,n=!1,i=t.message.default;window.addEventListener("mousemove",(()=>n=!0)),window.addEventListener("keydown",(()=>n=!0)),setInterval((()=>{n?(n=!1,clearInterval(s),s=null):s||(s=setInterval((()=>{o(i,6e3,9)}),2e4))}),1e3),o(function(e){if("/"===location.pathname)for(let{hour:t,text:o}of e){const e=new Date,s=t.split("-")[0],n=t.split("-")[1]||s;if(s<=e.getHours()&&e.getHours()<=n)return o}const t=`欢迎阅读<span>「${document.title.split(" - ")[0]}」</span>`;let o;if(""!==document.referrer){const e=new URL(document.referrer),s=e.hostname.split(".")[1],n={baidu:"百度",so:"360搜索",google:"谷歌搜索"};return location.hostname===e.hostname?t:(o=s in n?n[s]:e.hostname,`Hello!来自 <span>${o}</span> 的朋友<br>${t}`)}return t}(t.time),7e3,11),window.addEventListener("mouseover",(s=>{for(let{selector:n,text:i}of t.mouseover)if(s.target.matches(n))return i=e(i),i=i.replace("{text}",s.target.innerText),void o(i,4e3,8)})),window.addEventListener("click",(s=>{for(let{selector:n,text:i}of t.click)if(s.target.matches(n))return i=e(i),i=i.replace("{text}",s.target.innerText),void o(i,4e3,8)})),t.seasons.forEach((({date:t,text:o})=>{const s=new Date,n=t.split("-")[0],c=t.split("-")[1]||n;n.split("/")[0]<=s.getMonth()+1&&s.getMonth()+1<=c.split("/")[0]&&n.split("/")[1]<=s.getDate()&&s.getDate()<=c.split("/")[1]&&(o=(o=e(o)).replace("{year}",s.getFullYear()),i.push(o))}));const c=()=>{};console.log("%c",c),c.toString=()=>{o(t.message.console,6e3,9)},window.addEventListener("copy",(()=>{o(t.message.copy,6e3,9)})),window.addEventListener("visibilitychange",(()=>{document.hidden||o(t.message.visibilitychange,6e3,9)}))}localStorage.removeItem("waifu-display"),sessionStorage.removeItem("waifu-text"),document.body.insertAdjacentHTML("beforeend",'<div id="waifu">\n <div id="waifu-tips"></div>\n <canvas id="live2d" width="800" height="800"></canvas>\n <div id="waifu-tool"></div>\n </div>'),setTimeout((()=>{document.getElementById("waifu").style.bottom=0}),0),function(){n["switch-model"].callback=()=>i.loadOtherModel(),n["switch-texture"].callback=()=>i.loadRandModel(),Array.isArray(t.tools)||(t.tools=Object.keys(n));for(let e of t.tools)if(n[e]){const{icon:t,callback:o}=n[e];document.getElementById("waifu-tool").insertAdjacentHTML("beforeend",`<span id="waifu-tool-${e}">${t}</span>`),document.getElementById(`waifu-tool-${e}`).addEventListener("click",o)}}(),function(){let e=localStorage.getItem("modelId"),o=localStorage.getItem("modelTexturesId");null===e&&(e=1,o=53),i.loadModel(e,o),fetch(t.waifuPath).then((e=>e.json())).then(c)}()}window.initWidget=function(e,t){"string"==typeof e&&(e={waifuPath:e,apiPath:t}),document.body.insertAdjacentHTML("beforeend",'<div id="waifu-toggle">\n <span>看板娘</span>\n </div>');const o=document.getElementById("waifu-toggle");o.addEventListener("click",(()=>{o.classList.remove("waifu-toggle-active"),o.getAttribute("first-time")?(i(e),o.removeAttribute("first-time")):(localStorage.removeItem("waifu-display"),document.getElementById("waifu").style.display="",setTimeout((()=>{document.getElementById("waifu").style.bottom=0}),0))})),localStorage.getItem("waifu-display")&&Date.now()-localStorage.getItem("waifu-display")<=864e5?(o.setAttribute("first-time",!0),setTimeout((()=>{o.classList.add("waifu-toggle-active")}),0)):i(e)}}();