chadicus /
test-helpers
| 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: \'phpdocumentor-clean-icons\'">' + entity + '</span>' + html; |
||
| 7 | } |
||
| 8 | var icons = { |
||
| 9 | 'icon-trait' : '', |
||
| 10 | 'icon-interface' : '', |
||
| 11 | 'icon-class' : '' |
||
| 12 | }, |
||
| 13 | els = document.getElementsByTagName('*'), |
||
| 14 | i, attr, html, c, el; |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 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 | }; |