Open trimechee opened 1 month ago
Hi @trimechee,
Let me see if I understand correctly what you need. I will describe the steps and please correct my mistakes:
Does that sound right or am I missing something?
Hi Mr @thomasleplus, thank you very much for considering my request ! 💯 🥇
I usually go to a youtube channel like the after foot one, or a youtube channel of a tv or radio channel or a youtube channel of documentaries:
https://www.youtube.com/@After-Foot/videos
https://www.youtube.com/RMCSport/videos
https://www.youtube.com/@TVCRIMEDocumentaireshomicides/videos
https://www.youtube.com/@TrueCrimeStoriesDocs/videos
I usually point my mouse to the videos I choose to download/right click/copy the url address, and these urls are automatically captured by the media downloader software in which I have activated the option "automatically paste the urls into the clipboard"
but sometimes I download a lot of videos, and it's tiring, boring to right click and check in the context menu that you click on "copy url address",
i prefer to click on the video with the left click, so I can use, hopefully your future bookmarklet to copy the url address
which is displayed in the address bar, I prefer that than having to right click and search in the context menu for the box 'copy url address",
because recently, my laptop broke down, so I went back to using my little old eee pc made in 2012 which has no fan,
so it's difficult for me on a small screen to have to right click and have to search in the context menu of the youtube video for the box copy url address,
i prefer to click on the video that is displayed so I can quickly easily copy the url address of the video via a bookmarklet, then I go back to the videos page of the youtube channel,
also I do search, I often copy text, extracts from web pages to paste them on word, twitter threads ....
and when I select the text, I would like to use a bookmarklet that also copies the selected text because having to right-click each time to choose "copy" is tiring and annoying, I don't like the context menu that includes a lot of boxes, I prefer to copy the selected text via a bookmarklet,
yes I found extensions that allow you to select the url address and auto copy the selected text, but the extension for chrome is not open source, and I use catsxp browser because it is compatible with my windows 7 32-bit os and catsxp uses the latest version of chromium kernel which is rare exceptinnel on windows 7, there is no open source extension for chrome to do that,
and in addition I would like to avoid using extensions to copy the url address and the selected text, because my little pc has no fan and heats up a lot and often when I open some tabs in the web browser, my laptop stops working abruptly, that's why I prefer to avoid using extensions (I already use ublock origin with hundreds of thousands of blockists, video downloader extensions like cat-catch, live stream downloader, (alt) stream recorder from the edge store )
and I prefer to opt for lightweight solutions like bookmarklets that do not heat up my cpu in order to avoid the abrupt shutdown of my laptop!
I found bookmarklets for google keep and pocket, the problem is that some bookmarklets do not automatically add the selected links to google keep and pocket or do not work properly and we hope please that Mr Thomas can improve the operation and security of these bookmarklets please, thank you very much!
i find also this reading dark mode bookmarklet but even i tried , i don't know how add thos bookmarklet to my bookmarks bar :
https://gist.github.com/luckyshot/8a28768ae0f7035146946272563d8863
pocket bookmarkelt
+pocket Bookmarklet https://gist.github.com/helllth/4011264 javascript:(function()%7BISRIL_H='4b92';PKT_D='getpocket.com';ISRIL_SCRIPT=document.createElement('SCRIPT');ISRIL_SCRIPT.type='text/javascript';ISRIL_SCRIPT.src='http://'+PKT_D+'/b/r.js';document.getElementsByTagName('head')%5B0%5D.appendChild(ISRIL_SCRIPT)%7D)();
Pocket bookmarklet javascript:(function(){var%20e=function(t,n,r,i,s){var%20o=[3201465,5035344,6004026,1939028,4354726,5934764,4150418,3790639,1254730,2794236];var%20i=i||0,u=0,n=n||[],r=r||0,s=s||0;var%20a={'a':97,'b':98,'c':99,'d':100,'e':101,'f':102,'g':103,'h':104,'i':105,'j':106,'k':107,'l':108,'m':109,'n':110,'o':111,'p':112,'q':113,'r':114,'s':115,'t':116,'u':117,'v':118,'w':119,'x':120,'y':121,'z':122,'A':65,'B':66,'C':67,'D':68,'E':69,'F':70,'G':71,'H':72,'I':73,'J':74,'K':75,'L':76,'M':77,'N':78,'O':79,'P':80,'Q':81,'R':82,'S':83,'T':84,'U':85,'V':86,'W':87,'X':88,'Y':89,'Z':90,'0':48,'1':49,'2':50,'3':51,'4':52,'5':53,'6':54,'7':55,'8':56,'9':57,'\/':47,':':58,'?':63,'=':61,'-':45,'_':95,'&':38,'$':36,'!':33,'.':46};if(!s||s==0){t=o[0]+t}for(var%20f=0;f<t.length;f++){var%20l=function(e,t){return%20a[e[t]]?a[e[t]]:e.charCodeAt(t)}(t,f);if(!l1)l=3;var%20c=l(o[i]+lo[u%o.length]);n[r]=(n[r]?n[r]+c:c)+s+u;var%20p=c%(501);if(n[p]){var%20d=n[r];n[r]=n[p];n[p]=d}u+=c;r=r==50?0:r+1;i=i==o.length-1?0:i+1}if(s==322){var%20v='';for(var%20f=0;f<n.length;f++){v+=String.fromCharCode(n[f]%(25*1)+97)}o=function(){};return%20v+'05c853ed81'}else{return%20e(u+'',n,r,i,s+1)}};var%20t=document,n=t.location.href,r=t.title;var%20i=e(n);var%20s=t.createElement('script');s.type='text/javascript';s.src='https://getpocket.com/b/r4.js?h='+i+'&u='+encodeURIComponent(n)+'&t='+encodeURIComponent(r);e=i=function(){};var%20o=t.getElementsByTagName('head')[0]||t.documentElement;o.appendChild(s)})()
https://www.addtoany.com/services/pocket_button javascript:location.href='https://www.addtoany.com/add_to/pocket?linkurl='+encodeURIComponent(location.href)+'&linkname='+encodeURIComponent(document.title)
javascript:var pocketWindow = window.open('https://getpocket.com/edit?url='+document.location,'PocketAdd','height=300,width=600');setTimeout(function () { pocketWindow.close();}, 5000);
bookmarklets pocket reader mode save bookmarks https://gist.github.com/kortina/8cbba68393606d1b5bfc3aa0c13eea36 https://gist.github.com/helllth/4011264 https://www.addtoany.com/services/pocket_button https://xaviesteve.com/6344/add-to-pocket-bookmarklet-alternative-fixes-please-login-problem-and-other-errors/ https://gist.github.com/turtlemonvh/7c8e29974d87be7da378 https://getpocket.com/add/?ep=1 https://github.com/kepi/qutepocket https://github.com/achembarpu/pockyt https://getpocket.com/apps/bookmarks/
GOOGLE KEEP bookmarklet
javascript:void(function(){var w = 430; var h = 600; var t = (screen.height ? (screen.height - h) / 4 : 0); var l = (screen.width ? (screen.width - w) / 2 : 0); var win = window.open(%27https://drive.google.com/keep/%27,%27google-keep%27,%27width=%27+w+%27,height=%27+h+%27,top=%27+t+%27,left=%27+l+%27,location=no,personalbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes%27);})();
javascript:void(function(){var w = 430; var h = 600; var t = (screen.height ? (screen.height - h) / 4 : 0); var l = (screen.width ? (screen.width - w) / 2 : 0); var win = window.open('https://drive.google.com/keep/','google-keep','width='+w+',height='+h+',top='+t+',left='+l+',location=no,personalbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes');})();
https://keep.google.com/u/0/ https://www.google.com/save?authuser=0
https://via.hypothes.is/ https://txtpaper.com/ https://web-highlights.com https://www.paperspan.com/
instapaper offers a reliable free bookmarklet that works but I fear, one day in the future,
instapaper will decide to no longer support its bookmarket as pocket did because pocket no longer supports its bookmarklet so we hope please, if it is possible and it does not tire you, an alternative bookmarklet for instapaper please, and in addition this instapaper bookmarklet will remain for reasons of archiving and precaution because maybe one day, instapaer deletes its bookmarklet and we lose the instapaper bookmarklet code so it is a good idea to have a copy of the instapaper bookmarklet code on the github page or Mr Thomas's site :) :
https://www.instapaper.com/save
instapaper also has a rare free bookmarklet reader mode Instapaper Text bookmarklet The Instapaper Text bookmarklet converts any compatible web page into a beautifully designed Instapaper view article, right in the browser.
javascript:function iptxt(){var d=document;try{if(!d.body)throw(0);window.location='http://www.instapaper.com/text?u=%27+encodeURIComponent(d.location.href);}catch(e){alert(%27Please%20wait%20until%20the%20page%20has%20loaded.%27);}}iptxt();void(0)
same thing for raindrop bookmarklet please :
https://help.raindrop.io/install-extension/
javascript:(function()%7Bvar rspW%3D450%2CrspH%3D600%2CrspL%3DparseInt((screen.width%2F2)-(rspW%2F2))%2CrspT%3DparseInt((screen.height%2F2)-(rspH%2F2))%3Bwindow.open("https%3A%2F%2Fapp.raindrop.io%2Fadd%3Flink%3D"%2BencodeURIComponent(window.location.href)%2B"%26title%3D"%2BencodeURIComponent(document.title)%2C"raindrop-save"%2C"width%3D"%2BrspW%2B"%2Cheight%3D"%2BrspH%2B"%2Cresizable%3Dyes%2Cscrollbars%3Dyes%2Cstatus%3Dfalse%2Clocation%3Dfalse%2Ctoolbar%3Dfalse%2Cleft%3D"%2BrspL%2B"%2Ctop%3D"%2BrspT)%7D)()
and support translation from other translation platforme like bing translator or yandex translator please :
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'));
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'
*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'));
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
A mass Google Translate bookmarklet mass_google_translate_bookmarklet.js /*
// compressed 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)})()
// 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);
})()
Feature description
Anything else?
No response