aboutsummaryrefslogtreecommitdiffstats
path: root/dev-random/static/js/hex2ascii.js
blob: 3dde36f20fcb4475a20ae5d0df969790f190e869 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

window.hex2ascii = {};
window.hex2ascii.init = function() {
    var els = document.getElementsByClassName('hex'),
        hex, text,
        i, j, e;

    for(i=0; i < els.length; i++) {
        e = els[i];
        hex = e.innerHTML.split(' ');
        text = "";

        for(j=0; j < hex.length; j++) {
            text += String.fromCharCode(parseInt(hex[j], 16));
        }

        e.innerHTML = text;
        e.className = e.className.replace('hex','');
    }
};