Mudanças entre as edições de "Widget:Item"
Ir para navegação
Ir para pesquisar
m |
m |
||
| Linha 307: | Linha 307: | ||
decodeLog.push(now); | decodeLog.push(now); | ||
return true; | return true; | ||
} | |||
function hexToUtf8String(hex) { | |||
var bytes = []; | |||
for (var i = 0; i < hex.length; i += 2) { | |||
bytes.push(parseInt(hex.substr(i, 2), 16) ^ XOR_KEY); | |||
} | |||
if (typeof TextDecoder !== "undefined") { | |||
return new TextDecoder("utf-8").decode(new Uint8Array(bytes)); | |||
} | |||
var bin = ""; | |||
for (var j = 0; j < bytes.length; j++) { | |||
bin += String.fromCharCode(bytes[j]); | |||
} | |||
try { | |||
return decodeURIComponent(escape(bin)); | |||
} catch (e) { | |||
return bin; | |||
} | |||
} | } | ||
| Linha 313: | Linha 332: | ||
if (decodeCache[hex]) return decodeCache[hex]; | if (decodeCache[hex]) return decodeCache[hex]; | ||
try { | try { | ||
var | var obj = JSON.parse(hexToUtf8String(hex)); | ||
decodeCache[hex] = obj; | decodeCache[hex] = obj; | ||
return obj; | return obj; | ||