Show more if only one word is selected (#39)
This commit is contained in:
parent
9037b36548
commit
df273e22b9
|
@ -99,7 +99,7 @@ function getRequest(word) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.responseType = 'json';
|
xhr.responseType = 'json';
|
||||||
let url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=" + S.get().targetLang + "&dt=t&q=" + encodeURIComponent(word);
|
let url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=" + S.get().targetLang + "&dt=t&dt=bd&q=" + encodeURIComponent(word);
|
||||||
xhr.open("GET", url);
|
xhr.open("GET", url);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
|
@ -117,6 +117,12 @@ function showResult(results) {
|
||||||
resultText += results[j].response[0][i][0];
|
resultText += results[j].response[0][i][0];
|
||||||
}
|
}
|
||||||
resultText += "\n"; //
|
resultText += "\n"; //
|
||||||
|
|
||||||
|
if (results[j].response[1]) {
|
||||||
|
for (let i = 0; i < results[j].response[1].length; i++) {
|
||||||
|
resultText += "\n" + results[j].response[1][i][0] + ": " + results[j].response[1][i][1].join(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
panel.innerHTML = "<p></p>"
|
panel.innerHTML = "<p></p>"
|
||||||
panel.getElementsByTagName("p")[0].innerText = resultText;
|
panel.getElementsByTagName("p")[0].innerText = resultText;
|
||||||
|
|
Loading…
Reference in a new issue