-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlte-ie7.js
38 lines (37 loc) · 1009 Bytes
/
lte-ie7.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Use this script if you need to support IE 7 and IE 6. */
window.onload = function() {
function addIcon(el, entity) {
var html = el.innerHTML;
el.innerHTML = '<span style="font-family: \'Gobblicons\'">' + entity + '</span>' + html;
}
var icons = {
'icon-share' : '',
'icon-add-circle' : '',
'icon-search' : '',
'icon-edit' : '',
'icon-download' : '',
'icon-trash' : '',
'icon-file-next' : '',
'icon-file-add' : '',
'icon-file' : '',
'icon-add' : '',
'icon-right' : '',
'icon-left' : '',
'icon-down' : '',
'icon-close' : ''
},
els = document.getElementsByTagName('*'),
i, attr, html, c, el;
for (i = 0; i < els.length; i += 1) {
el = els[i];
attr = el.getAttribute('data-icon');
if (attr) {
addIcon(el, attr);
}
c = el.className;
c = c.match(/icon-[^\s'"]+/);
if (c && icons[c[0]]) {
addIcon(el, icons[c[0]]);
}
}
};