From 2daa751d9cbfd18f0a984b7d77767a302d5e6ed5 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Fri, 16 Jan 2015 22:11:48 -0500
Subject: [PATCH 01/18] Convert `jQuery.uaMatch()` to traditional function
I've chosen `jQBrowser()` as this is the jQuery.browser plugin,
and
because I cannot think of an uncommon but descriptive name for it,
for I do not want to pollute the common namespace.
---
dist/jquery.browser.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index cb3db86..b6fb765 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -32,7 +32,7 @@
var matched, browser;
- jQuery.uaMatch = function( ua ) {
+ window.jQBrowser = function( ua ) {
ua = ua.toLowerCase();
var match = /(edge)\/([\w.]+)/.exec( ua ) ||
@@ -71,7 +71,7 @@
};
};
- matched = jQuery.uaMatch( window.navigator.userAgent );
+ matched = jQBrowser( window.navigator.userAgent );
browser = {};
if ( matched.browser ) {
From 9d1323bf7c464536e2ad21bd606bc5b7479b7cd8 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Fri, 16 Jan 2015 22:19:16 -0500
Subject: [PATCH 02/18] If an UA is not provided, default to browser UA.
By optionally going jQuery free, this allows a new use-case: detecting a
browser from an arbitrary UA. However, because the majority of cases
will involve detecting the current browser, default to the UA if the
function is called without passing parameters. When using jQuery, the UA
is always provided.
---
dist/jquery.browser.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index b6fb765..38a4ec3 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -33,6 +33,10 @@
var matched, browser;
window.jQBrowser = function( ua ) {
+ // If an UA is not provided, default to the current browser UA.
+ if ( ua === undefined ) {
+ ua = window.navigator.userAgent;
+ }
ua = ua.toLowerCase();
var match = /(edge)\/([\w.]+)/.exec( ua ) ||
From 17658dfc91236f4d30232f365d456954b48f2d6b Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Fri, 16 Jan 2015 22:41:44 -0500
Subject: [PATCH 03/18] Allow calling of jQBrowser if jQuery is not defined
This required a tad bit of restructuring, mainly making the browser
matching a part of the function and not outside of it. This also
prevents the code from running twice if jQuery is loaded and the
function is called.
It may be that we want the function to be called on page load
regardless. In that case, the changes required are trivial.
---
dist/jquery.browser.js | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 38a4ec3..b565f2c 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -17,7 +17,7 @@
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
- define(['jquery'], function ($) {
+ define(['jquery'], function($) {
factory($);
});
} else if (typeof module === 'object' && typeof module.exports === 'object') {
@@ -25,7 +25,7 @@
module.exports = factory(require('jquery'));
} else {
// Browser globals
- factory(jQuery);
+ factory(window.jQuery);
}
}(function(jQuery) {
"use strict";
@@ -67,16 +67,13 @@
/(blackberry)/.exec( ua ) ||
[];
- return {
- browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
- version: match[ 2 ] || match[ 4 ] || "0",
- versionNumber: match[ 4 ] || match[ 2 ] || "0",
- platform: platform_match[ 0 ] || ""
- };
- };
-
- matched = jQBrowser( window.navigator.userAgent );
- browser = {};
+ var browser = {},
+ matched = {
+ browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
+ version: match[ 2 ] || match[ 4 ] || "0",
+ versionNumber: match[ 4 ] || match[ 2 ] || "0",
+ platform: platform_match[ 0 ] || ""
+ };
if ( matched.browser ) {
browser[ matched.browser ] = true;
@@ -172,7 +169,13 @@
// Assign the name and platform variable
browser.name = matched.browser;
browser.platform = matched.platform;
-
- jQuery.browser = browser;
return browser;
+
+ };
+
+ // Only assign to jQuery.browser if jQuery is loaded
+ if ( jQuery ) {
+ var browser = jQBrowser( window.navigator.userAgent );
+ jQuery.browser = browser;
+ }
}));
From 85deb50dc817eff38c224ed5db3e6b85b2dfc606 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Sat, 17 Jan 2015 12:05:45 -0500
Subject: [PATCH 04/18] Fix JSHint and indentation errors
---
dist/jquery.browser.js | 153 ++++++++++++++++++++---------------------
1 file changed, 75 insertions(+), 78 deletions(-)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index b565f2c..3040936 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -12,7 +12,7 @@
*
* Date: 12-12-2014
*/
-/*global window: false */
+/*global window: false, jQBrowser */
(function (factory) {
if (typeof define === 'function' && define.amd) {
@@ -30,8 +30,6 @@
}(function(jQuery) {
"use strict";
- var matched, browser;
-
window.jQBrowser = function( ua ) {
// If an UA is not provided, default to the current browser UA.
if ( ua === undefined ) {
@@ -75,102 +73,101 @@
platform: platform_match[ 0 ] || ""
};
- if ( matched.browser ) {
- browser[ matched.browser ] = true;
- browser.version = matched.version;
- browser.versionNumber = parseInt(matched.versionNumber, 10);
- }
-
- if ( matched.platform ) {
- browser[ matched.platform ] = true;
- }
+ if ( matched.browser ) {
+ browser[ matched.browser ] = true;
+ browser.version = matched.version;
+ browser.versionNumber = parseInt(matched.versionNumber, 10);
+ }
- // These are all considered mobile platforms, meaning they run a mobile browser
- if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
- browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
- browser.mobile = true;
- }
+ if ( matched.platform ) {
+ browser[ matched.platform ] = true;
+ }
- // These are all considered desktop platforms, meaning they run a desktop browser
- if ( browser.cros || browser.mac || browser.linux || browser.win ) {
- browser.desktop = true;
- }
+ // These are all considered mobile platforms, meaning they run a mobile browser
+ if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
+ browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
+ browser.mobile = true;
+ }
- // Chrome, Opera 15+ and Safari are webkit based browsers
- if ( browser.chrome || browser.opr || browser.safari ) {
- browser.webkit = true;
- }
+ // These are all considered desktop platforms, meaning they run a desktop browser
+ if ( browser.cros || browser.mac || browser.linux || browser.win ) {
+ browser.desktop = true;
+ }
- // IE11 has a new token so we will assign it msie to avoid breaking changes
- // IE12 disguises itself as Chrome, but adds a new Edge token.
- if ( browser.rv || browser.edge ) {
- var ie = "msie";
+ // Chrome, Opera 15+ and Safari are webkit based browsers
+ if ( browser.chrome || browser.opr || browser.safari ) {
+ browser.webkit = true;
+ }
- matched.browser = ie;
- browser[ie] = true;
- }
+ // IE11 has a new token so we will assign it msie to avoid breaking changes
+ // IE12 disguises itself as Chrome, but adds a new Edge token.
+ if ( browser.rv || browser.edge ) {
+ var ie = "msie";
- // Blackberry browsers are marked as Safari on BlackBerry
- if ( browser.safari && browser.blackberry ) {
- var blackberry = "blackberry";
+ matched.browser = ie;
+ browser[ie] = true;
+ }
- matched.browser = blackberry;
- browser[blackberry] = true;
- }
+ // Blackberry browsers are marked as Safari on BlackBerry
+ if ( browser.safari && browser.blackberry ) {
+ var blackberry = "blackberry";
- // Playbook browsers are marked as Safari on Playbook
- if ( browser.safari && browser.playbook ) {
- var playbook = "playbook";
+ matched.browser = blackberry;
+ browser[blackberry] = true;
+ }
- matched.browser = playbook;
- browser[playbook] = true;
- }
+ // Playbook browsers are marked as Safari on Playbook
+ if ( browser.safari && browser.playbook ) {
+ var playbook = "playbook";
- // BB10 is a newer OS version of BlackBerry
- if ( browser.bb ) {
- var bb = "blackberry";
+ matched.browser = playbook;
+ browser[playbook] = true;
+ }
- matched.browser = bb;
- browser[bb] = true;
- }
+ // BB10 is a newer OS version of BlackBerry
+ if ( browser.bb ) {
+ var bb = "blackberry";
- // Opera 15+ are identified as opr
- if ( browser.opr ) {
- var opera = "opera";
+ matched.browser = bb;
+ browser[bb] = true;
+ }
- matched.browser = opera;
- browser[opera] = true;
- }
+ // Opera 15+ are identified as opr
+ if ( browser.opr ) {
+ var opera = "opera";
- // Stock Android browsers are marked as Safari on Android.
- if ( browser.safari && browser.android ) {
- var android = "android";
+ matched.browser = opera;
+ browser[opera] = true;
+ }
- matched.browser = android;
- browser[android] = true;
- }
+ // Stock Android browsers are marked as Safari on Android.
+ if ( browser.safari && browser.android ) {
+ var android = "android";
- // Kindle browsers are marked as Safari on Kindle
- if ( browser.safari && browser.kindle ) {
- var kindle = "kindle";
+ matched.browser = android;
+ browser[android] = true;
+ }
- matched.browser = kindle;
- browser[kindle] = true;
- }
+ // Kindle browsers are marked as Safari on Kindle
+ if ( browser.safari && browser.kindle ) {
+ var kindle = "kindle";
- // Kindle Silk browsers are marked as Safari on Kindle
- if ( browser.safari && browser.silk ) {
- var silk = "silk";
+ matched.browser = kindle;
+ browser[kindle] = true;
+ }
- matched.browser = silk;
- browser[silk] = true;
- }
+ // Kindle Silk browsers are marked as Safari on Kindle
+ if ( browser.safari && browser.silk ) {
+ var silk = "silk";
- // Assign the name and platform variable
- browser.name = matched.browser;
- browser.platform = matched.platform;
- return browser;
+ matched.browser = silk;
+ browser[silk] = true;
+ }
+ // Assign the name and platform variable
+ browser.name = matched.browser;
+ browser.platform = matched.platform;
+ return browser;
};
// Only assign to jQuery.browser if jQuery is loaded
From fa811c883101f974f32affc0914c7c66b70e1ce3 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Tue, 20 Jan 2015 21:03:17 -0500
Subject: [PATCH 05/18] Auto-run function on page load,
add the `uaMatch` function to the returned object for use if desired
---
Gruntfile.js | 2 +-
dist/jquery.browser.js | 14 +++++++++-----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index d3406d8..95dc931 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -29,7 +29,7 @@ module.exports = function(grunt) {
}
},
copy: {
- main:{
+ main: {
src: "dist/<%= pkg.name %>.js",
dest: "test/src/<%= pkg.name %>.js"
}
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 3040936..078dbd0 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -12,7 +12,7 @@
*
* Date: 12-12-2014
*/
-/*global window: false, jQBrowser */
+/*global window: false */
(function (factory) {
if (typeof define === 'function' && define.amd) {
@@ -30,7 +30,7 @@
}(function(jQuery) {
"use strict";
- window.jQBrowser = function( ua ) {
+ function uaMatch( ua ) {
// If an UA is not provided, default to the current browser UA.
if ( ua === undefined ) {
ua = window.navigator.userAgent;
@@ -168,11 +168,15 @@
browser.name = matched.browser;
browser.platform = matched.platform;
return browser;
- };
+ }
+
+ // Run the matching process, also assign the function to the returned object
+ // for manual, jQuery-free use if desired
+ window.jQBrowser = uaMatch( window.navigator.userAgent );
+ window.jQBrowser.uaMatch = uaMatch;
// Only assign to jQuery.browser if jQuery is loaded
if ( jQuery ) {
- var browser = jQBrowser( window.navigator.userAgent );
- jQuery.browser = browser;
+ jQuery.browser = window.jQBrowser;
}
}));
From 63b620e30a384c624690e48334a2a745266e946c Mon Sep 17 00:00:00 2001
From: Gabriel Cebrian
Date: Tue, 20 Jan 2015 18:45:56 -0800
Subject: [PATCH 06/18] Always return browser to be able to require the module
Added 'require' to the require test so you can differentiate with other tests
---
dist/jquery.browser.js | 2 ++
dist/jquery.browser.min.js | 6 +++---
test/src/require/test.js | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 078dbd0..9bd4648 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -179,4 +179,6 @@
if ( jQuery ) {
jQuery.browser = window.jQBrowser;
}
+
+ return window.jQBrowser;
}));
diff --git a/dist/jquery.browser.min.js b/dist/jquery.browser.min.js
index adbfd0a..55f8cf5 100644
--- a/dist/jquery.browser.min.js
+++ b/dist/jquery.browser.min.js
@@ -5,10 +5,10 @@
* Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* http://jquery.org/license
*
- * Modifications Copyright 2014 Gabriel Cebrian
+ * Modifications Copyright 2015 Gabriel Cebrian
* https://github.com/gabceb
*
* Released under the MIT license
*
- * Date: 25-12-2014
- */!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";var b,c;if(a.uaMatch=function(a){a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[];return{browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""}},b=a.uaMatch(window.navigator.userAgent),c={},b.browser&&(c[b.browser]=!0,c.version=b.version,c.versionNumber=parseInt(b.versionNumber,10)),b.platform&&(c[b.platform]=!0),(c.android||c.bb||c.blackberry||c.ipad||c.iphone||c.ipod||c.kindle||c.playbook||c.silk||c["windows phone"])&&(c.mobile=!0),(c.cros||c.mac||c.linux||c.win)&&(c.desktop=!0),(c.chrome||c.opr||c.safari)&&(c.webkit=!0),c.rv||c.edge){var d="msie";b.browser=d,c[d]=!0}if(c.safari&&c.blackberry){var e="blackberry";b.browser=e,c[e]=!0}if(c.safari&&c.playbook){var f="playbook";b.browser=f,c[f]=!0}if(c.bb){var g="blackberry";b.browser=g,c[g]=!0}if(c.opr){var h="opera";b.browser=h,c[h]=!0}if(c.safari&&c.android){var i="android";b.browser=i,c[i]=!0}if(c.safari&&c.kindle){var j="kindle";b.browser=j,c[j]=!0}if(c.safari&&c.silk){var k="silk";b.browser=k,c[k]=!0}return c.name=b.browser,c.platform=b.platform,a.browser=c,c});
\ No newline at end of file
+ * Date: 20-01-2015
+ */!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
\ No newline at end of file
diff --git a/test/src/require/test.js b/test/src/require/test.js
index 4fde14b..596b114 100644
--- a/test/src/require/test.js
+++ b/test/src/require/test.js
@@ -9,7 +9,7 @@ var browser = require('../jquery.browser.js');
var should = require('chai').should();
-describe('jQuery browser', function() {
+describe('require jQuery browser', function() {
it('should have the correct properties for a Chrome browser on a Mac', function(done) {
browser.webkit.should.be.ok;
browser.mac.should.be.ok;
From 5c17c77d276fd7dcb36a551d5909aa14959f8cad Mon Sep 17 00:00:00 2001
From: Gabriel Cebrian
Date: Tue, 20 Jan 2015 18:53:33 -0800
Subject: [PATCH 07/18] Added tests for new jQuery-less function and manual UA
matching
---
test/test.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/test/test.js b/test/test.js
index 43b4232..122923b 100644
--- a/test/test.js
+++ b/test/test.js
@@ -827,3 +827,51 @@ casper.test.begin("when using BlackBerry PlayBook stock browser", 6, function(te
casper.exit();
});
});
+
+casper.test.begin("when using Chrome on Windows w/o jQuery", 7, function(test) {
+ casper.userAgent(ua.chrome.windows);
+
+ casper.start(test_url).then(function(){
+
+ var browser = casper.evaluate(function(){
+ return window.jQBrowser;
+ });
+
+ test.assert(browser.chrome, "Browser should be Chrome");
+ test.assertEquals(browser.name, ua.chrome.name,"Browser name should be " + ua.chrome.name);
+
+ test.assert(browser.webkit, "Browser should be WebKit based");
+ test.assertEquals(browser.version, ua.chrome.version, "String version should be " + ua.chrome.version);
+ test.assertEquals(browser.versionNumber, ua.chrome.versionNumber, "Number version should be " + ua.chrome.versionNumber);
+
+ test.assert(browser.desktop, "Browser platform should be desktop");
+ test.assert(browser.win, "Platform should be Windows");
+
+ }).run(function(){
+ test.done();
+ });
+});
+
+casper.test.begin("when trying to match a browser that is not the browser used by the user", 7, function(test) {
+ casper.userAgent(ua.chrome.mac); // Use the Mac Chrome browser
+
+ casper.start(test_url).then(function(){
+
+ var browser = casper.evaluate(function(){
+ return window.jQBrowser.uaMatch(ua.chrome.windows); // Match the Windows Chrome browser
+ });
+
+ test.assert(browser.chrome, "Browser should be Chrome");
+ test.assertEquals(browser.name, ua.chrome.name,"Browser name should be " + ua.chrome.name);
+
+ test.assert(browser.webkit, "Browser should be WebKit based");
+ test.assertEquals(browser.version, ua.chrome.version, "String version should be " + ua.chrome.version);
+ test.assertEquals(browser.versionNumber, ua.chrome.versionNumber, "Number version should be " + ua.chrome.versionNumber);
+
+ test.assert(browser.desktop, "Browser platform should be desktop");
+ test.assert(browser.win, "Platform should be Windows");
+
+ }).run(function(){
+ test.done();
+ });
+});
From 46f56d8776e5bc2ec8041cb7fb205a323d90ffe0 Mon Sep 17 00:00:00 2001
From: Baraa
Date: Sun, 19 Apr 2015 13:21:52 -0400
Subject: [PATCH 08/18] 2015 Updates!
---
Gruntfile.js | 2 +-
MIT-LICENSE.txt | 4 ++--
dist/jquery.browser.js | 6 +++---
dist/jquery.browser.min.js | 7 ++++---
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 95dc931..4d3c2fb 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -20,7 +20,7 @@ module.exports = function(grunt) {
},
uglify: {
options: {
- banner: '/*!\n * jQuery Browser Plugin <%= pkg.version %>\n * https://github.com/gabceb/jquery-browser-plugin\n *\n * Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors\n * http://jquery.org/license\n *\n * Modifications Copyright <%= grunt.template.today("yyyy") %> Gabriel Cebrian\n * https://github.com/gabceb\n *\n * Released under the MIT license\n *\n * Date: <%= grunt.template.today("dd-mm-yyyy")%>\n */'
+ banner: '/*!\n * jQuery Browser Plugin <%= pkg.version %>\n * https://github.com/gabceb/jquery-browser-plugin\n *\n * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors\n * http://jquery.org/license\n *\n * Modifications Copyright <%= grunt.template.today("yyyy") %> Gabriel Cebrian\n * https://github.com/gabceb\n *\n * Released under the MIT license\n *\n * Date: <%= grunt.template.today("dd-mm-yyyy")%>\n */'
},
dist: {
files: {
diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt
index d04f9a7..c6ae678 100644
--- a/MIT-LICENSE.txt
+++ b/MIT-LICENSE.txt
@@ -1,5 +1,5 @@
-Copyright 2013 jQuery Foundation and other contributors, http://jquery.com/
-Modifications Copyright 2013 Gabriel Cebrian, https://www.github.com/gabceb
+Copyright 2015 jQuery Foundation and other contributors, http://jquery.com/
+Modifications Copyright 2015 Gabriel Cebrian, https://www.github.com/gabceb
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 9bd4648..f3248b8 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -2,15 +2,15 @@
* jQuery Browser Plugin 0.0.7
* https://github.com/gabceb/jquery-browser-plugin
*
- * Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
+ * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
* http://jquery.org/license
*
- * Modifications Copyright 2014 Gabriel Cebrian
+ * Modifications Copyright 2015 Gabriel Cebrian
* https://github.com/gabceb
*
* Released under the MIT license
*
- * Date: 12-12-2014
+ * Date: 19-05-2015
*/
/*global window: false */
diff --git a/dist/jquery.browser.min.js b/dist/jquery.browser.min.js
index 55f8cf5..223144e 100644
--- a/dist/jquery.browser.min.js
+++ b/dist/jquery.browser.min.js
@@ -2,7 +2,7 @@
* jQuery Browser Plugin 0.0.7
* https://github.com/gabceb/jquery-browser-plugin
*
- * Original jquery-browser code Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
+ * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
* http://jquery.org/license
*
* Modifications Copyright 2015 Gabriel Cebrian
@@ -10,5 +10,6 @@
*
* Released under the MIT license
*
- * Date: 20-01-2015
- */!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
\ No newline at end of file
+ * Date: 19-05-2015
+ */
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
From 1c8e69209269591d26c84173b30de1fd943a20fb Mon Sep 17 00:00:00 2001
From: artemkaint
Date: Mon, 19 Jan 2015 11:16:59 +0300
Subject: [PATCH 09/18] Merge (fix) #57 - Fix bower AMD loading
---
dist/jquery.browser.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index f3248b8..f7f7872 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -17,8 +17,8 @@
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
- define(['jquery'], function($) {
- factory($);
+ define(['jquery'], function ($) {
+ return factory($);
});
} else if (typeof module === 'object' && typeof module.exports === 'object') {
// Node-like environment
From e651dd59375dc3da684a55919666b7a956c34f03 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Tue, 23 Jun 2015 14:46:00 -0400
Subject: [PATCH 10/18] Disable sudo on Travis CI
This help speed up the builds and make use of updated Travis
infrastructure.
---
.travis.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.travis.yml b/.travis.yml
index 8deaf3f..0a7a84e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
+sudo: false
language: node_js
node_js:
- "0.10"
From 04a369383dc2aa1e327679cce68482bb24d55a75 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Tue, 23 Jun 2015 15:18:37 -0400
Subject: [PATCH 11/18] Initial README update
---
README.md | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index abbdc88..362c0fb 100644
--- a/README.md
+++ b/README.md
@@ -2,17 +2,20 @@
[](https://travis-ci.org/gabceb/jquery-browser-plugin)
-A jQuery plugin for browser detection. jQuery removed support for browser detection on 1.9.1 so it was abstracted into a jQuery plugin
+A jQuery plugin for browser detection. jQuery v1.9.1 dropped support for browser detection, and this project aims to keep the detection up-to-date.
## Installation
Include script *after* the jQuery library:
+```html
+
+```
-
+Alternatively, you can use the plugin without jQuery by substituting `$.browser` for the global `jQBrowser` object.
## Usage
-Returns true if the current useragent is some version of Microsoft's Internet Explorer. Supports all IE versions including IE 12.
+Returns true if the current useragent is some version of Microsoft's Internet Explorer. Supports all IE versions including IE 11.
$.browser.msie;
@@ -24,10 +27,14 @@ Returns true if the current useragent is some version of Firefox
$.browser.mozilla;
-Reading the browser verion
-
+Reading the browser version
+
$.browser.version
+You can also examine arbitrary useragents
+
+ jQBrowser.uaMatch();
+
## Things not included in the original jQuery $.browser implementation
- Detect specifically Windows, Mac, Linux, iPad, iPhone, iPod, Android, Kindle, BlackBerry, Chrome OS, and Windows Phone useragents
@@ -78,7 +85,7 @@ Alternatively, you can detect for generic classifications such as desktop or mob
$.browser.versionNumber // Returns 32 as a number
```
-- Support for new useragent on IE 11 and IE 12
+- Support for new useragent on IE 11
- Support for WebKit based Opera browsers
- Added testing using PhantomJS and different browser user agents
From 3498df963b11a5748e7b44e4b38dc09cfb5c44ed Mon Sep 17 00:00:00 2001
From: Caleb Ely
Date: Sun, 5 Jul 2015 18:10:22 -0400
Subject: [PATCH 12/18] Fixed reversed wording for non-jQuery usage
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 362c0fb..cb9b5ec 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Include script *after* the jQuery library:
```
-Alternatively, you can use the plugin without jQuery by substituting `$.browser` for the global `jQBrowser` object.
+Alternatively, you can use the plugin without jQuery by using the global object `jQBrowser` instead of `$.browser`.
## Usage
From deedc12dcf8857686d592365df0cc0cf7324eec8 Mon Sep 17 00:00:00 2001
From: Triangle717
Date: Sun, 5 Jul 2015 21:06:04 -0400
Subject: [PATCH 13/18] v0.0.8
---
bower.json | 2 +-
browser.jquery.json | 2 +-
dist/jquery.browser.js | 4 ++--
dist/jquery.browser.min.js | 7 +++----
package.json | 2 +-
5 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/bower.json b/bower.json
index 686c626..a7a391f 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery.browser",
- "version": "0.0.6",
+ "version": "0.0.8",
"homepage": "https://github.com/gabceb/jquery-browser-plugin",
"authors": ["Gabriel Cebrian ", "jQuery Team "],
"description": "A jQuery plugin for browser detection.",
diff --git a/browser.jquery.json b/browser.jquery.json
index 4e4c14c..1468346 100644
--- a/browser.jquery.json
+++ b/browser.jquery.json
@@ -9,7 +9,7 @@
"html5",
"support"
],
- "version": "0.0.6",
+ "version": "0.0.8",
"author": {
"name": "Gabriel Cebrian. Initial implementation by the jQuery Team",
"url": "https://github.com/gabceb/jquery-browser-plugin/wiki/Authors"
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index f7f7872..038ec52 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -1,5 +1,5 @@
/*!
- * jQuery Browser Plugin 0.0.7
+ * jQuery Browser Plugin 0.0.8
* https://github.com/gabceb/jquery-browser-plugin
*
* Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
@@ -10,7 +10,7 @@
*
* Released under the MIT license
*
- * Date: 19-05-2015
+ * Date: 05-07-2015
*/
/*global window: false */
diff --git a/dist/jquery.browser.min.js b/dist/jquery.browser.min.js
index 223144e..246407c 100644
--- a/dist/jquery.browser.min.js
+++ b/dist/jquery.browser.min.js
@@ -1,5 +1,5 @@
/*!
- * jQuery Browser Plugin 0.0.7
+ * jQuery Browser Plugin 0.0.8
* https://github.com/gabceb/jquery-browser-plugin
*
* Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
@@ -10,6 +10,5 @@
*
* Released under the MIT license
*
- * Date: 19-05-2015
- */
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
+ * Date: 05-07-2015
+ */!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){return a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
\ No newline at end of file
diff --git a/package.json b/package.json
index abc22ab..d263ceb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.browser",
- "version": "0.0.7",
+ "version": "0.0.8",
"authors": [
"Gabriel Cebrian ",
"jQuery Team "
From 6ea05333701e5ffc4bfb61733c93a0ddd8e85f58 Mon Sep 17 00:00:00 2001
From: MoonYard
Date: Mon, 23 Nov 2015 12:26:09 +0100
Subject: [PATCH 14/18] bugfix windows phone (lumia520)
Closes #68
---
dist/jquery.browser.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 038ec52..3ef0152 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -40,6 +40,7 @@
var match = /(edge)\/([\w.]+)/.exec( ua ) ||
/(opr)[\/]([\w.]+)/.exec( ua ) ||
/(chrome)[ \/]([\w.]+)/.exec( ua ) ||
+ /(iemobile)[\/]([\w.]+)/.exec( ua ) ||
/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
@@ -51,11 +52,11 @@
var platform_match = /(ipad)/.exec( ua ) ||
/(ipod)/.exec( ua ) ||
+ /(windows phone)/.exec( ua ) ||
/(iphone)/.exec( ua ) ||
/(kindle)/.exec( ua ) ||
/(silk)/.exec( ua ) ||
/(android)/.exec( ua ) ||
- /(windows phone)/.exec( ua ) ||
/(win)/.exec( ua ) ||
/(mac)/.exec( ua ) ||
/(linux)/.exec( ua ) ||
@@ -101,7 +102,7 @@
// IE11 has a new token so we will assign it msie to avoid breaking changes
// IE12 disguises itself as Chrome, but adds a new Edge token.
- if ( browser.rv || browser.edge ) {
+ if ( browser.rv || browser.edge || browser.iemobile) {
var ie = "msie";
matched.browser = ie;
From 7dd692a1dee0451240083717f921024f400f795c Mon Sep 17 00:00:00 2001
From: MoonYard
Date: Mon, 23 Nov 2015 12:55:08 +0100
Subject: [PATCH 15/18] Update test.js
added test for Windows Phone 8.1 with IE11
Closes #69
---
test/test.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/test.js b/test/test.js
index 122923b..2d48c1a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -47,7 +47,8 @@ var ua = {
v_12: "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0"
},
win_phone : {
- v_10: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 1020)"
+ v_10: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 1020)",
+ v_11: "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"
},
name: "msie"
},
From ab87149178de1885c38bc6ff84ae51258b42386e Mon Sep 17 00:00:00 2001
From: Caleb Ely
Date: Mon, 23 Nov 2015 13:05:25 -0500
Subject: [PATCH 16/18] Add test for Windows Phone IE 11
---
test/test.js | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/test/test.js b/test/test.js
index 2d48c1a..1690926 100644
--- a/test/test.js
+++ b/test/test.js
@@ -464,7 +464,6 @@ casper.test.begin("when using IE10", 7, function(test) {
});
});
-
casper.test.begin("when using IE10 on a Windows Phone", 7, function(test) {
casper.userAgent(ua.ie.win_phone.v_10);
@@ -490,6 +489,31 @@ casper.test.begin("when using IE10 on a Windows Phone", 7, function(test) {
});
});
+casper.test.begin("when using IE11 on a Windows Phone", 7, function(test) {
+ casper.userAgent(ua.ie.win_phone.v_11);
+
+ casper.start(test_url).then(function(){
+
+ var browser = casper.evaluate(function(){
+ return $.browser;
+ });
+
+ test.assert(browser.msie, "Browser should be IE");
+ test.assertEquals(browser.name, ua.ie.name,"Browser name should be " + ua.ie.name);
+
+ test.assertEquals(browser.version, "11.0", "Version should be 11.0");
+ test.assertEquals(browser.versionNumber, 11, "Version should be 11");
+
+ test.assert(browser.mobile, "Browser platform should be mobile");
+ test.assert(browser["windows phone"], "Platform should be Windows Phone");
+
+ test.assertFalsy(browser.webkit, "Browser should NOT be WebKit based");
+
+ }).run(function(){
+ test.done();
+ });
+});
+
casper.test.begin("when using IE11", 7, function(test) {
casper.userAgent(ua.ie.windows.v_11);
From 412cbceb63f7f7e63d8c40ff4450f86730aea24e Mon Sep 17 00:00:00 2001
From: Caleb Ely
Date: Mon, 23 Nov 2015 14:13:59 -0500
Subject: [PATCH 17/18] Support Microsoft Edge (#63)
---
README.md | 2 +
dist/jquery.browser.js | 12 +++++-
test/test.js | 92 ++++++++++++++++++++++++++++++++++--------
3 files changed, 88 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index cb9b5ec..11c9f8e 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,7 @@ You can also examine arbitrary useragents
$.browser.kindle
$.browser.linux
$.browser.mac
+ $.browser.msedge
$.browser.playbook
$.browser.silk
$.browser.win
@@ -86,6 +87,7 @@ Alternatively, you can detect for generic classifications such as desktop or mob
```
- Support for new useragent on IE 11
+- Support for Microsoft Edge
- Support for WebKit based Opera browsers
- Added testing using PhantomJS and different browser user agents
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 3ef0152..8db2351 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -101,14 +101,22 @@
}
// IE11 has a new token so we will assign it msie to avoid breaking changes
- // IE12 disguises itself as Chrome, but adds a new Edge token.
- if ( browser.rv || browser.edge || browser.iemobile) {
+ if ( browser.rv || browser.iemobile) {
var ie = "msie";
matched.browser = ie;
browser[ie] = true;
}
+ // Edge is officially known as Microsoft Edge, so rewrite the key to match
+ if ( browser.edge ) {
+ delete browser.edge;
+ var msedge = "msedge";
+
+ matched.browser = msedge;
+ browser[msedge] = true;
+ }
+
// Blackberry browsers are marked as Safari on BlackBerry
if ( browser.safari && browser.blackberry ) {
var blackberry = "blackberry";
diff --git a/test/test.js b/test/test.js
index 1690926..35db474 100644
--- a/test/test.js
+++ b/test/test.js
@@ -40,18 +40,27 @@ var ua = {
name: "mozilla"
},
ie: {
- windows : {
+ windows: {
v_9: "Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)",
v_10: "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
- v_11: "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko",
- v_12: "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0"
+ v_11: "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko"
},
- win_phone : {
+ win_phone: {
v_10: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 1020)",
v_11: "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"
},
name: "msie"
},
+ msedge: {
+ windows: {
+ v_12: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.0",
+ v_13: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586"
+ },
+ win_phone: {
+ v_13: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; NOKIA; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/13.10586"
+ },
+ name: "msedge"
+ },
opera: {
v_15: {
mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.20 Safari/537.36 OPR/15.0.1147.18",
@@ -489,8 +498,8 @@ casper.test.begin("when using IE10 on a Windows Phone", 7, function(test) {
});
});
-casper.test.begin("when using IE11 on a Windows Phone", 7, function(test) {
- casper.userAgent(ua.ie.win_phone.v_11);
+casper.test.begin("when using IE11", 7, function(test) {
+ casper.userAgent(ua.ie.windows.v_11);
casper.start(test_url).then(function(){
@@ -504,8 +513,8 @@ casper.test.begin("when using IE11 on a Windows Phone", 7, function(test) {
test.assertEquals(browser.version, "11.0", "Version should be 11.0");
test.assertEquals(browser.versionNumber, 11, "Version should be 11");
- test.assert(browser.mobile, "Browser platform should be mobile");
- test.assert(browser["windows phone"], "Platform should be Windows Phone");
+ test.assert(browser.desktop, "Browser platform should be desktop");
+ test.assert(browser.win, "Platform should be Windows");
test.assertFalsy(browser.webkit, "Browser should NOT be WebKit based");
@@ -514,8 +523,8 @@ casper.test.begin("when using IE11 on a Windows Phone", 7, function(test) {
});
});
-casper.test.begin("when using IE11", 7, function(test) {
- casper.userAgent(ua.ie.windows.v_11);
+casper.test.begin("when using IE11 on a Windows Phone", 7, function(test) {
+ casper.userAgent(ua.ie.win_phone.v_11);
casper.start(test_url).then(function(){
@@ -529,8 +538,8 @@ casper.test.begin("when using IE11", 7, function(test) {
test.assertEquals(browser.version, "11.0", "Version should be 11.0");
test.assertEquals(browser.versionNumber, 11, "Version should be 11");
- test.assert(browser.desktop, "Browser platform should be desktop");
- test.assert(browser.win, "Platform should be Windows");
+ test.assert(browser.mobile, "Browser platform should be mobile");
+ test.assert(browser["windows phone"], "Platform should be Windows Phone");
test.assertFalsy(browser.webkit, "Browser should NOT be WebKit based");
@@ -539,8 +548,8 @@ casper.test.begin("when using IE11", 7, function(test) {
});
});
-casper.test.begin("when using IE12", 7, function(test) {
- casper.userAgent(ua.ie.windows.v_12);
+casper.test.begin("when using Microsoft Edge 12", 7, function(test) {
+ casper.userAgent(ua.msedge.windows.v_12);
casper.start(test_url).then(function(){
@@ -548,8 +557,8 @@ casper.test.begin("when using IE12", 7, function(test) {
return $.browser;
});
- test.assert(browser.msie, "Browser should be IE");
- test.assertEquals(browser.name, ua.ie.name,"Browser name should be " + ua.ie.name);
+ test.assert(browser.msedge, "Browser should be MS Edge");
+ test.assertEquals(browser.name, ua.msedge.name,"Browser name should be " + ua.msedge.name);
test.assertEquals(browser.version, "12.0", "Version should be 12.0");
test.assertEquals(browser.versionNumber, 12, "Version should be 12");
@@ -564,6 +573,57 @@ casper.test.begin("when using IE12", 7, function(test) {
});
});
+casper.test.begin("when using Microsoft Edge 13", 7, function(test) {
+ casper.userAgent(ua.msedge.windows.v_13);
+
+ casper.start(test_url).then(function(){
+
+ var browser = casper.evaluate(function(){
+ return $.browser;
+ });
+
+ test.assert(browser.msedge, "Browser should be MS Edge");
+ test.assertEquals(browser.name, ua.msedge.name,"Browser name should be " + ua.msedge.name);
+
+ test.assertEquals(browser.version, "13.10586", "Version should be 13.10586");
+ test.assertEquals(browser.versionNumber, 13, "Version should be 13");
+
+ test.assert(browser.desktop, "Browser platform should be desktop");
+ test.assert(browser.win, "Platform should be Windows");
+
+ test.assertFalsy(browser.webkit, "Browser should NOT be WebKit based");
+
+ }).run(function(){
+ test.done();
+ });
+});
+
+casper.test.begin("when using Microsoft Edge v13 on a Windows Phone", 7, function(test) {
+ casper.userAgent(ua.msedge.win_phone.v_13);
+
+ casper.start(test_url).then(function(){
+
+ var browser = casper.evaluate(function(){
+ return $.browser;
+ });
+
+ test.assert(browser.msedge, "Browser should be MS Edge");
+ test.assertEquals(browser.name, ua.msedge.name,"Browser name should be " + ua.msedge.name);
+
+ test.assertEquals(browser.version, "13.10586", "Version should be 13.10586");
+ test.assertEquals(browser.versionNumber, 13, "Version should be 13");
+
+ test.assert(browser.mobile, "Browser platform should be mobile");
+ test.assert(browser["windows phone"], "Platform should be Windows Phone");
+
+ test.assertFalsy(browser.webkit, "Browser should NOT be WebKit based");
+
+ }).run(function(){
+ test.done();
+ });
+});
+
+
casper.test.begin("when using Opera 15+ on Windows", 7, function(test) {
casper.userAgent(ua.opera.v_15.windows);
From 07d59ee6e87da9f789b196d221e5f62f9db3c158 Mon Sep 17 00:00:00 2001
From: Gabriel Cebrian
Date: Mon, 23 Nov 2015 11:56:22 -0800
Subject: [PATCH 18/18] Bump the minor
---
bower.json | 2 +-
browser.jquery.json | 2 +-
dist/jquery.browser.js | 2 +-
dist/jquery.browser.min.js | 6 +++---
package.json | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/bower.json b/bower.json
index a7a391f..6955a43 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery.browser",
- "version": "0.0.8",
+ "version": "0.1.0",
"homepage": "https://github.com/gabceb/jquery-browser-plugin",
"authors": ["Gabriel Cebrian ", "jQuery Team "],
"description": "A jQuery plugin for browser detection.",
diff --git a/browser.jquery.json b/browser.jquery.json
index 1468346..79868a6 100644
--- a/browser.jquery.json
+++ b/browser.jquery.json
@@ -9,7 +9,7 @@
"html5",
"support"
],
- "version": "0.0.8",
+ "version": "0.1.0",
"author": {
"name": "Gabriel Cebrian. Initial implementation by the jQuery Team",
"url": "https://github.com/gabceb/jquery-browser-plugin/wiki/Authors"
diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js
index 8db2351..223eca6 100644
--- a/dist/jquery.browser.js
+++ b/dist/jquery.browser.js
@@ -1,5 +1,5 @@
/*!
- * jQuery Browser Plugin 0.0.8
+ * jQuery Browser Plugin 0.1.0
* https://github.com/gabceb/jquery-browser-plugin
*
* Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
diff --git a/dist/jquery.browser.min.js b/dist/jquery.browser.min.js
index 246407c..491da7c 100644
--- a/dist/jquery.browser.min.js
+++ b/dist/jquery.browser.min.js
@@ -1,5 +1,5 @@
/*!
- * jQuery Browser Plugin 0.0.8
+ * jQuery Browser Plugin 0.1.0
* https://github.com/gabceb/jquery-browser-plugin
*
* Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
@@ -10,5 +10,5 @@
*
* Released under the MIT license
*
- * Date: 05-07-2015
- */!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){return a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
\ No newline at end of file
+ * Date: 23-11-2015
+ */!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){return a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(iemobile)[\/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(windows phone)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.iemobile){var f="msie";e.browser=f,d[f]=!0}if(d.edge){delete d.edge;var g="msedge";e.browser=g,d[g]=!0}if(d.safari&&d.blackberry){var h="blackberry";e.browser=h,d[h]=!0}if(d.safari&&d.playbook){var i="playbook";e.browser=i,d[i]=!0}if(d.bb){var j="blackberry";e.browser=j,d[j]=!0}if(d.opr){var k="opera";e.browser=k,d[k]=!0}if(d.safari&&d.android){var l="android";e.browser=l,d[l]=!0}if(d.safari&&d.kindle){var m="kindle";e.browser=m,d[m]=!0}if(d.safari&&d.silk){var n="silk";e.browser=n,d[n]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
\ No newline at end of file
diff --git a/package.json b/package.json
index d263ceb..421f8d5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.browser",
- "version": "0.0.8",
+ "version": "0.1.0",
"authors": [
"Gabriel Cebrian ",
"jQuery Team "