添加“PDF 划词翻译”

This commit is contained in:
example 2019-01-18 18:17:37 +08:00
parent b89c236ec8
commit 0894d2ff3d
3 changed files with 26 additions and 4 deletions

View File

@ -7,7 +7,7 @@
![translate.jpg](translate/translate.jpg) ![translate.jpg](translate/translate.jpg)
特色: 特色:
* 划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典”网页翻译 * 划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典、PDF 划词翻译”网页翻译
* 支持顺序自定义 * 支持顺序自定义
* 支持隐藏图标 * 支持隐藏图标
* 支持显示更多图标 * 支持显示更多图标
@ -27,6 +27,8 @@
![translate-bundle.jpg](translate/translate-bundle.jpg) ![translate-bundle.jpg](translate/translate-bundle.jpg)
![translate-pdf.jpg](translate/translate-pdf.jpg)
同时安装: 同时安装:
① 划词翻译:多词典查询 ① 划词翻译:多词典查询
@ -52,5 +54,5 @@ Tampermonkey 是一款免费的浏览器扩展和最为流行的用户脚本管
脚本名 | 用途 脚本名 | 用途
-|- -|-
translate.js|划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典”网页翻译 translate.js|划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典、PDF 划词翻译”网页翻译
translate-dictionary.js|划词翻译调用“有道词典有道翻译、金山词霸、Bing 词典必应词典、沪江小D、谷歌翻译” translate-dictionary.js|划词翻译调用“有道词典有道翻译、金山词霸、Bing 词典必应词典、沪江小D、谷歌翻译”

BIN
translate/translate-pdf.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@ -1,8 +1,8 @@
// ==UserScript== // ==UserScript==
// @name Translate // @name Translate
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 3.8 // @version 3.9
// @description 划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典”网页翻译 // @description 划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典、PDF 划词翻译”网页翻译
// @author https://github.com/barrer // @author https://github.com/barrer
// @match http://*/* // @match http://*/*
// @include https://*/* // @include https://*/*
@ -332,6 +332,16 @@
}, },
custom: function (text) {} custom: function (text) {}
}, },
{
name: 'PDF 划词翻译',
id: 'pdf',
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAABBVBMVEX////v7+/MzMzPz8/Z2dnf39/l5eX19fXs7Ozy8vLS0tLi4uLp6en5+fnR0dHf4OHZ2trX2NjS09PPz9DW1tbc3Nz8/Pzl5+jg4uPd39/V1tfOzs7j5ebc3d7U1NXa29zi5OXn6ens7e7w8vLq7Ozt7+/y8/T////19vb6+/vv8PH9/v7o6uv3+Pj09fX/5N//yb/jrKLZo5nnsqnst67/zsP/08bswbXZraD/6eL/kn//JgD/Ow3/UBr/p4z/XED/QSD/TzD/fFP/cUX/Zjf/8e//NBD/k4D/knD/9PH/1s//spv/nX7/qI3/h2L/Wyj/3tT/van1v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g3xPg/CtcnN9/ZvvrEIk7Pf/7HXGfnu8NHeYGyJPxc3zmnD89f71Coh+w+cbK1btrRZfpbj7buf1yN/jE13HdMhD+YjJ3Sx4PYEYVgLldgxCpBUxSWhOg/UgAUzygqhQg75bwtwyeGaClGyAfHeAAS4oBMe8UaFIvIK0IsIydOK8JYMhR8MgBcZpWCWjQHAPIKQJsyFGgB2A+EkCZigzAIFIDYHdiRBGgpxmAYVjSCeB3YjxFoQCw2mUAIeYxX77eseq1AGQ5duJZNQC+nB8FyBw1xgCY76+s4QAeEG4c8uUyk5RSBeDL+VEAQDkogC9Hyj4ARSKangzwj+i3fHFymoiyLMBI5clKaWqp6g/gp7xRr9D/yaeMmI8Y2dTsAFFrsgD/5Vm+XWY+XrhHzJRr3N7MlyfmgpRLRC6dJCuVemMxRHkxEwuRXHouYSPwnxllOZIp2gh7ebD/mc0Q5cx/Jr88mrXyjIpyiSgMlke51oy2nFkeKKckyhXHuTxkeToXizJYHurLmeURtvw/zIHlkE48ciYAAAAASUVORK5CYII=',
host: ['pdf.example.com'],
popup: function (text) {
openInNewTab('https://barrer.github.io/tools/pdfjs/web/viewer.html');
},
custom: function (text) {}
},
{ {
name: 'Settings', name: 'Settings',
id: 'settings', id: 'settings',
@ -535,6 +545,16 @@
} }
return win; return win;
} }
/**打开新的标签页*/
function openInNewTab(url) {
gm.set(gm.REDIRECT_URL, url);
var a = document.createElement('a');
a.setAttribute('target', '_blank');
a.setAttribute('href', 'https://example.com');
a.style.display = 'none';
shadow.appendChild(a);
a.click();
}
/**鼠标拖动*/ /**鼠标拖动*/
function Drag(element) { function Drag(element) {
this.dragging = false; this.dragging = false;