From 3c755ed710611e1bde74a0cec6024e104716e30f Mon Sep 17 00:00:00 2001 From: Andrew Shaffer Date: Fri, 27 Feb 2015 15:20:55 -0800 Subject: [PATCH 01/24] add support for googlebot detection --- bowser.js | 7 +++++++ bowser.min.js | 2 +- src/bowser.js | 7 +++++++ src/useragents.js | 7 +++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bowser.js b/bowser.js index f763963..1a44a7d 100644 --- a/bowser.js +++ b/bowser.js @@ -148,6 +148,13 @@ , version: versionIdentifier } } + else if(/googlebot/i.test(ua)) { + result = { + name: 'Googlebot' + , googlebot: t + , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier + } + } else result = {} // set webkit or gecko flag for browsers based on these engines diff --git a/bowser.min.js b/bowser.min.js index affb143..1fd4fcc 100644 --- a/bowser.min.js +++ b/bowser.min.js @@ -3,4 +3,4 @@ * https://github.com/ded/bowser * MIT License | (c) Dustin Diaz 2014 */ -!function(e,t){typeof module!="undefined"&&module.exports?module.exports.browser=t():typeof define=="function"&&define.amd?define(t):this[e]=t()}("bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}var r=n(/(ipod|iphone|ipad)/i).toLowerCase(),i=/like android/i.test(t),s=!i&&/android/i.test(t),o=n(/version\/(\d+(\.\d+)?)/i),u=/tablet/i.test(t),a=!u&&/[^-]mobi/i.test(t),f;/opera|opr/i.test(t)?f={name:"Opera",opera:e,version:o||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(t)?f={name:"Windows Phone",windowsphone:e,msie:e,version:n(/iemobile\/(\d+(\.\d+)?)/i)}:/msie|trident/i.test(t)?f={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(t)?f={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:r?(f={name:r=="iphone"?"iPhone":r=="ipad"?"iPad":"iPod"},o&&(f.version=o)):/sailfish/i.test(t)?f={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?f={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(f={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(f.firefoxos=e)):/silk/i.test(t)?f={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:s?f={name:"Android",version:o}:/phantom/i.test(t)?f={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?f={name:"BlackBerry",blackberry:e,version:o||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(t)?(f={name:"WebOS",webos:e,version:o||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(f.touchpad=e)):/bada/i.test(t)?f={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(t)?f={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||o}:/safari/i.test(t)?f={name:"Safari",safari:e,version:o}:f={},/(apple)?webkit/i.test(t)?(f.name=f.name||"Webkit",f.webkit=e,!f.version&&o&&(f.version=o)):!f.opera&&/gecko\//i.test(t)&&(f.name=f.name||"Gecko",f.gecko=e,f.version=f.version||n(/gecko\/(\d+(\.\d+)?)/i)),s||f.silk?f.android=e:r&&(f[r]=e,f.ios=e);var l="";r?(l=n(/os (\d+([_\s]\d+)*) like mac os x/i),l=l.replace(/[_\s]/g,".")):s?l=n(/android[ \/-](\d+(\.\d+)*)/i):f.windowsphone?l=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):f.webos?l=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):f.blackberry?l=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):f.bada?l=n(/bada\/(\d+(\.\d+)*)/i):f.tizen&&(l=n(/tizen[\/\s](\d+(\.\d+)*)/i)),l&&(f.osversion=l);var c=l.split(".")[0];if(u||r=="ipad"||s&&(c==3||c==4&&!a)||f.silk)f.tablet=e;else if(a||r=="iphone"||r=="ipod"||s||f.blackberry||f.webos||f.bada)f.mobile=e;return f.msie&&f.version>=10||f.chrome&&f.version>=20||f.firefox&&f.version>=20||f.safari&&f.version>=6||f.opera&&f.version>=10||f.ios&&f.osversion&&f.osversion.split(".")[0]>=6||f.blackberry&&f.version>=10.1?f.a=e:f.msie&&f.version<10||f.chrome&&f.version<20||f.firefox&&f.version<20||f.safari&&f.version<6||f.opera&&f.version<10||f.ios&&f.osversion&&f.osversion.split(".")[0]<6?f.c=e:f.x=e,f}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n._detect=t,n}) \ No newline at end of file +!function(e,t){typeof module!="undefined"&&module.exports?module.exports.browser=t():typeof define=="function"&&define.amd?define(t):this[e]=t()}("bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}var r=n(/(ipod|iphone|ipad)/i).toLowerCase(),i=/like android/i.test(t),s=!i&&/android/i.test(t),o=n(/version\/(\d+(\.\d+)?)/i),u=/tablet/i.test(t),a=!u&&/[^-]mobi/i.test(t),f;/opera|opr/i.test(t)?f={name:"Opera",opera:e,version:o||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(t)?f={name:"Windows Phone",windowsphone:e,msie:e,version:n(/iemobile\/(\d+(\.\d+)?)/i)}:/msie|trident/i.test(t)?f={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(t)?f={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:r?(f={name:r=="iphone"?"iPhone":r=="ipad"?"iPad":"iPod"},o&&(f.version=o)):/sailfish/i.test(t)?f={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?f={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(f={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(f.firefoxos=e)):/silk/i.test(t)?f={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:s?f={name:"Android",version:o}:/phantom/i.test(t)?f={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?f={name:"BlackBerry",blackberry:e,version:o||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(t)?(f={name:"WebOS",webos:e,version:o||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(f.touchpad=e)):/bada/i.test(t)?f={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(t)?f={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||o}:/safari/i.test(t)?f={name:"Safari",safari:e,version:o}:/googlebot/i.test(t)?f={name:"Googlebot",googlebot:e,version:n(/googlebot\/(\d+(\.\d+))/i)||o}:f={},/(apple)?webkit/i.test(t)?(f.name=f.name||"Webkit",f.webkit=e,!f.version&&o&&(f.version=o)):!f.opera&&/gecko\//i.test(t)&&(f.name=f.name||"Gecko",f.gecko=e,f.version=f.version||n(/gecko\/(\d+(\.\d+)?)/i)),s||f.silk?f.android=e:r&&(f[r]=e,f.ios=e);var l="";r?(l=n(/os (\d+([_\s]\d+)*) like mac os x/i),l=l.replace(/[_\s]/g,".")):s?l=n(/android[ \/-](\d+(\.\d+)*)/i):f.windowsphone?l=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):f.webos?l=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):f.blackberry?l=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):f.bada?l=n(/bada\/(\d+(\.\d+)*)/i):f.tizen&&(l=n(/tizen[\/\s](\d+(\.\d+)*)/i)),l&&(f.osversion=l);var c=l.split(".")[0];if(u||r=="ipad"||s&&(c==3||c==4&&!a)||f.silk)f.tablet=e;else if(a||r=="iphone"||r=="ipod"||s||f.blackberry||f.webos||f.bada)f.mobile=e;return f.msie&&f.version>=10||f.chrome&&f.version>=20||f.firefox&&f.version>=20||f.safari&&f.version>=6||f.opera&&f.version>=10||f.ios&&f.osversion&&f.osversion.split(".")[0]>=6||f.blackberry&&f.version>=10.1?f.a=e:f.msie&&f.version<10||f.chrome&&f.version<20||f.firefox&&f.version<20||f.safari&&f.version<6||f.opera&&f.version<10||f.ios&&f.osversion&&f.osversion.split(".")[0]<6?f.c=e:f.x=e,f}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n._detect=t,n}) \ No newline at end of file diff --git a/src/bowser.js b/src/bowser.js index 6547b0d..6c2b31a 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -142,6 +142,13 @@ , version: versionIdentifier } } + else if(/googlebot/i.test(ua)) { + result = { + name: 'Googlebot' + , googlebot: t + , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier + } + } else result = {} // set webkit or gecko flag for browsers based on these engines diff --git a/src/useragents.js b/src/useragents.js index eaa0ab7..b751559 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -931,4 +931,11 @@ module.exports.useragents = { , x: true } } + , Googlebot: { + 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)': { + googlebot: true + , version: '2.1' + , x: true + } + } }; From f255f5ad8694547435834bc25f33cfa38377e459 Mon Sep 17 00:00:00 2001 From: Jose Tavares Date: Sun, 18 Oct 2015 19:07:06 +0100 Subject: [PATCH 02/24] fix #67 - Fix bower warnings --- bower.json | 29 +++++++++++++++++++++++++++++ component.json | 17 ----------------- 2 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 bower.json delete mode 100644 component.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..0f121b8 --- /dev/null +++ b/bower.json @@ -0,0 +1,29 @@ +{ + "name": "bowser", + "description": "a browser detector", + "keywords": [ + "ender", + "browser", + "sniff", + "detection" + ], + "version": "1.0.0", + "homepage": "https://github.com/ded/bowser", + "scripts": [ + "bowser.js" + ], + "authors": [ + "Dustin Diaz (http://dustindiaz.com)" + ], + "moduleType": [], + "license": "MIT", + "main": "bowser.js", + "ignore": [ + "node_modules", + "test", + "src", + "make", + "**/.*", + "Makefile" + ] +} diff --git a/component.json b/component.json deleted file mode 100644 index 5ab10ae..0000000 --- a/component.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "bowser", - "description": "a browser detector", - "keywords": [ - "ender", - "browser", - "sniff", - "detection" - ], - "version": "0.7.2", - "homepage": "https://github.com/ded/bowser", - "author": "Dustin Diaz (http://dustindiaz.com)", - "main": "bowser.js", - "scripts": [ - "bowser.js" - ] -} From 1fa7c01a8553510dbdfdc615665dd35f4f969f63 Mon Sep 17 00:00:00 2001 From: Jose Tavares Date: Sun, 18 Oct 2015 20:06:08 +0100 Subject: [PATCH 03/24] fix #107 - uc browser is not detect using this library --- README.md | 1 + src/bowser.js | 7 +++++++ src/useragents.js | 23 ++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4585f43..dd11eed 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ if (bowser.msie && bowser.version <= 6) { * Bada browser as `bada`[`webkit`] * Tizen browser as `tizen`[`webkit`] * Sailfish browser as `sailfish`[`gecko`] + * UC Browser as `ucbrowser`[`webkit`] For all detected browsers the browser version is set in the `version` field. diff --git a/src/bowser.js b/src/bowser.js index cefeee2..46a8e0c 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -45,6 +45,13 @@ , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i) } } + else if (/ucbrowser/i.test(ua)) { + result = { + name: 'UC Browser' + , ucbrowser: t + , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i) + } + } else if (/windows phone/i.test(ua)) { result = { name: 'Windows Phone' diff --git a/src/useragents.js b/src/useragents.js index 9a4263a..642a035 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -970,5 +970,26 @@ module.exports.useragents = { , version: '2.15' , x: true } - } + }, + "UC Browser": { + 'Mozilla/5.0 (iPad; U; CPU OS 9 like Mac OS X; en-us; iPad4,4) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/2.4.0.367 U3/1 Safari/7543.48.3': { + ucbrowser: true, + version: '2.4.0.367', + webkit: true, + ipad: true, + ios: true, + osversion: 9, + tablet: true, + a: true + }, + 'Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; SM-T210R Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 UCBrowser/2.3.2.300': { + android: true, + osversion: '4.1.2', + tablet: true, + ucbrowser: true, + version: '2.3.2.300', + webkit: true, + x: true + } + } }; From d22d9207cbfd531e253bf0fce281f5d94631d7b5 Mon Sep 17 00:00:00 2001 From: Jose Tavares Date: Sun, 18 Oct 2015 20:21:29 +0100 Subject: [PATCH 04/24] fix #100 - Exception with QupZilla --- README.md | 1 + src/bowser.js | 7 +++++++ src/useragents.js | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4585f43..8511578 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ if (bowser.msie && bowser.version <= 6) { * Bada browser as `bada`[`webkit`] * Tizen browser as `tizen`[`webkit`] * Sailfish browser as `sailfish`[`gecko`] + * QupZilla browser as `qupzilla`[`webkit`] For all detected browsers the browser version is set in the `version` field. diff --git a/src/bowser.js b/src/bowser.js index cefeee2..83c9bc0 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -168,6 +168,13 @@ , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier }; } + else if (/qupzilla/i.test(ua)) { + result = { + name: 'QupZilla' + , qupzilla: t + , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier + } + } else if (/safari/i.test(ua)) { result = { name: 'Safari' diff --git a/src/useragents.js b/src/useragents.js index 9a4263a..e5c5489 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -970,5 +970,20 @@ module.exports.useragents = { , version: '2.15' , x: true } - } + }, + "QupZilla": { + 'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.8.2 Safari/538.1': { + qupzilla: true, + version: '1.8.2', + webkit: true, + x: true + }, + 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) QupZilla/1.8.6 Safari/537.21': { + qupzilla: true, + version: '1.8.6', + webkit: true, + x: true + } + +} }; From e543098ad825dec9b3e1f6672c19dd1f41b69927 Mon Sep 17 00:00:00 2001 From: Michael Cole Date: Fri, 6 Nov 2015 11:52:11 -0600 Subject: [PATCH 05/24] Update README.md --- README.md | 129 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 6ecd78c..c76ccfa 100644 --- a/README.md +++ b/README.md @@ -14,49 +14,31 @@ if (bowser.msie && bowser.version <= 6) { ## 1.0.0 breaking changes `browser = require('bowser').browser;` becomes `browser = require('bowser');` -## Flags set for detected Browsers[Engines] +## Bowser Flags +Your mileage may vary, but these flags should be set. See Contributing below. - * `chrome`[`webkit`] - * `firefox`[`gecko`] - * `msie` - * `msedge` - * Android native browser as `android`[`webkit`] - * iOS native browser as `ios`[`webkit`] - * `opera`[`webkit` if >12] - * `phantom`[`webkit`] - * `safari`[`webkit`] - * `seamonkey`[`gecko`] - * BlackBerry native browser as `blackberry`[`webkit`] - * WebOS native browser as `webos`[`webkit`] - * Amazon Kindle browser as `silk`[`webkit`] - * Bada browser as `bada`[`webkit`] - * Tizen browser as `tizen`[`webkit`] - * Sailfish browser as `sailfish`[`gecko`] +``` js +alert('Hello ' + bowser.name + ' ' + bowser.version); +``` -For all detected browsers the browser version is set in the `version` field. +### All detected browsers +These flags are set for all detected browsers: -## Flags set for detected Operating Systems +* `name` - A human readable name for this browser. E.g. 'Chrome', '' +* `version` - Version number for the browser. E.g. '32.0' - * `mac` - * Windows other than Windows Phone as `windows` - * Windows Phone as `windowsphone` - * `linux` for Linux other than `android`, `chromeos`, `webos`, `tizen`, and `sailfish` - * `chromeos` - * `android` - * `ios` (`iphone`/`ipad`/`ipod`) - * `blackberry` - * `firefoxos` - * `webos` (`touchpad`) - * `bada` - * `tizen` - * `sailfish` +Bowser makes a best guess to match name and version for unknown UA strings, so they may not be set. -Android, iOS, Windows Phone, WebOS, Bada, and Tizen will all report the OS version number if it is contained in the UA string in the `osversion` field. iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whichever one matches best. If WebOS device is an HP TouchPad the flag `touchpad` is additionally set. +### Rendering Engine Flags +If detected, one of these flags may be set to true: -All detected mobile OSes are additionally flagged `mobile`, **if they are not powering a tablet device**. If a tablet device is detected, the flag `tablet` is set instead. + * `webkit` - Chrome, Android, iOs, BB, etc. + * `gecko` - Firefox, etc. + * `msie` - IE <= 11 + * `msedge` - IE > 11 -### Notes -Safari, Chrome and some other minor browsers will report that they have `webkit` engines, Firefox and Seamonkey will report that they have `gecko` engines. +Safari, Chrome and some other minor browsers will report that they have `webkit` engines. +Firefox and Seamonkey will report that they have `gecko` engines. ``` js if (bowser.webkit) { @@ -64,6 +46,67 @@ if (bowser.webkit) { } ``` +### Device flags +If detected, one of these flags may be set to true: + + * `mobile` - All detected mobile OSes are additionally flagged `mobile`, **unless it's a tablet** + * `tablet` - If a tablet device is detected, the flag `tablet` is set **instead of `mobile`**. + +### Browsers flags +If detected, one of these flags may be set to true. The rendering engine flag is shown in []'s: + + * `chrome` - [`webkit`] + * `firefox` - [`gecko`] + * `msie` + * `msedge` + * `safari` - [`webkit`] + * `android` native browser - [`webkit`] + * `ios` native browser - [`webkit`] + * `opera` - [`webkit` if >12] + * `phantom` - [`webkit`] + * `blackberry` native browser - [`webkit`] + * `webos` native browser - [`webkit`] + * `silk` Amazon Kindle browser - [`webkit`] + * `bada` - [`webkit`] + * `tizen` - [`webkit`] + * `seamonkey` - [`gecko`] + * `sailfish` - [`gecko`] + +For all detected browsers the browser version is set in the `version` field. + +### OS Flags +If detected, one of these flags may be set to true: + + * `mac` + * `windows` - other than Windows Phone + * `windowsphone` + * `linux` - other than `android`, `chromeos`, `webos`, `tizen`, and `sailfish` + * `chromeos` + * `android` + * `ios` - also sets one of `iphone`/`ipad`/`ipod` + * `blackberry` + * `firefoxos` + * `webos` - may also set `touchpad` + * `bada` + * `tizen` + * `sailfish` + +`osversion` may also be set: + + * `osversion` - for Android, iOS, Windows Phone, WebOS, Bada, and Tizen. If included in UA string. + +iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whichever one matches best. +If WebOS device is an HP TouchPad the flag `touchpad` is additionally set. + +### Browser capability grading +One of these flags will be set: + + * `a` - This browser has full capabilities + * `c` - This browser has degraded capabilities. Serve simpler version + * `x` - This browser has minimal capabilities and is probably not well detected. + +There is no `b`. + ### Ender Support `package.json` @@ -80,20 +123,6 @@ if (require('bowser').chrome) { } ``` -### Graded Browser Support - -``` js -if (bowser.a) { - // support full feature set -} -else if (bowser.c) { - // serve degraded version -} -else { - // unsupported (bowser.x) -} -``` - ### Contributing If you'd like to contribute a change to bowser, modify the files in `src/`, then run the following (you'll need node + npm installed): From a82606b0b2fb4d888cd6602c739dcb3b748f5110 Mon Sep 17 00:00:00 2001 From: Michael Cole Date: Fri, 6 Nov 2015 11:58:50 -0600 Subject: [PATCH 06/24] Update README.md --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c76ccfa..e37e23b 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ These flags are set for all detected browsers: * `name` - A human readable name for this browser. E.g. 'Chrome', '' * `version` - Version number for the browser. E.g. '32.0' -Bowser makes a best guess to match name and version for unknown UA strings, so they may not be set. +For unknown browsers, Bowser makes a best guess from the UA string. So, these may not be set. -### Rendering Engine Flags +### Engine flags If detected, one of these flags may be set to true: * `webkit` - Chrome, Android, iOs, BB, etc. @@ -50,23 +50,23 @@ if (bowser.webkit) { If detected, one of these flags may be set to true: * `mobile` - All detected mobile OSes are additionally flagged `mobile`, **unless it's a tablet** - * `tablet` - If a tablet device is detected, the flag `tablet` is set **instead of `mobile`**. + * `tablet` - If a tablet device is detected, the flag `tablet` is **set instead of `mobile`**. -### Browsers flags -If detected, one of these flags may be set to true. The rendering engine flag is shown in []'s: +### Browser flags +If detected, one of these flags may be set to true. The engine flag is shown in []'s: * `chrome` - [`webkit`] * `firefox` - [`gecko`] * `msie` * `msedge` * `safari` - [`webkit`] - * `android` native browser - [`webkit`] - * `ios` native browser - [`webkit`] + * `android` - native browser - [`webkit`] + * `ios` - native browser - [`webkit`] * `opera` - [`webkit` if >12] * `phantom` - [`webkit`] - * `blackberry` native browser - [`webkit`] - * `webos` native browser - [`webkit`] - * `silk` Amazon Kindle browser - [`webkit`] + * `blackberry` - native browser - [`webkit`] + * `webos` - native browser - [`webkit`] + * `silk` - Amazon Kindle browser - [`webkit`] * `bada` - [`webkit`] * `tizen` - [`webkit`] * `seamonkey` - [`gecko`] @@ -99,13 +99,13 @@ iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whic If WebOS device is an HP TouchPad the flag `touchpad` is additionally set. ### Browser capability grading -One of these flags will be set: +One of these flags may be set: * `a` - This browser has full capabilities * `c` - This browser has degraded capabilities. Serve simpler version * `x` - This browser has minimal capabilities and is probably not well detected. -There is no `b`. +There is no `b`. For unknown browsers, none of these flags may be set. ### Ender Support From 80d0934c006c282ebab35711e47afc8ba81e3736 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:06:51 -0500 Subject: [PATCH 07/24] Added Vivaldi headers. --- src/useragents.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/useragents.js b/src/useragents.js index de560c4..d7e2976 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -1021,6 +1021,22 @@ module.exports.useragents = { , x: true } } + , Vivaldi: { + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.303.52' : { + vivaldi: true + , version: '1.0' + , mac: true + , webkit: true + , a: true + }, + 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.303.52': { + vivaldi: true + , version: '1.0' + , windows: true + , webkit: true + , c: true + } + } , Generic: { 'Generic/2.15 libww': { name: 'Generic' From fb5ddeadcb5fc70bb058e7d607297d17ab819420 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:09:18 -0500 Subject: [PATCH 08/24] Added Vivaldi case. --- src/bowser.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bowser.js b/src/bowser.js index fa4f666..6ea2b31 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -88,6 +88,13 @@ , version: edgeVersion } } + else if (/vivaldi/i.test(ua)) { + result = { + name: 'Vivaldi' + , vivaldi: t + , version: versionIdentifier + } + } else if (/chrome|crios|crmo/i.test(ua)) { result = { name: 'Chrome' From 87935f0e2db134b4131e858b02091c672d48246a Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:09:40 -0500 Subject: [PATCH 09/24] Docs for Vivaldi browser. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6ecd78c..3294106 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ if (bowser.msie && bowser.version <= 6) { ## Flags set for detected Browsers[Engines] + * `vivaldi`[`webkit`] * `chrome`[`webkit`] * `firefox`[`gecko`] * `msie` From 14f16d6120f0addec27addaa4e8636fcb6717efb Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:12:18 -0500 Subject: [PATCH 10/24] Trying to get version number to validate. --- src/bowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bowser.js b/src/bowser.js index 6ea2b31..85d5a3f 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -92,7 +92,7 @@ result = { name: 'Vivaldi' , vivaldi: t - , version: versionIdentifier + , version: versionIdentifier || getFirstMatch(/vivaldi[\d]+\/(\d+(\.\d+)?)/i) } } else if (/chrome|crios|crmo/i.test(ua)) { From b01795c47571a4354ff6a798d5bb2537c6ac7d55 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:13:48 -0500 Subject: [PATCH 11/24] Fixed typo. --- src/useragents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/useragents.js b/src/useragents.js index d7e2976..64d6232 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -1034,7 +1034,7 @@ module.exports.useragents = { , version: '1.0' , windows: true , webkit: true - , c: true + , a: true } } , Generic: { From b98e37c6ac1dd13fff313010b67478403ede3fc3 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:17:10 -0500 Subject: [PATCH 12/24] Vivaldi version number is now parsed correctly. --- src/bowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bowser.js b/src/bowser.js index 85d5a3f..4448d3c 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -92,7 +92,7 @@ result = { name: 'Vivaldi' , vivaldi: t - , version: versionIdentifier || getFirstMatch(/vivaldi[\d]+\/(\d+(\.\d+)?)/i) + , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier } } else if (/chrome|crios|crmo/i.test(ua)) { From 23697032da5a3a326bff42e19eda7101f8f112d3 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:19:56 -0500 Subject: [PATCH 13/24] Added support for grade a. --- src/bowser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bowser.js b/src/bowser.js index 4448d3c..7c92ce5 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -260,6 +260,7 @@ if (result.msedge || (result.msie && result.version >= 10) || (result.yandexbrowser && result.version >= 15) || + (result.vivaldi && result.version >= 1.0) || (result.chrome && result.version >= 20) || (result.firefox && result.version >= 20.0) || (result.safari && result.version >= 6) || From 1d39dcabbe3c7d43219efcfdbcdb5667d03473cd Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 16:54:22 -0500 Subject: [PATCH 14/24] Compiled. --- bowser.js | 37 ++++++++++++++++++++++++++++++------- bowser.min.js | 2 +- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/bowser.js b/bowser.js index 0f09bf3..d2ee431 100644 --- a/bowser.js +++ b/bowser.js @@ -30,7 +30,15 @@ var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() , likeAndroid = /like android/i.test(ua) , android = !likeAndroid && /android/i.test(ua) - , chromeBook = /CrOS/.test(ua) + , chromeos = /CrOS/.test(ua) + , silk = /silk/i.test(ua) + , sailfish = /sailfish/i.test(ua) + , tizen = /tizen/i.test(ua) + , webos = /(web|hpw)os/i.test(ua) + , windowsphone = /windows phone/i.test(ua) + , windows = !windowsphone && /windows/i.test(ua) + , mac = !iosdevice && !silk && /macintosh/i.test(ua) + , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua) , edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i) , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) , tablet = /tablet/i.test(ua) @@ -51,7 +59,7 @@ , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i) } } - else if (/windows phone/i.test(ua)) { + else if (windowsphone) { result = { name: 'Windows Phone' , windowsphone: t @@ -71,9 +79,10 @@ , msie: t , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) } - } else if (chromeBook) { + } else if (chromeos) { result = { name: 'Chrome' + , chromeos: t , chromeBook: t , chrome: t , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) @@ -85,6 +94,13 @@ , version: edgeVersion } } + else if (/vivaldi/i.test(ua)) { + result = { + name: 'Vivaldi' + , vivaldi: t + , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier + } + } else if (/chrome|crios|crmo/i.test(ua)) { result = { name: 'Chrome' @@ -101,7 +117,7 @@ result.version = versionIdentifier } } - else if (/sailfish/i.test(ua)) { + else if (sailfish) { result = { name: 'Sailfish' , sailfish: t @@ -125,7 +141,7 @@ result.firefoxos = t } } - else if (/silk/i.test(ua)) { + else if (silk) { result = { name: 'Amazon Silk' , silk: t @@ -152,7 +168,7 @@ , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i) } } - else if (/(web|hpw)os/i.test(ua)) { + else if (webos) { result = { name: 'WebOS' , webos: t @@ -167,7 +183,7 @@ , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i) }; } - else if (/tizen/i.test(ua)) { + else if (tizen) { result = { name: 'Tizen' , tizen: t @@ -207,6 +223,12 @@ } else if (iosdevice) { result[iosdevice] = t result.ios = t + } else if (windows) { + result.windows = t + } else if (mac) { + result.mac = t + } else if (linux) { + result.linux = t } // OS version extraction @@ -244,6 +266,7 @@ if (result.msedge || (result.msie && result.version >= 10) || (result.yandexbrowser && result.version >= 15) || + (result.vivaldi && result.version >= 1.0) || (result.chrome && result.version >= 20) || (result.firefox && result.version >= 20.0) || (result.safari && result.version >= 6) || diff --git a/bowser.min.js b/bowser.min.js index 66a3cdf..27a37c3 100644 --- a/bowser.min.js +++ b/bowser.min.js @@ -3,4 +3,4 @@ * https://github.com/ded/bowser * MIT License | (c) Dustin Diaz 2015 */ -!function(e,t){typeof module!="undefined"&&module.exports?module.exports=t():typeof define=="function"&&define.amd?define(t):this[e]=t()}("bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}function r(e){var n=t.match(e);return n&&n.length>1&&n[2]||""}var i=n(/(ipod|iphone|ipad)/i).toLowerCase(),s=/like android/i.test(t),o=!s&&/android/i.test(t),u=/CrOS/.test(t),a=n(/edge\/(\d+(\.\d+)?)/i),f=n(/version\/(\d+(\.\d+)?)/i),l=/tablet/i.test(t),c=!l&&/[^-]mobi/i.test(t),h;/opera|opr/i.test(t)?h={name:"Opera",opera:e,version:f||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(t)?h={name:"Yandex Browser",yandexbrowser:e,version:f||n(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(t)?(h={name:"Windows Phone",windowsphone:e},a?(h.msedge=e,h.version=a):(h.msie=e,h.version=n(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(t)?h={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:u?h={name:"Chrome",chromeBook:e,chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(t)?h={name:"Microsoft Edge",msedge:e,version:a}:/chrome|crios|crmo/i.test(t)?h={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:i?(h={name:i=="iphone"?"iPhone":i=="ipad"?"iPad":"iPod"},f&&(h.version=f)):/sailfish/i.test(t)?h={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?h={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(h={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(h.firefoxos=e)):/silk/i.test(t)?h={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:o?h={name:"Android",version:f}:/phantom/i.test(t)?h={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?h={name:"BlackBerry",blackberry:e,version:f||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(t)?(h={name:"WebOS",webos:e,version:f||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(h.touchpad=e)):/bada/i.test(t)?h={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(t)?h={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||f}:/safari/i.test(t)?h={name:"Safari",safari:e,version:f}:h={name:n(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!h.msedge&&/(apple)?webkit/i.test(t)?(h.name=h.name||"Webkit",h.webkit=e,!h.version&&f&&(h.version=f)):!h.opera&&/gecko\//i.test(t)&&(h.name=h.name||"Gecko",h.gecko=e,h.version=h.version||n(/gecko\/(\d+(\.\d+)?)/i)),!h.msedge&&(o||h.silk)?h.android=e:i&&(h[i]=e,h.ios=e);var p="";h.windowsphone?p=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):i?(p=n(/os (\d+([_\s]\d+)*) like mac os x/i),p=p.replace(/[_\s]/g,".")):o?p=n(/android[ \/-](\d+(\.\d+)*)/i):h.webos?p=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):h.blackberry?p=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):h.bada?p=n(/bada\/(\d+(\.\d+)*)/i):h.tizen&&(p=n(/tizen[\/\s](\d+(\.\d+)*)/i)),p&&(h.osversion=p);var d=p.split(".")[0];if(l||i=="ipad"||o&&(d==3||d==4&&!c)||h.silk)h.tablet=e;else if(c||i=="iphone"||i=="ipod"||o||h.blackberry||h.webos||h.bada)h.mobile=e;return h.msedge||h.msie&&h.version>=10||h.yandexbrowser&&h.version>=15||h.chrome&&h.version>=20||h.firefox&&h.version>=20||h.safari&&h.version>=6||h.opera&&h.version>=10||h.ios&&h.osversion&&h.osversion.split(".")[0]>=6||h.blackberry&&h.version>=10.1?h.a=e:h.msie&&h.version<10||h.chrome&&h.version<20||h.firefox&&h.version<20||h.safari&&h.version<6||h.opera&&h.version<10||h.ios&&h.osversion&&h.osversion.split(".")[0]<6?h.c=e:h.x=e,h}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n.test=function(e){for(var t=0;t1&&n[1]||""}function r(e){var n=t.match(e);return n&&n.length>1&&n[2]||""}var i=n(/(ipod|iphone|ipad)/i).toLowerCase(),s=/like android/i.test(t),o=!s&&/android/i.test(t),u=/CrOS/.test(t),a=/silk/i.test(t),f=/sailfish/i.test(t),l=/tizen/i.test(t),c=/(web|hpw)os/i.test(t),h=/windows phone/i.test(t),p=!h&&/windows/i.test(t),d=!i&&!a&&/macintosh/i.test(t),v=!o&&!f&&!l&&!c&&/linux/i.test(t),m=n(/edge\/(\d+(\.\d+)?)/i),g=n(/version\/(\d+(\.\d+)?)/i),y=/tablet/i.test(t),b=!y&&/[^-]mobi/i.test(t),w;/opera|opr/i.test(t)?w={name:"Opera",opera:e,version:g||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(t)?w={name:"Yandex Browser",yandexbrowser:e,version:g||n(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:h?(w={name:"Windows Phone",windowsphone:e},m?(w.msedge=e,w.version=m):(w.msie=e,w.version=n(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(t)?w={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:u?w={name:"Chrome",chromeos:e,chromeBook:e,chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(t)?w={name:"Microsoft Edge",msedge:e,version:m}:/vivaldi/i.test(t)?w={name:"Vivaldi",vivaldi:e,version:n(/vivaldi\/(\d+(\.\d+)?)/i)||g}:/chrome|crios|crmo/i.test(t)?w={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:i?(w={name:i=="iphone"?"iPhone":i=="ipad"?"iPad":"iPod"},g&&(w.version=g)):f?w={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?w={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(w={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(w.firefoxos=e)):a?w={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:o?w={name:"Android",version:g}:/phantom/i.test(t)?w={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?w={name:"BlackBerry",blackberry:e,version:g||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:c?(w={name:"WebOS",webos:e,version:g||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(w.touchpad=e)):/bada/i.test(t)?w={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:l?w={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||g}:/safari/i.test(t)?w={name:"Safari",safari:e,version:g}:w={name:n(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!w.msedge&&/(apple)?webkit/i.test(t)?(w.name=w.name||"Webkit",w.webkit=e,!w.version&&g&&(w.version=g)):!w.opera&&/gecko\//i.test(t)&&(w.name=w.name||"Gecko",w.gecko=e,w.version=w.version||n(/gecko\/(\d+(\.\d+)?)/i)),!w.msedge&&(o||w.silk)?w.android=e:i?(w[i]=e,w.ios=e):p?w.windows=e:d?w.mac=e:v&&(w.linux=e);var E="";w.windowsphone?E=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):i?(E=n(/os (\d+([_\s]\d+)*) like mac os x/i),E=E.replace(/[_\s]/g,".")):o?E=n(/android[ \/-](\d+(\.\d+)*)/i):w.webos?E=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):w.blackberry?E=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):w.bada?E=n(/bada\/(\d+(\.\d+)*)/i):w.tizen&&(E=n(/tizen[\/\s](\d+(\.\d+)*)/i)),E&&(w.osversion=E);var S=E.split(".")[0];if(y||i=="ipad"||o&&(S==3||S==4&&!b)||w.silk)w.tablet=e;else if(b||i=="iphone"||i=="ipod"||o||w.blackberry||w.webos||w.bada)w.mobile=e;return w.msedge||w.msie&&w.version>=10||w.yandexbrowser&&w.version>=15||w.vivaldi&&w.version>=1||w.chrome&&w.version>=20||w.firefox&&w.version>=20||w.safari&&w.version>=6||w.opera&&w.version>=10||w.ios&&w.osversion&&w.osversion.split(".")[0]>=6||w.blackberry&&w.version>=10.1?w.a=e:w.msie&&w.version<10||w.chrome&&w.version<20||w.firefox&&w.version<20||w.safari&&w.version<6||w.opera&&w.version<10||w.ios&&w.osversion&&w.osversion.split(".")[0]<6?w.c=e:w.x=e,w}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n.test=function(e){for(var t=0;t Date: Wed, 27 Jan 2016 10:14:11 +0100 Subject: [PATCH 15/24] fix nexus 7 to 9 considered as a mobile --- src/bowser.js | 4 +++- src/useragents.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/bowser.js b/src/bowser.js index fa4f666..49f2fdf 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -24,6 +24,8 @@ var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() , likeAndroid = /like android/i.test(ua) , android = !likeAndroid && /android/i.test(ua) + , nexusMobile = /nexus\s*[4-6]\s*/i.test(ua) + , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua) , chromeos = /CrOS/.test(ua) , silk = /silk/i.test(ua) , sailfish = /sailfish/i.test(ua) @@ -242,7 +244,7 @@ // device type extraction var osMajorVersion = osVersion.split('.')[0]; - if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) { + if (tablet || nexusTablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) { result.tablet = t } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) { result.mobile = t diff --git a/src/useragents.js b/src/useragents.js index de560c4..20c43ba 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -7,7 +7,16 @@ */ module.exports.useragents = { Chrome: { - 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 7 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Safari/537.36': { + 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 9 Build/LMY48T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36': { + chrome: true + , android: true + , osversion: '5.1.1' + , tablet: true + , version: '47.0' + , webkit: true + , a: true + } + , 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 7 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Safari/537.36': { chrome: true , android: true , osversion: '4.4.2' @@ -884,7 +893,7 @@ module.exports.useragents = { , osversion: '4.4.2' , webkit: true , version: 4.0 - , mobile: true + , tablet: true , x: true } , 'Mozilla/5.0 (Linux; U; Android 4.3; de-de; Galaxy Nexus Build/JWR66Y) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30': { From ad0e2ee63664449c3e0af4111815f768e30a626f Mon Sep 17 00:00:00 2001 From: Damien Saillard Date: Wed, 27 Jan 2016 14:23:38 +0100 Subject: [PATCH 16/24] fix eventual nexus 0 to 3 being mobile --- src/bowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bowser.js b/src/bowser.js index 49f2fdf..72b03b2 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -24,7 +24,7 @@ var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() , likeAndroid = /like android/i.test(ua) , android = !likeAndroid && /android/i.test(ua) - , nexusMobile = /nexus\s*[4-6]\s*/i.test(ua) + , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua) , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua) , chromeos = /CrOS/.test(ua) , silk = /silk/i.test(ua) From 0824814126b8073264c3bdbb0a65b2a05a020399 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Thu, 14 Apr 2016 23:30:27 +0300 Subject: [PATCH 17/24] ignore .idea folder --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b512c09..eb79dd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +.idea From ab52fc9220c662c1f26ead9acfd144987188c11a Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Thu, 14 Apr 2016 23:44:03 +0300 Subject: [PATCH 18/24] add .editorconfig --- .editorconfig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7a0e19f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.js] +charset = utf-8 +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab + +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 From d8c3e907bebbc92f2ae8c6f52505916b80e1ca6f Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Sat, 16 Apr 2016 18:49:14 +0300 Subject: [PATCH 19/24] add .md to editorconfig --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 7a0e19f..a11eb44 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true end_of_line = lf insert_final_newline = true -[*.js] +[{*.js,*.md}] charset = utf-8 indent_style = space indent_size = 2 From 5b67843977831c25c202f452994f8dc3b279e3ab Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Sat, 16 Apr 2016 19:00:31 +0300 Subject: [PATCH 20/24] add nexus mobile to detection --- src/bowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bowser.js b/src/bowser.js index 0ddf1fa..6958250 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -274,7 +274,7 @@ var osMajorVersion = osVersion.split('.')[0]; if (tablet || nexusTablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) { result.tablet = t - } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) { + } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || nexusMobile || result.blackberry || result.webos || result.bada) { result.mobile = t } From 80af7747244fa867cc5da3f4e7d3a3eeeb8dc991 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Fri, 6 May 2016 21:29:22 +0300 Subject: [PATCH 21/24] remove minified file from git --- .gitignore | 2 + README.md | 4 + bowser.js | 314 ----------------------------------------------- bowser.min.js | 6 - make/build.js | 3 +- src/bowser.js | 6 + src/copyright.js | 5 - 7 files changed, 13 insertions(+), 327 deletions(-) delete mode 100644 bowser.js delete mode 100644 bowser.min.js diff --git a/.gitignore b/.gitignore index eb79dd5..f95e122 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules .idea +/bowser.js +/bowser.min.js diff --git a/README.md b/README.md index c8b3317..7eaf30b 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ if (bowser.msie && bowser.version <= 6) { } ``` +## 1.1.0 breaking changes +We don't save built script in the repo anymore. The main file (`src/bowser.js`) is available through NPM or Bower. +Also you can download minified file from [the release page](https://github.com/ded/bowser/releases). + ## 1.0.0 breaking changes `browser = require('bowser').browser;` becomes `browser = require('bowser');` diff --git a/bowser.js b/bowser.js deleted file mode 100644 index d2ee431..0000000 --- a/bowser.js +++ /dev/null @@ -1,314 +0,0 @@ -/*! - * Bowser - a browser detector - * https://github.com/ded/bowser - * MIT License | (c) Dustin Diaz 2015 - */ - -!function (name, definition) { - if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (typeof define == 'function' && define.amd) define(definition) - else this[name] = definition() -}('bowser', function () { - /** - * See useragents.js for examples of navigator.userAgent - */ - - var t = true - - function detect(ua) { - - function getFirstMatch(regex) { - var match = ua.match(regex); - return (match && match.length > 1 && match[1]) || ''; - } - - function getSecondMatch(regex) { - var match = ua.match(regex); - return (match && match.length > 1 && match[2]) || ''; - } - - var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() - , likeAndroid = /like android/i.test(ua) - , android = !likeAndroid && /android/i.test(ua) - , chromeos = /CrOS/.test(ua) - , silk = /silk/i.test(ua) - , sailfish = /sailfish/i.test(ua) - , tizen = /tizen/i.test(ua) - , webos = /(web|hpw)os/i.test(ua) - , windowsphone = /windows phone/i.test(ua) - , windows = !windowsphone && /windows/i.test(ua) - , mac = !iosdevice && !silk && /macintosh/i.test(ua) - , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua) - , edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i) - , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) - , tablet = /tablet/i.test(ua) - , mobile = !tablet && /[^-]mobi/i.test(ua) - , result - - if (/opera|opr/i.test(ua)) { - result = { - name: 'Opera' - , opera: t - , version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i) - } - } - else if (/yabrowser/i.test(ua)) { - result = { - name: 'Yandex Browser' - , yandexbrowser: t - , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i) - } - } - else if (windowsphone) { - result = { - name: 'Windows Phone' - , windowsphone: t - } - if (edgeVersion) { - result.msedge = t - result.version = edgeVersion - } - else { - result.msie = t - result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i) - } - } - else if (/msie|trident/i.test(ua)) { - result = { - name: 'Internet Explorer' - , msie: t - , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) - } - } else if (chromeos) { - result = { - name: 'Chrome' - , chromeos: t - , chromeBook: t - , chrome: t - , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) - } - } else if (/chrome.+? edge/i.test(ua)) { - result = { - name: 'Microsoft Edge' - , msedge: t - , version: edgeVersion - } - } - else if (/vivaldi/i.test(ua)) { - result = { - name: 'Vivaldi' - , vivaldi: t - , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier - } - } - else if (/chrome|crios|crmo/i.test(ua)) { - result = { - name: 'Chrome' - , chrome: t - , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) - } - } - else if (iosdevice) { - result = { - name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod' - } - // WTF: version is not part of user agent in web apps - if (versionIdentifier) { - result.version = versionIdentifier - } - } - else if (sailfish) { - result = { - name: 'Sailfish' - , sailfish: t - , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i) - } - } - else if (/seamonkey\//i.test(ua)) { - result = { - name: 'SeaMonkey' - , seamonkey: t - , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i) - } - } - else if (/firefox|iceweasel/i.test(ua)) { - result = { - name: 'Firefox' - , firefox: t - , version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i) - } - if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) { - result.firefoxos = t - } - } - else if (silk) { - result = { - name: 'Amazon Silk' - , silk: t - , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i) - } - } - else if (android) { - result = { - name: 'Android' - , version: versionIdentifier - } - } - else if (/phantom/i.test(ua)) { - result = { - name: 'PhantomJS' - , phantom: t - , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i) - } - } - else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) { - result = { - name: 'BlackBerry' - , blackberry: t - , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i) - } - } - else if (webos) { - result = { - name: 'WebOS' - , webos: t - , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i) - }; - /touchpad\//i.test(ua) && (result.touchpad = t) - } - else if (/bada/i.test(ua)) { - result = { - name: 'Bada' - , bada: t - , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i) - }; - } - else if (tizen) { - result = { - name: 'Tizen' - , tizen: t - , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier - }; - } - else if (/safari/i.test(ua)) { - result = { - name: 'Safari' - , safari: t - , version: versionIdentifier - } - } - else { - result = { - name: getFirstMatch(/^(.*)\/(.*) /), - version: getSecondMatch(/^(.*)\/(.*) /) - }; - } - - // set webkit or gecko flag for browsers based on these engines - if (!result.msedge && /(apple)?webkit/i.test(ua)) { - result.name = result.name || "Webkit" - result.webkit = t - if (!result.version && versionIdentifier) { - result.version = versionIdentifier - } - } else if (!result.opera && /gecko\//i.test(ua)) { - result.name = result.name || "Gecko" - result.gecko = t - result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i) - } - - // set OS flags for platforms that have multiple browsers - if (!result.msedge && (android || result.silk)) { - result.android = t - } else if (iosdevice) { - result[iosdevice] = t - result.ios = t - } else if (windows) { - result.windows = t - } else if (mac) { - result.mac = t - } else if (linux) { - result.linux = t - } - - // OS version extraction - var osVersion = ''; - if (result.windowsphone) { - osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i); - } else if (iosdevice) { - osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i); - osVersion = osVersion.replace(/[_\s]/g, '.'); - } else if (android) { - osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i); - } else if (result.webos) { - osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i); - } else if (result.blackberry) { - osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i); - } else if (result.bada) { - osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i); - } else if (result.tizen) { - osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i); - } - if (osVersion) { - result.osversion = osVersion; - } - - // device type extraction - var osMajorVersion = osVersion.split('.')[0]; - if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) { - result.tablet = t - } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) { - result.mobile = t - } - - // Graded Browser Support - // http://developer.yahoo.com/yui/articles/gbs - if (result.msedge || - (result.msie && result.version >= 10) || - (result.yandexbrowser && result.version >= 15) || - (result.vivaldi && result.version >= 1.0) || - (result.chrome && result.version >= 20) || - (result.firefox && result.version >= 20.0) || - (result.safari && result.version >= 6) || - (result.opera && result.version >= 10.0) || - (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) || - (result.blackberry && result.version >= 10.1) - ) { - result.a = t; - } - else if ((result.msie && result.version < 10) || - (result.chrome && result.version < 20) || - (result.firefox && result.version < 20.0) || - (result.safari && result.version < 6) || - (result.opera && result.version < 10.0) || - (result.ios && result.osversion && result.osversion.split(".")[0] < 6) - ) { - result.c = t - } else result.x = t - - return result - } - - var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '') - - bowser.test = function (browserList) { - for (var i = 0; i < browserList.length; ++i) { - var browserItem = browserList[i]; - if (typeof browserItem=== 'string') { - if (browserItem in bowser) { - return true; - } - } - } - return false; - } - - /* - * Set our detect method to the main bowser object so we can - * reuse it to test other user agents. - * This is needed to implement future tests. - */ - bowser._detect = detect; - - return bowser -}); diff --git a/bowser.min.js b/bowser.min.js deleted file mode 100644 index 27a37c3..0000000 --- a/bowser.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bowser - a browser detector - * https://github.com/ded/bowser - * MIT License | (c) Dustin Diaz 2015 - */ -!function(e,t){typeof module!="undefined"&&module.exports?module.exports=t():typeof define=="function"&&define.amd?define(t):this[e]=t()}("bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}function r(e){var n=t.match(e);return n&&n.length>1&&n[2]||""}var i=n(/(ipod|iphone|ipad)/i).toLowerCase(),s=/like android/i.test(t),o=!s&&/android/i.test(t),u=/CrOS/.test(t),a=/silk/i.test(t),f=/sailfish/i.test(t),l=/tizen/i.test(t),c=/(web|hpw)os/i.test(t),h=/windows phone/i.test(t),p=!h&&/windows/i.test(t),d=!i&&!a&&/macintosh/i.test(t),v=!o&&!f&&!l&&!c&&/linux/i.test(t),m=n(/edge\/(\d+(\.\d+)?)/i),g=n(/version\/(\d+(\.\d+)?)/i),y=/tablet/i.test(t),b=!y&&/[^-]mobi/i.test(t),w;/opera|opr/i.test(t)?w={name:"Opera",opera:e,version:g||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(t)?w={name:"Yandex Browser",yandexbrowser:e,version:g||n(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:h?(w={name:"Windows Phone",windowsphone:e},m?(w.msedge=e,w.version=m):(w.msie=e,w.version=n(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(t)?w={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:u?w={name:"Chrome",chromeos:e,chromeBook:e,chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(t)?w={name:"Microsoft Edge",msedge:e,version:m}:/vivaldi/i.test(t)?w={name:"Vivaldi",vivaldi:e,version:n(/vivaldi\/(\d+(\.\d+)?)/i)||g}:/chrome|crios|crmo/i.test(t)?w={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:i?(w={name:i=="iphone"?"iPhone":i=="ipad"?"iPad":"iPod"},g&&(w.version=g)):f?w={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?w={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(w={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(w.firefoxos=e)):a?w={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:o?w={name:"Android",version:g}:/phantom/i.test(t)?w={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?w={name:"BlackBerry",blackberry:e,version:g||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:c?(w={name:"WebOS",webos:e,version:g||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(w.touchpad=e)):/bada/i.test(t)?w={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:l?w={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||g}:/safari/i.test(t)?w={name:"Safari",safari:e,version:g}:w={name:n(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!w.msedge&&/(apple)?webkit/i.test(t)?(w.name=w.name||"Webkit",w.webkit=e,!w.version&&g&&(w.version=g)):!w.opera&&/gecko\//i.test(t)&&(w.name=w.name||"Gecko",w.gecko=e,w.version=w.version||n(/gecko\/(\d+(\.\d+)?)/i)),!w.msedge&&(o||w.silk)?w.android=e:i?(w[i]=e,w.ios=e):p?w.windows=e:d?w.mac=e:v&&(w.linux=e);var E="";w.windowsphone?E=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):i?(E=n(/os (\d+([_\s]\d+)*) like mac os x/i),E=E.replace(/[_\s]/g,".")):o?E=n(/android[ \/-](\d+(\.\d+)*)/i):w.webos?E=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):w.blackberry?E=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):w.bada?E=n(/bada\/(\d+(\.\d+)*)/i):w.tizen&&(E=n(/tizen[\/\s](\d+(\.\d+)*)/i)),E&&(w.osversion=E);var S=E.split(".")[0];if(y||i=="ipad"||o&&(S==3||S==4&&!b)||w.silk)w.tablet=e;else if(b||i=="iphone"||i=="ipod"||o||w.blackberry||w.webos||w.bada)w.mobile=e;return w.msedge||w.msie&&w.version>=10||w.yandexbrowser&&w.version>=15||w.vivaldi&&w.version>=1||w.chrome&&w.version>=20||w.firefox&&w.version>=20||w.safari&&w.version>=6||w.opera&&w.version>=10||w.ios&&w.osversion&&w.osversion.split(".")[0]>=6||w.blackberry&&w.version>=10.1?w.a=e:w.msie&&w.version<10||w.chrome&&w.version<20||w.firefox&&w.version<20||w.safari&&w.version<6||w.opera&&w.version<10||w.ios&&w.osversion&&w.osversion.split(".")[0]<6?w.c=e:w.x=e,w}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n.test=function(e){for(var t=0;t Date: Fri, 6 May 2016 21:30:35 +0300 Subject: [PATCH 22/24] edit npm package necessary files --- .npmignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..eeec2d7 --- /dev/null +++ b/.npmignore @@ -0,0 +1,3 @@ +make +src/useragents.js +Makefile From 0abf17a0c40a706abf319ba611d7a6fdbd4bcc9c Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Fri, 6 May 2016 21:45:03 +0300 Subject: [PATCH 23/24] fix main file in package managers specs --- bower.json | 5 ++--- package.json | 2 +- src/copyright.js | 0 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 src/copyright.js diff --git a/bower.json b/bower.json index 0f121b8..09980ab 100644 --- a/bower.json +++ b/bower.json @@ -10,18 +10,17 @@ "version": "1.0.0", "homepage": "https://github.com/ded/bowser", "scripts": [ - "bowser.js" + "src/bowser.js" ], "authors": [ "Dustin Diaz (http://dustindiaz.com)" ], "moduleType": [], "license": "MIT", - "main": "bowser.js", + "main": "src/bowser.js", "ignore": [ "node_modules", "test", - "src", "make", "**/.*", "Makefile" diff --git a/package.json b/package.json index 4bd7aeb..d92325d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "version": "1.0.0", "homepage": "https://github.com/ded/bowser", "author": "Dustin Diaz (http://dustindiaz.com)", - "main": "./bowser.js", + "main": "./src/bowser.js", "repository": { "type": "git", "url": "git+https://github.com/ded/bowser.git" diff --git a/src/copyright.js b/src/copyright.js deleted file mode 100644 index e69de29..0000000 From bb115860c49f6b7c94ede8f2a40d49246852fb31 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Fri, 6 May 2016 21:47:56 +0300 Subject: [PATCH 24/24] version bump --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 09980ab..1f3df62 100644 --- a/bower.json +++ b/bower.json @@ -7,7 +7,7 @@ "sniff", "detection" ], - "version": "1.0.0", + "version": "1.1.0", "homepage": "https://github.com/ded/bowser", "scripts": [ "src/bowser.js" diff --git a/package.json b/package.json index d92325d..1ec668e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "sniff", "detection" ], - "version": "1.0.0", + "version": "1.1.0", "homepage": "https://github.com/ded/bowser", "author": "Dustin Diaz (http://dustindiaz.com)", "main": "./src/bowser.js",