diff --git a/waifu-tips.js b/waifu-tips.js
index bbdc553..f5abfbf 100755
--- a/waifu-tips.js
+++ b/waifu-tips.js
@@ -165,21 +165,23 @@ function loadWidget(config) {
fetch(waifuPath)
.then(response => response.json())
.then(result => {
- result.mouseover.forEach(tips => {
- window.addEventListener("mouseover", event => {
- if (!event.target.matches(tips.selector)) return;
+ window.addEventListener("mouseover", event => {
+ for (let tips of result.mouseover) {
+ if (!event.target.matches(tips.selector)) continue;
let text = randomSelection(tips.text);
text = text.replace("{text}", event.target.innerText);
showMessage(text, 4000, 8);
- });
+ return;
+ }
});
- result.click.forEach(tips => {
- window.addEventListener("click", event => {
- if (!event.target.matches(tips.selector)) return;
+ window.addEventListener("click", event => {
+ for (let tips of result.click) {
+ if (!event.target.matches(tips.selector)) continue;
let text = randomSelection(tips.text);
text = text.replace("{text}", event.target.innerText);
showMessage(text, 4000, 8);
- });
+ return;
+ }
});
result.seasons.forEach(tips => {
let now = new Date(),
diff --git a/waifu-tips.json b/waifu-tips.json
index 9fb752c..607848b 100755
--- a/waifu-tips.json
+++ b/waifu-tips.json
@@ -24,26 +24,29 @@
"selector": "#waifu-tool .fa-times",
"text": ["到了要说再见的时候了吗?", "呜呜 QAQ 后会有期……", "不要抛弃我呀……", "我们,还能再见面吗……", "哼,你会后悔的!"]
}, {
- "selector": ".menu-item-home",
+ "selector": ".menu-item-home a",
"text": ["点击前往首页,想回到上一页可以使用浏览器的后退功能哦。", "点它就可以回到首页啦!", "回首页看看吧。"]
}, {
- "selector": ".menu-item-about",
+ "selector": ".menu-item-about a",
"text": ["你想知道我家主人是谁吗?", "这里有一些关于我家主人的秘密哦,要不要看看呢?", "发现主人出没地点!"]
}, {
- "selector": ".menu-item-tags",
- "text": ["点击就可以看文章的标签啦!", "点击来查看所有标签哦。", "快看看这里都有什么呢!"]
+ "selector": ".menu-item-tags a",
+ "text": ["点击就可以看文章的标签啦!", "点击来查看所有标签哦。"]
}, {
- "selector": ".menu-item-categories",
- "text": ["文章都分类好啦~", "点击来查看文章分类哦。", "快看看这里都有什么呢!"]
+ "selector": ".menu-item-categories a",
+ "text": ["文章都分类好啦~", "点击来查看文章分类哦。"]
}, {
- "selector": ".menu-item-archives",
- "text": ["翻页比较麻烦吗,那就来看看文章归档吧。", "文章目录都整理在这里啦!", "快看看这里都有什么呢?"]
+ "selector": ".menu-item-archives a",
+ "text": ["翻页比较麻烦吗,那就来看看文章归档吧。", "文章目录都整理在这里啦!"]
}, {
- "selector": ".menu-item-friends",
+ "selector": ".menu-item-friends a",
"text": ["这是我的朋友们哦ヾ(◍°∇°◍)ノ゙", "要去大佬们的家看看吗?", "要去拜访一下我的朋友们吗?"]
}, {
- "selector": ".menu-item-search",
+ "selector": ".menu-item-search a",
"text": ["找不到想看的内容?搜索看看吧!", "在找什么东西呢,需要帮忙吗?"]
+ }, {
+ "selector": ".menu-item a",
+ "text": ["快看看这里都有什么呢?"]
}, {
"selector": ".site-author",
"text": ["我家主人好看吗?", "这是我家主人(*´∇`*)"]
@@ -66,8 +69,11 @@
"selector": ".fancybox img, img.medium-zoom-image",
"text": ["点击图片可以放大呢!"]
}, {
- "selector": ".highlight, .gist",
- "text": ["代码可以直接点击复制哟。", "GitHub!我是新手!", "PHP 是最好的语言!"]
+ "selector": ".copy-btn",
+ "text": ["代码可以直接点击复制哟。"]
+ }, {
+ "selector": ".highlight .table-container, .gist",
+ "text": ["GitHub!我是新手!", "PHP 是最好的语言!"]
}, {
"selector": ".container a[href^='http'], .nav-link .nav-text",
"text": ["要去看看 {text} 么?", "去 {text} 逛逛吧。", "到 {text} 看看吧。"]