mirror of
https://github.com/stevenjoezhang/live2d-widget.git
synced 2024-11-25 14:21:28 +08:00
Update waifu-tips.js
This commit is contained in:
parent
4d89c96e0e
commit
04f3a44224
@ -196,7 +196,7 @@ function loadWidget(config) {
|
|||||||
window.addEventListener("mouseover", event => {
|
window.addEventListener("mouseover", event => {
|
||||||
for (let { selector, text } of result.mouseover) {
|
for (let { selector, text } of result.mouseover) {
|
||||||
if (!event.target.matches(selector)) continue;
|
if (!event.target.matches(selector)) continue;
|
||||||
text = randomSelection(tips.text);
|
text = randomSelection(text);
|
||||||
text = text.replace("{text}", event.target.innerText);
|
text = text.replace("{text}", event.target.innerText);
|
||||||
showMessage(text, 4000, 8);
|
showMessage(text, 4000, 8);
|
||||||
return;
|
return;
|
||||||
@ -205,18 +205,18 @@ function loadWidget(config) {
|
|||||||
window.addEventListener("click", event => {
|
window.addEventListener("click", event => {
|
||||||
for (let { selector, text } of result.click) {
|
for (let { selector, text } of result.click) {
|
||||||
if (!event.target.matches(selector)) continue;
|
if (!event.target.matches(selector)) continue;
|
||||||
text = randomSelection(tips.text);
|
text = randomSelection(text);
|
||||||
text = text.replace("{text}", event.target.innerText);
|
text = text.replace("{text}", event.target.innerText);
|
||||||
showMessage(text, 4000, 8);
|
showMessage(text, 4000, 8);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
result.seasons.forEach(tips => {
|
result.seasons.forEach(({ date, text }) => {
|
||||||
const now = new Date(),
|
const now = new Date(),
|
||||||
after = tips.date.split("-")[0],
|
after = date.split("-")[0],
|
||||||
before = tips.date.split("-")[1] || after;
|
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])) {
|
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());
|
text = text.replace("{year}", now.getFullYear());
|
||||||
//showMessage(text, 7000, true);
|
//showMessage(text, 7000, true);
|
||||||
messageArray.push(text);
|
messageArray.push(text);
|
||||||
|
Loading…
Reference in New Issue
Block a user