Change url escaping
This commit is contained in:
parent
45e12265c1
commit
ca99f570f7
@ -30,9 +30,9 @@ function translate(text, from, to) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = 'https://www.bing.com/translator/?from=auto&to=' + to + '&text=' + text;
|
let url = 'https://www.bing.com/translator/?from=auto&to=' + to + '&text=' + encodeURIComponent(text);
|
||||||
console.log("setting url", url);
|
console.log("setting url", url);
|
||||||
window.location = encodeURI(url);
|
window.location = url;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,9 @@ function translate(text, from, to) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = 'https://www.deepl.com/translator#' + langs +
|
let url = 'https://www.deepl.com/translator#' + langs + encodeURIComponent(text);
|
||||||
text.replace('\n', ' ').replace('|', '');
|
|
||||||
console.log("setting url", url);
|
console.log("setting url", url);
|
||||||
window.location = encodeURI(url);
|
window.location = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -29,9 +29,9 @@ function translate(text, from, to) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// let url = 'https://translate.google.com/#auto/' + to + '/' + text;
|
// let url = 'https://translate.google.com/#auto/' + to + '/' + text;
|
||||||
let url = 'https://translate.google.com/#view=home&op=translate&sl=auto&tl=' + to + '&text=' + text;
|
let url = 'https://translate.google.com/#view=home&op=translate&sl=auto&tl=' + to + '&text=' + encodeURIComponent(text);
|
||||||
console.log("setting url", url);
|
console.log("setting url", url);
|
||||||
window.location = encodeURI(url);
|
window.location = url;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ function httpGetAsync(url, callback) {
|
|||||||
function translate(text, from, to) {
|
function translate(text, from, to) {
|
||||||
console.log('start translate', text, from, to)
|
console.log('start translate', text, from, to)
|
||||||
|
|
||||||
let url = 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=' + to + '&dt=t&q=' + text;
|
let url = 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=' + to + '&dt=t&q=' + encodeURIComponent(text);
|
||||||
console.log("loading url", url);
|
console.log("loading url", url);
|
||||||
|
|
||||||
httpGetAsync(url, function (response) {
|
httpGetAsync(url, function (response) {
|
||||||
|
@ -54,8 +54,7 @@ function translate(text, from, to) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = 'https://papago.naver.com/?sk=auto&tk=' + to + '&st=' +
|
let url = 'https://papago.naver.com/?sk=auto&tk=' + to + '&st=' + encodeURIComponent(text);
|
||||||
text.replace("\n", " ");
|
|
||||||
window.location = encodeURI(url);
|
window.location = encodeURI(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,7 @@ function translate(text, from, to) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = 'https://translate.yandex.ru/?' + langs + '&text=' + text;
|
let url = 'https://translate.yandex.ru/?' + langs + '&text=' + encodeURIComponent(text);
|
||||||
url = url.replace(new RegExp(' ', 'g'), '%20')
|
|
||||||
console.log("setting url", url);
|
console.log("setting url", url);
|
||||||
window.location = url;
|
window.location = url;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user