icon-font-ie7.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Load this script using conditional IE comments if you need to support IE 7 and IE 6. */
  2. window.onload = function() {
  3. function addIcon(el, entity) {
  4. var html = el.innerHTML;
  5. el.innerHTML = '<span style="font-family: \'Flat-UI-Icons\'">' + entity + '</span>' + html;
  6. }
  7. var icons = {
  8. 'fui-arrow-right' : '&#xe02c;',
  9. 'fui-arrow-left' : '&#xe02d;',
  10. 'fui-cmd' : '&#xe02f;',
  11. 'fui-check-inverted' : '&#xe006;',
  12. 'fui-heart' : '&#xe007;',
  13. 'fui-location' : '&#xe008;',
  14. 'fui-plus' : '&#xe009;',
  15. 'fui-check' : '&#xe00a;',
  16. 'fui-cross' : '&#xe00b;',
  17. 'fui-list' : '&#xe00c;',
  18. 'fui-new' : '&#xe00d;',
  19. 'fui-video' : '&#xe00e;',
  20. 'fui-photo' : '&#xe00f;',
  21. 'fui-volume' : '&#xe010;',
  22. 'fui-time' : '&#xe011;',
  23. 'fui-eye' : '&#xe012;',
  24. 'fui-chat' : '&#xe013;',
  25. 'fui-search' : '&#xe01c;',
  26. 'fui-user' : '&#xe01d;',
  27. 'fui-mail' : '&#xe01e;',
  28. 'fui-lock' : '&#xe01f;',
  29. 'fui-gear' : '&#xe024;',
  30. 'fui-radio-unchecked' : '&#xe02b;',
  31. 'fui-radio-checked' : '&#xe032;',
  32. 'fui-checkbox-unchecked' : '&#xe033;',
  33. 'fui-checkbox-checked' : '&#xe034;',
  34. 'fui-calendar-solid' : '&#xe022;',
  35. 'fui-pause' : '&#xe03b;',
  36. 'fui-play' : '&#xe03c;',
  37. 'fui-check-inverted-2' : '&#xe000;'
  38. },
  39. els = document.getElementsByTagName('*'),
  40. i, attr, html, c, el;
  41. for (i = 0; ; i += 1) {
  42. el = els[i];
  43. if(!el) {
  44. break;
  45. }
  46. attr = el.getAttribute('data-icon');
  47. if (attr) {
  48. addIcon(el, attr);
  49. }
  50. c = el.className;
  51. c = c.match(/fui-[^\s'"]+/);
  52. if (c && icons[c[0]]) {
  53. addIcon(el, icons[c[0]]);
  54. }
  55. }
  56. };