js/lib/font-awesome.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 3

Size

Lines of Code 27
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 1
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3
mnd 1
bc 4
fnc 1
bpm 4
cpm 3
noi 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();