Update translator

This commit is contained in:
Gres 2020-04-02 19:26:12 +03:00
parent 040d0ff540
commit 9144ea262d

View File

@ -7,7 +7,7 @@ function checkFinished() {
let spans = [].slice.call(document.querySelectorAll('span.translation-chunk'));
let text = spans.reduce(function (res, i) {
return res + ' ' + i.innerText;
}, '');
}, '').trim();
if (text === lastText || text === '')
return;
@ -25,7 +25,8 @@ function translate(text, from, to) {
let langs = 'lang=' + from + '-' + to;
if (window.location.href.indexOf('//translate.yandex') !== -1
&& window.location.href.indexOf(langs) !== -1) {
document.querySelector('textarea#textarea').value = text
document.querySelector('div#fakeArea').value = text;
document.querySelector('textarea#textarea').value = text;
document.querySelector('div#textbox').dispatchEvent(
new Event("input", { bubbles: true, cancelable: true }));
return;