Total Complexity | 3 |
Complexity/F | 3 |
Lines of Code | 27 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | function insertFontCSS() { |
||
2 | var fontPath = API.extension.getURL(''); |
||
3 | var fontCss = ["@font-face {", |
||
4 | "font-family: 'FontAwesome';", |
||
5 | "src: url('" + fontPath + "fonts/fontawesome-webfont.eot?v=4.7.0');", |
||
6 | "src: url('" + fontPath + "fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('" + fontPath + "fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('" + fontPath + "fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('" + fontPath + "fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('" + fontPath + "fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');", |
||
7 | "font-weight: normal;", |
||
8 | "font-style: normal;", |
||
9 | "}"]; |
||
10 | if (window.navigator.userAgent.indexOf('Firefox') !== -1) { |
||
11 | fontCss[2] = "src: url('" + fontPath + "fonts/fontawesome-webfont.eot?v=4.7.0');"; |
||
12 | fontCss[3] = "src: url('" + fontPath + "fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('" + fontPath + "fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('" + fontPath + "fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('" + fontPath + "fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('" + fontPath + "fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');"; |
||
13 | } |
||
14 | var css = fontCss.join(''); |
||
15 | var style = document.createElement('style'), |
||
16 | head = document.head || document.getElementsByTagName('head')[0]; |
||
17 | |||
18 | style.type = 'text/css'; |
||
19 | if (style.styleSheet) { |
||
20 | style.styleSheet.cssText = css; |
||
21 | } else { |
||
22 | style.appendChild(document.createTextNode(css)); |
||
23 | } |
||
24 | |||
25 | head.appendChild(style); |
||
26 | } |
||
27 | insertFontCSS(); |