Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / lte-ie7.js @ bf348d7d

History | View | Annotate | Download (1.3 kB)

1
/* Load this script using conditional IE comments if you need to support IE 7 and IE 6. */
2

    
3
window.onload = function() {
4
        function addIcon(el, entity) {
5
                var html = el.innerHTML;
6
                el.innerHTML = '<span style="font-family: \'snf-font-1\'">' + entity + '</span>' + html;
7
        }
8
        var icons = {
9
                        'snf-twitter-off-black' : '&#x67;',
10
                        'snf-cancel-circled' : '&#x63;',
11
                        'snf-checkbox-checked' : '&#x62;',
12
                        'snf-checkbox-unchecked' : '&#x61;',
13
                        'snf-cancel-circled2' : '&#x64;',
14
                        'snf-cancel-circled-outline' : '&#x65;',
15
                        'snf-cancel-outline' : '&#x66;',
16
                        'snf-ok' : '&#x68;',
17
                        'snf-remove' : '&#x69;',
18
                        'snf-ban-circle' : '&#x6a;',
19
                        'snf-ok-circle' : '&#x6b;',
20
                        'snf-ok-sign' : '&#x6c;',
21
                        'snf-remove-sign' : '&#x6d;',
22
                        'snf-minus-sign' : '&#x6e;',
23
                        'snf-pencil' : '&#x6f;',
24
                        'snf-edit' : '&#x70;',
25
                        'snf-edit-1' : '&#x71;',
26
                        'snf-pencil-circled' : '&#x72;',
27
                        'snf-icon-compute-outline' : '&#x73;',
28
                        'snf-icon-networks-fill' : '&#x74;'
29
                },
30
                els = document.getElementsByTagName('*'),
31
                i, attr, html, c, el;
32
        for (i = 0; ; i += 1) {
33
                el = els[i];
34
                if(!el) {
35
                        break;
36
                }
37
                attr = el.getAttribute('data-icon');
38
                if (attr) {
39
                        addIcon(el, attr);
40
                }
41
                c = el.className;
42
                c = c.match(/snf-[^\s'"]+/);
43
                if (c && icons[c[0]]) {
44
                        addIcon(el, icons[c[0]]);
45
                }
46
        }
47
};