webfontloader 1.5.13 → 1.5.14
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 +3 -0
- data/README.md +1 -1
- data/lib/webfontloader.rb +1 -1
- data/spec/core/eventdispatcher_spec.js +51 -36
- data/src/core/eventdispatcher.js +8 -11
- data/src/core/webfont.js +1 -5
- data/webfontloader.gemspec +2 -2
- data/webfontloader.js +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b78dbe2da7ee76be8180028a6e8bb1e8f947fc7
|
4
|
+
data.tar.gz: 646d9a10af417944a2ff25c896908ad844cf90e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62db432cdd91ef9c39b67bf0a861de6cb9112cb3bd8e0a471f64a0ba2255ee12b0fc6e371f4dc41dda8600ee2c2476b80d53236c9547ef34eab6d28324120dc9
|
7
|
+
data.tar.gz: 01fb5925737f019f3761343a6fac9f556144e0ad4f37e2901a843430ce7c9cc8027007cf15a86cf21e043e57586492b5a8e2d146441a8d5d0de5ffcd7dc51262
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -25,7 +25,7 @@ Web Font Loader gives you added control when using linked fonts via `@font-face`
|
|
25
25
|
To use the Web Font Loader library, just include it in your page and tell it which fonts to load. For example, you could load fonts from [Google Fonts](http://www.google.com/fonts/) using the Web Font Loader hosted on [Google Hosted Libraries](https://developers.google.com/speed/libraries/) using the following code.
|
26
26
|
|
27
27
|
```html
|
28
|
-
<script src="//ajax.googleapis.com/ajax/libs/webfont/1.5.
|
28
|
+
<script src="//ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js"></script>
|
29
29
|
<script>
|
30
30
|
WebFont.load({
|
31
31
|
google: {
|
data/lib/webfontloader.rb
CHANGED
@@ -5,21 +5,24 @@ describe('EventDispatcher', function () {
|
|
5
5
|
domHelper = new DomHelper(window),
|
6
6
|
element = null
|
7
7
|
eventDispatcher = null,
|
8
|
-
namespace = 'ns',
|
9
8
|
font = null;
|
10
9
|
|
11
10
|
beforeEach(function () {
|
12
|
-
element = domHelper.
|
13
|
-
|
11
|
+
element = domHelper.getLoadWindow().document.documentElement;
|
12
|
+
config = {
|
14
13
|
loading: jasmine.createSpy('loading'),
|
15
14
|
active: jasmine.createSpy('active'),
|
16
15
|
inactive: jasmine.createSpy('inactive'),
|
17
16
|
fontloading: jasmine.createSpy('fontloading'),
|
18
17
|
fontactive: jasmine.createSpy('fontactive'),
|
19
|
-
fontinactive: jasmine.createSpy('fontinactive')
|
18
|
+
fontinactive: jasmine.createSpy('fontinactive'),
|
19
|
+
classes: true,
|
20
|
+
events: true
|
20
21
|
};
|
21
22
|
|
22
|
-
|
23
|
+
element.className = '';
|
24
|
+
|
25
|
+
eventDispatcher = new EventDispatcher(domHelper, config);
|
23
26
|
|
24
27
|
font = new Font('My Family', 'n4');
|
25
28
|
});
|
@@ -30,11 +33,11 @@ describe('EventDispatcher', function () {
|
|
30
33
|
});
|
31
34
|
|
32
35
|
it('should call the correct callback', function () {
|
33
|
-
expect(
|
36
|
+
expect(config.loading).toHaveBeenCalled();
|
34
37
|
});
|
35
38
|
|
36
39
|
it('should set the correct class name', function () {
|
37
|
-
expect(element.className).toEqual('
|
40
|
+
expect(element.className).toEqual('wf-loading');
|
38
41
|
});
|
39
42
|
});
|
40
43
|
|
@@ -44,11 +47,11 @@ describe('EventDispatcher', function () {
|
|
44
47
|
});
|
45
48
|
|
46
49
|
it('should call the correct callback', function () {
|
47
|
-
expect(
|
50
|
+
expect(config.fontloading).toHaveBeenCalledWith('My Family', 'n4');
|
48
51
|
});
|
49
52
|
|
50
53
|
it('should set the correct class name', function () {
|
51
|
-
expect(element.className).toEqual('
|
54
|
+
expect(element.className).toEqual('wf-myfamily-n4-loading');
|
52
55
|
});
|
53
56
|
});
|
54
57
|
|
@@ -58,11 +61,11 @@ describe('EventDispatcher', function () {
|
|
58
61
|
});
|
59
62
|
|
60
63
|
it('should call the correct callback', function () {
|
61
|
-
expect(
|
64
|
+
expect(config.fontinactive).toHaveBeenCalledWith('My Family', 'n4');
|
62
65
|
});
|
63
66
|
|
64
67
|
it('should set the correct class name', function () {
|
65
|
-
expect(element.className).toEqual('
|
68
|
+
expect(element.className).toEqual('wf-myfamily-n4-inactive');
|
66
69
|
});
|
67
70
|
});
|
68
71
|
|
@@ -73,7 +76,7 @@ describe('EventDispatcher', function () {
|
|
73
76
|
});
|
74
77
|
|
75
78
|
it('should set the correct class name', function () {
|
76
|
-
expect(element.className).toEqual('
|
79
|
+
expect(element.className).toEqual('wf-myfamily-n4-inactive');
|
77
80
|
});
|
78
81
|
});
|
79
82
|
|
@@ -84,11 +87,11 @@ describe('EventDispatcher', function () {
|
|
84
87
|
});
|
85
88
|
|
86
89
|
it('should not append the inactive class name', function () {
|
87
|
-
expect(element.className).toEqual('
|
90
|
+
expect(element.className).toEqual('wf-myfamily-n4-active');
|
88
91
|
});
|
89
92
|
|
90
93
|
it('should still call the correct callback', function () {
|
91
|
-
expect(
|
94
|
+
expect(config.fontinactive).toHaveBeenCalledWith('My Family', 'n4');
|
92
95
|
});
|
93
96
|
});
|
94
97
|
|
@@ -98,11 +101,11 @@ describe('EventDispatcher', function () {
|
|
98
101
|
});
|
99
102
|
|
100
103
|
it('should call the correct callback', function () {
|
101
|
-
expect(
|
104
|
+
expect(config.fontactive).toHaveBeenCalledWith('My Family', 'n4');
|
102
105
|
});
|
103
106
|
|
104
107
|
it('should set the correct class name', function () {
|
105
|
-
expect(element.className).toEqual('
|
108
|
+
expect(element.className).toEqual('wf-myfamily-n4-active');
|
106
109
|
});
|
107
110
|
});
|
108
111
|
|
@@ -113,7 +116,7 @@ describe('EventDispatcher', function () {
|
|
113
116
|
});
|
114
117
|
|
115
118
|
it('should set the correct class name', function () {
|
116
|
-
expect(element.className).toEqual('
|
119
|
+
expect(element.className).toEqual('wf-myfamily-n4-active');
|
117
120
|
});
|
118
121
|
});
|
119
122
|
|
@@ -124,7 +127,7 @@ describe('EventDispatcher', function () {
|
|
124
127
|
});
|
125
128
|
|
126
129
|
it('should set the correct class', function () {
|
127
|
-
expect(element.className).toEqual('
|
130
|
+
expect(element.className).toEqual('wf-myfamily-n4-active');
|
128
131
|
});
|
129
132
|
});
|
130
133
|
|
@@ -134,11 +137,11 @@ describe('EventDispatcher', function () {
|
|
134
137
|
});
|
135
138
|
|
136
139
|
it('should call the correct callback', function () {
|
137
|
-
expect(
|
140
|
+
expect(config.inactive).toHaveBeenCalled();
|
138
141
|
});
|
139
142
|
|
140
143
|
it('should set the correct class name', function () {
|
141
|
-
expect(element.className).toEqual('
|
144
|
+
expect(element.className).toEqual('wf-inactive');
|
142
145
|
});
|
143
146
|
});
|
144
147
|
|
@@ -149,7 +152,7 @@ describe('EventDispatcher', function () {
|
|
149
152
|
});
|
150
153
|
|
151
154
|
it('should set the correct class name', function () {
|
152
|
-
expect(element.className).toEqual('
|
155
|
+
expect(element.className).toEqual('wf-inactive');
|
153
156
|
});
|
154
157
|
});
|
155
158
|
|
@@ -160,11 +163,11 @@ describe('EventDispatcher', function () {
|
|
160
163
|
});
|
161
164
|
|
162
165
|
it('should not set the the inactive class', function () {
|
163
|
-
expect(element.className).toEqual('
|
166
|
+
expect(element.className).toEqual('wf-active');
|
164
167
|
});
|
165
168
|
|
166
169
|
it('should still call the inactive callback', function () {
|
167
|
-
expect(
|
170
|
+
expect(config.inactive).toHaveBeenCalled();
|
168
171
|
});
|
169
172
|
});
|
170
173
|
|
@@ -174,11 +177,11 @@ describe('EventDispatcher', function () {
|
|
174
177
|
});
|
175
178
|
|
176
179
|
it('should call the correct callback', function () {
|
177
|
-
expect(
|
180
|
+
expect(config.active).toHaveBeenCalled();
|
178
181
|
});
|
179
182
|
|
180
183
|
it('should set the correct class name', function () {
|
181
|
-
expect(element.className).toEqual('
|
184
|
+
expect(element.className).toEqual('wf-active');
|
182
185
|
});
|
183
186
|
});
|
184
187
|
|
@@ -189,7 +192,7 @@ describe('EventDispatcher', function () {
|
|
189
192
|
});
|
190
193
|
|
191
194
|
it('should set the correct class name', function () {
|
192
|
-
expect(element.className).toEqual('
|
195
|
+
expect(element.className).toEqual('wf-active');
|
193
196
|
});
|
194
197
|
});
|
195
198
|
|
@@ -200,13 +203,15 @@ describe('EventDispatcher', function () {
|
|
200
203
|
});
|
201
204
|
|
202
205
|
it('should set the correct class name', function () {
|
203
|
-
expect(element.className).toEqual('
|
206
|
+
expect(element.className).toEqual('wf-active');
|
204
207
|
});
|
205
208
|
});
|
206
209
|
|
207
|
-
describe('disable
|
210
|
+
describe('disable classes and events', function () {
|
208
211
|
beforeEach(function () {
|
209
|
-
|
212
|
+
config.classes = false;
|
213
|
+
config.events = false;
|
214
|
+
eventDispatcher = new EventDispatcher(domHelper, config);
|
210
215
|
eventDispatcher.dispatchInactive();
|
211
216
|
eventDispatcher.dispatchActive();
|
212
217
|
eventDispatcher.dispatchLoading();
|
@@ -215,19 +220,25 @@ describe('EventDispatcher', function () {
|
|
215
220
|
eventDispatcher.dispatchFontLoading(font);
|
216
221
|
});
|
217
222
|
|
223
|
+
afterEach(function () {
|
224
|
+
config.classes = true;
|
225
|
+
config.events = true;
|
226
|
+
});
|
227
|
+
|
218
228
|
it('should not fire any events', function () {
|
219
|
-
expect(
|
220
|
-
expect(
|
221
|
-
expect(
|
222
|
-
expect(
|
223
|
-
expect(
|
224
|
-
expect(
|
229
|
+
expect(config.inactive).not.toHaveBeenCalled();
|
230
|
+
expect(config.active).not.toHaveBeenCalled();
|
231
|
+
expect(config.loading).not.toHaveBeenCalled();
|
232
|
+
expect(config.fontinactive).not.toHaveBeenCalled();
|
233
|
+
expect(config.fontactive).not.toHaveBeenCalled();
|
234
|
+
expect(config.fontloading).not.toHaveBeenCalled();
|
225
235
|
});
|
226
236
|
});
|
227
237
|
|
228
238
|
describe('disable classes', function () {
|
229
239
|
beforeEach(function () {
|
230
|
-
|
240
|
+
config.classes = false;
|
241
|
+
eventDispatcher = new EventDispatcher(domHelper, config);
|
231
242
|
eventDispatcher.dispatchInactive();
|
232
243
|
eventDispatcher.dispatchActive();
|
233
244
|
eventDispatcher.dispatchLoading();
|
@@ -236,6 +247,10 @@ describe('EventDispatcher', function () {
|
|
236
247
|
eventDispatcher.dispatchFontLoading(font);
|
237
248
|
});
|
238
249
|
|
250
|
+
afterEach(function () {
|
251
|
+
config.classes = true;
|
252
|
+
});
|
253
|
+
|
239
254
|
it('should not fire any events', function () {
|
240
255
|
expect(element.className).toEqual('');
|
241
256
|
});
|
data/src/core/eventdispatcher.js
CHANGED
@@ -8,22 +8,19 @@ goog.require('webfont.CssClassName');
|
|
8
8
|
* names always overwrite inactive class names of the same type, while loading
|
9
9
|
* class names may be present whenever a font is loading (regardless of if an
|
10
10
|
* associated active or inactive class name is also present).
|
11
|
+
*
|
11
12
|
* @param {webfont.DomHelper} domHelper
|
12
|
-
* @param {
|
13
|
-
* @param {Object} callbacks
|
14
|
-
* @param {string=} opt_namespace
|
15
|
-
* @param {boolean=} opt_dispatchEvents Set to false to not call any callbacks. Defaults to true.
|
16
|
-
* @param {boolean=} opt_setClasses Set to false to not set classes on the HTML element. Defaults to true.
|
13
|
+
* @param {Object} config
|
17
14
|
* @constructor
|
18
15
|
*/
|
19
|
-
webfont.EventDispatcher = function(domHelper,
|
16
|
+
webfont.EventDispatcher = function(domHelper, config) {
|
20
17
|
this.domHelper_ = domHelper;
|
21
|
-
this.htmlElement_ =
|
22
|
-
this.callbacks_ =
|
23
|
-
this.namespace_ =
|
18
|
+
this.htmlElement_ = domHelper.getLoadWindow().document.documentElement;
|
19
|
+
this.callbacks_ = config;
|
20
|
+
this.namespace_ = webfont.EventDispatcher.DEFAULT_NAMESPACE;
|
24
21
|
this.cssClassName_ = new webfont.CssClassName('-');
|
25
|
-
this.dispatchEvents_ =
|
26
|
-
this.setClasses_ =
|
22
|
+
this.dispatchEvents_ = config['events'] !== false;
|
23
|
+
this.setClasses_ = config['classes'] !== false;
|
27
24
|
};
|
28
25
|
|
29
26
|
/**
|
data/src/core/webfont.js
CHANGED
@@ -48,11 +48,7 @@ goog.scope(function () {
|
|
48
48
|
|
49
49
|
var eventDispatcher = new EventDispatcher(
|
50
50
|
this.domHelper_,
|
51
|
-
|
52
|
-
configuration,
|
53
|
-
undefined,
|
54
|
-
this.events_,
|
55
|
-
this.classes_
|
51
|
+
configuration
|
56
52
|
);
|
57
53
|
|
58
54
|
this.load_(eventDispatcher, configuration);
|
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 = '2015-01-
|
16
|
+
s.version = '1.5.14'
|
17
|
+
s.date = '2015-01-23'
|
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,9 +1,9 @@
|
|
1
|
-
/* Web Font Loader v1.5.
|
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.
|
1
|
+
/* Web Font Loader v1.5.14 - (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()}
|
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.
|
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
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.
|
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));
|
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
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};
|
@@ -11,20 +11,20 @@ function C(a){var b=E(a.a,/(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|Black
|
|
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.
|
15
|
-
function N(a){var b;b=[];for(var c=a.
|
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:-999px;left:-999px;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
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
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.
|
19
|
-
T.prototype.ha=function(a){var b=this.
|
20
|
-
T.prototype.ia=function(a){var b=this.
|
21
|
-
U.prototype.load=function(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.
|
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={}}
|
23
23
|
var qa={latin:"BESbswy",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},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
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.
|
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.
|
27
|
-
W.prototype.K=function(a,b){var c=this.f.id,d=this.d.
|
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.
|
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);$.
|
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);
|
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.
|
4
|
+
version: 1.5.14
|
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-01-
|
12
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|