From 04f3a442249fc992a35d7e384658794ecc582f5e Mon Sep 17 00:00:00 2001 From: PFiS <69380732+PFiS1737@users.noreply.github.com> Date: Sun, 14 Feb 2021 22:44:52 +0800 Subject: [PATCH] Update waifu-tips.js --- waifu-tips.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/waifu-tips.js b/waifu-tips.js index 07797bf..4d28c8e 100644 --- a/waifu-tips.js +++ b/waifu-tips.js @@ -196,7 +196,7 @@ function loadWidget(config) { window.addEventListener("mouseover", event => { for (let { selector, text } of result.mouseover) { if (!event.target.matches(selector)) continue; - text = randomSelection(tips.text); + text = randomSelection(text); text = text.replace("{text}", event.target.innerText); showMessage(text, 4000, 8); return; @@ -205,18 +205,18 @@ function loadWidget(config) { window.addEventListener("click", event => { for (let { selector, text } of result.click) { if (!event.target.matches(selector)) continue; - text = randomSelection(tips.text); + text = randomSelection(text); text = text.replace("{text}", event.target.innerText); showMessage(text, 4000, 8); return; } }); - result.seasons.forEach(tips => { + result.seasons.forEach(({ date, text }) => { const now = new Date(), - after = tips.date.split("-")[0], - before = tips.date.split("-")[1] || after; + 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])) { - let text = randomSelection(tips.text); + text = randomSelection(text); text = text.replace("{year}", now.getFullYear()); //showMessage(text, 7000, true); messageArray.push(text);