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
aecffb2db9
commit
4d89c96e0e
@ -194,18 +194,18 @@ function loadWidget(config) {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
window.addEventListener("mouseover", event => {
|
window.addEventListener("mouseover", event => {
|
||||||
for (let tips of result.mouseover) {
|
for (let { selector, text } of result.mouseover) {
|
||||||
if (!event.target.matches(tips.selector)) continue;
|
if (!event.target.matches(selector)) continue;
|
||||||
let text = randomSelection(tips.text);
|
text = randomSelection(tips.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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.addEventListener("click", event => {
|
window.addEventListener("click", event => {
|
||||||
for (let tips of result.click) {
|
for (let { selector, text } of result.click) {
|
||||||
if (!event.target.matches(tips.selector)) continue;
|
if (!event.target.matches(selector)) continue;
|
||||||
let text = randomSelection(tips.text);
|
text = randomSelection(tips.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;
|
||||||
|
Loading…
Reference in New Issue
Block a user