https://bugs.kde.org/show_bug.cgi?id=396609

Juraj <sgd.or...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sgd.or...@gmail.com

--- Comment #4 from Juraj <sgd.or...@gmail.com> ---
Hello,
There is probably some mistake in that code (it is old).

1. As mentioned, you need to use https otherwise it will work only on http
sites
2. we can get rid or 'scri'+'pt' and replace it with 'script' (it is easier to
read)
3. And here comes the obstacle
 - Remove: v.style.display='none';
   It will display some selectbox to manually trigger translating
 - Use the select box to trigger the translating, the translate bar will appear
 - After this was done, when you use this bookmarklet again on the same tab it
will display the selectbox and also the translate toolbar and loads a lots of
scripts
4. So I presume it is some kind of error with javascript or some execution
thing...
5. The workaround is not so bad...

====

javascript:%7Bd=document;b=d.body;o=d.createElement('script');o.setAttribute('src','https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit');o.setAttribute('type','text/javascript');b.appendChild(o);v=b.insertBefore(d.createElement('div'),b.firstChild);v.id='google_translate_element';p=d.createElement('script');p.setAttribute('type','text/javascript');p.text='function%20googleTranslateElementInit()%7Bnew%20google.translate.TranslateElement(%7BpageLanguage:%22%22%7D,%22google_translate_element%22);%7D';b.appendChild(p);%7D
====

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to