添加窗口位置校验
This commit is contained in:
parent
082a8dd909
commit
4958d62e6e
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Translate
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 4.7
|
||||
// @version 4.8
|
||||
// @description 划词翻译调用“金山词霸、有道词典(有道翻译)、Google Translate(谷歌翻译)、沪江小D、搜狗翻译、必应词典(必应翻译)、Microsoft Translator(必应在线翻译)、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典、PDF 划词翻译、Google Search、Bing Search(必应搜索)、百度搜索、Wikipedia Search(维基百科搜索)”网页翻译
|
||||
// @author https://github.com/barrer
|
||||
// @match http://*/*
|
||||
|
@ -264,7 +264,7 @@
|
|||
{
|
||||
name: 'PDF 划词翻译',
|
||||
id: 'pdf',
|
||||
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAMAUExURQAAAPShTvShTvmqgPShTvShTvihavnu1/13dfyIff5uce7iy/1zc/ShTvShTv5nbP19efuNf/ShTvShTvShTvqdgf17ePuRgPShTvqbgfShTvShTvShTvShTvShTvShTvShTvShTvuXgfqZgfqfgfShTvShTvShTvmgcvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvShTvqfgfqcgfqggfqdgfqegf2AevyFfPShTvnu1/qggfqZgfShTvqfgfShTvqagfqcgfqdgfShTvShTvyDe/ShTvqagfShTvShTvShTvShTvShTvShTvShTvuPf/qegfnu1/nu1/nu1/nu1/ShTvnu1/nu1/nu1+/bvvShTvShTvShTvjhwfDOpfnq0fShTvShTvShTvShTvnu1/9SXfShTlxecOjbxPvHuPjgvv9WYf5sb+ncxffr1f50ePDKnP5mbPnt1vygmvnq1P5qcPrgzP5gaP9cZGBic/9aZGdod25vfGJjdP1+gPXq1f9UX4aFjNbPwWlqeV1fcf9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Pdux5NC2gBrviOAlDQlPZ1lzutZgHXbGSA9U76N34CRrn+32HVIVZFlFtH0XF9RqPjsWiOVvmjAky9dtXclUeu2cWo9TV+b80iZ3I8Uuq2elGJVgPY3Oyrb51c/bnY0giNn4ydhaPUo+c9p1Rr/xd2Mv/64e1B/G7Fgm5neQGzW2gEn+IjQrsJbHFrMI/yg28VmMOveWxti49t7ifUJpo2q135zZoKtY1xVvbireMEHnFXSCpL6akhdwm84u6RSWaLTxp5t8Az7glsZKb4RoH3CNyjBa2hUWALoY6iRWABqfSCuitd6a50DA3RqYlGIaEdOwv1Ek92eiLw/hBrUEF0RER0QZA15P7AJzo9yfRT/wNj1w7CEvNligAAAABJRU5ErkJggg==',
|
||||
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAB0VBMVEX////i5efi5efi5efi5efi5efAxsvi5efi5efi5eewt73i5ee1u8G/xcrJztLb3+Gyub/N0dW+xMnW29/K0djxVkLxVkLxVkLxVkLwZFLsiHzk1tbxVkLwYlDxWkb2joD3m4/2jH/zcWDxWUXxV0Pzaljza1rzaVfxW0fza1nyX0zyY1H+7uz/////+/v5u7PyYk/1h3n96uf+9PL70873npPyZVL3pJn+8vD//Pv7zsjxXEn3oZb+8e/1in395uP/+vr2lon5ta3++Pfzbl3xW0j//v75sqnxWUb0e2z1g3T96OX+9PP82dT94d7829b839v/+vn70cv+8O74qqD6xb/yYE36x8H1iHr0dmb0dWX4p5z2joH94+D0fW73mY37ysT0fm74ppv0emr95uT83dj71dD1hHX7zcf5s6vzbFr96uj1gXL2k4b/+fj++PjyY1D3oJX5saj1hXf1iXv0fm/zcmH819PxWET2lIj+9fT1i33zdGP81dD95OHzb133mo73npL94t72kIP+8vH6v7j6w7z1gnT84Nz97Or0fGzyYU783Nj6xb7+8/L6xr/yXkv2lor84d3sbl/hopzta1vM0tjM09rS2N7M09ng4+XO9mvSAAAAHXRSTlMAJH6y5v/AAW71/7T///////////8apub/////6uVo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WEKgc+EAAAAASUVORK5CYII=',
|
||||
host: ['pdf.example.com'],
|
||||
popup: function (text) {
|
||||
openInNewTab('https://barrer.github.io/tools/pdfjs/web/viewer.html');
|
||||
|
@ -523,8 +523,12 @@
|
|||
function popupCenter(url, title, w, h) {
|
||||
gm.set(gm.REDIRECT_URL, url);
|
||||
url = 'https://example.com';
|
||||
var x = screen.width / 2 - w / 2;
|
||||
var y = screen.height / 2 - h / 2;
|
||||
w = w > screen.availWidth ? screen.availWidth : w;
|
||||
h = h > screen.availHeight ? screen.availHeight : h;
|
||||
var x = screen.availWidth / 2 - w / 2;
|
||||
var y = screen.availHeight / 2 - h / 2;
|
||||
x = x < 0 ? 0 : x;
|
||||
y = y < 0 ? 0 : y;
|
||||
var win;
|
||||
try {
|
||||
win = window.open('', title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + y + ', left=' + x);
|
||||
|
|
Loading…
Reference in New Issue
Block a user