From 0f2a7e996ab1eade8c99c7b4e048f7fcebe5e6b0 Mon Sep 17 00:00:00 2001 From: example Date: Fri, 24 May 2019 19:01:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E9=81=93=E8=AF=8D=E5=85=B8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BD=91=E7=BB=9C=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translate/translate-dictionary.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/translate/translate-dictionary.js b/translate/translate-dictionary.js index b4788db..e2a4b46 100644 --- a/translate/translate-dictionary.js +++ b/translate/translate-dictionary.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 划词翻译:多词典查询 // @namespace http://tampermonkey.net/ -// @version 5.2 +// @version 5.3 // @description 划词翻译调用“有道词典(有道翻译)、金山词霸、Bing 词典(必应词典)、剑桥高阶、沪江小D、谷歌翻译” // @author https://github.com/barrer // @match http://*/* @@ -845,6 +845,30 @@ }); html += tr; } + // 网络释义 + if (rstJson.web_trans && + rstJson.web_trans['web-translation'] && + rstJson.web_trans['web-translation'].length > 0 && + rstJson.web_trans['web-translation'][0]['@same'] && + rstJson.web_trans['web-translation'][0]['@same'] == 'true' && + rstJson.web_trans['web-translation'][0].trans && + rstJson.web_trans['web-translation'][0].trans.length > 0) { + var webTrans = '网络:'; + rstJson.web_trans['web-translation'][0].trans.forEach(function (obj, i) { + if (obj.value) { + if (obj.cls && obj.cls.cl && obj.cls.cl.length > 0) { + obj.cls.cl.forEach(function (cl) { + webTrans += '[' + cl + ']'; + }); + } + webTrans += obj.value; + if (rstJson.web_trans['web-translation'][0].trans.length - 1 != i) { + webTrans += ';'; + } + } + }); + html += '
' + webTrans + '
'; + } // 中英翻译 if (rstJson.ce_new && rstJson.ce_new.word) { html += '
' +