Sha256: 5dd4960fbcd0bdc80ff87365e02d35f382f422d466a41c8068c71bb410c237fb
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
/** * @constructor */ webfont.GoogleFontApi = function(userAgent, domHelper, configuration) { this.userAgent_ = userAgent; this.domHelper_ = domHelper; this.configuration_ = configuration; }; webfont.GoogleFontApi.NAME = 'google'; webfont.GoogleFontApi.prototype.supportUserAgent = function(userAgent, support) { support(userAgent.isSupportingWebFont()); }; webfont.GoogleFontApi.prototype.getFontWatchRunnerCtor = function() { if (this.userAgent_.getEngine() == "AppleWebKit") { return webfont.LastResortWebKitFontWatchRunner; } return webfont.FontWatchRunner; }; webfont.GoogleFontApi.prototype.load = function(onReady) { var domHelper = this.domHelper_; var nonBlockingIe = this.userAgent_.getName() == 'MSIE' && this.configuration_['blocking'] != true; if (nonBlockingIe) { domHelper.whenBodyExists(webfont.bind(this, this.insertLink_, onReady)); } else { this.insertLink_(onReady); } }; webfont.GoogleFontApi.prototype.insertLink_ = function(onReady) { var domHelper = this.domHelper_; var fontApiUrlBuilder = new webfont.FontApiUrlBuilder( this.configuration_['api']); var fontFamilies = this.configuration_['families']; fontApiUrlBuilder.setFontFamilies(fontFamilies); var fontApiParser = new webfont.FontApiParser(fontFamilies); fontApiParser.parse(); domHelper.insertInto('head', domHelper.createCssLink( fontApiUrlBuilder.build())); onReady(fontApiParser.getFontFamilies(), fontApiParser.getVariations(), fontApiParser.getFontTestStrings()); }; globalNamespaceObject.addModule(webfont.GoogleFontApi.NAME, function(configuration) { var userAgentParser = new webfont.UserAgentParser(navigator.userAgent, document); var userAgent = userAgentParser.parse(); return new webfont.GoogleFontApi(userAgent, new webfont.DomHelper(document), configuration); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webfontloader-1.0.31 | src/google/googlefontapi.js |
webfontloader-1.0.30 | src/google/googlefontapi.js |