updated idna.js
parent
a67e1dd285
commit
392f09c2ba
|
@ -1,6 +1,9 @@
|
||||||
// http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion
|
|
||||||
//Javascript Punycode converter derived from example in RFC3492.
|
//Javascript Punycode converter derived from example in RFC3492.
|
||||||
//This implementation is created by some@domain.name and released into public domain
|
//This implementation is created by some@domain.name and released into public domain
|
||||||
|
|
||||||
|
var domains = getParam("domains", ""),
|
||||||
|
parsed = [];
|
||||||
|
|
||||||
var punycode = new function Punycode() {
|
var punycode = new function Punycode() {
|
||||||
// This object converts to and from puny-code used in IDN
|
// This object converts to and from puny-code used in IDN
|
||||||
//
|
//
|
||||||
|
@ -320,19 +323,10 @@ var punycode = new function Punycode() {
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
var sEnvUrl = "${env.url}",
|
domains = domains.split(',');
|
||||||
sConverted = sEnvUrl.split('.')[0],
|
|
||||||
sDomain,
|
|
||||||
sResp;
|
|
||||||
|
|
||||||
|
for (var i = 0, n = domains.length; i < n; i++) {
|
||||||
if (sConverted) {
|
parsed.push(punycode.ToASCII(String(java.lang.String(domains[i]).trim())));
|
||||||
if (/[а-яА-ЯЁё]/.test(sConverted)) {
|
|
||||||
sDomain = sConverted.split('//')[1];
|
|
||||||
sConverted = punycode.ToASCII(sDomain);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sResp = sEnvUrl.replace(sDomain, sConverted).split('/')[2];
|
return { result: 0, domains: parsed }
|
||||||
|
|
||||||
return {result: 0, domain: sResp}
|
|
Loading…
Reference in New Issue