webfontloader 1.5.15 → 1.5.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 862467b0fd860a6dfcf03a8dbce5f8efe4be586a
4
- data.tar.gz: 78c6b4070c011c9dfb8333010bd98fc66ebb3d14
3
+ metadata.gz: bd15ad744234e9c40d581bc71a97c88828e8139a
4
+ data.tar.gz: 7da42b2e5093bde226814468257345fc14334f6f
5
5
  SHA512:
6
- metadata.gz: ae5e4f11c4ec120f57f8557cb48007540f099e550d26071a20ceb9c83d219feee4e5408006837b20e733862657806d2e2130dc2b21b5df7997ee698da4cfba7e
7
- data.tar.gz: d78b887b722b2b8776debb4349310c3582fc9aeb26496ae00dca2935c1c93dfe7bcdef94e3a8ca3760d2f802780a70144e76a40b59cdf532bf98fb6d4c2014ad
6
+ metadata.gz: 75c5ba8f1b4f4a66ab06a38a9e7039668211020252762b77bea3aff3e01ccadba9bb2177b69b9155ddd868c3deabab8f4c35372f5902c5efa635c599c9f3156c
7
+ data.tar.gz: eece241e3e740d5152484ac668b1ab1cf820742a30bc1f375e65b3964c6ad2c3d217474311808d6af6ee896adbd8077dabbfd0be4ce0aafa9fdac7fb91c43500
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v1.5.16 (March 30, 2015)
2
+ * Optimise DOM performance in the font watcher.
3
+
1
4
  v1.5.15 (March 25, 2015)
2
5
  * Increase offset position for ruler so scrollbars are less likely to be triggered by large test strings
3
6
 
data/lib/webfontloader.rb CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  require 'webfontloader/modules'
4
4
 
5
5
  module WebFontLoader
6
- VERSION = '1.5.15'
6
+ VERSION = '1.5.16'
7
7
 
8
8
  ProjectRoot = File.expand_path(File.dirname(__FILE__) + "/..")
9
9
 
data/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Web Font Loader gives you added control when using linked fonts via @font-face.",
5
5
  "main": "webfontloader.js",
6
6
  "scripts": {
7
- "test": "./node_modules/.bin/phantomjs tools/jasmine-phantomjs/jasmine-phantomjs.js spec/index.html"
7
+ "test": "phantomjs tools/jasmine-phantomjs/jasmine-phantomjs.js spec/index.html"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,6 +30,5 @@
30
30
  },
31
31
  "homepage": "https://github.com/typekit/webfontloader",
32
32
  "devDependencies": {
33
- "phantomjs2-ext": "0.0.4"
34
33
  }
35
34
  }
@@ -21,13 +21,10 @@ describe('FontWatcher', function () {
21
21
  userAgent = new UserAgent(
22
22
  'Firefox',
23
23
  new Version(3, 6),
24
- '3.6',
25
24
  'Gecko',
26
25
  new Version(1, 9, 3),
27
- '1.9.3',
28
26
  'Macintosh',
29
27
  new Version(10, 6),
30
- '10.6',
31
28
  undefined,
32
29
  new BrowserInfo(true, false, false, false)
33
30
  );
@@ -8,389 +8,150 @@ describe('FontWatchRunner', function () {
8
8
 
9
9
  var domHelper = null,
10
10
  activeCallback = null,
11
- inactiveCallback = null;
11
+ inactiveCallback = null,
12
+ userAgent = null,
13
+ nullFont = null,
14
+ sourceSansA = null,
15
+ sourceSansB = null,
16
+ elena = null;
12
17
 
13
18
  beforeEach(function () {
19
+ var userAgentParser = new UserAgentParser(window.navigator.userAgent, window.document);
20
+
14
21
  domHelper = new DomHelper(window);
15
22
 
16
23
  activeCallback = jasmine.createSpy('activeCallback');
17
24
  inactiveCallback = jasmine.createSpy('inactiveCallback');
18
- });
19
-
20
- describe('Fake browser', function () {
21
- var font = new Font('My Family', 'n4'),
22
- TARGET_SIZE = 3,
23
- FALLBACK_SIZE_A = 1,
24
- FALLBACK_SIZE_B = 2,
25
- LAST_RESORT_SIZE = 4,
26
-
27
- browserInfo = new BrowserInfo(true, false, false),
28
- fallbackBugBrowserInfo = new BrowserInfo(true, true, false),
29
- setupWidths = [],
30
- actualWidths = [],
31
- timesToGetTimeBeforeTimeout = 10;
32
-
33
- beforeEach(function () {
34
- jasmine.Clock.useMock();
35
-
36
- setupWidths = [FALLBACK_SIZE_A, FALLBACK_SIZE_B, LAST_RESORT_SIZE];
37
-
38
- actualWidths = [];
39
-
40
- var setupFinished = false,
41
- fakeGetWidthCount = 0;
42
-
43
- spyOn(FontRuler.prototype, 'getWidth').andCallFake(function () {
44
- var result = null;
45
- if (setupFinished) {
46
- // If you are getting an exception here your tests does not specify enough
47
- // size data to run properly.
48
- if (fakeGetWidthCount >= actualWidths.length) {
49
- throw 'Invalid test data';
50
- }
51
- result = actualWidths[fakeGetWidthCount];
52
- fakeGetWidthCount += 1;
53
- } else {
54
- result = setupWidths[Math.min(fakeGetWidthCount, setupWidths.length - 1)];
55
- fakeGetWidthCount += 1;
56
- }
57
- return result;
58
- });
59
-
60
- timesToGetBeforeTimeout = 10;
61
25
 
62
- spyOn(goog, 'now').andCallFake(function () {
63
- if (timesToGetTimeBeforeTimeout <= 0) {
64
- return 6000;
65
- } else {
66
- timesToGetTimeBeforeTimeout -= 1;
67
- return 1;
68
- }
69
- });
26
+ userAgent = userAgentParser.parse();
70
27
 
71
- var originalStart = FontWatchRunner.prototype.start;
28
+ nullFont = new Font('__webfontloader_test__');
29
+ sourceSansA = new Font('SourceSansA');
30
+ sourceSansB = new Font('SourceSansB');
31
+ elena = new Font('Elena');
32
+ });
72
33
 
73
- spyOn(FontWatchRunner.prototype, 'start').andCallFake(function () {
74
- setupFinished = true;
75
- fakeGetWidthCount = 0;
34
+ it('should fail to load a null font', function () {
35
+ var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
36
+ domHelper, nullFont, userAgent.getBrowserInfo(), 500, {});
76
37
 
77
- originalStart.apply(this);
78
- });
38
+ runs(function () {
39
+ fontWatchRunner.start();
79
40
  });
80
41
 
81
- it('should call active if fonts are already loaded', function () {
82
- actualWidths = [
83
- TARGET_SIZE, TARGET_SIZE
84
- ];
42
+ waitsFor(function () {
43
+ return activeCallback.wasCalled || inactiveCallback.wasCalled;
44
+ });
85
45
 
86
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
87
- domHelper, font, browserInfo);
46
+ runs(function () {
47
+ expect(inactiveCallback).toHaveBeenCalledWith(nullFont);
48
+ });
49
+ });
88
50
 
51
+ it('should load font succesfully', function () {
52
+ var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
53
+ domHelper, sourceSansA, userAgent.getBrowserInfo(), 5000),
54
+ ruler = new FontRuler(domHelper, 'abcdef'),
55
+ monospace = new Font('monospace'),
56
+ sourceSansAFallback = new Font("'SourceSansA', monospace"),
57
+ activeWidth = null,
58
+ originalWidth = null,
59
+ finalCheck = false;
60
+
61
+ runs(function () {
62
+ ruler.insert();
63
+ ruler.setFont(monospace);
64
+ originalWidth = ruler.getWidth();
65
+ ruler.setFont(sourceSansAFallback);
89
66
  fontWatchRunner.start();
90
-
91
- jasmine.Clock.tick(1 * 25);
92
- expect(activeCallback).toHaveBeenCalledWith(font);
93
67
  });
94
68
 
95
- it('should wait for font load and call active', function () {
96
- actualWidths = [
97
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
98
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
99
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
100
- TARGET_SIZE, TARGET_SIZE
101
- ];
102
-
103
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
104
- domHelper, font, browserInfo);
69
+ waitsFor(function () {
70
+ return activeCallback.wasCalled || inactiveCallback.wasCalled;
71
+ });
105
72
 
106
- fontWatchRunner.start();
73
+ runs(function () {
74
+ expect(activeCallback).toHaveBeenCalledWith(sourceSansA);
75
+ activeWidth = ruler.getWidth();
76
+ expect(activeWidth).not.toEqual(originalWidth);
107
77
 
108
- jasmine.Clock.tick(3 * 25);
109
- expect(activeCallback).toHaveBeenCalledWith(font);
78
+ window.setTimeout(function () {
79
+ finalCheck = true;
80
+ }, 200);
110
81
  });
111
82
 
112
- it('should wait for font inactive and call inactive', function () {
113
- timesToGetTimeBeforeTimeout = 5;
83
+ waitsFor(function () {
84
+ return finalCheck;
85
+ });
114
86
 
115
- actualWidths = [
116
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
117
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
118
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
119
- FALLBACK_SIZE_A, FALLBACK_SIZE_B,
120
- FALLBACK_SIZE_A, FALLBACK_SIZE_B
121
- ];
87
+ runs(function () {
88
+ expect(ruler.getWidth()).not.toEqual(originalWidth);
89
+ expect(ruler.getWidth()).toEqual(activeWidth);
90
+ });
91
+ });
122
92
 
123
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
124
- domHelper, font, browserInfo);
93
+ it('should attempt to load a non-existing font', function () {
94
+ var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
95
+ domHelper, elena, userAgent.getBrowserInfo(), 500, {});
125
96
 
97
+ runs(function () {
126
98
  fontWatchRunner.start();
127
-
128
- jasmine.Clock.tick(4 * 25);
129
- expect(inactiveCallback).toHaveBeenCalledWith(font);
130
99
  });
131
100
 
132
- describe('WebKit fallback bug', function () {
133
- it('should ignore fallback size and call active', function () {
134
- actualWidths = [
135
- LAST_RESORT_SIZE, LAST_RESORT_SIZE,
136
- TARGET_SIZE, TARGET_SIZE
137
- ];
138
-
139
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
140
- domHelper, font, fallbackBugBrowserInfo);
141
-
142
- fontWatchRunner.start();
143
-
144
- jasmine.Clock.tick(1 * 25);
145
- expect(activeCallback).toHaveBeenCalledWith(font);
146
- });
147
-
148
- it('should consider last resort font as having identical metrics and call active', function () {
149
- actualWidths = [
150
- LAST_RESORT_SIZE, LAST_RESORT_SIZE,
151
- LAST_RESORT_SIZE, LAST_RESORT_SIZE
152
- ];
153
-
154
- timesToGetTimeBeforeTimeout = 2;
155
-
156
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
157
- domHelper, font, fallbackBugBrowserInfo);
158
-
159
- fontWatchRunner.start();
160
-
161
- jasmine.Clock.tick(1 * 25);
162
- expect(activeCallback).toHaveBeenCalledWith(font);
163
- });
164
-
165
- it('should fail to load font and call inactive', function () {
166
- actualWidths = [
167
- LAST_RESORT_SIZE, LAST_RESORT_SIZE,
168
- LAST_RESORT_SIZE, LAST_RESORT_SIZE,
169
- FALLBACK_SIZE_A, FALLBACK_SIZE_B
170
- ];
171
-
172
- timesToGetTimeBeforeTimeout = 3;
173
-
174
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
175
- domHelper, font, fallbackBugBrowserInfo);
176
-
177
- fontWatchRunner.start();
178
-
179
- jasmine.Clock.tick(2 * 25);
180
- expect(inactiveCallback).toHaveBeenCalledWith(font);
181
- });
182
-
183
- it('should call inactive when we are loading a metric incompatible font', function () {
184
- actualWidths = [
185
- LAST_RESORT_SIZE, LAST_RESORT_SIZE,
186
- LAST_RESORT_SIZE, LAST_RESORT_SIZE
187
- ];
188
-
189
- timesToGetTimeBeforeTimeout = 2;
190
-
191
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
192
- domHelper, font, fallbackBugBrowserInfo, 0, { 'My Other Family': true });
193
-
194
- fontWatchRunner.start();
195
-
196
- jasmine.Clock.tick(1 * 25);
197
- expect(inactiveCallback).toHaveBeenCalledWith(font);
198
- });
199
-
200
- it('should call active when we are loading a metric compatible font', function () {
201
- actualWidths = [
202
- LAST_RESORT_SIZE, LAST_RESORT_SIZE,
203
- LAST_RESORT_SIZE, LAST_RESORT_SIZE
204
- ];
205
-
206
- timesToGetTimeBeforeTimeout = 2;
207
-
208
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
209
- domHelper, new Font('Arimo'), fallbackBugBrowserInfo, 0, { 'Arimo': true });
210
-
211
- fontWatchRunner.start();
212
-
213
- jasmine.Clock.tick(1 * 25);
214
- expect(activeCallback).toHaveBeenCalledWith(new Font('Arimo'));
215
- });
101
+ waitsFor(function () {
102
+ return activeCallback.wasCalled || inactiveCallback.wasCalled;
216
103
  });
217
104
 
218
- describe('test string', function () {
219
- var fontWatchRunner = null;
220
-
221
- beforeEach(function () {
222
- spyOn(domHelper, 'createElement').andCallThrough();
223
- });
224
-
225
- it('should be the default', function () {
226
- actualWidths = [
227
- TARGET_SIZE, TARGET_SIZE
228
- ];
229
- fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
230
- domHelper, font, browserInfo);
231
-
232
- fontWatchRunner.start();
233
-
234
- jasmine.Clock.tick(1 * 25);
235
- expect(domHelper.createElement.mostRecentCall.args[2]).toEqual('BESbswy');
236
- });
237
-
238
- it('should be a custom string', function () {
239
- actualWidths = [
240
- TARGET_SIZE, TARGET_SIZE
241
- ];
242
-
243
- fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
244
- domHelper, font, browserInfo, 0, null, 'TestString');
245
-
246
- fontWatchRunner.start();
247
-
248
- jasmine.Clock.tick(1 * 25);
249
- expect(domHelper.createElement.mostRecentCall.args[2]).toEqual('TestString');
250
- });
105
+ runs(function () {
106
+ expect(inactiveCallback).toHaveBeenCalledWith(elena);
251
107
  });
252
108
  });
253
109
 
254
- describe('real browser testing', function () {
255
- var userAgent = null,
256
- nullFont = null,
257
- sourceSansA = null,
258
- sourceSansB = null,
259
- elena = null;
260
-
261
- beforeEach(function () {
262
- var userAgentParser = new UserAgentParser(window.navigator.userAgent, window.document);
110
+ it('should load even if @font-face is inserted after watching has started', function () {
111
+ var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
112
+ domHelper, sourceSansB, userAgent.getBrowserInfo(), 5000),
113
+ ruler = new FontRuler(domHelper, 'abcdef'),
114
+ monospace = new Font('monospace'),
115
+ sourceSansBFallback = new Font("'SourceSansB', monospace"),
116
+ activeWidth = null,
117
+ originalWidth = null,
118
+ finalCheck = false;
119
+
120
+ runs(function () {
121
+ ruler.insert();
122
+ ruler.setFont(monospace);
123
+ originalWidth = ruler.getWidth();
124
+ ruler.setFont(sourceSansBFallback);
125
+ fontWatchRunner.start();
126
+ var link = document.createElement('link');
263
127
 
264
- nullFont = new Font('__webfontloader_test__');
265
- sourceSansA = new Font('SourceSansA');
266
- sourceSansB = new Font('SourceSansB');
267
- elena = new Font('Elena');
128
+ link.rel = "stylesheet";
129
+ link.href= "fixtures/fonts/sourcesansb.css";
268
130
 
269
- userAgent = userAgentParser.parse();
131
+ domHelper.insertInto('head', link);
270
132
  });
271
133
 
272
- it('should fail to load a null font', function () {
273
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
274
- domHelper, nullFont, userAgent.getBrowserInfo(), 500);
275
-
276
- runs(function () {
277
- fontWatchRunner.start();
278
- });
279
-
280
- waitsFor(function () {
281
- return activeCallback.wasCalled || inactiveCallback.wasCalled;
282
- });
283
-
284
- runs(function () {
285
- expect(inactiveCallback).toHaveBeenCalledWith(nullFont);
286
- });
134
+ waitsFor(function () {
135
+ return activeCallback.wasCalled || inactiveCallback.wasCalled;
287
136
  });
288
137
 
289
- it('should load font succesfully', function () {
290
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
291
- domHelper, sourceSansA, userAgent.getBrowserInfo(), 5000),
292
- ruler = new FontRuler(domHelper, 'abcdef'),
293
- monospace = new Font('monospace'),
294
- sourceSansAFallback = new Font("'SourceSansA', monospace"),
295
- activeWidth = null,
296
- originalWidth = null,
297
- finalCheck = false;
298
-
299
- runs(function () {
300
- ruler.insert();
301
- ruler.setFont(monospace);
302
- originalWidth = ruler.getWidth();
303
- ruler.setFont(sourceSansAFallback);
304
- fontWatchRunner.start();
305
- });
306
-
307
- waitsFor(function () {
308
- return activeCallback.wasCalled || inactiveCallback.wasCalled;
309
- });
310
-
311
- runs(function () {
312
- expect(activeCallback).toHaveBeenCalledWith(sourceSansA);
313
- activeWidth = ruler.getWidth();
314
- expect(activeWidth).not.toEqual(originalWidth);
138
+ runs(function () {
139
+ expect(activeCallback).toHaveBeenCalledWith(sourceSansB);
140
+ activeWidth = ruler.getWidth();
141
+ expect(activeWidth).not.toEqual(originalWidth);
315
142
 
316
- window.setTimeout(function () {
317
- finalCheck = true;
318
- }, 200);
319
- });
320
-
321
- waitsFor(function () {
322
- return finalCheck;
323
- });
324
-
325
- runs(function () {
326
- expect(ruler.getWidth()).not.toEqual(originalWidth);
327
- expect(ruler.getWidth()).toEqual(activeWidth);
328
- });
143
+ window.setTimeout(function () {
144
+ finalCheck = true;
145
+ }, 200);
329
146
  });
330
147
 
331
- it('should attempt to load a non-existing font', function () {
332
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
333
- domHelper, elena, userAgent.getBrowserInfo(), 500);
334
-
335
- runs(function () {
336
- fontWatchRunner.start();
337
- });
338
-
339
- waitsFor(function () {
340
- return activeCallback.wasCalled || inactiveCallback.wasCalled;
341
- });
342
-
343
- runs(function () {
344
- expect(inactiveCallback).toHaveBeenCalledWith(elena);
345
- });
148
+ waitsFor(function () {
149
+ return finalCheck;
346
150
  });
347
151
 
348
- it('should load even if @font-face is inserted after watching has started', function () {
349
- var fontWatchRunner = new FontWatchRunner(activeCallback, inactiveCallback,
350
- domHelper, sourceSansB, userAgent.getBrowserInfo(), 5000),
351
- ruler = new FontRuler(domHelper, 'abcdef'),
352
- monospace = new Font('monospace'),
353
- sourceSansBFallback = new Font("'SourceSansB', monospace"),
354
- activeWidth = null,
355
- originalWidth = null,
356
- finalCheck = false;
357
-
358
- runs(function () {
359
- ruler.insert();
360
- ruler.setFont(monospace);
361
- originalWidth = ruler.getWidth();
362
- ruler.setFont(sourceSansBFallback);
363
- fontWatchRunner.start();
364
- var link = document.createElement('link');
365
-
366
- link.rel = "stylesheet";
367
- link.href= "fixtures/fonts/sourcesansb.css";
368
-
369
- domHelper.insertInto('head', link);
370
- });
371
-
372
- waitsFor(function () {
373
- return activeCallback.wasCalled || inactiveCallback.wasCalled;
374
- });
375
-
376
- runs(function () {
377
- expect(activeCallback).toHaveBeenCalledWith(sourceSansB);
378
- activeWidth = ruler.getWidth();
379
- expect(activeWidth).not.toEqual(originalWidth);
380
-
381
- window.setTimeout(function () {
382
- finalCheck = true;
383
- }, 200);
384
- });
385
-
386
- waitsFor(function () {
387
- return finalCheck;
388
- });
389
-
390
- runs(function () {
391
- expect(ruler.getWidth()).not.toEqual(originalWidth);
392
- expect(ruler.getWidth()).toEqual(activeWidth);
393
- });
152
+ runs(function () {
153
+ expect(ruler.getWidth()).not.toEqual(originalWidth);
154
+ expect(ruler.getWidth()).toEqual(activeWidth);
394
155
  });
395
156
  });
396
157
  });
@@ -84,17 +84,17 @@ goog.scope(function () {
84
84
  // fontTestString
85
85
  // );
86
86
  //} else {
87
- fontWatchRunner = new FontWatchRunner(
88
- goog.bind(this.fontActive_, this),
89
- goog.bind(this.fontInactive_, this),
90
- this.domHelper_,
91
- font,
92
- this.browserInfo_,
93
- this.timeout_,
94
- metricCompatibleFonts,
95
- testString
96
- );
97
- //}
87
+ //
88
+ fontWatchRunner = new FontWatchRunner(
89
+ goog.bind(this.fontActive_, this),
90
+ goog.bind(this.fontInactive_, this),
91
+ this.domHelper_,
92
+ font,
93
+ this.browserInfo_,
94
+ this.timeout_,
95
+ metricCompatibleFonts,
96
+ testString
97
+ );
98
98
 
99
99
  fontWatchRunner.start();
100
100
  }
@@ -20,8 +20,8 @@ webfont.FontWatchRunner = function(activeCallback, inactiveCallback, domHelper,
20
20
  this.inactiveCallback_ = inactiveCallback;
21
21
  this.domHelper_ = domHelper;
22
22
  this.font_ = font;
23
- this.fontTestString_ = opt_fontTestString || webfont.FontWatchRunner.DEFAULT_TEST_STRING;
24
23
  this.browserInfo_ = browserInfo;
24
+ this.fontTestString_ = opt_fontTestString || webfont.FontWatchRunner.DEFAULT_TEST_STRING;
25
25
  this.lastResortWidths_ = {};
26
26
  this.timeout_ = opt_timeout || 3000;
27
27
 
@@ -29,6 +29,7 @@ webfont.FontWatchRunner = function(activeCallback, inactiveCallback, domHelper,
29
29
 
30
30
  this.fontRulerA_ = null;
31
31
  this.fontRulerB_ = null;
32
+ this.fontRulerC_ = null;
32
33
 
33
34
  this.setupLastResortWidths_();
34
35
  };
@@ -61,25 +62,24 @@ goog.scope(function () {
61
62
  * @private
62
63
  */
63
64
  FontWatchRunner.prototype.setupLastResortWidths_ = function() {
64
- var fontRuler = new FontRuler(this.domHelper_, this.fontTestString_);
65
-
66
- fontRuler.insert();
65
+ this.fontRulerA_ = new FontRuler(this.domHelper_, this.fontTestString_);
66
+ this.fontRulerB_ = new FontRuler(this.domHelper_, this.fontTestString_);
67
+ this.fontRulerC_ = new FontRuler(this.domHelper_, this.fontTestString_);
67
68
 
68
- for (var font in FontWatchRunner.LastResortFonts) {
69
- if (FontWatchRunner.LastResortFonts.hasOwnProperty(font)) {
70
- fontRuler.setFont(new Font(FontWatchRunner.LastResortFonts[font], this.font_.getVariation()));
71
- this.lastResortWidths_[FontWatchRunner.LastResortFonts[font]] = fontRuler.getWidth();
72
- }
73
- }
74
- fontRuler.remove();
75
- };
69
+ this.fontRulerA_.setFont(new Font(FontWatchRunner.LastResortFonts.SERIF, this.font_.getVariation()));
70
+ this.fontRulerB_.setFont(new Font(FontWatchRunner.LastResortFonts.SANS_SERIF, this.font_.getVariation()));
71
+ this.fontRulerC_.setFont(new Font(FontWatchRunner.LastResortFonts.MONOSPACE, this.font_.getVariation()));
76
72
 
77
- FontWatchRunner.prototype.start = function() {
78
- this.fontRulerA_ = new FontRuler(this.domHelper_, this.fontTestString_);
79
73
  this.fontRulerA_.insert();
80
- this.fontRulerB_ = new FontRuler(this.domHelper_, this.fontTestString_);
81
74
  this.fontRulerB_.insert();
75
+ this.fontRulerC_.insert();
76
+
77
+ this.lastResortWidths_[FontWatchRunner.LastResortFonts.SERIF] = this.fontRulerA_.getWidth();
78
+ this.lastResortWidths_[FontWatchRunner.LastResortFonts.SANS_SERIF] = this.fontRulerB_.getWidth();
79
+ this.lastResortWidths_[FontWatchRunner.LastResortFonts.MONOSPACE] = this.fontRulerC_.getWidth();
80
+ };
82
81
 
82
+ FontWatchRunner.prototype.start = function() {
83
83
  this.started_ = goog.now();
84
84
 
85
85
  this.fontRulerA_.setFont(new Font(this.font_.getName() + ',' + FontWatchRunner.LastResortFonts.SERIF, this.font_.getVariation()));
@@ -200,7 +200,7 @@ goog.scope(function () {
200
200
  FontWatchRunner.prototype.asyncCheck_ = function() {
201
201
  setTimeout(goog.bind(function () {
202
202
  this.check_();
203
- }, this), 25);
203
+ }, this), 50);
204
204
  };
205
205
 
206
206
  /**
@@ -210,6 +210,7 @@ goog.scope(function () {
210
210
  FontWatchRunner.prototype.finish_ = function(callback) {
211
211
  this.fontRulerA_.remove();
212
212
  this.fontRulerB_.remove();
213
+ this.fontRulerC_.remove();
213
214
  callback(this.font_);
214
215
  };
215
216
  });
@@ -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.15'
17
- s.date = '2015-03-25'
16
+ s.version = '1.5.16'
17
+ s.date = '2015-03-30'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
20
20
  ## as you like.
data/webfontloader.js CHANGED
@@ -1,30 +1,30 @@
1
- /* Web Font Loader v1.5.15 - (c) Adobe Systems, Google. License: Apache 2.0 */
2
- ;(function(window,document,undefined){function aa(a,b,c){return a.call.apply(a.bind,arguments)}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 k(a,b,c){k=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return k.apply(null,arguments)}var n=Date.now||function(){return+new Date};function q(a,b){this.J=a;this.t=b||a;this.C=this.t.document}q.prototype.createElement=function(a,b,c){a=this.C.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.C.createTextNode(c));return a};function r(a,b,c){a=a.C.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}function ca(a,b){function c(){a.C.body?b():setTimeout(c,0)}c()}
1
+ /* Web Font Loader v1.5.16 - (c) Adobe Systems, Google. License: Apache 2.0 */
2
+ ;(function(window,document,undefined){function aa(a,b,c){return a.call.apply(a.bind,arguments)}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 k(a,b,c){k=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return k.apply(null,arguments)}var n=Date.now||function(){return+new Date};function q(a,b){this.K=a;this.w=b||a;this.G=this.w.document}q.prototype.createElement=function(a,b,c){a=this.G.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.G.createTextNode(c));return a};function r(a,b,c){a=a.G.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}function ca(a,b){function c(){a.G.body?b():setTimeout(c,0)}c()}
3
3
  function s(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 t(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}
4
- function u(a){if("string"===typeof a.ma)return a.ma;var b=a.t.location.protocol;"about:"==b&&(b=a.J.location.protocol);return"https:"==b?"https:":"http:"}function v(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)};r(a,"head",c)}
5
- function w(a,b,c,d){var e=a.C.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 x(a,b){this.X=a;this.fa=b};function y(a,b,c,d){this.c=null!=a?a:null;this.g=null!=b?b:null;this.A=null!=c?c:null;this.e=null!=d?d:null}var da=/^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;y.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.A>a.A?1:this.c<a.c||this.c===a.c&&this.g<a.g||this.c===a.c&&this.g===a.g&&this.A<a.A?-1:0};y.prototype.toString=function(){return[this.c,this.g||"",this.A||"",this.e||""].join("")};
6
- function z(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 y(b,c,d,e)};function A(a,b,c,d,e,f,g,h){this.M=a;this.k=h}A.prototype.getName=function(){return this.M};function B(a){this.a=a}var ea=new A("Unknown",0,0,0,0,0,0,new x(!1,!1));
4
+ function u(a){if("string"===typeof a.na)return a.na;var b=a.w.location.protocol;"about:"==b&&(b=a.K.location.protocol);return"https:"==b?"https:":"http:"}function v(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)};r(a,"head",c)}
5
+ function w(a,b,c,d){var e=a.G.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 x(a,b){this.Y=a;this.ga=b};function y(a,b,c,d){this.c=null!=a?a:null;this.g=null!=b?b:null;this.D=null!=c?c:null;this.e=null!=d?d:null}var da=/^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;y.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.D>a.D?1:this.c<a.c||this.c===a.c&&this.g<a.g||this.c===a.c&&this.g===a.g&&this.D<a.D?-1:0};y.prototype.toString=function(){return[this.c,this.g||"",this.D||"",this.e||""].join("")};
6
+ function z(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 y(b,c,d,e)};function A(a,b,c,d,e,f,g,h){this.N=a;this.m=h}A.prototype.getName=function(){return this.N};function B(a){this.a=a}var ea=new A("Unknown",0,0,0,0,0,0,new x(!1,!1));
7
7
  B.prototype.parse=function(){var a;if(-1!=this.a.indexOf("MSIE")||-1!=this.a.indexOf("Trident/")){a=C(this);var b=z(D(this)),c=null,d=E(this.a,/Trident\/([\d\w\.]+)/,1),c=-1!=this.a.indexOf("MSIE")?z(E(this.a,/MSIE ([\d\w\.]+)/,1)):z(E(this.a,/rv:([\d\w\.]+)/,1));""!=d&&z(d);a=new A("MSIE",0,0,0,0,0,0,new x("Windows"==a&&6<=c.c||"Windows Phone"==a&&8<=b.c,!1))}else if(-1!=this.a.indexOf("Opera"))a:if(a=z(E(this.a,/Presto\/([\d\w\.]+)/,1)),z(D(this)),null!==a.c||z(E(this.a,/rv:([^\)]+)/,1)),-1!=this.a.indexOf("Opera Mini/"))a=
8
8
  z(E(this.a,/Opera Mini\/([\d\.]+)/,1)),a=new A("OperaMini",0,0,0,C(this),0,0,new x(!1,!1));else{if(-1!=this.a.indexOf("Version/")&&(a=z(E(this.a,/Version\/([\d\.]+)/,1)),null!==a.c)){a=new A("Opera",0,0,0,C(this),0,0,new x(10<=a.c,!1));break a}a=z(E(this.a,/Opera[\/ ]([\d\.]+)/,1));a=null!==a.c?new A("Opera",0,0,0,C(this),0,0,new x(10<=a.c,!1)):new A("Opera",0,0,0,C(this),0,0,new x(!1,!1))}else/OPR\/[\d.]+/.test(this.a)?a=F(this):/AppleWeb(K|k)it/.test(this.a)?a=F(this):-1!=this.a.indexOf("Gecko")?
9
- (a="Unknown",b=new y,z(D(this)),b=!1,-1!=this.a.indexOf("Firefox")?(a="Firefox",b=z(E(this.a,/Firefox\/([\d\w\.]+)/,1)),b=3<=b.c&&5<=b.g):-1!=this.a.indexOf("Mozilla")&&(a="Mozilla"),c=z(E(this.a,/rv:([^\)]+)/,1)),b||(b=1<c.c||1==c.c&&9<c.g||1==c.c&&9==c.g&&2<=c.A),a=new A(a,0,0,0,C(this),0,0,new x(b,!1))):a=ea;return a};
9
+ (a="Unknown",b=new y,z(D(this)),b=!1,-1!=this.a.indexOf("Firefox")?(a="Firefox",b=z(E(this.a,/Firefox\/([\d\w\.]+)/,1)),b=3<=b.c&&5<=b.g):-1!=this.a.indexOf("Mozilla")&&(a="Mozilla"),c=z(E(this.a,/rv:([^\)]+)/,1)),b||(b=1<c.c||1==c.c&&9<c.g||1==c.c&&9==c.g&&2<=c.D),a=new A(a,0,0,0,C(this),0,0,new x(b,!1))):a=ea;return a};
10
10
  function C(a){var b=E(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=E(a.a,/(Linux|Mac_PowerPC|Macintosh|Windows|CrOS|PlayStation|CrKey)/,1);return""!=a?("Mac_PowerPC"==a?a="Macintosh":"PlayStation"==a&&(a="Linux"),a):"Unknown"}
11
11
  function D(a){var b=E(a.a,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b||(b=E(a.a,/Windows Phone( OS)? ([^;)]+)/,2))||(b=E(a.a,/(iPhone )?OS ([\d_]+)/,2)))return b;if(b=E(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=E(a.a,/(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/,2))?a:"Unknown"}
12
12
  function F(a){var b=C(a),c=z(D(a)),d=z(E(a.a,/AppleWeb(?:K|k)it\/([\d\.\+]+)/,1)),e="Unknown",f=new y,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"==
13
13
  e?f="Unknown":"Silk"==e?f=E(a.a,/Silk\/([\d\._]+)/,1):"Chrome"==e?f=E(a.a,/(Chrome|CrMo|CriOS)\/([\d\.]+)/,2):-1!=a.a.indexOf("Version/")?f=E(a.a,/Version\/([\d\.\w]+)/,1):"AdobeAIR"==e?f=E(a.a,/AdobeAIR\/([\d\.]+)/,1):"Opera"==e?f=E(a.a,/OPR\/([\d.]+)/,1):"PhantomJS"==e&&(f=E(a.a,/PhantomJS\/([\d.]+)/,1));f=z(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 A(e,0,0,0,0,0,0,new x(g,536>d.c||536==d.c&&11>d.g))}
14
- function E(a,b,c){return(a=a.match(b))&&a[c]?a[c]:""};function G(a){this.la=a||"-"}G.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.la)};function H(a,b){this.M=a;this.Y=4;this.N="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.N=c[1],this.Y=parseInt(c[2],10))}H.prototype.getName=function(){return this.M};function I(a){return a.N+a.Y}function ga(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 ha(a,b){this.d=a;this.p=a.t.document.documentElement;this.P=b;this.j="wf";this.h=new G("-");this.ga=!1!==b.events;this.B=!1!==b.classes}function J(a){if(a.B){var b=t(a.p,a.h.e(a.j,"active")),c=[],d=[a.h.e(a.j,"loading")];b||c.push(a.h.e(a.j,"inactive"));s(a.p,c,d)}K(a,"inactive")}function K(a,b,c){if(a.ga&&a.P[b])if(c)a.P[b](c.getName(),I(c));else a.P[b]()};function ia(){this.w={}};function L(a,b){this.d=a;this.G=b;this.m=this.d.createElement("span",{"aria-hidden":"true"},this.G)}function M(a){r(a.d,"body",a.m)}
15
- function N(a){var b;b=[];for(var c=a.M.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.N?c="oblique":"i"===a.N&&(c="italic");return"display:block;position:absolute;top:-9999px;left:-9999px;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.Y+"00")+";")}
16
- L.prototype.remove=function(){var a=this.m;a.parentNode&&a.parentNode.removeChild(a)};function O(a,b,c,d,e,f,g,h){this.Z=a;this.ja=b;this.d=c;this.s=d;this.G=h||"BESbswy";this.k=e;this.I={};this.W=f||3E3;this.ba=g||null;this.F=this.D=null;a=new L(this.d,this.G);M(a);for(var m in P)P.hasOwnProperty(m)&&(b=new H(P[m],I(this.s)),b=N(b),a.m.style.cssText=b,this.I[P[m]]=a.m.offsetWidth);a.remove()}var P={ra:"serif",qa:"sans-serif",pa:"monospace"};
17
- O.prototype.start=function(){this.D=new L(this.d,this.G);M(this.D);this.F=new L(this.d,this.G);M(this.F);this.na=n();var a=new H(this.s.getName()+",serif",I(this.s)),a=N(a);this.D.m.style.cssText=a;a=new H(this.s.getName()+",sans-serif",I(this.s));a=N(a);this.F.m.style.cssText=a;Q(this)};function R(a,b,c){for(var d in P)if(P.hasOwnProperty(d)&&b===a.I[P[d]]&&c===a.I[P[d]])return!0;return!1}
18
- function Q(a){var b=a.D.m.offsetWidth,c=a.F.m.offsetWidth;b===a.I.serif&&c===a.I["sans-serif"]||a.k.fa&&R(a,b,c)?n()-a.na>=a.W?a.k.fa&&R(a,b,c)&&(null===a.ba||a.ba.hasOwnProperty(a.s.getName()))?S(a,a.Z):S(a,a.ja):ja(a):S(a,a.Z)}function ja(a){setTimeout(k(function(){Q(this)},a),25)}function S(a,b){a.D.remove();a.F.remove();b(a.s)};function T(a,b,c,d){this.d=b;this.u=c;this.R=0;this.da=this.aa=!1;this.W=d;this.k=a.k}function ka(a,b,c,d,e){c=c||{};if(0===b.length&&e)J(a.u);else for(a.R+=b.length,e&&(a.aa=e),e=0;e<b.length;e++){var f=b[e],g=c[f.getName()],h=a.u,m=f;h.B&&s(h.p,[h.h.e(h.j,m.getName(),I(m).toString(),"loading")]);K(h,"fontloading",m);h=null;h=new O(k(a.ha,a),k(a.ia,a),a.d,f,a.k,a.W,d,g);h.start()}}
19
- T.prototype.ha=function(a){var b=this.u;b.B&&s(b.p,[b.h.e(b.j,a.getName(),I(a).toString(),"active")],[b.h.e(b.j,a.getName(),I(a).toString(),"loading"),b.h.e(b.j,a.getName(),I(a).toString(),"inactive")]);K(b,"fontactive",a);this.da=!0;la(this)};
20
- T.prototype.ia=function(a){var b=this.u;if(b.B){var c=t(b.p,b.h.e(b.j,a.getName(),I(a).toString(),"active")),d=[],e=[b.h.e(b.j,a.getName(),I(a).toString(),"loading")];c||d.push(b.h.e(b.j,a.getName(),I(a).toString(),"inactive"));s(b.p,d,e)}K(b,"fontinactive",a);la(this)};function la(a){0==--a.R&&a.aa&&(a.da?(a=a.u,a.B&&s(a.p,[a.h.e(a.j,"active")],[a.h.e(a.j,"loading"),a.h.e(a.j,"inactive")]),K(a,"active")):J(a.u))};function U(a){this.J=a;this.v=new ia;this.oa=new B(a.navigator.userAgent);this.a=this.oa.parse();this.T=this.U=0;this.Q=this.S=!0}
21
- U.prototype.load=function(a){this.d=new q(this.J,a.context||this.J);this.S=!1!==a.events;this.Q=!1!==a.classes;var b=new ha(this.d,a),c=[],d=a.timeout;b.B&&s(b.p,[b.h.e(b.j,"loading")]);K(b,"loading");var c=this.v,e=this.d,f=[],g;for(g in a)if(a.hasOwnProperty(g)){var h=c.w[g];h&&f.push(h(a[g],e))}c=f;this.T=this.U=c.length;a=new T(this.a,this.d,b,d);d=0;for(g=c.length;d<g;d++)e=c[d],e.K(this.a,k(this.ka,this,e,b,a))};
22
- U.prototype.ka=function(a,b,c,d){var e=this;d?a.load(function(a,b,d){ma(e,c,a,b,d)}):(a=0==--this.U,this.T--,a&&0==this.T?J(b):(this.Q||this.S)&&ka(c,[],{},null,a))};function ma(a,b,c,d,e){var f=0==--a.U;(a.Q||a.S)&&setTimeout(function(){ka(b,c,d||null,e||null,f)},0)};function na(a,b,c){this.O=a?a:b+oa;this.q=[];this.V=[];this.ea=c||""}var oa="//fonts.googleapis.com/css";na.prototype.e=function(){if(0==this.q.length)throw Error("No fonts to load!");if(-1!=this.O.indexOf("kit="))return this.O;for(var a=this.q.length,b=[],c=0;c<a;c++)b.push(this.q[c].replace(/ /g,"+"));a=this.O+"?family="+b.join("%7C");0<this.V.length&&(a+="&subset="+this.V.join(","));0<this.ea.length&&(a+="&text="+encodeURIComponent(this.ea));return a};function pa(a){this.q=a;this.ca=[];this.L={}}
14
+ function E(a,b,c){return(a=a.match(b))&&a[c]?a[c]:""};function G(a){this.ma=a||"-"}G.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.ma)};function H(a,b){this.N=a;this.Z=4;this.O="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.O=c[1],this.Z=parseInt(c[2],10))}H.prototype.getName=function(){return this.N};function I(a){return a.O+a.Z}function ga(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 ha(a,b){this.d=a;this.q=a.w.document.documentElement;this.Q=b;this.j="wf";this.h=new G("-");this.ha=!1!==b.events;this.F=!1!==b.classes}function J(a){if(a.F){var b=t(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"));s(a.q,c,d)}K(a,"inactive")}function K(a,b,c){if(a.ha&&a.Q[b])if(c)a.Q[b](c.getName(),I(c));else a.Q[b]()};function ia(){this.C={}};function L(a,b){this.d=a;this.I=b;this.k=this.d.createElement("span",{"aria-hidden":"true"},this.I)}function M(a){r(a.d,"body",a.k)}
15
+ function N(a){var b;b=[];for(var c=a.N.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.O?c="oblique":"i"===a.O&&(c="italic");return"display:block;position:absolute;top:-9999px;left:-9999px;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.Z+"00")+";")}
16
+ L.prototype.remove=function(){var a=this.k;a.parentNode&&a.parentNode.removeChild(a)};function O(a,b,c,d,e,f,g,h){this.$=a;this.ka=b;this.d=c;this.o=d;this.m=e;this.I=h||"BESbswy";this.v={};this.X=f||3E3;this.ca=g||null;this.H=this.u=this.t=null;this.t=new L(this.d,this.I);this.u=new L(this.d,this.I);this.H=new L(this.d,this.I);a=new H("serif",I(this.o));a=N(a);this.t.k.style.cssText=a;a=new H("sans-serif",I(this.o));a=N(a);this.u.k.style.cssText=a;a=new H("monospace",I(this.o));a=N(a);this.H.k.style.cssText=a;M(this.t);M(this.u);M(this.H);this.v.serif=this.t.k.offsetWidth;this.v["sans-serif"]=
17
+ this.u.k.offsetWidth;this.v.monospace=this.H.k.offsetWidth}var P={sa:"serif",ra:"sans-serif",qa:"monospace"};O.prototype.start=function(){this.oa=n();var a=new H(this.o.getName()+",serif",I(this.o)),a=N(a);this.t.k.style.cssText=a;a=new H(this.o.getName()+",sans-serif",I(this.o));a=N(a);this.u.k.style.cssText=a;Q(this)};function R(a,b,c){for(var d in P)if(P.hasOwnProperty(d)&&b===a.v[P[d]]&&c===a.v[P[d]])return!0;return!1}
18
+ function Q(a){var b=a.t.k.offsetWidth,c=a.u.k.offsetWidth;b===a.v.serif&&c===a.v["sans-serif"]||a.m.ga&&R(a,b,c)?n()-a.oa>=a.X?a.m.ga&&R(a,b,c)&&(null===a.ca||a.ca.hasOwnProperty(a.o.getName()))?S(a,a.$):S(a,a.ka):ja(a):S(a,a.$)}function ja(a){setTimeout(k(function(){Q(this)},a),50)}function S(a,b){a.t.remove();a.u.remove();a.H.remove();b(a.o)};function T(a,b,c,d){this.d=b;this.A=c;this.S=0;this.ea=this.ba=!1;this.X=d;this.m=a.m}function ka(a,b,c,d,e){c=c||{};if(0===b.length&&e)J(a.A);else for(a.S+=b.length,e&&(a.ba=e),e=0;e<b.length;e++){var f=b[e],g=c[f.getName()],h=a.A,m=f;h.F&&s(h.q,[h.h.e(h.j,m.getName(),I(m).toString(),"loading")]);K(h,"fontloading",m);h=null;h=new O(k(a.ia,a),k(a.ja,a),a.d,f,a.m,a.X,d,g);h.start()}}
19
+ T.prototype.ia=function(a){var b=this.A;b.F&&s(b.q,[b.h.e(b.j,a.getName(),I(a).toString(),"active")],[b.h.e(b.j,a.getName(),I(a).toString(),"loading"),b.h.e(b.j,a.getName(),I(a).toString(),"inactive")]);K(b,"fontactive",a);this.ea=!0;la(this)};
20
+ T.prototype.ja=function(a){var b=this.A;if(b.F){var c=t(b.q,b.h.e(b.j,a.getName(),I(a).toString(),"active")),d=[],e=[b.h.e(b.j,a.getName(),I(a).toString(),"loading")];c||d.push(b.h.e(b.j,a.getName(),I(a).toString(),"inactive"));s(b.q,d,e)}K(b,"fontinactive",a);la(this)};function la(a){0==--a.S&&a.ba&&(a.ea?(a=a.A,a.F&&s(a.q,[a.h.e(a.j,"active")],[a.h.e(a.j,"loading"),a.h.e(a.j,"inactive")]),K(a,"active")):J(a.A))};function U(a){this.K=a;this.B=new ia;this.pa=new B(a.navigator.userAgent);this.a=this.pa.parse();this.U=this.V=0;this.R=this.T=!0}
21
+ U.prototype.load=function(a){this.d=new q(this.K,a.context||this.K);this.T=!1!==a.events;this.R=!1!==a.classes;var b=new ha(this.d,a),c=[],d=a.timeout;b.F&&s(b.q,[b.h.e(b.j,"loading")]);K(b,"loading");var c=this.B,e=this.d,f=[],g;for(g in a)if(a.hasOwnProperty(g)){var h=c.C[g];h&&f.push(h(a[g],e))}c=f;this.U=this.V=c.length;a=new T(this.a,this.d,b,d);d=0;for(g=c.length;d<g;d++)e=c[d],e.L(this.a,k(this.la,this,e,b,a))};
22
+ U.prototype.la=function(a,b,c,d){var e=this;d?a.load(function(a,b,d){ma(e,c,a,b,d)}):(a=0==--this.V,this.U--,a&&0==this.U?J(b):(this.R||this.T)&&ka(c,[],{},null,a))};function ma(a,b,c,d,e){var f=0==--a.V;(a.R||a.T)&&setTimeout(function(){ka(b,c,d||null,e||null,f)},0)};function na(a,b,c){this.P=a?a:b+oa;this.s=[];this.W=[];this.fa=c||""}var oa="//fonts.googleapis.com/css";na.prototype.e=function(){if(0==this.s.length)throw Error("No fonts to load!");if(-1!=this.P.indexOf("kit="))return this.P;for(var a=this.s.length,b=[],c=0;c<a;c++)b.push(this.s[c].replace(/ /g,"+"));a=this.P+"?family="+b.join("%7C");0<this.W.length&&(a+="&subset="+this.W.join(","));0<this.fa.length&&(a+="&text="+encodeURIComponent(this.fa));return a};function pa(a){this.s=a;this.da=[];this.M={}}
23
23
  var qa={latin:"BESbswy",cyrillic:"&#1081;&#1103;&#1046;",greek:"&#945;&#946;&#931;",khmer:"&#x1780;&#x1781;&#x1782;",Hanuman:"&#x1780;&#x1781;&#x1782;"},ra={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"},sa={i:"i",italic:"i",n:"n",normal:"n"},ta=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
24
- pa.prototype.parse=function(){for(var a=this.q.length,b=0;b<a;b++){var c=this.q[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,m=0;m<h;m++){var l;l=g[m];if(l.match(/^[\w-]+$/)){l=ta.exec(l.toLowerCase());var p=void 0;if(null==l)p="";else{p=void 0;p=l[1];if(null==p||""==p)p="4";else var fa=ra[p],p=fa?fa:isNaN(p)?"4":p.substr(0,1);l=l[2];p=[null==l||""==l?"n":sa[l],p].join("")}l=p}else l="";l&&f.push(l)}0<f.length&&(e=f);
25
- 3==c.length&&(c=c[2],f=[],c=c?c.split(","):f,0<c.length&&(c=qa[c[0]])&&(this.L[d]=c))}this.L[d]||(c=qa[d])&&(this.L[d]=c);for(c=0;c<e.length;c+=1)this.ca.push(new H(d,e[c]))}};function V(a,b){this.a=(new B(navigator.userAgent)).parse();this.d=a;this.f=b}var ua={Arimo:!0,Cousine:!0,Tinos:!0};V.prototype.K=function(a,b){b(a.k.X)};V.prototype.load=function(a){var b=this.d;"MSIE"==this.a.getName()&&1!=this.f.blocking?ca(b,k(this.$,this,a)):this.$(a)};
26
- V.prototype.$=function(a){for(var b=this.d,c=new na(this.f.api,u(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.V.push(g.pop());var h="";2==g.length&&""!=g[1]&&(h=":");c.q.push(g.join(h))}d=new pa(d);d.parse();v(b,c.e());a(d.ca,d.L,ua)};function W(a,b){this.d=a;this.f=b;this.o=[]}W.prototype.H=function(a){var b=this.d;return u(this.d)+(this.f.api||"//f.fontdeck.com/s/css/js/")+(b.t.location.hostname||b.J.location.hostname)+"/"+a+".js"};
27
- W.prototype.K=function(a,b){var c=this.f.id,d=this.d.t,e=this;c?(d.__webfontfontdeckmodule__||(d.__webfontfontdeckmodule__={}),d.__webfontfontdeckmodule__[c]=function(a,c){for(var d=0,m=c.fonts.length;d<m;++d){var l=c.fonts[d];e.o.push(new H(l.name,ga("font-weight:"+l.weight+";font-style:"+l.style)))}b(a)},w(this.d,this.H(c),function(a){a&&b(!1)})):b(!1)};W.prototype.load=function(a){a(this.o)};function X(a,b){this.d=a;this.f=b;this.o=[]}X.prototype.H=function(a){var b=u(this.d);return(this.f.api||b+"//use.typekit.net")+"/"+a+".js"};X.prototype.K=function(a,b){var c=this.f.id,d=this.d.t,e=this;c?w(this.d,this.H(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],m=a[c+1],l=0;l<m.length;l++)e.o.push(new H(h,m[l]));try{d.Typekit.load({events:!1,classes:!1})}catch(p){}}b(!0)}},2E3):b(!1)};
28
- X.prototype.load=function(a){a(this.o)};function Y(a,b){this.d=a;this.f=b;this.o=[]}Y.prototype.K=function(a,b){var c=this,d=c.f.projectId,e=c.f.version;if(d){var f=c.d.t;w(this.d,c.H(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.o.push(new H(e[h].fontfamily));b(a.k.X)}}).id="__MonotypeAPIScript__"+d}else b(!1)};Y.prototype.H=function(a,b){var c=u(this.d),d=(this.f.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};
29
- Y.prototype.load=function(a){a(this.o)};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++)v(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(","),m=0;m<h.length;m+=1)d.push(new H(g[0],h[m]));else d.push(new H(g[0]))}a(d,f)};Z.prototype.K=function(a,b){return b(a.k.X)};var $=new U(this);$.v.w.custom=function(a,b){return new Z(b,a)};$.v.w.fontdeck=function(a,b){return new W(b,a)};$.v.w.monotype=function(a,b){return new Y(b,a)};$.v.w.typekit=function(a,b){return new X(b,a)};$.v.w.google=function(a,b){return new V(b,a)};this.WebFont||(this.WebFont={},this.WebFont.load=k($.load,$),this.WebFontConfig&&$.load(this.WebFontConfig));})(this,document);
24
+ pa.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,m=0;m<h;m++){var l;l=g[m];if(l.match(/^[\w-]+$/)){l=ta.exec(l.toLowerCase());var p=void 0;if(null==l)p="";else{p=void 0;p=l[1];if(null==p||""==p)p="4";else var fa=ra[p],p=fa?fa:isNaN(p)?"4":p.substr(0,1);l=l[2];p=[null==l||""==l?"n":sa[l],p].join("")}l=p}else l="";l&&f.push(l)}0<f.length&&(e=f);
25
+ 3==c.length&&(c=c[2],f=[],c=c?c.split(","):f,0<c.length&&(c=qa[c[0]])&&(this.M[d]=c))}this.M[d]||(c=qa[d])&&(this.M[d]=c);for(c=0;c<e.length;c+=1)this.da.push(new H(d,e[c]))}};function V(a,b){this.a=(new B(navigator.userAgent)).parse();this.d=a;this.f=b}var ua={Arimo:!0,Cousine:!0,Tinos:!0};V.prototype.L=function(a,b){b(a.m.Y)};V.prototype.load=function(a){var b=this.d;"MSIE"==this.a.getName()&&1!=this.f.blocking?ca(b,k(this.aa,this,a)):this.aa(a)};
26
+ V.prototype.aa=function(a){for(var b=this.d,c=new na(this.f.api,u(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.W.push(g.pop());var h="";2==g.length&&""!=g[1]&&(h=":");c.s.push(g.join(h))}d=new pa(d);d.parse();v(b,c.e());a(d.da,d.M,ua)};function W(a,b){this.d=a;this.f=b;this.p=[]}W.prototype.J=function(a){var b=this.d;return u(this.d)+(this.f.api||"//f.fontdeck.com/s/css/js/")+(b.w.location.hostname||b.K.location.hostname)+"/"+a+".js"};
27
+ 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,m=c.fonts.length;d<m;++d){var l=c.fonts[d];e.p.push(new H(l.name,ga("font-weight:"+l.weight+";font-style:"+l.style)))}b(a)},w(this.d,this.J(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.J=function(a){var b=u(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?w(this.d,this.J(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],m=a[c+1],l=0;l<m.length;l++)e.p.push(new H(h,m[l]));try{d.Typekit.load({events:!1,classes:!1})}catch(p){}}b(!0)}},2E3):b(!1)};
28
+ 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;w(this.d,c.J(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 H(e[h].fontfamily));b(a.m.Y)}}).id="__MonotypeAPIScript__"+d}else b(!1)};Y.prototype.J=function(a,b){var c=u(this.d),d=(this.f.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};
29
+ 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++)v(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(","),m=0;m<h.length;m+=1)d.push(new H(g[0],h[m]));else d.push(new H(g[0]))}a(d,f)};Z.prototype.L=function(a,b){return b(a.m.Y)};var $=new U(this);$.B.C.custom=function(a,b){return new Z(b,a)};$.B.C.fontdeck=function(a,b){return new W(b,a)};$.B.C.monotype=function(a,b){return new Y(b,a)};$.B.C.typekit=function(a,b){return new X(b,a)};$.B.C.google=function(a,b){return new V(b,a)};this.WebFont||(this.WebFont={},this.WebFont.load=k($.load,$),this.WebFontConfig&&$.load(this.WebFontConfig));})(this,document);
30
30
 
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.15
4
+ version: 1.5.16
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: 2015-03-25 00:00:00.000000000 Z
12
+ date: 2015-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake