From a4b3991547375a9a06e92f7a896d48825c4bbab1 Mon Sep 17 00:00:00 2001 From: example Date: Tue, 16 Apr 2019 19:25:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A4=A7=E5=B0=8F=E5=86=99?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=AF=94=E8=BE=83=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translate/translate-dictionary.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/translate/translate-dictionary.js b/translate/translate-dictionary.js index a79c4f8..e431c4b 100644 --- a/translate/translate-dictionary.js +++ b/translate/translate-dictionary.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 划词翻译:多词典查询 // @namespace http://tampermonkey.net/ -// @version 4.7 +// @version 4.8 // @description 划词翻译调用“有道词典(有道翻译)、金山词霸、Bing 词典(必应词典)、剑桥高阶、沪江小D、谷歌翻译” // @author https://github.com/barrer // @match http://*/* @@ -723,10 +723,11 @@ function showContent() { // 填充已有结果集引擎内容 idsType.forEach(function (id) { - if (engineResult[id]) { + if (engineResult[id] && !(id in idsExtension.lowerCaseMap)) { // 跳过小写的内容填充 var engine = contentList.querySelector('tr-engine[data-id="' + id + '"]'); if (engine) { engine.appendChild(engineResult[id]); + engine.removeAttribute('data-id'); engine.style.display = 'block'; } } @@ -735,11 +736,13 @@ for (var id in idsExtension.lowerCaseMap) { if (engineResult[id] && engineResult[idsExtension.lowerCaseMap[id]] && - (engineResult[id].innerHTML == engineResult[idsExtension.lowerCaseMap[id]].innerHTML || - engineResult[id].innerHTML.toLowerCase() == engineResult[idsExtension.lowerCaseMap[id]].innerHTML.toLowerCase())) { + engineResult[id].innerHTML != engineResult[idsExtension.lowerCaseMap[id]].innerHTML && + engineResult[id].innerHTML.toLowerCase() != engineResult[idsExtension.lowerCaseMap[id]].innerHTML.toLowerCase()) { var engine = contentList.querySelector('tr-engine[data-id="' + id + '"]'); if (engine) { - engine.style.display = 'none'; // 隐藏小写内容 + engine.appendChild(engineResult[id]); + engine.removeAttribute('data-id'); + engine.style.display = 'block'; } } }