Sha256: e997d00b471ebbd43885dad27fb4c996d243212bde60b621eff90e2fa023a813
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
/** * * WebFont.load({ * custom: { * families: ['Font1', 'Font2'], * urls: [ 'http://moo', 'http://meuh' ] } * }); * * @constructor */ webfont.CustomCss = function(domHelper, configuration) { this.domHelper_ = domHelper; this.configuration_ = configuration; }; webfont.CustomCss.NAME = 'custom'; webfont.CustomCss.prototype.load = function(onReady) { var i, len; var urls = this.configuration_['urls'] || []; var familiesConfiguration = this.configuration_['families'] || []; for (i = 0, len = urls.length; i < len; i++) { var url = urls[i]; this.domHelper_.insertInto('head', this.domHelper_.createCssLink(url)); } var families = []; var variations = {}; for (i = 0, len = familiesConfiguration.length; i < len; i++) { var components = familiesConfiguration[i].split(":"); var family = components[0]; var familyVariations = components[1]; families.push(family); if (familyVariations) { var newVariations = familyVariations.split(","); variations[family] = (variations[family] || []).concat(newVariations); } } onReady(families, variations); }; webfont.CustomCss.prototype.supportUserAgent = function(userAgent, support) { return support(userAgent.getBrowserInfo().hasWebFontSupport()); }; globalNamespaceObject.addModule(webfont.CustomCss.NAME, function(configuration, domHelper) { return new webfont.CustomCss(domHelper, configuration); });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
webfontloader-1.3.0 | src/custom/customcss.js |
webfontloader-1.2.1 | src/custom/customcss.js |
webfontloader-1.2.0 | src/custom/customcss.js |