(function(window, document, undefined) {
    window.TypekitPreview || (window.TypekitPreview = {});
    window.TypekitPreview.config = {
        // "pi": "//use.typekit.net/c/{id}/{description}/{format}{/extras*}?{token}",
        // "pk": "//use.typekit.net/p/{id}/{description}/{format}{/extras*}?{token}"
        "pi": "typekit.com.eulas.europa.css",
        "pk": "typekit.com.eulas.europa.css"
    };
    if (window.TypekitPreview.load) {
        return
    };
    window.TypekitPreview.setup = function (opts) {
        //
    };
    window.TypekitPreview.load = function (loadParams, callback) {
        var link=document.createElement('link');
        link.rel = "stylesheet";
        link.href = ['/ui/pageweaver/css?', loadParams.google?'google&family='+loadParams.google.families:'typekit&family='+loadParams[0].css_name+','+loadParams[0].variations].join('');
        link.onload = function() {

        };
        link.onerror = function() {

        };
        var head=(document.head||document.documentElement);
        // head && head.lastChild && head.insertBefore(link, head.lastChild);
        head.appendChild(link);
        //TODO:延时比较字体有没有载入，如果载入，但不管有没有载入都要发出font_load_finished事件
        setTimeout(function(){
            //字体载入成功
            callback.active&&callback.active();
            //字体载入失败
            // callback.inactive&&callback.inactive();
        },25)

    };
})(this, document);
