From df5229cb62e5cc037c6079770153946244319c4a Mon Sep 17 00:00:00 2001 From: Alvin Portillo Date: Fri, 30 Nov 2018 11:00:24 -0800 Subject: [PATCH 01/61] Fix Pixel XL devices on Chrome 70 --- src/ua-parser.js | 2 +- test/device-test.json | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d982c4e..8321538 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -679,7 +679,7 @@ /android.+;\s(pixel c)[\s)]/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ - /android.+;\s(pixel( [23])?( xl)?)\s/i // Google Pixel + /android.+;\s(pixel( [23])?( xl)?)[\s)]/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models diff --git a/test/device-test.json b/test/device-test.json index a283f76..5ef3679 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -647,6 +647,15 @@ "type": "mobile" } }, + { + "desc": "Google Pixel XL", + "ua": "Mozilla/5.0 (Linux; Android 9; Pixel XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel XL", + "type": "mobile" + } + }, { "desc": "Google Pixel 2", "ua": "Mozilla/5.0 (Linux; Android 8.1.0; Pixel 2 Build/OPM1.171019.013) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Safari/537.36", @@ -665,6 +674,15 @@ "type": "mobile" } }, + { + "desc": "Google Pixel 2 XL", + "ua": "Mozilla/5.0 (Linux; Android 9; Pixel 2 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 2 XL", + "type": "mobile" + } + }, { "desc": "Google Pixel 3", "ua": "Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PD1A.180720.030) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36", @@ -683,6 +701,15 @@ "type": "mobile" } }, + { + "desc": "Google Pixel 3 XL", + "ua": "Mozilla/5.0 (Linux; Android 9; Pixel 3 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 3 XL", + "type": "mobile" + } + }, { "desc": "Generic Android Device", "ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; i980 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", From 6f27f8b8625a920d1f612a32b36acca8e0a2caf9 Mon Sep 17 00:00:00 2001 From: dianhe Date: Wed, 23 Jan 2019 14:32:30 +0800 Subject: [PATCH 02/61] + 'WeChat(Win) Desktop' --- src/ua-parser.js | 3 +++ test/browser-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 350425d..4242b1f 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -270,6 +270,9 @@ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ + /(windowswechat qbcore)\/([\w\.]+)/i // WeChat Desktop for Windows Built-in Browser + ], [[NAME, 'WeChat(Win) Desktop'], VERSION], [ + /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index f3b8c3e..2fbe6cb 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -878,5 +878,15 @@ "version" : "6.5.8.2910", "major" : "6" } + }, + { + "desc" : "QQ on Android", + "ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.901.400 QQBrowser/9.0.2524.400", + "expect" : + { + "name" : "WeChat(Win) Desktop", + "version" : "3.43.901.400", + "major" : "3" + } } ] From bc4fd7417cca28bc637a25eff96484ac7023df64 Mon Sep 17 00:00:00 2001 From: dianhe Date: Wed, 23 Jan 2019 14:43:56 +0800 Subject: [PATCH 03/61] test name --- test/browser-test.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/browser-test.json b/test/browser-test.json index 2fbe6cb..1070946 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -880,7 +880,7 @@ } }, { - "desc" : "QQ on Android", + "desc" : "WeChat Desktop for Windows Built-in Browser", "ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.901.400 QQBrowser/9.0.2524.400", "expect" : { From 995e872ff8bcd91e1ed5cc106d47ad25a39cbd38 Mon Sep 17 00:00:00 2001 From: Raine Makelainen Date: Fri, 1 Mar 2019 14:48:14 +0200 Subject: [PATCH 04/61] Add Sailfish OS and Sailfish Browser detection --- src/ua-parser.js | 8 +++++--- test/browser-test.json | 10 ++++++++++ test/os-test.json | 9 +++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d982c4e..208c67c 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -334,6 +334,9 @@ /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ + /(sailfishbrowser)\/([\w\.]+)/i // Sailfish Browser + ], [[NAME, 'Sailfish Browser'], VERSION], [ + /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ @@ -864,9 +867,8 @@ ], [[NAME, 'BlackBerry'], VERSION], [ /(blackberry)\w*\/?([\w\.]*)/i, // Blackberry /(tizen)[\/\s]([\w\.]+)/i, // Tizen - /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i, - // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki - /linux;.+(sailfish);/i // Sailfish OS + /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i + // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki/Sailfish OS ], [NAME, VERSION], [ /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i // Symbian ], [[NAME, 'Symbian'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index b98db59..518241d 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -59,6 +59,16 @@ "major" : "3" } }, + { + "desc" : "Sailfish Browser", + "ua" : "Mozilla/5.0 (Linux; U; Sailfish 3.0; Mobile; rv:45.0) Gecko/45.0 Firefox/45.0 SailfishBrowser/1.0", + "expect" : + { + "name" : "Sailfish Browser", + "version" : "1.0", + "major" : "1" + } + }, { "desc" : "Arora", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.1; de-CH) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.2", diff --git a/test/os-test.json b/test/os-test.json index 5dc4c1d..a2a2411 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -170,6 +170,15 @@ "version" : "2.2.2" } }, + { + "desc" : "Sailfish", + "ua" : "Mozilla/5.0 (Linux; U; Sailfish 3.0; Mobile; rv:45.0) Gecko/45.0 Firefox/45.0 SailfishBrowser/1.0", + "expect" : + { + "name" : "Sailfish", + "version" : "3.0" + } + }, { "desc" : "WebOS", "ua" : "", From 97dc89ae03b955fb92e73b5640aa8cd83304ad0f Mon Sep 17 00:00:00 2001 From: Bendeguz Date: Tue, 19 Mar 2019 10:57:36 +0100 Subject: [PATCH 05/61] FIX: When using in an AMD module with RequireJS using a namespace, it does not get packed correctly, because r.js optimizer matches the exact line containing 'function' as a string. (See r.js@26506) --- src/ua-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d982c4e..ebebfd5 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1083,7 +1083,7 @@ exports.UAParser = UAParser; } else { // requirejs env (optional) - if (typeof(define) === FUNC_TYPE && define.amd) { + if (typeof(define) === 'function' && define.amd) { define(function () { return UAParser; }); From 795139e1b8bb6dd3c8f2d7a5798493be8c2adf27 Mon Sep 17 00:00:00 2001 From: Max Nordlund Date: Mon, 25 Mar 2019 11:54:55 +0100 Subject: [PATCH 06/61] Fix typo Changes `margedRegexes` -> `mergedRegexes` --- src/ua-parser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d982c4e..3b7ea5a 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -45,15 +45,15 @@ var util = { extend : function (regexes, extensions) { - var margedRegexes = {}; + var mergedRegexes = {}; for (var i in regexes) { if (extensions[i] && extensions[i].length % 2 === 0) { - margedRegexes[i] = extensions[i].concat(regexes[i]); + mergedRegexes[i] = extensions[i].concat(regexes[i]); } else { - margedRegexes[i] = regexes[i]; + mergedRegexes[i] = regexes[i]; } } - return margedRegexes; + return mergedRegexes; }, has : function (str1, str2) { if (typeof str1 === "string") { From a4da1e2b659438d76cd6a40ce8010c26dfa0aee4 Mon Sep 17 00:00:00 2001 From: Max Nordlund Date: Mon, 25 Mar 2019 12:09:10 +0100 Subject: [PATCH 07/61] Remove outcommented code It was disabled 2 years ago, see #258 --- src/ua-parser.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d982c4e..2055e07 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -924,22 +924,6 @@ ///////////////// // Constructor //////////////// - /* - var Browser = function (name, version) { - this[NAME] = name; - this[VERSION] = version; - }; - var CPU = function (arch) { - this[ARCHITECTURE] = arch; - }; - var Device = function (vendor, model, type) { - this[VENDOR] = vendor; - this[MODEL] = model; - this[TYPE] = type; - }; - var Engine = Browser; - var OS = Browser; - */ var UAParser = function (uastring, extensions) { if (typeof uastring === 'object') { @@ -953,11 +937,6 @@ var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); var rgxmap = extensions ? util.extend(regexes, extensions) : regexes; - //var browser = new Browser(); - //var cpu = new CPU(); - //var device = new Device(); - //var engine = new Engine(); - //var os = new OS(); this.getBrowser = function () { var browser = { name: undefined, version: undefined }; @@ -1000,11 +979,6 @@ }; this.setUA = function (uastring) { ua = uastring; - //browser = new Browser(); - //cpu = new CPU(); - //device = new Device(); - //engine = new Engine(); - //os = new OS(); return this; }; return this; From d1a7f365ad55c4be1ab24c186a8925185533129e Mon Sep 17 00:00:00 2001 From: Max Nordlund Date: Mon, 25 Mar 2019 12:11:07 +0100 Subject: [PATCH 08/61] Remove disabled CLI functionality See #268 --- readme.md | 12 ------------ src/ua-parser.js | 30 ------------------------------ 2 files changed, 42 deletions(-) diff --git a/readme.md b/readme.md index fb356c3..364810e 100644 --- a/readme.md +++ b/readme.md @@ -241,18 +241,6 @@ $ npm install --save @types/ua-parser-js # https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ua-parser-js ``` -## Using CLI - -```sh -$ node ua-parser.min.js "Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)" -# multiple args -$ node ua-parser.min.js "Opera/1.2" "Opera/3.4" -# piped args -$ echo "Opera/1.2" | node ua-parser.min.js -# log file -$ cat ua.log | node ua-parser.min.js -``` - ## Using jQuery/Zepto ($.ua) Although written in vanilla js (which means it doesn't depends on jQuery), this library will automatically detect if jQuery/Zepto is present and create `$.ua` object based on browser's user-agent (although in case you need, `window.UAParser` constructor is still present). To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`. diff --git a/src/ua-parser.js b/src/ua-parser.js index 2055e07..2593637 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1012,7 +1012,6 @@ NAME : NAME, VERSION : VERSION }; - //UAParser.Utils = util; /////////// // Export @@ -1025,35 +1024,6 @@ if (typeof module !== UNDEF_TYPE && module.exports) { exports = module.exports = UAParser; } - // TODO: test!!!!!!!! - /* - if (require && require.main === module && process) { - // cli - var jsonize = function (arr) { - var res = []; - for (var i in arr) { - res.push(new UAParser(arr[i]).getResult()); - } - process.stdout.write(JSON.stringify(res, null, 2) + '\n'); - }; - if (process.stdin.isTTY) { - // via args - jsonize(process.argv.slice(2)); - } else { - // via pipe - var str = ''; - process.stdin.on('readable', function() { - var read = process.stdin.read(); - if (read !== null) { - str += read; - } - }); - process.stdin.on('end', function () { - jsonize(str.replace(/\n$/, '').split('\n')); - }); - } - } - */ exports.UAParser = UAParser; } else { // requirejs env (optional) From cc479f81ae0489b4872ea0d1544ef322e95382fa Mon Sep 17 00:00:00 2001 From: Max Nordlund gmail Date: Mon, 25 Mar 2019 12:14:31 +0100 Subject: [PATCH 09/61] Remove outcommented code Hasn't been used for years, so it's most likely safe to remove. --- src/ua-parser.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 2593637..01bca0e 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -83,14 +83,7 @@ rgx : function (ua, arrays) { - //var result = {}, - var i = 0, j, k, p, q, matches, match;//, args = arguments; - - /*// construct object barebones - for (p = 0; p < args[1].length; p++) { - q = args[1][p]; - result[typeof q === OBJ_TYPE ? q[0] : q] = undefined; - }*/ + var i = 0, j, k, p, q, matches, match; // loop through all regexes maps while (i < arrays.length && !matches) { @@ -138,8 +131,6 @@ } i += 2; } - // console.log(this); - //return this; }, str : function (str, map) { From 95f37b4ce5bc25dac82a2476899eaaf7c38d6170 Mon Sep 17 00:00:00 2001 From: Max Nordlund gmail Date: Mon, 25 Mar 2019 12:20:06 +0100 Subject: [PATCH 10/61] Remove unused media players This got disabled ~4 years ago, see 5d817e37 --- src/ua-parser.js | 111 ----------------------------------------------- 1 file changed, 111 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 01bca0e..e86c010 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -375,117 +375,6 @@ /(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser /(mosaic)[\/\s]([\w\.]+)/i // Mosaic ], [NAME, VERSION] - - /* ///////////////////// - // Media players BEGIN - //////////////////////// - - , [ - - /(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia - /(coremedia) v((\d+)[\w\._]+)/i - ], [NAME, VERSION], [ - - /(aqualung|lyssna|bsplayer)\/((\d+)?[\w\.-]+)/i // Aqualung/Lyssna/BSPlayer - ], [NAME, VERSION], [ - - /(ares|ossproxy)\s((\d+)[\w\.-]+)/i // Ares/OSSProxy - ], [NAME, VERSION], [ - - /(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/((\d+)[\w\.-]+)/i, - // Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC - // NSPlayer/PSP-InternetRadioPlayer/Videos - /(clementine|music player daemon)\s((\d+)[\w\.-]+)/i, // Clementine/MPD - /(lg player|nexplayer)\s((\d+)[\d\.]+)/i, - /player\/(nexplayer|lg player)\s((\d+)[\w\.-]+)/i // NexPlayer/LG Player - ], [NAME, VERSION], [ - /(nexplayer)\s((\d+)[\w\.-]+)/i // Nexplayer - ], [NAME, VERSION], [ - - /(flrp)\/((\d+)[\w\.-]+)/i // Flip Player - ], [[NAME, 'Flip Player'], VERSION], [ - - /(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i - // FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit - ], [NAME], [ - - /(gstreamer) souphttpsrc (?:\([^\)]+\)){0,1} libsoup\/((\d+)[\w\.-]+)/i - // Gstreamer - ], [NAME, VERSION], [ - - /(htc streaming player)\s[\w_]+\s\/\s((\d+)[\d\.]+)/i, // HTC Streaming Player - /(java|python-urllib|python-requests|wget|libcurl)\/((\d+)[\w\.-_]+)/i, - // Java/urllib/requests/wget/cURL - /(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG) - ], [NAME, VERSION], [ - - /(htc_one_s)\/((\d+)[\d\.]+)/i // HTC One S - ], [[NAME, /_/g, ' '], VERSION], [ - - /(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i - // MPlayer SVN - ], [NAME, VERSION], [ - - /(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i // MPlayer - ], [NAME, VERSION], [ - - /(mplayer)/i, // MPlayer (no other info) - /(yourmuze)/i, // YourMuze - /(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime - ], [NAME], [ - - /(nero (?:home|scout))\/((\d+)[\w\.-]+)/i // Nero Home/Nero Scout - ], [NAME, VERSION], [ - - /(nokia\d+)\/((\d+)[\w\.-]+)/i // Nokia - ], [NAME, VERSION], [ - - /\s(songbird)\/((\d+)[\w\.-]+)/i // Songbird/Philips-Songbird - ], [NAME, VERSION], [ - - /(winamp)3 version ((\d+)[\w\.-]+)/i, // Winamp - /(winamp)\s((\d+)[\w\.-]+)/i, - /(winamp)mpeg\/((\d+)[\w\.-]+)/i - ], [NAME, VERSION], [ - - /(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info) - // inlight radio - ], [NAME], [ - - /(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/((\d+)[\w\.-]+)/i - // QuickTime/RealMedia/RadioApp/RadioClientApplication/ - // SoundTap/Totem/Stagefright/Streamium - ], [NAME, VERSION], [ - - /(smp)((\d+)[\d\.]+)/i // SMP - ], [NAME, VERSION], [ - - /(vlc) media player - version ((\d+)[\w\.]+)/i, // VLC Videolan - /(vlc)\/((\d+)[\w\.-]+)/i, - /(xbmc|gvfs|xine|xmms|irapp)\/((\d+)[\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp - /(foobar2000)\/((\d+)[\d\.]+)/i, // Foobar2000 - /(itunes)\/((\d+)[\d\.]+)/i // iTunes - ], [NAME, VERSION], [ - - /(wmplayer)\/((\d+)[\w\.-]+)/i, // Windows Media Player - /(windows-media-player)\/((\d+)[\w\.-]+)/i - ], [[NAME, /-/g, ' '], VERSION], [ - - /windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i - // Windows Media Server - ], [VERSION, [NAME, 'Windows']], [ - - /(com\.riseupradioalarm)\/((\d+)[\d\.]*)/i // RiseUP Radio Alarm - ], [NAME, VERSION], [ - - /(rad.io)\s((\d+)[\d\.]+)/i, // Rad.io - /(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i - ], [[NAME, 'rad.io'], VERSION] - - ////////////////////// - // Media players END - ////////////////////*/ - ], cpu : [[ From 37cac21d0cb0e04c2d097dc01248a7b9df7483d0 Mon Sep 17 00:00:00 2001 From: Max Nordlund gmail Date: Mon, 25 Mar 2019 12:23:21 +0100 Subject: [PATCH 11/61] Remove outdated TODO This todo was written in April 2015, which at the time of this commit is almost 4 years ago. See 6a284e26 --- src/ua-parser.js | 52 ------------------------------------------------ 1 file changed, 52 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index e86c010..13830cd 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -654,58 +654,6 @@ /(android[\w\.\s\-]{0,9});.+build/i // Generic Android Device ], [MODEL, [VENDOR, 'Generic']] - - - /*////////////////////////// - // TODO: move to string map - //////////////////////////// - - /(C6603)/i // Sony Xperia Z C6603 - ], [[MODEL, 'Xperia Z C6603'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [ - /(C6903)/i // Sony Xperia Z 1 - ], [[MODEL, 'Xperia Z 1'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [ - - /(SM-G900[F|H])/i // Samsung Galaxy S5 - ], [[MODEL, 'Galaxy S5'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ - /(SM-G7102)/i // Samsung Galaxy Grand 2 - ], [[MODEL, 'Galaxy Grand 2'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ - /(SM-G530H)/i // Samsung Galaxy Grand Prime - ], [[MODEL, 'Galaxy Grand Prime'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ - /(SM-G313HZ)/i // Samsung Galaxy V - ], [[MODEL, 'Galaxy V'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ - /(SM-T805)/i // Samsung Galaxy Tab S 10.5 - ], [[MODEL, 'Galaxy Tab S 10.5'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ - /(SM-G800F)/i // Samsung Galaxy S5 Mini - ], [[MODEL, 'Galaxy S5 Mini'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ - /(SM-T311)/i // Samsung Galaxy Tab 3 8.0 - ], [[MODEL, 'Galaxy Tab 3 8.0'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ - - /(T3C)/i // Advan Vandroid T3C - ], [MODEL, [VENDOR, 'Advan'], [TYPE, TABLET]], [ - /(ADVAN T1J\+)/i // Advan Vandroid T1J+ - ], [[MODEL, 'Vandroid T1J+'], [VENDOR, 'Advan'], [TYPE, TABLET]], [ - /(ADVAN S4A)/i // Advan Vandroid S4A - ], [[MODEL, 'Vandroid S4A'], [VENDOR, 'Advan'], [TYPE, MOBILE]], [ - - /(V972M)/i // ZTE V972M - ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [ - - /(i-mobile)\s(IQ\s[\d\.]+)/i // i-mobile IQ - ], [VENDOR, MODEL, [TYPE, MOBILE]], [ - /(IQ6.3)/i // i-mobile IQ IQ 6.3 - ], [[MODEL, 'IQ 6.3'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [ - /(i-mobile)\s(i-style\s[\d\.]+)/i // i-mobile i-STYLE - ], [VENDOR, MODEL, [TYPE, MOBILE]], [ - /(i-STYLE2.1)/i // i-mobile i-STYLE 2.1 - ], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [ - - /(mobiistar touch LAI 512)/i // mobiistar touch LAI 512 - ], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [ - - ///////////// - // END TODO - ///////////*/ - ], engine : [[ From 7d4d9fd4762f1f96e7ebdc6bcec8728f4449206a Mon Sep 17 00:00:00 2001 From: Pavel Studeny Date: Wed, 10 Apr 2019 16:22:15 +0200 Subject: [PATCH 12/61] Add Avast Secure Browser detection --- src/ua-parser.js | 3 +++ test/browser-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index d982c4e..aae5962 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -270,6 +270,9 @@ /(yabrowser)\/([\w\.]+)/i // Yandex ], [[NAME, 'Yandex'], VERSION], [ + /(Avast)\/([\w\.]+)/i // Avast Secure Browser + ], [[NAME, 'Avast Secure Browser'], VERSION], [ + /(puffin)\/([\w\.]+)/i // Puffin ], [[NAME, 'Puffin'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index b98db59..0716fad 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -79,6 +79,16 @@ "major" : "undefined" } }, + { + "desc" : "Avast Secure Browser", + "ua" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Avast/72.0.1174.122", + "expect" : + { + "name" : "Avast Secure Browser", + "version" : "72.0.1174.122", + "major" : "72" + } + }, { "desc" : "Baidu", "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", From 0b7d05bae0078ccbec109af6140042b124acdacf Mon Sep 17 00:00:00 2001 From: Pavel Studeny Date: Wed, 10 Apr 2019 16:38:13 +0200 Subject: [PATCH 13/61] Add AVG Secure Browser detection --- src/ua-parser.js | 3 +++ test/browser-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index aae5962..ca7a422 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -273,6 +273,9 @@ /(Avast)\/([\w\.]+)/i // Avast Secure Browser ], [[NAME, 'Avast Secure Browser'], VERSION], [ + /(AVG)\/([\w\.]+)/i // Avast Secure Browser + ], [[NAME, 'AVG Secure Browser'], VERSION], [ + /(puffin)\/([\w\.]+)/i // Puffin ], [[NAME, 'Puffin'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index 0716fad..c95c43d 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -89,6 +89,16 @@ "major" : "72" } }, + { + "desc" : "AVG Secure Browser", + "ua" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 AVG/72.0.719.123", + "expect" : + { + "name" : "AVG Secure Browser", + "version" : "72.0.719.123", + "major" : "72" + } + }, { "desc" : "Baidu", "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", From a88b70bdd4ad9c04677f7e51415c6551b2ca3789 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Sat, 13 Apr 2019 10:48:53 +0300 Subject: [PATCH 14/61] Fixed Edge Chromium detection Closes #373 --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 2 +- test/browser-test.json | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index c12f2ef..ed48f0a 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -6,4 +6,4 @@ * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 or MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.19",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded";var util={extend:function(regexes,extensions){var margedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){margedRegexes[i]=extensions[i].concat(regexes[i])}else{margedRegexes[i]=regexes[i]}}return margedRegexes},has:function(str1,str2){if(typeof str1==="string"){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1}else{return false}},lowerize:function(str){return str.toLowerCase()},major:function(version){return typeof version===STR_TYPE?version.replace(/[^\d\.]/g,"").split(".")[0]:undefined},trim:function(str){return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};var mapper={rgx:function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j * Dual licensed under GPLv2 or MIT */ -!function(i,s){"use strict";var e="0.7.19",o="",r="?",n="function",a="undefined",d="object",t="string",l="major",w="model",u="name",c="type",m="vendor",b="version",p="architecture",g="console",f="mobile",h="tablet",v="smarttv",x="wearable",k="embedded",y={extend:function(i,s){var e={};for(var o in i)s[o]&&s[o].length%2===0?e[o]=s[o].concat(i[o]):e[o]=i[o];return e},has:function(i,s){return"string"==typeof i&&s.toLowerCase().indexOf(i.toLowerCase())!==-1},lowerize:function(i){return i.toLowerCase()},major:function(i){return typeof i===t?i.replace(/[^\d\.]/g,"").split(".")[0]:s},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},T={rgx:function(i,e){for(var o,r,a,t,l,w,u=0;u0?2==t.length?typeof t[1]==n?this[t[0]]=t[1].call(this,w):this[t[0]]=t[1]:3==t.length?typeof t[1]!==n||t[1].exec&&t[1].test?this[t[0]]=w?w.replace(t[1],t[2]):s:this[t[0]]=w?t[1].call(this,w,t[2]):s:4==t.length&&(this[t[0]]=w?t[3].call(this,w.replace(t[1],t[2])):s):this[t]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===d&&e[o].length>0){for(var n=0;n0?2==t.length?typeof t[1]==n?this[t[0]]=t[1].call(this,w):this[t[0]]=t[1]:3==t.length?typeof t[1]!==n||t[1].exec&&t[1].test?this[t[0]]=w?w.replace(t[1],t[2]):s:this[t[0]]=w?t[1].call(this,w,t[2]):s:4==t.length&&(this[t[0]]=w?t[3].call(this,w.replace(t[1],t[2])):s):this[t]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===d&&e[o].length>0){for(var n=0;n Date: Wed, 5 Jun 2019 16:48:01 +0200 Subject: [PATCH 15/61] fix license in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9686761..0485507 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "type": "git", "url": "https://github.com/faisalman/ua-parser-js.git" }, - "license": "(GPL-2.0 OR MIT)", + "license": "MIT", "engines": { "node": "*" }, From 90ae87ec17b9ae2ee3637c2a17429c3c445a9e20 Mon Sep 17 00:00:00 2001 From: Elchin Valiyev Date: Wed, 5 Jun 2019 17:01:30 +0200 Subject: [PATCH 16/61] Update README --- readme.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index fb356c3..9a5c1d4 100644 --- a/readme.md +++ b/readme.md @@ -325,18 +325,18 @@ Do you use & like UAParser.js but you don’t find a way to show some love? If y # License -Dual licensed under GPLv2 or MIT +MIT License -Copyright © 2012-2018 Faisal Salman <> +Copyright (c) 2012-2019 Faisal Salman <> -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR From 7ef62a68de0880f3a5ff4956ec9443ba127ac33c Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Jun 2019 20:28:14 +0700 Subject: [PATCH 17/61] Fix #318 Detect Meizu Note as Mobile --- src/ua-parser.js | 6 +++--- test/device-test.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 6c5be8b..b42443a 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -575,9 +575,9 @@ ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ /android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i // Mi Pad tablets ],[[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, TABLET]], [ - /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet - ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ - /(mz)-([\w-]{2,})/i // Meizu Phone + /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu + ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [ + /(mz)-([\w-]{2,})/i ], [[VENDOR, 'Meizu'], MODEL, [TYPE, MOBILE]], [ /android.+a000(1)\s+build/i, // OnePlus diff --git a/test/device-test.json b/test/device-test.json index 5ef3679..3b837c4 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -157,7 +157,7 @@ "expect": { "vendor": "Meizu", "model": "M5 Note", - "type": "tablet" + "type": "mobile" } }, { From a9fc6163b86269b48b3a26e63f4c5782fb4061cf Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Jun 2019 20:39:31 +0700 Subject: [PATCH 18/61] Fix #289 Detect Xiaomi Mi as Mobile --- src/ua-parser.js | 3 ++- test/device-test.json | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index b42443a..3960cc6 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -570,7 +570,8 @@ /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi - /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i, // Xiaomi Mi + /android.+(mi[\s\-_]*(?:a\d|one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i, + // Xiaomi Mi /android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i // Redmi Phones ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ /android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i // Mi Pad tablets diff --git a/test/device-test.json b/test/device-test.json index 3b837c4..7478c9c 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -522,6 +522,15 @@ "type": "mobile" } }, + { + "desc": "Xiaomi Mi A1", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; Mi A1 Build/OPR1.170623.026) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36", + "expect": { + "vendor": "Xiaomi", + "model": "Mi A1", + "type": "mobile" + } + }, { "desc": "Xiaomi Mi Note", "ua": "Mozilla/5.0 (Linux; Android 4.4.4; MI NOTE LTE Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36", From b1d6eda6e1d13f6fa2d33d9b154b0a732f1795d3 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Jun 2019 20:51:31 +0700 Subject: [PATCH 19/61] Fix #378 Detect Samsung Galaxy C9 Pro --- test/device-test.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/device-test.json b/test/device-test.json index 7478c9c..865337a 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -567,6 +567,15 @@ "type": "mobile" } }, + { + "desc": "Samsung Galaxy C9 Pro", + "ua": "Mozilla/5.0 (Linux; Android 6.0; SAMSUNG SM-C900F Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.2 Chrome/44.0.2403.133 Mobile Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-C900F", + "type": "mobile" + } + }, { "desc": "Samsung Galaxy S5", "ua": "Mozilla/5.0 (Linux; Android 5.0; SM-G900F Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36", From 8cf2a8793822dc56960891176f95d7e1e0611732 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Jun 2019 21:10:52 +0700 Subject: [PATCH 20/61] Fix #379 Detect Lenovo Tab --- src/ua-parser.js | 11 ++++++----- test/device-test.json | 9 +++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 3960cc6..36b1bd5 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -471,13 +471,10 @@ /(sprint\s(\w+))/i // Sprint Phones ], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [ - /(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i // Lenovo tablets - ], [VENDOR, MODEL, [TYPE, TABLET]], [ - /(htc)[;_\s-]+([\w\s]+(?=\)|\sbuild)|\w+)/i, // HTC /(zte)-(\w*)/i, // ZTE - /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i - // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony + /(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i + // Alcatel/GeeksPhone/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ /(nexus\s9)/i // HTC Nexus 9 @@ -544,8 +541,12 @@ /android.+lg(\-?[\d\w]+)\s+build/i ], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [ + /(lenovo)\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+))/i // Lenovo tablets + ], [VENDOR, MODEL, [TYPE, TABLET]], [ /android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [ + /(lenovo)[_\s-]?([\w-]+)/i + ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /linux;.+((jolla));/i // Jolla ], [VENDOR, MODEL, [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index 865337a..6074665 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -133,6 +133,15 @@ "type": "mobile" } }, + { + "desc": "Lenovo Tab 2", + "ua": "Mozilla/5.0 (Linux; Android 5.0.1; Lenovo TAB 2 A7-30HC Build/LRX21M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Safari/537.36", + "expect": { + "vendor": "Lenovo", + "model": "TAB 2 A7", + "type": "tablet" + } + }, { "desc": "LG Nexus 4", "ua": "Mozilla/5.0 (Linux; Android 4.2.1; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", From a88934fadf2393f3757f1e8b9966d8c0244120b1 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Jun 2019 21:49:59 +0700 Subject: [PATCH 21/61] v0.7.20 - released under the MIT license --- bower.json | 4 ++-- dist/ua-parser.min.js | 8 ++++---- dist/ua-parser.pack.js | 8 ++++---- license.md | 2 +- package.js | 2 +- package.json | 2 +- src/ua-parser.js | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bower.json b/bower.json index c83d0a9..d7496a9 100644 --- a/bower.json +++ b/bower.json @@ -1,8 +1,8 @@ { "name": "ua-parser-js", - "version": "0.7.19", + "version": "0.7.20", "authors": [ - "Faisal Salman " + "Faisal Salman " ], "private": false, "main": "src/ua-parser.js", diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index ed48f0a..6e8acb3 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /*! - * UAParser.js v0.7.19 + * UAParser.js v0.7.20 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * - * Copyright © 2012-2016 Faisal Salman - * Dual licensed under GPLv2 or MIT + * Copyright © 2012-2019 Faisal Salman + * Licensed under MIT License */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.19",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded";var util={extend:function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},has:function(str1,str2){if(typeof str1==="string"){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1}else{return false}},lowerize:function(str){return str.toLowerCase()},major:function(version){return typeof version===STR_TYPE?version.replace(/[^\d\.]/g,"").split(".")[0]:undefined},trim:function(str){return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};var mapper={rgx:function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j - * Dual licensed under GPLv2 or MIT + * Copyright © 2012-2019 Faisal Salman + * Licensed under MIT License */ -!function(i,s){"use strict";var e="0.7.19",o="",r="?",n="function",a="undefined",d="object",t="string",l="major",w="model",u="name",c="type",m="vendor",b="version",p="architecture",f="console",g="mobile",h="tablet",v="smarttv",x="wearable",k="embedded",y={extend:function(i,s){var e={};for(var o in i)s[o]&&s[o].length%2===0?e[o]=s[o].concat(i[o]):e[o]=i[o];return e},has:function(i,s){return"string"==typeof i&&s.toLowerCase().indexOf(i.toLowerCase())!==-1},lowerize:function(i){return i.toLowerCase()},major:function(i){return typeof i===t?i.replace(/[^\d\.]/g,"").split(".")[0]:s},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},T={rgx:function(i,e){for(var o,r,a,t,l,w,u=0;u0?2==t.length?typeof t[1]==n?this[t[0]]=t[1].call(this,w):this[t[0]]=t[1]:3==t.length?typeof t[1]!==n||t[1].exec&&t[1].test?this[t[0]]=w?w.replace(t[1],t[2]):s:this[t[0]]=w?t[1].call(this,w,t[2]):s:4==t.length&&(this[t[0]]=w?t[3].call(this,w.replace(t[1],t[2])):s):this[t]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===d&&e[o].length>0){for(var n=0;n> +Copyright (c) 2012-2019 Faisal Salman <> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.js b/package.js index adff37c..e41d5e7 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'faisalman:ua-parser-js', - version: '0.7.19', + version: '0.7.20', summary: 'Lightweight JavaScript-based user-agent string parser', git: 'https://github.com/faisalman/ua-parser-js.git', documentation: 'readme.md' diff --git a/package.json b/package.json index 0485507..8b6c554 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "UAParser.js", "name": "ua-parser-js", - "version": "0.7.19", + "version": "0.7.20", "author": "Faisal Salman (http://faisalman.com)", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ diff --git a/src/ua-parser.js b/src/ua-parser.js index 36b1bd5..de0579c 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,10 +1,10 @@ /*! - * UAParser.js v0.7.19 + * UAParser.js v0.7.20 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * - * Copyright © 2012-2016 Faisal Salman - * Dual licensed under GPLv2 or MIT + * Copyright © 2012-2019 Faisal Salman + * Licensed under MIT License */ (function (window, undefined) { @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.19', + var LIBVERSION = '0.7.20', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', From ee391c8888ee049576ff17f8cd5a342205b0c0b2 Mon Sep 17 00:00:00 2001 From: Pavel Studeny Date: Fri, 21 Jun 2019 09:43:12 +0200 Subject: [PATCH 22/61] fix comment --- src/ua-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index ca7a422..495ef79 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -273,7 +273,7 @@ /(Avast)\/([\w\.]+)/i // Avast Secure Browser ], [[NAME, 'Avast Secure Browser'], VERSION], [ - /(AVG)\/([\w\.]+)/i // Avast Secure Browser + /(AVG)\/([\w\.]+)/i // AVG Secure Browser ], [[NAME, 'AVG Secure Browser'], VERSION], [ /(puffin)\/([\w\.]+)/i // Puffin From c7525200417231e28e86818038643c233e9adb17 Mon Sep 17 00:00:00 2001 From: Alvin Portillo Date: Fri, 19 Jul 2019 14:45:34 -0700 Subject: [PATCH 23/61] Detect Huawei P20 Lite and P30 Pro --- src/ua-parser.js | 2 +- test/device-test.json | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index de0579c..b3f0f71 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -481,7 +481,7 @@ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, - /(nexus\s6p)/i // Huawei + /(nexus\s6p|vog-l29|ane-lx1)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia diff --git a/test/device-test.json b/test/device-test.json index 6074665..5f4cc5c 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1041,5 +1041,23 @@ "model": "MI PAD 2", "type": "tablet" } + }, + { + "desc": "Huawei P30 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; VOG-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "VOG-L29", + "type": "mobile" + } + }, + { + "desc": "Huawei P20 Lite", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; ANE-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "ANE-LX1", + "type": "mobile" + } } ] From e5a02c0e5709e25c5c74670c6395b79053321b85 Mon Sep 17 00:00:00 2001 From: Tony Tomarchio Date: Mon, 22 Jul 2019 14:14:57 -0700 Subject: [PATCH 24/61] Detect Huawei P20 --- src/ua-parser.js | 2 +- test/device-test.json | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index b3f0f71..49909fa 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -481,7 +481,7 @@ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, - /(nexus\s6p|vog-l29|ane-lx1)/i // Huawei + /(nexus\s6p|vog-l29|ane-lx1|eml-l29)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia diff --git a/test/device-test.json b/test/device-test.json index 5f4cc5c..d38387c 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1059,5 +1059,14 @@ "model": "ANE-LX1", "type": "mobile" } - } + }, + { + "desc": "Huawei P20", + "ua": "Mozilla/5.0 (Linux; Android 8.1.0; EML-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "EML-L29", + "type": "mobile" + } + } ] From ca14b133cb05999e941877ad891aafe0aed43eeb Mon Sep 17 00:00:00 2001 From: JBYoshi <12983479+JBYoshi@users.noreply.github.com> Date: Wed, 28 Aug 2019 21:12:14 -0500 Subject: [PATCH 25/61] Use Chrome version for Blink version. --- src/ua-parser.js | 4 ++-- test/engine-test.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index de0579c..847b748 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -669,8 +669,8 @@ /windows.+\sedge\/([\w\.]+)/i // EdgeHTML ], [VERSION, [NAME, 'EdgeHTML']], [ - /webkit\/537\.36.+chrome\/(?!27)/i // Blink - ], [[NAME, 'Blink']], [ + /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink + ], [VERSION, [NAME, 'Blink']], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, diff --git a/test/engine-test.json b/test/engine-test.json index c1afba3..9f54d31 100644 --- a/test/engine-test.json +++ b/test/engine-test.json @@ -5,7 +5,7 @@ "expect" : { "name" : "Blink", - "version" : "undefined" + "version" : "57.0.2987.146" } }, { From 8457f61f60f584fe4c510e282a15589e7b7aede2 Mon Sep 17 00:00:00 2001 From: JBYoshi <12983479+JBYoshi@users.noreply.github.com> Date: Wed, 28 Aug 2019 21:16:40 -0500 Subject: [PATCH 26/61] Fix whitespace. --- src/ua-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 847b748..f3a4754 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -669,7 +669,7 @@ /windows.+\sedge\/([\w\.]+)/i // EdgeHTML ], [VERSION, [NAME, 'EdgeHTML']], [ - /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink + /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink ], [VERSION, [NAME, 'Blink']], [ /(presto)\/([\w\.]+)/i, // Presto From 3a78cf598deb4cdad0ffb7b96a5a157338b534c3 Mon Sep 17 00:00:00 2001 From: JBYoshi <12983479+JBYoshi@users.noreply.github.com> Date: Wed, 4 Sep 2019 10:21:13 -0500 Subject: [PATCH 27/61] Classify Apple TV and Chromecast as smart TVs. --- src/ua-parser.js | 4 ++-- test/device-test.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index de0579c..1355bb5 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -418,7 +418,7 @@ ], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [ /(apple\s{0,1}tv)/i // Apple TV - ], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [ + ], [[MODEL, 'Apple TV'], [VENDOR, 'Apple'], [TYPE, SMARTTV]], [ /(archos)\s(gamepad2?)/i, // Archos /(hp).+(touchpad)/i, // HP TouchPad @@ -558,7 +558,7 @@ ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /crkey/i // Google Chromecast - ], [[MODEL, 'Chromecast'], [VENDOR, 'Google']], [ + ], [[MODEL, 'Chromecast'], [VENDOR, 'Google'], [TYPE, SMARTTV]], [ /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ diff --git a/test/device-test.json b/test/device-test.json index 6074665..7fbc69c 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -635,7 +635,8 @@ "ua": "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.84 Safari/537.36 CrKey/1.22.79313", "expect": { "vendor": "Google", - "model": "Chromecast" + "model": "Chromecast", + "type": "smarttv" } }, { From 5050ef75f6c6a03672f958520589f1ac9878285e Mon Sep 17 00:00:00 2001 From: ll-syber <670159357@qq.com> Date: Tue, 17 Sep 2019 19:52:12 +0800 Subject: [PATCH 28/61] 1. merge baidubrowser with bidubrowser, and place them in "trident based" 2. add baiduboxapp, which stand for "Baidu App on mobile" --- src/ua-parser.js | 7 ++++--- test/browser-test.json | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index de0579c..6ec47c7 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -239,8 +239,9 @@ // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based - /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, - // Avant/IEMobile/SlimBrowser/Baidu + /(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i, + // Avant/IEMobile/SlimBrowser + /(bidubrowser|baidubrowser)[\/\s]?([\w\.]+)/i, // Baidu Browser /(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer // Webkit/KHTML based @@ -294,7 +295,7 @@ /m?(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser ], [NAME, VERSION], [ - /(BIDUBrowser)[\/\s]?([\w\.]+)/i // Baidu Browser + /(baiduboxapp)[\/\s]?([\w\.]+)/i // Baidu App ], [NAME, VERSION], [ /(2345Explorer)[\/\s]?([\w\.]+)/i // 2345 Browser diff --git a/test/browser-test.json b/test/browser-test.json index 58ef6cc..4170b76 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -94,7 +94,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", "expect" : { - "name" : "baidu", + "name" : "baidubrowser", "version" : "1.x", "major" : "1" } @@ -1108,6 +1108,26 @@ "major" : "6" } }, + { + "desc" : "baidu app on iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16C101 main%2F1.0 baiduboxapp/11.12.0.18 (Baidu; P2 12.1.2)", + "expect" : + { + "name" : "baiduboxapp", + "version" : "11.12.0.18", + "major" : "11" + } + }, + { + "desc" : "baidu app on Android", + "ua" : "Mozilla/5.0 (Linux; Android 8.1.0; BKK-AL10 Build/HONORBKK-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/63.0.3239.83 Mobile Safari/537.36 T7/11.11 baiduboxapp/11.11.0.0 (Baidu; P1 8.1.0)", + "expect" : + { + "name" : "baiduboxapp", + "version" : "11.11.0.0", + "major" : "11" + } + }, { "desc" : "WeChat Desktop for Windows Built-in Browser", "ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.901.400 QQBrowser/9.0.2524.400", From c558a64ec5213d39c817855d23b539fe2fca271c Mon Sep 17 00:00:00 2001 From: MimyyK Date: Fri, 15 Nov 2019 11:59:31 +0100 Subject: [PATCH 29/61] Add new devices (OnePlus 6 and OnePlus 6T) --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 3 ++- test/device-test.json | 18 ++++++++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 6e8acb3..38e29fa 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -6,4 +6,4 @@ * Copyright © 2012-2019 Faisal Salman * Licensed under MIT License */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.20",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded";var util={extend:function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},has:function(str1,str2){if(typeof str1==="string"){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1}else{return false}},lowerize:function(str){return str.toLowerCase()},major:function(version){return typeof version===STR_TYPE?version.replace(/[^\d\.]/g,"").split(".")[0]:undefined},trim:function(str){return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};var mapper={rgx:function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j * Licensed under MIT License */ -!function(r,u){"use strict";var c="function",i="undefined",m="object",s="model",e="name",o="type",n="vendor",a="version",d="architecture",t="console",l="mobile",w="tablet",b="smarttv",p="wearable",f={extend:function(i,s){var e={};for(var o in i)s[o]&&s[o].length%2==0?e[o]=s[o].concat(i[o]):e[o]=i[o];return e},has:function(i,s){return"string"==typeof i&&-1!==s.toLowerCase().indexOf(i.toLowerCase())},lowerize:function(i){return i.toLowerCase()},major:function(i){return"string"==typeof i?i.replace(/[^\d\.]/g,"").split(".")[0]:u},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},g={rgx:function(i,s){for(var e,o,r,n,a,d,t=0;t0?2==t.length?typeof t[1]==n?this[t[0]]=t[1].call(this,w):this[t[0]]=t[1]:3==t.length?typeof t[1]!==n||t[1].exec&&t[1].test?this[t[0]]=w?w.replace(t[1],t[2]):s:this[t[0]]=w?t[1].call(this,w,t[2]):s:4==t.length&&(this[t[0]]=w?t[3].call(this,w.replace(t[1],t[2])):s):this[t]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===d&&e[o].length>0){for(var n=0;n Date: Wed, 4 Dec 2019 07:06:32 -0600 Subject: [PATCH 30/61] Add detection for newer Pixel devices --- src/ua-parser.js | 2 +- test/device-test.json | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index de0579c..713424a 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -566,7 +566,7 @@ /android.+;\s(pixel c)[\s)]/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ - /android.+;\s(pixel( [23])?( xl)?)[\s)]/i // Google Pixel + /android.+;\s(pixel( [2-9]a?)?( xl)?)[\s)]/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models diff --git a/test/device-test.json b/test/device-test.json index 6074665..edb2d13 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -737,6 +737,42 @@ "type": "mobile" } }, + { + "desc": "Google Pixel 3a", + "ua": "Mozilla/5.0 (Linux; Android 10; Pixel 3a) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 3a", + "type": "mobile" + } + }, + { + "desc": "Google Pixel 3a XL", + "ua": "Mozilla/5.0 (Linux; Android 10; Pixel 3a XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 3a XL", + "type": "mobile" + } + }, + { + "desc": "Google Pixel 4", + "ua": "Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 4", + "type": "mobile" + } + }, + { + "desc": "Google Pixel 4 XL", + "ua": "Mozilla/5.0 (Linux; Android 10; Pixel 4 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 4 XL", + "type": "mobile" + } + }, { "desc": "Generic Android Device", "ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; i980 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", From 7fca67cbc7a3bab985f3e91132f29f913925151c Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 14 Dec 2019 05:49:00 +0700 Subject: [PATCH 31/61] Add OS: KaiOS --- src/ua-parser.js | 2 +- test/os-test.json | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 8727c92..15d1c98 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -707,7 +707,7 @@ /\((bb)(10);/i // BlackBerry 10 ], [[NAME, 'BlackBerry'], VERSION], [ /(blackberry)\w*\/?([\w\.]*)/i, // Blackberry - /(tizen)[\/\s]([\w\.]+)/i, // Tizen + /(tizen|kaios)[\/\s]([\w\.]+)/i, // Tizen/KaiOS /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki/Sailfish OS ], [NAME, VERSION], [ diff --git a/test/os-test.json b/test/os-test.json index a2a2411..b944ac0 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -548,6 +548,15 @@ "version" : "R1" } }, + { + "desc" : "KaiOS", + "ua" : "Mozilla/5.0 (Mobile; Nokia_8110_4G; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5", + "expect" : + { + "name" : "KAIOS", + "version" : "2.5" + } + }, { "desc" : "AIX", "ua" : "", From 5cbd2fa795d9e1c0fdb7f2634b0f0869e6b8c0c0 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 14 Dec 2019 06:18:46 +0700 Subject: [PATCH 32/61] Fix #389 TypeError when $=null --- src/ua-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 15d1c98..7e0835a 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -886,7 +886,7 @@ // jQuery always exports to global scope, unless jQuery.noConflict(true) is used, // and we should catch that. var $ = window && (window.jQuery || window.Zepto); - if (typeof $ !== UNDEF_TYPE && !$.ua) { + if ($ && !$.ua) { var parser = new UAParser(); $.ua = parser.getResult(); $.ua.get = function () { From 9da7fd4f9293c4167906900f30d15d7e296547d6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 14 Dec 2019 07:30:43 +0700 Subject: [PATCH 33/61] Fix #395: Add 360 Browser --- src/ua-parser.js | 3 +++ test/browser-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 7e0835a..365bff5 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -345,6 +345,9 @@ /(dolfin)\/([\w\.]+)/i // Dolphin ], [[NAME, 'Dolphin'], VERSION], [ + /(qihu|qhbrowser|qihoobrowser|360browser)/i // 360 + ], [[NAME, '360 Browser']], [ + /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index 29533c0..9544a47 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1,4 +1,14 @@ [ + { + "desc" : "360 Browser on iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/607.3.9 (KHTML, like Gecko) Mobile/16G102 QHBrowser/317 QihooBrowser/4.0.10", + "expect" : + { + "name" : "360 Browser", + "version" : "undefined", + "major" : "undefined" + } + }, { "desc" : "Android Browser on Galaxy Nexus", "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", From d260bcca37540e07004f14b37ee1560ba9bbcf28 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 14 Dec 2019 19:06:53 +0700 Subject: [PATCH 34/61] Remove redundant rule for OnePlus --- src/ua-parser.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 365bff5..67ab4dd 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -593,8 +593,7 @@ ], [[VENDOR, 'Meizu'], MODEL, [TYPE, MOBILE]], [ /android.+a000(1)\s+build/i, // OnePlus - /android.+oneplus\s(a\d{4})\s+build/i, - /android.+oneplus\s(a\d{4})/i + /android.+oneplus\s(a\d{4})[\s)]/i ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets From e14dcd598c4441973895cecda6fcee3d8c862fd6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 14 Dec 2019 22:41:59 +0700 Subject: [PATCH 35/61] Fix #351: Identify Huawei MediaPad as tablet --- src/ua-parser.js | 8 +++++--- test/device-test.json | 9 +++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 67ab4dd..fc2e5ff 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -237,7 +237,6 @@ /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer - // Trident based /(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser @@ -289,7 +288,7 @@ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ - /(brave)\/([\w\.]+)/i // Brave browser + /(brave)\/([\w\.]+)/i // Brave browser ], [[NAME, 'Brave'], VERSION], [ /(qqbrowserlite)\/([\w\.]+)/i // QQBrowserLite @@ -310,7 +309,7 @@ /(MetaSr)[\/\s]?([\w\.]+)/i // SouGouBrowser ], [NAME], [ - /(LBBROWSER)/i // LieBao Browser + /(LBBROWSER)/i // LieBao Browser ], [NAME], [ /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser @@ -494,6 +493,9 @@ /(nexus\s6p|vog-l29|ane-lx1|eml-l29)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ + /android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad + ], [MODEL, [VENDOR, 'Huawei'], [TYPE, TABLET]], [ + /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia ], [VENDOR, MODEL, [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index d218672..61e9755 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1061,6 +1061,15 @@ "type": "tablet" } }, + { + "desc": "HUAWEI MediaPad M3 Lite 10", + "ua": "Mozilla/5.0 (Linux; Android 7.0; BAH-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "BAH-L09", + "type": "tablet" + } + }, { "desc": "Huawei P30 Pro", "ua": "Mozilla/5.0 (Linux; Android 9; VOG-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36", From e1dd27cc3f91dce6c209e1ff238e9ef7ba74098a Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 19 Dec 2019 23:01:31 +0700 Subject: [PATCH 36/61] Update README --- readme.md | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/readme.md b/readme.md index e905d47..5f29a0d 100644 --- a/readme.md +++ b/readme.md @@ -27,19 +27,20 @@ ```sh # Possible 'browser.name': -2345Explorer, Amaya, Android Browser, Arora, Avant, BIDUBrowser, Baidu, -Basilisk, Blazer, Bolt, Bowser, Camino, Chimera, Chrome Headless, -Chrome WebView, Chrome, Chromium, Comodo Dragon, Dillo, Dolphin, Doris, Edge, -Epiphany, Facebook, Falkon, Fennec, Firebird, Firefox, Flock, GSA, GoBrowser, -ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, Iceape, Iceweasel, -Iridium, Iron, Jasmine, K-Meleon, Kindle, Konqueror, LBBROWSER Line, Links, -Lunascape, Lynx, MIUI Browser, Maemo Browser, Maemo, Maxthon, MetaSr Midori, -Minimo, Mobile Safari, Mosaic, Mozilla, NetFront, NetSurf, Netfront, Netscape, -NokiaBrowser, Oculus Browser, OmniWeb, Opera Coast, Opera Mini, Opera Mobi, -Opera Tablet, Opera, PaleMoon, PhantomJS, Phoenix, Polaris, Puffin, QQ, -QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, Safari, Samsung Browser, -SeaMonkey, Silk, Skyfire, Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, -UCBrowser, Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m, ... +2345Explorer, 360 Browser, Amaya, Android Browser, Arora, Avant, Avast, AVG, +BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera, +Chrome Headless, Chrome WebView, Chrome, Chromium, Comodo Dragon, Dillo, +Dolphin, Doris, Edge, Epiphany, Facebook, Falkon, Fennec, Firebird, Firefox, +Flock, GSA, GoBrowser, ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, +Iceape, Iceweasel, Iridium, Iron, Jasmine, K-Meleon, Kindle, Konqueror, +LBBROWSER Line, Links, Lunascape, Lynx, MIUI Browser, Maemo Browser, Maemo, +Maxthon, MetaSr Midori, Minimo, Mobile Safari, Mosaic, Mozilla, NetFront, +NetSurf, Netfront, Netscape, NokiaBrowser, Oculus Browser, OmniWeb, +Opera Coast, Opera Mini, Opera Mobi, Opera Tablet, Opera, PaleMoon, PhantomJS, +Phoenix, Polaris, Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, +RockMelt, Safari, Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, +Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, UCBrowser, Vivaldi, +Waterfox, WeChat, Yandex, baidu, iCab, w3m, ... # 'browser.version' determined dynamically ``` @@ -65,8 +66,8 @@ RIM, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE, ... ```sh # Possible 'engine.name' -Amaya, Blink, EdgeHTML, Gecko, Goanna, iCab, KHTML, Links, Lynx, NetFront, NetSurf, -Presto, Tasman, Trident, w3m, WebKit +Amaya, Blink, EdgeHTML, Gecko, Goanna, iCab, KHTML, Links, Lynx, NetFront, +NetSurf, Presto, Tasman, Trident, w3m, WebKit # 'engine.version' determined dynamically ``` @@ -76,12 +77,13 @@ Presto, Tasman, Trident, w3m, WebKit ```sh # Possible 'os.name' -AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, -Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Fuchsia, Gentoo, GNU, Haiku, Hurd, iOS, -Joli, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, -Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PC-BSD, PCLinuxOS, Plan9, Playstation, QNX, RedHat, -RIM Tablet OS, RISC OS, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, -Ubuntu, Unix, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk, ... +AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, +Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Fuchsia, Gentoo, GNU, +Haiku, Hurd, iOS, Joli, KaiOS, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, +Minix, Mint, Morph OS, NetBSD, Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PC-BSD, +PCLinuxOS, Plan9, Playstation, QNX, RedHat, RIM Tablet OS, RISC OS, Sailfish, +Series40, Slackware, Solaris, SUSE, Symbian, Tizen, Ubuntu, Unix, VectorLinux, +WebOS, Windows [Phone/Mobile], Zenwalk, ... # 'os.version' determined dynamically ``` From 31a0460b607ab426ec56ae98b107b5446d9d6c7d Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 19 Dec 2019 23:11:25 +0700 Subject: [PATCH 37/61] v0.7.21 --- bower.json | 2 +- dist/ua-parser.min.js | 4 ++-- dist/ua-parser.pack.js | 4 ++-- package.js | 2 +- package.json | 2 +- src/ua-parser.js | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index d7496a9..c6ab47b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.20", + "version": "0.7.21", "authors": [ "Faisal Salman " ], diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 38e29fa..edd4d7e 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /*! - * UAParser.js v0.7.20 + * UAParser.js v0.7.21 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2019 Faisal Salman * Licensed under MIT License */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.20",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded";var util={extend:function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},has:function(str1,str2){if(typeof str1==="string"){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1}else{return false}},lowerize:function(str){return str.toLowerCase()},major:function(version){return typeof version===STR_TYPE?version.replace(/[^\d\.]/g,"").split(".")[0]:undefined},trim:function(str){return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};var mapper={rgx:function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j * Licensed under MIT License */ -!function(i,s){"use strict";var e="0.7.20",o="",r="?",n="function",a="undefined",d="object",t="string",l="major",w="model",u="name",c="type",m="vendor",b="version",p="architecture",f="console",g="mobile",h="tablet",v="smarttv",x="wearable",k="embedded",y={extend:function(i,s){var e={};for(var o in i)s[o]&&s[o].length%2===0?e[o]=s[o].concat(i[o]):e[o]=i[o];return e},has:function(i,s){return"string"==typeof i&&s.toLowerCase().indexOf(i.toLowerCase())!==-1},lowerize:function(i){return i.toLowerCase()},major:function(i){return typeof i===t?i.replace(/[^\d\.]/g,"").split(".")[0]:s},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},T={rgx:function(i,e){for(var o,r,a,t,l,w,u=0;u0?2==t.length?typeof t[1]==n?this[t[0]]=t[1].call(this,w):this[t[0]]=t[1]:3==t.length?typeof t[1]!==n||t[1].exec&&t[1].test?this[t[0]]=w?w.replace(t[1],t[2]):s:this[t[0]]=w?t[1].call(this,w,t[2]):s:4==t.length&&(this[t[0]]=w?t[3].call(this,w.replace(t[1],t[2])):s):this[t]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===d&&e[o].length>0){for(var n=0;n0?2==t.length?typeof t[1]==a?this[t[0]]=t[1].call(this,l):this[t[0]]=t[1]:3==t.length?typeof t[1]!==a||t[1].exec&&t[1].test?this[t[0]]=l?l.replace(t[1],t[2]):s:this[t[0]]=l?t[1].call(this,l,t[2]):s:4==t.length&&(this[t[0]]=l?t[3].call(this,l.replace(t[1],t[2])):s):this[t]=l?l:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===d&&e[o].length>0){for(var a=0;a (http://faisalman.com)", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ diff --git a/src/ua-parser.js b/src/ua-parser.js index fc2e5ff..1a57e88 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /*! - * UAParser.js v0.7.20 + * UAParser.js v0.7.21 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.20', + var LIBVERSION = '0.7.21', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', From fc08e23f54addee24df1a97eaf687c44ea639c74 Mon Sep 17 00:00:00 2001 From: Tony Tomarchio Date: Tue, 12 Nov 2019 09:36:45 -0800 Subject: [PATCH 38/61] Detect Huawei Mate 20 Pro --- src/ua-parser.js | 2 +- test/device-test.json | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d284b26..ec6d785 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -490,7 +490,7 @@ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, - /(nexus\s6p|vog-l29|ane-lx1|eml-l29)/i // Huawei + /(nexus\s6p|vog-l29|ane-lx1|eml-l29|lya-l09)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad diff --git a/test/device-test.json b/test/device-test.json index 35d25f5..9d3517e 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1132,5 +1132,14 @@ "model": "EML-L29", "type": "mobile" } + }, + { + "desc": "Huawei Mate 20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; LYA-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LYA-L09", + "type": "mobile" + } } ] From feafa4d0278e1f243cdc94eb5c20a06b5dee4c0d Mon Sep 17 00:00:00 2001 From: Tony Tomarchio Date: Tue, 12 Nov 2019 09:44:12 -0800 Subject: [PATCH 39/61] Detect Huawei P20 Pro --- src/ua-parser.js | 2 +- test/device-test.json | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index ec6d785..75f9eed 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -490,7 +490,7 @@ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, - /(nexus\s6p|vog-l29|ane-lx1|eml-l29|lya-l09)/i // Huawei + /(nexus\s6p|vog-l29|ane-lx1|eml-l29|lya-l09|clt-l29)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad diff --git a/test/device-test.json b/test/device-test.json index 9d3517e..75ae433 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1133,6 +1133,15 @@ "type": "mobile" } }, + { + "desc": "Huawei P20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; CLT-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "CLT-L29", + "type": "mobile" + } + }, { "desc": "Huawei Mate 20 Pro", "ua": "Mozilla/5.0 (Linux; Android 9; LYA-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", From b45bd07bab830415b403e4755c8e0f1bd8234883 Mon Sep 17 00:00:00 2001 From: Tony Tomarchio Date: Wed, 4 Dec 2019 16:23:01 -0800 Subject: [PATCH 40/61] Add additional model numbers for Huawei Mate 20 Pro --- src/ua-parser.js | 2 +- test/device-test.json | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 75f9eed..56df865 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -490,7 +490,7 @@ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, - /(nexus\s6p|vog-l29|ane-lx1|eml-l29|lya-l09|clt-l29)/i // Huawei + /(nexus\s6p|vog-l29|ane-lx1|eml-l29|lya-l09|clt-l29|lya-al00|lya-al10|lya-l0c|lya-l29|lya-tl00)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad diff --git a/test/device-test.json b/test/device-test.json index 75ae433..a0bf104 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1150,5 +1150,50 @@ "model": "LYA-L09", "type": "mobile" } + }, + { + "desc": "Huawei Mate 20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; LYA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LYA-AL00", + "type": "mobile" + } + }, + { + "desc": "Huawei Mate 20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; LYA-AL10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LYA-AL10", + "type": "mobile" + } + }, + { + "desc": "Huawei Mate 20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; LYA-L0C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LYA-L0C", + "type": "mobile" + } + }, + { + "desc": "Huawei Mate 20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; LYA-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LYA-L29", + "type": "mobile" + } + }, + { + "desc": "Huawei Mate 20 Pro", + "ua": "Mozilla/5.0 (Linux; Android 9; LYA-TL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.90 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LYA-TL00", + "type": "mobile" + } } ] From a8eac11d823cb1011db91d6dff9da639db654583 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 21 Dec 2019 05:49:32 +0700 Subject: [PATCH 41/61] Simplify Huawei regex --- src/ua-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 3a55077..0717e67 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -489,8 +489,8 @@ /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ - /d\/huawei([\w\s-]+)[;\)]/i, - /(nexus\s6p|vog-l29|ane-lx1|eml-l29|lya-l09|clt-l29|lya-al00|lya-al10|lya-l0c|lya-l29|lya-tl00)/i // Huawei + /d\/huawei([\w\s-]+)[;\)]/i, // Huawei + /android.+\s(nexus\s6p|vog-[at]?l\d\d|ane-[at]?l[x\d]\d|eml-a?l\d\da?|lya-[at]?l\d[\dc]|clt-a?l\d\di?)/i ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad From ec0d7c037a0591bdb18438f901c4ca2de4811e69 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sun, 5 Jan 2020 12:45:40 +0100 Subject: [PATCH 42/61] Tabs => spaces --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 5f29a0d..5b899a5 100644 --- a/readme.md +++ b/readme.md @@ -116,7 +116,7 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ... - +