57 lines
No EOL
1.5 KiB
JavaScript
57 lines
No EOL
1.5 KiB
JavaScript
/* Load this script using conditional IE comments 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: \'toolbar\'">' + entity + '</span>' + html;
|
|
}
|
|
var icons = {
|
|
'icon-file' : '',
|
|
'icon-image' : '',
|
|
'icon-zoom-out' : '',
|
|
'icon-zoom-in' : '',
|
|
'icon-expand' : '',
|
|
'icon-expand-2' : '',
|
|
'icon-folder-open' : '',
|
|
'icon-folder' : '',
|
|
'icon-cog' : '',
|
|
'icon-menu' : '',
|
|
'icon-wrench' : '',
|
|
'icon-settings' : '',
|
|
'icon-loop' : '',
|
|
'icon-pin' : '',
|
|
'icon-first' : '',
|
|
'icon-last' : '',
|
|
'icon-arrow-left' : '',
|
|
'icon-arrow-right' : '',
|
|
'icon-arrow-left-2' : '',
|
|
'icon-arrow-right-2' : '',
|
|
'icon-arrow-left-3' : '',
|
|
'icon-arrow-right-3' : '',
|
|
'icon-previous' : '',
|
|
'icon-next' : '',
|
|
'icon-droplet' : '',
|
|
'icon-adjust' : '',
|
|
'icon-sun' : '',
|
|
'icon-remove-sign' : '',
|
|
'icon-remove' : '',
|
|
'icon-copy' : ''
|
|
},
|
|
els = document.getElementsByTagName('*'),
|
|
i, attr, html, c, el;
|
|
for (i = 0; ; i += 1) {
|
|
el = els[i];
|
|
if(!el) {
|
|
break;
|
|
}
|
|
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]]);
|
|
}
|
|
}
|
|
}; |