From 4d89c96e0e5b8d15a4b5fcd7d932625d2d2cc34e Mon Sep 17 00:00:00 2001 From: PFiS <69380732+PFiS1737@users.noreply.github.com> Date: Sun, 14 Feb 2021 22:38:44 +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 df7bab8..07797bf 100644 --- a/waifu-tips.js +++ b/waifu-tips.js @@ -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;