From 9144ea262de642c6bc5328ee17f4d52c90371b18 Mon Sep 17 00:00:00 2001 From: Gres Date: Thu, 2 Apr 2020 19:26:12 +0300 Subject: [PATCH] Update translator --- translators/yandex.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/translators/yandex.js b/translators/yandex.js index d9f249b..3722daf 100644 --- a/translators/yandex.js +++ b/translators/yandex.js @@ -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;