From 3acd6fb2bee8a18a0d75c2c13c39375719dd4217 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Fri, 2 Oct 2015 19:25:13 -0400 Subject: [PATCH 1/4] Added useragent for vivaldi. --- src/useragents.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/useragents.js b/src/useragents.js index 9a4263a..9021097 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -964,6 +964,14 @@ module.exports.useragents = { , x: true } } + , Vivaldi: { + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.75 Safari/537.36 Vivaldi/1.0.219.53': { + vivaldi: true + , webkit: true + , version: '1.0' + , a: true + } + } , Generic: { 'Generic/2.15 libww': { name: 'Generic' From f44ec8b813828f02cd1b4c5873469376b3a12412 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Fri, 2 Oct 2015 19:27:15 -0400 Subject: [PATCH 2/4] Added useragent for vivaldi windows. --- src/useragents.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/useragents.js b/src/useragents.js index 9021097..6d17260 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -970,6 +970,12 @@ module.exports.useragents = { , webkit: true , version: '1.0' , a: true + }, + 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.75 Safari/537.36 Vivaldi/1.0.219.50': { + vivaldi: true + , webkit: true + , version: '1.0' + , a: true } } , Generic: { From 3f42b985d05e89b74eb8f0dd1ede7bd9d12269da Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Fri, 2 Oct 2015 19:29:38 -0400 Subject: [PATCH 3/4] Draft of Vivaldi case. --- src/bowser.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bowser.js b/src/bowser.js index cefeee2..217a8ea 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -175,6 +175,13 @@ , version: versionIdentifier } } + else if (/vivaldi/i.test(ua)) { + result = { + name: 'Vivaldi' + , vivaldi: t + , version: versionIdentifier + } + } else { result = { name: getFirstMatch(/^(.*)\/(.*) /), From bef1c560d93ab9aec5ec441e40212aa933cc4731 Mon Sep 17 00:00:00 2001 From: Ivan Carosati Date: Mon, 7 Dec 2015 14:54:35 -0500 Subject: [PATCH 4/4] Vivaldi pass tests. --- README.md | 1 + src/bowser.js | 21 ++++++++++++--------- src/useragents.js | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4585f43..7c72c5c 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`] + * Vivaldi browser as `vivaldi`[`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 217a8ea..1a2208f 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -65,14 +65,23 @@ , msie: t , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) } - } else if (chromeBook) { + } + else if (/vivaldi/i.test(ua)) { + result = { + name: 'Vivaldi' + , vivaldi: t + , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier + } + } + else if (chromeBook) { result = { name: 'Chrome' , chromeBook: t , chrome: t , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) } - } else if (/chrome.+? edge/i.test(ua)) { + } + else if (/chrome.+? edge/i.test(ua)) { result = { name: 'Microsoft Edge' , msedge: t @@ -175,13 +184,6 @@ , version: versionIdentifier } } - else if (/vivaldi/i.test(ua)) { - result = { - name: 'Vivaldi' - , vivaldi: t - , version: versionIdentifier - } - } else { result = { name: getFirstMatch(/^(.*)\/(.*) /), @@ -248,6 +250,7 @@ (result.chrome && result.version >= 20) || (result.firefox && result.version >= 20.0) || (result.safari && result.version >= 6) || + (result.vivaldi && result.version >= 1) || (result.opera && result.version >= 10.0) || (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) || (result.blackberry && result.version >= 10.1) diff --git a/src/useragents.js b/src/useragents.js index 6d17260..602d17d 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -965,17 +965,17 @@ module.exports.useragents = { } } , Vivaldi: { - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.75 Safari/537.36 Vivaldi/1.0.219.53': { - vivaldi: true - , webkit: true - , version: '1.0' - , a: true + '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', + webkit: true, + a: true }, - 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.75 Safari/537.36 Vivaldi/1.0.219.50': { - vivaldi: true - , webkit: true - , version: '1.0' - , 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', + webkit: true, + a: true } } , Generic: {