Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I discover rare translation bookmarklets using bing translator, yandex translator.....it will be good idea please to check their security code and add the best ones to enrich the catalog ! #55

Open
trimechee opened this issue Oct 13, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@trimechee
Copy link

trimechee commented Oct 13, 2024

Feature description

Hello, I discover many translation bookmarklet using bing translator, yandex translator.....
it will be good idea please to check their code and add the best ones to enrich the catalog !


************************************************************
bookmarklets BING TRANSLATOR traduire traducteur traduction

javascript:q=(document.location.href);void(open(http://www.microsofttranslator.com/bv.aspx?from=&to=auto&a='+escape(q),'_self','resizable,location,menubar,toolbar,scrollbars,status'));

javascript:q=(document.location.href);void(open(http://www.microsofttranslator.com/bv.aspx?from=&to=fr&a='+escape(q),'_self','resizable,location,menubar,toolbar,scrollbars,status'));

javascript:q=(document.location.href);void(open(http://www.microsofttranslator.com/bv.aspx?from=&to=en&a='+escape(q),'_self','resizable,location,menubar,toolbar,scrollbars,status'));




*****************************************************************

*bookmarklets yandex translator

javascript:q=(document.location.href);void(open('https://translate.yandex.com/translate?lang=auto-auto&url='+escape(q),'_self','resizable,location,menubar,toolbar,scrollbars,status'));

javascript:q=(document.location.href);void(open('http://online-translator.com/siteTranslation/autolink/?direction=ar&template=General&sourceURL='+escape(q),'_self','resizable,location,menubar,toolbar,scrollbars,status'));



********************************************************


bookmarklets google translator bookmarklet traduire google traduction traducteur

javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/?text=%27+t+%27&hl=auto&langpair=auto|auto&tbb=1&ie=%27+e;}else{location.href=%27http://translate.google.com/translate?u=%27+encodeURIComponent(location.href)+%27&hl=fr&langpair=auto|auto&tbb=1&ie=%27+e;};

javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/?text='+t+'&hl=auto&langpair=auto|auto&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=auto&langpair=auto|auto&tbb=1&ie='+e;};

https://zingmp3-vn.translate.goog/?_x_tr_sl=vi&_x_tr_tl=fr&_x_tr_hl=fr&_x_tr_pto=sc

javascript:(function(){var%20a=window.getSelection(),b='';if(a!=''){a='text='+encodeURIComponent(a)}else{a='u='+encodeURIComponent(location.href);b='translate'};window.open('https://translate.google.com/'+b+'?sl=auto&tl=en&'+a,'_blank','height=800,width=600,noreferrer,noopener')})();

javascript:(function(){var%20a=window.getSelection(),b='';if(a!=''){a='text='+encodeURIComponent(a)}else{a='u='+encodeURIComponent(location.href);b='translate'};window.open('https://translate.google.com/'+b+'?sl=auto&tl=en&'+a,'_blank','noreferrer,noopener')})();












****************************************************************
translate to french francais

javascript:%28function %28%29 %7B var console %3D %28function %28%29 %7B var iframe %3D document.getElementById%28%27xxxJanConsole%27%29%3B if %28%21iframe%29 %7B iframe %3D document.createElementNS%28%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%27%2C %27iframe%27%29%3B iframe.id %3D %27xxxJanConsole%27%3B iframe.style.display %3D %27none%27%3B %28document.body %7C%7C document.documentElement%29.appendChild%28iframe%29%3B %7D return iframe %26%26 iframe.contentWindow %26%26 iframe.contentWindow.console %7C%7C %7B log%3A function %28%29 %7B%7D %7D%3B %7D%29%28%29%3B var s %3D %28function %28%29 %7B %2F%2A%s%2A%2F%3B %7D%29.toString%28%29 .replace%28%2F%5Efunction%5Cs%2A%5C%28%5Cs%2A%5C%29%5Cs%2A%5C%7B%5Cs%2A%5C%2F%5C%2A%2F%2C %27%27%29 .replace%28%2F%5C%2A%5C%2F%5Cs%2A%5C%3B%3F%5Cs%2A%5C%7D%5Cs%2A%24%2F%2C %27%27%29 .replace%28%2F%5Cu0025s%2F%2C %27%27%29%3B if %28s %3D%3D%3D %27%27%29 %7B function getActiveSelection%28doc%29 %7B if %28arguments.length %3D%3D%3D 0%29 %7B doc %3D document%3B %7D if %28%21doc %7C%7C typeof doc.getSelection %21%3D%3D %27function%27%29 %7B return %27%27%3B %7D if %28%21doc.activeElement%29 %7B return doc.getSelection%28%29 %2B %27%27%3B %7D var activeElement %3D doc.activeElement%3B try %7B if %28 typeof activeElement.contentDocument %3D%3D%3D %27object%27 %26%26 activeElement.contentDocument %21%3D%3D null %29 %7B return getActiveSelection%28activeElement.contentDocument%29%3B %7D %7D catch %28e%29 %7B return doc.getSelection%28%29 %2B %27%27%3B %7D if %28typeof activeElement.value %3D%3D%3D %27string%27%29 %7B if %28activeElement.selectionStart %21%3D%3D activeElement.selectionEnd%29 %7B return activeElement.value.substring%28activeElement.selectionStart%2C activeElement.selectionEnd%29%3B %7D return activeElement.value%3B %7D return doc.getSelection%28%29 %2B %27%27%3B %7D s %3D getActiveSelection%28%29%3B if %28%21s%29 %7B var interLanguageSelectors %3D %5B %27.interlanguage-link a%5Bhref%5D%5Bhreflang%3D"fr"%5D%27%2C %27%23language a%5Bhref%5D%5Bhreflang%3D"fr"%5D%27%2C %27link%5Brel%3D"alternate"%5D%5Bhreflang%3D"fr"%5D%27%2C %27link%5Brel%3D"alternate"%5D%5Bhreflang%5E%3D"fr-"%5D%27%2C %27%5Bid%2A%3D"lang"%5D%5Bid%2A%3D"elect"%5D a%5Bhreflang%3D"fr"%5D%27%2C %27%5Bid%2A%3D"lang"%5D%5Bid%2A%3D"elect"%5D a%5Bhreflang%5E%3D"fr-"%5D%27%2C %27%5Bclass%2A%3D"lang"%5D%5Bclass%2A%3D"elect"%5D a%5Bhreflang%3D"fr"%5D%27%2C %27%5Bclass%2A%3D"lang"%5D%5Bclass%2A%3D"elect"%5D a%5Bhreflang%5E%3D"fr-"%5D%27%2C %27a.language%5Bhref%2A%3D"%2Ffr%2F"%5D%27%2C %27a%5Bhref%5D%5Btitle%24%3D"this page in French"%5D%27%2C %27a%5Bhref%5D%5Btitle%24%3D"cette page en français"%5D%27 %5D%3B for %28var link%2C i %3D 0%3B i < interLanguageSelectors.length%3B i%2B%2B%29 %7B link %3D document.querySelector%28interLanguageSelectors%5Bi%5D%29%3B if %28link%29 %7B console.log%28%27Translate to French%3A found link for selector %27%2C interLanguageSelectors%5Bi%5D%2C %27%3A %27%2C link%29%3B location %3D link.href%3B return%3B %7D %7D var interLanguageXPathSelectors %3D %5B %27%2F%2Fa%5B%40href%5D%5Btranslate%28.%2C "ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZРУСКИЙ"%2C "abcçdefghijklmnñopqrstuvwxyzруский"%29 %3D "fr"%5D%27%2C %27%2F%2Fa%5B%40href%5D%5Btranslate%28.%2C "ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZРУСКИЙ"%2C "abcçdefghijklmnñopqrstuvwxyzруский"%29 %3D "français"%5D%27%2C %27%2F%2Fa%5B%40href%5D%5Bcontains%28.%2C "page in French"%29%5D%27%2C %5D%3B for %28i %3D 0%3B i < interLanguageXPathSelectors.length%3B i%2B%2B%29 %7B var xPathResult %3D document.evaluate%28interLanguageXPathSelectors%5Bi%5D%2C document%2C null%2C XPathResult.ORDERED_NODE_SNAPSHOT_TYPE%2C null%29%3B if %28xPathResult.snapshotLength%29 %7B console.log%28%27Translate to French%3A found link for selector %27%2C interLanguageXPathSelectors%5Bi%5D%2C %27%3A %27%2C xPathResult.snapshotItem%280%29%29%3B location %3D xPathResult.snapshotItem%280%29.href%3B return%3B %7D %7D const wikimediaDomains %3D %5B %27wikipedia.org%27%2C %27wiktionary.org%27%2C %27wikibooks.org%27%2C %27wikinews.org%27%2C %27wikiquote.org%27%2C %27wikisource.org%27%2C %27wikiversity.org%27%2C %27wikivoyage.org%27%2C %5D%3B const possibleWikimediaDomainMatches %3D location.host.match%28%2F.%2A%3F%5C.%28m%5C.%29%3F%28%5B%5E.%5D%2B%5C.%5B%5E.%5D%2B%24%29%2F%29%3B if %28possibleWikimediaDomainMatches%29 %7B const possibleWikimediaDomain %3D possibleWikimediaDomainMatches%5B2%5D%3B if %28wikimediaDomains.indexOf%28possibleWikimediaDomain%29 > -1 %26%26 %21document.querySelector%28%27%23ca-view%27%29%29 %7B const mobileSubdomain %3D possibleWikimediaDomainMatches%5B1%5D%3B const languageSubdomain %3D %27fr%27.replace%28%2F-.%2A%2F%2C %27%27%29%3B const targetLanguageDomain %3D %60%24%7BlanguageSubdomain%7D.%24%7BmobileSubdomain %3F%3F %27%27%7D%24%7BpossibleWikimediaDomain%7D%60%3B console.log%28%60Translate to French%3A Wikimedia special case%3A going to the corresponding page on the French domain %24%7BtargetLanguageDomain%7D%60%29%3B location.host %3D targetLanguageDomain%3B return%3B %7D %7D s %3D %28location.protocol %2B %27%27%29.match%28%2F%5Ehttp%2F%29 %3F location %2B %27%27 %3A %27%27%3B if %28%21s%29 %7B s %3D prompt%28%27Please enter your text to translate to French%3A%27%29%3B %7D %7D %7D else %7B s %3D s.replace%28%2F%28%5E%7C%5Cs%7C"%29~%28"%7C%5Cs%7C%24%29%2Fg%2C %27%241%27 %2B getSelection%28%29 %2B %27%242%27%29%3B %7D if %28s%29 %7B if %28s.match%28%2F%5E%28https%3F%3A%5C%2F%5C%2F%29%28%5B%5E%5Cs.%5D%2B%5C.%29%2B%5B%5E%5Cs.%5D%2B%5C.%3F%28%5C%2F%5CS%2A%29%3F%24%2F%29%29 %7B const googleTranslateUrl %3D new URL%28s%29%3B const isHttp %3D googleTranslateUrl.protocol %3D%3D%3D %27http%3A%27%3B googleTranslateUrl.protocol %3D %27https%27%3B googleTranslateUrl.host %3D googleTranslateUrl.host.replaceAll%28%27-%27%2C %27--%27%29.replaceAll%28%27.%27%2C %27-%27%29 %2B %27.translate.goog%27%3B if %28isHttp%29 %7B googleTranslateUrl.searchParams.set%28%27_x_tr_sch%27%2C %27http%27%29%3B %7D googleTranslateUrl.searchParams.set%28%27_x_tr_sl%27%2C %27auto%27%29%3B googleTranslateUrl.searchParams.set%28%27_x_tr_tl%27%2C %27fr%27%29%3B location %3D googleTranslateUrl%3B %7D else %7B location %3D %27https%3A%2F%2Ftranslate.google.com%2F%3Fop%3Dtranslate%26sl%3Dauto%26tl%3Dfr%26text%3D%27 %2B encodeURIComponent%28s%29%3B %7D %7D %7D%29%28%29%3B

traduire translate to english anglais

javascript:%28function %28%29 %7B var console %3D %28function %28%29 %7B var iframe %3D document.getElementById%28%27xxxJanConsole%27%29%3B if %28%21iframe%29 %7B iframe %3D document.createElementNS%28%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%27%2C %27iframe%27%29%3B iframe.id %3D %27xxxJanConsole%27%3B iframe.style.display %3D %27none%27%3B %28document.body %7C%7C document.documentElement%29.appendChild%28iframe%29%3B %7D return iframe %26%26 iframe.contentWindow %26%26 iframe.contentWindow.console %7C%7C %7B log%3A function %28%29 %7B%7D %7D%3B %7D%29%28%29%3B var s %3D %28function %28%29 %7B %2F%2A%s%2A%2F%3B %7D%29.toString%28%29 .replace%28%2F%5Efunction%5Cs%2A%5C%28%5Cs%2A%5C%29%5Cs%2A%5C%7B%5Cs%2A%5C%2F%5C%2A%2F%2C %27%27%29 .replace%28%2F%5C%2A%5C%2F%5Cs%2A%5C%3B%3F%5Cs%2A%5C%7D%5Cs%2A%24%2F%2C %27%27%29 .replace%28%2F%5Cu0025s%2F%2C %27%27%29%3B if %28s %3D%3D%3D %27%27%29 %7B function getActiveSelection%28doc%29 %7B if %28arguments.length %3D%3D%3D 0%29 %7B doc %3D document%3B %7D if %28%21doc %7C%7C typeof doc.getSelection %21%3D%3D %27function%27%29 %7B return %27%27%3B %7D if %28%21doc.activeElement%29 %7B return doc.getSelection%28%29 %2B %27%27%3B %7D var activeElement %3D doc.activeElement%3B try %7B if %28 typeof activeElement.contentDocument %3D%3D%3D %27object%27 %26%26 activeElement.contentDocument %21%3D%3D null %29 %7B return getActiveSelection%28activeElement.contentDocument%29%3B %7D %7D catch %28e%29 %7B return doc.getSelection%28%29 %2B %27%27%3B %7D if %28typeof activeElement.value %3D%3D%3D %27string%27%29 %7B if %28activeElement.selectionStart %21%3D%3D activeElement.selectionEnd%29 %7B return activeElement.value.substring%28activeElement.selectionStart%2C activeElement.selectionEnd%29%3B %7D return activeElement.value%3B %7D return doc.getSelection%28%29 %2B %27%27%3B %7D s %3D getActiveSelection%28%29%3B if %28%21s%29 %7B var interLanguageSelectors %3D %5B %27.interlanguage-link a%5Bhref%5D%5Bhreflang%3D"en"%5D%27%2C %27%23language a%5Bhref%5D%5Bhreflang%3D"en"%5D%27%2C %27link%5Brel%3D"alternate"%5D%5Bhreflang%3D"en"%5D%27%2C %27link%5Brel%3D"alternate"%5D%5Bhreflang%5E%3D"en-"%5D%27%2C %27%5Bid%2A%3D"lang"%5D%5Bid%2A%3D"elect"%5D a%5Bhreflang%3D"en"%5D%27%2C %27%5Bid%2A%3D"lang"%5D%5Bid%2A%3D"elect"%5D a%5Bhreflang%5E%3D"en-"%5D%27%2C %27%5Bclass%2A%3D"lang"%5D%5Bclass%2A%3D"elect"%5D a%5Bhreflang%3D"en"%5D%27%2C %27%5Bclass%2A%3D"lang"%5D%5Bclass%2A%3D"elect"%5D a%5Bhreflang%5E%3D"en-"%5D%27%2C %27a.language%5Bhref%2A%3D"%2Fen%2F"%5D%27%2C %27a%5Bhref%5D%5Btitle%24%3D"this page in English"%5D%27%2C %27a%5Bhref%5D%5Btitle%24%3D"current page in English"%5D%27 %5D%3B for %28var link%2C i %3D 0%3B i < interLanguageSelectors.length%3B i%2B%2B%29 %7B link %3D document.querySelector%28interLanguageSelectors%5Bi%5D%29%3B if %28link%29 %7B console.log%28%27Translate to English%3A found link for selector %27%2C interLanguageSelectors%5Bi%5D%2C %27%3A %27%2C link%29%3B location %3D link.href%3B return%3B %7D %7D var interLanguageXPathSelectors %3D %5B %27%2F%2Fa%5B%40href%5D%5Btranslate%28.%2C "ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZРУСКИЙ"%2C "abcçdefghijklmnñopqrstuvwxyzруский"%29 %3D "en"%5D%27%2C %27%2F%2Fa%5B%40href%5D%5Btranslate%28.%2C "ABCÇDEFGHIJKLMNÑOPQRSTUVWXYZРУСКИЙ"%2C "abcçdefghijklmnñopqrstuvwxyzруский"%29 %3D "english"%5D%27%2C %27%2F%2Fa%5B%40href%5D%5Bcontains%28.%2C "page in English"%29%5D%27%2C %5D%3B for %28i %3D 0%3B i < interLanguageXPathSelectors.length%3B i%2B%2B%29 %7B var xPathResult %3D document.evaluate%28interLanguageXPathSelectors%5Bi%5D%2C document%2C null%2C XPathResult.ORDERED_NODE_SNAPSHOT_TYPE%2C null%29%3B if %28xPathResult.snapshotLength%29 %7B console.log%28%27Translate to English%3A found link for selector %27%2C interLanguageXPathSelectors%5Bi%5D%2C %27%3A %27%2C xPathResult.snapshotItem%280%29%29%3B location %3D xPathResult.snapshotItem%280%29.href%3B return%3B %7D %7D const wikimediaDomains %3D %5B %27wikipedia.org%27%2C %27wiktionary.org%27%2C %27wikibooks.org%27%2C %27wikinews.org%27%2C %27wikiquote.org%27%2C %27wikisource.org%27%2C %27wikiversity.org%27%2C %27wikivoyage.org%27%2C %5D%3B const possibleWikimediaDomainMatches %3D location.host.match%28%2F.%2A%3F%5C.%28m%5C.%29%3F%28%5B%5E.%5D%2B%5C.%5B%5E.%5D%2B%24%29%2F%29%3B if %28possibleWikimediaDomainMatches%29 %7B const possibleWikimediaDomain %3D possibleWikimediaDomainMatches%5B2%5D%3B if %28wikimediaDomains.indexOf%28possibleWikimediaDomain%29 > -1 %26%26 %21document.querySelector%28%27%23ca-view%27%29%29 %7B const mobileSubdomain %3D possibleWikimediaDomainMatches%5B1%5D%3B const languageSubdomain %3D %27en%27.replace%28%2F-.%2A%2F%2C %27%27%29%3B const targetLanguageDomain %3D %60%24%7BlanguageSubdomain%7D.%24%7BmobileSubdomain %3F%3F %27%27%7D%24%7BpossibleWikimediaDomain%7D%60%3B console.log%28%60Translate to English%3A Wikimedia special case%3A going to the corresponding page on the English domain %24%7BtargetLanguageDomain%7D%60%29%3B location.host %3D targetLanguageDomain%3B return%3B %7D %7D s %3D %28location.protocol %2B %27%27%29.match%28%2F%5Ehttp%2F%29 %3F location %2B %27%27 %3A %27%27%3B if %28%21s%29 %7B s %3D prompt%28%27Please enter your text to translate to English%3A%27%29%3B %7D %7D %7D else %7B s %3D s.replace%28%2F%28%5E%7C%5Cs%7C"%29~%28"%7C%5Cs%7C%24%29%2Fg%2C %27%241%27 %2B getSelection%28%29 %2B %27%242%27%29%3B %7D if %28s%29 %7B if %28s.match%28%2F%5E%28https%3F%3A%5C%2F%5C%2F%29%28%5B%5E%5Cs.%5D%2B%5C.%29%2B%5B%5E%5Cs.%5D%2B%5C.%3F%28%5C%2F%5CS%2A%29%3F%24%2F%29%29 %7B const googleTranslateUrl %3D new URL%28s%29%3B const isHttp %3D googleTranslateUrl.protocol %3D%3D%3D %27http%3A%27%3B googleTranslateUrl.protocol %3D %27https%27%3B googleTranslateUrl.host %3D googleTranslateUrl.host.replaceAll%28%27-%27%2C %27--%27%29.replaceAll%28%27.%27%2C %27-%27%29 %2B %27.translate.goog%27%3B if %28isHttp%29 %7B googleTranslateUrl.searchParams.set%28%27_x_tr_sch%27%2C %27http%27%29%3B %7D googleTranslateUrl.searchParams.set%28%27_x_tr_sl%27%2C %27auto%27%29%3B googleTranslateUrl.searchParams.set%28%27_x_tr_tl%27%2C %27en%27%29%3B location %3D googleTranslateUrl%3B %7D else %7B location %3D %27https%3A%2F%2Ftranslate.google.com%2F%3Fop%3Dtranslate%26sl%3Dauto%26tl%3Den%26text%3D%27 %2B encodeURIComponent%28s%29%3B %7D %7D %7D%29%28%29%3B

javascript:location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=%s&hl=EN&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools'






************************************************************


TRANSLATE TRADUIRE TRADUCTION script

https://gist.github.com/andykant/442361

andykant/mass_google_translate_bookmarklet.js
Created 12 years ago • Report abuse
1
0
Code
Revisions
6

<script src="https://gist.github.com/andykant/442361.js"></script>
A mass Google Translate bookmarklet
mass_google_translate_bookmarklet.js
/*
1. Copy the compressed version into a bookmark address
2. Go to Google Translate: http://translate.google.com/
3. Paste your message block in the textarea (default delimiters are new lines for each message and '=' to separate the key/value
4. Click the bookmarklet
5. The result is injected back into the textarea, focused, and selected
6. Copy + paste back into your message file
*/

// compressed
javascript:(function(){var $=function(el){return document.getElementById(el)},chomp=function(str){return str.replace(/^[\s\n\r]/,'').replace(/[\s\n\r]
Extra close brace or missing open brace

$/,'')},source=$
('source'),messages=chomp(source.value).split(/[\r\n]/),delimiter='=',data=[],text=[],message,i;for(i=0;(message=messages[i]);i++){message=messages[i]=chomp(message).split(delimiter);message[1]=messages[i][1]=message.slice(1).join(delimiter);data.push(message[1])}source.value=data.join('\n');window.location.hash='#'+$('old_sl').value+'|'+$('old_tl').value+'|'+encodeURIComponent(data.join('\n'));setTimeout(function parse(){var translations=$('result_box').childNodes,results=[];if(translations.length>messages.length){alert('Found too many translated messages, please try a smaller subset')}else if(translations.length!==messages.length){setTimeout(parse,100);return}for(i=0;(message=messages[i]);i++){results.push(message[0]+'='+(translations[i]?translations[i].firstChild.textContent:''))}source.value=results.join('\n');source.focus();source.setSelectionRange(0,source.value.length)},100)})()

// expanded
javascript:(function() {
var $ = function(el) { return document.getElementById(el); },
chomp = function(str) { return str.replace(/^[\s\n\r]/,'').replace(/[\s\n\r]$/,''); },
source = $('source'),
messages = chomp(source.value).split(/[\r\n]/),
delimiter = '=',
data = [],
text = [],
message, i;

for (i = 0; (message = messages[i]); i++) {
    message = messages[i] = chomp(message).split(delimiter);
    message[1] = messages[i][1] = message.slice(1).join(delimiter);
    data.push(message[1]);
}
source.value = data.join('\n');
window.location.hash = '#' + $('old_sl').value + '|' + $('old_tl').value + '|' + encodeURIComponent(data.join('\n'));

setTimeout(function parse() {
    var translations = $('result_box').childNodes,
        results = [];
    
    if (translations.length > messages.length) {
        alert('Found too many translated messages, please try a smaller subset');
    }
    else if (translations.length !== messages.length) {
        setTimeout(parse, 100);
        return;
    }
    
    for (i = 0; (message = messages[i]); i++) {
        results.push(message[0] + '=' + (translations[i] ? translations[i].firstChild.textContent : ''));
    }
    
    source.value = results.join('\n');
    source.focus();
    source.setSelectionRange(0, source.value.length);
}, 100);


})()








*******************************************************************************

TRANSLATION script 

https://github.com/Raj9039852537/userscript-for-Via-browser/blob/main/Google%20Translate.user.js




/*
 * @name: Google native web page translation
 * @Author: Gu Huatai
 * @version: 2.0
 * @description: call the Google translation interface to translate the entire website
 * @include: *
 * @createTime: 2019-10-12 09:11:58
 * @updateTime: 2020-03-16 00:51:04
 */

(function () {
  /* Determine whether to execute */
  /* URL blacklist system, not implemented when encountering these domain names */
  const blackList = ['zhihu.com', 'twitter.com', 'wenku.baidu.com', 'wk.baidu.com','127.0.0.1','js13kgames.com',/otherl/];
 const whiteList = ['bext.ketra.fun','via-app.cn','bilibili.com','sogou.com',/.cn$/];
  const hostname = window.location.hostname;
  const key = encodeURIComponent('gimmick : ready to translate ');
  const isBlack = blackList.some(keyword => {
    if (hostname.match(keyword)) {
      return true;
    };
    return false;
  });
 const isWhite = whiteList.some(keyword => {
    if (hostname.match(keyword)) {
      return true;
    };
    return false;
  });
try{
  if (isBlack || window[key]) {
    return;
  };
  window[key] = true;

const dic = document.createElement('div');
  dic.id = 'tranlator';
  dic.innerHTML = "🇬🇧🇮🇳?";
  dic.setAttribute('style', `
    position: fixed;
    bottom: 5%;
    right: 5%;user-select:none;
    z-index: 999999998;
  `);


var tlate=function(){ 
  /* Start code execution */
  const config = {
    initName: 'googleTranslate',
    initElm: 'google_translate_elm',
    /*Multilingual page support*/
    multilanguagePage: true,
    /* Source language*/
    pageLanguage: 'auto',
    /*target language*/
    includedLanguages: 'hi,en',
    /* Hide tool bar */
    autoDisplay: false
  };

  /* Inject Google Translate script */
  const script = document.createElement('script');
  script.src = `//translate.google.com/translate_a/element.js?&cb=${config.initName}`;
  script.async = true;
  document.head.appendChild(script);

  /* Create the language selection box container in the lower right corner of Google Translate */
  const div = document.createElement('div');
  div.id = config.initElm;
  div.setAttribute('style', `
    position: fixed;
    bottom: 5vw;
    right: 5vw;user-select:none;
    z-index: 999999999;
  `);
  document.documentElement.appendChild(div);

  /* Some styles */
  const style = document.createElement('style');
  style.innerHTML = `
    body {
      position: relative;
      top: 0 !important;
      left: 0 !important;    
    }
    .skiptranslate iframe{
      width: 0px !important;
      height: 0px !important;
      overflow: hidden;
      display: none !important;
    }
    .goog-te-gadget-simple {
      border: 1px solid #ececec !important;
      border-radius: 4px;
      padding: 8px;
      line-height: 26px;
      text-align: center;
    }
    .goog-te-gadget-simple a,.goog-te-gadget-simple a:link,.goog-te-gadget-simple a:visited,.goog-te-gadget-simple a:hover,.goog-te-gadget-simple a:active{
      text-decoration: none;
      color:inherit;
    }
   div#tranlator{display:none;}
  `;
  document.head.appendChild(style);

  /* Google Translate instantiation function */
  window[config.initName] = () => {
    new window.google.translate.TranslateElement({
      layout: google.translate.TranslateElement.InlineLayout.SIMPLE,
      multilanguagePage: config.multilanguagePage,
      pageLanguage: config.pageLanguage,
      includedLanguages: config.includedLanguages,
      autoDisplay: config.autoDisplay
    }, config.initElm);
  };

  /* Monitor dom function */
  function observe({ targetNode, config = {}, callback = () => { } }) {
    if (!targetNode) {
      return;
    };
    config = Object.assign({
      attributes: true,
      childList: true,
      subtree: true
    }, config);
    const observer = new MutationObserver(callback);
    observer.observe(targetNode, config);
  };

  /* Listen to the language selection box in the lower right corner */
  const initElm = document.querySelector(`#${config.initElm}`);
  observe({
    targetNode: initElm,
    config: {
      attributes: false
    },
    callback(mutationList, observer) {
      /* Traverse nodes */
      mutationList.forEach(mutation => {
        Array.from(mutation.addedNodes, node => {
          /* clear google image */
          const googleImages = document.querySelectorAll(`#goog-gt-tt img, #${config.initElm} img`);
          Array.from(googleImages, img => {
            img.parentNode.removeChild(img);
          });

          /* Add close button */
          if (node.className === 'goog-te-menu-value') {
            const btnContent = document.querySelector('.goog-te-gadget-simple > span > a');
            const closeBtn = document.createElement('span');
            closeBtn.innerText = '× | ';
            closeBtn.addEventListener('click', (e) => {
              initElm.parentNode.removeChild(initElm);
              e.stopPropagation();
            }, true);
            btnContent.parentNode.insertBefore(closeBtn, btnContent);
          };

        });
        /* End monitoring */
        observer.disconnect();
      });
    }
  });
};

if(isWhite){tlate();}else{
  dic.onclick=function(){tlate()};document.documentElement.appendChild(dic);};
}catch(a){alert(a);}
})();

Anything else?

No response

@trimechee trimechee added the enhancement New feature or request label Oct 13, 2024
@trimechee trimechee changed the title I discover rare translation bookmarklets using bing translator, yandex translator.....it will be good idea please to check their code and add the best ones to enrich the catalog ! I discover rare translation bookmarklets using bing translator, yandex translator.....it will be good idea please to check their security code and add the best ones to enrich the catalog ! Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants