diff --git a/bower.json b/bower.json index 686c626..6979e88 100644 --- a/bower.json +++ b/bower.json @@ -1,5 +1,5 @@ { - "name": "jquery.browser", + "name": "browser", "version": "0.0.6", "homepage": "https://github.com/gabceb/jquery-browser-plugin", "authors": ["Gabriel Cebrian ", "jQuery Team "], diff --git a/dist/browser.js b/dist/browser.js new file mode 100644 index 0000000..40736c1 --- /dev/null +++ b/dist/browser.js @@ -0,0 +1,58 @@ +// Generated by CoffeeScript 1.7.1 +(function() { + (function($, window, undefined_) { + "use strict"; + var android, browser, ie, matched, opera; + matched = void 0; + browser = void 0; + $.uaMatch = function(ua) { + var match, platform_match; + ua = ua.toLowerCase(); + match = /(opr)[\/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(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) || []; + 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)/i.exec(ua) || []; + return { + browser: match[3] || match[1] || "", + version: match[2] || "0", + platform: platform_match[0] || "" + }; + }; + matched = $.uaMatch(window.navigator.userAgent); + browser = {}; + if (matched.browser) { + browser[matched.browser] = true; + browser.version = matched.version; + browser.versionNumber = parseInt(matched.version); + } + if (matched.platform) { + browser[matched.platform] = true; + } + if (browser.android || browser.ipad || browser.iphone || browser["windows phone"]) { + browser.mobile = true; + } + if (browser.cros || browser.mac || browser.linux || browser.win) { + browser.desktop = true; + } + if (browser.chrome || browser.opr || browser.safari) { + browser.webkit = true; + } + if (browser.rv) { + ie = "msie"; + matched.browser = ie; + browser[ie] = true; + } + if (browser.opr) { + opera = "opera"; + matched.browser = opera; + browser[opera] = true; + } + if (browser.safari && browser.android) { + android = 'android'; + matched.browser = android; + browser[android] = true; + } + browser.name = matched.browser; + browser.platform = matched.platform; + return $.browser = browser; + })(window, window); + +}).call(this); diff --git a/dist/jquery.browser.js.coffee b/dist/browser.js.coffee similarity index 94% rename from dist/jquery.browser.js.coffee rename to dist/browser.js.coffee index d236bfe..1eb5009 100644 --- a/dist/jquery.browser.js.coffee +++ b/dist/browser.js.coffee @@ -13,12 +13,12 @@ # Date: 2013-07-29T17:23:27-07:00 # -((jQuery, window, undefined_) -> +(($, window, undefined_) -> "use strict" matched = undefined browser = undefined - jQuery.uaMatch = (ua) -> + $.uaMatch = (ua) -> ua = ua.toLowerCase() match = /(opr)[\/]([\w.]+)/.exec(ua) or /(chrome)[ \/]([\w.]+)/.exec(ua) or /(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) or /(webkit)[ \/]([\w.]+)/.exec(ua) or /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) or /(msie) ([\w.]+)/.exec(ua) or ua.indexOf("trident") >= 0 and /(rv)(?::| )([\w.]+)/.exec(ua) or ua.indexOf("compatible") < 0 and /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) or [] platform_match = /(ipad)/.exec(ua) or /(iphone)/.exec(ua) or /(android)/.exec(ua) or /(windows phone)/.exec(ua) or /(win)/.exec(ua) or /(mac)/.exec(ua) or /(linux)/.exec(ua) or /(cros)/i.exec(ua) or [] @@ -26,7 +26,7 @@ version: match[2] or "0" platform: platform_match[0] or "" - matched = jQuery.uaMatch(window.navigator.userAgent) + matched = $.uaMatch(window.navigator.userAgent) browser = {} if matched.browser @@ -74,5 +74,5 @@ browser.name = matched.browser browser.platform = matched.platform -jQuery.browser = browser -) jQuery, window + $.browser = browser +) window, window diff --git a/dist/browser.min.js b/dist/browser.min.js new file mode 100644 index 0000000..af3381d --- /dev/null +++ b/dist/browser.min.js @@ -0,0 +1,14 @@ +/*! + * jQuery Browser Plugin 0.0.6 + * 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 2014 Gabriel Cebrian + * https://github.com/gabceb + * + * Released under the MIT license + * + * Date: 17-04-2014 + */(function(){!function(a,b){"use strict";var c,d,e,f,g;return f=void 0,d=void 0,a.uaMatch=function(a){var b,c;return a=a.toLowerCase(),b=/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(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)/i.exec(a)||[],{browser:b[3]||b[1]||"",version:b[2]||"0",platform:c[0]||""}},f=a.uaMatch(b.navigator.userAgent),d={},f.browser&&(d[f.browser]=!0,d.version=f.version,d.versionNumber=parseInt(f.version)),f.platform&&(d[f.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&&(e="msie",f.browser=e,d[e]=!0),d.opr&&(g="opera",f.browser=g,d[g]=!0),d.safari&&d.android&&(c="android",f.browser=c,d[c]=!0),d.name=f.browser,d.platform=f.platform,a.browser=d}(window,window)}).call(this); \ No newline at end of file diff --git a/dist/jquery.browser.js b/dist/jquery.browser.js deleted file mode 100644 index 3bb26d7..0000000 --- a/dist/jquery.browser.js +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * jQuery Browser Plugin v0.0.6 - * 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 - * https://github.com/gabceb - * - * Released under the MIT license - * - * Date: 2013-07-29T17:23:27-07:00 - */ - -(function( jQuery, window, undefined ) { - "use strict"; - - var matched, browser; - - jQuery.uaMatch = function( ua ) { - ua = ua.toLowerCase(); - - var match = /(opr)[\/]([\w.]+)/.exec( ua ) || - /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(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)/i.exec( ua ) || - []; - - return { - browser: match[ 3 ] || match[ 1 ] || "", - version: match[ 2 ] || "0", - platform: platform_match[ 0 ] || "" - }; - }; - - matched = jQuery.uaMatch( window.navigator.userAgent ); - browser = {}; - - if ( matched.browser ) { - browser[ matched.browser ] = true; - browser.version = matched.version; - browser.versionNumber = parseInt(matched.version); - } - - if ( matched.platform ) { - browser[ matched.platform ] = true; - } - - // These are all considered mobile platforms, meaning they run a mobile browser - if ( browser.android || browser.ipad || browser.iphone || browser[ "windows phone" ] ) { - browser.mobile = 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; - } - - // Chrome, Opera 15+ and Safari are webkit based browsers - if ( browser.chrome || browser.opr || browser.safari ) { - browser.webkit = true; - } - - // IE11 has a new token so we will assign it msie to avoid breaking changes - if ( browser.rv ) - { - var ie = "msie"; - - matched.browser = ie; - browser[ie] = true; - } - - // Opera 15+ are identified as opr - if ( browser.opr ) - { - var opera = "opera"; - - matched.browser = opera; - browser[opera] = true; - } - - // Stock Android browsers are marked as Safari on Android. - if ( browser.safari && browser.android ) - { - var android = "android"; - - matched.browser = android; - browser[android] = true; - } - - // Assign the name and platform variable - browser.name = matched.browser; - browser.platform = matched.platform; - - - jQuery.browser = browser; -})( jQuery, window ); \ No newline at end of file diff --git a/dist/jquery.browser.min.js b/dist/jquery.browser.min.js deleted file mode 100644 index eadf06e..0000000 --- a/dist/jquery.browser.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/*! - * jQuery Browser Plugin 0.0.6 - * 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 2014 Gabriel Cebrian - * https://github.com/gabceb - * - * Released under the MIT license - * - * Date: 30-03-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)||/(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)/i.exec(a)||[];return{browser:b[3]||b[1]||"",version: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.version)),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 diff --git a/test/src/browser.js b/test/src/browser.js new file mode 100644 index 0000000..40736c1 --- /dev/null +++ b/test/src/browser.js @@ -0,0 +1,58 @@ +// Generated by CoffeeScript 1.7.1 +(function() { + (function($, window, undefined_) { + "use strict"; + var android, browser, ie, matched, opera; + matched = void 0; + browser = void 0; + $.uaMatch = function(ua) { + var match, platform_match; + ua = ua.toLowerCase(); + match = /(opr)[\/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(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) || []; + 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)/i.exec(ua) || []; + return { + browser: match[3] || match[1] || "", + version: match[2] || "0", + platform: platform_match[0] || "" + }; + }; + matched = $.uaMatch(window.navigator.userAgent); + browser = {}; + if (matched.browser) { + browser[matched.browser] = true; + browser.version = matched.version; + browser.versionNumber = parseInt(matched.version); + } + if (matched.platform) { + browser[matched.platform] = true; + } + if (browser.android || browser.ipad || browser.iphone || browser["windows phone"]) { + browser.mobile = true; + } + if (browser.cros || browser.mac || browser.linux || browser.win) { + browser.desktop = true; + } + if (browser.chrome || browser.opr || browser.safari) { + browser.webkit = true; + } + if (browser.rv) { + ie = "msie"; + matched.browser = ie; + browser[ie] = true; + } + if (browser.opr) { + opera = "opera"; + matched.browser = opera; + browser[opera] = true; + } + if (browser.safari && browser.android) { + android = 'android'; + matched.browser = android; + browser[android] = true; + } + browser.name = matched.browser; + browser.platform = matched.platform; + return $.browser = browser; + })(window, window); + +}).call(this); diff --git a/test/src/jquery.browser.js b/test/src/jquery.browser.js deleted file mode 100644 index 3bb26d7..0000000 --- a/test/src/jquery.browser.js +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * jQuery Browser Plugin v0.0.6 - * 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 - * https://github.com/gabceb - * - * Released under the MIT license - * - * Date: 2013-07-29T17:23:27-07:00 - */ - -(function( jQuery, window, undefined ) { - "use strict"; - - var matched, browser; - - jQuery.uaMatch = function( ua ) { - ua = ua.toLowerCase(); - - var match = /(opr)[\/]([\w.]+)/.exec( ua ) || - /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(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)/i.exec( ua ) || - []; - - return { - browser: match[ 3 ] || match[ 1 ] || "", - version: match[ 2 ] || "0", - platform: platform_match[ 0 ] || "" - }; - }; - - matched = jQuery.uaMatch( window.navigator.userAgent ); - browser = {}; - - if ( matched.browser ) { - browser[ matched.browser ] = true; - browser.version = matched.version; - browser.versionNumber = parseInt(matched.version); - } - - if ( matched.platform ) { - browser[ matched.platform ] = true; - } - - // These are all considered mobile platforms, meaning they run a mobile browser - if ( browser.android || browser.ipad || browser.iphone || browser[ "windows phone" ] ) { - browser.mobile = 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; - } - - // Chrome, Opera 15+ and Safari are webkit based browsers - if ( browser.chrome || browser.opr || browser.safari ) { - browser.webkit = true; - } - - // IE11 has a new token so we will assign it msie to avoid breaking changes - if ( browser.rv ) - { - var ie = "msie"; - - matched.browser = ie; - browser[ie] = true; - } - - // Opera 15+ are identified as opr - if ( browser.opr ) - { - var opera = "opera"; - - matched.browser = opera; - browser[opera] = true; - } - - // Stock Android browsers are marked as Safari on Android. - if ( browser.safari && browser.android ) - { - var android = "android"; - - matched.browser = android; - browser[android] = true; - } - - // Assign the name and platform variable - browser.name = matched.browser; - browser.platform = matched.platform; - - - jQuery.browser = browser; -})( jQuery, window ); \ No newline at end of file