webfontloader 1.5.8 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/README.md +18 -0
- data/lib/webfontloader.rb +1 -1
- data/spec/core/eventdispatcher_spec.js +47 -17
- data/spec/core/useragentparser_spec.js +212 -470
- data/spec/modules/monotype_spec.js +0 -3
- data/spec/modules/typekit_spec.js +14 -38
- data/src/core/eventdispatcher.js +71 -57
- data/src/core/fontruler.js +1 -1
- data/src/core/fontwatcher.js +27 -15
- data/src/core/useragent.js +3 -39
- data/src/core/useragentparser.js +15 -58
- data/src/core/webfont.js +20 -5
- data/src/modules/typekit.js +24 -27
- data/webfontloader.gemspec +3 -2
- data/webfontloader.js +31 -0
- metadata +3 -2
data/src/core/useragentparser.js
CHANGED
@@ -37,12 +37,9 @@ webfont.UserAgentParser.UNKNOWN_USER_AGENT = new webfont.UserAgent(
|
|
37
37
|
webfont.UserAgentParser.UNKNOWN,
|
38
38
|
new webfont.Version(),
|
39
39
|
webfont.UserAgentParser.UNKNOWN,
|
40
|
-
webfont.UserAgentParser.UNKNOWN,
|
41
40
|
new webfont.Version(),
|
42
41
|
webfont.UserAgentParser.UNKNOWN,
|
43
|
-
webfont.UserAgentParser.UNKNOWN,
|
44
42
|
new webfont.Version(),
|
45
|
-
webfont.UserAgentParser.UNKNOWN,
|
46
43
|
undefined,
|
47
44
|
new webfont.BrowserInfo(false, false, false, false));
|
48
45
|
|
@@ -151,9 +148,7 @@ goog.scope(function () {
|
|
151
148
|
*/
|
152
149
|
UserAgentParser.prototype.parseIeUserAgentString_ = function() {
|
153
150
|
var platform = this.getPlatform_(),
|
154
|
-
|
155
|
-
platformVersion = Version.parse(platformVersionString),
|
156
|
-
browserVersionString = null,
|
151
|
+
platformVersion = Version.parse(this.getPlatformVersionString_()),
|
157
152
|
browserVersion = null,
|
158
153
|
engine = null,
|
159
154
|
engineVersion = null,
|
@@ -161,20 +156,17 @@ goog.scope(function () {
|
|
161
156
|
documentMode = this.getDocumentMode_(this.doc_);
|
162
157
|
|
163
158
|
if (this.userAgent_.indexOf("MSIE") != -1) {
|
164
|
-
|
159
|
+
browserVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /MSIE ([\d\w\.]+)/, 1));
|
165
160
|
} else {
|
166
|
-
|
161
|
+
browserVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /rv:([\d\w\.]+)/, 1));
|
167
162
|
}
|
168
163
|
|
169
|
-
browserVersion = Version.parse(browserVersionString);
|
170
|
-
|
171
164
|
if (engineVersionString != '') {
|
172
165
|
engine = 'Trident';
|
173
166
|
engineVersion = Version.parse(engineVersionString);
|
174
167
|
} else {
|
175
168
|
engine = UserAgentParser.UNKNOWN;
|
176
169
|
engineVersion = new Version();
|
177
|
-
engineVersionString = UserAgentParser.UNKNOWN;
|
178
170
|
}
|
179
171
|
|
180
172
|
var supportWebFont = (platform == "Windows" && browserVersion.major >= 6) ||
|
@@ -183,13 +175,10 @@ goog.scope(function () {
|
|
183
175
|
return new UserAgent(
|
184
176
|
"MSIE",
|
185
177
|
browserVersion,
|
186
|
-
browserVersionString,
|
187
178
|
engine,
|
188
179
|
engineVersion,
|
189
|
-
engineVersionString,
|
190
180
|
platform,
|
191
181
|
platformVersion,
|
192
|
-
platformVersionString,
|
193
182
|
documentMode,
|
194
183
|
new BrowserInfo(supportWebFont, false, false, !!this.doc_['fonts'])
|
195
184
|
);
|
@@ -214,10 +203,8 @@ goog.scope(function () {
|
|
214
203
|
*/
|
215
204
|
UserAgentParser.prototype.parseOldOperaUserAgentString_ = function() {
|
216
205
|
var engineName = UserAgentParser.UNKNOWN,
|
217
|
-
|
218
|
-
|
219
|
-
platformVersionString = this.getPlatformVersionString_(),
|
220
|
-
platformVersion = Version.parse(platformVersionString),
|
206
|
+
engineVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /Presto\/([\d\w\.]+)/, 1)),
|
207
|
+
platformVersion = Version.parse(this.getPlatformVersionString_()),
|
221
208
|
documentMode = this.getDocumentMode_(this.doc_);
|
222
209
|
|
223
210
|
if (engineVersion.isValid()) {
|
@@ -226,25 +213,20 @@ goog.scope(function () {
|
|
226
213
|
if (this.userAgent_.indexOf("Gecko") != -1) {
|
227
214
|
engineName = "Gecko";
|
228
215
|
}
|
229
|
-
|
230
|
-
engineVersion = Version.parse(engineVersionString);
|
216
|
+
engineVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /rv:([^\)]+)/, 1));
|
231
217
|
}
|
232
218
|
|
233
219
|
// Check for Opera Mini first, since it looks like normal Opera
|
234
220
|
if (this.userAgent_.indexOf("Opera Mini/") != -1) {
|
235
|
-
var
|
236
|
-
var browserVersion = Version.parse(browserVersionString);
|
221
|
+
var browserVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /Opera Mini\/([\d\.]+)/, 1));
|
237
222
|
|
238
223
|
return new UserAgent(
|
239
224
|
"OperaMini",
|
240
225
|
browserVersion,
|
241
|
-
browserVersionString,
|
242
226
|
engineName,
|
243
227
|
engineVersion,
|
244
|
-
engineVersionString,
|
245
228
|
this.getPlatform_(),
|
246
229
|
platformVersion,
|
247
|
-
platformVersionString,
|
248
230
|
documentMode,
|
249
231
|
new BrowserInfo(false, false, false, !!this.doc_['fonts'])
|
250
232
|
);
|
@@ -252,39 +234,31 @@ goog.scope(function () {
|
|
252
234
|
|
253
235
|
// Otherwise, find version information for normal Opera or Opera Mobile
|
254
236
|
if (this.userAgent_.indexOf("Version/") != -1) {
|
255
|
-
var
|
256
|
-
var browserVersion = Version.parse(browserVersionString);
|
237
|
+
var browserVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /Version\/([\d\.]+)/, 1));
|
257
238
|
|
258
239
|
if (browserVersion.isValid()) {
|
259
240
|
return new UserAgent(
|
260
241
|
"Opera",
|
261
242
|
browserVersion,
|
262
|
-
browserVersionString,
|
263
243
|
engineName,
|
264
244
|
engineVersion,
|
265
|
-
engineVersionString,
|
266
245
|
this.getPlatform_(),
|
267
246
|
platformVersion,
|
268
|
-
platformVersionString,
|
269
247
|
documentMode,
|
270
248
|
new BrowserInfo(browserVersion.major >= 10, false, false, !!this.doc_['fonts'])
|
271
249
|
);
|
272
250
|
}
|
273
251
|
}
|
274
|
-
var
|
275
|
-
var browserVersion = Version.parse(browserVersionString);
|
252
|
+
var browserVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /Opera[\/ ]([\d\.]+)/, 1));
|
276
253
|
|
277
254
|
if (browserVersion.isValid()) {
|
278
255
|
return new UserAgent(
|
279
256
|
"Opera",
|
280
257
|
browserVersion,
|
281
|
-
browserVersionString,
|
282
258
|
engineName,
|
283
259
|
engineVersion,
|
284
|
-
engineVersionString,
|
285
260
|
this.getPlatform_(),
|
286
261
|
platformVersion,
|
287
|
-
platformVersionString,
|
288
262
|
documentMode,
|
289
263
|
new BrowserInfo(browserVersion.major >= 10, false, false, !!this.doc_['fonts'])
|
290
264
|
);
|
@@ -292,13 +266,10 @@ goog.scope(function () {
|
|
292
266
|
return new UserAgent(
|
293
267
|
"Opera",
|
294
268
|
new Version(),
|
295
|
-
UserAgentParser.UNKNOWN,
|
296
269
|
engineName,
|
297
270
|
engineVersion,
|
298
|
-
engineVersionString,
|
299
271
|
this.getPlatform_(),
|
300
272
|
platformVersion,
|
301
|
-
platformVersionString,
|
302
273
|
documentMode,
|
303
274
|
new BrowserInfo(false, false, false, !!this.doc_['fonts'])
|
304
275
|
);
|
@@ -316,10 +287,8 @@ goog.scope(function () {
|
|
316
287
|
*/
|
317
288
|
UserAgentParser.prototype.parseWebKitUserAgentString_ = function() {
|
318
289
|
var platform = this.getPlatform_(),
|
319
|
-
|
320
|
-
|
321
|
-
webKitVersionString = this.getMatchingGroup_(this.userAgent_, /AppleWeb(?:K|k)it\/([\d\.\+]+)/, 1),
|
322
|
-
webKitVersion = Version.parse(webKitVersionString),
|
290
|
+
platformVersion = Version.parse(this.getPlatformVersionString_()),
|
291
|
+
webKitVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /AppleWeb(?:K|k)it\/([\d\.\+]+)/, 1)),
|
323
292
|
browserName = UserAgentParser.UNKNOWN,
|
324
293
|
browserVersion = new Version(),
|
325
294
|
browserVersionString = UserAgentParser.UNKNOWN,
|
@@ -378,13 +347,10 @@ goog.scope(function () {
|
|
378
347
|
return new UserAgent(
|
379
348
|
browserName,
|
380
349
|
browserVersion,
|
381
|
-
browserVersionString,
|
382
350
|
"AppleWebKit",
|
383
351
|
webKitVersion,
|
384
|
-
webKitVersionString,
|
385
352
|
platform,
|
386
353
|
platformVersion,
|
387
|
-
platformVersionString,
|
388
354
|
this.getDocumentMode_(this.doc_),
|
389
355
|
new BrowserInfo(supportWebFont, hasWebKitFallbackBug, hasWebKitMetricsBug, !!this.doc_['fonts'])
|
390
356
|
);
|
@@ -403,40 +369,31 @@ goog.scope(function () {
|
|
403
369
|
UserAgentParser.prototype.parseGeckoUserAgentString_ = function() {
|
404
370
|
var name = UserAgentParser.UNKNOWN,
|
405
371
|
version = new Version(),
|
406
|
-
|
407
|
-
platformVersionString = this.getPlatformVersionString_(),
|
408
|
-
platformVersion = Version.parse(platformVersionString),
|
372
|
+
platformVersion = Version.parse(this.getPlatformVersionString_()),
|
409
373
|
supportWebFont = false;
|
410
374
|
|
411
375
|
if (this.userAgent_.indexOf("Firefox") != -1) {
|
412
376
|
name = "Firefox";
|
413
|
-
|
414
|
-
version = Version.parse(versionString);
|
377
|
+
version = Version.parse(this.getMatchingGroup_(this.userAgent_, /Firefox\/([\d\w\.]+)/, 1));
|
415
378
|
supportWebFont = version.major >= 3 && version.minor >= 5;
|
416
379
|
} else if (this.userAgent_.indexOf("Mozilla") != -1) {
|
417
380
|
name = "Mozilla";
|
418
381
|
}
|
419
382
|
|
420
|
-
var
|
421
|
-
engineVersion = Version.parse(engineVersionString);
|
383
|
+
var engineVersion = Version.parse(this.getMatchingGroup_(this.userAgent_, /rv:([^\)]+)/, 1));
|
422
384
|
|
423
385
|
if (!supportWebFont) {
|
424
386
|
supportWebFont = engineVersion.major > 1 ||
|
425
387
|
engineVersion.major == 1 && engineVersion.minor > 9 ||
|
426
|
-
engineVersion.major == 1 && engineVersion.minor == 9 && engineVersion.patch >= 2
|
427
|
-
engineVersionString.match(/1\.9\.1b[123]/) != null ||
|
428
|
-
engineVersionString.match(/1\.9\.1\.[\d\.]+/) != null;
|
388
|
+
engineVersion.major == 1 && engineVersion.minor == 9 && engineVersion.patch >= 2;
|
429
389
|
}
|
430
390
|
return new UserAgent(
|
431
391
|
name,
|
432
392
|
version,
|
433
|
-
versionString,
|
434
393
|
"Gecko",
|
435
394
|
engineVersion,
|
436
|
-
engineVersionString,
|
437
395
|
this.getPlatform_(),
|
438
396
|
platformVersion,
|
439
|
-
platformVersionString,
|
440
397
|
this.getDocumentMode_(this.doc_),
|
441
398
|
new BrowserInfo(supportWebFont, false, false, !!this.doc_['fonts'])
|
442
399
|
);
|
data/src/core/webfont.js
CHANGED
@@ -18,6 +18,8 @@ webfont.WebFont = function(mainWindow) {
|
|
18
18
|
this.userAgent_ = this.userAgentParser_.parse();
|
19
19
|
this.moduleLoading_ = 0;
|
20
20
|
this.moduleFailedLoading_ = 0;
|
21
|
+
this.events_ = true;
|
22
|
+
this.classes_ = true;
|
21
23
|
};
|
22
24
|
|
23
25
|
goog.scope(function () {
|
@@ -41,8 +43,17 @@ goog.scope(function () {
|
|
41
43
|
var context = configuration['context'] || this.mainWindow_;
|
42
44
|
this.domHelper_ = new DomHelper(this.mainWindow_, context);
|
43
45
|
|
46
|
+
this.events_ = configuration['events'] !== false;
|
47
|
+
this.classes_ = configuration['classes'] !== false;
|
48
|
+
|
44
49
|
var eventDispatcher = new EventDispatcher(
|
45
|
-
this.domHelper_,
|
50
|
+
this.domHelper_,
|
51
|
+
context.document.documentElement,
|
52
|
+
configuration,
|
53
|
+
undefined,
|
54
|
+
this.events_,
|
55
|
+
this.classes_
|
56
|
+
);
|
46
57
|
|
47
58
|
this.load_(eventDispatcher, configuration);
|
48
59
|
};
|
@@ -69,7 +80,9 @@ goog.scope(function () {
|
|
69
80
|
if (allModulesLoaded && this.moduleFailedLoading_ == 0) {
|
70
81
|
eventDispatcher.dispatchInactive();
|
71
82
|
} else {
|
72
|
-
|
83
|
+
if (this.classes_ || this.events_) {
|
84
|
+
fontWatcher.watchFonts([], {}, null, allModulesLoaded);
|
85
|
+
}
|
73
86
|
}
|
74
87
|
}
|
75
88
|
};
|
@@ -84,9 +97,11 @@ goog.scope(function () {
|
|
84
97
|
WebFont.prototype.onModuleReady_ = function(eventDispatcher, fontWatcher, fonts, opt_fontTestStrings, opt_metricCompatibleFonts) {
|
85
98
|
var allModulesLoaded = --this.moduleLoading_ == 0;
|
86
99
|
|
87
|
-
|
88
|
-
|
89
|
-
|
100
|
+
if (this.classes_ || this.events_) {
|
101
|
+
setTimeout(function () {
|
102
|
+
fontWatcher.watchFonts(fonts, opt_fontTestStrings || null, opt_metricCompatibleFonts || null, allModulesLoaded);
|
103
|
+
}, 0);
|
104
|
+
}
|
90
105
|
};
|
91
106
|
|
92
107
|
/**
|
data/src/modules/typekit.js
CHANGED
@@ -18,8 +18,6 @@ webfont.modules.Typekit = function(domHelper, configuration) {
|
|
18
18
|
*/
|
19
19
|
webfont.modules.Typekit.NAME = 'typekit';
|
20
20
|
|
21
|
-
webfont.modules.Typekit.HOOK = '__webfonttypekitmodule__';
|
22
|
-
|
23
21
|
goog.scope(function () {
|
24
22
|
var Typekit = webfont.modules.Typekit,
|
25
23
|
Font = webfont.Font;
|
@@ -34,38 +32,37 @@ goog.scope(function () {
|
|
34
32
|
var kitId = this.configuration_['id'];
|
35
33
|
var configuration = this.configuration_;
|
36
34
|
var loadWindow = this.domHelper_.getLoadWindow();
|
37
|
-
var
|
35
|
+
var that = this;
|
38
36
|
|
39
37
|
if (kitId) {
|
40
|
-
//
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
// Load the Typekit script. Once it is done loading we grab its configuration
|
39
|
+
// and use that to populate the fonts we should watch.
|
40
|
+
this.domHelper_.loadScript(this.getScriptSrc(kitId), function (err) {
|
41
|
+
if (err) {
|
42
|
+
support(false);
|
43
|
+
} else {
|
44
|
+
if (loadWindow['Typekit'] && loadWindow['Typekit']['config'] && loadWindow['Typekit']['config']['fn']) {
|
45
|
+
var fn = loadWindow['Typekit']['config']['fn'];
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
var init = function(typekitSupports, fontFamilies, fontVariations) {
|
49
|
-
for (var i = 0; i < fontFamilies.length; i += 1) {
|
50
|
-
var variations = fontVariations[fontFamilies[i]];
|
47
|
+
for (var i = 0; i < fn.length; i += 2) {
|
48
|
+
var font = fn[i],
|
49
|
+
variations = fn[i + 1];
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
self.fonts_.push(new Font(fontFamilies[i], variations[j]));
|
51
|
+
for (var j = 0; j < variations.length; j++) {
|
52
|
+
that.fonts_.push(new Font(font, variations[j]));
|
55
53
|
}
|
56
|
-
} else {
|
57
|
-
self.fonts_.push(new Font(fontFamilies[i]));
|
58
54
|
}
|
59
|
-
}
|
60
|
-
support(typekitSupports);
|
61
|
-
};
|
62
|
-
callback(userAgent, configuration, init);
|
63
|
-
};
|
64
55
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
56
|
+
// Kick off font loading but disable font events so
|
57
|
+
// we don't duplicate font watching.
|
58
|
+
try {
|
59
|
+
loadWindow['Typekit']['load']({
|
60
|
+
events: false,
|
61
|
+
classes: false
|
62
|
+
});
|
63
|
+
} catch (e) {}
|
64
|
+
}
|
65
|
+
support(true);
|
69
66
|
}
|
70
67
|
}, 2000);
|
71
68
|
} else {
|
data/webfontloader.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'webfontloader'
|
16
|
-
s.version = '1.5.
|
17
|
-
s.date = '2014-
|
16
|
+
s.version = '1.5.9'
|
17
|
+
s.date = '2014-12-18'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
20
20
|
## as you like.
|
@@ -182,6 +182,7 @@ DESC
|
|
182
182
|
tools/jasmine/jasmine.css
|
183
183
|
tools/jasmine/jasmine.js
|
184
184
|
webfontloader.gemspec
|
185
|
+
webfontloader.js
|
185
186
|
]
|
186
187
|
# = MANIFEST =
|
187
188
|
|
data/webfontloader.js
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
/* Web Font Loader v1.5.9 - (c) Adobe Systems, Google. License: Apache 2.0 */
|
2
|
+
;(function(window,document,undefined){var k=this;function l(a,b){var c=a.split("."),d=k;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d=d[e]?d[e]:d[e]={}:d[e]=b}function aa(a,b,c){return a.call.apply(a.bind,arguments)}
|
3
|
+
function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function n(a,b,c){n=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return n.apply(null,arguments)}var q=Date.now||function(){return+new Date};function s(a,b){this.K=a;this.w=b||a;this.D=this.w.document}s.prototype.createElement=function(a,b,c){a=this.D.createElement(a);if(b)for(var d in b)b.hasOwnProperty(d)&&("style"==d?a.style.cssText=b[d]:a.setAttribute(d,b[d]));c&&a.appendChild(this.D.createTextNode(c));return a};function t(a,b,c){a=a.D.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}function ca(a,b){function c(){a.D.body?b():setTimeout(c,0)}c()}
|
4
|
+
function u(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var f=!1,g=0;g<d.length;g+=1)if(b[e]===d[g]){f=!0;break}f||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){f=!1;for(g=0;g<c.length;g+=1)if(d[e]===c[g]){f=!0;break}f||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function v(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return!0;return!1}
|
5
|
+
function w(a){var b=a.w.location.protocol;"about:"==b&&(b=a.K.location.protocol);return"https:"==b?"https:":"http:"}function x(a,b){var c=a.createElement("link",{rel:"stylesheet",href:b}),d=!1;c.onload=function(){d||(d=!0)};c.onerror=function(){d||(d=!0)};t(a,"head",c)}
|
6
|
+
function y(a,b,c,d){var e=a.D.getElementsByTagName("head")[0];if(e){var f=a.createElement("script",{src:b}),g=!1;f.onload=f.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),f.onload=f.onreadystatechange=null,"HEAD"==f.parentNode.tagName&&e.removeChild(f))};e.appendChild(f);window.setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return f}return null};function z(a,b,c,d){this.R=a;this.Z=b;this.Ba=c;this.ra=d}l("webfont.BrowserInfo",z);z.prototype.sa=function(){return this.R};z.prototype.hasWebFontSupport=z.prototype.sa;z.prototype.ta=function(){return this.Z};z.prototype.hasWebKitFallbackBug=z.prototype.ta;z.prototype.ua=function(){return this.Ba};z.prototype.hasWebKitMetricsBug=z.prototype.ua;z.prototype.qa=function(){return this.ra};z.prototype.hasNativeFontLoading=z.prototype.qa;function A(a,b,c,d){this.c=null!=a?a:null;this.g=null!=b?b:null;this.B=null!=c?c:null;this.e=null!=d?d:null}var da=/^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;A.prototype.compare=function(a){return this.c>a.c||this.c===a.c&&this.g>a.g||this.c===a.c&&this.g===a.g&&this.B>a.B?1:this.c<a.c||this.c===a.c&&this.g<a.g||this.c===a.c&&this.g===a.g&&this.B<a.B?-1:0};A.prototype.toString=function(){return[this.c,this.g||"",this.B||"",this.e||""].join("")};
|
7
|
+
function B(a){a=da.exec(a);var b=null,c=null,d=null,e=null;a&&(null!==a[1]&&a[1]&&(b=parseInt(a[1],10)),null!==a[2]&&a[2]&&(c=parseInt(a[2],10)),null!==a[3]&&a[3]&&(d=parseInt(a[3],10)),null!==a[4]&&a[4]&&(e=/^[0-9]+$/.test(a[4])?parseInt(a[4],10):a[4]));return new A(b,c,d,e)};function C(a,b,c,d,e,f,g,h){this.P=a;this.ja=c;this.ya=e;this.ia=g;this.m=h}l("webfont.UserAgent",C);C.prototype.getName=function(){return this.P};C.prototype.getName=C.prototype.getName;C.prototype.oa=function(){return this.ja};C.prototype.getEngine=C.prototype.oa;C.prototype.pa=function(){return this.ya};C.prototype.getPlatform=C.prototype.pa;C.prototype.na=function(){return this.ia};C.prototype.getDocumentMode=C.prototype.na;C.prototype.ma=function(){return this.m};C.prototype.getBrowserInfo=C.prototype.ma;function D(a,b){this.a=a;this.k=b}var ea=new C("Unknown",0,"Unknown",0,"Unknown",0,void 0,new z(!1,!1,!1,!1));
|
8
|
+
D.prototype.parse=function(){var a;if(-1!=this.a.indexOf("MSIE")||-1!=this.a.indexOf("Trident/")){a=E(this);var b=B(F(this)),c=null,d=null,e=G(this.a,/Trident\/([\d\w\.]+)/,1),f=H(this.k),c=-1!=this.a.indexOf("MSIE")?B(G(this.a,/MSIE ([\d\w\.]+)/,1)):B(G(this.a,/rv:([\d\w\.]+)/,1));""!=e?(d="Trident",B(e)):d="Unknown";a=new C("MSIE",0,d,0,a,0,f,new z("Windows"==a&&6<=c.c||"Windows Phone"==a&&8<=b.c,!1,!1,!!this.k.fonts))}else if(-1!=this.a.indexOf("Opera"))a:if(a="Unknown",c=B(G(this.a,/Presto\/([\d\w\.]+)/,
|
9
|
+
1)),B(F(this)),b=H(this.k),null!==c.c?a="Presto":(-1!=this.a.indexOf("Gecko")&&(a="Gecko"),B(G(this.a,/rv:([^\)]+)/,1))),-1!=this.a.indexOf("Opera Mini/"))c=B(G(this.a,/Opera Mini\/([\d\.]+)/,1)),a=new C("OperaMini",0,a,0,E(this),0,b,new z(!1,!1,!1,!!this.k.fonts));else{if(-1!=this.a.indexOf("Version/")&&(c=B(G(this.a,/Version\/([\d\.]+)/,1)),null!==c.c)){a=new C("Opera",0,a,0,E(this),0,b,new z(10<=c.c,!1,!1,!!this.k.fonts));break a}c=B(G(this.a,/Opera[\/ ]([\d\.]+)/,1));a=null!==c.c?new C("Opera",
|
10
|
+
0,a,0,E(this),0,b,new z(10<=c.c,!1,!1,!!this.k.fonts)):new C("Opera",0,a,0,E(this),0,b,new z(!1,!1,!1,!!this.k.fonts))}else/OPR\/[\d.]+/.test(this.a)?a=I(this):/AppleWeb(K|k)it/.test(this.a)?a=I(this):-1!=this.a.indexOf("Gecko")?(a="Unknown",b=new A,B(F(this)),b=!1,-1!=this.a.indexOf("Firefox")?(a="Firefox",b=B(G(this.a,/Firefox\/([\d\w\.]+)/,1)),b=3<=b.c&&5<=b.g):-1!=this.a.indexOf("Mozilla")&&(a="Mozilla"),c=B(G(this.a,/rv:([^\)]+)/,1)),b||(b=1<c.c||1==c.c&&9<c.g||1==c.c&&9==c.g&&2<=c.B),a=new C(a,
|
11
|
+
0,"Gecko",0,E(this),0,H(this.k),new z(b,!1,!1,!!this.k.fonts))):a=ea;return a};function E(a){var b=G(a.a,/(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|BlackBerry)/,1);if(""!=b)return/BB\d{2}/.test(b)&&(b="BlackBerry"),b;a=G(a.a,/(Linux|Mac_PowerPC|Macintosh|Windows|CrOS|PlayStation|CrKey)/,1);return""!=a?("Mac_PowerPC"==a?a="Macintosh":"PlayStation"==a&&(a="Linux"),a):"Unknown"}
|
12
|
+
function F(a){var b=G(a.a,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b||(b=G(a.a,/Windows Phone( OS)? ([^;)]+)/,2))||(b=G(a.a,/(iPhone )?OS ([\d_]+)/,2)))return b;if(b=G(a.a,/(?:Linux|CrOS|CrKey) ([^;)]+)/,1))for(var b=b.split(/\s/),c=0;c<b.length;c+=1)if(/^[\d\._]+$/.test(b[c]))return b[c];return(a=G(a.a,/(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/,2))?a:"Unknown"}
|
13
|
+
function I(a){var b=E(a),c=B(F(a)),d=B(G(a.a,/AppleWeb(?:K|k)it\/([\d\.\+]+)/,1)),e="Unknown",f=new A,f="Unknown",g=!1;/OPR\/[\d.]+/.test(a.a)?e="Opera":-1!=a.a.indexOf("Chrome")||-1!=a.a.indexOf("CrMo")||-1!=a.a.indexOf("CriOS")?e="Chrome":/Silk\/\d/.test(a.a)?e="Silk":"BlackBerry"==b||"Android"==b?e="BuiltinBrowser":-1!=a.a.indexOf("PhantomJS")?e="PhantomJS":-1!=a.a.indexOf("Safari")?e="Safari":-1!=a.a.indexOf("AdobeAIR")?e="AdobeAIR":-1!=a.a.indexOf("PlayStation")&&(e="BuiltinBrowser");"BuiltinBrowser"==
|
14
|
+
e?f="Unknown":"Silk"==e?f=G(a.a,/Silk\/([\d\._]+)/,1):"Chrome"==e?f=G(a.a,/(Chrome|CrMo|CriOS)\/([\d\.]+)/,2):-1!=a.a.indexOf("Version/")?f=G(a.a,/Version\/([\d\.\w]+)/,1):"AdobeAIR"==e?f=G(a.a,/AdobeAIR\/([\d\.]+)/,1):"Opera"==e?f=G(a.a,/OPR\/([\d.]+)/,1):"PhantomJS"==e&&(f=G(a.a,/PhantomJS\/([\d.]+)/,1));f=B(f);g="AdobeAIR"==e?2<f.c||2==f.c&&5<=f.g:"BlackBerry"==b?10<=c.c:"Android"==b?2<c.c||2==c.c&&1<c.g:526<=d.c||525<=d.c&&13<=d.g;return new C(e,0,"AppleWebKit",0,b,0,H(a.k),new z(g,536>d.c||536==
|
15
|
+
d.c&&11>d.g,"iPhone"==b||"iPad"==b||"iPod"==b||"Macintosh"==b,!!a.k.fonts))}function G(a,b,c){return(a=a.match(b))&&a[c]?a[c]:""}function H(a){if(a.documentMode)return a.documentMode};function J(a){this.xa=a||"-"}J.prototype.e=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.xa)};function K(a,b){this.P=a;this.$=4;this.Q="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.Q=c[1],this.$=parseInt(c[2],10))}K.prototype.getName=function(){return this.P};function L(a){return a.Q+a.$}function fa(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function ga(a,b,c,d,e){this.d=a;this.q=b;this.T=c;this.j="wf";this.h=new J("-");this.ha=!1!==d;this.C=!1!==e}function M(a){if(a.C){var b=v(a.q,a.h.e(a.j,"active")),c=[],d=[a.h.e(a.j,"loading")];b||c.push(a.h.e(a.j,"inactive"));u(a.q,c,d)}N(a,"inactive")}function N(a,b,c){if(a.ha&&a.T[b])if(c)a.T[b](c.getName(),L(c));else a.T[b]()};function ha(){this.A={}};function O(a,b){this.d=a;this.H=b;this.o=this.d.createElement("span",{"aria-hidden":"true"},this.H)}function P(a){t(a.d,"body",a.o)}
|
16
|
+
function Q(a){var b;b=[];for(var c=a.P.split(/,\s*/),d=0;d<c.length;d++){var e=c[d].replace(/['"]/g,"");-1==e.indexOf(" ")?b.push(e):b.push("'"+e+"'")}b=b.join(",");c="normal";"o"===a.Q?c="oblique":"i"===a.Q&&(c="italic");return"display:block;position:absolute;top:0px;left:0px;visibility:hidden;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+b+";"+("font-style:"+c+";font-weight:"+(a.$+"00")+";")}
|
17
|
+
O.prototype.remove=function(){var a=this.o;a.parentNode&&a.parentNode.removeChild(a)};function ja(a,b,c,d,e,f,g,h){this.aa=a;this.va=b;this.d=c;this.t=d;this.H=h||"BESbswy";this.m=e;this.J={};this.Y=f||3E3;this.da=g||null;this.G=this.F=null;a=new O(this.d,this.H);P(a);for(var p in R)R.hasOwnProperty(p)&&(b=new K(R[p],L(this.t)),b=Q(b),a.o.style.cssText=b,this.J[R[p]]=a.o.offsetWidth);a.remove()}var R={Ea:"serif",Da:"sans-serif",Ca:"monospace"};
|
18
|
+
ja.prototype.start=function(){this.F=new O(this.d,this.H);P(this.F);this.G=new O(this.d,this.H);P(this.G);this.za=q();var a=new K(this.t.getName()+",serif",L(this.t)),a=Q(a);this.F.o.style.cssText=a;a=new K(this.t.getName()+",sans-serif",L(this.t));a=Q(a);this.G.o.style.cssText=a;ka(this)};function la(a,b,c){for(var d in R)if(R.hasOwnProperty(d)&&b===a.J[R[d]]&&c===a.J[R[d]])return!0;return!1}
|
19
|
+
function ka(a){var b=a.F.o.offsetWidth,c=a.G.o.offsetWidth;b===a.J.serif&&c===a.J["sans-serif"]||a.m.Z&&la(a,b,c)?q()-a.za>=a.Y?a.m.Z&&la(a,b,c)&&(null===a.da||a.da.hasOwnProperty(a.t.getName()))?S(a,a.aa):S(a,a.va):ma(a):S(a,a.aa)}function ma(a){setTimeout(n(function(){ka(this)},a),25)}function S(a,b){a.F.remove();a.G.remove();b(a.t)};function T(a,b,c,d){this.d=b;this.u=c;this.U=0;this.fa=this.ca=!1;this.Y=d;this.m=a.m}function na(a,b,c,d,e){c=c||{};if(0===b.length&&e)M(a.u);else for(a.U+=b.length,e&&(a.ca=e),e=0;e<b.length;e++){var f=b[e],g=c[f.getName()],h=a.u,p=f;h.C&&u(h.q,[h.h.e(h.j,p.getName(),L(p).toString(),"loading")]);N(h,"fontloading",p);h=null;h=new ja(n(a.ka,a),n(a.la,a),a.d,f,a.m,a.Y,d,g);h.start()}}
|
20
|
+
T.prototype.ka=function(a){var b=this.u;b.C&&u(b.q,[b.h.e(b.j,a.getName(),L(a).toString(),"active")],[b.h.e(b.j,a.getName(),L(a).toString(),"loading"),b.h.e(b.j,a.getName(),L(a).toString(),"inactive")]);N(b,"fontactive",a);this.fa=!0;oa(this)};
|
21
|
+
T.prototype.la=function(a){var b=this.u;if(b.C){var c=v(b.q,b.h.e(b.j,a.getName(),L(a).toString(),"active")),d=[],e=[b.h.e(b.j,a.getName(),L(a).toString(),"loading")];c||d.push(b.h.e(b.j,a.getName(),L(a).toString(),"inactive"));u(b.q,d,e)}N(b,"fontinactive",a);oa(this)};function oa(a){0==--a.U&&a.ca&&(a.fa?(a=a.u,a.C&&u(a.q,[a.h.e(a.j,"active")],[a.h.e(a.j,"loading"),a.h.e(a.j,"inactive")]),N(a,"active")):M(a.u))};function U(a){this.K=a;this.v=new ha;this.Aa=new D(a.navigator.userAgent,a.document);this.a=this.Aa.parse();this.V=this.W=0;this.M=this.N=!0}
|
22
|
+
U.prototype.load=function(a){var b=a.context||this.K;this.d=new s(this.K,b);this.N=!1!==a.events;this.M=!1!==a.classes;var b=new ga(this.d,b.document.documentElement,a,this.N,this.M),c=[],d=a.timeout;b.C&&u(b.q,[b.h.e(b.j,"loading")]);N(b,"loading");var c=this.v,e=this.d,f=[],g;for(g in a)if(a.hasOwnProperty(g)){var h=c.A[g];h&&f.push(h(a[g],e))}c=f;this.V=this.W=c.length;a=new T(this.a,this.d,b,d);g=0;for(d=c.length;g<d;g++)e=c[g],e.L(this.a,n(this.wa,this,e,b,a))};
|
23
|
+
U.prototype.wa=function(a,b,c,d){var e=this;d?a.load(function(a,b,d){pa(e,c,a,b,d)}):(a=0==--this.W,this.V--,a&&0==this.V?M(b):(this.M||this.N)&&na(c,[],{},null,a))};function pa(a,b,c,d,e){var f=0==--a.W;(a.M||a.N)&&setTimeout(function(){na(b,c,d||null,e||null,f)},0)};function qa(a,b,c){this.S=a?a:b+ra;this.s=[];this.X=[];this.ga=c||""}var ra="//fonts.googleapis.com/css";qa.prototype.e=function(){if(0==this.s.length)throw Error("No fonts to load!");if(-1!=this.S.indexOf("kit="))return this.S;for(var a=this.s.length,b=[],c=0;c<a;c++)b.push(this.s[c].replace(/ /g,"+"));a=this.S+"?family="+b.join("%7C");0<this.X.length&&(a+="&subset="+this.X.join(","));0<this.ga.length&&(a+="&text="+encodeURIComponent(this.ga));return a};function sa(a){this.s=a;this.ea=[];this.O={}}
|
24
|
+
var ta={latin:"BESbswy",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},ua={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},va={i:"i",italic:"i",n:"n",normal:"n"},wa=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
|
25
|
+
sa.prototype.parse=function(){for(var a=this.s.length,b=0;b<a;b++){var c=this.s[b].split(":"),d=c[0].replace(/\+/g," "),e=["n4"];if(2<=c.length){var f;var g=c[1];f=[];if(g)for(var g=g.split(","),h=g.length,p=0;p<h;p++){var m;m=g[p];if(m.match(/^[\w-]+$/)){m=wa.exec(m.toLowerCase());var r=void 0;if(null==m)r="";else{r=void 0;r=m[1];if(null==r||""==r)r="4";else var ia=ua[r],r=ia?ia:isNaN(r)?"4":r.substr(0,1);m=m[2];r=[null==m||""==m?"n":va[m],r].join("")}m=r}else m="";m&&f.push(m)}0<f.length&&(e=f);
|
26
|
+
3==c.length&&(c=c[2],f=[],c=c?c.split(","):f,0<c.length&&(c=ta[c[0]])&&(this.O[d]=c))}this.O[d]||(c=ta[d])&&(this.O[d]=c);for(c=0;c<e.length;c+=1)this.ea.push(new K(d,e[c]))}};function V(a,b){this.a=(new D(navigator.userAgent,document)).parse();this.d=a;this.f=b}var xa={Arimo:!0,Cousine:!0,Tinos:!0};V.prototype.L=function(a,b){b(a.m.R)};V.prototype.load=function(a){var b=this.d;"MSIE"==this.a.getName()&&1!=this.f.blocking?ca(b,n(this.ba,this,a)):this.ba(a)};
|
27
|
+
V.prototype.ba=function(a){for(var b=this.d,c=new qa(this.f.api,w(b),this.f.text),d=this.f.families,e=d.length,f=0;f<e;f++){var g=d[f].split(":");3==g.length&&c.X.push(g.pop());var h="";2==g.length&&""!=g[1]&&(h=":");c.s.push(g.join(h))}d=new sa(d);d.parse();x(b,c.e());a(d.ea,d.O,xa)};function W(a,b){this.d=a;this.f=b;this.p=[]}W.prototype.I=function(a){var b=this.d;return w(this.d)+(this.f.api||"//f.fontdeck.com/s/css/js/")+(b.w.location.hostname||b.K.location.hostname)+"/"+a+".js"};
|
28
|
+
W.prototype.L=function(a,b){var c=this.f.id,d=this.d.w,e=this;c?(d.__webfontfontdeckmodule__||(d.__webfontfontdeckmodule__={}),d.__webfontfontdeckmodule__[c]=function(a,c){for(var d=0,p=c.fonts.length;d<p;++d){var m=c.fonts[d];e.p.push(new K(m.name,fa("font-weight:"+m.weight+";font-style:"+m.style)))}b(a)},y(this.d,this.I(c),function(a){a&&b(!1)})):b(!1)};W.prototype.load=function(a){a(this.p)};function X(a,b){this.d=a;this.f=b;this.p=[]}X.prototype.I=function(a){var b=w(this.d);return(this.f.api||b+"//use.typekit.net")+"/"+a+".js"};X.prototype.L=function(a,b){var c=this.f.id,d=this.d.w,e=this;c?y(this.d,this.I(c),function(a){if(a)b(!1);else{if(d.Typekit&&d.Typekit.config&&d.Typekit.config.fn){a=d.Typekit.config.fn;for(var c=0;c<a.length;c+=2)for(var h=a[c],p=a[c+1],m=0;m<p.length;m++)e.p.push(new K(h,p[m]));try{d.Typekit.load({Ga:!1,Fa:!1})}catch(r){}}b(!0)}},2E3):b(!1)};
|
29
|
+
X.prototype.load=function(a){a(this.p)};function Y(a,b){this.d=a;this.f=b;this.p=[]}Y.prototype.L=function(a,b){var c=this,d=c.f.projectId,e=c.f.version;if(d){var f=c.d.w;y(this.d,c.I(d,e),function(e){if(e)b(!1);else{if(f["__mti_fntLst"+d]&&(e=f["__mti_fntLst"+d]()))for(var h=0;h<e.length;h++)c.p.push(new K(e[h].fontfamily));b(a.m.R)}}).id="__MonotypeAPIScript__"+d}else b(!1)};Y.prototype.I=function(a,b){var c=w(this.d),d=(this.f.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};
|
30
|
+
Y.prototype.load=function(a){a(this.p)};function Z(a,b){this.d=a;this.f=b}Z.prototype.load=function(a){var b,c,d=this.f.urls||[],e=this.f.families||[],f=this.f.testStrings||{};b=0;for(c=d.length;b<c;b++)x(this.d,d[b]);d=[];b=0;for(c=e.length;b<c;b++){var g=e[b].split(":");if(g[1])for(var h=g[1].split(","),p=0;p<h.length;p+=1)d.push(new K(g[0],h[p]));else d.push(new K(g[0]))}a(d,f)};Z.prototype.L=function(a,b){return b(a.m.R)};var $=new U(k);$.v.A.custom=function(a,b){return new Z(b,a)};$.v.A.fontdeck=function(a,b){return new W(b,a)};$.v.A.monotype=function(a,b){return new Y(b,a)};$.v.A.typekit=function(a,b){return new X(b,a)};$.v.A.google=function(a,b){return new V(b,a)};k.WebFont||(k.WebFont={},k.WebFont.load=n($.load,$),k.WebFontConfig&&$.load(k.WebFontConfig));})(this,document);
|
31
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webfontloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Carver
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- tools/jasmine/jasmine.css
|
192
192
|
- tools/jasmine/jasmine.js
|
193
193
|
- webfontloader.gemspec
|
194
|
+
- webfontloader.js
|
194
195
|
homepage: http://github.com/typekit/webfontloader
|
195
196
|
licenses:
|
196
197
|
- Apache 2.0
|