webfontloader 1.0.13 → 1.0.15
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.
- data/CHANGELOG +5 -1
- data/lib/webfontloader.rb +1 -1
- data/src-test/core/useragenttest.js +16 -0
- data/src/core/fontwatcher.js +3 -1
- data/src/core/useragentparser.js +1 -1
- data/src/google/googlefontapi.js +14 -12
- data/webfontloader.gemspec +2 -2
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
v1.0.15 (October 14, 2010)
|
2
|
+
* Fix an error parsing platform version in IE, when it has no items following the platform in the UA string.
|
3
|
+
|
4
|
+
v1.0.14 (October 14, 2010)
|
5
|
+
* Bugfix: fixed IE issue in google module.
|
2
6
|
|
3
7
|
v1.0.13 (September 30, 2010)
|
4
8
|
* Added support for detecting Adobe Air.
|
data/lib/webfontloader.rb
CHANGED
@@ -116,6 +116,22 @@ UserAgentTest.prototype.testBrowserIsIE = function() {
|
|
116
116
|
assertTrue(userAgent.isSupportingWebFont());
|
117
117
|
};
|
118
118
|
|
119
|
+
UserAgentTest.prototype.testBrowserIsIEMinimal = function() {
|
120
|
+
var userAgentParser = new webfont.UserAgentParser(
|
121
|
+
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)",
|
122
|
+
this.defaultDocument_);
|
123
|
+
var userAgent = userAgentParser.parse();
|
124
|
+
|
125
|
+
assertEquals("MSIE", userAgent.getName());
|
126
|
+
assertEquals("7.0", userAgent.getVersion());
|
127
|
+
assertEquals("Windows", userAgent.getPlatform());
|
128
|
+
assertEquals("5.1", userAgent.getPlatformVersion());
|
129
|
+
assertEquals("MSIE", userAgent.getEngine());
|
130
|
+
assertEquals("7.0", userAgent.getEngineVersion());
|
131
|
+
assertEquals(undefined, userAgent.getDocumentMode());
|
132
|
+
assertTrue(userAgent.isSupportingWebFont());
|
133
|
+
};
|
134
|
+
|
119
135
|
UserAgentTest.prototype.testBrowserIsIPhone = function() {
|
120
136
|
var userAgentParser = new webfont.UserAgentParser(
|
121
137
|
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16",
|
data/src/core/fontwatcher.js
CHANGED
@@ -31,7 +31,9 @@ webfont.FontWatcher.DEFAULT_VARIATION = 'n4';
|
|
31
31
|
* Watches a set of font families.
|
32
32
|
* @param {Array.<string>} fontFamilies The font family names to watch.
|
33
33
|
* @param {Object.<string, Array.<string>>} fontDescriptions The font variations
|
34
|
-
*
|
34
|
+
* of each family to watch. Described with FVD.
|
35
|
+
* @param {Object.<string, string>} fontTestStrings The font test strings for
|
36
|
+
* each family.
|
35
37
|
* @param {boolean} last True if this is the last set of families to watch.
|
36
38
|
*/
|
37
39
|
webfont.FontWatcher.prototype.watch = function(fontFamilies, fontDescriptions,
|
data/src/core/useragentparser.js
CHANGED
@@ -72,7 +72,7 @@ webfont.UserAgentParser.prototype.getPlatform_ = function() {
|
|
72
72
|
*/
|
73
73
|
webfont.UserAgentParser.prototype.getPlatformVersion_ = function() {
|
74
74
|
var macVersion = this.getMatchingGroup_(this.userAgent_,
|
75
|
-
/(OS X|Windows NT|Android) ([^;]+)/, 2);
|
75
|
+
/(OS X|Windows NT|Android) ([^;)]+)/, 2);
|
76
76
|
if (macVersion) {
|
77
77
|
return macVersion;
|
78
78
|
}
|
data/src/google/googlefontapi.js
CHANGED
@@ -17,27 +17,29 @@ webfont.GoogleFontApi.prototype.supportUserAgent = function(userAgent, support)
|
|
17
17
|
};
|
18
18
|
|
19
19
|
webfont.GoogleFontApi.prototype.load = function(onReady) {
|
20
|
-
var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(
|
21
|
-
this.configuration_['api']);
|
22
|
-
var fontFamilies = this.configuration_['families'];
|
23
20
|
var domHelper = this.domHelper_;
|
24
21
|
var nonBlockingIe = this.userAgent_.getName() == 'MSIE' &&
|
25
22
|
this.configuration_['blocking'] != true;
|
26
23
|
|
27
|
-
fontApiUrlBuilder.setFontFamilies(fontFamilies);
|
28
|
-
|
29
24
|
if (nonBlockingIe) {
|
30
|
-
domHelper.whenBodyExists(
|
31
|
-
domHelper.insertInto('head', domHelper.createCssLink(
|
32
|
-
fontApiUrlBuilder.build()));
|
33
|
-
});
|
25
|
+
domHelper.whenBodyExists(webfont.bind(this, this.insertLink_, onReady));
|
34
26
|
} else {
|
35
|
-
|
36
|
-
fontApiUrlBuilder.build()));
|
27
|
+
this.insertLink_(onReady);
|
37
28
|
}
|
38
|
-
|
29
|
+
};
|
39
30
|
|
31
|
+
webfont.GoogleFontApi.prototype.insertLink_ = function(onReady) {
|
32
|
+
var domHelper = this.domHelper_;
|
33
|
+
var fontApiUrlBuilder = new webfont.FontApiUrlBuilder(
|
34
|
+
this.configuration_['api']);
|
35
|
+
var fontFamilies = this.configuration_['families'];
|
36
|
+
fontApiUrlBuilder.setFontFamilies(fontFamilies);
|
37
|
+
|
38
|
+
var fontApiParser = new webfont.FontApiParser(fontFamilies);
|
40
39
|
fontApiParser.parse();
|
40
|
+
|
41
|
+
domHelper.insertInto('head', domHelper.createCssLink(
|
42
|
+
fontApiUrlBuilder.build()));
|
41
43
|
onReady(fontApiParser.getFontFamilies(), fontApiParser.getVariations(),
|
42
44
|
fontApiParser.getFontTestStrings());
|
43
45
|
};
|
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.0.
|
17
|
-
s.date = '2010-
|
16
|
+
s.version = '1.0.15'
|
17
|
+
s.date = '2010-10-20'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
20
20
|
## as you like.
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 15
|
9
|
+
version: 1.0.15
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ryan Carver
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-20 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|