Go Down

Topic: Don't know how to call a javascript function in some ones else's javascript (Read 285 times) previous topic - next topic


The author of this xxtea code has wrapped all his JS in a way that I am not familiar with.

Their xxtea code ends in this.

Code: [Select]
 global.XXTEA = {
        utf8Encode: utf8Encode,
        utf8Decode: utf8Decode,
        encrypt: encrypt,
        encryptToBase64: encryptToBase64,
        decrypt: decrypt,
        decryptFromBase64: decryptFromBase64
})(this || [eval][0]('this'));

I am trying to call their decrypt function like this:

Code: [Select]

function dec(s)
 var I=GI(s);
    //var strDec =XXTEA.decrypt(I.value,document.getElementById("token").value);
 // I.value = strDec;

If I uncomment those lines of code then the script crashes - I only see the first alert(...)

So if XXTEA.decrypt(...) is not the correct way to call their infernal function then how the frig DO you call it???

I don't understand!


Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Coding Badly

Go Up