parent
6936914976
commit
d46c72fafb
@ -4,7 +4,7 @@ var active = window.location.href !== "about:blank";
|
|||||||
function checkFinished() {
|
function checkFinished() {
|
||||||
if (!active) return;
|
if (!active) return;
|
||||||
|
|
||||||
let spans = [].slice.call(document.querySelectorAll('span.translation > span, #result_box > span'));
|
let spans = [].slice.call(document.querySelectorAll('span.VIiyi > span > span'));
|
||||||
let text = spans.reduce(function (res, i) {
|
let text = spans.reduce(function (res, i) {
|
||||||
return res + ' ' + i.innerText;
|
return res + ' ' + i.innerText;
|
||||||
}, '');
|
}, '');
|
||||||
@ -25,10 +25,11 @@ function translate(text, from, to) {
|
|||||||
|
|
||||||
if (window.location.href.indexOf('//translate.google') !== -1
|
if (window.location.href.indexOf('//translate.google') !== -1
|
||||||
&& window.location.href.indexOf('&tl=' + to + '&') !== -1) {
|
&& window.location.href.indexOf('&tl=' + to + '&') !== -1) {
|
||||||
document.querySelector('textarea#source').value = text;
|
document.querySelector('textarea.er8xn').value = text;
|
||||||
|
document.querySelector('textarea.er8xn').dispatchEvent(
|
||||||
|
new Event("input", { bubbles: true, cancelable: true }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// let url = 'https://translate.google.com/#auto/' + to + '/' + text;
|
|
||||||
let url = 'https://translate.google.com/#view=home&op=translate&sl=auto&tl=' + to + '&text=' + encodeURIComponent(text);
|
let url = 'https://translate.google.com/#view=home&op=translate&sl=auto&tl=' + to + '&text=' + encodeURIComponent(text);
|
||||||
console.log("setting url", url);
|
console.log("setting url", url);
|
||||||
window.location = url;
|
window.location = url;
|
||||||
|
@ -585,7 +585,7 @@
|
|||||||
{"url":"https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/deepl.js", "path":"$translators$/deepl.js", "md5":"a6dfae3f63ca3fa9c7edbfaff87600e4", "size":1596}
|
{"url":"https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/deepl.js", "path":"$translators$/deepl.js", "md5":"a6dfae3f63ca3fa9c7edbfaff87600e4", "size":1596}
|
||||||
]}
|
]}
|
||||||
,"google": {"files":[
|
,"google": {"files":[
|
||||||
{"url":"https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/google.js", "path":"$translators$/google.js", "md5":"16ffead93035e08e8db13279cc8b65a7", "size":1260}
|
{"url":"https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/google.js", "path":"$translators$/google.js", "md5":"74f1064ba8f02c9c7be3821a4bdc557b", "size":1297}
|
||||||
]}
|
]}
|
||||||
,"google_api": {"files":[
|
,"google_api": {"files":[
|
||||||
{"url":"https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/google_api.js", "path":"$translators$/google_api.js", "md5":"90b9b1a5c8dc52fd4a3f28be93442a56", "size":1030}
|
{"url":"https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/google_api.js", "path":"$translators$/google_api.js", "md5":"90b9b1a5c8dc52fd4a3f28be93442a56", "size":1030}
|
||||||
|
Loading…
Reference in New Issue
Block a user