Update translator
This commit is contained in:
		
							parent
							
								
									040d0ff540
								
							
						
					
					
						commit
						9144ea262d
					
				@ -7,7 +7,7 @@ function checkFinished() {
 | 
				
			|||||||
    let spans = [].slice.call(document.querySelectorAll('span.translation-chunk'));
 | 
					    let spans = [].slice.call(document.querySelectorAll('span.translation-chunk'));
 | 
				
			||||||
    let text = spans.reduce(function (res, i) {
 | 
					    let text = spans.reduce(function (res, i) {
 | 
				
			||||||
        return res + ' ' + i.innerText;
 | 
					        return res + ' ' + i.innerText;
 | 
				
			||||||
    }, '');
 | 
					    }, '').trim();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (text === lastText || text === '')
 | 
					    if (text === lastText || text === '')
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@ -25,7 +25,8 @@ function translate(text, from, to) {
 | 
				
			|||||||
    let langs = 'lang=' + from + '-' + to;
 | 
					    let langs = 'lang=' + from + '-' + to;
 | 
				
			||||||
    if (window.location.href.indexOf('//translate.yandex') !== -1
 | 
					    if (window.location.href.indexOf('//translate.yandex') !== -1
 | 
				
			||||||
        && window.location.href.indexOf(langs) !== -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(
 | 
					        document.querySelector('div#textbox').dispatchEvent(
 | 
				
			||||||
            new Event("input", { bubbles: true, cancelable: true }));
 | 
					            new Event("input", { bubbles: true, cancelable: true }));
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user