Skip to content

Commit c41db05

Browse files
committed
Merge pull request #53 from gabceb/release-007
Update version to v0.0.7
2 parents 751896d + 7ed56e7 commit c41db05

File tree

4 files changed

+98
-41
lines changed

4 files changed

+98
-41
lines changed

dist/jquery.browser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*!
2-
* jQuery Browser Plugin v0.0.6
2+
* jQuery Browser Plugin 0.0.7
33
* https://github.com/gabceb/jquery-browser-plugin
44
*
55
* Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
66
* http://jquery.org/license
77
*
8-
* Modifications Copyright 2013 Gabriel Cebrian
8+
* Modifications Copyright 2014 Gabriel Cebrian
99
* https://github.com/gabceb
1010
*
1111
* Released under the MIT license
1212
*
13-
* Date: 2013-07-29T17:23:27-07:00
13+
* Date: 12-12-2014
1414
*/
1515

1616
(function (root, factory) {

dist/jquery.browser.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.browser",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"authors": [
55
"Gabriel Cebrian <gabceb@gmail.com>",
66
"jQuery Team <https://github.com/gabceb/jquery-browser-plugin/wiki/Authors>"

test/src/jquery.browser.js

Lines changed: 91 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,68 @@
11
/*!
2-
* jQuery Browser Plugin v0.0.6
2+
* jQuery Browser Plugin 0.0.7
33
* https://github.com/gabceb/jquery-browser-plugin
44
*
55
* Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
66
* http://jquery.org/license
77
*
8-
* Modifications Copyright 2013 Gabriel Cebrian
8+
* Modifications Copyright 2014 Gabriel Cebrian
99
* https://github.com/gabceb
1010
*
1111
* Released under the MIT license
1212
*
13-
* Date: 2013-07-29T17:23:27-07:00
13+
* Date: 12-12-2014
1414
*/
1515

16-
(function( jQuery, window, undefined ) {
16+
(function (root, factory) {
17+
if (typeof define === 'function' && define.amd) {
18+
// AMD. Register as an anonymous module.
19+
define(['jquery'], function ($) {
20+
factory($, root);
21+
});
22+
} else {
23+
// Browser globals
24+
factory(jQuery, root);
25+
}
26+
}(this, function(jQuery, window) {
1727
"use strict";
1828

1929
var matched, browser;
2030

2131
jQuery.uaMatch = function( ua ) {
2232
ua = ua.toLowerCase();
2333

24-
var match = /(opr)[\/]([\w.]+)/.exec( ua ) ||
25-
/(chrome)[ \/]([\w.]+)/.exec( ua ) ||
26-
/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
27-
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
28-
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
29-
/(msie) ([\w.]+)/.exec( ua ) ||
30-
ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
31-
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
32-
[];
34+
var match = /(edge)\/([\w.]+)/.exec( ua ) ||
35+
/(opr)[\/]([\w.]+)/.exec( ua ) ||
36+
/(chrome)[ \/]([\w.]+)/.exec( ua ) ||
37+
/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
38+
/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
39+
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
40+
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
41+
/(msie) ([\w.]+)/.exec( ua ) ||
42+
ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
43+
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
44+
[];
3345

3446
var platform_match = /(ipad)/.exec( ua ) ||
35-
/(iphone)/.exec( ua ) ||
36-
/(android)/.exec( ua ) ||
37-
/(windows phone)/.exec( ua ) ||
38-
/(win)/.exec( ua ) ||
39-
/(mac)/.exec( ua ) ||
40-
/(linux)/.exec( ua ) ||
41-
/(cros)/.exec( ua ) ||
42-
[];
47+
/(ipod)/.exec( ua ) ||
48+
/(iphone)/.exec( ua ) ||
49+
/(kindle)/.exec( ua ) ||
50+
/(silk)/.exec( ua ) ||
51+
/(android)/.exec( ua ) ||
52+
/(windows phone)/.exec( ua ) ||
53+
/(win)/.exec( ua ) ||
54+
/(mac)/.exec( ua ) ||
55+
/(linux)/.exec( ua ) ||
56+
/(cros)/.exec( ua ) ||
57+
/(playbook)/.exec( ua ) ||
58+
/(bb)/.exec( ua ) ||
59+
/(blackberry)/.exec( ua ) ||
60+
[];
4361

4462
return {
45-
browser: match[ 3 ] || match[ 1 ] || "",
46-
version: match[ 4 ] || match[ 2 ],
47-
versionNumber: match[ 2 ] || "0",
63+
browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
64+
version: match[ 2 ] || match[ 4 ] || "0",
65+
versionNumber: match[ 4 ] || match[ 2 ] || "0",
4866
platform: platform_match[ 0 ] || ""
4967
};
5068
};
@@ -55,15 +73,16 @@
5573
if ( matched.browser ) {
5674
browser[ matched.browser ] = true;
5775
browser.version = matched.version;
58-
browser.versionNumber = parseInt(matched.versionNumber);
76+
browser.versionNumber = parseInt(matched.versionNumber, 10);
5977
}
6078

6179
if ( matched.platform ) {
6280
browser[ matched.platform ] = true;
6381
}
6482

6583
// These are all considered mobile platforms, meaning they run a mobile browser
66-
if ( browser.android || browser.ipad || browser.iphone || browser[ "windows phone" ] ) {
84+
if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
85+
browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
6786
browser.mobile = true;
6887
}
6988

@@ -78,36 +97,74 @@
7897
}
7998

8099
// IE11 has a new token so we will assign it msie to avoid breaking changes
81-
if ( browser.rv )
82-
{
100+
// IE12 disguises itself as Chrome, but adds a new Edge token.
101+
if ( browser.rv || browser.edge ) {
83102
var ie = "msie";
84103

85104
matched.browser = ie;
86105
browser[ie] = true;
87106
}
88107

108+
// Blackberry browsers are marked as Safari on BlackBerry
109+
if ( browser.safari && browser.blackberry ) {
110+
var blackberry = "blackberry";
111+
112+
matched.browser = blackberry;
113+
browser[blackberry] = true;
114+
}
115+
116+
// Playbook browsers are marked as Safari on Playbook
117+
if ( browser.safari && browser.playbook ) {
118+
var playbook = "playbook";
119+
120+
matched.browser = playbook;
121+
browser[playbook] = true;
122+
}
123+
124+
// BB10 is a newer OS version of BlackBerry
125+
if ( browser.bb ) {
126+
var bb = "blackberry";
127+
128+
matched.browser = bb;
129+
browser[bb] = true;
130+
}
131+
89132
// Opera 15+ are identified as opr
90-
if ( browser.opr )
91-
{
133+
if ( browser.opr ) {
92134
var opera = "opera";
93135

94136
matched.browser = opera;
95137
browser[opera] = true;
96138
}
97139

98140
// Stock Android browsers are marked as Safari on Android.
99-
if ( browser.safari && browser.android )
100-
{
141+
if ( browser.safari && browser.android ) {
101142
var android = "android";
102143

103144
matched.browser = android;
104145
browser[android] = true;
105146
}
106147

148+
// Kindle browsers are marked as Safari on Kindle
149+
if ( browser.safari && browser.kindle ) {
150+
var kindle = "kindle";
151+
152+
matched.browser = kindle;
153+
browser[kindle] = true;
154+
}
155+
156+
// Kindle Silk browsers are marked as Safari on Kindle
157+
if ( browser.safari && browser.silk ) {
158+
var silk = "silk";
159+
160+
matched.browser = silk;
161+
browser[silk] = true;
162+
}
163+
107164
// Assign the name and platform variable
108165
browser.name = matched.browser;
109166
browser.platform = matched.platform;
110167

111-
112168
jQuery.browser = browser;
113-
})( jQuery, window );
169+
return browser;
170+
}));

0 commit comments

Comments
 (0)