<f:comment>
    For an explanation on what this script does, look in 'root/Javascript/inline/fontloading.js'!

    This is just an example configuration for loading "Source Sans Pro" with Variants and "DM Serif Text".
</f:comment>

<script id="asynchronousFontLoading">
    (function() {
    "use strict";
    if( sessionStorage.fontsLoaded ) {
        document.documentElement.className += " fonts-loaded-1 fonts-loaded-2";
        return;
    } else if( "fonts" in document ) {
        document.fonts.load("400 1em SourceSansPro").then(function () {
            document.documentElement.className += " fonts-loaded-1";
            Promise.all([
                document.fonts.load("400 1em DMSerifText"),
                document.fonts.load("700 1em SourceSansPro"),
                document.fonts.load("400 italic 1em SourceSansPro")
            ]).then(function () {
                document.documentElement.className += " fonts-loaded-2";
                sessionStorage.fontsLoaded = true;
            });
        });
    } else {
        var ref = document.getElementsByTagName( "script" )[ 0 ];
        var script = document.createElement( "script" );
        script.src = "/_Resources/Static/Packages/Newland.BaseTheme/scripts/legacy-fontloading/fontloading-legacy.js";
        script.async = true;
        ref.parentNode.insertBefore( script, ref );
    }
})();
</script>
