From e0be7adf1d6f497f5285302e002c16fcf55b2185 Mon Sep 17 00:00:00 2001
From: Mimi <1119186082@qq.com>
Date: Thu, 20 Oct 2022 22:50:17 +0800
Subject: [PATCH] Refactor registerEventListener
---
src/waifu-tips.js | 101 +++++++++++++++++++++++-----------------------
waifu-tips.js | 2 +-
waifu-tips.json | 5 ++-
3 files changed, 56 insertions(+), 52 deletions(-)
diff --git a/src/waifu-tips.js b/src/waifu-tips.js
index 1d4ef48..9456b12 100755
--- a/src/waifu-tips.js
+++ b/src/waifu-tips.js
@@ -22,25 +22,7 @@ function loadWidget(config) {
document.getElementById("waifu").style.bottom = 0;
}, 0);
- // 检测用户活动状态,并在空闲时显示消息
- let userAction = false,
- userActionTimer,
- messageArray = ["好久不见,日子过得好快呢……", "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~", "嗨~快来逗我玩吧!", "拿小拳拳锤你胸口!", "记得把小家加入 Adblock 白名单哦!"];
- window.addEventListener("mousemove", () => userAction = true);
- window.addEventListener("keydown", () => userAction = true);
- setInterval(() => {
- if (userAction) {
- userAction = false;
- clearInterval(userActionTimer);
- userActionTimer = null;
- } else if (!userActionTimer) {
- userActionTimer = setInterval(() => {
- showMessage(randomSelection(messageArray), 6000, 9);
- }, 20000);
- }
- }, 1000);
-
- (function registerEventListener() {
+ (function registerTools() {
tools["switch-model"].callback = () => model.loadOtherModel();
tools["switch-texture"].callback = () => model.loadRandModel();
if (!Array.isArray(config.tools)) {
@@ -98,6 +80,55 @@ function loadWidget(config) {
return message;
}
+ function registerEventListener(result) {
+ // 检测用户活动状态,并在空闲时显示消息
+ let userAction = false,
+ userActionTimer,
+ messageArray = result.message.default;
+ window.addEventListener("mousemove", () => userAction = true);
+ window.addEventListener("keydown", () => userAction = true);
+ setInterval(() => {
+ if (userAction) {
+ userAction = false;
+ clearInterval(userActionTimer);
+ userActionTimer = null;
+ } else if (!userActionTimer) {
+ userActionTimer = setInterval(() => {
+ showMessage(randomSelection(messageArray), 6000, 9);
+ }, 20000);
+ }
+ }, 1000);
+ showMessage(welcomeMessage(result.time), 7000, 11);
+ window.addEventListener("mouseover", event => {
+ for (let { selector, text } of result.mouseover) {
+ if (!event.target.matches(selector)) continue;
+ text = randomSelection(text);
+ text = text.replace("{text}", event.target.innerText);
+ showMessage(text, 4000, 8);
+ return;
+ }
+ });
+ window.addEventListener("click", event => {
+ for (let { selector, text } of result.click) {
+ if (!event.target.matches(selector)) continue;
+ text = randomSelection(text);
+ text = text.replace("{text}", event.target.innerText);
+ showMessage(text, 4000, 8);
+ return;
+ }
+ });
+ result.seasons.forEach(({ date, text }) => {
+ const now = new Date(),
+ after = date.split("-")[0],
+ before = date.split("-")[1] || after;
+ if ((after.split("/")[0] <= now.getMonth() + 1 && now.getMonth() + 1 <= before.split("/")[0]) && (after.split("/")[1] <= now.getDate() && now.getDate() <= before.split("/")[1])) {
+ text = randomSelection(text);
+ text = text.replace("{year}", now.getFullYear());
+ messageArray.push(text);
+ }
+ });
+ }
+
(function initModel() {
let modelId = localStorage.getItem("modelId"),
modelTexturesId = localStorage.getItem("modelTexturesId");
@@ -109,37 +140,7 @@ function loadWidget(config) {
model.loadModel(modelId, modelTexturesId);
fetch(config.waifuPath)
.then(response => response.json())
- .then(result => {
- showMessage(welcomeMessage(result.time), 7000, 11);
- window.addEventListener("mouseover", event => {
- for (let { selector, text } of result.mouseover) {
- if (!event.target.matches(selector)) continue;
- text = randomSelection(text);
- text = text.replace("{text}", event.target.innerText);
- showMessage(text, 4000, 8);
- return;
- }
- });
- window.addEventListener("click", event => {
- for (let { selector, text } of result.click) {
- if (!event.target.matches(selector)) continue;
- text = randomSelection(text);
- text = text.replace("{text}", event.target.innerText);
- showMessage(text, 4000, 8);
- return;
- }
- });
- result.seasons.forEach(({ date, text }) => {
- const now = new Date(),
- after = date.split("-")[0],
- before = date.split("-")[1] || after;
- if ((after.split("/")[0] <= now.getMonth() + 1 && now.getMonth() + 1 <= before.split("/")[0]) && (after.split("/")[1] <= now.getDate() && now.getDate() <= before.split("/")[1])) {
- text = randomSelection(text);
- text = text.replace("{year}", now.getFullYear());
- messageArray.push(text);
- }
- });
- });
+ .then(registerEventListener);
})();
}
diff --git a/waifu-tips.js b/waifu-tips.js
index d5a0eeb..8cf7f30 100644
--- a/waifu-tips.js
+++ b/waifu-tips.js
@@ -1 +1 @@
-!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:'\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 ',callback:function(){fetch("https://v1.hitokoto.cn").then((e=>e.json())).then((e=>{const t=`这句一言来自 「${e.from}」 ,是 ${e.creator} 在 hitokoto.cn 投稿的。`;o(e.hitokoto,6e3,9),setTimeout((()=>{o(t,4e3,9)}),6e3)}))}},asteroids:{icon:'\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 ',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:'\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 ',callback:()=>{}},"switch-texture":{icon:'\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 ',callback:()=>{}},photo:{icon:'\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 ',callback:()=>{o("照好了嘛,是不是很可爱呢?",6e3,9),Live2D.captureName="photo.png",Live2D.captureFrame=!0}},info:{icon:'\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 ',callback:()=>{open("https://github.com/stevenjoezhang/live2d-widget")}},quit:{icon:'\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 ',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);localStorage.removeItem("waifu-display"),sessionStorage.removeItem("waifu-text"),document.body.insertAdjacentHTML("beforeend",'
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
'),setTimeout((()=>{document.getElementById("waifu").style.bottom=0}),0);let c,a=!1,l=["好久不见,日子过得好快呢……","大坏蛋!你都多久没理人家了呀,嘤嘤嘤~","嗨~快来逗我玩吧!","拿小拳拳锤你胸口!","记得把小家加入 Adblock 白名单哦!"];window.addEventListener("mousemove",(()=>a=!0)),window.addEventListener("keydown",(()=>a=!0)),setInterval((()=>{a?(a=!1,clearInterval(c),c=null):c||(c=setInterval((()=>{o(e(l),6e3,9)}),2e4))}),1e3),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",`${t} `),document.getElementById(`waifu-tool-${e}`).addEventListener("click",o)}const e=()=>{};console.log("%c",e),e.toString=()=>{o("哈哈,你打开了控制台,是想要看看我的小秘密吗?",6e3,9)},window.addEventListener("copy",(()=>{o("你都复制了些什么呀,转载要记得加上出处哦!",6e3,9)})),window.addEventListener("visibilitychange",(()=>{document.hidden||o("哇,你终于回来了~",6e3,9)}))}(),function(){let s=localStorage.getItem("modelId"),n=localStorage.getItem("modelTexturesId");null===s&&(s=1,n=53),i.loadModel(s,n),fetch(t.waifuPath).then((e=>e.json())).then((t=>{o(function(t){const o=`欢迎阅读「${document.title.split(" - ")[0]}」 `;let s;if("/"===location.pathname)for(let{hour:o,text:s}of t){const t=new Date,n=o.split("-")[0],i=o.split("-")[1]||n;if(n<=t.getHours()&&t.getHours()<=i)return s=e(s),s}if(""!==document.referrer){const e=new URL(document.referrer),t=e.hostname.split(".")[1],n={baidu:"百度",so:"360搜索",google:"谷歌搜索"};return location.hostname===e.hostname?o:(s=t in n?n[t]:e.hostname,`Hello!来自 ${s} 的朋友 ${o}`)}return o}(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],i=t.split("-")[1]||n;n.split("/")[0]<=s.getMonth()+1&&s.getMonth()+1<=i.split("/")[0]&&n.split("/")[1]<=s.getDate()&&s.getDate()<=i.split("/")[1]&&(o=(o=e(o)).replace("{year}",s.getFullYear()),l.push(o))}))}))}()}window.initWidget=function(e,t){"string"==typeof e&&(e={waifuPath:e,apiPath:t}),document.body.insertAdjacentHTML("beforeend",'\n\t\t\t看板娘 \n\t\t
');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)}}();
+!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:'\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 ',callback:function(){fetch("https://v1.hitokoto.cn").then((e=>e.json())).then((e=>{const t=`这句一言来自 「${e.from}」 ,是 ${e.creator} 在 hitokoto.cn 投稿的。`;o(e.hitokoto,6e3,9),setTimeout((()=>{o(t,4e3,9)}),6e3)}))}},asteroids:{icon:'\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 ',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:'\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 ',callback:()=>{}},"switch-texture":{icon:'\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 ',callback:()=>{}},photo:{icon:'\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 ',callback:()=>{o("照好了嘛,是不是很可爱呢?",6e3,9),Live2D.captureName="photo.png",Live2D.captureFrame=!0}},info:{icon:'\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 ',callback:()=>{open("https://github.com/stevenjoezhang/live2d-widget")}},quit:{icon:'\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 ',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(e(i),6e3,9)}),2e4))}),1e3),o(function(t){const o=`欢迎阅读「${document.title.split(" - ")[0]}」 `;let s;if("/"===location.pathname)for(let{hour:o,text:s}of t){const t=new Date,n=o.split("-")[0],i=o.split("-")[1]||n;if(n<=t.getHours()&&t.getHours()<=i)return s=e(s),s}if(""!==document.referrer){const e=new URL(document.referrer),t=e.hostname.split(".")[1],n={baidu:"百度",so:"360搜索",google:"谷歌搜索"};return location.hostname===e.hostname?o:(s=t in n?n[t]:e.hostname,`Hello!来自 ${s} 的朋友 ${o}`)}return o}(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))}))}localStorage.removeItem("waifu-display"),sessionStorage.removeItem("waifu-text"),document.body.insertAdjacentHTML("beforeend",'\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
'),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",`${t} `),document.getElementById(`waifu-tool-${e}`).addEventListener("click",o)}const e=()=>{};console.log("%c",e),e.toString=()=>{o("哈哈,你打开了控制台,是想要看看我的小秘密吗?",6e3,9)},window.addEventListener("copy",(()=>{o("你都复制了些什么呀,转载要记得加上出处哦!",6e3,9)})),window.addEventListener("visibilitychange",(()=>{document.hidden||o("哇,你终于回来了~",6e3,9)}))}(),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",'\n\t\t\t看板娘 \n\t\t
');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)}}();
diff --git a/waifu-tips.json b/waifu-tips.json
index 7d50c73..7312d37 100755
--- a/waifu-tips.json
+++ b/waifu-tips.json
@@ -245,5 +245,8 @@
}, {
"hour": "0-5",
"text": "你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?"
- }]
+ }],
+ "message": {
+ "default": ["好久不见,日子过得好快呢……", "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~", "嗨~快来逗我玩吧!", "拿小拳拳锤你胸口!", "记得把小家加入收藏夹哦!"]
+ }
}