root / snf-cyclades-app / synnefo / ui / new_ui / ui / testIconFonts / lte-ie7.js @ b3c1328b
History | View | Annotate | Download (728 Bytes)
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: \'test1\'">' + entity + '</span>' + html; |
7 |
} |
8 |
var icons = {
|
9 |
'icon-twitter-off-black' : 'a', |
10 |
'icon-remove' : 'b', |
11 |
'icon-twitter-off-black-2' : 'c' |
12 |
}, |
13 |
els = document.getElementsByTagName('*'),
|
14 |
i, attr, html, c, el; |
15 |
for (i = 0; ; i += 1) { |
16 |
el = els[i]; |
17 |
if(!el) {
|
18 |
break;
|
19 |
} |
20 |
attr = el.getAttribute('data-icon');
|
21 |
if (attr) {
|
22 |
addIcon(el, attr); |
23 |
} |
24 |
c = el.className; |
25 |
c = c.match(/icon-[^\s'"]+/);
|
26 |
if (c && icons[c[0]]) { |
27 |
addIcon(el, icons[c[0]]);
|
28 |
} |
29 |
} |
30 |
}; |