From 51977cf144535ad59d464e07f313bb006221302f Mon Sep 17 00:00:00 2001 From: xing Date: Wed, 8 Jan 2020 12:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E7=94=A8=E4=BA=8E=E6=B2=AA=E6=B1=9F?= =?UTF-8?q?=E5=B0=8Fd=E6=9F=A5=E8=AF=A2=E6=97=A5=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translate/translate-dictionary.js | 459 ++---------------------------- 1 file changed, 21 insertions(+), 438 deletions(-) diff --git a/translate/translate-dictionary.js b/translate/translate-dictionary.js index c119d5e..e7ed7e4 100644 --- a/translate/translate-dictionary.js +++ b/translate/translate-dictionary.js @@ -8,13 +8,7 @@ // @include https://*/* // @include file:///* // @run-at document-start -// @connect youdao.com -// @connect iciba.com -// @connect translate.google.cn // @connect hjenglish.com -// @connect bing.com -// @connect chinacloudapi.cn -// @connect cambridge.org // @grant GM_xmlhttpRequest // ==/UserScript== @@ -23,13 +17,7 @@ // Your code here... /**联网权限*/ - // @connect youdao.com 有道词典 - // @connect iciba.com 金山词霸 - // @connect translate.google.cn 谷歌翻译 // @connect hjenglish.com 沪江小D - // @connect bing.com 必应词典 - // @connect chinacloudapi.cn 必应词典-发音 - // @connect cambridge.org 剑桥高阶 /**样式*/ var style = document.createElement('style'); // >>>>> 可以自定义的变量 @@ -59,31 +47,11 @@ tr-audio{display:block;margin-bottom:5px} tr-audio a{margin-right:1em;font-size:80%} tr-audio a:last-of-type{margin-right:auto} - tr-content{display:none;width:${trContentWidth}px;height:${trContentHeight}px;overflow-x:hidden;overflow-y:scroll;background:white;padding:2px 8px;margin-top:5px;box-sizing:content-box;font-family:"Helvetica Neue","Helvetica","Arial","sans-serif";font-size:${fontSize}px;font-weight:normal;line-height:normal;-webkit-font-smoothing:auto;font-smoothing:auto;text-rendering:auto} + tr-content{display:none;width:${trContentWidth}px;height:auto;overflow-x:hidden;overflow-y:scroll;background:white;padding:2px 8px;margin-top:5px;box-sizing:content-box;font-family:"Helvetica Neue","Helvetica","Arial","sans-serif";font-size:${fontSize}px;font-weight:normal;line-height:normal;-webkit-font-smoothing:auto;font-smoothing:auto;text-rendering:auto} tr-engine~tr-engine{margin-top:1em} tr-engine .title{color:#00c;display:inline-block;font-weight:bold} tr-engine .title:hover{text-decoration:none} /*各引擎样式*/ - .google .sentences,.google .trans,.google .orig,.google .dict,.google .pos,.none{display:block} - .google .backend,.google .entry,.google .base_form,.google .pos_enum,.google .src,.google .confidence,.google .ld_result,.google .translation_engine_debug_info,.none{display:none} - .google .orig{color:#777} - .google .pos{margin-top:1em} - .google .pos:before{content:"<"} - .google .pos:after{content:">"} - .google .terms:before{content:"〔"} - .google .terms:after{content:"〕"} - .google .terms{margin-right:.2em} - .youdao .pron{margin-right:1em} - .youdao .phone{color:#777;margin-right:1em} - .youdao .phone:before{content:"["} - .youdao .phone:after{content:"]"} - .youdao .pos:before{content:"<"} - .youdao .pos:after{content:">"} - .youdao .phrs{display:none} - .youdao .trs>.tr>.exam{display:none} - .youdao .trs>.tr>.l{display:block;margin-left:1em} - .youdao [class="#text"]{font-style:italic} - .youdao .return-phrase,.youdao [class="@action"],.none{display:none} .hjenglish dl,.hjenglish dt,.hjenglish dd,.hjenglish p,.hjenglish ul,.hjenglish li,.hjenglish h3{margin:0;padding:0;margin-block-start:0;margin-block-end:0;margin-inline-start:0;margin-inline-end:0} .hjenglish h3{font-size:1em;font-weight:normal} .hjenglish .detail-pron,.hjenglish .pronounces{color:#777} @@ -94,40 +62,7 @@ .hjenglish ol,.hjenglish ul{list-style:none} .hjenglish dd{margin-left:1em} .hjenglish dd>p{margin-left:2.5em} - .bing h1,.bing strong{font-size:1em;font-weight:normal;margin:0;padding:0} - .bing .concise ul{list-style:none;margin:0;padding:0} - .bing .hd_tf{margin-right:1em} - .bing .concise .pos{margin-right:.2em} - .bing .concise .web{margin-right:auto} - .bing .concise .web:after{content:":"} - .bing .oald{margin-top:.4em} - .bing .hd_tf_lh div{display:inline;color:#777} - .bing #authid td:first-child{width:22px;margin:0;padding:0} - .bing .def_row{vertical-align:top} - .bing .bil_dis,.bing .val_dis{padding-right:.25em} - .bing .li_exs{display:none} - .bing .li_id{border:0;padding:.2em} - .bing .infor,.bing .sen_com,.bing .com_sep,.bing .bil,.bing .gra{padding-right:.25em} - .bing .infor,.bing .label{padding-left:.25em} - .bing .each_seg+.each_seg{margin-top:.5em} - .bing .de_co div{display:inline} - .bing .idm_seg,.bing .li_ids_co{margin-left:1em} - .bing .sim{display:inline} - .cambridge .entry~.entry{margin-top:1em} - .cambridge p,.cambridge h2,.cambridge h3{padding:0;margin:0} - .cambridge h2,.cambridge h3{font-size:1em;font-weight:normal} - .cambridge .headword .hw{display:block} - .cambridge .pron{color:#777;margin-right:1em} - .cambridge b.def{font-weight:normal} - .cambridge .epp-xref{border:1px solid #777;border-radius:.5em;padding:0 2px;font-size:80%} - .cambridge .examp,.cambridge .extraexamps,.cambridge .cols,.cambridge .xref,.cambridge .fcdo,.cambridge div[fallback],.cambridge .i-volume-up,.cambridge .daccord{display:none} - .cambridge .entry-body__el+.entry-body__el{margin-top:1em} - .cambridge .pos-body{margin-left:1em} - .iciba strong{font-size:1em;font-weight:normal} - .iciba p{padding:0;margin:0} - .iciba .icIBahyI-footer,.iciba .icIBahyI-suggest{display:none} - .iciba .icIBahyI-prons{color:#777} - .iciba .icIBahyI-eg{margin-right:1em} + .hjenglish .pronounces .word-audio {margin-left:2.5em} `; // iframe 工具库 var iframe = document.createElement('iframe'); @@ -151,116 +86,36 @@ var engineResult = {}; // id: DOM // 唯一 ID var ids = { - ICIBA: 'iciba', - ICIBA_LOWER_CASE: 'icibaLowerCase', - YOUDAO: 'youdao', - YOUDAO_LOWER_CASE: 'youdaoLowerCase', - BING: 'bing', HJENGLISH: 'hjenglish', - GOOGLE: 'google', - CAMBRIDGE: 'cambridge' }; // 唯一 ID 扩展 var idsExtension = { // ID 组 - LIST_DICT: [ids.ICIBA, ids.YOUDAO, ids.BING, ids.HJENGLISH, ids.CAMBRIDGE], - LIST_DICT_LOWER_CASE: [ids.ICIBA, ids.ICIBA_LOWER_CASE, ids.YOUDAO, ids.YOUDAO_LOWER_CASE, ids.BING, ids.HJENGLISH, ids.CAMBRIDGE], - LIST_GOOGLE: [ids.GOOGLE], + LIST_DICT: [ids.HJENGLISH,], + LIST_DICT_LOWER_CASE: [ids.HJENGLISH,], // 去重比对(大小写翻译可能一样) lowerCaseMap: (function () { var obj = {}; - obj[ids.ICIBA_LOWER_CASE] = ids.ICIBA; - obj[ids.YOUDAO_LOWER_CASE] = ids.YOUDAO; return obj; })(), // 标题 names: (function () { var obj = {}; - obj[ids.ICIBA] = '金山词霸'; - obj[ids.ICIBA_LOWER_CASE] = ''; - obj[ids.YOUDAO] = '有道词典'; - obj[ids.YOUDAO_LOWER_CASE] = ''; - obj[ids.BING] = 'Bing 词典'; obj[ids.HJENGLISH] = '沪江小D'; - obj[ids.GOOGLE] = '谷歌翻译'; - obj[ids.CAMBRIDGE] = '剑桥高阶'; return obj; })(), // 跳转到网站(“%q%”占位符或者 function text -> return URL) links: (function () { var obj = {}; - obj[ids.ICIBA] = 'http://www.iciba.com/%q%'; - obj[ids.ICIBA_LOWER_CASE] = ''; - obj[ids.YOUDAO] = 'https://dict.youdao.com/w/eng/%q%'; - obj[ids.YOUDAO_LOWER_CASE] = ''; - obj[ids.BING] = 'https://cn.bing.com/dict/search?q=%q%'; - obj[ids.HJENGLISH] = 'https://dict.hjenglish.com/w/%q%'; - obj[ids.GOOGLE] = function (text) { - var rst = ''; - if (hasChineseByRange(text)) { - rst = 'https://translate.google.cn/#view=home&op=translate&sl=auto&tl=en&text=' + encodeURIComponent(text); - } else { - rst = 'https://translate.google.cn/#view=home&op=translate&sl=auto&tl=zh-CN&text=' + encodeURIComponent(text); - } - return rst; - }; - obj[ids.CAMBRIDGE] = 'https://dictionary.cambridge.org/search/english-chinese-simplified/direct/?q=%q%'; + obj[ids.HJENGLISH] = 'https://dict.hjenglish.com/jp/jc/%q%'; return obj; })(), // 翻译引擎 engines: (function () { var obj = {}; - obj[ids.ICIBA] = function (text, time) { - ajax('http://open.iciba.com/huaci_v3/dict.php?word=' + encodeURIComponent(text), function (rst) { - putEngineResult(ids.ICIBA, parseIciba(rst), time); - showContent(); - }, function (rst) { - putEngineResult(ids.ICIBA, htmlToDom('error: 无法连接翻译服务'), time); - showContent(); - }); - }; - obj[ids.ICIBA_LOWER_CASE] = function (text, time) { - ajax('http://open.iciba.com/huaci_v3/dict.php?word=' + encodeURIComponent(text.toLowerCase()), function (rst) { - putEngineResult(ids.ICIBA_LOWER_CASE, parseIciba(rst), time); - showContent(); - }, function (rst) { - putEngineResult(ids.ICIBA_LOWER_CASE, htmlToDom('error: 无法连接翻译服务'), time); - showContent(); - }); - }; - obj[ids.YOUDAO] = function (text, time) { - ajax('https://dict.youdao.com/jsonapi?xmlVersion=5.1&jsonversion=2&q=' + encodeURIComponent(text), function (rst) { - putEngineResult(ids.YOUDAO, parseYoudao(rst), time) - showContent(); - }, function (rst) { - putEngineResult(ids.YOUDAO, htmlToDom('error: 无法连接翻译服务'), time); - showContent(); - }); - }; - obj[ids.YOUDAO_LOWER_CASE] = function (text, time) { - ajax('https://dict.youdao.com/jsonapi?xmlVersion=5.1&jsonversion=2&q=' + encodeURIComponent(text.toLowerCase()), function (rst) { - putEngineResult(ids.YOUDAO_LOWER_CASE, parseYoudao(rst), time); - showContent(); - }, function (rst) { - putEngineResult(ids.YOUDAO_LOWER_CASE, htmlToDom('error: 无法连接翻译服务'), time) - showContent(); - }); - }; - obj[ids.BING] = function (text, time) { - ajax('https://cn.bing.com/dict/search?q=' + encodeURIComponent(text), function (rst) { - putEngineResult(ids.BING, parseBing(rst), time); - showContent(); - }, function (rst) { - putEngineResult(ids.BING, htmlToDom('error: 无法连接翻译服务'), time); - showContent(); - }, { - headers: { - 'Cookie': 'ENSEARCH=BENVER=0;' // 中文结果 - } - }); - }; + obj[ids.HJENGLISH] = function (text, time) { - ajax('https://dict.hjenglish.com/w/' + encodeURIComponent(text), function (rst) { + ajax('https://dict.hjenglish.com/jp/jc/' + encodeURIComponent(text), function (rst) { putEngineResult(ids.HJENGLISH, parseHjenglish(rst), time); showContent(); }, function (rst) { @@ -273,42 +128,17 @@ } }); }; - obj[ids.GOOGLE] = function (text, time) { - 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=' + encodeURIComponent(text); - } else { - url += '&tl=zh-CN&q=' + encodeURIComponent(text); - } - ajax(url, function (rst) { - putEngineResult(ids.GOOGLE, parseGoogle(rst), time); - showContent(); - }, function (rst) { - putEngineResult(ids.GOOGLE, htmlToDom('error: 无法连接翻译服务'), time); - showContent(); - }); - }; - obj[ids.CAMBRIDGE] = function (text, time) { - var url = 'https://dictionary.cambridge.org/dictionary/english-chinese-simplified/' + encodeURIComponent(text); - ajax(url, function (rst) { - putEngineResult(ids.CAMBRIDGE, parseCambridge(rst), time); - showContent(); - }, function (rst) { - putEngineResult(ids.CAMBRIDGE, htmlToDom('error: 无法连接翻译服务'), time); - showContent(); - }); - }; + return obj; })() - } + }; // 绑定图标拖动事件 var iconDrag = new Drag(icon); // 图标数组 var iconArray = [{ name: '多词典查询', id: 'icon-dict', - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAANjklEQVR4Ae2dBVgjyRZG67m7u7u7u/t7yLqOC0lgDBjFdgjj7u7ubkDQcXc3nKSjxO+7N2ts0bCwkw4t9X/fqbEIU31S2t1hekhqTs6be2YV/rVnVlF2j0zr+p7Z1ms9s6xRBFTOfWRbj6yiMb2zx/0zNWPS2xCWSKjQND2yx/4MK/ECAjrgas9M668Rliio0CRPDhn/DqywKUgEAR0RxdZsOv3/EKY0VGiOnJyc12Ml2ajCdExZauq6NyBMSajQHNjHD6NK0ju9sop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/w3H+iXLUT9zsEHPcENy0PRPycl8cyi9B96vgGf0AczEsedSrZMtGC676xPE9ZbF4Lzy72SyqSlqcURv9llbhhGzZFGu5jNzTlpG3bEmn6UeHGagrOFOQdev1P4y/KJ7oVRN3z35y80HzfcRNoY4Ybsgr9x+7tVysPgbvfglOXt0ftTRmBzElS17nCRnkXr7X1mf/GUFvovjM3P6tjy2voKmVLrzGs3t/NfVcePUdi+XCu4uy2IX/8GIbnqZbMfX47zAK/Btc1UrMLL9jwd9sZs3Vn8V0ttGZsZ2ApsprJXZes1MXPl7BT8KKeRzhZsCIqzqG/hEs/MP411Ee3zGx9dBT+wt+xdG5/T/UbuDazuxLpwAAAABJRU5ErkJggg==', trigger: function (text, time) { idsType = idsExtension.LIST_DICT; if (text != text.toLowerCase()) { @@ -320,18 +150,6 @@ initContent(); // 初始化翻译面板 displayContent(); // 立马显示翻译面板 } - }, { - name: '谷歌翻译', - id: 'icon-google', - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAALW0lEQVR4Ae2dBXAcxxKG9QLFoaIwMzMzM3PMzGxLZmZGMZtODkhmZgYxs85ilu5OcJeqzJsOyCVv74mW5rZf1fdCgs393+5MT89OvNr6392+9us53TgWThynnPMXhwlCOmc4x4uQ4u4fXs2ZwXFymAfwKQXefgGe4MRzmAdxggJvW4ArOdM4Lg7zMP7i3E6huxcAwmcezDgKXV6AJ5A739M4R6HjAlyNjPmeyj0UvFSAGRxmEiZT8C201PlOEwmQSMG3FqAbh5mMhyn8SwJYTCjATAr/kgBxJhQgg8K/JEA5h5mQJzkkAN7YMQULOCSAScMH8swdPgkAvMAhAUzMcg4JYGKKOP8jAczN6ySAuVlLApibcs6VJICJ2RBvO1xVW28RnE2cNZypnJ8413O82oAEAMbstTH+YXgaLs4+zrMkQBs8GWxnZdUeEDrOn5xZnKvdCEBsTfWspwBCHOdxGQGIYbs8XgDAyXmXBEB4LMjOSqo8XgDAyrmWBED4LdkUTw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OCEBrAlDrn8gQp9ZHmMbxkhGAuMkn4VG58G+HWj+2TOQ7H8K/kgRog+fmpaHDQMDhYpHH/JbHPgnQBl+syxpzefjTY6yilnoz/pvwdUAAoldoTtTDM1L+/GhVJrOcKROiscMp58RxLJxunOvb+vf8P4SrYCFqyvrgAAAAAElFTkSuQmCC', - trigger: function (text, time) { - idsType = idsExtension.LIST_GOOGLE; - idsType.forEach(function (id) { - idsExtension.engines[id](text, time); - }); - initContent(); // 初始化翻译面板 - displayContent(); // 立马显示翻译面板 - } }]; // 添加翻译引擎图标 iconArray.forEach(function (obj) { @@ -383,7 +201,7 @@ // 鼠标事件:防止选中的文本消失 document.addEventListener('mousedown', function (e) { log('mousedown event:', e); - if (e.target == icon || (e.target.parentNode && e.target.parentNode == icon)) { // 点击了翻译图标 + if (e.target === icon || (e.target.parentNode && e.target.parentNode === icon)) { // 点击了翻译图标 e.preventDefault(); } }); @@ -465,8 +283,8 @@ } /**是否拖动图标*/ function isDrag() { - return iconDrag.elementOriginalLeft != parseInt(icon.style.left) || - iconDrag.elementOriginalTop != parseInt(icon.style.top); + return iconDrag.elementOriginalLeft !== parseInt(icon.style.left) || + iconDrag.elementOriginalTop !== parseInt(icon.style.top); } /**强制结束拖动*/ function forceStopDrag() { @@ -512,7 +330,7 @@ } xml += obj[prop] instanceof iframeWin.Array ? '' : ''; } - var xml = xml.replace(/<\/?[0-9]{1,}>/g, ''); + xml = xml.replace(/<\/?[0-9]{1,}>/g, ''); return xml } /**xml 转 html*/ @@ -601,19 +419,7 @@ /**初始化面板*/ function initContent() { contentList.innerHTML = ''; // 清空翻译内容列表 - // 发音 - var audio = document.createElement('tr-audio'); - audio.appendChild(getPlayButton({ - name: 'US', - url: 'https://dict.youdao.com/dictvoice?audio=' + selected + '&type=2' - })); - audio.appendChild(getPlayButton({ - name: 'UK', - url: 'https://dict.youdao.com/dictvoice?audio=' + selected + '&type=1' - })); - if (engineId != 'icon-google') { // 谷歌翻译不显示发音图标 - contentList.appendChild(audio); - } + // 初始化翻译引擎结构(此时内容暂未填充) idsType.forEach(function (id) { if (id in idsExtension.names) { @@ -792,7 +598,7 @@ } selected = window.getSelection().toString().trim(); // 当前选中文本 log('selected:' + selected + ', icon display:' + icon.style.display); - if (selected && icon.style.display != 'block' && pageX && pageY) { // 显示翻译图标 + if (selected && icon.style.display !== 'block' && /[\u30a1-\u30f6\u3041-\u3093\uFF00-\uFFFF\u4e00-\u9fa5]/.test(selected) && pageX && pageY) { // 显示翻译图标 log('show icon'); icon.style.top = pageY + offsetY + 'px'; icon.style.left = pageX + offsetX + 'px'; @@ -857,142 +663,14 @@ }); return type; } - /**有道词典排版*/ - function parseYoudao(rst) { - var html = ''; - try { - var rstJson = iframeWin.JSON.parse(rst), - phoneStyle = 'color:#777;'; - if (rstJson.ec) { - var word = rstJson.ec.word[0], - tr = ''; - var trs = word.trs, - ukphone = word.ukphone, - usphone = word.usphone, - phone = word.phone, - returnPhrase = word['return-phrase']; - if (returnPhrase && returnPhrase.l && returnPhrase.l.i) { - html += '
' + returnPhrase.l.i + '
'; - } - html += '
'; - if (ukphone && ukphone.length != 0) { - html += '英 [' + ukphone + '] '; - } - if (usphone && usphone.length != 0) { - html += '美 [' + usphone + '] '; - } - html += '
'; - if (phone && phone.length != 0) { - html += '
[' + phone + ']
'; - } - trs.forEach(element => { - tr += '
' + element.tr[0].l.i[0] + '
'; - }); - 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 += '
' + - '《新汉英大辞典》
' + xmlToHtml(objToXml(rstJson.ce_new.word), 'div') + - '
'; - } - // 中文翻译 - if (rstJson.hh && rstJson.hh.word) { - html += '
' + - '《现代汉语大词典》
' + xmlToHtml(objToXml(rstJson.hh.word), 'span') + - '
'; - } - // 长句翻译 - if (rstJson.fanyi && rstJson.fanyi.tran) { - html += rstJson.fanyi.tran; - } - } catch (error) { - log(error); - html += error; - } - var dom = document.createElement('div'); - dom.setAttribute('class', ids.YOUDAO); - dom.innerHTML = html; - return dom; - } - /**金山词霸排版*/ - function parseIciba(rst) { - var dom = document.createElement('div'); - dom.setAttribute('class', ids.ICIBA); - try { - rst = rst.replace(/\n/g, ' '); - rst = /dict.innerHTML='(.*)'; \tdict.style.display = "block";/g.exec(rst)[1]; - rst = rst - .replace(/\\"/g, '"') - .replace(/\\'/g, '\'') // inner-city 这个词会多一个斜杠,金山词霸的数据有些许瑕疵 - .replace(/onclick=/g, 'data-onclick='); - rst = cleanAttr(rst, 'style'); - // 标识符处理 - var symbolRegex = /(.*?(?: xml:lang=).*?<\/span>)/ig; - var symbolMatch; - var symbolResult = []; - while ((symbolMatch = symbolRegex.exec(rst)) != null) { - symbolResult.push(symbolMatch[1]); - } - symbolResult.forEach(function (str) { - rst = rst.replace(str, - str.replace(/\[英\]/g, '英') - .replace(/\[美\]/g, '美') - ); - }); - rst = cleanHtml(rst) - .replace(/(?:a>)/ig, 'span>') - .replace(/(?:= 1) { - ele.appendChild(getPlayButton({ - name: '♫', - url: match[1] - })); - } - }); - // 内容 - dom.appendChild(doc); - } catch (error) { - log(error); - dom.appendChild(htmlToDom(error)); - } - return dom; - } /**沪江小D排版*/ function parseHjenglish(rst) { var dom = document.createElement('div'); dom.setAttribute('class', ids.HJENGLISH); - try { + var parser = new DOMParser(), doc = parser.parseFromString(rst, 'text/html'), + content = doc.getElementsByClassName('word-details')[0]; + dom.appendChild(content); + /*try { var doc = htmlToDom(cleanHtml(rst)); var label = doc.querySelector('.word-details-item-content header'); var entry = doc.querySelector('.word-text h2'); @@ -1016,102 +694,7 @@ } catch (error) { log(error); dom.appendChild(htmlToDom(error)); - } - return dom; - } - /**必应词典排版*/ - function parseBing(rst) { - var html = ''; - try { - rst = rst.replace(/onmouseover/ig, 'data-sound'); // 发音链接预处理 - rst = cleanHtml(rst) - .replace(/(?:a>)/ig, 'span>') - .replace(/(?:'; - if (concise) { - html += '
' + concise.outerHTML + '
'; - } - if (tense) { - html += '
' + tense.outerHTML + '
'; - } - if (oald) { - html += '
《牛津高阶英汉双解词典第八版》
' + oald.outerHTML + '
'; - } - } - // 计算机翻译 - var machineTrans = doc.querySelector('.smt_hw'); - if (machineTrans && machineTrans.innerHTML.indexOf('计算机翻译') != -1) { - var parent = machineTrans.parentNode; - var zhText = parent.querySelector('.p1-11'); - if (zhText) { - html += '
' + zhText.outerHTML + '
';; - } - } - } catch (error) { - log(error); - html += error; - } - var dom = document.createElement('div'); - dom.setAttribute('class', ids.BING); - dom.innerHTML = html; - // 发音 - dom.querySelectorAll('[data-sound]').forEach(function (ele) { - var str = ele.getAttribute('data-sound'); - var regex = /'(https:\/\/.*?)'/ig; - var match = regex.exec(str); - if (match && match.length >= 1) { - ele.appendChild(getPlayButton({ - name: '♫', - url: match[1] - })); - } - }); - return dom; - } - /**谷歌翻译排版*/ - function parseGoogle(rst) { - var dom = document.createElement('div'); - dom.setAttribute('class', ids.GOOGLE); - try { - dom.appendChild(htmlToDom(xmlToHtml(objToXml(iframeWin.JSON.parse(rst)), 'span'))); - } catch (error) { - log(error); - dom.appendChild(htmlToDom(error)); - } - return dom; - } - /**剑桥高阶排版*/ - function parseCambridge(rst) { - var dom = document.createElement('div'); - dom.setAttribute('class', ids.CAMBRIDGE); - try { - rst = cleanHtml(rst).replace(/(?:a>)/ig, 'span>') - .replace(/(?: