Update waifu-tips.js

This commit is contained in:
PFiS 2021-02-14 22:38:44 +08:00 committed by GitHub
parent aecffb2db9
commit 4d89c96e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -194,18 +194,18 @@ function loadWidget(config) {
.then(response => response.json())
.then(result => {
window.addEventListener("mouseover", event => {
for (let tips of result.mouseover) {
if (!event.target.matches(tips.selector)) continue;
let text = randomSelection(tips.text);
for (let { selector, text } of result.mouseover) {
if (!event.target.matches(selector)) continue;
text = randomSelection(tips.text);
text = text.replace("{text}", event.target.innerText);
showMessage(text, 4000, 8);
return;
}
});
window.addEventListener("click", event => {
for (let tips of result.click) {
if (!event.target.matches(tips.selector)) continue;
let text = randomSelection(tips.text);
for (let { selector, text } of result.click) {
if (!event.target.matches(selector)) continue;
text = randomSelection(tips.text);
text = text.replace("{text}", event.target.innerText);
showMessage(text, 4000, 8);
return;