Sha256: 432eb13b076ecbdce8d1c355b1fce6cad13acd47dfe52e7c8962af7ad271cf85

Contents?: true

Size: 986 Bytes

Versions: 3

Compression:

Stored size: 986 Bytes

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 domHelper = new webfont.DomHelper(document);
  return new webfont.CustomCss(domHelper, configuration);
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webfontloader-1.0.29 src/custom/customcss.js
webfontloader-1.0.28 src/custom/customcss.js
webfontloader-1.0.27 src/custom/customcss.js