From 7ed56e71bc4500dabbc39615a6ad1195fc3e8173 Mon Sep 17 00:00:00 2001 From: Triangle717 Date: Fri, 12 Dec 2014 17:54:35 -0500 Subject: [PATCH] Update version to v0.0.7 --- dist/jquery.browser.js | 6 +- dist/jquery.browser.min.js | 6 +- package.json | 2 +- test/src/jquery.browser.js | 125 +++++++++++++++++++++++++++---------- 4 files changed, 98 insertions(+), 41 deletions(-) diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js index 064e75f..e105e95 100644 --- a/dist/jquery.browser.js +++ b/dist/jquery.browser.js @@ -1,16 +1,16 @@ /*! - * jQuery Browser Plugin v0.0.6 + * 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 * http://jquery.org/license * - * Modifications Copyright 2013 Gabriel Cebrian + * Modifications Copyright 2014 Gabriel Cebrian * https://github.com/gabceb * * Released under the MIT license * - * Date: 2013-07-29T17:23:27-07:00 + * Date: 12-12-2014 */ (function (root, factory) { diff --git a/dist/jquery.browser.min.js b/dist/jquery.browser.min.js index d5f6aa3..f8e0482 100644 --- a/dist/jquery.browser.min.js +++ b/dist/jquery.browser.min.js @@ -1,5 +1,5 @@ /*! - * jQuery Browser Plugin 0.0.6 + * 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 @@ -10,5 +10,5 @@ * * Released under the MIT license * - * Date: 28-09-2014 - */!function(a,b){"use strict";var c,d;if(a.uaMatch=function(a){a=a.toLowerCase();var b=/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\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)||/(iphone)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||[];return{browser:b[3]||b[1]||"",version:b[4]||b[2],versionNumber:b[2]||"0",platform:c[0]||""}},c=a.uaMatch(b.navigator.userAgent),d={},c.browser&&(d[c.browser]=!0,d.version=c.version,d.versionNumber=parseInt(c.versionNumber)),c.platform&&(d[c.platform]=!0),(d.android||d.ipad||d.iphone||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){var e="msie";c.browser=e,d[e]=!0}if(d.opr){var f="opera";c.browser=f,d[f]=!0}if(d.safari&&d.android){var g="android";c.browser=g,d[g]=!0}d.name=c.browser,d.platform=c.platform,a.browser=d}(jQuery,window); \ No newline at end of file + * Date: 12-12-2014 + */!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){b(c,a)}):b(jQuery,a)}(this,function(a,b){"use strict";var c,d;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]||""}},c=a.uaMatch(b.navigator.userAgent),d={},c.browser&&(d[c.browser]=!0,d.version=c.version,d.versionNumber=parseInt(c.versionNumber,10)),c.platform&&(d[c.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 e="msie";c.browser=e,d[e]=!0}if(d.safari&&d.blackberry){var f="blackberry";c.browser=f,d[f]=!0}if(d.safari&&d.playbook){var g="playbook";c.browser=g,d[g]=!0}if(d.bb){var h="blackberry";c.browser=h,d[h]=!0}if(d.opr){var i="opera";c.browser=i,d[i]=!0}if(d.safari&&d.android){var j="android";c.browser=j,d[j]=!0}if(d.safari&&d.kindle){var k="kindle";c.browser=k,d[k]=!0}if(d.safari&&d.silk){var l="silk";c.browser=l,d[l]=!0}return d.name=c.browser,d.platform=c.platform,a.browser=d,d}); \ No newline at end of file diff --git a/package.json b/package.json index 4312f40..df0b02b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery.browser", - "version": "0.0.6", + "version": "0.0.7", "authors": [ "Gabriel Cebrian ", "jQuery Team " diff --git a/test/src/jquery.browser.js b/test/src/jquery.browser.js index ceea0e4..e105e95 100644 --- a/test/src/jquery.browser.js +++ b/test/src/jquery.browser.js @@ -1,19 +1,29 @@ /*! - * jQuery Browser Plugin v0.0.6 + * 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 * http://jquery.org/license * - * Modifications Copyright 2013 Gabriel Cebrian + * Modifications Copyright 2014 Gabriel Cebrian * https://github.com/gabceb * * Released under the MIT license * - * Date: 2013-07-29T17:23:27-07:00 + * Date: 12-12-2014 */ -(function( jQuery, window, undefined ) { +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], function ($) { + factory($, root); + }); + } else { + // Browser globals + factory(jQuery, root); + } +}(this, function(jQuery, window) { "use strict"; var matched, browser; @@ -21,30 +31,38 @@ jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); - var match = /(opr)[\/]([\w.]+)/.exec( ua ) || - /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || - /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) || - ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || - []; + var match = /(edge)\/([\w.]+)/.exec( ua ) || + /(opr)[\/]([\w.]+)/.exec( ua ) || + /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; var platform_match = /(ipad)/.exec( ua ) || - /(iphone)/.exec( ua ) || - /(android)/.exec( ua ) || - /(windows phone)/.exec( ua ) || - /(win)/.exec( ua ) || - /(mac)/.exec( ua ) || - /(linux)/.exec( ua ) || - /(cros)/.exec( ua ) || - []; + /(ipod)/.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 ) || + /(cros)/.exec( ua ) || + /(playbook)/.exec( ua ) || + /(bb)/.exec( ua ) || + /(blackberry)/.exec( ua ) || + []; return { - browser: match[ 3 ] || match[ 1 ] || "", - version: match[ 4 ] || match[ 2 ], - versionNumber: match[ 2 ] || "0", + browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "", + version: match[ 2 ] || match[ 4 ] || "0", + versionNumber: match[ 4 ] || match[ 2 ] || "0", platform: platform_match[ 0 ] || "" }; }; @@ -55,7 +73,7 @@ if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; - browser.versionNumber = parseInt(matched.versionNumber); + browser.versionNumber = parseInt(matched.versionNumber, 10); } if ( matched.platform ) { @@ -63,7 +81,8 @@ } // These are all considered mobile platforms, meaning they run a mobile browser - if ( browser.android || browser.ipad || browser.iphone || browser[ "windows phone" ] ) { + 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; } @@ -78,17 +97,40 @@ } // IE11 has a new token so we will assign it msie to avoid breaking changes - if ( browser.rv ) - { + // IE12 disguises itself as Chrome, but adds a new Edge token. + if ( browser.rv || browser.edge ) { var ie = "msie"; matched.browser = ie; browser[ie] = true; } + // Blackberry browsers are marked as Safari on BlackBerry + if ( browser.safari && browser.blackberry ) { + var blackberry = "blackberry"; + + matched.browser = blackberry; + browser[blackberry] = true; + } + + // Playbook browsers are marked as Safari on Playbook + if ( browser.safari && browser.playbook ) { + var playbook = "playbook"; + + matched.browser = playbook; + browser[playbook] = true; + } + + // BB10 is a newer OS version of BlackBerry + if ( browser.bb ) { + var bb = "blackberry"; + + matched.browser = bb; + browser[bb] = true; + } + // Opera 15+ are identified as opr - if ( browser.opr ) - { + if ( browser.opr ) { var opera = "opera"; matched.browser = opera; @@ -96,18 +138,33 @@ } // Stock Android browsers are marked as Safari on Android. - if ( browser.safari && browser.android ) - { + if ( browser.safari && browser.android ) { var android = "android"; matched.browser = android; browser[android] = true; } + // Kindle browsers are marked as Safari on Kindle + if ( browser.safari && browser.kindle ) { + var kindle = "kindle"; + + matched.browser = kindle; + browser[kindle] = true; + } + + // Kindle Silk browsers are marked as Safari on Kindle + if ( browser.safari && browser.silk ) { + var silk = "silk"; + + matched.browser = silk; + browser[silk] = true; + } + // Assign the name and platform variable browser.name = matched.browser; browser.platform = matched.platform; - jQuery.browser = browser; -})( jQuery, window ); + return browser; +}));