Sha256: cd5db51eebc6acdae86cfbd2fcef97c1fdcfe9c979420473505fe06e0a47d4f5

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 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 urls = this.configuration_['urls'] || [];
  var families = this.configuration_['families'] || [];

  for (var i = 0, len = urls.length; i < len; i++) {
    var url = urls[i];

    this.domHelper_.insertInto('head', this.domHelper_.createCssLink(url));
  }
  onReady(families);
};

webfont.CustomCss.prototype.supportUserAgent = function(userAgent, support) {
  return support(userAgent.isSupportingWebFont());
};

window['WebFont'].addModule(webfont.CustomCss.NAME, function(configuration) {
  var userAgentParser = new webfont.UserAgentParser(navigator.userAgent, document);
  var userAgent = userAgentParser.parse();
  var domHelper = new webfont.DomHelper(document, userAgent);
  return new webfont.CustomCss(domHelper, configuration);
});

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
webfontloader-1.0.26 src/custom/customcss.js
webfontloader-1.0.25 src/custom/customcss.js
webfontloader-1.0.24 src/custom/customcss.js
webfontloader-1.0.22 src/custom/customcss.js
webfontloader-1.0.21 src/custom/customcss.js
webfontloader-1.0.20 src/custom/customcss.js
webfontloader-1.0.19 src/custom/customcss.js
webfontloader-1.0.18 src/custom/customcss.js
webfontloader-1.0.16 src/custom/customcss.js
webfontloader-1.0.15 src/custom/customcss.js
webfontloader-1.0.13 src/custom/customcss.js
webfontloader-1.0.9 src/custom/customcss.js
webfontloader-1.0.8 src/custom/customcss.js
webfontloader-1.0.7 src/custom/customcss.js