Skip to content

Instantly share code, notes, and snippets.

@MrCyjaneK
Created October 18, 2019 09:56
Show Gist options
  • Save MrCyjaneK/3719cabfdfcc2b36f68464a06df5fb0f to your computer and use it in GitHub Desktop.
Save MrCyjaneK/3719cabfdfcc2b36f68464a06df5fb0f to your computer and use it in GitHub Desktop.
https://quizlet.com Hack :) Doesn't work well, and I'm too lazy to finish it
apikey = "trnsl.1.1.20191018T093555Z.b6bd9f9ec98d78a9.134f73cb647d78dc17a4723deb47325790d768f0"
// Get apikey from https://tech.yandex.com/translate/
setInterval(() => {
try {
totranslate = document.getElementsByClassName('FormattedText notranslate TermText lang-pl');
totranslate[0].innerText = translate(totranslate[0].innerText);
totranslate[1].innerText = translate(totranslate[1].innerText);
totranslate[2].innerText = translate(totranslate[2].innerText);
totranslate[3].innerText = translate(totranslate[3].innerText);
} catch (e) {
console.log(e);
}
},1500)
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return xmlHttp.responseText;
}
function getJsonHttp(theUrl) {
response = httpGet(theUrl)
return JSON.parse(response)
}
function translate(wat) {
url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key="+apikey+"&text="+encodeURIComponent(wat)+"&lang=en"
response = getJsonHttp(url).text[0];
return response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment