From 419053f3e00760f9475deef3aef7dd2cc631a58c Mon Sep 17 00:00:00 2001 From: example Date: Thu, 24 Jan 2019 13:38:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translate/translate-dictionary.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translate/translate-dictionary.js b/translate/translate-dictionary.js index 234a911..1110246 100644 --- a/translate/translate-dictionary.js +++ b/translate/translate-dictionary.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 划词翻译:多词典查询 // @namespace http://tampermonkey.net/ -// @version 2.0 +// @version 2.1 // @description 划词翻译调用“有道词典(有道翻译)、金山词霸、Bing 词典(必应词典)、沪江小D、谷歌翻译” // @author https://github.com/barrer // @match http://*/* @@ -14,7 +14,7 @@ // @connect hjenglish.com // @connect hjapi.com // @connect hjfile.cn -// @connect cn.bing.com +// @connect bing.com // @grant GM_xmlhttpRequest // ==/UserScript== @@ -455,7 +455,7 @@ engineResult[ids.YOUDAO] = htmlToDom('error: 无法连接翻译服务'); showContent(); }); - ajax('https://cn.bing.com/dict/search?q=' + encodeURIComponent(text), function (rst) { + ajax('https://www4.bing.com/dict/search?q=' + encodeURIComponent(text), function (rst) { engineResult[ids.BING] = parseBing(rst); showContent(); }, function (rst) { @@ -488,7 +488,7 @@ engineResult[ids.YOUDAO_LOWER_CASE] = htmlToDom('error: 无法连接翻译服务'); showContent(); }); - ajax('https://cn.bing.com/dict/search?q=' + encodeURIComponent(text.toLowerCase()), function (rst) { + ajax('https://www4.bing.com/dict/search?q=' + encodeURIComponent(text.toLowerCase()), function (rst) { engineResult[ids.BING_LOWER_CASE] = parseBing(rst); showContent(); }, function (rst) { @@ -506,9 +506,9 @@ var url = 'https://translate.google.cn/translate_a/single?client=gtx&dt=t&dt=bd&dj=1&source=input&hl=zh-CN&sl=auto'; url += '&tk=' + token(text); if (hasChineseByRange(text)) - url += '&tl=en&q=' + text; + url += '&tl=en&q=' + encodeURIComponent(text); else - url += '&tl=zh-CN&q=' + text; + url += '&tl=zh-CN&q=' + encodeURIComponent(text); ajax(url, function (rst) { engineResult[ids.GOOGLE] = parseGoogle(rst); showContent();