From 2e5dff95c8b9d62fb79b85c8b6f625ec60bc09ac Mon Sep 17 00:00:00 2001 From: niris Date: Tue, 3 Nov 2015 16:05:37 +0800 Subject: [PATCH 001/170] add support for wechat --- src/ua-parser.js | 11 +++++++---- test/browser-test.json | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index cf00131..963497f 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -267,10 +267,13 @@ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ - /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i, - // Chrome/OmniWeb/Arora/Tizen/Nokia - /(qqbrowser)[\/\s]?([\w\.]+)/i - // QQBrowser + /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia + ], [NAME, VERSION], [ + + /(MicroMessenger)\/([\w\.]+)/i // WeChat + ], [[NAME, 'WeChat'], VERSION], [ + + /(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser ], [NAME, VERSION], [ /(uc\s?browser)[\/\s]?([\w\.]+)/i, diff --git a/test/browser-test.json b/test/browser-test.json index 2e4d294..d4b2e5c 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -689,6 +689,26 @@ "major" : "7" } }, + { + "desc": "WeChat on iOS", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H321 MicroMessenger/6.3.6 NetType/WIFI Language/zh_CN", + "expect": + { + "name": "WeChat", + "version": "6.3.6", + "major": "6" + } + }, + { + "desc": "WeChat on Android", + "ua": "Mozilla/5.0 (Linux; U; Android 5.1; zh-cn; Lenovo K50-t5 Build/LMY47D) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.4 TBS/025478 Mobile Safari/533.1 MicroMessenger/6.3.5.50_r1573191.640 NetType/WIFI Language/zh_CN", + "expect": + { + "name": "WeChat", + "version": "6.3.5.50_r1573191.640", + "major": "6" + } + }, { "desc" : "Vivaldi", "ua" : "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Vivaldi/1.0.83.38 Safari/537.36", From 909d6fc26d0ecbff86c7c28a6b4688a32c97c397 Mon Sep 17 00:00:00 2001 From: Andrea Vaghi Date: Thu, 28 Jan 2016 11:01:05 +0100 Subject: [PATCH 002/170] Optimized pattern for Android browser, moved them before the Chrome pattern to avoid errors in the some of the newest browsers --- src/ua-parser.js | 23 +++--- test/browser-test.json | 176 ++++++++++++++++++++++++----------------- 2 files changed, 116 insertions(+), 83 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 009bae8..278124c 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -232,7 +232,8 @@ /(opera\smini)\/([\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet /(opera).+version\/([\w\.]+)/i, // Opera > 9.80 - /(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80 + /(opera)[\/\s]+([\w\.]+)/i, // Opera < 9.80 + /(opios)\/([\w\.-]+)/i // Opera Mini on iOS ], [NAME, VERSION], [ @@ -267,6 +268,14 @@ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ + /XiaoMi\/MiuiBrowser\/([\w\.]+)/i // MIUI Browser + ], [VERSION, [NAME, 'MIUI Browser']], [ + + /android.+samsungbrowser\/([\w\.]+)/i, + /android.+version\/([\w\.]+)/i, + /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i // Android Browser + ], [VERSION, [NAME, 'Android Browser']], [ + /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i, // Chrome/OmniWeb/Arora/Tizen/Nokia /(qqbrowser)[\/\s]?([\w\.]+)/i @@ -285,12 +294,6 @@ /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION], [ - /XiaoMi\/MiuiBrowser\/([\w\.]+)/i // MIUI Browser - ], [VERSION, [NAME, 'MIUI Browser']], [ - - /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i // Android Browser - ], [VERSION, [NAME, 'Android Browser']], [ - /FBAV\/([\w\.]+);/i // Facebook App for iOS ], [VERSION, [NAME, 'Facebook']], [ @@ -534,7 +537,7 @@ /(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i // Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ - + /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ @@ -655,7 +658,7 @@ ], [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]], [ @@ -857,7 +860,7 @@ } // jQuery/Zepto specific (optional) - // Note: + // Note: // In AMD env the global scope should be kept clean, but jQuery is an exception. // jQuery always exports to global scope, unless jQuery.noConflict(true) is used, // and we should catch that. diff --git a/test/browser-test.json b/test/browser-test.json index 90af603..891c191 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -2,7 +2,7 @@ { "desc" : "Android Browser on HTC Flyer (P510E)", "ua" : "Mozilla/5.0 (Linux; U; Android 3.2.1; ru-ru; HTC Flyer P510e Build/HTK75C) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13", - "expect" : + "expect" : { "name" : "Android Browser", "version" : "4.0", @@ -12,17 +12,37 @@ { "desc" : "Android Browser on Huawei Honor Glory II (U9508)", "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; ru-by; HUAWEI U9508 Build/HuaweiU9508) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 ACHEETAHI/2100050044", - "expect" : + "expect" : { "name" : "Android Browser", "version" : "4.0", "major" : "4" } }, + { + "desc" : "Android Browser on Huawei P8 (H891L)", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.4; HUAWEI H891L Build/HuaweiH891L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36", + "expect" : + { + "name" : "Android Browser", + "version" : "4.0", + "major" : "4" + } + }, + { + "desc" : "Android Browser on Samsung S6 (SM-G925F)", + "ua" : "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-G925F Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.0 Chrome/38.0.2125.102 Mobile Safari/537.36", + "expect" : + { + "name" : "Android Browser", + "version" : "3.0", + "major" : "3" + } + }, { "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", - "expect" : + "expect" : { "name" : "Arora", "version" : "0.2", @@ -32,7 +52,7 @@ { "desc" : "Avant", "ua" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", - "expect" : + "expect" : { "name" : "Avant ", "version" : "undefined", @@ -42,7 +62,7 @@ { "desc" : "Baidu", "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", - "expect" : + "expect" : { "name" : "baidu", "version" : "1.x", @@ -52,7 +72,7 @@ { "desc" : "Bolt", "ua" : "Mozilla/5.0 (X11; 78; CentOS; US-en) AppleWebKit/527+ (KHTML, like Gecko) Bolt/0.862 Version/3.0 Safari/523.15", - "expect" : + "expect" : { "name" : "Bolt", "version" : "0.862", @@ -62,7 +82,7 @@ { "desc" : "Camino", "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en; rv:1.9.0.19) Gecko/2011091218 Camino/2.0.9 (like Firefox/3.0.19)", - "expect" : + "expect" : { "name" : "Camino", "version" : "2.0.9", @@ -72,7 +92,7 @@ { "desc" : "Chimera", "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-PL; rv:1.0.1) Gecko/20021111 Chimera/0.6", - "expect" : + "expect" : { "name" : "Chimera", "version" : "0.6", @@ -82,7 +102,7 @@ { "desc" : "Chrome", "ua" : "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6", - "expect" : + "expect" : { "name" : "Chrome", "version" : "20.0.1090.0", @@ -92,7 +112,7 @@ { "desc" : "Chrome on iOS", "ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3", - "expect" : + "expect" : { "name" : "Chrome", "version" : "19.0.1084.60", @@ -102,7 +122,7 @@ { "desc" : "Chromium", "ua" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Ubuntu/11.10 Chromium/16.0.912.21 Chrome/16.0.912.21 Safari/535.7", - "expect" : + "expect" : { "name" : "Chromium", "version" : "16.0.912.21", @@ -112,7 +132,7 @@ { "desc" : "Chrome on Android", "ua" : "Mozilla/5.0 (Linux; U; Android-4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7", - "expect" : + "expect" : { "name" : "Chrome", "version" : "16.0.912.75", @@ -122,7 +142,7 @@ { "desc" : "Dillo", "ua" : "Dillo/2.2", - "expect" : + "expect" : { "name" : "Dillo", "version" : "2.2", @@ -132,7 +152,7 @@ { "desc" : "Dolphin", "ua" : "Mozilla/5.0 (SCH-F859/F859DG12;U;NUCLEUS/2.1;Profile/MIDP-2.1 Configuration/CLDC-1.1;480*800;CTC/2.0) Dolfin/2.0", - "expect" : + "expect" : { "name" : "Dolphin", "version" : "2.0", @@ -142,7 +162,7 @@ { "desc" : "Doris", "ua" : "Doris/1.15 [en] (Symbian)", - "expect" : + "expect" : { "name" : "Doris", "version" : "1.15", @@ -152,7 +172,7 @@ { "desc" : "Epiphany", "ua" : "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040628 Epiphany/1.2.6", - "expect" : + "expect" : { "name" : "Epiphany", "version" : "1.2.6", @@ -162,7 +182,7 @@ { "desc" : "Firebird", "ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7", - "expect" : + "expect" : { "name" : "Firebird", "version" : "0.7", @@ -172,7 +192,7 @@ { "desc" : "Firefox", "ua" : "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2", - "expect" : + "expect" : { "name" : "Firefox", "version" : "15.0a2", @@ -182,7 +202,7 @@ { "desc" : "Fennec", "ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1", - "expect" : + "expect" : { "name" : "Fennec", "version" : "1.0a1", @@ -192,7 +212,7 @@ { "desc" : "Flock", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008100716 Firefox/3.0.3 Flock/2.0", - "expect" : + "expect" : { "name" : "Flock", "version" : "2.0", @@ -202,7 +222,7 @@ { "desc" : "GoBrowser", "ua" : "Nokia5700XpressMusic/GoBrowser/1.6.91", - "expect" : + "expect" : { "name" : "GoBrowser", "version" : "1.6.91", @@ -212,7 +232,7 @@ { "desc" : "IceApe", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.19) Gecko/20110817 Iceape/2.0.14", - "expect" : + "expect" : { "name" : "Iceape", "version" : "2.0.14", @@ -222,7 +242,7 @@ { "desc" : "IceCat", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092921 IceCat/3.0.3-g1", - "expect" : + "expect" : { "name" : "IceCat", "version" : "3.0.3-g1", @@ -232,7 +252,7 @@ { "desc" : "Iceweasel", "ua" : "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.16) Gecko/2009121610 Iceweasel/3.0.6 (Debian-3.0.6-3)", - "expect" : + "expect" : { "name" : "Iceweasel", "version" : "3.0.6", @@ -242,7 +262,7 @@ { "desc" : "iCab", "ua" : "iCab/2.9.5 (Macintosh; U; PPC; Mac OS X)", - "expect" : + "expect" : { "name" : "iCab", "version" : "2.9.5", @@ -252,7 +272,7 @@ { "desc" : "IEMobile", "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) 320x240; VZW; Motorola-Q9c; Windows Mobile 6.1 Standard", - "expect" : + "expect" : { "name" : "IEMobile", "version" : "7.11", @@ -262,7 +282,7 @@ { "desc" : "IE 11 with IE token", "ua" : "Mozilla/5.0 (IE 11.0; Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko", - "expect" : + "expect" : { "name" : "IE", "version" : "11.0", @@ -272,7 +292,7 @@ { "desc" : "IE 11 without IE token", "ua" : "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko", - "expect" : + "expect" : { "name" : "IE", "version" : "11.0", @@ -282,7 +302,7 @@ { "desc" : "K-Meleon", "ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031016 K-Meleon/0.8.2", - "expect" : + "expect" : { "name" : "K-Meleon", "version" : "0.8.2", @@ -292,17 +312,17 @@ { "desc" : "Kindle Browser", "ua" : "Mozilla/4.0 (compatible; Linux 2.6.22) NetFront/3.4 Kindle/2.5 (screen 600x800; rotate)", - "expect" : + "expect" : { "name" : "Kindle", "version" : "2.5", "major" : "2" } - }, + }, { "desc" : "Konqueror", "ua" : "Mozilla/5.0 (compatible; Konqueror/3.5; Linux; X11; x86_64) KHTML/3.5.6 (like Gecko) (Kubuntu)", - "expect" : + "expect" : { "name" : "Konqueror", "version" : "3.5", @@ -312,7 +332,7 @@ { "desc" : "Lunascape", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090804 Firefox/3.5.2 Lunascape/5.1.4.5", - "expect" : + "expect" : { "name" : "Lunascape", "version" : "5.1.4.5", @@ -322,7 +342,7 @@ { "desc" : "Lynx", "ua" : "Lynx/2.8.5dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6b", - "expect" : + "expect" : { "name" : "Lynx", "version" : "2.8.5dev.16", @@ -332,7 +352,7 @@ { "desc" : "Maemo Browser", "ua" : "Mozilla/5.0 (X11; U; Linux armv7l; ru-RU; rv:1.9.2.3pre) Gecko/20100723 Firefox/3.5 Maemo Browser 1.7.4.8 RX-51 N900", - "expect" : + "expect" : { "name" : "Maemo Browser", "version" : "1.7.4.8", @@ -342,7 +362,7 @@ { "desc" : "Maxthon", "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)", - "expect" : + "expect" : { "name" : "Maxthon", "version" : "undefined", @@ -352,7 +372,7 @@ { "desc" : "Midori", "ua" : "Midori/0.2.2 (X11; Linux i686; U; en-us) WebKit/531.2+", - "expect" : + "expect" : { "name" : "Midori", "version" : "0.2.2", @@ -362,7 +382,7 @@ { "desc" : "Minimo", "ua" : "Mozilla/5.0 (X11; U; Linux armv6l; rv 1.8.1.5pre) Gecko/20070619 Minimo/0.020", - "expect" : + "expect" : { "name" : "Minimo", "version" : "0.020", @@ -372,7 +392,7 @@ { "desc" : "MIUI Browser on Xiaomi Hongmi WCDMA (HM2013023)", "ua" : "Mozilla/5.0 (Linux; U; Android 4.2.2; ru-ru; 2013023 Build/HM2013023) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 XiaoMi/MiuiBrowser/1.0", - "expect" : + "expect" : { "name" : "MIUI Browser", "version" : "1.0", @@ -382,7 +402,7 @@ { "desc" : "Mobile Safari", "ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7", - "expect" : + "expect" : { "name" : "Mobile Safari", "version" : "4.0.5", @@ -392,7 +412,7 @@ { "desc" : "Mosaic", "ua" : "NCSA_Mosaic/2.6 (X11; SunOS 4.1.3 sun4m)", - "expect" : + "expect" : { "name" : "Mosaic", "version" : "2.6", @@ -402,7 +422,7 @@ { "desc" : "Mozilla", "ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7) Gecko/20070606", - "expect" : + "expect" : { "name" : "Mozilla", "version" : "5.0", @@ -412,7 +432,7 @@ { "desc" : "MSIE", "ua" : "Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)", - "expect" : + "expect" : { "name" : "IE", "version" : "5.0b1", @@ -422,7 +442,7 @@ { "desc" : "NetFront", "ua" : "Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0", - "expect" : + "expect" : { "name" : "NetFront", "version" : "3.0", @@ -432,7 +452,7 @@ { "desc" : "Netscape on Windows ME", "ua" : "Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.8.1.8pre) Gecko/20071015 Firefox/2.0.0.7 Navigator/9.0", - "expect" : + "expect" : { "name" : "Netscape", "version" : "9.0", @@ -442,7 +462,7 @@ { "desc" : "Netscape on Windows 2000", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20050519 Netscape/8.0.1", - "expect" : + "expect" : { "name" : "Netscape", "version" : "8.0.1", @@ -452,7 +472,7 @@ { "desc" : "Nokia Browser", "ua" : "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/025.007; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.37 Mobile Safari/533.4 3gpp-gba", - "expect" : + "expect" : { "name" : "NokiaBrowser", "version" : "7.3.1.37", @@ -462,7 +482,7 @@ { "desc" : "OmniWeb", "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.48", - "expect" : + "expect" : { "name" : "OmniWeb", "version" : "558.48", @@ -472,7 +492,7 @@ { "desc" : "Opera > 9.80", "ua" : "Opera/9.80 (X11; Linux x86_64; U; Linux Mint; en) Presto/2.2.15 Version/10.10", - "expect" : + "expect" : { "name" : "Opera", "version" : "10.10", @@ -482,7 +502,7 @@ { "desc" : "Opera < 9.80 on Windows", "ua" : "Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 6.01 [en]", - "expect" : + "expect" : { "name" : "Opera", "version" : "6.01", @@ -492,7 +512,7 @@ { "desc" : "Opera < 9.80 on OSX", "ua" : "Opera/8.5 (Macintosh; PPC Mac OS X; U; en)", - "expect" : + "expect" : { "name" : "Opera", "version" : "8.5", @@ -502,7 +522,7 @@ { "desc" : "Opera Mobile", "ua" : "Opera/9.80 (Android 2.3.5; Linux; Opera Mobi/ADR-1111101157; U; de) Presto/2.9.201 Version/11.50", - "expect" : + "expect" : { "name" : "Opera Mobi", "version" : "11.50", @@ -512,7 +532,7 @@ { "desc" : "Opera Webkit", "ua" : "Mozilla/5.0 AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.123 Mobile Safari/537.22 OPR/14.0.1025.52315", - "expect" : + "expect" : { "name" : "Opera", "version" : "14.0.1025.52315", @@ -522,17 +542,27 @@ { "desc" : "Opera Mini", "ua" : "Opera/9.80 (J2ME/MIDP; Opera Mini/5.1.21214/19.916; U; en) Presto/2.5.25", - "expect" : + "expect" : { "name" : "Opera Mini", "version" : "5.1.21214", "major" : "5" } }, + { + "desc" : "Opera Mini 8 above on iPhone", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) OPiOS/12.1.1.98980 Mobile/13C75 Safari/9537.53", + "expect" : + { + "name" : "OPiOS", + "version" : "12.1.1.98980", + "major" : "12" + } + }, { "desc" : "Opera Tablet", "ua" : "Opera/9.80 (Windows NT 6.1; Opera Tablet/15165; U; en) Presto/2.8.149 Version/11.1", - "expect" : + "expect" : { "name" : "Opera Tablet", "version" : "11.1", @@ -552,7 +582,7 @@ { "desc" : "Phoenix", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021029 Phoenix/0.4", - "expect" : + "expect" : { "name" : "Phoenix", "version" : "0.4", @@ -562,7 +592,7 @@ { "desc" : "Polaris", "ua" : "LG-LX600 Polaris/6.0 MMP/2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1", - "expect" : + "expect" : { "name" : "Polaris", "version" : "6.0", @@ -572,7 +602,7 @@ { "desc" : "RockMelt", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) RockMelt/0.8.36.78 Chrome/7.0.517.44 Safari/534.7", - "expect" : + "expect" : { "name" : "RockMelt", "version" : "0.8.36.78", @@ -582,7 +612,7 @@ { "desc" : "Safari", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8", - "expect" : + "expect" : { "name" : "Safari", "version" : "5.0.1", @@ -592,7 +622,7 @@ { "desc" : "Safari < 3.0", "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3", - "expect" : + "expect" : { "name" : "Safari", "version" : "2.0.4", @@ -602,7 +632,7 @@ { "desc" : "SeaMonkey", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b4pre) Gecko/20090405 SeaMonkey/2.0b1pre", - "expect" : + "expect" : { "name" : "SeaMonkey", "version" : "2.0b1pre", @@ -612,7 +642,7 @@ { "desc" : "Silk Browser", "ua" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-84)", - "expect" : + "expect" : { "name" : "Silk", "version" : "1.1.0-84", @@ -622,7 +652,7 @@ { "desc" : "Skyfire", "ua" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17 Skyfire/2.0", - "expect" : + "expect" : { "name" : "Skyfire", "version" : "2.0", @@ -632,7 +662,7 @@ { "desc" : "SlimBrowser", "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)", - "expect" : + "expect" : { "name" : "Slim", "version" : "undefined", @@ -642,7 +672,7 @@ { "desc" : "Swiftfox", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0 (Swiftfox)", - "expect" : + "expect" : { "name" : "Swiftfox", "version" : "undefined", @@ -652,7 +682,7 @@ { "desc" : "Tizen Browser", "ua" : "Mozilla/5.0 (Linux; U; Tizen/1.0 like Android; en-us; AppleWebKit/534.46 (KHTML, like Gecko) Tizen Browser/1.0 Mobile", - "expect" : + "expect" : { "name" : "Tizen Browser", "version" : "1.0", @@ -662,7 +692,7 @@ { "desc" : "UC Browser on Samsung", "ua" : "Mozilla/5.0 (Java; U; Pt-br; samsung-gt-s5620) UCBrowser8.2.1.144/69/352/UCWEB Mobile UNTRUSTED/1.0", - "expect" : + "expect" : { "name" : "UCBrowser", "version" : "8.2.1.144", @@ -672,7 +702,7 @@ { "desc" : "UC Browser on Nokia", "ua" : "Mozilla/5.0 (S60V3; U; en-in; NokiaN73)/UC Browser8.4.0.159/28/351/UCWEB Mobile", - "expect" : + "expect" : { "name" : "UCBrowser", "version" : "8.4.0.159", @@ -682,7 +712,7 @@ { "desc" : "UC Browser J2ME", "ua" : "UCWEB/2.0 (MIDP-2.0; U; zh-CN; HTC EVO 3D X515m) U2/1.0.0 UCBrowser/10.4.0.558 U2/1.0.0 Mobile", - "expect" : + "expect" : { "name" : "UCBrowser", "version" : "10.4.0.558", @@ -692,7 +722,7 @@ { "desc" : "UC Browser J2ME 2", "ua" : "JUC (Linux; U; 2.3.5; zh-cn; GT-I9100; 480*800) UCWEB7.9.0.94/139/800", - "expect" : + "expect" : { "name" : "UCBrowser", "version" : "7.9.0.94", @@ -702,7 +732,7 @@ { "desc" : "Vivaldi", "ua" : "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Vivaldi/1.0.83.38 Safari/537.36", - "expect" : + "expect" : { "name" : "Vivaldi", "version" : "1.0.83.38", @@ -712,7 +742,7 @@ { "desc" : "Yandex", "ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.5 (KHTML, like Gecko) YaBrowser/1.0.1084.5402 Chrome/19.0.1084.5402 Safari/536.5", - "expect" : + "expect" : { "name" : "Yandex", "version" : "1.0.1084.5402", @@ -722,7 +752,7 @@ { "desc" : "Microsoft Edge", "ua" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0", - "expect" : + "expect" : { "name" : "Edge", "version" : "12.0", From 4344c43d04c8c28910236ce41dd423fafd4c682f Mon Sep 17 00:00:00 2001 From: Andrea Vaghi Date: Thu, 28 Jan 2016 11:05:27 +0100 Subject: [PATCH 003/170] run build --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index f9607b8..908a897 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -5,4 +5,4 @@ * * Copyright © 2012-2015 Faisal Salman * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.9",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){for(var n in t)"browser cpu device engine os".indexOf(n)!==-1&&t[n].length%2===0&&(e[n]=t[n].concat(e[n]));return e},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.9",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){for(var n in t)"browser cpu device engine os".indexOf(n)!==-1&&t[n].length%2===0&&(e[n]=t[n].concat(e[n]));return e},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s Date: Fri, 26 Feb 2016 18:53:43 +0100 Subject: [PATCH 004/170] Get SmartTV device by HbbTV part --- src/ua-parser.js | 10 ++++++++-- test/device-test.json | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 15bd2f3..358857b 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -67,6 +67,9 @@ }, major : function (version) { return typeof(version) === STR_TYPE ? version.split(".")[0] : undefined; + }, + trim : function (str) { + return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } }; @@ -474,6 +477,9 @@ device : [[ + /hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices + ], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [ + /\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook ], [MODEL, VENDOR, [TYPE, TABLET]], [ @@ -564,8 +570,8 @@ /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ - /(samsung);smarttv/i - ], [VENDOR, MODEL, [TYPE, SMARTTV]], [ + /hbbtv.+maple;(\d+)/i + ], [[MODEL, /^/, 'SmartTV'], [VENDOR, 'Samsung'], [TYPE, SMARTTV]], [ /\(dtv[\);].+(aquos)/i // Sharp ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ diff --git a/test/device-test.json b/test/device-test.json index fa10540..b9e704a 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -99,6 +99,16 @@ "type" : "mobile" } }, + { + "desc" : "Philips SmartTV", + "ua" : "Opera/9.80 HbbTV/1.1.1 (; Philips; ; ; ; ) NETTV/4.0.2; en) Version/11.60", + "expect" : + { + "vendor" : "Philips", + "model" : "", + "type" : "smarttv" + } + }, { "desc" : "Kindle Fire HD", "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true", @@ -139,6 +149,36 @@ "type" : "tablet" } }, + { + "desc" : "Samsung SmartTV2011", + "ua" : "HbbTV/1.1.1 (;;;;;) Maple;2011", + "expect" : + { + "vendor" : "Samsung", + "model" : "SmartTV2011", + "type" : "smarttv" + } + }, + { + "desc" : "Samsung SmartTV2012", + "ua" : "HbbTV/1.1.1 (;Samsung;SmartTV2012;;;) WebKit", + "expect" : + { + "vendor" : "Samsung", + "model" : "SmartTV2012", + "type" : "smarttv" + } + }, + { + "desc" : "Samsung SmartTV2014", + "ua" : "HbbTV/1.1.1 (;Samsung;SmartTV2014;T-NT14UDEUC-1060.4;;) WebKit", + "expect" : + { + "vendor" : "Samsung", + "model" : "SmartTV2014", + "type" : "smarttv" + } + }, { "desc" : "Sony C5303 (Xperia SP)", "ua" : "Mozilla/5.0 (Linux; Android 4.3; C5303 Build/12.1.A.1.205) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36", From 5ba9fd50edb742930d4a1dad6703d1d2d6835aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Camblor?= Date: Thu, 17 Mar 2016 18:03:33 +0100 Subject: [PATCH 005/170] Fixed require sample in readme Module name is `ua-parser-js`, not `ua-parser` (see [here](https://github.com/faisalman/ua-parser-js/blob/d929c3e5087fd88083e8012d06fc2da013809757/src/ua-parser.js#L855)) --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f8e5e6a..c711306 100644 --- a/readme.md +++ b/readme.md @@ -191,7 +191,7 @@ console.log('Server running at http://127.0.0.1:1337/'); ### Using requirejs ```js -require(['ua-parser'], function(UAParser) { +require(['ua-parser-js'], function(UAParser) { var parser = new UAParser(); console.log(parser.getResult()); }); From 1020d10a30491eb0f9f77228b7182504a8fe839f Mon Sep 17 00:00:00 2001 From: Benjamin Urban Date: Tue, 22 Mar 2016 15:08:11 +0100 Subject: [PATCH 006/170] Add generic device detection for samsung smartphones --- src/ua-parser.js | 2 +- test/device-test.json | 51 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 15bd2f3..d6f8ce8 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -560,7 +560,7 @@ /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung - /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i, + /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index fa10540..246e0d4 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -268,5 +268,56 @@ "model" : "Galaxy Nexus", "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", + "expect" : + { + "vendor" : "Samsung", + "model" : "SM-G900F", + "type" : "mobile" + } + }, + { + "desc" : "Samsung Galaxy S6", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-G920I Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect" : + { + "vendor" : "Samsung", + "model" : "SM-G920I", + "type" : "mobile" + } + }, + { + "desc" : "Samsung Galaxy S6 Edge", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-G925I Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect" : + { + "vendor" : "Samsung", + "model" : "SM-G925I", + "type" : "mobile" + } + }, + { + "desc" : "Samsung Galaxy Note 5 Chrome", + "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; SM-N920C Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.91 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Samsung", + "model" : "SM-N920C", + "type" : "mobile" + } + } +, + { + "desc" : "Samsung Galaxy Note 5 Samsung Browser", + "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-N920C Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Samsung", + "model" : "SM-N920C", + "type" : "mobile" + } } ] From b254f93ec1d4e9d93456b85a3512d581388456d1 Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Mon, 23 May 2016 11:33:12 +0200 Subject: [PATCH 007/170] rewrote license field to be SPDX compatible According to [NPM docs](https://docs.npmjs.com/files/package.json#license) the `license` field in package.json should be SPDX compatible. [SPDX](https://spdx.org/licenses/) is a format which allows you to specify your licenses in an easy understandable, machine parseable way. These changes reflect your license choice according to #1 --- package.json | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/package.json b/package.json index fa3f493..b70f0d5 100644 --- a/package.json +++ b/package.json @@ -70,16 +70,7 @@ "type": "git", "url": "https://github.com/faisalman/ua-parser-js.git" }, - "licenses": [ - { - "type": "GPLv2", - "url": "http://www.gnu.org/licenses/gpl-2.0.html" - }, - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/mit-license.php" - } - ], + "license": "(GPL-2.0 OR MIT)", "engines": { "node": "*" }, From c3f7294a44ccca69357e2cbc429517a73618a99f Mon Sep 17 00:00:00 2001 From: Lithin Date: Thu, 26 May 2016 19:01:11 +0530 Subject: [PATCH 008/170] Add device detection for HP 10 tablet --- dist/ua-parser.min.js | 9 ++++++++- dist/ua-parser.pack.js | 9 ++++++++- src/ua-parser.js | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 083827d..11be3f2 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1 +1,8 @@ -(function(window,undefined){"use strict";var LIBVERSION="0.7.10",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.split(".")[0]:undefined}};var mapper={rgx:function(){var result,i=0,j,k,p,q,matches,match,args=arguments;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){result[q[0]]=q[1].call(this,match)}else{result[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){result[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{result[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){result[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{result[q]=match?match:undefined}}}}i+=2}return result},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 & MIT + */(function(e,t){"use strict";var n="0.7.10",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?2==w.length?i[w[0]]=typeof w[1]==n?w[1].call(this,d):w[1]:3==w.length?i[w[0]]=typeof w[1]!==n||w[1].exec&&w[1].test?d?d.replace(w[1],w[2]):s:d?w[1].call(this,d,w[2]):s:4==w.length&&(i[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):i[w]=d?d:s;p+=2}return i},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n + * Dual licensed under GPLv2 & MIT + */(function(e,t){"use strict";var n="0.7.10",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s Date: Tue, 18 Oct 2016 17:10:36 +0800 Subject: [PATCH 009/170] Add CDNJS version badge in readme This will add the badge to show its version on CDNJS and also link to its page on CDNJS! --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index c711306..4e544f2 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,7 @@ Lightweight JavaScript-based User-Agent string parser. Supports browser & node.j [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/3867907/faisalmanua-parser-js-on-GitHub) +[![CDNJS](https://img.shields.io/cdnjs/v/UAParser.js.svg)](https://cdnjs.com/libraries/UAParser.js) * Author : Faisal Salman <> * Demo : http://faisalman.github.io/ua-parser-js From bf4c2e170e5d127c8f44b1d2a74a933983236ac0 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 29 Oct 2016 00:39:20 +0700 Subject: [PATCH 010/170] Fix #174: "Tablet PC" != tablet device --- 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 15bd2f3..2e847ec 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -604,8 +604,8 @@ /android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ - /\s(tablet)[;\/\s]/i, // Unidentifiable Tablet - /\s(mobile)[;\/\s]/i // Unidentifiable Mobile + /\s(tablet)[;\/]/i, // Unidentifiable Tablet + /\s(mobile)[;\/]/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] /*////////////////////////// From c71373b666e8461e020d6efa80bcc096d755f1bf Mon Sep 17 00:00:00 2001 From: Martynas Date: Thu, 3 Nov 2016 19:50:51 +0200 Subject: [PATCH 011/170] Add HTML imports entry-point --- dist/ua-parser.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 dist/ua-parser.html diff --git a/dist/ua-parser.html b/dist/ua-parser.html new file mode 100644 index 0000000..1e530bb --- /dev/null +++ b/dist/ua-parser.html @@ -0,0 +1 @@ + From c03a84a6019e650fa7767e7078f5bc7a26d72257 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 7 Nov 2016 00:28:20 +0700 Subject: [PATCH 012/170] Add WeChat --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 4e544f2..6345500 100644 --- a/readme.md +++ b/readme.md @@ -30,7 +30,7 @@ Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, -Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, Yandex +Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex # 'browser.version' determined dynamically ``` From 10775bd17c0ec27aeb27bafc3342fd7a07f8118c Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 7 Nov 2016 00:37:33 +0700 Subject: [PATCH 013/170] Increment build version to 0.7.11 --- bower.json | 2 +- component.json | 2 +- dist/ua-parser.min.js | 6 +++--- dist/ua-parser.pack.js | 6 +++--- package.js | 2 +- package.json | 2 +- readme.md | 2 +- src/ua-parser.js | 6 +++--- ua-parser-js.jquery.json | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bower.json b/bower.json index 9137147..aacc321 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.10", + "version": "0.7.11", "authors": [ "Faisal Salman " ], diff --git a/component.json b/component.json index 9d40502..5f63724 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.10", + "version": "0.7.11", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ "user-agent", diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 11be3f2..d6a4171 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,8 +1,8 @@ /** - * UAParser.js v0.7.10 + * UAParser.js v0.7.11 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * - * Copyright © 2012-2015 Faisal Salman + * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.10",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s + * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.10",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s (http://faisalman.com)", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ diff --git a/readme.md b/readme.md index 6345500..b759cb1 100644 --- a/readme.md +++ b/readme.md @@ -269,7 +269,7 @@ Then submit a pull request to https://github.com/faisalman/ua-parser-js under `d Dual licensed under GPLv2 & MIT -Copyright © 2012-2015 Faisal Salman <> +Copyright © 2012-2016 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 diff --git a/src/ua-parser.js b/src/ua-parser.js index 0adffca..43f395a 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,9 +1,9 @@ /** - * UAParser.js v0.7.10 + * UAParser.js v0.7.11 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * - * Copyright © 2012-2015 Faisal Salman + * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT */ @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.10', + var LIBVERSION = '0.7.11', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', diff --git a/ua-parser-js.jquery.json b/ua-parser-js.jquery.json index 2163e74..4407936 100644 --- a/ua-parser-js.jquery.json +++ b/ua-parser-js.jquery.json @@ -1,7 +1,7 @@ { "title": "UAParser.js", "name": "ua-parser-js", - "version": "0.7.10", + "version": "0.7.11", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ "user-agent", From f28f87c41262d940c1a3cf73ecb9f2a623173129 Mon Sep 17 00:00:00 2001 From: Levente Balogh Date: Mon, 7 Nov 2016 10:34:08 +0100 Subject: [PATCH 014/170] Fix: don't define the RequireJs module with name If we define it with name it becomes less portable and breaks code that used version `0.7.10`. This is not correct according to **semver**, as this is a `patch` only which should not break APIs. I think defining the module with a name should be a responsibility of build tools / optimisation tools. --- 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 43f395a..0820259 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -862,7 +862,7 @@ } else { // requirejs env (optional) if (typeof(define) === FUNC_TYPE && define.amd) { - define("ua-parser-js", [], function () { + define(function () { return UAParser; }); } else { From a56c990ec32f105219570d398f3398f9373b5a75 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 7 Nov 2016 21:34:05 +0700 Subject: [PATCH 015/170] Fix #188 distinguish webview from chrome --- src/ua-parser.js | 5 ++++- test/browser-test.json | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 43f395a..f61ca15 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -66,7 +66,7 @@ return str.toLowerCase(); }, major : function (version) { - return typeof(version) === STR_TYPE ? version.split(".")[0] : undefined; + 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, ''); @@ -275,6 +275,9 @@ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ + /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView + ], [NAME, [VERSION, /(.+)/, 'WebView $1']], [ + /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index 68ad90b..cd23f64 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -89,6 +89,16 @@ "major" : "20" } }, + { + "desc" : "Chrome WebView", + "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36", + "expect" : + { + "name" : "Chrome", + "version" : "WebView 43.0.2357.65", + "major" : "43" + } + }, { "desc" : "Chrome on iOS", "ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3", From 3dae55a3c8bc82d5b79e5155d7df5e61b17f6623 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 8 Nov 2016 12:55:19 +0700 Subject: [PATCH 016/170] Fix #197 microsoft lumia --- src/ua-parser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 2a01220..7ab4f08 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -556,6 +556,9 @@ /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ + /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia + ], [VENDOR, MODEL, [TYPE, MOBILE]], [ + /[\s\(;](xbox(?:\sone)?)[\s\);]/i // Microsoft Xbox ], [MODEL, [VENDOR, 'Microsoft'], [TYPE, CONSOLE]], [ /(kin\.[onetw]{3})/i // Microsoft Kin @@ -618,7 +621,7 @@ ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ /\s(tablet)[;\/]/i, // Unidentifiable Tablet - /\s(mobile)[;\/]/i // Unidentifiable Mobile + /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] /*////////////////////////// From d1a33d7d8545a6cde4a689ca551a1b49219ae93d Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 8 Nov 2016 12:55:56 +0700 Subject: [PATCH 017/170] Test case for #174 --- test/device-test.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/device-test.json b/test/device-test.json index 640c2aa..0c958cb 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1,4 +1,14 @@ [ + { + "desc" : "Desktop (IE11 with Tablet string)", + "ua" : "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", + "expect" : + { + "vendor" : "undefined", + "model" : "undefined", + "type" : "undefined" + } + }, { "desc" : "HTC Evo Shift 4G", "ua" : "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0", @@ -39,6 +49,16 @@ "type" : "mobile" } }, + { + "desc" : "Microsoft Lumia 950", + "ua" : "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586", + "expect" : + { + "vendor" : "Microsoft", + "model" : "Lumia 950", + "type" : "mobile" + } + }, { "desc" : "Motorola Nexus 6", "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36", From d3f959ee28c26a9464ea4ebc06a75594990e0aca Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 9 Nov 2016 18:09:11 +0700 Subject: [PATCH 018/170] Split mediaplayer test cases, edit readme --- readme.md | 8 +- test/browser&mediaplayer-test.json | 1232 ---------------------------- test/mediaplayer-test.json | 582 +++++++++++++ test/os-test.json | 6 +- 4 files changed, 589 insertions(+), 1239 deletions(-) delete mode 100644 test/browser&mediaplayer-test.json create mode 100644 test/mediaplayer-test.json diff --git a/readme.md b/readme.md index b759cb1..8d7e407 100644 --- a/readme.md +++ b/readme.md @@ -247,10 +247,10 @@ Pass your own regexes to extend the limited matching rules. ```js // Example: -var uaString = 'ownbrowser/1.3'; -var ownBrowser = [[/(ownbrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]]; -var parser = new UAParser(uaString, {browser: ownBrowser}); -console.log(parser.getBrowser()); // {name: "ownbrowser", version: "1.3"} +var uaString = 'MyOwnBrowser/1.3'; +var myOwnRegex = [[/(myownbrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]]; +var parser = new UAParser(uaString, { browser: myOwnRegex }); +console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} ``` ## Development diff --git a/test/browser&mediaplayer-test.json b/test/browser&mediaplayer-test.json deleted file mode 100644 index 35df96b..0000000 --- a/test/browser&mediaplayer-test.json +++ /dev/null @@ -1,1232 +0,0 @@ -[ - { - "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", - "expect" : - { - "name" : "Arora", - "version" : "0.2", - "major" : "0" - } - }, - { - "desc" : "Avant", - "ua" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", - "expect" : - { - "name" : "Avant ", - "version" : "undefined", - "major" : "undefined" - } - }, - { - "desc" : "Baidu", - "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", - "expect" : - { - "name" : "baidu", - "version" : "1.x", - "major" : "1" - } - }, - { - "desc" : "Bolt", - "ua" : "Mozilla/5.0 (X11; 78; CentOS; US-en) AppleWebKit/527+ (KHTML, like Gecko) Bolt/0.862 Version/3.0 Safari/523.15", - "expect" : - { - "name" : "Bolt", - "version" : "0.862", - "major" : "0" - } - }, - { - "desc" : "Camino", - "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en; rv:1.9.0.19) Gecko/2011091218 Camino/2.0.9 (like Firefox/3.0.19)", - "expect" : - { - "name" : "Camino", - "version" : "2.0.9", - "major" : "2" - } - }, - { - "desc" : "Chimera", - "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-PL; rv:1.0.1) Gecko/20021111 Chimera/0.6", - "expect" : - { - "name" : "Chimera", - "version" : "0.6", - "major" : "0" - } - }, - { - "desc" : "Chrome", - "ua" : "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6", - "expect" : - { - "name" : "Chrome", - "version" : "20.0.1090.0", - "major" : "20" - } - }, - { - "desc" : "Chrome on iOS", - "ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3", - "expect" : - { - "name" : "Chrome", - "version" : "19.0.1084.60", - "major" : "19" - } - }, - { - "desc" : "Chromium", - "ua" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Ubuntu/11.10 Chromium/16.0.912.21 Chrome/16.0.912.21 Safari/535.7", - "expect" : - { - "name" : "Chromium", - "version" : "16.0.912.21", - "major" : "16" - } - }, - { - "desc" : "Chrome on Android", - "ua" : "Mozilla/5.0 (Linux; U; Android-4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7", - "expect" : - { - "name" : "Chrome", - "version" : "16.0.912.75", - "major" : "16" - } - }, - { - "desc" : "Dillo", - "ua" : "Dillo/2.2", - "expect" : - { - "name" : "Dillo", - "version" : "2.2", - "major" : "2" - } - }, - { - "desc" : "Dolphin", - "ua" : "Mozilla/5.0 (SCH-F859/F859DG12;U;NUCLEUS/2.1;Profile/MIDP-2.1 Configuration/CLDC-1.1;480*800;CTC/2.0) Dolfin/2.0", - "expect" : - { - "name" : "Dolphin", - "version" : "2.0", - "major" : "2" - } - }, - { - "desc" : "Doris", - "ua" : "Doris/1.15 [en] (Symbian)", - "expect" : - { - "name" : "Doris", - "version" : "1.15", - "major" : "1" - } - }, - { - "desc" : "Epiphany", - "ua" : "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040628 Epiphany/1.2.6", - "expect" : - { - "name" : "Epiphany", - "version" : "1.2.6", - "major" : "1" - } - }, - { - "desc" : "Firebird", - "ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7", - "expect" : - { - "name" : "Firebird", - "version" : "0.7", - "major" : "0" - } - }, - { - "desc" : "Firefox", - "ua" : "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2", - "expect" : - { - "name" : "Firefox", - "version" : "15.0a2", - "major" : "15" - } - }, - { - "desc" : "Fennec", - "ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1", - "expect" : - { - "name" : "Fennec", - "version" : "1.0a1", - "major" : "1" - } - }, - { - "desc" : "Flock", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008100716 Firefox/3.0.3 Flock/2.0", - "expect" : - { - "name" : "Flock", - "version" : "2.0", - "major" : "2" - } - }, - { - "desc" : "GoBrowser", - "ua" : "Nokia5700XpressMusic/GoBrowser/1.6.91", - "expect" : - { - "name" : "GoBrowser", - "version" : "1.6.91", - "major" : "1" - } - }, - { - "desc" : "IceApe", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.19) Gecko/20110817 Iceape/2.0.14", - "expect" : - { - "name" : "Iceape", - "version" : "2.0.14", - "major" : "2" - } - }, - { - "desc" : "IceCat", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092921 IceCat/3.0.3-g1", - "expect" : - { - "name" : "IceCat", - "version" : "3.0.3-g1", - "major" : "3" - } - }, - { - "desc" : "Iceweasel", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.16) Gecko/2009121610 Iceweasel/3.0.6 (Debian-3.0.6-3)", - "expect" : - { - "name" : "Iceweasel", - "version" : "3.0.6", - "major" : "3" - } - }, - { - "desc" : "iCab", - "ua" : "iCab/2.9.5 (Macintosh; U; PPC; Mac OS X)", - "expect" : - { - "name" : "iCab", - "version" : "2.9.5", - "major" : "2" - } - }, - { - "desc" : "IEMobile", - "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) 320x240; VZW; Motorola-Q9c; Windows Mobile 6.1 Standard", - "expect" : - { - "name" : "IEMobile", - "version" : "7.11", - "major" : "7" - } - }, - { - "desc" : "IE 11 with IE token", - "ua" : "Mozilla/5.0 (IE 11.0; Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko", - "expect" : - { - "name" : "IE", - "version" : "11.0", - "major" : "11" - } - }, - { - "desc" : "IE 11 without IE token", - "ua" : "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko", - "expect" : - { - "name" : "IE", - "version" : "11.0", - "major" : "11" - } - }, - { - "desc" : "K-Meleon", - "ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031016 K-Meleon/0.8.2", - "expect" : - { - "name" : "K-Meleon", - "version" : "0.8.2", - "major" : "0" - } - }, - { - "desc" : "Kindle Browser", - "ua" : "Mozilla/4.0 (compatible; Linux 2.6.22) NetFront/3.4 Kindle/2.5 (screen 600x800; rotate)", - "expect" : - { - "name" : "Kindle", - "version" : "2.5", - "major" : "2" - } - }, - { - "desc" : "Konqueror", - "ua" : "Mozilla/5.0 (compatible; Konqueror/3.5; Linux; X11; x86_64) KHTML/3.5.6 (like Gecko) (Kubuntu)", - "expect" : - { - "name" : "Konqueror", - "version" : "3.5", - "major" : "3" - } - }, - { - "desc" : "Lunascape", - "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090804 Firefox/3.5.2 Lunascape/5.1.4.5", - "expect" : - { - "name" : "Lunascape", - "version" : "5.1.4.5", - "major" : "5" - } - }, - { - "desc" : "Lynx", - "ua" : "Lynx/2.8.5dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6b", - "expect" : - { - "name" : "Lynx", - "version" : "2.8.5dev.16", - "major" : "2" - } - }, - { - "desc" : "Maemo Browser", - "ua" : "Mozilla/5.0 (X11; U; Linux armv7l; ru-RU; rv:1.9.2.3pre) Gecko/20100723 Firefox/3.5 Maemo Browser 1.7.4.8 RX-51 N900", - "expect" : - { - "name" : "Maemo Browser", - "version" : "1.7.4.8", - "major" : "1" - } - }, - { - "desc" : "Maxthon", - "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)", - "expect" : - { - "name" : "Maxthon", - "version" : "undefined", - "major" : "undefined" - } - }, - { - "desc" : "Midori", - "ua" : "Midori/0.2.2 (X11; Linux i686; U; en-us) WebKit/531.2+", - "expect" : - { - "name" : "Midori", - "version" : "0.2.2", - "major" : "0" - } - }, - { - "desc" : "Minimo", - "ua" : "Mozilla/5.0 (X11; U; Linux armv6l; rv 1.8.1.5pre) Gecko/20070619 Minimo/0.020", - "expect" : - { - "name" : "Minimo", - "version" : "0.020", - "major" : "0" - } - }, - { - "desc" : "Mobile Safari", - "ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7", - "expect" : - { - "name" : "Mobile Safari", - "version" : "4.0.5", - "major" : "4" - } - }, - { - "desc" : "Mosaic", - "ua" : "NCSA_Mosaic/2.6 (X11; SunOS 4.1.3 sun4m)", - "expect" : - { - "name" : "Mosaic", - "version" : "2.6", - "major" : "2" - } - }, - { - "desc" : "Mozilla", - "ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7) Gecko/20070606", - "expect" : - { - "name" : "Mozilla", - "version" : "5.0", - "major" : "5" - } - }, - { - "desc" : "MSIE", - "ua" : "Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)", - "expect" : - { - "name" : "IE", - "version" : "5.0b1", - "major" : "5" - } - }, - { - "desc" : "NetFront", - "ua" : "Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0", - "expect" : - { - "name" : "NetFront", - "version" : "3.0", - "major" : "3" - } - }, - { - "desc" : "Netscape on Windows ME", - "ua" : "Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.8.1.8pre) Gecko/20071015 Firefox/2.0.0.7 Navigator/9.0", - "expect" : - { - "name" : "Netscape", - "version" : "9.0", - "major" : "9" - } - }, - { - "desc" : "Netscape on Windows 2000", - "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20050519 Netscape/8.0.1", - "expect" : - { - "name" : "Netscape", - "version" : "8.0.1", - "major" : "8" - } - }, - { - "desc" : "Nokia Browser", - "ua" : "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/025.007; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.37 Mobile Safari/533.4 3gpp-gba", - "expect" : - { - "name" : "NokiaBrowser", - "version" : "7.3.1.37", - "major" : "7" - } - }, - { - "desc" : "OmniWeb", - "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.48", - "expect" : - { - "name" : "OmniWeb", - "version" : "558.48", - "major" : "558" - } - }, - { - "desc" : "Opera > 9.80", - "ua" : "Opera/9.80 (X11; Linux x86_64; U; Linux Mint; en) Presto/2.2.15 Version/10.10", - "expect" : - { - "name" : "Opera", - "version" : "10.10", - "major" : "10" - } - }, - { - "desc" : "Opera < 9.80 on Windows", - "ua" : "Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 6.01 [en]", - "expect" : - { - "name" : "Opera", - "version" : "6.01", - "major" : "6" - } - }, - { - "desc" : "Opera < 9.80 on OSX", - "ua" : "Opera/8.5 (Macintosh; PPC Mac OS X; U; en)", - "expect" : - { - "name" : "Opera", - "version" : "8.5", - "major" : "8" - } - }, - { - "desc" : "Opera Mobile", - "ua" : "Opera/9.80 (Android 2.3.5; Linux; Opera Mobi/ADR-1111101157; U; de) Presto/2.9.201 Version/11.50", - "expect" : - { - "name" : "Opera Mobi", - "version" : "11.50", - "major" : "11" - } - }, - { - "desc" : "Opera Webkit", - "ua" : "Mozilla/5.0 AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.123 Mobile Safari/537.22 OPR/14.0.1025.52315", - "expect" : - { - "name" : "Opera", - "version" : "14.0.1025.52315", - "major" : "14" - } - }, - { - "desc" : "Opera Mini", - "ua" : "Opera/9.80 (J2ME/MIDP; Opera Mini/5.1.21214/19.916; U; en) Presto/2.5.25", - "expect" : - { - "name" : "Opera Mini", - "version" : "5.1.21214", - "major" : "5" - } - }, - { - "desc" : "Opera Tablet", - "ua" : "Opera/9.80 (Windows NT 6.1; Opera Tablet/15165; U; en) Presto/2.8.149 Version/11.1", - "expect" : - { - "name" : "Opera Tablet", - "version" : "11.1", - "major" : "11" - } - }, - { - "desc" : "Phoenix", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021029 Phoenix/0.4", - "expect" : - { - "name" : "Phoenix", - "version" : "0.4", - "major" : "0" - } - }, - { - "desc" : "Polaris", - "ua" : "LG-LX600 Polaris/6.0 MMP/2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1", - "expect" : - { - "name" : "Polaris", - "version" : "6.0", - "major" : "6" - } - }, - { - "desc" : "RockMelt", - "ua" : "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) RockMelt/0.8.36.78 Chrome/7.0.517.44 Safari/534.7", - "expect" : - { - "name" : "RockMelt", - "version" : "0.8.36.78", - "major" : "0" - } - }, - { - "desc" : "Safari", - "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8", - "expect" : - { - "name" : "Safari", - "version" : "5.0.1", - "major" : "5" - } - }, - { - "desc" : "Safari < 3.0", - "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3", - "expect" : - { - "name" : "Safari", - "version" : "2.0.4", - "major" : "2" - } - }, - { - "desc" : "SeaMonkey", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b4pre) Gecko/20090405 SeaMonkey/2.0b1pre", - "expect" : - { - "name" : "SeaMonkey", - "version" : "2.0b1pre", - "major" : "2" - } - }, - { - "desc" : "Silk Browser", - "ua" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-84)", - "expect" : - { - "name" : "Silk", - "version" : "1.1.0-84", - "major" : "1" - } - }, - { - "desc" : "Skyfire", - "ua" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17 Skyfire/2.0", - "expect" : - { - "name" : "Skyfire", - "version" : "2.0", - "major" : "2" - } - }, - { - "desc" : "SlimBrowser", - "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)", - "expect" : - { - "name" : "Slim", - "version" : "undefined", - "major" : "undefined" - } - }, - { - "desc" : "Swiftfox", - "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0 (Swiftfox)", - "expect" : - { - "name" : "Swiftfox", - "version" : "undefined", - "major" : "undefined" - } - }, - { - "desc" : "Tizen Browser", - "ua" : "Mozilla/5.0 (Linux; U; Tizen/1.0 like Android; en-us; AppleWebKit/534.46 (KHTML, like Gecko) Tizen Browser/1.0 Mobile", - "expect" : - { - "name" : "Tizen Browser", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "UC Browser on Samsung", - "ua" : "Mozilla/5.0 (Java; U; Pt-br; samsung-gt-s5620) UCBrowser8.2.1.144/69/352/UCWEB Mobile UNTRUSTED/1.0", - "expect" : - { - "name" : "UCBrowser", - "version" : "8.2.1.144", - "major" : "8" - } - }, - { - "desc" : "UC Browser on Nokia", - "ua" : "Mozilla/5.0 (S60V3; U; en-in; NokiaN73)/UC Browser8.4.0.159/28/351/UCWEB Mobile", - "expect" : - { - "name" : "UC Browser", - "version" : "8.4.0.159", - "major" : "8" - } - }, - { - "desc" : "Yandex", - "ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.5 (KHTML, like Gecko) YaBrowser/1.0.1084.5402 Chrome/19.0.1084.5402 Safari/536.5", - "expect" : - { - "name" : "Yandex", - "version" : "1.0.1084.5402", - "major" : "1" - } - }, - { - "desc" : "Coremedia", - "ua" : "Apple Mac OS X v10.6.4 CoreMedia v1.0.0.10F2108", - "expect" : - { - "name" : "CoreMedia", - "version" : "1.0.0.10F2108", - "major" : "1" - } - }, - { - "desc" : "AppleCoreMedia", - "ua" : "AppleCoreMedia/1.0.0.10A403 (iPad; U; CPU OS 6_0 like Mac OS X; it_it)", - "expect" : - { - "name" : "AppleCoreMedia", - "version" : "1.0.0.10A403", - "major" : "1" - } - }, - { - "desc" : "AppleTv", - "ua" : "AppleTV/3.0.2 (Macintosh; Intel Mac OS X 10.4.7) AppleWebKit/528.18", - "expect" : - { - "name" : "WebKit", - "version" : "528.18", - "major" : "528" - } - }, - { - "desc" : "Aqualung", - "ua" : "Aqualung/R-1114", - "expect" : - { - "name" : "Aqualung", - "version" : "R-1114", - "major" : "undefined" - } - }, - { - "desc" : "Ares", - "ua" : "Ares 2.2.4.3048", - "expect" : - { - "name" : "Ares", - "version" : "2.2.4.3048", - "major" : "2" - } - }, - { - "desc" : "Audacious", - "ua" : "Audacious/3.2.2 neon/0.29.3", - "expect" : - { - "name" : "Audacious", - "version" : "3.2.2", - "major" : "3" - } - }, - { - "desc" : "AudiMusicStream", - "ua" : "AudiMusicStream/3020.130826151911", - "expect" : - { - "name" : "AudiMusicStream", - "version" : "3020.130826151911", - "major" : "3020" - } - }, - { - "desc" : "BASS", - "ua" : "BASS/2.4", - "expect" : - { - "name" : "BASS", - "version" : "2.4", - "major" : "2" - } - }, - { - "desc" : "BSPlayer", - "ua" : "BSPlayer/2", - "expect" : - { - "name" : "BSPlayer", - "version" : "2", - "major" : "2" - } - }, - { - "desc" : "Core", - "ua" : "CORE/6.506.4.1", - "expect" : - { - "name" : "CORE", - "version" : "6.506.4.1", - "major" : "6" - } - }, - { - "desc" : "Clementine", - "ua" : "Clementine 1.1", - "expect" : - { - "name" : "Clementine", - "version" : "1.1", - "major" : "1" - } - }, - { - "desc" : "Dalvik", - "ua" : "Dalvik/1.2.0 (Linux; U; Android 2.2.1; GT-S5830L Build/FROYO)", - "expect" : - { - "name" : "Dalvik", - "version" : "1.2.0", - "major" : "1" - } - }, - { - "desc" : "NexPlayer", - "ua" : "E97510d/ Player/NexPlayer 4.0", - "expect" : - { - "name" : "NexPlayer", - "version" : "4.0", - "major" : "4" - } - }, - { - "desc" : "FLRP", - "ua" : "FLRP/2.5 CFNetwork/609.1.4 Darwin/13.0.0", - "expect" : - { - "name" : "Flip Player", - "version" : "2.5", - "major" : "2" - } - }, - { - "desc" : "FStream", - "ua" : "FStream", - "expect" : - { - "name" : "FStream", - "version" : "undefined", - "major" : "undefined" - } - }, - { - "desc" : "GStreamer", - "ua" : "GStreamer souphttpsrc (compatible; LG NetCast.TV-2012) libsoup/2.34.2", - "expect" : - { - "name" : "GStreamer", - "version" : "2.34.2", - "major" : "2" - } - }, - { - "desc" : "GnomeMplayer", - "ua" : "GnomeMplayer/1.0.2", - "expect" : - { - "name" : "GnomeMplayer", - "version" : "1.0.2", - "major" : "1" - } - }, - { - "desc" : "HTC Streaming Player", - "ua" : "HTC Streaming Player htc_asia_wwe / 1.0 / endeavoru / 4.1.1", - "expect" : - { - "name" : "HTC Streaming Player", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "HTC One S", - "ua" : "HTC_One_S/3.16.111.10", - "expect" : - { - "name" : "HTC One S", - "version" : "3.16.111.10", - "major" : "3" - } - }, - { - "desc" : "Java", - "ua" : "Java/1.4.1_04", - "expect" : - { - "name" : "Java", - "version" : "1.4.1_04", - "major" : "1" - } - }, - { - "desc" : "LG Player", - "ua" : "LG Player 1.0; Android", - "expect" : - { - "name" : "LG Player", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "NexPlayer", - "ua" : "LG-P700/V10k-DEC-12-2012 Player/NexPlayer 4.0 for Android", - "expect" : - { - "name" : "NexPlayer", - "version" : "4.0", - "major" : "4" - } - }, - { - "desc" : "LG Player", - "ua" : "LGE400/V10b Player/LG Player 1.0", - "expect" : - { - "name" : "LG Player", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "Lavf", - "ua" : "Lavf52.111.0", - "expect" : - { - "name" : "Lavf", - "version" : "52.111.0", - "major" : "52" - } - }, - { - "desc" : "Lyssna", - "ua" : "Lyssna/46 CFNetwork/609.1.4 Darwin/13.0.0", - "expect" : - { - "name" : "Lyssna", - "version" : "46", - "major" : "46" - } - }, - { - "desc" : "MPlayer", - "ua" : "MPlayer 1.1-4.2.1", - "expect" : - { - "name" : "MPlayer", - "version" : "1.1-4.2.1", - "major" : "" - } - }, - { - "desc" : "MPlayer SVN", - "ua" : "MPlayer SVN-r33713-4.6.1", - "expect" : - { - "name" : "MPlayer", - "version" : "r33713-4.6.1", - "major" : "undefined" - } - }, - { - "desc" : "MPlayer ubuntu", - "ua" : "MPlayer svn r34540 (Ubuntu), built with gcc-4.6", - "expect" : - { - "name" : "MPlayer", - "version" : "r34540", - "major" : "undefined" - } - }, - { - "desc" : "MoC", - "ua" : "Music On Console/2.5.0-beta1", - "expect" : - { - "name" : "Music On Console", - "version" : "2.5.0-beta1", - "major" : "2" - } - }, - { - "desc" : "MPD", - "ua" : "Music Player Daemon 0.17.4", - "expect" : - { - "name" : "Music Player Daemon", - "version" : "0.17.4", - "major" : "0" - } - }, - { - "desc" : "NSPlayer", - "ua" : "NSPlayer/11.0.5358.4827 WMFSDK/11.0", - "expect" : - { - "name" : "NSPlayer", - "version" : "11.0.5358.4827", - "major" : "11" - } - }, - { - "desc" : "Nero Home", - "ua" : "Nero Home/1.5.3.0 (compatible; Nero AG; Nero Home 1.5.3.0)", - "expect" : - { - "name" : "Nero Home", - "version" : "1.5.3.0", - "major" : "1" - } - }, - { - "desc" : "NexPlayer", - "ua" : "NexPlayer 4.0 for Android( stagefright alternative )", - "expect" : - { - "name" : "NexPlayer", - "version" : "4.0", - "major" : "4" - } - }, - { - "desc" : "Nokia3xx", - "ua" : "Nokia303/14.87 CLDC-1.1", - "expect" : - { - "name" : "Nokia303", - "version" : "14.87", - "major" : "14" - } - }, - { - "desc" : "MPlayer SVN Sherpya", - "ua" : "MPlayer Sherpya-SVN-r33124-4.2.5", - "expect" : - { - "name" : "MPlayer", - "version" : "r33124-4.2.5", - "major" : "undefined" - } - }, - { - "desc" : "Philips Songbird", - "ua" : "NotMoz/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.2.3) Gecko/20101207 Philips-Songbird/5.4.1980 Songbird/1.9.4 (20110302030555)", - "expect" : - { - "name" : "Songbird", - "version" : "1.9.4", - "major" : "1" - } - }, - { - "desc" : "Ossproxy", - "ua" : "OSSProxy 1.3.336.320 (Build 336.320 Win32 en-us)(Aug 16 2013 17:38:43)", - "expect" : - { - "name" : "OSSProxy", - "version" : "1.3.336.320", - "major" : "1" - } - }, - { - "desc" : "Winamp3", - "ua" : "Nullsoft Winamp3 version 3.0 (compatible)", - "expect" : - { - "name" : "Winamp", - "version" : "3.0", - "major" : "3" - } - }, - { - "desc" : "PSP", - "ua" : "PSP-InternetRadioPlayer/1.00", - "expect" : - { - "name" : "PSP-InternetRadioPlayer", - "version" : "1.00", - "major" : "1" - } - }, - { - "desc" : "urllib", - "ua" : "Python-urllib/2.7", - "expect" : - { - "name" : "Python-urllib", - "version" : "2.7", - "major" : "2" - } - }, - { - "desc" : "QuickTime", - "ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)", - "expect" : - { - "name" : "QuickTime", - "version" : "7.5.6", - "major" : "7" - } - }, - { - "desc" : "RMA", - "ua" : "RMA/1.0 (compatible; RealMedia)", - "expect" : - { - "name" : "RMA", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "RadioApp", - "ua" : "RadioApp/1.0 CFNetwork/609.1.4 Darwin/11.4.2", - "expect" : - { - "name" : "RadioApp", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "RadioClientApplication", - "ua" : "RadioClientApplication/20 CFNetwork/609.1.4 Darwin/13.0.0", - "expect" : - { - "name" : "RadioClientApplication", - "version" : "20", - "major" : "undefined" - } - }, - { - "desc" : "stagefright", - "ua" : "Samsung GT-I9070 stagefright/1.1 (Linux;Android 2.3.6)", - "expect" : - { - "name" : "stagefright", - "version" : "1.1", - "major" : "1" - } - }, - { - "desc" : "Soundtap", - "ua" : "Soundtap/1.2.4 CFNetwork/672.0.2 Darwin/14.0.0", - "expect" : - { - "name" : "Soundtap", - "version" : "1.2.4", - "major" : "1" - } - }, - { - "desc" : "Streamium", - "ua" : "Streamium/1.0", - "expect" : - { - "name" : "Streamium", - "version" : "1.0", - "major" : "1" - } - }, - { - "desc" : "Totem", - "ua" : "Totem/3.0.1", - "expect" : - { - "name" : "Totem", - "version" : "3.0.1", - "major" : "3" - } - }, - { - "desc" : "VLC", - "ua" : "VLC media player - version 0.8.6c Janus - (c) 1996-2007 the VideoLAN team", - "expect" : - { - "name" : "VLC", - "version" : "0.8.6c", - "major" : "0" - } - }, - { - "desc" : "VLC", - "ua" : "VLC/2.0.0 LibVLC/2.0.0", - "expect" : - { - "name" : "VLC", - "version" : "2.0.0", - "major" : "2" - } - }, - { - "desc" : "Videos", - "ua" : "Videos/3.8.2", - "expect" : - { - "name" : "Video", - "version" : "3.8.2", - "major" : "3" - } - }, - { - "desc" : "Wget", - "ua" : "Wget/1.12 (darwin10.7.0)", - "expect" : - { - "name" : "Wget", - "version" : "1.12", - "major" : "1" - } - }, - { - "desc" : "Winamp", - "ua" : "Winamp 2.81", - "expect" : - { - "name" : "Winamp", - "version" : "2.81", - "major" : "2" - } - }, - { - "desc" : "Winamp", - "ua" : "WinampMPEG/2.00", - "expect" : - { - "name" : "Winamp", - "version" : "2.00", - "major" : "2" - } - }, - { - "desc" : "Windows Media Player", - "ua" : "Windows-Media-Player/10.00.00.4019", - "expect" : - { - "name" : "Windows Media Player", - "version" : "10.00.00.4019", - "major" : "10" - } - }, - { - "desc" : "XBMC", - "ua" : "XBMC/12.0 Git:20130127-fb595f2 (Windows NT 6.1;WOW64;Win64;x64; http://www.xbmc.org)", - "expect" : - { - "name" : "XBMC", - "version" : "12.0", - "major" : "12" - } - }, - { - "desc" : "rad.io", - "ua" : "rad.io 1.18.1 rv:593 (iPhone 4S; iPhone OS 7.0.4; it_IT)", - "expect" : - { - "name" : "rad.io", - "version" : "1.18.1", - "major" : "1" - } - }, - { - "desc" : "BE-Test", - "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", - "expect" : - { - "name" : "BE Test", - "version" : "1.0", - "major" : "1" - } - } -] diff --git a/test/mediaplayer-test.json b/test/mediaplayer-test.json new file mode 100644 index 0000000..d40ba04 --- /dev/null +++ b/test/mediaplayer-test.json @@ -0,0 +1,582 @@ +[ + { + "desc" : "Coremedia", + "ua" : "Apple Mac OS X v10.6.4 CoreMedia v1.0.0.10F2108", + "expect" : + { + "name" : "CoreMedia", + "version" : "1.0.0.10F2108", + "major" : "1" + } + }, + { + "desc" : "AppleCoreMedia", + "ua" : "AppleCoreMedia/1.0.0.10A403 (iPad; U; CPU OS 6_0 like Mac OS X; it_it)", + "expect" : + { + "name" : "AppleCoreMedia", + "version" : "1.0.0.10A403", + "major" : "1" + } + }, + { + "desc" : "AppleTv", + "ua" : "AppleTV/3.0.2 (Macintosh; Intel Mac OS X 10.4.7) AppleWebKit/528.18", + "expect" : + { + "name" : "WebKit", + "version" : "528.18", + "major" : "528" + } + }, + { + "desc" : "Aqualung", + "ua" : "Aqualung/R-1114", + "expect" : + { + "name" : "Aqualung", + "version" : "R-1114", + "major" : "undefined" + } + }, + { + "desc" : "Ares", + "ua" : "Ares 2.2.4.3048", + "expect" : + { + "name" : "Ares", + "version" : "2.2.4.3048", + "major" : "2" + } + }, + { + "desc" : "Audacious", + "ua" : "Audacious/3.2.2 neon/0.29.3", + "expect" : + { + "name" : "Audacious", + "version" : "3.2.2", + "major" : "3" + } + }, + { + "desc" : "AudiMusicStream", + "ua" : "AudiMusicStream/3020.130826151911", + "expect" : + { + "name" : "AudiMusicStream", + "version" : "3020.130826151911", + "major" : "3020" + } + }, + { + "desc" : "BASS", + "ua" : "BASS/2.4", + "expect" : + { + "name" : "BASS", + "version" : "2.4", + "major" : "2" + } + }, + { + "desc" : "BSPlayer", + "ua" : "BSPlayer/2", + "expect" : + { + "name" : "BSPlayer", + "version" : "2", + "major" : "2" + } + }, + { + "desc" : "Core", + "ua" : "CORE/6.506.4.1", + "expect" : + { + "name" : "CORE", + "version" : "6.506.4.1", + "major" : "6" + } + }, + { + "desc" : "Clementine", + "ua" : "Clementine 1.1", + "expect" : + { + "name" : "Clementine", + "version" : "1.1", + "major" : "1" + } + }, + { + "desc" : "Dalvik", + "ua" : "Dalvik/1.2.0 (Linux; U; Android 2.2.1; GT-S5830L Build/FROYO)", + "expect" : + { + "name" : "Dalvik", + "version" : "1.2.0", + "major" : "1" + } + }, + { + "desc" : "NexPlayer", + "ua" : "E97510d/ Player/NexPlayer 4.0", + "expect" : + { + "name" : "NexPlayer", + "version" : "4.0", + "major" : "4" + } + }, + { + "desc" : "FLRP", + "ua" : "FLRP/2.5 CFNetwork/609.1.4 Darwin/13.0.0", + "expect" : + { + "name" : "Flip Player", + "version" : "2.5", + "major" : "2" + } + }, + { + "desc" : "FStream", + "ua" : "FStream", + "expect" : + { + "name" : "FStream", + "version" : "undefined", + "major" : "undefined" + } + }, + { + "desc" : "GStreamer", + "ua" : "GStreamer souphttpsrc (compatible; LG NetCast.TV-2012) libsoup/2.34.2", + "expect" : + { + "name" : "GStreamer", + "version" : "2.34.2", + "major" : "2" + } + }, + { + "desc" : "GnomeMplayer", + "ua" : "GnomeMplayer/1.0.2", + "expect" : + { + "name" : "GnomeMplayer", + "version" : "1.0.2", + "major" : "1" + } + }, + { + "desc" : "HTC Streaming Player", + "ua" : "HTC Streaming Player htc_asia_wwe / 1.0 / endeavoru / 4.1.1", + "expect" : + { + "name" : "HTC Streaming Player", + "version" : "1.0", + "major" : "1" + } + }, + { + "desc" : "HTC One S", + "ua" : "HTC_One_S/3.16.111.10", + "expect" : + { + "name" : "HTC One S", + "version" : "3.16.111.10", + "major" : "3" + } + }, + { + "desc" : "Java", + "ua" : "Java/1.4.1_04", + "expect" : + { + "name" : "Java", + "version" : "1.4.1_04", + "major" : "1" + } + }, + { + "desc" : "LG Player", + "ua" : "LG Player 1.0; Android", + "expect" : + { + "name" : "LG Player", + "version" : "1.0", + "major" : "1" + } + }, + { + "desc" : "NexPlayer", + "ua" : "LG-P700/V10k-DEC-12-2012 Player/NexPlayer 4.0 for Android", + "expect" : + { + "name" : "NexPlayer", + "version" : "4.0", + "major" : "4" + } + }, + { + "desc" : "LG Player", + "ua" : "LGE400/V10b Player/LG Player 1.0", + "expect" : + { + "name" : "LG Player", + "version" : "1.0", + "major" : "1" + } + }, + { + "desc" : "Lavf", + "ua" : "Lavf52.111.0", + "expect" : + { + "name" : "Lavf", + "version" : "52.111.0", + "major" : "52" + } + }, + { + "desc" : "Lyssna", + "ua" : "Lyssna/46 CFNetwork/609.1.4 Darwin/13.0.0", + "expect" : + { + "name" : "Lyssna", + "version" : "46", + "major" : "46" + } + }, + { + "desc" : "MPlayer", + "ua" : "MPlayer 1.1-4.2.1", + "expect" : + { + "name" : "MPlayer", + "version" : "1.1-4.2.1", + "major" : "" + } + }, + { + "desc" : "MPlayer SVN", + "ua" : "MPlayer SVN-r33713-4.6.1", + "expect" : + { + "name" : "MPlayer", + "version" : "r33713-4.6.1", + "major" : "undefined" + } + }, + { + "desc" : "MPlayer ubuntu", + "ua" : "MPlayer svn r34540 (Ubuntu), built with gcc-4.6", + "expect" : + { + "name" : "MPlayer", + "version" : "r34540", + "major" : "undefined" + } + }, + { + "desc" : "MoC", + "ua" : "Music On Console/2.5.0-beta1", + "expect" : + { + "name" : "Music On Console", + "version" : "2.5.0-beta1", + "major" : "2" + } + }, + { + "desc" : "MPD", + "ua" : "Music Player Daemon 0.17.4", + "expect" : + { + "name" : "Music Player Daemon", + "version" : "0.17.4", + "major" : "0" + } + }, + { + "desc" : "NSPlayer", + "ua" : "NSPlayer/11.0.5358.4827 WMFSDK/11.0", + "expect" : + { + "name" : "NSPlayer", + "version" : "11.0.5358.4827", + "major" : "11" + } + }, + { + "desc" : "Nero Home", + "ua" : "Nero Home/1.5.3.0 (compatible; Nero AG; Nero Home 1.5.3.0)", + "expect" : + { + "name" : "Nero Home", + "version" : "1.5.3.0", + "major" : "1" + } + }, + { + "desc" : "NexPlayer", + "ua" : "NexPlayer 4.0 for Android( stagefright alternative )", + "expect" : + { + "name" : "NexPlayer", + "version" : "4.0", + "major" : "4" + } + }, + { + "desc" : "Nokia3xx", + "ua" : "Nokia303/14.87 CLDC-1.1", + "expect" : + { + "name" : "Nokia303", + "version" : "14.87", + "major" : "14" + } + }, + { + "desc" : "MPlayer SVN Sherpya", + "ua" : "MPlayer Sherpya-SVN-r33124-4.2.5", + "expect" : + { + "name" : "MPlayer", + "version" : "r33124-4.2.5", + "major" : "undefined" + } + }, + { + "desc" : "Philips Songbird", + "ua" : "NotMoz/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.2.3) Gecko/20101207 Philips-Songbird/5.4.1980 Songbird/1.9.4 (20110302030555)", + "expect" : + { + "name" : "Songbird", + "version" : "1.9.4", + "major" : "1" + } + }, + { + "desc" : "Ossproxy", + "ua" : "OSSProxy 1.3.336.320 (Build 336.320 Win32 en-us)(Aug 16 2013 17:38:43)", + "expect" : + { + "name" : "OSSProxy", + "version" : "1.3.336.320", + "major" : "1" + } + }, + { + "desc" : "Winamp3", + "ua" : "Nullsoft Winamp3 version 3.0 (compatible)", + "expect" : + { + "name" : "Winamp", + "version" : "3.0", + "major" : "3" + } + }, + { + "desc" : "PSP", + "ua" : "PSP-InternetRadioPlayer/1.00", + "expect" : + { + "name" : "PSP-InternetRadioPlayer", + "version" : "1.00", + "major" : "1" + } + }, + { + "desc" : "urllib", + "ua" : "Python-urllib/2.7", + "expect" : + { + "name" : "Python-urllib", + "version" : "2.7", + "major" : "2" + } + }, + { + "desc" : "QuickTime", + "ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)", + "expect" : + { + "name" : "QuickTime", + "version" : "7.5.6", + "major" : "7" + } + }, + { + "desc" : "RMA", + "ua" : "RMA/1.0 (compatible; RealMedia)", + "expect" : + { + "name" : "RMA", + "version" : "1.0", + "major" : "1" + } + }, + { + "desc" : "RadioApp", + "ua" : "RadioApp/1.0 CFNetwork/609.1.4 Darwin/11.4.2", + "expect" : + { + "name" : "RadioApp", + "version" : "1.0", + "major" : "1" + } + }, + { + "desc" : "RadioClientApplication", + "ua" : "RadioClientApplication/20 CFNetwork/609.1.4 Darwin/13.0.0", + "expect" : + { + "name" : "RadioClientApplication", + "version" : "20", + "major" : "undefined" + } + }, + { + "desc" : "stagefright", + "ua" : "Samsung GT-I9070 stagefright/1.1 (Linux;Android 2.3.6)", + "expect" : + { + "name" : "stagefright", + "version" : "1.1", + "major" : "1" + } + }, + { + "desc" : "Soundtap", + "ua" : "Soundtap/1.2.4 CFNetwork/672.0.2 Darwin/14.0.0", + "expect" : + { + "name" : "Soundtap", + "version" : "1.2.4", + "major" : "1" + } + }, + { + "desc" : "Streamium", + "ua" : "Streamium/1.0", + "expect" : + { + "name" : "Streamium", + "version" : "1.0", + "major" : "1" + } + }, + { + "desc" : "Totem", + "ua" : "Totem/3.0.1", + "expect" : + { + "name" : "Totem", + "version" : "3.0.1", + "major" : "3" + } + }, + { + "desc" : "VLC", + "ua" : "VLC media player - version 0.8.6c Janus - (c) 1996-2007 the VideoLAN team", + "expect" : + { + "name" : "VLC", + "version" : "0.8.6c", + "major" : "0" + } + }, + { + "desc" : "VLC", + "ua" : "VLC/2.0.0 LibVLC/2.0.0", + "expect" : + { + "name" : "VLC", + "version" : "2.0.0", + "major" : "2" + } + }, + { + "desc" : "Videos", + "ua" : "Videos/3.8.2", + "expect" : + { + "name" : "Video", + "version" : "3.8.2", + "major" : "3" + } + }, + { + "desc" : "Wget", + "ua" : "Wget/1.12 (darwin10.7.0)", + "expect" : + { + "name" : "Wget", + "version" : "1.12", + "major" : "1" + } + }, + { + "desc" : "Winamp", + "ua" : "Winamp 2.81", + "expect" : + { + "name" : "Winamp", + "version" : "2.81", + "major" : "2" + } + }, + { + "desc" : "Winamp", + "ua" : "WinampMPEG/2.00", + "expect" : + { + "name" : "Winamp", + "version" : "2.00", + "major" : "2" + } + }, + { + "desc" : "Windows Media Player", + "ua" : "Windows-Media-Player/10.00.00.4019", + "expect" : + { + "name" : "Windows Media Player", + "version" : "10.00.00.4019", + "major" : "10" + } + }, + { + "desc" : "XBMC", + "ua" : "XBMC/12.0 Git:20130127-fb595f2 (Windows NT 6.1;WOW64;Win64;x64; http://www.xbmc.org)", + "expect" : + { + "name" : "XBMC", + "version" : "12.0", + "major" : "12" + } + }, + { + "desc" : "rad.io", + "ua" : "rad.io 1.18.1 rv:593 (iPhone 4S; iPhone OS 7.0.4; it_IT)", + "expect" : + { + "name" : "rad.io", + "version" : "1.18.1", + "major" : "1" + } + }, + { + "desc" : "BE-Test", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "BE Test", + "version" : "1.0", + "major" : "1" + } + } +] diff --git a/test/os-test.json b/test/os-test.json index cd26ced..eaff59e 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -145,11 +145,11 @@ }, { "desc" : "Tizen", - "ua" : "", + "ua" : "Mozilla/5.0 (Linux; Tizen 2.3; SAMSUNG SM-Z130H) AppleWebKit/537.3 (KHTML, like Gecko) Version/2.3 Mobile Safari/537.3", "expect" : { - "name" : "", - "version" : "" + "name" : "Tizen", + "version" : "2.3" } }, { From d0b7c5892f666d539bdd04bbdd8c18d4e4bbc032 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 9 Nov 2016 19:27:41 +0700 Subject: [PATCH 019/170] Samsung smarttv misidentified as mobile --- src/ua-parser.js | 2 ++ test/device-test.json | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 7ab4f08..220dfe5 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -576,6 +576,8 @@ /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung + /smart-tv.+(samsung)/i + ], [VENDOR, [TYPE, SMARTTV], MODEL], [ /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i diff --git a/test/device-test.json b/test/device-test.json index 0c958cb..ee08a64 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -199,6 +199,16 @@ "type" : "smarttv" } }, + { + "desc" : "Samsung SmartTV", + "ua" : "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1", + "expect" : + { + "vendor" : "Samsung", + "model" : "undefined", + "type" : "smarttv" + } + }, { "desc" : "Sony C5303 (Xperia SP)", "ua" : "Mozilla/5.0 (Linux; Android 4.3; C5303 Build/12.1.A.1.205) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36", From aadabcce295e10dcc83398c731f360d02b07dd7b Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 9 Nov 2016 19:32:20 +0700 Subject: [PATCH 020/170] Fix #188 Separate Chrome WebView from Chrome --- src/ua-parser.js | 2 +- test/browser-test.json | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 220dfe5..2ceb485 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -276,7 +276,7 @@ ], [[NAME, /_/g, ' '], VERSION], [ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView - ], [NAME, [VERSION, /(.+)/, 'WebView $1']], [ + ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [ /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index cd23f64..22a2639 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -94,8 +94,8 @@ "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36", "expect" : { - "name" : "Chrome", - "version" : "WebView 43.0.2357.65", + "name" : "Chrome WebView", + "version" : "43.0.2357.65", "major" : "43" } }, @@ -169,6 +169,16 @@ "major" : "1" } }, + { + "desc" : "Facebook in-App Browser", + "ua" : "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.121 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/35.0.0.48.273;]", + "expect" : + { + "name" : "Chrome WebView", + "version" : "43.0.2357.121", + "major" : "43" + } + }, { "desc" : "Firebird", "ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7", From 1a4dab58290827a50e7462470eaf00e25eed07c6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 9 Nov 2016 23:41:57 +0700 Subject: [PATCH 021/170] Edit readme: guide to contribute --- readme.md | 48 +++++++++++++++++++++++++++++++++--------------- src/ua-parser.js | 8 ++++---- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/readme.md b/readme.md index 8d7e407..85915cd 100644 --- a/readme.md +++ b/readme.md @@ -10,13 +10,15 @@ Lightweight JavaScript-based User-Agent string parser. Supports browser & node.j * Demo : http://faisalman.github.io/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js -## Features + +# Features Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model purely from user-agent string with relatively lightweight footprint (~11KB minified / ~4KB gzipped). Written in vanilla js, which means it doesn't depends on any other library. ![It's over 9000](https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/over9000.jpg) -## Methods + +# Methods * `getBrowser()` * returns `{ name: '', version: '' }` @@ -95,7 +97,8 @@ ppc, sparc, sparc64 * `setUA(uastring)` * set & parse UA string -## Example + +# Example ```html @@ -168,7 +171,7 @@ ppc, sparc, sparc64 ``` -### Using node.js +## Using node.js ```sh $ npm install ua-parser-js @@ -189,7 +192,7 @@ http.createServer(function (req, res) { console.log('Server running at http://127.0.0.1:1337/'); ``` -### Using requirejs +## Using requirejs ```js require(['ua-parser-js'], function(UAParser) { @@ -198,25 +201,25 @@ require(['ua-parser-js'], function(UAParser) { }); ``` -### Using component +## Using component ```sh $ component install faisalman/ua-parser-js ``` -### Using bower +## Using bower ```sh $ bower install ua-parser-js ``` -### Using meteor +## Using meteor ```sh $ meteor add faisalman:ua-parser-js ``` -### Using jQuery/Zepto ($.ua) +## 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)`. @@ -239,7 +242,7 @@ console.log($.ua.device); // {vendor: "Motorola", model: "Xoom", type: console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4 ``` -### Extending regex patterns +## Extending regex patterns * `UAParser(uastring[, extensions])` @@ -253,19 +256,34 @@ var parser = new UAParser(uaString, { browser: myOwnRegex }); console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} ``` -## Development -Verify, test, & minify script +# Development + +## Contribute + +* Fork and clone this repository +* Make some changes as required +* Write a unit test to showcase your feature +* Run the test suites to make sure the changes you made didn't break anything ```sh $ npm run test +``` + +* Commit and push to your own repository +* Submit a pull request to this repository under `develop` branch +* Profit? + +## Build + +Build a minified & packed script + +```sh $ npm run build ``` -Then submit a pull request to https://github.com/faisalman/ua-parser-js under `develop` branch. - -## License +# License Dual licensed under GPLv2 & MIT diff --git a/src/ua-parser.js b/src/ua-parser.js index 8df70a6..3a43d7f 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -275,10 +275,10 @@ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ - /(MicroMessenger)\/([\w\.]+)/i // WeChat + /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ - /XiaoMi\/MiuiBrowser\/([\w\.]+)/i // MIUI Browser + /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView @@ -296,7 +296,7 @@ /(uc\s?browser)[\/\s]?([\w\.]+)/i, /ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i, - /JUC.+(ucweb)[\/\s]?([\w\.]+)/i + /juc.+(ucweb)[\/\s]?([\w\.]+)/i // UCBrowser ], [[NAME, 'UCBrowser'], VERSION], [ @@ -306,7 +306,7 @@ /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION], [ - /FBAV\/([\w\.]+);/i // Facebook App for iOS + /;fbav\/([\w\.]+);/i // Facebook App for iOS ], [VERSION, [NAME, 'Facebook']], [ /fxios\/([\w\.-]+)/i // Firefox for iOS From 88f2f4e24cd1a987a285343cee81bb7461229673 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 00:21:28 +0700 Subject: [PATCH 022/170] Fix #32 browser recognized as version --- src/ua-parser.js | 2 +- test/os-test.json | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 3a43d7f..3495b42 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -738,7 +738,7 @@ // GNU/Linux based /(mint)[\/\s\(]?(\w+)*/i, // Mint /(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux - /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i, + /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i, // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux diff --git a/test/os-test.json b/test/os-test.json index eaff59e..b85f3d8 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -280,11 +280,20 @@ }, { "desc" : "Ubuntu", - "ua" : "", + "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.22+ (KHTML, like Gecko) Chromium/17.0.963.56 Chrome/17.0.963.56 Safari/535.22+ Ubuntu/12.04 (3.4.1-0ubuntu1) Epiphany/3.4.1", "expect" : { - "name" : "", - "version" : "" + "name" : "Ubuntu", + "version" : "12.04" + } + }, + { + "desc" : "Ubuntu", + "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36", + "expect" : + { + "name" : "Ubuntu", + "version" : "undefined" } }, { From 1fb82fb6ff358d36bd75135f124a79c71fba421e Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 00:43:20 +0700 Subject: [PATCH 023/170] Smart-TV ordering --- src/ua-parser.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 3495b42..ce6ad26 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -484,9 +484,6 @@ device : [[ - /hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices - ], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [ - /\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook ], [MODEL, VENDOR, [TYPE, TABLET]], [ @@ -574,6 +571,15 @@ /android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [ + /hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices + ], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [ + + /hbbtv.+maple;(\d+)/i + ], [[MODEL, /^/, 'SmartTV'], [VENDOR, 'Samsung'], [TYPE, SMARTTV]], [ + + /\(dtv[\);].+(aquos)/i // Sharp + ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ + /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung @@ -583,11 +589,7 @@ /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ - /hbbtv.+maple;(\d+)/i - ], [[MODEL, /^/, 'SmartTV'], [VENDOR, 'Samsung'], [TYPE, SMARTTV]], [ - /\(dtv[\);].+(aquos)/i // Sharp - ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ /sie-(\w+)*/i // Siemens ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [ From 0f0ea13fab81e39113000ba5bb0df495a5687509 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 00:45:48 +0700 Subject: [PATCH 024/170] Fix #99 Wrong Windows version --- src/ua-parser.js | 3 ++- test/os-test.json | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index ce6ad26..a458958 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -713,7 +713,8 @@ /microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes) ], [NAME, VERSION], [ /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT - /(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i + /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i, // Windows Phone + /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [ /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i ], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [ diff --git a/test/os-test.json b/test/os-test.json index b85f3d8..547b9eb 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -107,6 +107,15 @@ "version" : "6.1" } }, + { + "desc" : "Windows Phone", + "ua" : "Opera/9.80 (Windows Phone; Opera Mini/7.6.8/35.7518; U; ru) Presto/2.8.119 Version/11.10", + "expect" : + { + "name" : "Windows Phone", + "version" : "undefined" + } + }, { "desc" : "Windows Phone OS", "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; DELL; Venue Pro)", From 73735e1ca8af6fbaaa12058f5835f9577dc1fc25 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 08:29:01 +0700 Subject: [PATCH 025/170] Fix #37 #38 test case for nexus 7 & ipod --- test/device-test.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/device-test.json b/test/device-test.json index ee08a64..ba1de16 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1,4 +1,14 @@ [ + { + "desc" : "Asus Nexus 7", + "ua" : "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", + "expect" : + { + "vendor" : "Asus", + "model" : "Nexus 7", + "type" : "tablet" + } + }, { "desc" : "Desktop (IE11 with Tablet string)", "ua" : "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", @@ -29,6 +39,16 @@ "type" : "tablet" } }, + { + "desc" : "iPod", + "ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", + "expect" : + { + "vendor" : "Apple", + "model" : "iPod touch", + "type" : "mobile" + } + }, { "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 58880fda7f68017819ced18b49dfd54266763ff9 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 09:11:23 +0700 Subject: [PATCH 026/170] Fix #43 #68 xperia sp & asus padfone --- src/ua-parser.js | 2 +- test/device-test.json | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index a458958..e1c369e 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -520,7 +520,7 @@ /\(bb10;\s(\w+)/i // BlackBerry 10 ], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [ // Asus Tablets - /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i + /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i ], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony diff --git a/test/device-test.json b/test/device-test.json index ba1de16..0afada8 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -9,6 +9,16 @@ "type" : "tablet" } }, + { + "desc" : "Asus Padfone", + "ua" : "Mozilla/5.0 (Linux; Android 4.1.1; PadFone 2 Build/JRO03L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.117 Safari/537.36", + "expect" : + { + "vendor" : "Asus", + "model" : "PadFone", + "type" : "tablet" + } + }, { "desc" : "Desktop (IE11 with Tablet string)", "ua" : "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", @@ -269,6 +279,16 @@ "type" : "mobile" } }, + { + "desc" : "Sony Xperia SP", + "ua" : "Mozilla/5.0 (Linux; Android 4.3; C5302 Build/12.1.A.1.201) AppleWebkit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Sony", + "model" : "Xperia Phone", + "type" : "mobile" + } + }, { "desc" : "Sony SGP521 (Xperia Z2 Tablet)", "ua" : "Mozilla/5.0 (Linux; Android 4.4; SGP521 Build/17.1.A.0.432) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Safari/537.36", From 61b0f1c05406c26c3078f833f16fb9b134c0d91f Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 09:16:17 +0700 Subject: [PATCH 027/170] Fix #87 oneplus one --- src/ua-parser.js | 3 +++ test/device-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index e1c369e..9d65880 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -625,6 +625,9 @@ /android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ + /android.+a000(1)\s+build/i // OnePlus + ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] diff --git a/test/device-test.json b/test/device-test.json index 0afada8..de6fcb9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -149,6 +149,16 @@ "type" : "mobile" } }, + { + "desc" : "OnePlus One", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.4; A0001 Build/KTU84Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Mobile Safari/537.36", + "expect" : + { + "vendor" : "OnePlus", + "model" : "1", + "type" : "mobile" + } + }, { "desc" : "Philips SmartTV", "ua" : "Opera/9.80 HbbTV/1.1.1 (; Philips; ; ; ; ) NETTV/4.0.2; en) Version/11.60", From b99840d0743dd7e19b7dae02db3b55c5ecc033ed Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 09:24:00 +0700 Subject: [PATCH 028/170] Fix #158 xiaomi mi note --- src/ua-parser.js | 2 +- test/device-test.json | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 9d65880..83e0bdf 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -622,7 +622,7 @@ /android.+(\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)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi + /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ /android.+a000(1)\s+build/i // OnePlus diff --git a/test/device-test.json b/test/device-test.json index de6fcb9..058912d 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -359,6 +359,16 @@ "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", + "expect" : + { + "vendor" : "Xiaomi", + "model" : "MI NOTE LTE", + "type" : "mobile" + } + }, { "desc" : "Xiaomi Mi One Plus", "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; MI-ONE Plus Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", From 9fe7561d78a2c03fc9679e843dce226aee1abfcd Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 09:30:04 +0700 Subject: [PATCH 029/170] Fix #96 Moto X --- test/device-test.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/device-test.json b/test/device-test.json index 058912d..67e04f9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -89,6 +89,16 @@ "type" : "mobile" } }, + { + "desc" : "Motorola Moto X", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.4; XT1097 Build/KXE21.187-38) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Motorola", + "model" : "XT1097", + "type" : "mobile" + } + }, { "desc" : "Motorola Nexus 6", "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36", From 7f9919f8967c84d663c40b19a53f92da3c784233 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 10 Nov 2016 09:41:16 +0700 Subject: [PATCH 030/170] Fix #185 Huawei Nexus 6P --- src/ua-parser.js | 9 ++++++--- test/device-test.json | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 83e0bdf..86935d0 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -554,6 +554,9 @@ /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ + /(nexus\s6p)/i // Huawei Nexus 6P + ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ + /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia ], [VENDOR, MODEL, [TYPE, MOBILE]], [ @@ -566,7 +569,7 @@ /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w+)*/i, /(XT\d{3,4}) build\//i, - /(nexus\s[6])/i + /(nexus\s6)/i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [ /android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [ @@ -620,8 +623,8 @@ /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ - /android.+(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models - /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi + /android.+(\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+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index 67e04f9..7967494 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -49,6 +49,16 @@ "type" : "tablet" } }, + { + "desc" : "Huawei Nexus 6P", + "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MTC19V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537", + "expect" : + { + "vendor" : "Huawei", + "model" : "Nexus 6P", + "type" : "mobile" + } + }, { "desc" : "iPod", "ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", From b13c891d7f7b0957575a0ea22b48958617ba3207 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 11 Nov 2016 09:26:59 +0700 Subject: [PATCH 031/170] Fix #190 haiku --- src/ua-parser.js | 4 +++- test/os-test.json | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 86935d0..d0c988e 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -765,6 +765,9 @@ /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ + /(haiku)\s(\w+)/i // Haiku + ], [NAME, VERSION],[ + /(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i // iOS ], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [ @@ -774,7 +777,6 @@ // Other /((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris - /(haiku)\s(\w+)/i, // Haiku /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS diff --git a/test/os-test.json b/test/os-test.json index 547b9eb..c0100d0 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -514,11 +514,11 @@ }, { "desc" : "Haiku", - "ua" : "", + "ua" : "Mozilla/5.0 (Macintosh; Intel Haiku R1 x86) AppleWebKit/602.1.1 (KHTML, like Gecko) WebPositive/1.2 Version/8.0 Safari/602.1.1", "expect" : { - "name" : "", - "version" : "" + "name" : "Haiku", + "version" : "R1" } }, { From 9f0419607baea6235f812553b8f9fca760f1e479 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 11 Nov 2016 10:40:32 +0700 Subject: [PATCH 032/170] Fix #127 galaxy note --- src/ua-parser.js | 2 +- test/device-test.json | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index d0c988e..f782918 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -583,7 +583,7 @@ /\(dtv[\);].+(aquos)/i // Sharp ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ - /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i, + /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung /smart-tv.+(samsung)/i diff --git a/test/device-test.json b/test/device-test.json index 7967494..2a0c75e 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -199,6 +199,16 @@ "type" : "tablet" } }, + { + "desc" : "Samsung Galaxy Note 8", + "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; GT-N5100 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Safari/537.36", + "expect" : + { + "vendor" : "Samsung", + "model" : "GT-N5100", + "type" : "tablet" + } + }, { "desc" : "Samsung SM-T231", "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T231 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", From 97b52b2cfd94933050df1f76a8e447883e8b8f10 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 11 Nov 2016 13:58:15 +0700 Subject: [PATCH 033/170] Test unit for extension --- test/test.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/test.js b/test/test.js index 2412363..2150ee9 100644 --- a/test/test.js +++ b/test/test.js @@ -43,15 +43,6 @@ describe('UAParser()', function () { assert.deepEqual(UAParser(ua), new UAParser().setUA(ua).getResult()); }); -describe('Injected Browser', function () { - var uaString = 'ownbrowser/1.3'; - var ownBrowser = [[/(ownbrowser)\/((\d+)?[\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, UAParser.BROWSER.MAJOR]]; - var parser = new UAParser(uaString, {browser: ownBrowser}); - assert.equal(parser.getBrowser().name, 'ownbrowser'); - assert.equal(parser.getBrowser().major, '1'); - assert.equal(parser.getBrowser().version, '1.3'); -}); - for (var i in methods) { describe(methods[i]['title'], function () { for (var j in methods[i]['list']) { @@ -72,3 +63,12 @@ for (var i in methods) { } }); } + +describe('Extending Regex', function () { + var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; + var myOwnBrowser = [[/(myownbrowser)\/((\d+)?[\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, UAParser.BROWSER.MAJOR]]; + var parser = new UAParser(uaString, {browser: myOwnBrowser}); + assert.equal(parser.getBrowser().name, 'MyOwnBrowser'); + assert.equal(parser.getBrowser().version, '1.3'); + assert.equal(parser.getBrowser().major, '1'); +}); \ No newline at end of file From 34848e8ec201b49e4f0001dc2278f77b2f7487fd Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 11 Nov 2016 18:40:26 +0700 Subject: [PATCH 034/170] Fix #187 #171 #92 Require.js --- package.json | 1 + readme.md | 9 ++++++++- test/test.js | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fb7142d..dbb1e34 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "devDependencies": { "jshint": "~1.1.0", "mocha": "~1.8.0", + "requirejs": "^2.3.2", "uglify-js": "~1.3.4", "verup": "^1.3.x" }, diff --git a/readme.md b/readme.md index 85915cd..6c3d85e 100644 --- a/readme.md +++ b/readme.md @@ -195,7 +195,14 @@ console.log('Server running at http://127.0.0.1:1337/'); ## Using requirejs ```js -require(['ua-parser-js'], function(UAParser) { +requirejs.config({ + baseUrl : 'js/lib', // path to your script directory + paths : { + 'ua-parser-js' : 'ua-parser.min' + } +}); + +requirejs(['ua-parser-js'], function(UAParser) { var parser = new UAParser(); console.log(parser.getResult()); }); diff --git a/test/test.js b/test/test.js index 2150ee9..40a6e0d 100644 --- a/test/test.js +++ b/test/test.js @@ -1,4 +1,5 @@ var assert = require('assert'); +var requirejs = require('requirejs'); var UAParser = require('./../src/ua-parser'); var browsers = require('./browser-test.json'); var cpus = require('./cpu-test.json'); @@ -71,4 +72,20 @@ describe('Extending Regex', function () { assert.equal(parser.getBrowser().name, 'MyOwnBrowser'); assert.equal(parser.getBrowser().version, '1.3'); assert.equal(parser.getBrowser().major, '1'); +}); + +describe('Using Require.js', function () { + it('should loaded automatically', function(done) { + requirejs.config({ + baseUrl : 'dist', + paths : { + 'ua-parser-js' : 'ua-parser.min' + } + }); + requirejs(['ua-parser-js'], function(ua) { + var parser = new ua('Dillo/1.0'); + assert.deepEqual(parser.getBrowser().name, 'Dillo'); + done(); + }); + }); }); \ No newline at end of file From 2b4a20d162b1caaef9faff0b4d7ee4a6eb767760 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 14 Nov 2016 00:33:56 +0700 Subject: [PATCH 035/170] Edit readme --- readme.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index 6c3d85e..d97a59c 100644 --- a/readme.md +++ b/readme.md @@ -1,23 +1,19 @@ # UAParser.js -Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as jQuery/Zepto plugin, Component/Bower/Meteor package, & RequireJS/AMD module + A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Component/Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) -[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/3867907/faisalmanua-parser-js-on-GitHub) +[![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) +[![Bower](https://img.shields.io/bower/v/ua-parser-js.svg)](https://bower.io/) [![CDNJS](https://img.shields.io/cdnjs/v/UAParser.js.svg)](https://cdnjs.com/libraries/UAParser.js) +[![Gratipay](https://img.shields.io/gratipay/team/UAParser.js.svg)](https://gratipay.com/UAParser.js) +[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/3867907/faisalmanua-parser-js-on-GitHub) * Author : Faisal Salman <> * Demo : http://faisalman.github.io/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js -# Features - -Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model purely from user-agent string with relatively lightweight footprint (~11KB minified / ~4KB gzipped). Written in vanilla js, which means it doesn't depends on any other library. - -![It's over 9000](https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/over9000.jpg) - - # Methods * `getBrowser()` From 507714c3c7709649019351f3fa6bf02d17e0abec Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 14 Nov 2016 00:42:43 +0700 Subject: [PATCH 036/170] Move logo to right --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index d97a59c..4f5eb00 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Component/Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. + A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Component/Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) From 975cbdc89e611ed939ef061dfd93ec766ae00a34 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 14 Nov 2016 10:02:07 +0700 Subject: [PATCH 037/170] Bumping version: 0.7.11 -> 0.7.12 --- bower.json | 28 +--------------------------- component.json | 6 ++++-- package.js | 2 +- package.json | 2 +- src/ua-parser.js | 4 ++-- ua-parser-js.jquery.json | 2 +- 6 files changed, 10 insertions(+), 34 deletions(-) diff --git a/bower.json b/bower.json index aacc321..c1f71ba 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.11", + "version": "0.7.12", "authors": [ "Faisal Salman " ], @@ -13,31 +13,5 @@ "test", "tests" ], - "contributors": [ - "Faisal Salman ", - "Benjamin Bertrand ", - "Carl C Von Lewin ", - "Christopher De Cairos ", - "Davit Barbakadze ", - "Dmitry Tyschenko ", - "Douglas Li ", - "Dumitru Uzun ", - "Erik Hesselink ", - "Fabian Becker ", - "Hendrik Helwich ", - "Jackpoll ", - "Jake Mc ", - "John Tantalo ", - "John Yanarella ", - "Jon Buckley ", - "Kendall Buchanan ", - "Lee Treveil ", - "Leonardo ", - "Max Maurer ", - "Michael Hess ", - "OtakuSiD ", - "Ross Noble ", - "Sandro Sonntag " - ], "dependencies": {} } diff --git a/component.json b/component.json index 5f63724..0264ad4 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.11", + "version": "0.7.12", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ "user-agent", @@ -19,6 +19,8 @@ "development": { "jshint/jshint": "*", "visionmedia/mocha": "*", - "mishoo/uglifyjs2": "*" + "mishoo/uglifyjs2": "*", + "requirejs": "^2.3.2", + "verup": "^1.3.x" } } diff --git a/package.js b/package.js index 6aae690..216597f 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'faisalman:ua-parser-js', - version: '0.7.11', + version: '0.7.12', 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 dbb1e34..f63bab5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "UAParser.js", "name": "ua-parser-js", - "version": "0.7.11", + "version": "0.7.12", "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 f782918..8d5d513 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /** - * UAParser.js v0.7.11 + * UAParser.js v0.7.12 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.11', + var LIBVERSION = '0.7.12', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', diff --git a/ua-parser-js.jquery.json b/ua-parser-js.jquery.json index 4407936..04a6687 100644 --- a/ua-parser-js.jquery.json +++ b/ua-parser-js.jquery.json @@ -1,7 +1,7 @@ { "title": "UAParser.js", "name": "ua-parser-js", - "version": "0.7.11", + "version": "0.7.12", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ "user-agent", From 2de1f2a75d53c06c93d93f724850fc5adc494184 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 14 Nov 2016 10:12:49 +0700 Subject: [PATCH 038/170] Remove ComponentJS support --- component.json | 26 -------------------------- readme.md | 8 +------- 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 component.json diff --git a/component.json b/component.json deleted file mode 100644 index 0264ad4..0000000 --- a/component.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "ua-parser-js", - "version": "0.7.12", - "description": "Lightweight JavaScript-based user-agent string parser", - "keywords": [ - "user-agent", - "parser", - "browser", - "engine", - "os", - "device", - "cpu" - ], - "scripts": [ - "src/ua-parser.js" - ], - "main": "src/ua-parser.js", - "license": "MIT", - "development": { - "jshint/jshint": "*", - "visionmedia/mocha": "*", - "mishoo/uglifyjs2": "*", - "requirejs": "^2.3.2", - "verup": "^1.3.x" - } -} diff --git a/readme.md b/readme.md index 4f5eb00..7951d06 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Component/Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. + A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) @@ -204,12 +204,6 @@ requirejs(['ua-parser-js'], function(UAParser) { }); ``` -## Using component - -```sh -$ component install faisalman/ua-parser-js -``` - ## Using bower ```sh From 01ae611dfa2d2c2ec3dba79c454538c0ed92e54f Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 14 Nov 2016 10:14:01 +0700 Subject: [PATCH 039/170] Build dist package --- dist/ua-parser.min.js | 4 ++-- dist/ua-parser.pack.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index b5d1888..e4d47a1 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,8 +1,8 @@ /** - * UAParser.js v0.7.11 + * UAParser.js v0.7.12 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.11",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:t},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.11",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:t},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s Date: Thu, 17 Nov 2016 13:36:08 -0500 Subject: [PATCH 040/170] Add google pixel devices - Add Google Pixel and Google Pixel XL mobiles - Add Google Pixel C tablet --- src/ua-parser.js | 7 +++++++ test/device-test.json | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 8d5d513..f778d7e 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -623,6 +623,13 @@ /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ + /android.+;\s(pixel c)\s/i // Google Pixel C + ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ + + /android.+;\s(pixel xl|pixel)\s/i // Google Pixel + ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ + + /android.+(\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+build/i // Xiaomi Mi diff --git a/test/device-test.json b/test/device-test.json index 2a0c75e..3a1fa00 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -480,4 +480,37 @@ "type" : "mobile" } } +, + { + "desc" : "Google Pixel C", + "ua" : "Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36", + "expect" : + { + "vendor" : "Google", + "model" : "Pixel C", + "type" : "tablet" + } + } +, + { + "desc" : "Google Pixel", + "ua" : "Mozilla/5.0 (Linux; Android 7.1; Pixel Build/NDE63V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Google", + "model" : "Pixel", + "type" : "mobile" + } + } +, + { + "desc" : "Google Pixel", + "ua" : "Mozilla/5.0 (Linux; Android 7.1; Pixel XL Build/NDE63X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Google", + "model" : "Pixel XL", + "type" : "mobile" + } + } ] From 2aa2f77881a75b7706121ab7723d4a2c8965c1ed Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 22 Nov 2016 00:49:18 +0700 Subject: [PATCH 041/170] Fix #186 unnecessary `if` statement inside `while` loop --- src/ua-parser.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 8d5d513..2056ae8 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -83,33 +83,26 @@ rgx : function () { - var result, i = 0, j, k, p, q, matches, match, args = arguments; + var result = {}, 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; + } // loop through all regexes maps while (i < args.length && !matches) { var regex = args[i], // even sequence (0,2,4,..) props = args[i + 1]; // odd sequence (1,3,5,..) - - // construct object barebones - if (typeof result === UNDEF_TYPE) { - result = {}; - for (p in props) { - if (props.hasOwnProperty(p)){ - q = props[p]; - if (typeof q === OBJ_TYPE) { - result[q[0]] = undefined; - } else { - result[q] = undefined; - } - } - } - } + j = k = 0; // try matching uastring with regexes - j = k = 0; while (j < regex.length && !matches) { + matches = regex[j++].exec(this.getUA()); + if (!!matches) { for (p = 0; p < props.length; p++) { match = matches[++k]; From 3e2d5c181773f0c594f561db36ae4d956f85a7f2 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 22 Nov 2016 14:03:54 +0700 Subject: [PATCH 042/170] Update contributors --- package.json | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f63bab5..824de7f 100644 --- a/package.json +++ b/package.json @@ -15,30 +15,65 @@ ], "homepage": "http://github.com/faisalman/ua-parser-js", "contributors": [ - "Faisal Salman ", + "Aamir Poonawalla ", + "Admas ", + "algenon ", + "Andrea Vaghi ", + "Anton Zhiyanov ", + "Austin Pray ", "Benjamin Bertrand ", + "boneyao ", "Carl C Von Lewin ", + "CESAR RAMOS ", "Christopher De Cairos ", "Davit Barbakadze ", + "ddivernois ", + "Demis Palma ", "Dmitry Tyschenko ", "Douglas Li ", "Dumitru Uzun ", "Erik Hesselink ", "Fabian Becker ", + "Faisal Salman ", + "Frédéric Camblor ", + "Grigory Dmitrenko ", "Hendrik Helwich ", - "Jackpoll ", + "jackpoll ", "Jake Mc ", "John Tantalo ", "John Yanarella ", "Jon Buckley ", "Kendall Buchanan ", "Lee Treveil ", - "Leonardo ", + "leonardo ", + "Levente Balogh ", + "Liam Quinn ", + "Lithin ", + "Lukas Eipert ", + "Malash ", + "Martynas ", + "Maximilian Haupt ", "Max Maurer ", "Michael Hess ", - "OtakuSiD ", + "naoh ", + "Nik Rolls ", + "niris ", + "otakuSiD ", + "Peter Dave Hello ", + "philippsimon ", + "Pieter Hendrickx ", + "Robert Tod ", "Ross Noble ", - "Sandro Sonntag " + "Sandro Sonntag ", + "sgautrea ", + "Shane Gautreau ", + "Shane Thacker ", + "Simon Eisenmann ", + "Simon Lang ", + "Sylvain Gizard ", + "szchenghuang ", + "Vadim Kurachevsky ", + "Yun Young-jin " ], "main": "src/ua-parser.js", "scripts": { From 5177c460a57ce9872a97152724cbcdad652fa788 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 6 Dec 2016 12:41:48 +0700 Subject: [PATCH 043/170] Use constructors --- src/ua-parser.js | 74 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index df69765..d138f8e 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -81,27 +81,28 @@ var mapper = { - rgx : function () { + rgx : function (ua, arrays) { - var result = {}, i = 0, j, k, p, q, matches, match, args = arguments; + //var result = {}, + var i = 0, j, k, p, q, matches, match;//, args = arguments; - // construct object barebones + /*// construct object barebones for (p = 0; p < args[1].length; p++) { q = args[1][p]; result[typeof q === OBJ_TYPE ? q[0] : q] = undefined; - } + }*/ // loop through all regexes maps - while (i < args.length && !matches) { + while (i < arrays.length && !matches) { - var regex = args[i], // even sequence (0,2,4,..) - props = args[i + 1]; // odd sequence (1,3,5,..) + var regex = arrays[i], // even sequence (0,2,4,..) + props = arrays[i + 1]; // odd sequence (1,3,5,..) j = k = 0; // try matching uastring with regexes while (j < regex.length && !matches) { - matches = regex[j++].exec(this.getUA()); + matches = regex[j++].exec(ua); if (!!matches) { for (p = 0; p < props.length; p++) { @@ -112,32 +113,33 @@ if (q.length == 2) { if (typeof q[1] == FUNC_TYPE) { // assign modified match - result[q[0]] = q[1].call(this, match); + this[q[0]] = q[1].call(this, match); } else { // assign given value, ignore regex match - result[q[0]] = q[1]; + this[q[0]] = q[1]; } } else if (q.length == 3) { // check whether function or regex if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) { // call function (usually string mapper) - result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined; + this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined; } else { // sanitize match using given regex - result[q[0]] = match ? match.replace(q[1], q[2]) : undefined; + this[q[0]] = match ? match.replace(q[1], q[2]) : undefined; } } else if (q.length == 4) { - result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined; + this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined; } } else { - result[q] = match ? match : undefined; + this[q] = match ? match : undefined; } } } } i += 2; } - return result; + //console.log(this); + //return this; }, str : function (str, map) { @@ -790,6 +792,20 @@ // 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) { @@ -799,23 +815,32 @@ 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 = mapper.rgx.apply(this, rgxmap.browser); - browser.major = util.major(browser.version); + mapper.rgx.call(browser, ua, rgxmap.browser); + browser.major = util.major(browser.version); // deprecated return browser; }; this.getCPU = function () { - return mapper.rgx.apply(this, rgxmap.cpu); + mapper.rgx.call(cpu, ua, rgxmap.cpu); + return cpu; }; this.getDevice = function () { - return mapper.rgx.apply(this, rgxmap.device); + mapper.rgx.call(device, ua, rgxmap.device); + return device; }; this.getEngine = function () { - return mapper.rgx.apply(this, rgxmap.engine); + mapper.rgx.call(engine, ua, rgxmap.engine); + return engine; }; this.getOS = function () { - return mapper.rgx.apply(this, rgxmap.os); + mapper.rgx.call(os, ua, rgxmap.os); + return os; }; this.getResult = function() { return { @@ -832,6 +857,11 @@ }; 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; @@ -865,7 +895,7 @@ NAME : NAME, VERSION : VERSION }; - + //UAParser.Utils = util; /////////// // Export From caa2f47c06ac815e94ff4beebbe8fa95f80ca2e6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 6 Dec 2016 12:44:16 +0700 Subject: [PATCH 044/170] update uglify version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 824de7f..3012050 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ ], "main": "src/ua-parser.js", "scripts": { - "build": "uglifyjs src/ua-parser.js > dist/ua-parser.min.js --comments '/UAParser\\.js/' && uglifyjs src/ua-parser.js > dist/ua-parser.pack.js --comments '/UAParser\\.js/' --compress --mangle", + "build": "uglifyjs src/ua-parser.js -o dist/ua-parser.min.js --comments '/UAParser\\.js/' && uglifyjs src/ua-parser.js -o dist/ua-parser.pack.js --comments '/UAParser\\.js/' --compress --mangle", "test": "jshint src/ua-parser.js && mocha -R nyan test/test.js", "verup": "node ./node_modules/verup", "version": "node ./node_modules/verup 0" @@ -99,7 +99,7 @@ "jshint": "~1.1.0", "mocha": "~1.8.0", "requirejs": "^2.3.2", - "uglify-js": "~1.3.4", + "uglify-js": "~2.7.5", "verup": "^1.3.x" }, "repository": { From ef69224d7c34820a3af2f1665a7043d63cc001e3 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 6 Dec 2016 13:47:30 +0700 Subject: [PATCH 045/170] Edit readme --- readme.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index 7951d06..6f6de19 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. + A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not accurate than using feature detection. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) @@ -13,6 +13,13 @@ * Demo : http://faisalman.github.io/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js +# Constructor + +* `new UAParser([uastring][,extensions])` + * returns new instance + +* `UAParser([uastring][,extensions])` + * returns result object # Methods @@ -237,6 +244,10 @@ console.log($.ua.browser.name); // "Safari" console.log($.ua.engine.name); // "Webkit" console.log($.ua.device); // {vendor: "Motorola", model: "Xoom", type: "tablet"} console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4 + +// Add class to tag +// +$('body').addClass('ua-browser-' + $.ua.browser.name + ' ua-devicetype-' + $.ua.device.type); ``` ## Extending regex patterns @@ -247,7 +258,7 @@ Pass your own regexes to extend the limited matching rules. ```js // Example: -var uaString = 'MyOwnBrowser/1.3'; +var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; var myOwnRegex = [[/(myownbrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]]; var parser = new UAParser(uaString, { browser: myOwnRegex }); console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} @@ -261,15 +272,10 @@ console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} * Fork and clone this repository * Make some changes as required * Write a unit test to showcase your feature -* Run the test suites to make sure the changes you made didn't break anything - -```sh -$ npm run test -``` - +* Run the test suites to make sure the changes you made didn't break anything `$ npm run test` * Commit and push to your own repository * Submit a pull request to this repository under `develop` branch -* Profit? +* Profit? $$$ ## Build From 49609c09907e26d6f3a81004988b3c14263badd3 Mon Sep 17 00:00:00 2001 From: Piper Chester Date: Tue, 6 Dec 2016 22:16:25 -0800 Subject: [PATCH 046/170] Fix formatting for consistency --- 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 df69765..23ed194 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -817,7 +817,7 @@ this.getOS = function () { return mapper.rgx.apply(this, rgxmap.os); }; - this.getResult = function() { + this.getResult = function () { return { ua : this.getUA(), browser : this.getBrowser(), @@ -900,7 +900,7 @@ if (typeof $ !== UNDEF_TYPE) { var parser = new UAParser(); $.ua = parser.getResult(); - $.ua.get = function() { + $.ua.get = function () { return parser.getUA(); }; $.ua.set = function (uastring) { From eed646f9ce8463690ce02621e3740cf9f9e09dc0 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Dec 2016 23:50:01 +0700 Subject: [PATCH 047/170] Add Bowser --- readme.md | 28 ++++++++++++++-------------- src/ua-parser.js | 4 ++-- test/browser-test.json | 10 ++++++++++ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/readme.md b/readme.md index 6f6de19..50ab6a2 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ * returns new instance * `UAParser([uastring][,extensions])` - * returns result object + * returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }` # Methods @@ -28,14 +28,14 @@ ``` # Possible 'browser.name': -Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Camino, Chimera, Chrome, -Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, Epiphany, Fennec, -Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, IceDragon, -Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links, -Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, +Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Bowser, Camino, Chimera, +Chrome [WebView], Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, +Epiphany, Fennec, Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, +IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, +Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], -PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, -Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex +PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, Sleipnir, +SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex # 'browser.version' determined dynamically ``` @@ -50,8 +50,8 @@ console, mobile, tablet, smarttv, wearable, embedded # Possible 'device.vendor': Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, -Nintendo, Nokia, Nvidia, Ouya, Palm, Panasonic, Polytron, RIM, Samsung, Sharp, -Siemens, Sony-Ericsson, Sprint, Xbox, ZTE +Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm, Panasonic, Pebble, Polytron, RIM, +Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE # 'device.model' determined dynamically ``` @@ -75,7 +75,7 @@ Tasman, Trident, w3m, WebKit AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, Joli, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, -Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PCLinuxOS, Plan9, Playstation, QNX, RedHat, +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 @@ -87,8 +87,7 @@ Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk ``` # Possible 'cpu.architecture' -68k, amd64, arm, arm64, avr, ia32, ia64, irix, irix64, mips, mips64, pa-risc, -ppc, sparc, sparc64 +68k, amd64, arm[64], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64] ``` * `getResult()` @@ -98,7 +97,8 @@ ppc, sparc, sparc64 * returns UA string of current instance * `setUA(uastring)` - * set & parse UA string + * set UA string to parse + * returns current instance # Example diff --git a/src/ua-parser.js b/src/ua-parser.js index d138f8e..e63ac7b 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -254,8 +254,8 @@ // Webkit/KHTML based /(rekonq)\/([\w\.]+)*/i, // Rekonq - /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i - // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS + /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i + // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser ], [NAME, VERSION], [ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 diff --git a/test/browser-test.json b/test/browser-test.json index 8a01e88..ad1f988 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -99,6 +99,16 @@ "major" : "0" } }, + { + "desc" : "Bowser", + "ua" : "Mozilla/5.0 (iOS; like Mac OS X) AppleWebKit/536.36 (KHTML, like Gecko) not Chrome/27.0.1500.95 Mobile/10B141 Safari/537.36 Bowser/0.2.1", + "expect" : + { + "name" : "Bowser", + "version" : "0.2.1", + "major" : "0" + } + }, { "desc" : "Camino", "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en; rv:1.9.0.19) Gecko/2011091218 Camino/2.0.9 (like Firefox/3.0.19)", From 740fc93b4bec79e01774f7dbadbd15b76203e031 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 27 Dec 2016 15:58:03 +0700 Subject: [PATCH 048/170] Fix #210 Add device: OPPO --- src/ua-parser.js | 15 +++------------ test/device-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index e63ac7b..c6012a6 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -615,6 +615,9 @@ /((pebble))app\/[\d\.]+\s/i // Pebble ], [VENDOR, MODEL, [TYPE, WEARABLE]], [ + /android.+;\s(oppo)\s?([\w\s]+)\sbuild/i // OPPO + ], [VENDOR, MODEL, [TYPE, MOBILE]], [ + /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ @@ -624,7 +627,6 @@ /android.+;\s(pixel xl|pixel)\s/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ - /android.+(\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+build/i // Xiaomi Mi @@ -661,17 +663,6 @@ /(SM-T311)/i // Samsung Galaxy Tab 3 8.0 ], [[MODEL, 'Galaxy Tab 3 8.0'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ - /(R1001)/i // Oppo R1001 - ], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [ - /(X9006)/i // Oppo Find 7a - ], [[MODEL, 'Find 7a'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [ - /(R2001)/i // Oppo YOYO R2001 - ], [[MODEL, 'Yoyo R2001'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [ - /(R815)/i // Oppo Clover R815 - ], [[MODEL, 'Clover R815'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [ - /(U707)/i // Oppo Find Way S - ], [[MODEL, 'Find Way S'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [ - /(T3C)/i // Advan Vandroid T3C ], [MODEL, [VENDOR, 'Advan'], [TYPE, TABLET]], [ /(ADVAN T1J\+)/i // Advan Vandroid T1J+ diff --git a/test/device-test.json b/test/device-test.json index 3a1fa00..4bc7228 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -179,6 +179,16 @@ "type" : "mobile" } }, + { + "desc" : "OPPO R7s", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; OPPO R7s Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.1 Mobile Safari/537.36", + "expect" : + { + "vendor" : "OPPO", + "model" : "R7s", + "type" : "mobile" + } + }, { "desc" : "Philips SmartTV", "ua" : "Opera/9.80 HbbTV/1.1.1 (; Philips; ; ; ; ) NETTV/4.0.2; en) Version/11.60", From 6555bf6e814b65798d8d9890d705098251ead2c1 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 27 Dec 2016 16:36:51 +0700 Subject: [PATCH 049/170] Fix #210 Refine browser: QQBrowser --- src/ua-parser.js | 7 ++++--- test/browser-test.json | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index c6012a6..567517c 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -273,6 +273,9 @@ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ + /m?(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser + ], [NAME, VERSION], [ + /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ @@ -283,10 +286,8 @@ /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ - /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i, + /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia - /(qqbrowser)[\/\s]?([\w\.]+)/i - // QQBrowser ], [NAME, VERSION], [ /(uc\s?browser)[\/\s]?([\w\.]+)/i, diff --git a/test/browser-test.json b/test/browser-test.json index ad1f988..da8623d 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -649,6 +649,16 @@ "major" : "6" } }, + { + "desc" : "QQ", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; OPPO R7s Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.1 Mobile Safari/537.36", + "expect" : + { + "name" : "QQBrowser", + "version" : "7.1", + "major" : "7" + } + }, { "desc" : "RockMelt", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) RockMelt/0.8.36.78 Chrome/7.0.517.44 Safari/534.7", From 252db2534ee70c466c2e374df896c68ab1ab5403 Mon Sep 17 00:00:00 2001 From: Eric Schrenker Date: Tue, 17 Jan 2017 14:43:09 -0600 Subject: [PATCH 050/170] :memo: copyedit readme --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 7951d06..c300154 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. + A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in-browser (client-side) or in a node.js (server-side) environment. Also available as a jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify the web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from the user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) From fe568ffe96553eff0b6752c7d2dbd996024aa9ef Mon Sep 17 00:00:00 2001 From: Arturo Mejia Date: Wed, 8 Mar 2017 12:55:35 -0500 Subject: [PATCH 051/170] Added Google Chromemast detection --- src/ua-parser.js | 3 +++ test/device-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 567517c..a9f96cb 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -619,6 +619,9 @@ /android.+;\s(oppo)\s?([\w\s]+)\sbuild/i // OPPO ], [VENDOR, MODEL, [TYPE, MOBILE]], [ + /crkey/i // Google Chromecast + ], [[MODEL, 'Chromecast'], [VENDOR, 'Google']], [ + /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 4bc7228..589285a 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -490,6 +490,16 @@ "type" : "mobile" } } +, + { + "desc" : "Google Chromecast", + "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" + } + } , { "desc" : "Google Pixel C", From f89e08f2c0f56ed830720ad4d5f4d51615c1ed98 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 14:47:11 +0530 Subject: [PATCH 052/170] Improved LG Tablet Detection --- src/ua-parser.js | 2 ++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 567517c..978089d 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -599,6 +599,8 @@ /android\s3\.[\s\w;-]{10}(a\d{3})/i // Acer ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [ + /android.+([vl]k\-?\d{3})\s+build/i // LG Tablet + ], [MODEL, [VENDOR, 'LG'], [TYPE, TABLET]], [ /android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ /(lg) netcast\.tv/i // LG SmartTV diff --git a/test/device-test.json b/test/device-test.json index 4bc7228..a3303fa 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -523,4 +523,26 @@ "type" : "mobile" } } +, + { + "desc" : "LG VK Series Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 5.0.2; VK700 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.84 Safari/537.36", + "expect" : + { + "vendor" : "LG", + "model" : "VK700", + "type" : "tablet" + } + } +, + { + "desc" : "LG LK Series Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 5.0.1; LGLK430 Build/LRX21Y) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/38.0.2125.102 Safari/537.36", + "expect" : + { + "vendor" : "LG", + "model" : "LK430", + "type" : "tablet" + } + } ] From 4768992762bd72eb66d02a4683adc2956dbb19af Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 14:54:40 +0530 Subject: [PATCH 053/170] Added LG Generic Mobile --- src/ua-parser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 978089d..a318912 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -606,7 +606,8 @@ /(lg) netcast\.tv/i // LG SmartTV ], [VENDOR, MODEL, [TYPE, SMARTTV]], [ /(nexus\s[45])/i, // LG - /lg[e;\s\/-]+(\w+)*/i + /lg[e;\s\/-]+(\w+)*/i, + /android.+lg(\-?[\d\w]+)\s+build/i ], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [ /android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo From 8e09cd49e328f8c225cdfcb7c31a2b1b1cae3bf8 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 14:57:28 +0530 Subject: [PATCH 054/170] Added RCA Devices detection --- src/ua-parser.js | 3 +++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index a318912..6fe342a 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -639,6 +639,9 @@ /android.+a000(1)\s+build/i // OnePlus ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ + /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets + ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] diff --git a/test/device-test.json b/test/device-test.json index a3303fa..0ca0ff7 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -545,4 +545,26 @@ "type" : "tablet" } } +, + { + "desc" : "RCA Voyager III Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; RCT6973W43 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "RCA", + "model" : "RCT6973W43", + "type" : "tablet" + } + } +, + { + "desc" : "RCA Voyager II Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 5.0; RCT6773W22B Build/LRX21M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "RCA", + "model" : "RCT6773W22B", + "type" : "tablet" + } + } ] From 985a7b18e0594f2e4d9572c947bd812faffd7eda Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:00:00 +0530 Subject: [PATCH 055/170] Added Verizon Devices detection --- src/ua-parser.js | 3 +++ test/device-test.json | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 6fe342a..2e83c19 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -642,6 +642,9 @@ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet + ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] diff --git a/test/device-test.json b/test/device-test.json index 0ca0ff7..72e34bd 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -567,4 +567,37 @@ "type" : "tablet" } } +, + { + "desc" : "Verizon Quanta Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; QMV7B Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Verizon", + "model" : "QMV7B", + "type" : "tablet" + } + } +, + { + "desc" : "Verizon Ellipsis 8 Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; QTAQZ3 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Verizon", + "model" : "QTAQZ3", + "type" : "tablet" + } + } +, + { + "desc" : "Verizon Ellipsis 8HD Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; QTASUN1 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Safari/537.36", + "expect" : + { + "vendor" : "Verizon", + "model" : "QTASUN1", + "type" : "tablet" + } + } ] From a25426840c0db078783e8d121d9add626cbc0fd2 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:01:49 +0530 Subject: [PATCH 056/170] Added Dell Venue Tablet detection --- src/ua-parser.js | 4 ++++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 2e83c19..60dae02 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -642,9 +642,13 @@ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Venue[\d\s]*)\s+build/i // Dell Venue Tablets + ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] diff --git a/test/device-test.json b/test/device-test.json index 72e34bd..e3e86ae 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -600,4 +600,26 @@ "type" : "tablet" } } +, + { + "desc" : "Dell Venue 8 Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; Venue 8 3830 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Dell", + "model" : "Venue 8 3830", + "type" : "tablet" + } + } +, + { + "desc" : "Dell Venue 7 Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; Venue 7 3730 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Dell", + "model" : "Venue 7 3730", + "type" : "tablet" + } + } ] From f3882f1882ff6244d255a43dcfdc1dddf481b724 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:03:04 +0530 Subject: [PATCH 057/170] Added Barnes & Noble Tablet detection --- src/ua-parser.js | 3 +++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 60dae02..3c22590 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -648,6 +648,9 @@ /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [ + /android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i // Barnes & Noble Tablet + ], [[VENDOR, 'Barnes & Noble'], MODEL, [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile diff --git a/test/device-test.json b/test/device-test.json index e3e86ae..d398a60 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -622,4 +622,26 @@ "type" : "tablet" } } +, + { + "desc" : "Barnes & Noble Nook HD+ Tablet", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Barnes & Noble Nook HD+ Build/JZO54K; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect" : + { + "vendor" : "Barnes & Noble", + "model" : "Nook HD+", + "type" : "tablet" + } + } +, + { + "desc" : "Barnes & Noble V400 Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36", + "expect" : + { + "vendor" : "Barnes & Noble", + "model" : "V400", + "type" : "tablet" + } + } ] From b89fa098aa7adbcfc9158b90123a884525ff3748 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:04:02 +0530 Subject: [PATCH 058/170] Added NuVision Tablet detection --- src/ua-parser.js | 2 ++ test/device-test.json | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 3c22590..af0478f 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -651,6 +651,8 @@ /android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i // Barnes & Noble Tablet ], [[VENDOR, 'Barnes & Noble'], MODEL, [TYPE, TABLET]], [ + /android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i // Barnes & Noble Tablet + ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [ /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile diff --git a/test/device-test.json b/test/device-test.json index d398a60..69a56af 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -644,4 +644,15 @@ "type" : "tablet" } } +, + { + "desc" : "NuVision TM101A540N Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 5.1; TM101A540N Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/50.0.2661.86 Safari/537.36", + "expect" : + { + "vendor" : "NuVision", + "model" : "TM101A540N", + "type" : "tablet" + } + } ] From 8e9c400ec5a996f8890ae6f68d2803c0705bcf76 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:07:22 +0530 Subject: [PATCH 059/170] Added ZTE K-Series Tablet detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index af0478f..87da356 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -654,6 +654,9 @@ /android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i // Barnes & Noble Tablet ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i // ZTE K Series Tablet + ], [[VENDOR, 'ZTE'], MODEL, [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] diff --git a/test/device-test.json b/test/device-test.json index 69a56af..814e22a 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -655,4 +655,15 @@ "type" : "tablet" } } +, + { + "desc" : "ZTE K Series Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; K88 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "ZTE", + "model" : "K88", + "type" : "tablet" + } + } ] From fbe8a0e3a6c3309022abc45c077b38274cf001fb Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:09:01 +0530 Subject: [PATCH 060/170] Added Generic Android detection --- src/ua-parser.js | 8 ++++++-- test/device-test.json | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 87da356..637f4ed 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -659,9 +659,13 @@ /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile - ], [[TYPE, util.lowerize], VENDOR, MODEL] + ], [[TYPE, util.lowerize], VENDOR, MODEL], [ - /*////////////////////////// + /(android.+)[;\/].+build/i // Generic Android Device + ], [MODEL, [VENDOR, 'Generic']] + + + /*////////////////////////// // TODO: move to string map //////////////////////////// diff --git a/test/device-test.json b/test/device-test.json index 814e22a..9e710e2 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -524,6 +524,17 @@ } } , + + { + "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", + "expect" : + { + "vendor" : "Generic", + "model" : "Android 6.0.1" + } + } +, { "desc" : "LG VK Series Tablet", "ua" : "Mozilla/5.0 (Linux; Android 5.0.2; VK700 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.84 Safari/537.36", From 4e2cbdfd16211c1151fa2857395828e0eec7fb68 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:17:53 +0530 Subject: [PATCH 061/170] Added Swiss Mobiles and Tablets detection --- src/ua-parser.js | 6 ++++++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 637f4ed..9673426 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -657,6 +657,12 @@ /android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i // ZTE K Series Tablet ], [[VENDOR, 'ZTE'], MODEL, [TYPE, TABLET]], [ + /android.+[;\/]\s*(gen\d{3})\s+build.*49h/i // Swiss GEN Mobile + ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [ + + /android.+[;\/]\s*(zur\d{3})\s+build/i // Swiss ZUR Tablet + ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index 9e710e2..3cf8d8d 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -677,4 +677,26 @@ "type" : "tablet" } } +, + { + "desc" : "Swizz GEN610", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; GEN610 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Swiss", + "model" : "GEN610", + "type" : "mobile" + } + } +, + { + "desc" : "Swizz ZUR700", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; ZUR700 Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Safari/537.36", + "expect" : + { + "vendor" : "Swiss", + "model" : "ZUR700", + "type" : "tablet" + } + } ] From 38c409e8d955b7f5fc4f50b12cf5a88662d05e84 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:24:26 +0530 Subject: [PATCH 062/170] Added Zeki Tablets detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 9673426..bb28016 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -663,6 +663,9 @@ /android.+[;\/]\s*(zur\d{3})\s+build/i // Swiss ZUR Tablet ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [ + /android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i // Zeki Tablets + ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index 3cf8d8d..98e83dc 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -699,4 +699,15 @@ "type" : "tablet" } } +, + { + "desc" : "Zeki TB782b Tablet", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; en-US; TB782B Build/IMM76D) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.0.2.299 U3/0.8.0 Mobile Safari/534.31", + "expect" : + { + "vendor" : "Zeki", + "model" : "TB782B", + "type" : "tablet" + } + } ] From 48ab3b372c9c09ca1f9a201db401ece5cd96cb81 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:37:48 +0530 Subject: [PATCH 063/170] Added Dragon-Touch Tablets detection --- src/ua-parser.js | 4 ++++ test/device-test.json | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index bb28016..789fefd 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -666,6 +666,10 @@ /android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i // Zeki Tablets ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [ + /(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i, + /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i // Dragon Touch Tablet + ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index 98e83dc..e00141d 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -710,4 +710,15 @@ "type" : "tablet" } } +, + { + "desc" : "Dragon Touch Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Dragon Touch", + "model" : "9138B", + "type" : "tablet" + } + } ] From 6fb4941458cef601d8a25fa072490f5090f186b7 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 15:48:22 +0530 Subject: [PATCH 064/170] Added Insignia Tablets detection --- src/ua-parser.js | 3 +++ test/device-test.json | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 789fefd..fcdc91f 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -670,6 +670,9 @@ /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i // Dragon Touch Tablet ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [ + /android.+[;\/]\s*(NS-?.+)\s+build/i // Insignia Tablets + ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index e00141d..bc0414f 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -712,12 +712,23 @@ } , { - "desc" : "Dragon Touch Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36", + "desc" : "Dragon Touch Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Dragon Touch", + "model" : "9138B", + "type" : "tablet" + } + } +, + { + "desc" : "Insignia Tablet", + "ua" : "Mozilla/5.0 (Linux; U; Android 6.0.1; NS-P08A7100 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Safari/537.36", "expect" : { - "vendor" : "Dragon Touch", - "model" : "9138B", + "vendor" : "Insignia", + "model" : "NS-P08A7100", "type" : "tablet" } } From 83ca52bb28b0418c67476a53eafa3a840489f3b9 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 19:43:50 +0530 Subject: [PATCH 065/170] Added Voice Xtreme Phones detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index fcdc91f..97f53a7 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -673,6 +673,9 @@ /android.+[;\/]\s*(NS-?.+)\s+build/i // Insignia Tablets ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i + ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index bc0414f..bacaa1b 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -732,4 +732,15 @@ "type" : "tablet" } } +, + { + "desc" : "Voice Xtreme V75", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; V75 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect" : + { + "vendor" : "Voice", + "model" : "V75", + "type" : "mobile" + } + } ] From 951106c4251400e232fb3b10e66e64c09cae77c7 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 19:44:21 +0530 Subject: [PATCH 066/170] Added LvTel Phones detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 97f53a7..ec82339 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -676,6 +676,9 @@ /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones + /android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i // LvTel Phones + ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index bacaa1b..3fabe4f 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -743,4 +743,15 @@ "type" : "mobile" } } +, + { + "desc" : "LvTel V11", + "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; V11 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36", + "expect" : + { + "vendor" : "LvTel", + "model" : "V11", + "type" : "mobile" + } + } ] From 8d826fcc24e8a7bdf0b356465d9d2b39c0eccaa8 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 19:50:44 +0530 Subject: [PATCH 067/170] Added Envizen Tablets detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index ec82339..d33fdd4 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -679,6 +679,9 @@ /android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i // LvTel Phones ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [ + /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets + ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index 3fabe4f..13763b9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -754,4 +754,15 @@ "type" : "mobile" } } +, + { + "desc" : "Envizen Tablet V100MD", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; V100MD Build/V100MD.20130816) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", + "expect" : + { + "vendor" : "Envizen", + "model" : "V100MD", + "type" : "tablet" + } + } ] From f7ca724f3bd31465334de5f3a25a32c70d0ae43b Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 19:55:08 +0530 Subject: [PATCH 068/170] Added Rotor Tablets detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index d33fdd4..56bfce4 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -682,6 +682,9 @@ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ + /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets + ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ + /\s(tablet)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index 13763b9..530cfb0 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -765,4 +765,15 @@ "type" : "tablet" } } +, + { + "desc" : "Rotor Tablet", + "ua" : "mozilla/5.0 (linux; android 5.0.1; tu_1491 build/lrx22c) applewebkit/537.36 (khtml, like gecko) chrome/43.0.2357.93 safari/537.36", + "expect" : + { + "vendor" : "Rotor", + "model" : "1491", + "type" : "tablet" + } + } ] From 72a11e24b2f2d9eee47a80c55c043c5fc07ddf00 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:00:42 +0530 Subject: [PATCH 069/170] Added MachSpeed Tablets detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 56bfce4..5c05549 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -682,6 +682,9 @@ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets + ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [ + /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ diff --git a/test/device-test.json b/test/device-test.json index 530cfb0..f340e1a 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -776,4 +776,15 @@ "type" : "tablet" } } +, + { + "desc" : "MachSpeed Tablets", + "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; Trio 7.85 vQ Build/Trio_7.85_vQ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36", + "expect" : + { + "vendor" : "MachSpeed", + "model" : "Trio 7.85 vQ", + "type" : "tablet" + } + } ] From a6316f02b07cf2ffabf59766a24e1f65519ac1fa Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:06:33 +0530 Subject: [PATCH 070/170] Added Trinity Tablets detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 5c05549..68cbe32 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -685,6 +685,9 @@ /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i // Trinity Tablets + ], [VENDOR, MODEL, [TYPE, TABLET]], [ + /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ diff --git a/test/device-test.json b/test/device-test.json index f340e1a..fce4d66 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -787,4 +787,15 @@ "type" : "tablet" } } +, + { + "desc" : "Trinity Tablets", + "ua" : "Mozilla/5.0 (Linux; Android 5.0.1; Trinity T101 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36", + "expect" : + { + "vendor" : "Trinity", + "model" : "T101", + "type" : "tablet" + } + } ] From 7d826ed62ef038f6a00cab85d9ed78a5a93d0edc Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:09:22 +0530 Subject: [PATCH 071/170] Improved Unidentified Tablet detection --- 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 68cbe32..84a7b3d 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -691,7 +691,7 @@ /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ - /\s(tablet)[;\/]/i, // Unidentifiable Tablet + /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ From 89775a8ae70320f0a8be345891403a6535c27fb3 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:19:14 +0530 Subject: [PATCH 072/170] Added NextBook Tablet detection --- src/ua-parser.js | 3 +++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 84a7b3d..8368766 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -673,6 +673,9 @@ /android.+[;\/]\s*(NS-?.+)\s+build/i // Insignia Tablets ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [ + /android.+[;\/]\s*((NX|Next)-?.+)\s+build/i // NextBook Tablets + ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones diff --git a/test/device-test.json b/test/device-test.json index fce4d66..4f1ca28 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -798,4 +798,26 @@ "type" : "tablet" } } +, + { + "desc" : "NextBook Next7", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Next7P12 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", + "expect" : + { + "vendor" : "NextBook", + "model" : "Next7P12", + "type" : "tablet" + } + } +, + { + "desc" : "NextBook Tablets", + "ua" : "Mozilla/5.0 (Linux; Android 5.0; NXA8QC116 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "NextBook", + "model" : "NXA8QC116", + "type" : "tablet" + } + } ] From ee2db31f8ced432525ca005bb1d2749919dbad5a Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:27:04 +0530 Subject: [PATCH 073/170] Added Le-Pan Tablet detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 8368766..d17d9c1 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -685,6 +685,9 @@ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ + /android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i // Le Pan Tablets + ], [VENDOR, MODEL, [TYPE, TABLET]], [ + /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [ diff --git a/test/device-test.json b/test/device-test.json index 4f1ca28..33b7119 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -820,4 +820,15 @@ "type" : "tablet" } } +, + { + "desc" : "Le Pan Tablets", + "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Le Pan", + "model" : "TC802A", + "type" : "tablet" + } + } ] From a25bb8b1a6f1961b9a037411f1ed5c45996a47ff Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:35:11 +0530 Subject: [PATCH 074/170] Added Amazon Kindle Fire Tablet detection --- src/ua-parser.js | 3 +++ test/device-test.json | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index d17d9c1..6520d85 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -697,6 +697,9 @@ /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ + /android.+(KS(.+))\s+build/i // Amazon Kindle Tablets + ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ + /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index 33b7119..d33383c 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -831,4 +831,26 @@ "type" : "tablet" } } +, + { + "desc" : "Le Pan Tablets", + "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Le Pan", + "model" : "TC802A", + "type" : "tablet" + } + } +, + { + "desc" : "Amazon Kindle Fire Tablet", + "ua" : "Mozilla/5.0 (Linux; U; Android 4.4.3; en-us; KFSAWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/3.66 like Chrome/39.0.2171.93 Safari/537.36", + "expect" : + { + "vendor" : "Amazon", + "model" : "KFSAWI", + "type" : "tablet" + } + } ] From 2610f37a8b46d1145f369a488e38ed304cc6c3f0 Mon Sep 17 00:00:00 2001 From: Nikhil Motiani Date: Thu, 16 Mar 2017 20:39:21 +0530 Subject: [PATCH 075/170] Added Gigaset Tablet detection --- src/ua-parser.js | 3 +++ test/device-test.json | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 6520d85..15a09da 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -700,6 +700,9 @@ /android.+(KS(.+))\s+build/i // Amazon Kindle Tablets ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ + /android.+(Gigaset)[\s\-]+(Q.+)\s+build/i // Gigaset Tablets + ], [VENDOR, MODEL, [TYPE, TABLET]], [ + /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ diff --git a/test/device-test.json b/test/device-test.json index d33383c..7ac1da9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -853,4 +853,15 @@ "type" : "tablet" } } +, + { + "desc" : "Gigaset Tablet", + "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; Gigaset QV830 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect" : + { + "vendor" : "Gigaset", + "model" : "QV830", + "type" : "tablet" + } + } ] From 2bc75f10bc1c481021581e9743026d5e5a9afa77 Mon Sep 17 00:00:00 2001 From: Dario Vladovic Date: Tue, 21 Mar 2017 18:09:15 +0100 Subject: [PATCH 076/170] Adding Opera Coast support, fixing UCBrowser detection - pushing UCBrowser up to avoid being caught by Chrome regex - adding regex for Opera Coast (Opera's iOS browser) --- dist/ua-parser.min.js | 3 ++- dist/ua-parser.pack.js | 3 ++- src/ua-parser.js | 16 ++++++++++------ test/browser-test.json | 20 ++++++++++++++++++++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index e4d47a1..2a673c3 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -5,4 +5,5 @@ * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT - */(function(e,t){"use strict";var n="0.7.12",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:t},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0){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 & MIT - */(function(e,t){"use strict";var n="0.7.12",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2===0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:t},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n0?f.length==2?typeof f[1]==s?e[f[0]]=f[1].call(this,c):e[f[0]]=f[1]:f.length==3?typeof f[1]===s&&(!f[1].exec||!f[1].test)?e[f[0]]=c?f[1].call(this,c,f[2]):t:e[f[0]]=c?c.replace(f[1],f[2]):t:f.length==4&&(e[f[0]]=c?f[3].call(this,c.replace(f[1],f[2])):t):e[f]=c?c:t}n+=2}return e},str:function(e,n){for(var r in n)if(typeof n[r]===u&&n[r].length>0){for(var s=0;s0?2==w.length?typeof w[1]==n?this[w[0]]=w[1].call(this,d):this[w[0]]=w[1]:3==w.length?typeof w[1]!==n||w[1].exec&&w[1].test?this[w[0]]=d?d.replace(w[1],w[2]):s:this[w[0]]=d?w[1].call(this,d,w[2]):s:4==w.length&&(this[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):this[w]=d?d:s;c+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n Date: Tue, 21 Mar 2017 18:41:51 +0100 Subject: [PATCH 077/170] Adding support for Puffin browser --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 5 ++++- test/browser-test.json | 10 ++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 2a673c3..7e35f18 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 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.12",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 & MIT */ -!function(i,s){"use strict";var e="0.7.12",o="",r="?",n="function",a="undefined",t="object",w="string",l="major",d="model",c="name",u="type",m="vendor",p="version",b="architecture",f="console",h="mobile",g="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===w?i.replace(/[^\d\.]/g,"").split(".")[0]:s},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},A={rgx:function(i,e){for(var o,r,a,w,l,d,c=0;c0?2==w.length?typeof w[1]==n?this[w[0]]=w[1].call(this,d):this[w[0]]=w[1]:3==w.length?typeof w[1]!==n||w[1].exec&&w[1].test?this[w[0]]=d?d.replace(w[1],w[2]):s:this[w[0]]=d?w[1].call(this,d,w[2]):s:4==w.length&&(this[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):this[w]=d?d:s;c+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n0?2==w.length?typeof w[1]==n?this[w[0]]=w[1].call(this,d):this[w[0]]=w[1]:3==w.length?typeof w[1]!==n||w[1].exec&&w[1].test?this[w[0]]=d?d.replace(w[1],w[2]):s:this[w[0]]=d?w[1].call(this,d,w[2]):s:4==w.length&&(this[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):this[w]=d?d:s;c+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n Date: Thu, 30 Mar 2017 16:13:41 -0600 Subject: [PATCH 078/170] Fix server side rendering Fixes problem when window is undefined in the server. --- 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 23ed194..5b8da8f 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -885,7 +885,7 @@ define(function () { return UAParser; }); - } else { + } else if (window) { // browser env window.UAParser = UAParser; } @@ -896,7 +896,7 @@ // In AMD env the global scope should be kept clean, but jQuery is an exception. // jQuery always exports to global scope, unless jQuery.noConflict(true) is used, // and we should catch that. - var $ = window.jQuery || window.Zepto; + var $ = window && (window.jQuery || window.Zepto); if (typeof $ !== UNDEF_TYPE) { var parser = new UAParser(); $.ua = parser.getResult(); From 552915907e75e77dd0ca654999a1c60b694e036f Mon Sep 17 00:00:00 2001 From: Ron Korland Date: Thu, 13 Apr 2017 16:42:04 +0300 Subject: [PATCH 079/170] Add support to Chrome Headless user agent --- 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 23ed194..ba14faf 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -274,6 +274,9 @@ /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ + /(headlesschrome) ([\w\.]+)/i // Chrome Headless + ], [VERSION, [NAME, 'Chrome Headless']], [ + /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index 8a01e88..111da99 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1,4 +1,14 @@ [ + { + "desc" : "Chrome Headless", + "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36", + "expect" : + { + "name" : "Chrome Headless", + "version" : "HeadlessChrome", + "major" : "" + } + }, { "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 2f1b14906f121a31db81c165bef070b6817bd0db Mon Sep 17 00:00:00 2001 From: Hermann Ebert Date: Tue, 23 May 2017 09:06:58 +0200 Subject: [PATCH 080/170] Facebook browser now recognized as well (not only iOS) --- src/ua-parser.js | 6 +++--- test/browser-test.json | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 4a9b863..22b3170 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -289,6 +289,9 @@ /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ + /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android + ], [VERSION, [NAME, 'Facebook']], [ + /(headlesschrome) ([\w\.]+)/i // Chrome Headless ], [VERSION, [NAME, 'Chrome Headless']], [ @@ -312,9 +315,6 @@ /(coast)\/([\w\.]+)/i // Opera Coast ], [[NAME, 'Opera Coast'], VERSION], [ - /;fbav\/([\w\.]+);/i // Facebook App for iOS - ], [VERSION, [NAME, 'Facebook']], [ - /fxios\/([\w\.-]+)/i // Firefox for iOS ], [VERSION, [NAME, 'Firefox']], [ diff --git a/test/browser-test.json b/test/browser-test.json index 66dddd0..b28517d 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -230,13 +230,23 @@ } }, { - "desc" : "Facebook in-App Browser", + "desc" : "Facebook in-App Browser for Android", "ua" : "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.121 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/35.0.0.48.273;]", "expect" : { - "name" : "Chrome WebView", - "version" : "43.0.2357.121", - "major" : "43" + "name" : "Facebook", + "version" : "35.0.0.48.273", + "major" : "35" + } + }, + { + "desc" : "Facebook in-App Browser for iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E304 [FBAN/FBIOS;FBAV/91.0.0.41.73;FBBV/57050710;FBDV/iPhone8,1;FBMD/iPhone;FBSN/iOS;FBSV/10.3.1;FBSS/2;FBCR/Telekom.de;FBID/phone;FBLC/de_DE;FBOP/5;FBRV/0])", + "expect" : + { + "name" : "Facebook", + "version" : "91.0.0.41.73", + "major" : "91" } }, { From 4c15b107307862e39abe1bb1f66facebac84f41f Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 3 Jun 2017 02:28:55 +0700 Subject: [PATCH 081/170] revert readme.md fix --- readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index ac1da11..88edca8 100644 --- a/readme.md +++ b/readme.md @@ -1,15 +1,16 @@ # UAParser.js - A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in-browser (client-side) or in a node.js (server-side) environment. Also available as a jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify the web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from the user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. + A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not accurate than using feature detection. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) +[![NPM downloads](https://img.shields.io/npm/dw/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) [![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) [![Bower](https://img.shields.io/bower/v/ua-parser-js.svg)](https://bower.io/) [![CDNJS](https://img.shields.io/cdnjs/v/UAParser.js.svg)](https://cdnjs.com/libraries/UAParser.js) [![Gratipay](https://img.shields.io/gratipay/team/UAParser.js.svg)](https://gratipay.com/UAParser.js) [![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/3867907/faisalmanua-parser-js-on-GitHub) -* Author : Faisal Salman <> +* Author : Faisal Salman <> * Demo : http://faisalman.github.io/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js From cf977c50ed470d62f3079099952354550ac69e66 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Jun 2017 14:11:17 +0700 Subject: [PATCH 082/170] remove component.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 3012050..8e39ccd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "UAParser.js", "name": "ua-parser-js", - "version": "0.7.12", + "version": "0.7.13", "author": "Faisal Salman (http://faisalman.com)", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ @@ -85,7 +85,6 @@ "verup": { "files": [ "ua-parser-js.jquery.json", - "component.json", "bower.json", "package.js", "src/ua-parser.js" From 6cc6742f5efadab731c76461d8cb12d7ffcedcf3 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Jun 2017 14:16:29 +0700 Subject: [PATCH 083/170] increment patch version --- bower.json | 2 +- dist/ua-parser.min.js | 4 ++-- dist/ua-parser.pack.js | 4 ++-- package.js | 2 +- src/ua-parser.js | 4 ++-- ua-parser-js.jquery.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index c1f71ba..4d06114 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.12", + "version": "0.7.13", "authors": [ "Faisal Salman " ], diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 2de82ff..1072894 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /** - * UAParser.js v0.7.12 + * UAParser.js v0.7.13 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.12",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 & MIT */ -!function(i,s){"use strict";var e="0.7.12",o="",r="?",n="function",a="undefined",t="object",w="string",l="major",d="model",c="name",u="type",m="vendor",p="version",b="architecture",f="console",h="mobile",g="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===w?i.replace(/[^\d\.]/g,"").split(".")[0]:s},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},A={rgx:function(i,e){for(var o,r,a,w,l,d,c=0;c0?2==w.length?typeof w[1]==n?this[w[0]]=w[1].call(this,d):this[w[0]]=w[1]:3==w.length?typeof w[1]!==n||w[1].exec&&w[1].test?this[w[0]]=d?d.replace(w[1],w[2]):s:this[w[0]]=d?w[1].call(this,d,w[2]):s:4==w.length&&(this[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):this[w]=d?d:s;c+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n0?2==w.length?typeof w[1]==n?this[w[0]]=w[1].call(this,d):this[w[0]]=w[1]:3==w.length?typeof w[1]!==n||w[1].exec&&w[1].test?this[w[0]]=d?d.replace(w[1],w[2]):s:this[w[0]]=d?w[1].call(this,d,w[2]):s:4==w.length&&(this[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):this[w]=d?d:s;c+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n Date: Thu, 22 Jun 2017 17:04:14 +0700 Subject: [PATCH 084/170] Fix #219 samsung mistakenly detected as sony --- src/ua-parser.js | 4 ++-- test/device-test.json | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 1394cfa..e8d4cea 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -532,8 +532,8 @@ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony /(sony)?(?:sgp.+)\sbuild\//i ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [ - /(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i - ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Phone'], [TYPE, MOBILE]], [ + /android.+\s([cdefg]\d{4}|so[-l]\w+)\sbuild\//i + ], [MODEL, [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /\s(ouya)\s/i, // Ouya /(nintendo)\s([wids3u]+)/i // Nintendo diff --git a/test/device-test.json b/test/device-test.json index 589285a..1fa15f9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -219,6 +219,16 @@ "type" : "tablet" } }, + { + "desc" : "Samsung SM-C5000", + "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; SM-C5000 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.81 Mobile Safari/537.36 wkbrowser 4.1.35 3065", + "expect" : + { + "vendor" : "Samsung", + "model" : "SM-C5000", + "type" : "mobile" + } + }, { "desc" : "Samsung SM-T231", "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T231 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", @@ -295,7 +305,7 @@ "expect" : { "vendor" : "Sony", - "model" : "Xperia Phone", + "model" : "C5303", "type" : "mobile" } }, @@ -305,7 +315,7 @@ "expect" : { "vendor" : "Sony", - "model" : "Xperia Phone", + "model" : "SO-02F", "type" : "mobile" } }, @@ -315,7 +325,7 @@ "expect" : { "vendor" : "Sony", - "model" : "Xperia Phone", + "model" : "D6653", "type" : "mobile" } }, @@ -325,7 +335,7 @@ "expect" : { "vendor" : "Sony", - "model" : "Xperia Phone", + "model" : "SOL25", "type" : "mobile" } }, @@ -335,7 +345,7 @@ "expect" : { "vendor" : "Sony", - "model" : "Xperia Phone", + "model" : "C5302", "type" : "mobile" } }, From 3fd01f07eaca38e08cb3c705678382b5c94883c1 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Jun 2017 17:37:35 +0700 Subject: [PATCH 085/170] Fix #235 Detect Meizu Tablet --- src/ua-parser.js | 5 ++++- test/device-test.json | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index e8d4cea..485905e 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -532,7 +532,7 @@ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony /(sony)?(?:sgp.+)\sbuild\//i ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [ - /android.+\s([cdefg]\d{4}|so[-l]\w+)\sbuild\//i + /android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i ], [MODEL, [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /\s(ouya)\s/i, // Ouya @@ -646,6 +646,9 @@ /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ + /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet + ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ + /android.+a000(1)\s+build/i // OnePlus ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index 1fa15f9..b2f5a9e 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -89,6 +89,16 @@ "type" : "mobile" } }, + { + "desc" : "Meizu M5 Note", + "ua" : "Mozilla/5.0 (Linux; Android 6.0; M5 Note Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043024 Safari/537.36 MicroMessenger/6.5.7.1040 NetType/WIFI Language/zh_CN", + "expect" : + { + "vendor" : "Meizu", + "model" : "M5 Note", + "type" : "tablet" + } + }, { "desc" : "Microsoft Lumia 950", "ua" : "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586", From 3a4626b5e8d2a32895faecb3c12b2015eb2f9b3b Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 28 Jun 2017 14:20:05 +0700 Subject: [PATCH 086/170] Fix #211 Distinguish Samsung Browser from Android Browser --- src/ua-parser.js | 4 +++- test/browser-test.json | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 485905e..383f960 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -298,7 +298,9 @@ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [ - /android.+samsungbrowser\/([\w\.]+)/i, + /android.+(samsungbrowser)\/([\w\.]+)/i + ], [[NAME, /(.+g)(.+)/, '$1 $2'], VERSION], [ // Samsung Browser + /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ diff --git a/test/browser-test.json b/test/browser-test.json index b28517d..a888417 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -64,7 +64,7 @@ "ua" : "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-G925F Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.0 Chrome/38.0.2125.102 Mobile Safari/537.36", "expect" : { - "name" : "Android Browser", + "name" : "Samsung Browser", "version" : "3.0", "major" : "3" } @@ -719,6 +719,16 @@ "major" : "2" } }, + { + "desc" : "Samsung Browser", + "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG-SM-G925A Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36", + "expect" : + { + "name" : "Samsung Browser", + "version" : "4.0", + "major" : "4" + } + }, { "desc" : "SeaMonkey", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b4pre) Gecko/20090405 SeaMonkey/2.0b1pre", From 07fe58b7933c87d9d5e2b057dee289d7745e48cd Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 28 Jun 2017 14:36:59 +0700 Subject: [PATCH 087/170] Fix #220 Identify UBrowser as UCBrowser --- src/ua-parser.js | 5 +---- test/browser-test.json | 10 ++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 383f960..c857927 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -270,10 +270,7 @@ /(puffin)\/([\w\.]+)/i // Puffin ], [[NAME, 'Puffin'], VERSION], [ - /(uc\s?browser)[\/\s]?([\w\.]+)/i, - /ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i, - /juc.+(ucweb)[\/\s]?([\w\.]+)/i, - /(ucbrowser)\/([\w\.]+)/i + /((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i // UCBrowser ], [[NAME, 'UCBrowser'], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index a888417..b807a24 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -789,6 +789,16 @@ "major" : "1" } }, + { + "desc" : "UC Browser", + "ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 UBrowser/5.6.12860.7 Safari/537.36", + "expect" : + { + "name" : "UCBrowser", + "version" : "5.6.12860.7", + "major" : "5" + } + }, { "desc" : "UC Browser", "ua" : "Mozilla/5.0 (Linux; U; Android 6.0.1; en-US; Lenovo P2a42 Build/MMB29M) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/11.2.0.915 U3/0.8.0 Mobile Safari/534.30", From f9f9fa79e1c573c6429a5c54dcbbcfd06f586433 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 28 Jun 2017 15:57:50 +0700 Subject: [PATCH 088/170] Fix #247 Add Oculus Browser --- src/ua-parser.js | 4 ++-- test/browser-test.json | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index c857927..5d6d1ac 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -295,8 +295,8 @@ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [ - /android.+(samsungbrowser)\/([\w\.]+)/i - ], [[NAME, /(.+g)(.+)/, '$1 $2'], VERSION], [ // Samsung Browser + /((?:oculus|samsung)browser)\/([\w\.]+)/i + ], [[NAME, /(.+(?:g|us))(.+)/, '$1 $2'], VERSION], [ // Oculus / Samsung Browser /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ diff --git a/test/browser-test.json b/test/browser-test.json index b807a24..d99e3de 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -549,6 +549,16 @@ "major" : "7" } }, + { + "desc" : "Oculus Browser", + "ua" : "Mozilla/5.0 (Linux; Android 7.0; SM-G920I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/3.4.9 SamsungBrowser/4.0 Chrome/57.0.2987.146 Mobile VR Safari/537.36", + "expect" : + { + "name" : "Oculus Browser", + "version" : "3.4.9", + "major" : "3" + } + }, { "desc" : "OmniWeb", "ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.48", From 297c6538bcb75ebdaf1feebe1dac2e35ecc04cf5 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 28 Jun 2017 16:12:43 +0700 Subject: [PATCH 089/170] Fix #206 Detect OS for iOS app --- src/ua-parser.js | 5 +++-- test/os-test.json | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 5d6d1ac..24292f2 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -777,8 +777,9 @@ /(haiku)\s(\w+)/i // Haiku ], [NAME, VERSION],[ - /(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i // iOS - ], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [ + /cfnetwork\/.+darwin/i, + /ip[honead]+(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i // iOS + ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(macintosh|mac(?=_powerpc)\s)/i // Mac OS diff --git a/test/os-test.json b/test/os-test.json index c0100d0..86aa837 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -485,6 +485,15 @@ "version" : "" } }, + { + "desc" : "iOS in App", + "ua" : "AppName/version CFNetwork/version Darwin/version", + "expect" : + { + "name" : "iOS", + "version" : "undefined" + } + }, { "desc" : "iOS with Chrome", "ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3", From fd46c4d2be7cc0abe9fbde7abc05f9012c8bb167 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 1 Jul 2017 18:49:35 +0700 Subject: [PATCH 090/170] Fix #249 Detect Huawei devices --- src/ua-parser.js | 11 ++++++----- test/device-test.json | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 24292f2..c4ba8ad 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -517,8 +517,8 @@ ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ /(blackberry)[\s-]?(\w+)/i, // BlackBerry - /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, - // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola/Polytron + /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, + // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron /(hp)\s([\w\s]+\w)/i, // HP iPAQ /(asus)-?(\w+)/i // Asus ], [VENDOR, MODEL, [TYPE, MOBILE]], [ @@ -552,14 +552,15 @@ /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC /(zte)-(\w+)*/i, // ZTE - /(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i - // Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony + /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i + // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ - /(nexus\s6p)/i // Huawei Nexus 6P + /d\/huawei([\w\s-]+)[;\)]/i, + /(nexus\s6p)/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 b2f5a9e..b211071 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -49,6 +49,16 @@ "type" : "tablet" } }, + { + "desc" : "Huawei Honor", + "ua" : "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; U8860 Build/HuaweiU8860) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", + "expect" : + { + "vendor" : "Huawei", + "model" : "U8860", + "type" : "mobile" + } + }, { "desc" : "Huawei Nexus 6P", "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MTC19V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537", @@ -59,6 +69,26 @@ "type" : "mobile" } }, + { + "desc" : "Huawei P10", + "ua" : "Mozilla/5.0 (Linux; Android 7.0; VTR-L09 Build/HUAWEIVTR-L09; xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Huawei", + "model" : "VTR-L09", + "type" : "mobile" + } + }, + { + "desc" : "Huawei Y3II", + "ua" : "Mozilla/5.0 (Linux; U; Android 5.1; xx-xx; HUAWEI LUA-L03 Build/HUAWEILUA-L03) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Huawei", + "model" : "LUA-L03", + "type" : "mobile" + } + }, { "desc" : "iPod", "ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", From 5ae468a3d30d9dd6f30d3d0d9913f421d4223e36 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 1 Jul 2017 20:28:03 +0700 Subject: [PATCH 091/170] uastring is optional when using extensions --- readme.md | 8 ++++---- src/ua-parser.js | 5 +++++ test/test.js | 15 +++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 88edca8..98c6e58 100644 --- a/readme.md +++ b/readme.md @@ -253,16 +253,16 @@ $('body').addClass('ua-browser-' + $.ua.browser.name + ' ua-devicetype-' + $.ua. ## Extending regex patterns -* `UAParser(uastring[, extensions])` +* `UAParser([uastring,] extensions)` Pass your own regexes to extend the limited matching rules. ```js // Example: -var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; var myOwnRegex = [[/(myownbrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]]; -var parser = new UAParser(uaString, { browser: myOwnRegex }); -console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} +var myParser = new UAParser({ browser: myOwnRegex }); +var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; +console.log(myParser.setUA(uaString).getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} ``` diff --git a/src/ua-parser.js b/src/ua-parser.js index c4ba8ad..2048a99 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -818,6 +818,11 @@ var UAParser = function (uastring, extensions) { + if (typeof uastring === 'object') { + extensions = uastring; + uastring = undefined; + } + if (!(this instanceof UAParser)) { return new UAParser(uastring, extensions).getResult(); } diff --git a/test/test.js b/test/test.js index 40a6e0d..2fd033e 100644 --- a/test/test.js +++ b/test/test.js @@ -68,10 +68,17 @@ for (var i in methods) { describe('Extending Regex', function () { var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; var myOwnBrowser = [[/(myownbrowser)\/((\d+)?[\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, UAParser.BROWSER.MAJOR]]; - var parser = new UAParser(uaString, {browser: myOwnBrowser}); - assert.equal(parser.getBrowser().name, 'MyOwnBrowser'); - assert.equal(parser.getBrowser().version, '1.3'); - assert.equal(parser.getBrowser().major, '1'); + + var parser1 = new UAParser(uaString, {browser: myOwnBrowser}); + assert.equal(parser1.getBrowser().name, 'MyOwnBrowser'); + assert.equal(parser1.getBrowser().version, '1.3'); + assert.equal(parser1.getBrowser().major, '1'); + + var parser2 = new UAParser({browser: myOwnBrowser}); + assert.equal(parser2.getBrowser().name, undefined); + parser2.setUA(uaString); + assert.equal(parser2.getBrowser().name, 'MyOwnBrowser'); + assert.equal(parser1.getBrowser().version, '1.3'); }); describe('Using Require.js', function () { From 7f217753f56ebca5fb3bfc7fec5f813d2541589c Mon Sep 17 00:00:00 2001 From: dianhe Date: Wed, 5 Jul 2017 19:55:19 +0800 Subject: [PATCH 092/170] + browser inside QQ support --- src/ua-parser.js | 5 ++++- test/browser-test.json | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 567517c..350425d 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -83,7 +83,7 @@ rgx : function (ua, arrays) { - //var result = {}, + //var result = {}, var i = 0, j, k, p, q, matches, match;//, args = arguments; /*// construct object barebones @@ -273,6 +273,9 @@ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ + /(QQ)\/([\d\.]+)/i // QQ, aka ShouQ + ], [NAME, VERSION], [ + /m?(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser ], [NAME, VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index da8623d..f3b8c3e 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -858,5 +858,25 @@ "version" : "1.1", "major" : "1" } + }, + { + "desc" : "QQ on iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Mobile/14A456 QQ/6.5.3.410 V1_IPH_SQ_6.5.3_1_APP_A Pixel/1080 Core/UIWebView NetType/WIFI Mem/26", + "expect" : + { + "name" : "QQ", + "version" : "6.5.3.410", + "major" : "6" + } + }, + { + "desc" : "QQ on Android", + "ua" : "Mozilla/5.0 (Linux; Android 6.0; PRO 6 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/37.0.0.0 Mobile MQQBrowser/6.8 TBS/036824 Safari/537.36 V1_AND_SQ_6.5.8_422_YYB_D PA QQ/6.5.8.2910 NetType/WIFI WebP/0.3.0 Pixel/1080", + "expect" : + { + "name" : "QQ", + "version" : "6.5.8.2910", + "major" : "6" + } } ] From b49cfae4e23867c1c978251c7d981a7de621a638 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Mon, 17 Jul 2017 22:53:16 +0700 Subject: [PATCH 093/170] Opening donation --- readme.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readme.md b/readme.md index 98c6e58..da7bc48 100644 --- a/readme.md +++ b/readme.md @@ -287,6 +287,13 @@ $ npm run build ``` +# Donate + +Do you use & like UAParser.js but you don’t find a way to show some love? If yes, please consider donating to support this project. Otherwise, no worries, regardless of whether there is support or not, I will keep maintaining this project. Still, if you buy me a cup of coffee I would be more than happy though :) + +[![Support via Pledgie](https://pledgie.com/campaigns/34252.png?skin_name=chrome)](https://pledgie.com/campaigns/34252) + + # License Dual licensed under GPLv2 & MIT From 806c2b80300f0524f8fd842c824feba773d269ae Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 19 Jul 2017 19:31:11 +0700 Subject: [PATCH 094/170] move jquery.json to package.json --- package.json | 12 ++++++++---- ua-parser-js.jquery.json | 32 -------------------------------- 2 files changed, 8 insertions(+), 36 deletions(-) delete mode 100644 ua-parser-js.jquery.json diff --git a/package.json b/package.json index 8e39ccd..fa6481e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "title": "UAParser.js", "name": "ua-parser-js", "version": "0.7.13", - "author": "Faisal Salman (http://faisalman.com)", + "author": "Faisal Salman (http://faisalman.com)", "description": "Lightweight JavaScript-based user-agent string parser", "keywords": [ "user-agent", @@ -11,7 +11,9 @@ "engine", "os", "device", - "cpu" + "cpu", + "jquery-plugin", + "ecosystem:jquery" ], "homepage": "http://github.com/faisalman/ua-parser-js", "contributors": [ @@ -84,7 +86,6 @@ }, "verup": { "files": [ - "ua-parser-js.jquery.json", "bower.json", "package.js", "src/ua-parser.js" @@ -113,5 +114,8 @@ "dist": "dist", "src": "src", "test": "test" - } + }, + "bugs": "https://github.com/faisalman/ua-parser-js/issues", + "demo": "https://faisalman.github.io/ua-parser-js", + "download": "https://raw.github.com/faisalman/ua-parser-js/master/dist/ua-parser.min.js" } diff --git a/ua-parser-js.jquery.json b/ua-parser-js.jquery.json deleted file mode 100644 index 0730ade..0000000 --- a/ua-parser-js.jquery.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "title": "UAParser.js", - "name": "ua-parser-js", - "version": "0.7.13", - "description": "Lightweight JavaScript-based user-agent string parser", - "keywords": [ - "user-agent", - "parser", - "browser", - "engine", - "os", - "device", - "cpu" - ], - "homepage": "https://faisalman.github.com/ua-parser-js", - "author": { - "name": "Faisal Salman", - "email": "fyzlman@gmail.com" - }, - "dependencies": { - "jquery": ">=1.5" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/mit-license.php" - } - ], - "bugs": "https://github.com/faisalman/ua-parser-js/issues", - "docs": "https://github.com/faisalman/ua-parser-js", - "download": "https://raw.github.com/faisalman/ua-parser-js/master/dist/ua-parser.min.js" -} From 7ae3098778572742544385938a2726c4efa01a02 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 19 Jul 2017 19:39:01 +0700 Subject: [PATCH 095/170] Fix #256 tag new release 0.7.14 --- 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 4d06114..9ef0a38 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.13", + "version": "0.7.14", "authors": [ "Faisal Salman " ], diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 1072894..f1de7bc 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /** - * UAParser.js v0.7.13 + * UAParser.js v0.7.14 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.13",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 & MIT */ -!function(i,s){"use strict";var e="0.7.13",o="",r="?",n="function",a="undefined",t="object",w="string",l="major",d="model",c="name",u="type",m="vendor",p="version",b="architecture",f="console",h="mobile",g="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===w?i.replace(/[^\d\.]/g,"").split(".")[0]:s},trim:function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},A={rgx:function(i,e){for(var o,r,a,w,l,d,c=0;c0?2==w.length?typeof w[1]==n?this[w[0]]=w[1].call(this,d):this[w[0]]=w[1]:3==w.length?typeof w[1]!==n||w[1].exec&&w[1].test?this[w[0]]=d?d.replace(w[1],w[2]):s:this[w[0]]=d?w[1].call(this,d,w[2]):s:4==w.length&&(this[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):s):this[w]=d?d:s;c+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n (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 a0c3965..5e9b11a 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /** - * UAParser.js v0.7.13 + * UAParser.js v0.7.14 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.13', + var LIBVERSION = '0.7.14', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', From 6f621f1ae2126f9b0c337a5e12ab0cc8258101d1 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 1 Aug 2017 14:28:03 +0700 Subject: [PATCH 096/170] New feature: CLI support --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- readme.md | 12 ++++++++++++ src/ua-parser.js | 27 +++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/ua-parser.js diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index f1de7bc..2b65726 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 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.14",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 & MIT */ -!function(i,s){"use strict";var e="0.7.14",o="",r="?",n="function",a="undefined",t="object",d="string",l="major",w="model",u="name",c="type",m="vendor",p="version",b="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===d?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,d,l,w,u=0;u0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n Date: Sun, 6 Aug 2017 08:27:02 +0700 Subject: [PATCH 097/170] Issue #258 0.7.15rc --- src/ua-parser.js | 29 +++++++++++++++++------------ test/test.js | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 5e9b11a..b847459 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -874,7 +874,7 @@ ///////////////// // Constructor //////////////// - + /* var Browser = function (name, version) { this[NAME] = name; this[VERSION] = version; @@ -889,7 +889,7 @@ }; var Engine = Browser; var OS = Browser; - + */ var UAParser = function (uastring, extensions) { if (typeof uastring === 'object') { @@ -903,30 +903,35 @@ 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(); + //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 }; mapper.rgx.call(browser, ua, rgxmap.browser); browser.major = util.major(browser.version); // deprecated return browser; }; this.getCPU = function () { + var cpu = { architecture: undefined }; mapper.rgx.call(cpu, ua, rgxmap.cpu); return cpu; }; this.getDevice = function () { + var device = { vendor: undefined, model: undefined, type: undefined }; mapper.rgx.call(device, ua, rgxmap.device); return device; }; this.getEngine = function () { + var engine = { name: undefined, version: undefined }; mapper.rgx.call(engine, ua, rgxmap.engine); return engine; }; this.getOS = function () { + var os = { name: undefined, version: undefined }; mapper.rgx.call(os, ua, rgxmap.os); return os; }; @@ -945,11 +950,11 @@ }; this.setUA = function (uastring) { ua = uastring; - browser = new Browser(); - cpu = new CPU(); - device = new Device(); - engine = new Engine(); - os = new OS(); + //browser = new Browser(); + //cpu = new CPU(); + //device = new Device(); + //engine = new Engine(); + //os = new OS(); return this; }; return this; diff --git a/test/test.js b/test/test.js index 2fd033e..99e53ff 100644 --- a/test/test.js +++ b/test/test.js @@ -65,6 +65,21 @@ for (var i in methods) { }); } +describe('Returns', function () { + it('getResult() should returns JSON', function(done) { + assert.deepEqual(new UAParser('').getResult(), + { + ua : '', + browser: { name: undefined, version: undefined, major: undefined }, + cpu: { architecture: undefined }, + device: { vendor: undefined, model: undefined, type: undefined }, + engine: { name: undefined, version: undefined}, + os: { name: undefined, version: undefined } + }); + done(); + }); +}); + describe('Extending Regex', function () { var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; var myOwnBrowser = [[/(myownbrowser)\/((\d+)?[\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, UAParser.BROWSER.MAJOR]]; From 2c28b3e97eae059add923f26f4c9361622ae89d3 Mon Sep 17 00:00:00 2001 From: Igor Topal Date: Fri, 8 Sep 2017 17:40:49 +0300 Subject: [PATCH 098/170] Add new Meizu device type (MZ) support, for correctly parsing --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- package.json | 1 + src/ua-parser.js | 4 ++-- test/device-test.json | 10 ++++++++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index f1de7bc..83fcfb4 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 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.14",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 & MIT */ -!function(i,s){"use strict";var e="0.7.14",o="",r="?",n="function",a="undefined",t="object",d="string",l="major",w="model",u="name",c="type",m="vendor",p="version",b="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===d?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,d,l,w,u=0;u0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n", "Shane Gautreau ", "Shane Thacker ", + "shchotse ", "Simon Eisenmann ", "Simon Lang ", "Sylvain Gizard ", diff --git a/src/ua-parser.js b/src/ua-parser.js index 5e9b11a..e8077aa 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -520,8 +520,8 @@ ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ /(blackberry)[\s-]?(\w+)/i, // BlackBerry - /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, - // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron + /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|mz|motorola|polytron)[\s_-]?([\w-]+)*/i, + // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/MZ (Meizu)/Motorola/Polytron /(hp)\s([\w\s]+\w)/i, // HP iPAQ /(asus)-?(\w+)/i // Asus ], [VENDOR, MODEL, [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index 0660303..1994350 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -129,6 +129,16 @@ "type" : "tablet" } }, + { + "desc" : "Meizu M3S", + "ua" : "Mozilla/5.0 (X11; Linux; Android 5.1; MZ-M3s Build/LMY47I) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrom/45.0.2454.94 Mobile Safari/537.36", + "expect" : + { + "vendor" : "MZ", + "model" : "M3s", + "type" : "mobile" + } + }, { "desc" : "Microsoft Lumia 950", "ua" : "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586", From 74ec93ffb6973d792cc79f2f6db8f5ed454df1ca Mon Sep 17 00:00:00 2001 From: Arun Rama Reddy Date: Sat, 16 Sep 2017 10:48:27 +0530 Subject: [PATCH 099/170] feat: Added Redmi phone and Mi Pad tablet detection support --- src/ua-parser.js | 8 +- test/device-test.json | 1286 +++++++++++++++++++---------------------- 2 files changed, 594 insertions(+), 700 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 5e9b11a..9d19dc6 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -138,7 +138,7 @@ } i += 2; } - //console.log(this); + // console.log(this); //return this; }, @@ -649,9 +649,11 @@ /android.+(\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+build/i // Xiaomi Mi + /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\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 + ],[[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, TABLET]], [ /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ diff --git a/test/device-test.json b/test/device-test.json index 0660303..c1a3075 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1,927 +1,819 @@ -[ - { - "desc" : "Asus Nexus 7", - "ua" : "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", - "expect" : - { - "vendor" : "Asus", - "model" : "Nexus 7", - "type" : "tablet" +[{ + "desc": "Asus Nexus 7", + "ua": "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", + "expect": { + "vendor": "Asus", + "model": "Nexus 7", + "type": "tablet" } }, { - "desc" : "Asus Padfone", - "ua" : "Mozilla/5.0 (Linux; Android 4.1.1; PadFone 2 Build/JRO03L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.117 Safari/537.36", - "expect" : - { - "vendor" : "Asus", - "model" : "PadFone", - "type" : "tablet" + "desc": "Asus Padfone", + "ua": "Mozilla/5.0 (Linux; Android 4.1.1; PadFone 2 Build/JRO03L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.117 Safari/537.36", + "expect": { + "vendor": "Asus", + "model": "PadFone", + "type": "tablet" } }, { - "desc" : "Desktop (IE11 with Tablet string)", - "ua" : "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", - "expect" : - { - "vendor" : "undefined", - "model" : "undefined", - "type" : "undefined" + "desc": "Desktop (IE11 with Tablet string)", + "ua": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", + "expect": { + "vendor": "undefined", + "model": "undefined", + "type": "undefined" } }, { - "desc" : "HTC Evo Shift 4G", - "ua" : "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0", - "expect" : - { - "vendor" : "HTC", - "model" : "Evo Shift 4G", - "type" : "mobile" + "desc": "HTC Evo Shift 4G", + "ua": "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0", + "expect": { + "vendor": "HTC", + "model": "Evo Shift 4G", + "type": "mobile" } }, { - "desc" : "HTC Nexus 9", - "ua" : "Mozilla/5.0 (Linux; Android 5.0; Nexus 9 Build/LRX21R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Mobile Crosswalk/7.36.154.13 Safari/537.36", - "expect" : - { - "vendor" : "HTC", - "model" : "Nexus 9", - "type" : "tablet" + "desc": "HTC Nexus 9", + "ua": "Mozilla/5.0 (Linux; Android 5.0; Nexus 9 Build/LRX21R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Mobile Crosswalk/7.36.154.13 Safari/537.36", + "expect": { + "vendor": "HTC", + "model": "Nexus 9", + "type": "tablet" } }, { - "desc" : "Huawei Honor", - "ua" : "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; U8860 Build/HuaweiU8860) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", - "expect" : - { - "vendor" : "Huawei", - "model" : "U8860", - "type" : "mobile" + "desc": "Huawei Honor", + "ua": "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; U8860 Build/HuaweiU8860) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", + "expect": { + "vendor": "Huawei", + "model": "U8860", + "type": "mobile" } }, { - "desc" : "Huawei Nexus 6P", - "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MTC19V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537", - "expect" : - { - "vendor" : "Huawei", - "model" : "Nexus 6P", - "type" : "mobile" + "desc": "Huawei Nexus 6P", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MTC19V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537", + "expect": { + "vendor": "Huawei", + "model": "Nexus 6P", + "type": "mobile" } }, { - "desc" : "Huawei P10", - "ua" : "Mozilla/5.0 (Linux; Android 7.0; VTR-L09 Build/HUAWEIVTR-L09; xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Huawei", - "model" : "VTR-L09", - "type" : "mobile" + "desc": "Huawei P10", + "ua": "Mozilla/5.0 (Linux; Android 7.0; VTR-L09 Build/HUAWEIVTR-L09; xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "VTR-L09", + "type": "mobile" } }, { - "desc" : "Huawei Y3II", - "ua" : "Mozilla/5.0 (Linux; U; Android 5.1; xx-xx; HUAWEI LUA-L03 Build/HUAWEILUA-L03) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Huawei", - "model" : "LUA-L03", - "type" : "mobile" + "desc": "Huawei Y3II", + "ua": "Mozilla/5.0 (Linux; U; Android 5.1; xx-xx; HUAWEI LUA-L03 Build/HUAWEILUA-L03) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36", + "expect": { + "vendor": "Huawei", + "model": "LUA-L03", + "type": "mobile" } }, { - "desc" : "iPod", - "ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", - "expect" : - { - "vendor" : "Apple", - "model" : "iPod touch", - "type" : "mobile" + "desc": "iPod", + "ua": "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", + "expect": { + "vendor": "Apple", + "model": "iPod touch", + "type": "mobile" } }, { - "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", - "expect" : - { - "vendor" : "LG", - "model" : "Nexus 4", - "type" : "mobile" + "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", + "expect": { + "vendor": "LG", + "model": "Nexus 4", + "type": "mobile" } }, { - "desc" : "LG Nexus 5", - "ua" : "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", - "expect" : - { - "vendor" : "LG", - "model" : "Nexus 5", - "type" : "mobile" + "desc": "LG Nexus 5", + "ua": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", + "expect": { + "vendor": "LG", + "model": "Nexus 5", + "type": "mobile" } }, { - "desc" : "Meizu M5 Note", - "ua" : "Mozilla/5.0 (Linux; Android 6.0; M5 Note Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043024 Safari/537.36 MicroMessenger/6.5.7.1040 NetType/WIFI Language/zh_CN", - "expect" : - { - "vendor" : "Meizu", - "model" : "M5 Note", - "type" : "tablet" + "desc": "Meizu M5 Note", + "ua": "Mozilla/5.0 (Linux; Android 6.0; M5 Note Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043024 Safari/537.36 MicroMessenger/6.5.7.1040 NetType/WIFI Language/zh_CN", + "expect": { + "vendor": "Meizu", + "model": "M5 Note", + "type": "tablet" } }, { - "desc" : "Microsoft Lumia 950", - "ua" : "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586", - "expect" : - { - "vendor" : "Microsoft", - "model" : "Lumia 950", - "type" : "mobile" + "desc": "Microsoft Lumia 950", + "ua": "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586", + "expect": { + "vendor": "Microsoft", + "model": "Lumia 950", + "type": "mobile" } }, { - "desc" : "Motorola Moto X", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.4; XT1097 Build/KXE21.187-38) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Motorola", - "model" : "XT1097", - "type" : "mobile" + "desc": "Motorola Moto X", + "ua": "Mozilla/5.0 (Linux; Android 4.4.4; XT1097 Build/KXE21.187-38) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.109 Mobile Safari/537.36", + "expect": { + "vendor": "Motorola", + "model": "XT1097", + "type": "mobile" } }, { - "desc" : "Motorola Nexus 6", - "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Motorola", - "model" : "Nexus 6", - "type" : "mobile" + "desc": "Motorola Nexus 6", + "ua": "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36", + "expect": { + "vendor": "Motorola", + "model": "Nexus 6", + "type": "mobile" } }, { - "desc" : "Motorola Droid RAZR 4G", - "ua" : "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; DROID RAZR 4G Build/6.5.1-73_DHD-11_M1-29) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", - "expect" : - { - "vendor" : "Motorola", - "model" : "DROID RAZR 4G", - "type" : "mobile" + "desc": "Motorola Droid RAZR 4G", + "ua": "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; DROID RAZR 4G Build/6.5.1-73_DHD-11_M1-29) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", + "expect": { + "vendor": "Motorola", + "model": "DROID RAZR 4G", + "type": "mobile" } }, { - "desc" : "iPhone", - "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53", - "expect" : - { - "vendor" : "Apple", - "model" : "iPhone", - "type" : "mobile" + "desc": "iPhone", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53", + "expect": { + "vendor": "Apple", + "model": "iPhone", + "type": "mobile" } }, { - "desc" : "Motorola Droid RAZR 4G", - "ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53", - "expect" : - { - "vendor" : "Apple", - "model" : "iPod touch", - "type" : "mobile" + "desc": "Motorola Droid RAZR 4G", + "ua": "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53", + "expect": { + "vendor": "Apple", + "model": "iPod touch", + "type": "mobile" } }, { - "desc" : "Moto X", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.2; xx-xx; XT1058 Build/13.9.0Q2.X-70-GHOST-ATT_LE-2) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", - "expect" : - { - "vendor" : "Motorola", - "model" : "XT1058", - "type" : "mobile" + "desc": "Moto X", + "ua": "Mozilla/5.0 (Linux; U; Android 4.2; xx-xx; XT1058 Build/13.9.0Q2.X-70-GHOST-ATT_LE-2) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect": { + "vendor": "Motorola", + "model": "XT1058", + "type": "mobile" } }, { - "desc" : "Nokia3xx", - "ua" : "Nokia303/14.87 CLDC-1.1", - "expect" : - { - "vendor" : "Nokia", - "model" : "303", - "type" : "mobile" + "desc": "Nokia3xx", + "ua": "Nokia303/14.87 CLDC-1.1", + "expect": { + "vendor": "Nokia", + "model": "303", + "type": "mobile" } }, { - "desc" : "OnePlus One", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.4; A0001 Build/KTU84Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Mobile Safari/537.36", - "expect" : - { - "vendor" : "OnePlus", - "model" : "1", - "type" : "mobile" + "desc": "OnePlus One", + "ua": "Mozilla/5.0 (Linux; Android 4.4.4; A0001 Build/KTU84Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Mobile Safari/537.36", + "expect": { + "vendor": "OnePlus", + "model": "1", + "type": "mobile" } }, { - "desc" : "OPPO R7s", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; OPPO R7s Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.1 Mobile Safari/537.36", - "expect" : - { - "vendor" : "OPPO", - "model" : "R7s", - "type" : "mobile" + "desc": "OPPO R7s", + "ua": "Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; OPPO R7s Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.1 Mobile Safari/537.36", + "expect": { + "vendor": "OPPO", + "model": "R7s", + "type": "mobile" } }, { - "desc" : "Philips SmartTV", - "ua" : "Opera/9.80 HbbTV/1.1.1 (; Philips; ; ; ; ) NETTV/4.0.2; en) Version/11.60", - "expect" : - { - "vendor" : "Philips", - "model" : "", - "type" : "smarttv" + "desc": "Philips SmartTV", + "ua": "Opera/9.80 HbbTV/1.1.1 (; Philips; ; ; ; ) NETTV/4.0.2; en) Version/11.60", + "expect": { + "vendor": "Philips", + "model": "", + "type": "smarttv" } }, { - "desc" : "Kindle Fire HD", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true", - "expect" : - { - "vendor" : "Amazon", - "model" : "KFTT", - "type" : "tablet" + "desc": "Kindle Fire HD", + "ua": "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true", + "expect": { + "vendor": "Amazon", + "model": "KFTT", + "type": "tablet" } }, { - "desc" : "Samsung Galaxy Note 8", - "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; GT-N5100 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "GT-N5100", - "type" : "tablet" + "desc": "Samsung Galaxy Note 8", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; GT-N5100 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "GT-N5100", + "type": "tablet" } }, { - "desc" : "Samsung SM-C5000", - "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; SM-C5000 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.81 Mobile Safari/537.36 wkbrowser 4.1.35 3065", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-C5000", - "type" : "mobile" + "desc": "Samsung SM-C5000", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; SM-C5000 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.81 Mobile Safari/537.36 wkbrowser 4.1.35 3065", + "expect": { + "vendor": "Samsung", + "model": "SM-C5000", + "type": "mobile" } }, { - "desc" : "Samsung SM-T231", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T231 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-T231", - "type" : "tablet" + "desc": "Samsung SM-T231", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; SM-T231 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-T231", + "type": "tablet" } }, { - "desc" : "Samsung SM-T700", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T700 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-T700", - "type" : "tablet" + "desc": "Samsung SM-T700", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; SM-T700 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-T700", + "type": "tablet" } }, { - "desc" : "Samsung SM-T520", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-T520", - "type" : "tablet" + "desc": "Samsung SM-T520", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-T520", + "type": "tablet" } }, { - "desc" : "Samsung SmartTV2011", - "ua" : "HbbTV/1.1.1 (;;;;;) Maple;2011", - "expect" : - { - "vendor" : "Samsung", - "model" : "SmartTV2011", - "type" : "smarttv" + "desc": "Samsung SmartTV2011", + "ua": "HbbTV/1.1.1 (;;;;;) Maple;2011", + "expect": { + "vendor": "Samsung", + "model": "SmartTV2011", + "type": "smarttv" } }, { - "desc" : "Samsung SmartTV2012", - "ua" : "HbbTV/1.1.1 (;Samsung;SmartTV2012;;;) WebKit", - "expect" : - { - "vendor" : "Samsung", - "model" : "SmartTV2012", - "type" : "smarttv" + "desc": "Samsung SmartTV2012", + "ua": "HbbTV/1.1.1 (;Samsung;SmartTV2012;;;) WebKit", + "expect": { + "vendor": "Samsung", + "model": "SmartTV2012", + "type": "smarttv" } }, { - "desc" : "Samsung SmartTV2014", - "ua" : "HbbTV/1.1.1 (;Samsung;SmartTV2014;T-NT14UDEUC-1060.4;;) WebKit", - "expect" : - { - "vendor" : "Samsung", - "model" : "SmartTV2014", - "type" : "smarttv" + "desc": "Samsung SmartTV2014", + "ua": "HbbTV/1.1.1 (;Samsung;SmartTV2014;T-NT14UDEUC-1060.4;;) WebKit", + "expect": { + "vendor": "Samsung", + "model": "SmartTV2014", + "type": "smarttv" } }, { - "desc" : "Samsung SmartTV", - "ua" : "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1", - "expect" : - { - "vendor" : "Samsung", - "model" : "undefined", - "type" : "smarttv" + "desc": "Samsung SmartTV", + "ua": "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1", + "expect": { + "vendor": "Samsung", + "model": "undefined", + "type": "smarttv" } }, { - "desc" : "Sony C5303 (Xperia SP)", - "ua" : "Mozilla/5.0 (Linux; Android 4.3; C5303 Build/12.1.A.1.205) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Sony", - "model" : "C5303", - "type" : "mobile" + "desc": "Sony C5303 (Xperia SP)", + "ua": "Mozilla/5.0 (Linux; Android 4.3; C5303 Build/12.1.A.1.205) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "C5303", + "type": "mobile" } }, { - "desc" : "Sony SO-02F (Xperia Z1 F)", - "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; SO-02F Build/14.1.H.2.119) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Sony", - "model" : "SO-02F", - "type" : "mobile" + "desc": "Sony SO-02F (Xperia Z1 F)", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; SO-02F Build/14.1.H.2.119) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "SO-02F", + "type": "mobile" } }, { - "desc" : "Sony D6653 (Xperia Z3)", - "ua" : "Mozilla/5.0 (Linux; Android 4.4; D6653 Build/23.0.A.0.376) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Sony", - "model" : "D6653", - "type" : "mobile" + "desc": "Sony D6653 (Xperia Z3)", + "ua": "Mozilla/5.0 (Linux; Android 4.4; D6653 Build/23.0.A.0.376) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Mobile Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "D6653", + "type": "mobile" } }, { - "desc" : "Sony Xperia SOL25 (ZL2)", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.4; SOL25 Build/17.1.1.C.1.64) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", - "expect" : - { - "vendor" : "Sony", - "model" : "SOL25", - "type" : "mobile" + "desc": "Sony Xperia SOL25 (ZL2)", + "ua": "Mozilla/5.0 (Linux; U; Android 4.4; SOL25 Build/17.1.1.C.1.64) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect": { + "vendor": "Sony", + "model": "SOL25", + "type": "mobile" } }, { - "desc" : "Sony Xperia SP", - "ua" : "Mozilla/5.0 (Linux; Android 4.3; C5302 Build/12.1.A.1.201) AppleWebkit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Sony", - "model" : "C5302", - "type" : "mobile" + "desc": "Sony Xperia SP", + "ua": "Mozilla/5.0 (Linux; Android 4.3; C5302 Build/12.1.A.1.201) AppleWebkit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "C5302", + "type": "mobile" } }, { - "desc" : "Sony SGP521 (Xperia Z2 Tablet)", - "ua" : "Mozilla/5.0 (Linux; Android 4.4; SGP521 Build/17.1.A.0.432) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Safari/537.36", - "expect" : - { - "vendor" : "Sony", - "model" : "Xperia Tablet", - "type" : "tablet" + "desc": "Sony SGP521 (Xperia Z2 Tablet)", + "ua": "Mozilla/5.0 (Linux; Android 4.4; SGP521 Build/17.1.A.0.432) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "Xperia Tablet", + "type": "tablet" } }, { - "desc" : "Sony Tablet S", - "ua" : "Mozilla/5.0 (Linux; U; Android 3.1; Sony Tablet S Build/THMAS10000) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13", - "expect" : - { - "vendor" : "Sony", - "model" : "Xperia Tablet", - "type" : "tablet" + "desc": "Sony Tablet S", + "ua": "Mozilla/5.0 (Linux; U; Android 3.1; Sony Tablet S Build/THMAS10000) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13", + "expect": { + "vendor": "Sony", + "model": "Xperia Tablet", + "type": "tablet" } }, { - "desc" : "Sony Tablet Z LTE", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.1; SonySGP321 Build/10.2.C.0.143) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", - "expect" : - { - "vendor" : "Sony", - "model" : "Xperia Tablet", - "type" : "tablet" + "desc": "Sony Tablet Z LTE", + "ua": "Mozilla/5.0 (Linux; U; Android 4.1; SonySGP321 Build/10.2.C.0.143) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", + "expect": { + "vendor": "Sony", + "model": "Xperia Tablet", + "type": "tablet" } }, { - "desc" : "Xiaomi 2013023", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.2.2; en-US; 2013023 Build/HM2013023) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/10.0.1.512 U3/0.8.0 Mobile Safari/533.1", - "expect" : - { - "vendor" : "Xiaomi", - "model" : "2013023", - "type" : "mobile" + "desc": "Xiaomi 2013023", + "ua": "Mozilla/5.0 (Linux; U; Android 4.2.2; en-US; 2013023 Build/HM2013023) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/10.0.1.512 U3/0.8.0 Mobile Safari/533.1", + "expect": { + "vendor": "Xiaomi", + "model": "2013023", + "type": "mobile" } }, { - "desc" : "Xiaomi Hongmi Note 1W", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.2.2; zh-CN; HM NOTE 1W Build/JDQ39) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/9.7.9.439 U3/0.8.0 Mobile Safari/533.1", - "expect" : - { - "vendor" : "Xiaomi", - "model" : "HM NOTE 1W", - "type" : "mobile" + "desc": "Xiaomi Hongmi Note 1W", + "ua": "Mozilla/5.0 (Linux; U; Android 4.2.2; zh-CN; HM NOTE 1W Build/JDQ39) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/9.7.9.439 U3/0.8.0 Mobile Safari/533.1", + "expect": { + "vendor": "Xiaomi", + "model": "HM NOTE 1W", + "type": "mobile" } }, { - "desc" : "Xiaomi Mi 3C", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.3; zh-CN; MI 3C Build/JLS36C) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/9.7.9.439 U3/0.8.0 Mobile Safari/533.1", - "expect" : - { - "vendor" : "Xiaomi", - "model" : "MI 3C", - "type" : "mobile" + "desc": "Xiaomi Mi 3C", + "ua": "Mozilla/5.0 (Linux; U; Android 4.3; zh-CN; MI 3C Build/JLS36C) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/9.7.9.439 U3/0.8.0 Mobile Safari/533.1", + "expect": { + "vendor": "Xiaomi", + "model": "MI 3C", + "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", - "expect" : - { - "vendor" : "Xiaomi", - "model" : "MI NOTE LTE", - "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", + "expect": { + "vendor": "Xiaomi", + "model": "MI NOTE LTE", + "type": "mobile" } }, { - "desc" : "Xiaomi Mi One Plus", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; MI-ONE Plus Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", - "expect" : - { - "vendor" : "Xiaomi", - "model" : "MI-ONE Plus", - "type" : "mobile" + "desc": "Xiaomi Mi One Plus", + "ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; MI-ONE Plus Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect": { + "vendor": "Xiaomi", + "model": "MI-ONE Plus", + "type": "mobile" } }, { - "desc" : "PlayStation 4", - "ua" : "Mozilla/5.0 (PlayStation 4 3.00) AppleWebKit/537.73 (KHTML, like Gecko)", - "expect" : - { - "vendor" : "Sony", - "model" : "PlayStation 4", - "type" : "console" + "desc": "PlayStation 4", + "ua": "Mozilla/5.0 (PlayStation 4 3.00) AppleWebKit/537.73 (KHTML, like Gecko)", + "expect": { + "vendor": "Sony", + "model": "PlayStation 4", + "type": "console" } }, { - "desc" : "Galaxy Nexus", - "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19", - "expect" : - { - "vendor" : "Samsung", - "model" : "Galaxy Nexus", - "type" : "mobile" + "desc": "Galaxy Nexus", + "ua": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19", + "expect": { + "vendor": "Samsung", + "model": "Galaxy Nexus", + "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", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-G900F", - "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", + "expect": { + "vendor": "Samsung", + "model": "SM-G900F", + "type": "mobile" } }, { - "desc" : "Samsung Galaxy S6", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-G920I Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-G920I", - "type" : "mobile" + "desc": "Samsung Galaxy S6", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; SM-G920I Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-G920I", + "type": "mobile" } }, { - "desc" : "Samsung Galaxy S6 Edge", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-G925I Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-G925I", - "type" : "mobile" + "desc": "Samsung Galaxy S6 Edge", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; SM-G925I Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-G925I", + "type": "mobile" } }, { - "desc" : "Samsung Galaxy Note 5 Chrome", - "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; SM-N920C Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.91 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-N920C", - "type" : "mobile" + "desc": "Samsung Galaxy Note 5 Chrome", + "ua": "Mozilla/5.0 (Linux; Android 5.1.1; SM-N920C Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.91 Mobile Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-N920C", + "type": "mobile" } - } -, + }, { - "desc" : "Samsung Galaxy Note 5 Samsung Browser", - "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-N920C Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Samsung", - "model" : "SM-N920C", - "type" : "mobile" + "desc": "Samsung Galaxy Note 5 Samsung Browser", + "ua": "Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-N920C Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36", + "expect": { + "vendor": "Samsung", + "model": "SM-N920C", + "type": "mobile" } - } -, + }, { - "desc" : "Google Chromecast", - "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" + "desc": "Google Chromecast", + "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" } - } -, + }, { - "desc" : "Google Pixel C", - "ua" : "Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36", - "expect" : - { - "vendor" : "Google", - "model" : "Pixel C", - "type" : "tablet" + "desc": "Google Pixel C", + "ua": "Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel C", + "type": "tablet" } - } -, + }, { - "desc" : "Google Pixel", - "ua" : "Mozilla/5.0 (Linux; Android 7.1; Pixel Build/NDE63V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Google", - "model" : "Pixel", - "type" : "mobile" + "desc": "Google Pixel", + "ua": "Mozilla/5.0 (Linux; Android 7.1; Pixel Build/NDE63V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel", + "type": "mobile" } - } -, + }, { - "desc" : "Google Pixel", - "ua" : "Mozilla/5.0 (Linux; Android 7.1; Pixel XL Build/NDE63X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Google", - "model" : "Pixel XL", - "type" : "mobile" + "desc": "Google Pixel", + "ua": "Mozilla/5.0 (Linux; Android 7.1; Pixel XL Build/NDE63X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 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", - "expect" : - { - "vendor" : "Generic", - "model" : "Android 6.0.1" + "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", + "expect": { + "vendor": "Generic", + "model": "Android 6.0.1" } - } -, + }, { - "desc" : "LG VK Series Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 5.0.2; VK700 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.84 Safari/537.36", - "expect" : - { - "vendor" : "LG", - "model" : "VK700", - "type" : "tablet" + "desc": "LG VK Series Tablet", + "ua": "Mozilla/5.0 (Linux; Android 5.0.2; VK700 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.84 Safari/537.36", + "expect": { + "vendor": "LG", + "model": "VK700", + "type": "tablet" } - } -, + }, { - "desc" : "LG LK Series Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 5.0.1; LGLK430 Build/LRX21Y) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/38.0.2125.102 Safari/537.36", - "expect" : - { - "vendor" : "LG", - "model" : "LK430", - "type" : "tablet" + "desc": "LG LK Series Tablet", + "ua": "Mozilla/5.0 (Linux; Android 5.0.1; LGLK430 Build/LRX21Y) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/38.0.2125.102 Safari/537.36", + "expect": { + "vendor": "LG", + "model": "LK430", + "type": "tablet" } - } -, + }, { - "desc" : "RCA Voyager III Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; RCT6973W43 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "RCA", - "model" : "RCT6973W43", - "type" : "tablet" + "desc": "RCA Voyager III Tablet", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; RCT6973W43 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "RCA", + "model": "RCT6973W43", + "type": "tablet" } - } -, + }, { - "desc" : "RCA Voyager II Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 5.0; RCT6773W22B Build/LRX21M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "RCA", - "model" : "RCT6773W22B", - "type" : "tablet" + "desc": "RCA Voyager II Tablet", + "ua": "Mozilla/5.0 (Linux; Android 5.0; RCT6773W22B Build/LRX21M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "RCA", + "model": "RCT6773W22B", + "type": "tablet" } - } -, + }, { - "desc" : "Verizon Quanta Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; QMV7B Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Verizon", - "model" : "QMV7B", - "type" : "tablet" + "desc": "Verizon Quanta Tablet", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; QMV7B Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Verizon", + "model": "QMV7B", + "type": "tablet" } - } -, + }, { - "desc" : "Verizon Ellipsis 8 Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; QTAQZ3 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Verizon", - "model" : "QTAQZ3", - "type" : "tablet" + "desc": "Verizon Ellipsis 8 Tablet", + "ua": "Mozilla/5.0 (Linux; Android 5.1.1; QTAQZ3 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Verizon", + "model": "QTAQZ3", + "type": "tablet" } - } -, + }, { - "desc" : "Verizon Ellipsis 8HD Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; QTASUN1 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Safari/537.36", - "expect" : - { - "vendor" : "Verizon", - "model" : "QTASUN1", - "type" : "tablet" + "desc": "Verizon Ellipsis 8HD Tablet", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; QTASUN1 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Safari/537.36", + "expect": { + "vendor": "Verizon", + "model": "QTASUN1", + "type": "tablet" } - } -, + }, { - "desc" : "Dell Venue 8 Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; Venue 8 3830 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Dell", - "model" : "Venue 8 3830", - "type" : "tablet" + "desc": "Dell Venue 8 Tablet", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; Venue 8 3830 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Dell", + "model": "Venue 8 3830", + "type": "tablet" } - } -, + }, { - "desc" : "Dell Venue 7 Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; Venue 7 3730 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Dell", - "model" : "Venue 7 3730", - "type" : "tablet" + "desc": "Dell Venue 7 Tablet", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; Venue 7 3730 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Dell", + "model": "Venue 7 3730", + "type": "tablet" } - } -, + }, { - "desc" : "Barnes & Noble Nook HD+ Tablet", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Barnes & Noble Nook HD+ Build/JZO54K; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", - "expect" : - { - "vendor" : "Barnes & Noble", - "model" : "Nook HD+", - "type" : "tablet" + "desc": "Barnes & Noble Nook HD+ Tablet", + "ua": "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Barnes & Noble Nook HD+ Build/JZO54K; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect": { + "vendor": "Barnes & Noble", + "model": "Nook HD+", + "type": "tablet" } - } -, + }, { - "desc" : "Barnes & Noble V400 Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36", - "expect" : - { - "vendor" : "Barnes & Noble", - "model" : "V400", - "type" : "tablet" + "desc": "Barnes & Noble V400 Tablet", + "ua": "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36", + "expect": { + "vendor": "Barnes & Noble", + "model": "V400", + "type": "tablet" } - } -, + }, { - "desc" : "NuVision TM101A540N Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 5.1; TM101A540N Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/50.0.2661.86 Safari/537.36", - "expect" : - { - "vendor" : "NuVision", - "model" : "TM101A540N", - "type" : "tablet" + "desc": "NuVision TM101A540N Tablet", + "ua": "Mozilla/5.0 (Linux; Android 5.1; TM101A540N Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/50.0.2661.86 Safari/537.36", + "expect": { + "vendor": "NuVision", + "model": "TM101A540N", + "type": "tablet" } - } -, + }, { - "desc" : "ZTE K Series Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; K88 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "ZTE", - "model" : "K88", - "type" : "tablet" + "desc": "ZTE K Series Tablet", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; K88 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "ZTE", + "model": "K88", + "type": "tablet" } - } -, + }, { - "desc" : "Swizz GEN610", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; GEN610 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Swiss", - "model" : "GEN610", - "type" : "mobile" + "desc": "Swizz GEN610", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; GEN610 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", + "expect": { + "vendor": "Swiss", + "model": "GEN610", + "type": "mobile" } - } -, + }, { - "desc" : "Swizz ZUR700", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; ZUR700 Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Safari/537.36", - "expect" : - { - "vendor" : "Swiss", - "model" : "ZUR700", - "type" : "tablet" + "desc": "Swizz ZUR700", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; ZUR700 Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Safari/537.36", + "expect": { + "vendor": "Swiss", + "model": "ZUR700", + "type": "tablet" } - } -, + }, { - "desc" : "Zeki TB782b Tablet", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; en-US; TB782B Build/IMM76D) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.0.2.299 U3/0.8.0 Mobile Safari/534.31", - "expect" : - { - "vendor" : "Zeki", - "model" : "TB782B", - "type" : "tablet" + "desc": "Zeki TB782b Tablet", + "ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-US; TB782B Build/IMM76D) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.0.2.299 U3/0.8.0 Mobile Safari/534.31", + "expect": { + "vendor": "Zeki", + "model": "TB782B", + "type": "tablet" } - } -, + }, { - "desc" : "Dragon Touch Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36", - "expect" : - { - "vendor" : "Dragon Touch", - "model" : "9138B", - "type" : "tablet" - } - } -, - { - "desc" : "Insignia Tablet", - "ua" : "Mozilla/5.0 (Linux; U; Android 6.0.1; NS-P08A7100 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Insignia", - "model" : "NS-P08A7100", - "type" : "tablet" + "desc": "Dragon Touch Tablet", + "ua": "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36", + "expect": { + "vendor": "Dragon Touch", + "model": "9138B", + "type": "tablet" } - } -, + }, { - "desc" : "Voice Xtreme V75", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; V75 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", - "expect" : - { - "vendor" : "Voice", - "model" : "V75", - "type" : "mobile" + "desc": "Insignia Tablet", + "ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; NS-P08A7100 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Insignia", + "model": "NS-P08A7100", + "type": "tablet" } - } -, + }, { - "desc" : "LvTel V11", - "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; V11 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36", - "expect" : - { - "vendor" : "LvTel", - "model" : "V11", - "type" : "mobile" + "desc": "Voice Xtreme V75", + "ua": "Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; V75 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", + "expect": { + "vendor": "Voice", + "model": "V75", + "type": "mobile" } - } -, + }, { - "desc" : "Envizen Tablet V100MD", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; V100MD Build/V100MD.20130816) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", - "expect" : - { - "vendor" : "Envizen", - "model" : "V100MD", - "type" : "tablet" + "desc": "LvTel V11", + "ua": "Mozilla/5.0 (Linux; Android 5.1.1; V11 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36", + "expect": { + "vendor": "LvTel", + "model": "V11", + "type": "mobile" } - } -, + }, { - "desc" : "Rotor Tablet", - "ua" : "mozilla/5.0 (linux; android 5.0.1; tu_1491 build/lrx22c) applewebkit/537.36 (khtml, like gecko) chrome/43.0.2357.93 safari/537.36", - "expect" : - { - "vendor" : "Rotor", - "model" : "1491", - "type" : "tablet" + "desc": "Envizen Tablet V100MD", + "ua": "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; V100MD Build/V100MD.20130816) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", + "expect": { + "vendor": "Envizen", + "model": "V100MD", + "type": "tablet" } - } -, + }, { - "desc" : "MachSpeed Tablets", - "ua" : "Mozilla/5.0 (Linux; Android 4.4.2; Trio 7.85 vQ Build/Trio_7.85_vQ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36", - "expect" : - { - "vendor" : "MachSpeed", - "model" : "Trio 7.85 vQ", - "type" : "tablet" + "desc": "Rotor Tablet", + "ua": "mozilla/5.0 (linux; android 5.0.1; tu_1491 build/lrx22c) applewebkit/537.36 (khtml, like gecko) chrome/43.0.2357.93 safari/537.36", + "expect": { + "vendor": "Rotor", + "model": "1491", + "type": "tablet" } - } -, + }, { - "desc" : "Trinity Tablets", - "ua" : "Mozilla/5.0 (Linux; Android 5.0.1; Trinity T101 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36", - "expect" : - { - "vendor" : "Trinity", - "model" : "T101", - "type" : "tablet" + "desc": "MachSpeed Tablets", + "ua": "Mozilla/5.0 (Linux; Android 4.4.2; Trio 7.85 vQ Build/Trio_7.85_vQ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36", + "expect": { + "vendor": "MachSpeed", + "model": "Trio 7.85 vQ", + "type": "tablet" } - } -, + }, { - "desc" : "NextBook Next7", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Next7P12 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", - "expect" : - { - "vendor" : "NextBook", - "model" : "Next7P12", - "type" : "tablet" + "desc": "Trinity Tablets", + "ua": "Mozilla/5.0 (Linux; Android 5.0.1; Trinity T101 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36", + "expect": { + "vendor": "Trinity", + "model": "T101", + "type": "tablet" } - } -, + }, { - "desc" : "NextBook Tablets", - "ua" : "Mozilla/5.0 (Linux; Android 5.0; NXA8QC116 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "NextBook", - "model" : "NXA8QC116", - "type" : "tablet" + "desc": "NextBook Next7", + "ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Next7P12 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", + "expect": { + "vendor": "NextBook", + "model": "Next7P12", + "type": "tablet" } - } -, + }, { - "desc" : "Le Pan Tablets", - "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Le Pan", - "model" : "TC802A", - "type" : "tablet" + "desc": "NextBook Tablets", + "ua": "Mozilla/5.0 (Linux; Android 5.0; NXA8QC116 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "NextBook", + "model": "NXA8QC116", + "type": "tablet" } - } -, + }, { - "desc" : "Le Pan Tablets", - "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Le Pan", - "model" : "TC802A", - "type" : "tablet" + "desc": "Le Pan Tablets", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Le Pan", + "model": "TC802A", + "type": "tablet" } - } -, + }, { - "desc" : "Amazon Kindle Fire Tablet", - "ua" : "Mozilla/5.0 (Linux; U; Android 4.4.3; en-us; KFSAWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/3.66 like Chrome/39.0.2171.93 Safari/537.36", - "expect" : - { - "vendor" : "Amazon", - "model" : "KFSAWI", - "type" : "tablet" + "desc": "Le Pan Tablets", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Le Pan", + "model": "TC802A", + "type": "tablet" } - } -, + }, { - "desc" : "Gigaset Tablet", - "ua" : "Mozilla/5.0 (Linux; Android 4.2.2; Gigaset QV830 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", - "expect" : - { - "vendor" : "Gigaset", - "model" : "QV830", - "type" : "tablet" + "desc": "Amazon Kindle Fire Tablet", + "ua": "Mozilla/5.0 (Linux; U; Android 4.4.3; en-us; KFSAWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/3.66 like Chrome/39.0.2171.93 Safari/537.36", + "expect": { + "vendor": "Amazon", + "model": "KFSAWI", + "type": "tablet" + } + }, + { + "desc": "Gigaset Tablet", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; Gigaset QV830 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", + "expect": { + "vendor": "Gigaset", + "model": "QV830", + "type": "tablet" + } + }, + { + "desc": "Redmi Note 3", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; Redmi Note 3 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.116 Mobile Safari/537.36", + "expect": { + "vendor": "Xiaomi", + "model": "Redmi Note 3", + "type": "mobile" + } + }, + { + "desc": "MI PAD 2", + "ua": "Mozilla/5.0 (Linux; Android 5.1; MI PAD 2 Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Safari/537.36 [FB_IAB/FB4A;FBAV/137.0.0.24.91;]", + "expect": { + "vendor": "Xiaomi", + "model": "MI PAD 2", + "type": "tablet" } } ] From 4d95ac10ef3dc2cd30fd26e94a91c30cedbd72ff Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 19 Sep 2017 14:17:51 -0400 Subject: [PATCH 100/170] Add support for Google Search Appliance on iOS --- 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 9d19dc6..57fa2c4 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -326,6 +326,9 @@ /version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile ], [VERSION, NAME], [ + /webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Google Search Appliance on iOS + ], [[NAME, 'GSA'], VERSION], [ + /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [ diff --git a/test/browser-test.json b/test/browser-test.json index 501de71..67b0494 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -958,5 +958,15 @@ "version" : "6.5.8.2910", "major" : "6" } + }, + { + "desc" : "GSA on iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) GSA/30.1.161623614 Mobile/14F89 Safari/602.1", + "expect" : + { + "name" : "GSA", + "version" : "30.1.161623614", + "major" : "30" + } } ] From 3ce12c0cf9bf8e8382d2f7c8358d1bf7611bab8a Mon Sep 17 00:00:00 2001 From: Lukas Drgon Date: Mon, 2 Oct 2017 19:31:03 +0200 Subject: [PATCH 101/170] Add CDN link --- readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readme.md b/readme.md index da7bc48..c458d7f 100644 --- a/readme.md +++ b/readme.md @@ -212,6 +212,12 @@ requirejs(['ua-parser-js'], function(UAParser) { }); ``` +## Using CDN + +```html + +``` + ## Using bower ```sh From b8978f5933d132422923881a7b8dfde17bb5f3e7 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Oct 2017 09:18:42 +0700 Subject: [PATCH 102/170] Fix #262 Chrome Headless --- src/ua-parser.js | 2 +- test/browser-test.json | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index a9e82f9..dbb3612 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -292,7 +292,7 @@ /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android ], [VERSION, [NAME, 'Facebook']], [ - /(headlesschrome) ([\w\.]+)/i // Chrome Headless + /headlesschrome\/([\w\.]+)/i // Chrome Headless ], [VERSION, [NAME, 'Chrome Headless']], [ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView diff --git a/test/browser-test.json b/test/browser-test.json index 501de71..5b061f6 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1,14 +1,4 @@ [ - { - "desc" : "Chrome Headless", - "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36", - "expect" : - { - "name" : "Chrome Headless", - "version" : "HeadlessChrome", - "major" : "" - } - }, { "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", @@ -149,6 +139,26 @@ "major" : "20" } }, + { + "desc" : "Chrome Headless", + "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36", + "expect" : + { + "name" : "Chrome Headless", + "version" : "HeadlessChrome", + "major" : "" + } + }, + { + "desc" : "Chrome Headless", + "ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/60.0.3112.113 Safari/537.36", + "expect" : + { + "name" : "Chrome Headless", + "version" : "60.0.3112.113", + "major" : "60" + } + }, { "desc" : "Chrome WebView", "ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36", From 3b89dff771925b0db11f1b0a8c6465d218709afa Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Oct 2017 09:28:14 +0700 Subject: [PATCH 103/170] increment revision 0.7.15 --- bower.json | 2 +- package.js | 2 +- package.json | 2 +- src/ua-parser.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 9ef0a38..7bf1441 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.14", + "version": "0.7.15", "authors": [ "Faisal Salman " ], diff --git a/package.js b/package.js index 099ca54..fa13a01 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'faisalman:ua-parser-js', - version: '0.7.14', + version: '0.7.15', 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 3d87497..2f6254b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "UAParser.js", "name": "ua-parser-js", - "version": "0.7.14", + "version": "0.7.15", "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 b847459..9d46f84 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /** - * UAParser.js v0.7.14 + * UAParser.js v0.7.15 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.14', + var LIBVERSION = '0.7.15', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', From 7bd9ffea2406d4f58edb9fc837d0506590641cc6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Oct 2017 09:48:25 +0700 Subject: [PATCH 104/170] Fix #262 Chrome Headless --- src/ua-parser.js | 2 +- test/browser-test.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index a53f547..a3d678a 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -292,7 +292,7 @@ /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android ], [VERSION, [NAME, 'Facebook']], [ - /headlesschrome\/([\w\.]+)/i // Chrome Headless + /headlesschrome(?:\/([\w\.]+)|\s)/i // Chrome Headless ], [VERSION, [NAME, 'Chrome Headless']], [ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView diff --git a/test/browser-test.json b/test/browser-test.json index d892e79..3efba3f 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -145,8 +145,8 @@ "expect" : { "name" : "Chrome Headless", - "version" : "HeadlessChrome", - "major" : "" + "version" : "undefined", + "major" : "undefined" } }, { From 25e143ee7caba78c6405a57d1d06b19c1e8e2f79 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Oct 2017 12:07:10 +0700 Subject: [PATCH 105/170] Fix vulnerable regex in getOS() (as reported by Nick Starke) --- 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 a3d678a..b6e8cc5 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -858,7 +858,7 @@ ], [NAME, VERSION],[ /cfnetwork\/.+darwin/i, - /ip[honead]+(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i // iOS + /ip[honead]+(?:.*os\s([\w]+)\slike\smac|;\sopera)/i // iOS ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, From 40aa1a693bcdbbad14a1b0599bf214c0a731694f Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Oct 2017 12:10:08 +0700 Subject: [PATCH 106/170] bump version --- 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 7bf1441..0707776 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.15", + "version": "0.7.16", "authors": [ "Faisal Salman " ], diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 2b65726..a56fcc4 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /** - * UAParser.js v0.7.14 + * UAParser.js v0.7.16 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.14",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 & MIT */ -!function(i,s){"use strict";var e="0.7.14",o="",r="?",n="function",a="undefined",t="object",d="string",l="major",w="model",u="name",c="type",p="vendor",m="version",b="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===d?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,d,l,w,u=0;u0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&e[o].length>0){for(var n=0;n (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 b6e8cc5..0adc897 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /** - * UAParser.js v0.7.15 + * UAParser.js v0.7.16 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.15', + var LIBVERSION = '0.7.16', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', From 60952586733b60b1d1e3fb38b8dd9b29f8511264 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Oct 2017 15:15:36 +0700 Subject: [PATCH 107/170] Fix #268 revert changes --- 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 | 8 +++++--- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bower.json b/bower.json index 0707776..69e9aaa 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.16", + "version": "0.7.17", "authors": [ "Faisal Salman " ], diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index a56fcc4..49d763e 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /** - * UAParser.js v0.7.16 + * UAParser.js v0.7.17 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.16",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 & MIT */ -!function(i,s){"use strict";var e="0.7.16",o="",r="?",n="function",a="undefined",t="object",d="string",l="major",w="model",u="name",c="type",m="vendor",p="version",b="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===d?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,d,l,w,u=0;u0?2==d.length?typeof d[1]==n?this[d[0]]=d[1].call(this,w):this[d[0]]=d[1]:3==d.length?typeof d[1]!==n||d[1].exec&&d[1].test?this[d[0]]=w?w.replace(d[1],d[2]):s:this[d[0]]=w?d[1].call(this,w,d[2]):s:4==d.length&&(this[d[0]]=w?d[3].call(this,w.replace(d[1],d[2])):s):this[d]=w?w:s;u+=2}},str:function(i,e){for(var o in e)if(typeof e[o]===t&&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 (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 0adc897..64e6454 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /** - * UAParser.js v0.7.16 + * UAParser.js v0.7.17 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.16', + var LIBVERSION = '0.7.17', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', @@ -1006,7 +1006,8 @@ if (typeof module !== UNDEF_TYPE && module.exports) { exports = module.exports = UAParser; } - // TODO: test!!! + // TODO: test!!!!!!!! + /* if (require && require.main === module && process) { // cli var jsonize = function (arr) { @@ -1033,6 +1034,7 @@ }); } } + */ exports.UAParser = UAParser; } else { // requirejs env (optional) From a75de42f8e6e58f57f4e09c3375e9dd08375862f Mon Sep 17 00:00:00 2001 From: Nobuo Okada Date: Tue, 31 Oct 2017 18:59:41 +0900 Subject: [PATCH 108/170] Fixed license --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 9fe4025..9e948ce 100644 --- a/readme.md +++ b/readme.md @@ -314,7 +314,7 @@ Do you use & like UAParser.js but you don’t find a way to show some love? If y # License -Dual licensed under GPLv2 & MIT +Dual licensed under GPLv2 or MIT Copyright © 2012-2016 Faisal Salman <> From 46dfe2aeb8e6acba249296b33ceae5275b57864d Mon Sep 17 00:00:00 2001 From: Nobuo Okada Date: Wed, 1 Nov 2017 13:18:26 +0900 Subject: [PATCH 109/170] Fixed license --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 49d763e..3e13903 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -4,6 +4,6 @@ * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman - * Dual licensed under GPLv2 & MIT + * Dual licensed under GPLv2 or MIT */ (function(window,undefined){"use strict";var LIBVERSION="0.7.17",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;j - * Dual licensed under GPLv2 & MIT + * Dual licensed under GPLv2 or MIT */ !function(i,s){"use strict";var e="0.7.17",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;n - * Dual licensed under GPLv2 & MIT + * Dual licensed under GPLv2 or MIT */ (function (window, undefined) { From 9dfeee52112c8c1fec4e99825c21b57b094c41a6 Mon Sep 17 00:00:00 2001 From: dhoko Date: Tue, 21 Nov 2017 10:25:30 +0100 Subject: [PATCH 110/170] Add support for palemoon browser + basilisk --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 3 ++- test/browser-test.json | 20 ++++++++++++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 49d763e..c13534a 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 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.17",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 & MIT */ -!function(i,s){"use strict";var e="0.7.17",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: Fri, 24 Nov 2017 17:30:38 +0800 Subject: [PATCH 111/170] Add Quark Browser support --- readme.md | 2 +- src/ua-parser.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 9fe4025..ba18054 100644 --- a/readme.md +++ b/readme.md @@ -35,7 +35,7 @@ Epiphany, Fennec, Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], -PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, Sleipnir, +PhantomJS, Phoenix, Polaris, QQBrowser, Quark, RockMelt, Silk, Skyfire, SeaMonkey, Sleipnir, SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex # 'browser.version' determined dynamically diff --git a/src/ua-parser.js b/src/ua-parser.js index 64e6454..3b5c0c7 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -254,7 +254,7 @@ // Webkit/KHTML based /(rekonq)\/([\w\.]+)*/i, // Rekonq - /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i + /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser ], [NAME, VERSION], [ From 503bb6eb06b1df728b29b46736d21ccfe5deb64f Mon Sep 17 00:00:00 2001 From: dhoko Date: Wed, 29 Nov 2017 09:11:04 +0100 Subject: [PATCH 112/170] Add support for waterfox --- 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 a14ecec..9d2ae4d 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.17",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.17",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: Fri, 15 Dec 2017 15:56:03 +0100 Subject: [PATCH 113/170] Add support for Xiaomi Mi 1/2/3/4/5/6 mobile smartphones --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 2 +- test/device-test.json | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 49d763e..1893947 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 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.17",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 & MIT */ -!function(i,s){"use strict";var e="0.7.17",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: Fri, 15 Dec 2017 16:16:39 +0100 Subject: [PATCH 114/170] Revert /dist files --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 1893947..49d763e 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 & MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.17",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 & MIT */ -!function(i,s){"use strict";var e="0.7.17",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: Fri, 15 Dec 2017 16:32:33 +0100 Subject: [PATCH 115/170] Xiaomi tablets: Ensure the UA contains "pad" --- 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 005f526..a2619a4 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -655,7 +655,7 @@ /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w?)?)\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 + /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]], [ From 610781dac374705a27718ac53173e999ae61d1d0 Mon Sep 17 00:00:00 2001 From: Loris Guignard Date: Fri, 15 Dec 2017 16:32:51 +0100 Subject: [PATCH 116/170] Add support for "Mi 5s Plus" --- 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 a2619a4..3a38ac9 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -652,7 +652,7 @@ /android.+(\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+build/i, // Xiaomi Mi + /android.+(mi[\s\-_]*(?: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 9d61cbe..95754a9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -421,6 +421,15 @@ "type": "mobile" } }, + { + "desc": "Xiaomi Mi 5s Plus", + "ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; zh-cn; MI 5s Plus Build/MXB48T) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.146 Mobile Safari/537.36 XiaoMi/MiuiBrowser/8.7.1", + "expect": { + "vendor": "Xiaomi", + "model": "MI 5s Plus", + "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 b367a3f74115cb1bf005d073a88e56895be13ed2 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 26 Dec 2017 08:29:40 +0700 Subject: [PATCH 117/170] Update contributors --- package.json | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7b87310..c7fd075 100644 --- a/package.json +++ b/package.json @@ -22,24 +22,33 @@ "algenon ", "Andrea Vaghi ", "Anton Zhiyanov ", + "Arturo Mejia ", + "Arun Rama Reddy ", "Austin Pray ", "Benjamin Bertrand ", + "Benjamin Urban ", "boneyao ", "Carl C Von Lewin ", "CESAR RAMOS ", "Christopher De Cairos ", + "Dario Vladovic ", "Davit Barbakadze ", "ddivernois ", "Demis Palma ", + "dhoko ", + "dianhe ", "Dmitry Tyschenko ", "Douglas Li ", "Dumitru Uzun ", + "Eric Schrenker ", "Erik Hesselink ", "Fabian Becker ", "Faisal Salman ", "Frédéric Camblor ", + "Germán M. Bravo ", "Grigory Dmitrenko ", "Hendrik Helwich ", + "Hermann Ebert ", "jackpoll ", "Jake Mc ", "John Tantalo ", @@ -48,23 +57,30 @@ "Kendall Buchanan ", "Lee Treveil ", "leonardo ", - "Levente Balogh ", + "Levente Balogh ", "Liam Quinn ", "Lithin ", + "Loris Guignard ", + "Lukas Drgon ", "Lukas Eipert ", "Malash ", - "Martynas ", - "Maximilian Haupt ", + "Martynas ", + "Matt Brophy ", "Max Maurer ", + "Maximilian Haupt ", "Michael Hess ", - "naoh ", + "naoh ", "Nik Rolls ", + "Nikhil Motiani ", "niris ", + "Nobuo Okada ", "otakuSiD ", "Peter Dave Hello ", "philippsimon ", "Pieter Hendrickx ", + "Piper Chester ", "Robert Tod ", + "Ron Korland ", "Ross Noble ", "Sandro Sonntag ", "sgautrea ", @@ -72,6 +88,7 @@ "Shane Thacker ", "Simon Eisenmann ", "Simon Lang ", + "Stiekel ", "Sylvain Gizard ", "szchenghuang ", "Vadim Kurachevsky ", From ac7f87f19948d3e170d2267b00ccfb8c216fb624 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 26 Dec 2017 10:54:46 +0700 Subject: [PATCH 118/170] Fix #272 OnePlus --- 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 4142f75..841dd7d 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -661,7 +661,8 @@ /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ - /android.+a000(1)\s+build/i // OnePlus + /android.+a000(1)\s+build/i, // OnePlus + /android.+oneplus\s(a\d{4})\s+build/i ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets diff --git a/test/device-test.json b/test/device-test.json index 95754a9..3fa7503 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -196,6 +196,15 @@ "type": "mobile" } }, + { + "desc": "OnePlus 3", + "ua": "Mozilla/5.0 (Linux; Android 7.1.1; ONEPLUS A3000 Build/NMF26F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36", + "expect": { + "vendor": "OnePlus", + "model": "A3000", + "type": "mobile" + } + }, { "desc": "OPPO R7s", "ua": "Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; OPPO R7s Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.1 Mobile Safari/537.36", From 50bd78afb140136deef245dcf95052bd8f0bc27e Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 26 Dec 2017 15:30:33 +0700 Subject: [PATCH 119/170] Fix ReDoS vulnerability reported by Sonatype --- src/ua-parser.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 841dd7d..9cc170e 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -513,9 +513,9 @@ /(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak ], [VENDOR, MODEL, [TYPE, TABLET]], [ - /(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i // Kindle Fire HD + /(kf[A-z]+)\sbuild\/.+silk\//i // Kindle Fire HD ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ - /(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i // Fire Phone + /(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i // Fire Phone ], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [ /\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone @@ -651,12 +651,12 @@ /android.+;\s(pixel xl|pixel)\s/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ - /android.+(\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.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+)?)\s+build/i // Redmi Phones + /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models + /android.+;\s(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi + /android.+;\s(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w?)?[\s_]*(?:plus)?)\s+build/i, // Xiaomi Mi + /android.+;\s(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 + /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]], [ @@ -668,7 +668,7 @@ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [ - /android.+[;\/]\s*(Venue[\d\s]*)\s+build/i // Dell Venue Tablets + /android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i // Dell Venue Tablets ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet @@ -680,8 +680,8 @@ /android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i // Barnes & Noble Tablet ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [ - /android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i // ZTE K Series Tablet - ], [[VENDOR, 'ZTE'], MODEL, [TYPE, TABLET]], [ + /android.+;\s(k88)\sbuild/i // ZTE K Series Tablet + ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [ /android.+[;\/]\s*(gen\d{3})\s+build.*49h/i // Swiss GEN Mobile ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [ @@ -692,14 +692,14 @@ /android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i // Zeki Tablets ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [ - /(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i, - /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i // Dragon Touch Tablet + /(android).+[;\/]\s+([YR]\d{2})\s+build/i, + /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i // Dragon Touch Tablet ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [ - /android.+[;\/]\s*(NS-?.+)\s+build/i // Insignia Tablets + /android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i // Insignia Tablets ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [ - /android.+[;\/]\s*((NX|Next)-?.+)\s+build/i // NextBook Tablets + /android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i // NextBook Tablets ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i @@ -711,7 +711,7 @@ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ - /android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i // Le Pan Tablets + /android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i // Le Pan Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets @@ -726,14 +726,14 @@ /android.+(KS(.+))\s+build/i // Amazon Kindle Tablets ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ - /android.+(Gigaset)[\s\-]+(Q.+)\s+build/i // Gigaset Tablets + /android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i // Gigaset Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ - /(android.+)[;\/].+build/i // Generic Android Device + /(android[\w\.\s\-]{0,9});.+build/i // Generic Android Device ], [MODEL, [VENDOR, 'Generic']] @@ -800,7 +800,7 @@ /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab ], [NAME, VERSION], [ - /rv\:([\w\.]+).*(gecko)/i // Gecko + /rv\:([\w\.]{1,9}).+(gecko)/i // Gecko ], [VERSION, NAME] ], @@ -856,11 +856,11 @@ /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ - /(haiku)\s(\w+)/i // Haiku + /(haiku)\s(\w+)/i // Haiku ], [NAME, VERSION],[ /cfnetwork\/.+darwin/i, - /ip[honead]+(?:.*os\s([\w]+)\slike\smac|;\sopera)/i // iOS + /ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i // iOS ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, From 083cb66d46582dec0c0b3407c6553c5bc51b9f12 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Thu, 11 Jan 2018 13:04:00 +0100 Subject: [PATCH 120/170] Add missing Waterfox browser to README --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 8e3436c..ed58201 100644 --- a/readme.md +++ b/readme.md @@ -36,7 +36,7 @@ IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Ki Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], PhantomJS, Phoenix, Polaris, QQBrowser, Quark, RockMelt, Silk, Skyfire, SeaMonkey, Sleipnir, -SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex +SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, Waterfox, WeChat, Yandex # 'browser.version' determined dynamically ``` From 8b54a7256e56decc3b02e8f6649a5d8108f20485 Mon Sep 17 00:00:00 2001 From: Zach Bjornson Date: Mon, 26 Feb 2018 20:11:01 -0800 Subject: [PATCH 121/170] Fix vulnerable RegExps Fixes #298 --- dist/ua-parser.min.js | 225 ++++++++++++++++++++++++++++++++++++++++- dist/ua-parser.pack.js | 189 +++++++++++++++++++++++++++++++++- src/ua-parser.js | 66 ++++++------ 3 files changed, 445 insertions(+), 35 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 9d2ae4d..0d25e49 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -6,4 +6,227 @@ * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 or MIT */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.17",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){ +// assign modified match +this[q[0]]=q[1].call(this,match)}else{ +// assign given value, ignore regex match +this[q[0]]=q[1]}}else if(q.length==3){ +// check whether function or regex +if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){ +// call function (usually string mapper) +this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{ +// sanitize match using given regex +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){ +// check if array +if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j 9.80 +/(opera)[\/\s]+([\w\.]+)/i],[NAME,VERSION],[/(opios)[\/\s]+([\w\.]+)/i],[[NAME,"Opera Mini"],VERSION],[/\s(opr)\/([\w\.]+)/i],[[NAME,"Opera"],VERSION],[ +// Mixed +/(kindle)\/([\w\.]+)/i,// Kindle +/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i, +// Lunascape/Maxthon/Netfront/Jasmine/Blazer +// Trident based +/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, +// Avant/IEMobile/SlimBrowser/Baidu +/(?:ms|\()(ie)\s([\w\.]+)/i,// Internet Explorer +// Webkit/KHTML based +/(rekonq)\/([\w\.]*)/i,// Rekonq +/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[NAME,VERSION],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[NAME,"IE"],VERSION],[/(edge)\/((\d*)[\w\.]+)/i],[NAME,VERSION],[/(yabrowser)\/([\w\.]+)/i],[[NAME,"Yandex"],VERSION],[/(puffin)\/([\w\.]+)/i],[[NAME,"Puffin"],VERSION],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[NAME,"UCBrowser"],VERSION],[/(comodo_dragon)\/([\w\.]+)/i],[[NAME,/_/g," "],VERSION],[/(micromessenger)\/([\w\.]+)/i],[[NAME,"WeChat"],VERSION],[/(QQ)\/([\d\.]+)/i],[NAME,VERSION],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[NAME,VERSION],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[VERSION,[NAME,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[VERSION,[NAME,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 WebView"],VERSION],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[NAME,/(.+(?:g|us))(.+)/,"$1 $2"],VERSION],[// Oculus / Samsung Browser +/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[VERSION,[NAME,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/(dolfin)\/([\w\.]+)/i],[[NAME,"Dolphin"],VERSION],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[NAME,"Chrome"],VERSION],[/(coast)\/([\w\.]+)/i],[[NAME,"Opera Coast"],VERSION],[/fxios\/([\w\.-]+)/i],[VERSION,[NAME,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[VERSION,[NAME,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[VERSION,NAME],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[NAME,"GSA"],VERSION],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,mapper.str,maps.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,// Konqueror +/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[ +// Gecko based +/(navigator|netscape)\/([\w\.-]+)/i],[[NAME,"Netscape"],VERSION],[/(swiftfox)/i,// Swiftfox +/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, +// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror +/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i, +// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix +/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,// Mozilla +// Other +/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, +// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir +/(links)\s\(([\w\.]+)/i,// Links +/(gobrowser)\/?([\w\.]*)/i,// GoBrowser +/(ice\s?browser)\/v?([\w\._]+)/i,// ICE Browser +/(mosaic)[\/\s]([\w\.]+)/i],[NAME,VERSION]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[ARCHITECTURE,"amd64"]],[/(ia32(?=;))/i],[[ARCHITECTURE,util.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[ARCHITECTURE,"ia32"]],[ +// PocketPC mistakenly identified as PowerPC +/windows\s(ce|mobile);\sppc;/i],[[ARCHITECTURE,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[ARCHITECTURE,/ower/,"",util.lowerize]],[/(sun4\w)[;\)]/i],[[ARCHITECTURE,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[ARCHITECTURE,util.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/applecoremedia\/[\w\.]+ \((ipad)/],[MODEL,[VENDOR,"Apple"],[TYPE,TABLET]],[/(apple\s{0,1}tv)/i],[[MODEL,"Apple TV"],[VENDOR,"Apple"]],[/(archos)\s(gamepad2?)/i,// Archos +/(hp).+(touchpad)/i,// HP TouchPad +/(hp).+(tablet)/i,// HP Tablet +/(kindle)\/([\w\.]+)/i,// Kindle +/\s(nook)[\w\s]+build\/(\w+)/i,// Nook +/(dell)\s(strea[kpr\s\d]*[\dko])/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[MODEL,[VENDOR,"Amazon"],[TYPE,TABLET]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[MODEL,mapper.str,maps.device.amazon.model],[VENDOR,"Amazon"],[TYPE,MOBILE]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[MODEL,VENDOR,[TYPE,MOBILE]],[/\((ip[honed|\s\w*]+);/i],[MODEL,[VENDOR,"Apple"],[TYPE,MOBILE]],[/(blackberry)[\s-]?(\w+)/i,// BlackBerry +/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i, +// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron +/(hp)\s([\w\s]+\w)/i,// HP iPAQ +/(asus)-?(\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/\(bb10;\s(\w+)/i],[MODEL,[VENDOR,"BlackBerry"],[TYPE,MOBILE]],[ +// Asus Tablets +/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[MODEL,[VENDOR,"Asus"],[TYPE,TABLET]],[/(sony)\s(tablet\s[ps])\sbuild\//i,// Sony +/(sony)?(?:sgp.+)\sbuild\//i],[[VENDOR,"Sony"],[MODEL,"Xperia Tablet"],[TYPE,TABLET]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[MODEL,[VENDOR,"Sony"],[TYPE,MOBILE]],[/\s(ouya)\s/i,// Ouya +/(nintendo)\s([wids3u]+)/i],[VENDOR,MODEL,[TYPE,CONSOLE]],[/android.+;\s(shield)\sbuild/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,CONSOLE]],[/(playstation\s[34portablevi]+)/i],[MODEL,[VENDOR,"Sony"],[TYPE,CONSOLE]],[/(sprint\s(\w+))/i],[[VENDOR,mapper.str,maps.device.sprint.vendor],[MODEL,mapper.str,maps.device.sprint.model],[TYPE,MOBILE]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,// HTC +/(zte)-(\w*)/i,// ZTE +/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/(nexus\s9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[MODEL,[VENDOR,"Huawei"],[TYPE,MOBILE]],[/(microsoft);\s(lumia[\s\w]+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[MODEL,[VENDOR,"Microsoft"],[TYPE,CONSOLE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,"Microsoft"],[TYPE,MOBILE]],[ +// Motorola +/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[MODEL,[VENDOR,"Motorola"],[TYPE,MOBILE]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[MODEL,[VENDOR,"Motorola"],[TYPE,TABLET]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[VENDOR,util.trim],[MODEL,util.trim],[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,"Samsung"],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,SMARTTV]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[VENDOR,"Samsung"],MODEL,[TYPE,TABLET]],[// Samsung +/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV],MODEL],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[VENDOR,"Samsung"],MODEL,[TYPE,MOBILE]],[/sie-(\w*)/i],[MODEL,[VENDOR,"Siemens"],[TYPE,MOBILE]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,// Nokia +/(nokia)[\s_-]?([\w-]*)/i],[[VENDOR,"Nokia"],MODEL,[TYPE,MOBILE]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/android.+([vl]k\-?\d{3})\s+build/i],[MODEL,[VENDOR,"LG"],[TYPE,TABLET]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[VENDOR,"LG"],MODEL,[TYPE,TABLET]],[/(lg) netcast\.tv/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/(nexus\s[45])/i,// LG +/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[MODEL,[VENDOR,"LG"],[TYPE,MOBILE]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[MODEL,[VENDOR,"Lenovo"],[TYPE,TABLET]],[/linux;.+((jolla));/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/((pebble))app\/[\d\.]+\s/i],[VENDOR,MODEL,[TYPE,WEARABLE]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/crkey/i],[[MODEL,"Chromecast"],[VENDOR,"Google"]],[/android.+;\s(glass)\s\d/i],[MODEL,[VENDOR,"Google"],[TYPE,WEARABLE]],[/android.+;\s(pixel c)\s/i],[MODEL,[VENDOR,"Google"],[TYPE,TABLET]],[/android.+;\s(pixel xl|pixel)\s/i],[MODEL,[VENDOR,"Google"],[TYPE,MOBILE]],[/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.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[MODEL,/_/g," "],[VENDOR,"Xiaomi"],[TYPE,MOBILE]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[MODEL,/_/g," "],[VENDOR,"Xiaomi"],[TYPE,TABLET]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[MODEL,[VENDOR,"Meizu"],[TYPE,TABLET]],[/android.+a000(1)\s+build/i,// OnePlus +/android.+oneplus\s(a\d{4})\s+build/i],[MODEL,[VENDOR,"OnePlus"],[TYPE,MOBILE]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[MODEL,[VENDOR,"RCA"],[TYPE,TABLET]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[MODEL,[VENDOR,"Dell"],[TYPE,TABLET]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[MODEL,[VENDOR,"Verizon"],[TYPE,TABLET]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[VENDOR,"Barnes & Noble"],MODEL,[TYPE,TABLET]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[MODEL,[VENDOR,"NuVision"],[TYPE,TABLET]],[/android.+;\s(k88)\sbuild/i],[MODEL,[VENDOR,"ZTE"],[TYPE,TABLET]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[MODEL,[VENDOR,"Swiss"],[TYPE,MOBILE]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[MODEL,[VENDOR,"Swiss"],[TYPE,TABLET]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[MODEL,[VENDOR,"Zeki"],[TYPE,TABLET]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[VENDOR,"Dragon Touch"],MODEL,[TYPE,TABLET]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[MODEL,[VENDOR,"Insignia"],[TYPE,TABLET]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[MODEL,[VENDOR,"NextBook"],[TYPE,TABLET]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[VENDOR,"Voice"],MODEL,[TYPE,MOBILE]],[// Voice Xtreme Phones +/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[VENDOR,"LvTel"],MODEL,[TYPE,MOBILE]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[MODEL,[VENDOR,"Envizen"],[TYPE,TABLET]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[VENDOR,MODEL,[TYPE,TABLET]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[MODEL,[VENDOR,"MachSpeed"],[TYPE,TABLET]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[VENDOR,MODEL,[TYPE,TABLET]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[MODEL,[VENDOR,"Rotor"],[TYPE,TABLET]],[/android.+(KS(.+))\s+build/i],[MODEL,[VENDOR,"Amazon"],[TYPE,TABLET]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[VENDOR,MODEL,[TYPE,TABLET]],[/\s(tablet|tab)[;\/]/i,// Unidentifiable Tablet +/\s(mobile)(?:[;\/]|\ssafari)/i],[[TYPE,util.lowerize],VENDOR,MODEL],[/(android[\w\.\s\-]{0,9});.+build/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[VERSION,[NAME,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,// Presto +/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,// WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m +/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,// KHTML/Tasman/Links +/(icab)[\/\s]([23]\.[\d\.]+)/i],[NAME,VERSION],[/rv\:([\w\.]{1,9}).+(gecko)/i],[VERSION,NAME]],os:[[ +// Windows based +/microsoft\s(windows)\s(vista|xp)/i],[NAME,VERSION],[/(windows)\snt\s6\.2;\s(arm)/i,// Windows RT +/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,// Windows Phone +/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[NAME,[VERSION,mapper.str,maps.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[NAME,"Windows"],[VERSION,mapper.str,maps.os.windows.version]],[ +// Mobile/Embedded OS +/\((bb)(10);/i],[[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],[NAME,VERSION],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[NAME,"Symbian"],VERSION],[/\((series40);/i],[NAME],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[NAME,"Firefox OS"],VERSION],[ +// Console +/(nintendo|playstation)\s([wids34portablevu]+)/i,// Nintendo/Playstation +// GNU/Linux based +/(mint)[\/\s\(]?(\w*)/i,// Mint +/(mageia|vectorlinux)[;\s]/i,// Mageia/VectorLinux +/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i, +// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware +// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus +/(hurd|linux)\s?([\w\.]*)/i,// Hurd/Linux +/(gnu)\s?([\w\.]*)/i],[NAME,VERSION],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[NAME,"Chromium OS"],VERSION],[ +// Solaris +/(sunos)\s?([\w\.\d]*)/i],[[NAME,"Solaris"],VERSION],[ +// BSD based +/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[NAME,VERSION],[/(haiku)\s(\w+)/i],[NAME,VERSION],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[NAME,"Mac OS"],[VERSION,/_/g,"."]],[ +// Other +/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,// Solaris +/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,// AIX +/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, +// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS +/(unix)\s?([\w\.]*)/i],[NAME,VERSION]]}; +///////////////// +// 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"){extensions=uastring;uastring=undefined}if(!(this instanceof UAParser)){return new UAParser(uastring,extensions).getResult()}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};mapper.rgx.call(browser,ua,rgxmap.browser);browser.major=util.major(browser.version);// deprecated +return browser};this.getCPU=function(){var cpu={architecture:undefined};mapper.rgx.call(cpu,ua,rgxmap.cpu);return cpu};this.getDevice=function(){var device={vendor:undefined,model:undefined,type:undefined};mapper.rgx.call(device,ua,rgxmap.device);return device};this.getEngine=function(){var engine={name:undefined,version:undefined};mapper.rgx.call(engine,ua,rgxmap.engine);return engine};this.getOS=function(){var os={name:undefined,version:undefined};mapper.rgx.call(os,ua,rgxmap.os);return os};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return ua};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};UAParser.VERSION=LIBVERSION;UAParser.BROWSER={NAME:NAME,MAJOR:MAJOR,// deprecated +VERSION:VERSION};UAParser.CPU={ARCHITECTURE:ARCHITECTURE};UAParser.DEVICE={MODEL:MODEL,VENDOR:VENDOR,TYPE:TYPE,CONSOLE:CONSOLE,MOBILE:MOBILE,SMARTTV:SMARTTV,TABLET:TABLET,WEARABLE:WEARABLE,EMBEDDED:EMBEDDED};UAParser.ENGINE={NAME:NAME,VERSION:VERSION};UAParser.OS={NAME:NAME,VERSION:VERSION}; +//UAParser.Utils = util; +/////////// +// Export +////////// +// check js environment +if(typeof exports!==UNDEF_TYPE){ +// nodejs env +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) +if(typeof define===FUNC_TYPE&&define.amd){define(function(){return UAParser})}else if(window){ +// browser env +window.UAParser=UAParser}} +// jQuery/Zepto specific (optional) +// Note: +// In AMD env the global scope should be kept clean, but jQuery is an exception. +// 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){var parser=new UAParser;$.ua=parser.getResult();$.ua.get=function(){return parser.getUA()};$.ua.set=function(uastring){parser.setUA(uastring);var result=parser.getResult();for(var prop in result){$.ua[prop]=result[prop]}}}})(typeof window==="object"?window:this); \ No newline at end of file diff --git a/dist/ua-parser.pack.js b/dist/ua-parser.pack.js index 1d7570e..1c730e6 100644 --- a/dist/ua-parser.pack.js +++ b/dist/ua-parser.pack.js @@ -6,4 +6,191 @@ * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 or MIT */ -!function(i,s){"use strict";var e="0.7.17",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? +// assign modified match +this[t[0]]=t[1].call(this,w): +// assign given value, ignore regex match +this[t[0]]=t[1]:3==t.length? +// check whether function or regex +typeof t[1]!==n||t[1].exec&&t[1].test? +// sanitize match using given regex +this[t[0]]=w?w.replace(t[1],t[2]):s: +// call function (usually string mapper) +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) +// check if array +if(typeof e[o]===d&&e[o].length>0){for(var n=0;n 9.80 +/(opera)[\/\s]+([\w\.]+)/i],[u,p],[/(opios)[\/\s]+([\w\.]+)/i],[[u,"Opera Mini"],p],[/\s(opr)\/([\w\.]+)/i],[[u,"Opera"],p],[ +// Mixed +/(kindle)\/([\w\.]+)/i,// Kindle +/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i, +// Lunascape/Maxthon/Netfront/Jasmine/Blazer +// Trident based +/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, +// Avant/IEMobile/SlimBrowser/Baidu +/(?:ms|\()(ie)\s([\w\.]+)/i,// Internet Explorer +// Webkit/KHTML based +/(rekonq)\/([\w\.]*)/i,// Rekonq +/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[u,p],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[u,"IE"],p],[/(edge)\/((\d*)[\w\.]+)/i],[u,p],[/(yabrowser)\/([\w\.]+)/i],[[u,"Yandex"],p],[/(puffin)\/([\w\.]+)/i],[[u,"Puffin"],p],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[u,"UCBrowser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(micromessenger)\/([\w\.]+)/i],[[u,"WeChat"],p],[/(QQ)\/([\d\.]+)/i],[u,p],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[u,p],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[p,[u,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[p,[u,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[u,/(.+)/,"$1 WebView"],p],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[u,/(.+(?:g|us))(.+)/,"$1 $2"],p],[// Oculus / Samsung Browser +/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[u,p],[/(dolfin)\/([\w\.]+)/i],[[u,"Dolphin"],p],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[u,"Chrome"],p],[/(coast)\/([\w\.]+)/i],[[u,"Opera Coast"],p],[/fxios\/([\w\.-]+)/i],[p,[u,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[p,u],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[u,"GSA"],p],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[u,[p,T.str,S.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,// Konqueror +/(webkit|khtml)\/([\w\.]+)/i],[u,p],[ +// Gecko based +/(navigator|netscape)\/([\w\.-]+)/i],[[u,"Netscape"],p],[/(swiftfox)/i,// Swiftfox +/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, +// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror +/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i, +// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix +/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,// Mozilla +// Other +/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, +// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir +/(links)\s\(([\w\.]+)/i,// Links +/(gobrowser)\/?([\w\.]*)/i,// GoBrowser +/(ice\s?browser)\/v?([\w\._]+)/i,// ICE Browser +/(mosaic)[\/\s]([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[b,"amd64"]],[/(ia32(?=;))/i],[[b,y.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[b,"ia32"]],[ +// PocketPC mistakenly identified as PowerPC +/windows\s(ce|mobile);\sppc;/i],[[b,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[b,/ower/,"",y.lowerize]],[/(sun4\w)[;\)]/i],[[b,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[b,y.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[w,m,[c,h]],[/applecoremedia\/[\w\.]+ \((ipad)/],[w,[m,"Apple"],[c,h]],[/(apple\s{0,1}tv)/i],[[w,"Apple TV"],[m,"Apple"]],[/(archos)\s(gamepad2?)/i,// Archos +/(hp).+(touchpad)/i,// HP TouchPad +/(hp).+(tablet)/i,// HP Tablet +/(kindle)\/([\w\.]+)/i,// Kindle +/\s(nook)[\w\s]+build\/(\w+)/i,// Nook +/(dell)\s(strea[kpr\s\d]*[\dko])/i],[m,w,[c,h]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[w,[m,"Amazon"],[c,h]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[w,T.str,S.device.amazon.model],[m,"Amazon"],[c,f]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[w,m,[c,f]],[/\((ip[honed|\s\w*]+);/i],[w,[m,"Apple"],[c,f]],[/(blackberry)[\s-]?(\w+)/i,// BlackBerry +/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i, +// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron +/(hp)\s([\w\s]+\w)/i,// HP iPAQ +/(asus)-?(\w+)/i],[m,w,[c,f]],[/\(bb10;\s(\w+)/i],[w,[m,"BlackBerry"],[c,f]],[ +// Asus Tablets +/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[w,[m,"Asus"],[c,h]],[/(sony)\s(tablet\s[ps])\sbuild\//i,// Sony +/(sony)?(?:sgp.+)\sbuild\//i],[[m,"Sony"],[w,"Xperia Tablet"],[c,h]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[w,[m,"Sony"],[c,f]],[/\s(ouya)\s/i,// Ouya +/(nintendo)\s([wids3u]+)/i],[m,w,[c,g]],[/android.+;\s(shield)\sbuild/i],[w,[m,"Nvidia"],[c,g]],[/(playstation\s[34portablevi]+)/i],[w,[m,"Sony"],[c,g]],[/(sprint\s(\w+))/i],[[m,T.str,S.device.sprint.vendor],[w,T.str,S.device.sprint.model],[c,f]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[m,w,[c,h]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,// HTC +/(zte)-(\w*)/i,// ZTE +/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[m,[w,/_/g," "],[c,f]],[/(nexus\s9)/i],[w,[m,"HTC"],[c,h]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[w,[m,"Huawei"],[c,f]],[/(microsoft);\s(lumia[\s\w]+)/i],[m,w,[c,f]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[w,[m,"Microsoft"],[c,g]],[/(kin\.[onetw]{3})/i],[[w,/\./g," "],[m,"Microsoft"],[c,f]],[ +// Motorola +/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[w,[m,"Motorola"],[c,f]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[w,[m,"Motorola"],[c,h]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[m,y.trim],[w,y.trim],[c,v]],[/hbbtv.+maple;(\d+)/i],[[w,/^/,"SmartTV"],[m,"Samsung"],[c,v]],[/\(dtv[\);].+(aquos)/i],[w,[m,"Sharp"],[c,v]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[m,"Samsung"],w,[c,h]],[// Samsung +/smart-tv.+(samsung)/i],[m,[c,v],w],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[m,"Samsung"],w,[c,f]],[/sie-(\w*)/i],[w,[m,"Siemens"],[c,f]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,// Nokia +/(nokia)[\s_-]?([\w-]*)/i],[[m,"Nokia"],w,[c,f]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[w,[m,"Acer"],[c,h]],[/android.+([vl]k\-?\d{3})\s+build/i],[w,[m,"LG"],[c,h]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[m,"LG"],w,[c,h]],[/(lg) netcast\.tv/i],[m,w,[c,v]],[/(nexus\s[45])/i,// LG +/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[w,[m,"LG"],[c,f]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[w,[m,"Lenovo"],[c,h]],[/linux;.+((jolla));/i],[m,w,[c,f]],[/((pebble))app\/[\d\.]+\s/i],[m,w,[c,x]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[m,w,[c,f]],[/crkey/i],[[w,"Chromecast"],[m,"Google"]],[/android.+;\s(glass)\s\d/i],[w,[m,"Google"],[c,x]],[/android.+;\s(pixel c)\s/i],[w,[m,"Google"],[c,h]],[/android.+;\s(pixel xl|pixel)\s/i],[w,[m,"Google"],[c,f]],[/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.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[w,/_/g," "],[m,"Xiaomi"],[c,f]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[w,/_/g," "],[m,"Xiaomi"],[c,h]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[w,[m,"Meizu"],[c,h]],[/android.+a000(1)\s+build/i,// OnePlus +/android.+oneplus\s(a\d{4})\s+build/i],[w,[m,"OnePlus"],[c,f]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[w,[m,"RCA"],[c,h]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[w,[m,"Dell"],[c,h]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[w,[m,"Verizon"],[c,h]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[m,"Barnes & Noble"],w,[c,h]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[w,[m,"NuVision"],[c,h]],[/android.+;\s(k88)\sbuild/i],[w,[m,"ZTE"],[c,h]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[w,[m,"Swiss"],[c,f]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[w,[m,"Swiss"],[c,h]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[w,[m,"Zeki"],[c,h]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[m,"Dragon Touch"],w,[c,h]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[w,[m,"Insignia"],[c,h]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[w,[m,"NextBook"],[c,h]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[m,"Voice"],w,[c,f]],[// Voice Xtreme Phones +/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[m,"LvTel"],w,[c,f]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[w,[m,"Envizen"],[c,h]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[m,w,[c,h]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[w,[m,"MachSpeed"],[c,h]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[m,w,[c,h]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[w,[m,"Rotor"],[c,h]],[/android.+(KS(.+))\s+build/i],[w,[m,"Amazon"],[c,h]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[m,w,[c,h]],[/\s(tablet|tab)[;\/]/i,// Unidentifiable Tablet +/\s(mobile)(?:[;\/]|\ssafari)/i],[[c,y.lowerize],m,w],[/(android[\w\.\s\-]{0,9});.+build/i],[w,[m,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,// Presto +/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,// WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m +/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,// KHTML/Tasman/Links +/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9}).+(gecko)/i],[p,u]],os:[[ +// Windows based +/microsoft\s(windows)\s(vista|xp)/i],[u,p],[/(windows)\snt\s6\.2;\s(arm)/i,// Windows RT +/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,// Windows Phone +/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[p,T.str,S.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[p,T.str,S.os.windows.version]],[ +// Mobile/Embedded OS +/\((bb)(10);/i],[[u,"BlackBerry"],p],[/(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],[u,p],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[u,"Symbian"],p],[/\((series40);/i],[u],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],p],[ +// Console +/(nintendo|playstation)\s([wids34portablevu]+)/i,// Nintendo/Playstation +// GNU/Linux based +/(mint)[\/\s\(]?(\w*)/i,// Mint +/(mageia|vectorlinux)[;\s]/i,// Mageia/VectorLinux +/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i, +// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware +// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus +/(hurd|linux)\s?([\w\.]*)/i,// Hurd/Linux +/(gnu)\s?([\w\.]*)/i],[u,p],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],p],[ +// Solaris +/(sunos)\s?([\w\.\d]*)/i],[[u,"Solaris"],p],[ +// BSD based +/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[u,p],[/(haiku)\s(\w+)/i],[u,p],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[u,"Mac OS"],[p,/_/g,"."]],[ +// Other +/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,// Solaris +/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,// AIX +/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, +// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS +/(unix)\s?([\w\.]*)/i],[u,p]]},E=function(e,r){if("object"==typeof e&&(r=e,e=s),!(this instanceof E))return new E(e,r).getResult();var n=e||(i&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:o),a=r?y.extend(A,r):A; +//var browser = new Browser(); +//var cpu = new CPU(); +//var device = new Device(); +//var engine = new Engine(); +//var os = new OS(); +return this.getBrowser=function(){var i={name:s,version:s};// deprecated +return T.rgx.call(i,n,a.browser),i.major=y.major(i.version),i},this.getCPU=function(){var i={architecture:s};return T.rgx.call(i,n,a.cpu),i},this.getDevice=function(){var i={vendor:s,model:s,type:s};return T.rgx.call(i,n,a.device),i},this.getEngine=function(){var i={name:s,version:s};return T.rgx.call(i,n,a.engine),i},this.getOS=function(){var i={name:s,version:s};return T.rgx.call(i,n,a.os),i},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(i){ +//browser = new Browser(); +//cpu = new CPU(); +//device = new Device(); +//engine = new Engine(); +//os = new OS(); +return n=i,this},this};E.VERSION=e,E.BROWSER={NAME:u,MAJOR:l,// deprecated +VERSION:p},E.CPU={ARCHITECTURE:b},E.DEVICE={MODEL:w,VENDOR:m,TYPE:c,CONSOLE:g,MOBILE:f,SMARTTV:v,TABLET:h,WEARABLE:x,EMBEDDED:k},E.ENGINE={NAME:u,VERSION:p},E.OS={NAME:u,VERSION:p}, +//UAParser.Utils = util; +/////////// +// Export +////////// +// check js environment +typeof exports!==a?( +// nodejs env +typeof module!==a&&module.exports&&(exports=module.exports=E), +// 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=E): +// requirejs env (optional) +typeof define===n&&define.amd?define(function(){return E}):i&&( +// browser env +i.UAParser=E); +// jQuery/Zepto specific (optional) +// Note: +// In AMD env the global scope should be kept clean, but jQuery is an exception. +// jQuery always exports to global scope, unless jQuery.noConflict(true) is used, +// and we should catch that. +var N=i&&(i.jQuery||i.Zepto);if(typeof N!==a){var z=new E;N.ua=z.getResult(),N.ua.get=function(){return z.getUA()},N.ua.set=function(i){z.setUA(i);var s=z.getResult();for(var e in s)N.ua[e]=s[e]}}}("object"==typeof window?window:this); \ No newline at end of file diff --git a/src/ua-parser.js b/src/ua-parser.js index 9cc170e..22fd882 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -244,7 +244,7 @@ // Mixed /(kindle)\/([\w\.]+)/i, // Kindle - /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i, + /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based @@ -253,7 +253,7 @@ /(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer // Webkit/KHTML based - /(rekonq)\/([\w\.]+)*/i, // Rekonq + /(rekonq)\/([\w\.]*)/i, // Rekonq /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser ], [NAME, VERSION], [ @@ -261,7 +261,7 @@ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ - /(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge + /(edge)\/((\d*)[\w\.]+)/i // Microsoft Edge ], [NAME, VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex @@ -351,7 +351,7 @@ /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir /(links)\s\(([\w\.]+)/i, // Links - /(gobrowser)\/?([\w\.]+)*/i, // GoBrowser + /(gobrowser)\/?([\w\.]*)/i, // GoBrowser /(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser /(mosaic)[\/\s]([\w\.]+)/i // Mosaic ], [NAME, VERSION] @@ -524,7 +524,7 @@ ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ /(blackberry)[\s-]?(\w+)/i, // BlackBerry - /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, + /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i, // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron /(hp)\s([\w\s]+\w)/i, // HP iPAQ /(asus)-?(\w+)/i // Asus @@ -558,8 +558,8 @@ ], [VENDOR, MODEL, [TYPE, TABLET]], [ /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC - /(zte)-(\w+)*/i, // ZTE - /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i + /(zte)-(\w*)/i, // ZTE + /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ @@ -579,8 +579,8 @@ ], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [ // Motorola - /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, - /mot[\s-]?(\w+)*/i, + /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i, + /mot[\s-]?(\w*)/i, /(XT\d{3,4}) build\//i, /(nexus\s6)/i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [ @@ -602,15 +602,15 @@ /smart-tv.+(samsung)/i ], [VENDOR, [TYPE, SMARTTV], MODEL], [ /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, - /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, + /(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i, /sec-((sgh\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ - /sie-(\w+)*/i // Siemens + /sie-(\w*)/i // Siemens ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [ /(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia - /(nokia)[\s_-]?([\w-]+)*/i + /(nokia)[\s_-]?([\w-]*)/i ], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [ /android\s3\.[\s\w;-]{10}(a\d{3})/i // Acer @@ -623,7 +623,7 @@ /(lg) netcast\.tv/i // LG SmartTV ], [VENDOR, MODEL, [TYPE, SMARTTV]], [ /(nexus\s[45])/i, // LG - /lg[e;\s\/-]+(\w+)*/i, + /lg[e;\s\/-]+(\w*)/i, /android.+lg(\-?[\d\w]+)\s+build/i ], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [ @@ -652,11 +652,11 @@ ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models - /android.+;\s(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi - /android.+;\s(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w?)?[\s_]*(?:plus)?)\s+build/i, // Xiaomi Mi - /android.+;\s(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+)?)\s+build/i // Redmi Phones + /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.+(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 + /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]], [ @@ -702,10 +702,10 @@ /android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i // NextBook Tablets ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [ - /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i + /android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones - /android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i // LvTel Phones + /android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i // LvTel Phones ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets @@ -810,7 +810,7 @@ /microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes) ], [NAME, VERSION], [ /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT - /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i, // Windows Phone + /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i, // Windows Phone /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [ /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i @@ -819,13 +819,13 @@ // Mobile/Embedded OS /\((bb)(10);/i // BlackBerry 10 ], [[NAME, 'BlackBerry'], VERSION], [ - /(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry + /(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\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i, // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki /linux;.+(sailfish);/i // Sailfish OS ], [NAME, VERSION], [ - /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian + /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i // Symbian ], [[NAME, 'Symbian'], VERSION], [ /\((series40);/i // Series 40 ], [NAME], [ @@ -836,24 +836,24 @@ /(nintendo|playstation)\s([wids34portablevu]+)/i, // Nintendo/Playstation // GNU/Linux based - /(mint)[\/\s\(]?(\w+)*/i, // Mint + /(mint)[\/\s\(]?(\w*)/i, // Mint /(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux - /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i, + /(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i, // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus - /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux - /(gnu)\s?([\w\.]+)*/i // GNU + /(hurd|linux)\s?([\w\.]*)/i, // Hurd/Linux + /(gnu)\s?([\w\.]*)/i // GNU ], [NAME, VERSION], [ /(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS ], [[NAME, 'Chromium OS'], VERSION],[ // Solaris - /(sunos)\s?([\w\.]+\d)*/i // Solaris + /(sunos)\s?([\w\.\d]*)/i // Solaris ], [[NAME, 'Solaris'], VERSION], [ // BSD based - /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly + /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ /(haiku)\s(\w+)/i // Haiku @@ -863,16 +863,16 @@ /ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i // iOS ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ - /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, + /(mac\sos\sx)\s?([\w\s\.]*)/i, /(macintosh|mac(?=_powerpc)\s)/i // Mac OS ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ // Other - /((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris - /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX + /((?:open)?solaris)[\/\s-]?([\w\.]*)/i, // Solaris + /(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i, // AIX /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS - /(unix)\s?([\w\.]+)*/i // UNIX + /(unix)\s?([\w\.]*)/i // UNIX ], [NAME, VERSION] ] }; From a795cf83c40fb0735dc5b292cca81ff390845b1a Mon Sep 17 00:00:00 2001 From: gulpin Date: Thu, 29 Mar 2018 16:41:58 +0900 Subject: [PATCH 122/170] mark license comment as important --- 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 9cc170e..42fe5ac 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,4 +1,4 @@ -/** +/*! * UAParser.js v0.7.17 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js From 9ceb402834533ac71480ddac7f252daa46d8922b Mon Sep 17 00:00:00 2001 From: Shreedhar Date: Mon, 2 Apr 2018 19:52:18 +0530 Subject: [PATCH 123/170] fix: wrong browser name returns for edge browsers on mobiles --- 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 841dd7d..0402fba 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -261,7 +261,7 @@ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ - /(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge + /(edge|edgeios|edgea)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [NAME, VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex From 84bfaaf22521001754a237ee64b35aeba985d4ea Mon Sep 17 00:00:00 2001 From: Shreedhar Date: Mon, 2 Apr 2018 20:09:57 +0530 Subject: [PATCH 124/170] updated ua string for ios --- 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 0402fba..1b67403 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -261,7 +261,7 @@ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ - /(edge|edgeios|edgea)\/((\d+)?[\w\.]+)/i // Microsoft Edge + /(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [NAME, VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex From 0c6ae1a1e37e22fdefc824ecd5653d6cfb09d61b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 21 Apr 2018 16:10:42 -0700 Subject: [PATCH 125/170] Readme typo: missing "be more" --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index ed58201..7efebe2 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not accurate than using feature detection. + A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not be more accurate than using feature detection. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM downloads](https://img.shields.io/npm/dw/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) From 3ed9d3f4ffc9fa602e228d8e4e8a03d1a80156ad Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Mon, 23 Apr 2018 09:36:11 -0400 Subject: [PATCH 126/170] #311 - Add support for QQBrowserLite --- 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 9cc170e..d56f2fe 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -280,6 +280,9 @@ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ + /(qqbrowserlite)\/([\w\.]+)/i // QQBrowserLite + ], [NAME, VERSION], [ + /(QQ)\/([\d\.]+)/i // QQ, aka ShouQ ], [NAME, VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index 0da3d81..2d41879 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1008,5 +1008,15 @@ "version" : "30.1.161623614", "major" : "30" } + }, + { + "desc" : "QQBrowserLite", + "ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14 QQBrowserLite/1.1.0", + "expect" : + { + "name" : "QQBrowserLite", + "version" : "1.1.0", + "major" : "1" + } } ] From 4790f944bf3637f132d7897b4300e5bee311c9a3 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Mon, 23 Apr 2018 09:37:13 -0400 Subject: [PATCH 127/170] Update README --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 8e3436c..6eb8860 100644 --- a/readme.md +++ b/readme.md @@ -35,8 +35,8 @@ Epiphany, Fennec, Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], -PhantomJS, Phoenix, Polaris, QQBrowser, Quark, RockMelt, Silk, Skyfire, SeaMonkey, Sleipnir, -SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex +PhantomJS, Phoenix, Polaris, QQBrowser, QQBrowserLite, Quark, RockMelt, Silk, Skyfire, SeaMonkey, +Sleipnir, SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex # 'browser.version' determined dynamically ``` From fb92a46479a0c571e6ad98e94877de369b56cb43 Mon Sep 17 00:00:00 2001 From: yuanyang Date: Wed, 25 Apr 2018 12:02:19 +0800 Subject: [PATCH 128/170] =?UTF-8?q?add=20Sogou=20Browser=E3=80=81LieBao=20?= =?UTF-8?q?Browser=E3=80=81Baidu=20Browser=E3=80=812345=20Browser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 12 ++++++++++++ test/browser-test.json | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 9d2ae4d..991d6a4 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.17",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.17",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, 25 Apr 2018 12:02:19 +0800 Subject: [PATCH 129/170] =?UTF-8?q?add=20Sogou=20Browser=E3=80=81LieBao=20?= =?UTF-8?q?Browser=E3=80=81Baidu=20Browser=E3=80=812345=20Browser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/ua-parser.min.js | 2 +- dist/ua-parser.pack.js | 2 +- src/ua-parser.js | 12 ++++++++++++ test/browser-test.json | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index 9d2ae4d..991d6a4 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.17",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.17",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: Sun, 6 May 2018 21:05:30 +0700 Subject: [PATCH 130/170] Fix #271 --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 70d8856..dbd59d8 100644 --- a/readme.md +++ b/readme.md @@ -79,7 +79,7 @@ Fedora, Firefox OS, FreeBSD, Debian, DragonFly, 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 +Ubuntu, Unix, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk # 'os.version' determined dynamically ``` From a3f5efa68091ab812471b2e6828479c92fa27fa8 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 6 May 2018 22:10:39 +0700 Subject: [PATCH 131/170] Fix #212: Detect LINE --- src/ua-parser.js | 4 ++++ test/browser-test.json | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 2aa68bb..60f5654 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -307,6 +307,10 @@ /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android ], [VERSION, [NAME, 'Facebook']], [ + /safari\s(line)\/([\w\.]+)/i, // Line App for iOS + /android.+(line)\/([\w\.]+)\/iab/i // Line App for Android + ], [NAME, VERSION], [ + /headlesschrome(?:\/([\w\.]+)|\s)/i // Chrome Headless ], [VERSION, [NAME, 'Chrome Headless']], [ diff --git a/test/browser-test.json b/test/browser-test.json index c98d169..8deb980 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -439,6 +439,26 @@ "major" : "3" } }, + { + "desc" : "LINE on Android", + "ua" : "Mozilla/5.0 (Linux; Android 5.0; ASUS_Z00AD Build/LRX21V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.81 Mobile Safari/537.36 Line/6.5.1/IAB", + "expect" : + { + "name" : "Line", + "version" : "6.5.1", + "major" : "6" + } + }, + { + "desc" : "LINE on iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Mobile/15D100 Safari Line/8.4.1", + "expect" : + { + "name" : "Line", + "version" : "8.4.1", + "major" : "8" + } + }, { "desc" : "Lunascape", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090804 Firefox/3.5.2 Lunascape/5.1.4.5", From 93affc671cd0fe92f415b4bc186ddd7adee378e4 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 6 May 2018 22:16:36 +0700 Subject: [PATCH 132/170] Replace donation button --- readme.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index dbd59d8..08ff9dd 100644 --- a/readme.md +++ b/readme.md @@ -7,8 +7,6 @@ [![NPM](https://img.shields.io/npm/v/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) [![Bower](https://img.shields.io/bower/v/ua-parser-js.svg)](https://bower.io/) [![CDNJS](https://img.shields.io/cdnjs/v/UAParser.js.svg)](https://cdnjs.com/libraries/UAParser.js) -[![Gratipay](https://img.shields.io/gratipay/team/UAParser.js.svg)](https://gratipay.com/UAParser.js) -[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/3867907/faisalmanua-parser-js-on-GitHub) * Author : Faisal Salman <> * Demo : http://faisalman.github.io/ua-parser-js @@ -310,14 +308,14 @@ $ npm run build Do you use & like UAParser.js but you don’t find a way to show some love? If yes, please consider donating to support this project. Otherwise, no worries, regardless of whether there is support or not, I will keep maintaining this project. Still, if you buy me a cup of coffee I would be more than happy though :) -[![Support via Pledgie](https://pledgie.com/campaigns/34252.png?skin_name=chrome)](https://pledgie.com/campaigns/34252) +[![Support via PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.me/faisalman/) # License Dual licensed under GPLv2 or MIT -Copyright © 2012-2016 Faisal Salman <> +Copyright © 2012-2018 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 From 0059eef770da5466c6d6d51e6f5ed70eae63a713 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 6 May 2018 22:26:16 +0700 Subject: [PATCH 133/170] Fix #293: Detect ARM on ChromeOS --- src/ua-parser.js | 2 +- test/cpu-test.json | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 60f5654..6bd8f36 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -508,7 +508,7 @@ /(sun4\w)[;\)]/i // SPARC ], [[ARCHITECTURE, 'sparc']], [ - /((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i + /((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+[;l]))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC ], [[ARCHITECTURE, util.lowerize]] ], diff --git a/test/cpu-test.json b/test/cpu-test.json index 8e9befc..f42ee76 100644 --- a/test/cpu-test.json +++ b/test/cpu-test.json @@ -47,6 +47,14 @@ "architecture" : "arm" } }, + { + "desc" : "ARMv7", + "ua" : "Mozilla/5.0 (X11; CrOS armv7l 9765.85.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.123 Safari/537.36", + "expect" : + { + "architecture" : "arm" + } + }, { "desc" : "Pocket PC", "ua" : "Opera/9.7 (Windows Mobile; PPC; Opera Mobi/35166; U; en) Presto/2.2.1", From 8fdc32f5b829ac7878d43390063c190c1c84ba61 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 6 May 2018 22:41:38 +0700 Subject: [PATCH 134/170] Fix #295: Detect Amazon Fire TV --- src/ua-parser.js | 2 ++ test/device-test.json | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 6bd8f36..a3dc8b6 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -536,6 +536,8 @@ ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ /(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i // Fire Phone ], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [ + /android.+aft([bms])\sbuild/i // Fire TV + ], [MODEL, [VENDOR, 'Amazon'], [TYPE, SMARTTV]], [ /\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone ], [MODEL, VENDOR, [TYPE, MOBILE]], [ diff --git a/test/device-test.json b/test/device-test.json index 3fa7503..340f2c2 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -825,6 +825,15 @@ "type": "tablet" } }, + { + "desc": "Amazon Fire TV", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; AFTB Build/JDQ39) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.173 Mobile Safari/537.22", + "expect": { + "vendor": "Amazon", + "model": "B", + "type": "smarttv" + } + }, { "desc": "Gigaset Tablet", "ua": "Mozilla/5.0 (Linux; Android 4.2.2; Gigaset QV830 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", From f5e0aa83eb027a2805844c118a09350e932c4ab1 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 8 May 2018 15:26:38 +0700 Subject: [PATCH 135/170] Fix #290: Add Device Model: Pixel 2 --- src/ua-parser.js | 2 +- test/device-test.json | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index a3dc8b6..f39a6d5 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -669,7 +669,7 @@ /android.+;\s(pixel c)\s/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ - /android.+;\s(pixel xl|pixel)\s/i // Google Pixel + /android.+;\s(pixel [xl2]{1,2}|pixel)\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 340f2c2..b8407f0 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -555,7 +555,15 @@ "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", + "expect": { + "vendor": "Google", + "model": "Pixel 2", + "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 14935877425a2e2af61f3e413918401aece50149 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 17 May 2018 06:19:13 +0700 Subject: [PATCH 136/170] Fix #317: Add missing warranty section of MIT license in readme.md --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index 08ff9dd..33e639e 100644 --- a/readme.md +++ b/readme.md @@ -326,3 +326,11 @@ subject to the following conditions: 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 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 55ffb10a5f17559923c990f47e64120a48c08ee7 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 23 May 2018 20:28:47 +0700 Subject: [PATCH 137/170] Fix #259: Avoid collision when using $.ua --- 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 f39a6d5..3e8ede1 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1077,7 +1077,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) { + if (typeof $ !== UNDEF_TYPE && !$.ua) { var parser = new UAParser(); $.ua = parser.getResult(); $.ua.get = function () { From 8c2607aac9ad9692e9c100f594b92a749d824750 Mon Sep 17 00:00:00 2001 From: Cyrille David Date: Thu, 26 Jul 2018 11:36:10 +0200 Subject: [PATCH 138/170] Extract browser names from test/browser-test.json --- browser_names_extraction.txt | 82 ++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 browser_names_extraction.txt diff --git a/browser_names_extraction.txt b/browser_names_extraction.txt new file mode 100644 index 0000000..4770bc0 --- /dev/null +++ b/browser_names_extraction.txt @@ -0,0 +1,82 @@ +2345Explorer, +Android Browser, +Arora, +Avant , +BIDUBrowser, +Basilisk, +Bolt, +Bowser, +Camino, +Chimera, +Chrome Headless, +Chrome WebView, +Chrome, +Chromium, +Dillo, +Dolphin, +Doris, +Edge, +Epiphany, +Facebook, +Fennec, +Firebird, +Firefox, +Flock, +GSA, +GoBrowser, +IE, +IEMobile, +IceCat, +Iceape, +Iceweasel, +Iridium, +K-Meleon, +Kindle, +Konqueror, +LBBROWSER +Line, +Lunascape, +Lynx, +MIUI Browser, +Maemo Browser, +Maxthon, +MetaSr +Midori, +Minimo, +Mobile Safari, +Mosaic, +Mozilla, +NetFront, +Netscape, +NokiaBrowser, +Oculus Browser, +OmniWeb, +Opera Coast, +Opera Mini, +Opera Mobi, +Opera Tablet, +Opera, +PaleMoon, +PhantomJS, +Phoenix, +Polaris, +Puffin, +QQ, +QQBrowser, +QQBrowserLite, +RockMelt, +Safari, +Samsung Browser, +SeaMonkey, +Silk, +Skyfire, +Slim, +Swiftfox, +Tizen Browser, +UCBrowser, +Vivaldi, +Waterfox, +WeChat, +Yandex, +baidu, +iCab, From 58c71a019efa75c8cf83cad64e38653853d97a83 Mon Sep 17 00:00:00 2001 From: Cyrille David Date: Thu, 26 Jul 2018 11:40:11 +0200 Subject: [PATCH 139/170] Merge README list into extraction --- browser_names_extraction.txt | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/browser_names_extraction.txt b/browser_names_extraction.txt index 4770bc0..edef6e6 100644 --- a/browser_names_extraction.txt +++ b/browser_names_extraction.txt @@ -1,17 +1,23 @@ 2345Explorer, +Amaya, Android Browser, Arora, -Avant , +Avant, BIDUBrowser, +Baidu, Basilisk, +Blazer, Bolt, Bowser, Camino, Chimera, Chrome Headless, Chrome WebView, +Chrome [WebView], Chrome, Chromium, +Comodo Dragon, +Conkeror, Dillo, Dolphin, Doris, @@ -24,21 +30,29 @@ Firefox, Flock, GSA, GoBrowser, +ICE Browser, IE, IEMobile, +IE[Mobile], +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, @@ -47,7 +61,10 @@ Mobile Safari, Mosaic, Mozilla, NetFront, +NetSurf, +Netfront, Netscape, +Nokia, NokiaBrowser, Oculus Browser, OmniWeb, @@ -55,6 +72,7 @@ Opera Coast, Opera Mini, Opera Mobi, Opera Tablet, +Opera [Mini/Mobi/Tablet], Opera, PaleMoon, PhantomJS, @@ -64,19 +82,26 @@ Puffin, QQ, QQBrowser, QQBrowserLite, +Quark, RockMelt, Safari, Samsung Browser, SeaMonkey, Silk, Skyfire, +Sleipnir, Slim, +SlimBrowser, Swiftfox, Tizen Browser, +Tizen, UCBrowser, Vivaldi, Waterfox, WeChat, +Yandex Yandex, +[Mobile] Safari, baidu, iCab, +w3m, From 565d67bbb68cb7abd203a3c07c094d08da46eaa3 Mon Sep 17 00:00:00 2001 From: Cyrille David Date: Thu, 26 Jul 2018 11:42:45 +0200 Subject: [PATCH 140/170] Remove unconsistant (because outdated?) names Only remove names coming from README. --- browser_names_extraction.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/browser_names_extraction.txt b/browser_names_extraction.txt index edef6e6..5fa1412 100644 --- a/browser_names_extraction.txt +++ b/browser_names_extraction.txt @@ -13,11 +13,9 @@ Camino, Chimera, Chrome Headless, Chrome WebView, -Chrome [WebView], Chrome, Chromium, Comodo Dragon, -Conkeror, Dillo, Dolphin, Doris, @@ -33,7 +31,6 @@ GoBrowser, ICE Browser, IE, IEMobile, -IE[Mobile], IceApe, IceCat, IceDragon, @@ -64,7 +61,6 @@ NetFront, NetSurf, Netfront, Netscape, -Nokia, NokiaBrowser, Oculus Browser, OmniWeb, @@ -72,7 +68,6 @@ Opera Coast, Opera Mini, Opera Mobi, Opera Tablet, -Opera [Mini/Mobi/Tablet], Opera, PaleMoon, PhantomJS, @@ -94,14 +89,12 @@ Slim, SlimBrowser, Swiftfox, Tizen Browser, -Tizen, UCBrowser, Vivaldi, Waterfox, WeChat, Yandex Yandex, -[Mobile] Safari, baidu, iCab, -w3m, +w3m From b49865266c9139f5b732e2d4803aa71fa3f42e19 Mon Sep 17 00:00:00 2001 From: Cyrille David Date: Thu, 26 Jul 2018 11:46:52 +0200 Subject: [PATCH 141/170] Update browser names in README --- browser_names_extraction.txt | 100 ----------------------------------- readme.md | 22 ++++---- 2 files changed, 13 insertions(+), 109 deletions(-) delete mode 100644 browser_names_extraction.txt diff --git a/browser_names_extraction.txt b/browser_names_extraction.txt deleted file mode 100644 index 5fa1412..0000000 --- a/browser_names_extraction.txt +++ /dev/null @@ -1,100 +0,0 @@ -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, -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, -RockMelt, -Safari, -Samsung Browser, -SeaMonkey, -Silk, -Skyfire, -Sleipnir, -Slim, -SlimBrowser, -Swiftfox, -Tizen Browser, -UCBrowser, -Vivaldi, -Waterfox, -WeChat, -Yandex -Yandex, -baidu, -iCab, -w3m diff --git a/readme.md b/readme.md index 33e639e..66159bd 100644 --- a/readme.md +++ b/readme.md @@ -27,15 +27,19 @@ ``` # Possible 'browser.name': -Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Bowser, Camino, Chimera, -Chrome [WebView], Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, -Epiphany, Fennec, Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, -IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, -Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, -Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], -PhantomJS, Phoenix, Polaris, QQBrowser, QQBrowserLite, Quark, RockMelt, Silk, Skyfire, -SeaMonkey, Sleipnir, SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, Waterfox, -WeChat, Yandex +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, 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, RockMelt, Safari, Samsung Browser, SeaMonkey, +Silk, Skyfire, Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, UCBrowser, +Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m # 'browser.version' determined dynamically ``` From 76be1cb328a2b9c501ef769c14706eeed7923bcf Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Sep 2018 14:21:36 +0700 Subject: [PATCH 142/170] Fix test for Meizu device --- test/device-test.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/device-test.json b/test/device-test.json index f18ca1c..340ddb9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -138,7 +138,7 @@ "ua" : "Mozilla/5.0 (X11; Linux; Android 5.1; MZ-M3s Build/LMY47I) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrom/45.0.2454.94 Mobile Safari/537.36", "expect" : { - "vendor" : "MZ", + "vendor" : "Meizu", "model" : "M3s", "type" : "mobile" } From a142c0ee942a1669a802ec0f78d70168aeaa6616 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 8 Sep 2018 16:13:45 +0700 Subject: [PATCH 143/170] Update filesize description --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 66159bd..a3abd64 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not be more accurate than using feature detection. + A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~17KB when minified / ~6KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not be more accurate than using feature detection. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM downloads](https://img.shields.io/npm/dw/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) From fc4c0df095fb8b7e7b0fb656f0c76f6b394532d3 Mon Sep 17 00:00:00 2001 From: Matthew Origer Date: Fri, 14 Sep 2018 15:57:26 -0500 Subject: [PATCH 144/170] add Brave browser --- src/ua-parser.js | 3 +++ test/browser-test.json | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 8c306e4..dd82835 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -280,6 +280,9 @@ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ + /(brave)\/([\w\.]+)/i // Brave browser + ], [[NAME, 'Brave'], VERSION], [ + /(qqbrowserlite)\/([\w\.]+)/i // QQBrowserLite ], [NAME, VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index 8deb980..fd3dd2e 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1051,7 +1051,7 @@ "expect" : { "name" : "BIDUBrowser", - "version" : "8.7", + "version" : "8.7", "major" : "8" } }, @@ -1074,5 +1074,15 @@ "version" : "1.1.0", "major" : "1" } + }, + { + "desc" : "Brave Browser", + "ua" : "Brave/4.5.16 CFNetwork/893.13.1 Darwin/17.3.0 (x86_64)", + "expect" : + { + "name" : "Brave", + "version" : "4.5.16", + "major" : "4" + } } ] From eb83122c5e6ddb1467f668764b58d091451e4e11 Mon Sep 17 00:00:00 2001 From: Dario Vladovic Date: Sun, 16 Sep 2018 11:40:03 +0200 Subject: [PATCH 145/170] Update .gitignore --- .gitignore | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 154d1f0..ca8c34e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ npm-debug.log + ### vim ### .*.s[a-w][a-z] *.un~ @@ -8,17 +9,20 @@ Session.vim *~ .versions +### editors ### +.vscode +.idea +*.sublime-* + ### OSX ### .DS_Store .AppleDouble .LSOverride Icon - # Thumbnails ._* # Files that might appear on external disk .Spotlight-V100 .Trashes -.idea From 384bafe31c3a892e512e95fbf6aa7703ce4398b7 Mon Sep 17 00:00:00 2001 From: Dario Vladovic Date: Sun, 16 Sep 2018 11:46:11 +0200 Subject: [PATCH 146/170] Prevent package-lock creation --- .npmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false From 01eab85f7da213e58e48fa0b454cb8a9c77536b4 Mon Sep 17 00:00:00 2001 From: Dario Vladovic Date: Sun, 16 Sep 2018 12:07:18 +0200 Subject: [PATCH 147/170] Add Opera Touch & Firefox Focus, fix Microsoft Edge --- src/ua-parser.js | 11 ++++++++--- test/browser-test.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 3e8ede1..1b9357b 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -261,7 +261,7 @@ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ - /(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i // Microsoft Edge + /(edge|edgios|edgea|edga)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [[NAME, 'Edge'], VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex @@ -270,8 +270,13 @@ /(puffin)\/([\w\.]+)/i // Puffin ], [[NAME, 'Puffin'], VERSION], [ - /((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i - // UCBrowser + /(focus)\/([\w\.]+)/i // Firefox Focus + ], [[NAME, 'Firefox Focus'], VERSION], [ + + /(opt)\/([\w\.]+)/i // Opera Touch + ], [[NAME, 'Opera Touch'], VERSION], [ + + /((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i // UCBrowser ], [[NAME, 'UCBrowser'], VERSION], [ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon diff --git a/test/browser-test.json b/test/browser-test.json index 8deb980..f6e53dd 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -319,6 +319,15 @@ "major" : "1" } }, + { + "desc": "Firefox Focus", + "ua": "Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/6.1.1 Chrome/68.0.3440.91 Mobile Safari/537.36", + "expect": { + "name": "Firefox Focus", + "version": "6.1.1", + "major": "6" + } + }, { "desc" : "Flock", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008100716 Firefox/3.0.3 Flock/2.0", @@ -719,6 +728,16 @@ "major" : "5" } }, + { + "desc" : "Opera Touch", + "ua" : "Mozilla/5.0 (Linux; Android 7.0; Lenovo P2a42 Build/NRD90N) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36 OPT/1.10.33", + "expect" : + { + "name" : "Opera Touch", + "version" : "1.10.33", + "major" : "1" + } + }, { "desc" : "PhantomJS", "ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34", @@ -979,6 +998,16 @@ "major" : "12" } }, + { + "desc" : "Microsoft Edge", + "ua" : "Mozilla/5.0 (Linux; Android 7.0; Lenovo P2a42 Build/NRD90N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.123 Mobile Safari/537.36 EdgA/42.0.0.2314", + "expect" : + { + "name" : "Edge", + "version" : "42.0.0.2314", + "major" : "42" + } + }, { "desc" : "Iridium", "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/43.8 Safari/537.36 Chrome/43.0.2357.132", From bf79eabecccf2563366708121d5379db0f4243c9 Mon Sep 17 00:00:00 2001 From: Dario Vladovic Date: Sun, 16 Sep 2018 12:19:47 +0200 Subject: [PATCH 148/170] Improve Microsoft Edge detection --- 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 1b9357b..7181eee 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -261,7 +261,7 @@ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ - /(edge|edgios|edgea|edga)\/((\d+)?[\w\.]+)/i // Microsoft Edge + /(edge|edgios|edga)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [[NAME, 'Edge'], VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex From 964431ef89372d489aab34f7d6b32b9b71f54590 Mon Sep 17 00:00:00 2001 From: Eric Redon Date: Thu, 27 Sep 2018 17:50:54 +0200 Subject: [PATCH 149/170] Fix browser detection of Edge on Android --- src/ua-parser.js | 2 +- test/browser-test.json | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 8c306e4..99389be 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -261,7 +261,7 @@ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ - /(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i // Microsoft Edge + /(edge|edgios|edga)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [[NAME, 'Edge'], VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex diff --git a/test/browser-test.json b/test/browser-test.json index 8deb980..4afe308 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -979,6 +979,26 @@ "major" : "12" } }, + { + "desc" : "Microsoft Edge on iOS", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 EdgiOS/42.1.1.0 Mobile/15F79 Safari/605.1.15", + "expect" : + { + "name" : "Edge", + "version" : "42.1.1.0", + "major" : "42" + } + }, + { + "desc" : "Microsoft Edge on Android", + "ua" : "Mozilla/5.0 (Linux; Android 8.0.0; G8441 Build/47.1.A.12.270) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.123 Mobile Safari/537.36 EdgA/42.0.0.2529", + "expect" : + { + "name" : "Edge", + "version" : "42.0.0.2529", + "major" : "42" + } + }, { "desc" : "Iridium", "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/43.8 Safari/537.36 Chrome/43.0.2357.132", From 95fcd3f672d7d533f02b753a57ca90f25b0eff64 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 13 Oct 2018 10:01:51 +0700 Subject: [PATCH 150/170] Fix #321: Add a LICENSE to be recognized by GitHub API --- license.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 license.md diff --git a/license.md b/license.md new file mode 100644 index 0000000..1f3ef51 --- /dev/null +++ b/license.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2018 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: + +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 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 4cc29dd88c75f5380968ab323806aac824da5ee6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 21 Oct 2018 15:21:03 +0700 Subject: [PATCH 151/170] Update readme: using TypeScript --- readme.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index a3abd64..7a0cf8c 100644 --- a/readme.md +++ b/readme.md @@ -25,7 +25,7 @@ * `getBrowser()` * returns `{ name: '', version: '' }` -``` +```sh # Possible 'browser.name': 2345Explorer, Amaya, Android Browser, Arora, Avant, BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Bowser, Camino, Chimera, Chrome Headless, @@ -47,7 +47,7 @@ Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m * `getDevice()` * returns `{ model: '', type: '', vendor: '' }` -``` +```sh # Possible 'device.type': console, mobile, tablet, smarttv, wearable, embedded @@ -63,7 +63,7 @@ Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE * `getEngine()` * returns `{ name: '', version: '' }` -``` +```sh # Possible 'engine.name' Amaya, EdgeHTML, Gecko, iCab, KHTML, Links, Lynx, NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit @@ -74,7 +74,7 @@ Tasman, Trident, w3m, WebKit * `getOS()` * returns `{ name: '', version: '' }` -``` +```sh # Possible 'os.name' AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, @@ -89,7 +89,7 @@ Ubuntu, Unix, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk * `getCPU()` * returns `{ architecture: '' }` -``` +```sh # Possible 'cpu.architecture' 68k, amd64, arm[64], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64] ``` @@ -233,6 +233,14 @@ $ bower install ua-parser-js $ meteor add faisalman:ua-parser-js ``` +## Using TypeScript + +```sh +$ npm install --save @types/ua-parser-js +# Download TS type definition from DefinitelyTyped repository: +# https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ua-parser-js +``` + ## Using CLI ```sh From 7dbf0c68673a9e541a151fb3228e4cc9ebc5f8ff Mon Sep 17 00:00:00 2001 From: Alvin Portillo Date: Mon, 10 Sep 2018 10:55:08 -0700 Subject: [PATCH 152/170] Detect Essential Phone (PH-1) --- src/ua-parser.js | 3 +++ test/device-test.json | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 6ef423e..bfa4279 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -739,6 +739,9 @@ /android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i // LvTel Phones ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [ + /android.+;\s(PH-1)\s/i + ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [ // Essential PH-1 + /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ diff --git a/test/device-test.json b/test/device-test.json index 340ddb9..e037a87 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -25,6 +25,15 @@ "type": "undefined" } }, + { + "desc": "Essential PH-1", + "ua": "Mozilla/5.0 (Linux; Android 9; PH-1 Build/PPR1.180905.036) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.86 Mobile Safari/537.36", + "expect": { + "vendor": "Essential", + "model": "PH-1", + "type": "mobile" + } + }, { "desc": "HTC Evo Shift 4G", "ua": "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0", From 6c2a767e32fa7f00e976452a570a0d1e00786a54 Mon Sep 17 00:00:00 2001 From: Alvin Portillo Date: Mon, 22 Oct 2018 11:18:09 -0700 Subject: [PATCH 153/170] Add Pixel 2 XL, Pixel 3, Pixel 3 XL Device Models --- package.json | 1 + src/ua-parser.js | 2 +- test/device-test.json | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 119a0ae..6b25f3e 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "Aamir Poonawalla ", "Admas ", "algenon ", + "Alvin Portillo ", "Andrea Vaghi ", "Anton Zhiyanov ", "Arturo Mejia ", diff --git a/src/ua-parser.js b/src/ua-parser.js index 6ef423e..3d8bce8 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -677,7 +677,7 @@ /android.+;\s(pixel c)\s/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ - /android.+;\s(pixel [xl2]{1,2}|pixel)\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 340ddb9..42668ef 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -584,6 +584,33 @@ "type": "mobile" } }, + { + "desc": "Google Pixel 2 XL", + "ua": "Mozilla/5.0 (Linux; Android 8.1.0; Pixel 2 XL Build/OPM1.171019.013) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 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", + "expect": { + "vendor": "Google", + "model": "Pixel 3", + "type": "mobile" + } + }, + { + "desc": "Google Pixel 3 XL", + "ua": "Mozilla/5.0 (Linux; Android 9; Pixel 3 XL Build/PD1A.180720.030) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 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 2c7e61f9a219a7bac85ce080235e3ad5d4d8b85e Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 26 Oct 2018 00:33:06 +0700 Subject: [PATCH 154/170] Add Device: Essential & Google Pixel --- readme.md | 12 ++++++------ test/device-test.json | 11 ++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index 7a0cf8c..06eaaee 100644 --- a/readme.md +++ b/readme.md @@ -39,7 +39,7 @@ NokiaBrowser, Oculus Browser, OmniWeb, Opera Coast, Opera Mini, Opera Mobi, Opera Tablet, Opera, PaleMoon, PhantomJS, Phoenix, Polaris, Puffin, QQ, QQBrowser, QQBrowserLite, Quark, RockMelt, Safari, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, UCBrowser, -Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m +Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m, ... # 'browser.version' determined dynamically ``` @@ -52,10 +52,10 @@ Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m console, mobile, tablet, smarttv, wearable, embedded # Possible 'device.vendor': -Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, GeeksPhone, -Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, -Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm, Panasonic, Pebble, Polytron, RIM, -Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE +Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, Essential, +GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola, +Nexian, Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm, Panasonic, Pebble, Polytron, +RIM, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE, ... # 'device.model' determined dynamically ``` @@ -81,7 +81,7 @@ Fedora, Firefox OS, FreeBSD, Debian, DragonFly, 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 +Ubuntu, Unix, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk, ... # 'os.version' determined dynamically ``` diff --git a/test/device-test.json b/test/device-test.json index 8ed2fc1..31d6e6a 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -566,6 +566,15 @@ "type": "tablet" } }, + { + "desc": "Google Pixel C", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; Pixel C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.64 Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel C", + "type": "tablet" + } + }, { "desc": "Google Pixel", "ua": "Mozilla/5.0 (Linux; Android 7.1; Pixel Build/NDE63V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", @@ -576,7 +585,7 @@ } }, { - "desc": "Google Pixel", + "desc": "Google Pixel XL", "ua": "Mozilla/5.0 (Linux; Android 7.1; Pixel XL Build/NDE63X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.85 Mobile Safari/537.36", "expect": { "vendor": "Google", From 93e17524c02a85430a5c9c29f09ca7696fd04c58 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 26 Oct 2018 00:37:15 +0700 Subject: [PATCH 155/170] Add OS: Fuchsia --- src/ua-parser.js | 4 ++-- test/os-test.json | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 2739fe0..fef4b83 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -904,8 +904,8 @@ // Other /((?:open)?solaris)[\/\s-]?([\w\.]*)/i, // Solaris /(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i, // AIX - /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, - // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS + /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i, + // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS/Fuchsia /(unix)\s?([\w\.]*)/i // UNIX ], [NAME, VERSION] ] diff --git a/test/os-test.json b/test/os-test.json index 86aa837..5dc4c1d 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -433,11 +433,20 @@ }, { "desc" : "Chromium OS", - "ua" : "", + "ua" : "Mozilla/5.0 (X11; CrOS x86_64 10575.58.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", "expect" : { - "name" : "", - "version" : "" + "name" : "Chromium OS", + "version" : "10575.58.0" + } + }, + { + "desc" : "Fuchsia", + "ua" : "Mozilla/5.0 (X11; Fuchsia x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3557.0 Safari/537.36", + "expect" : + { + "name" : "Fuchsia", + "version" : "undefined" } }, { From 073c672af5fcdf96cc7858b164e8373ab737f8b1 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 26 Oct 2018 00:37:15 +0700 Subject: [PATCH 156/170] Add OS: Fuchsia --- readme.md | 2 +- src/ua-parser.js | 4 ++-- test/os-test.json | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 06eaaee..f7a3a5b 100644 --- a/readme.md +++ b/readme.md @@ -77,7 +77,7 @@ 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, Gentoo, GNU, Haiku, Hurd, iOS, +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, diff --git a/src/ua-parser.js b/src/ua-parser.js index 2739fe0..fef4b83 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -904,8 +904,8 @@ // Other /((?:open)?solaris)[\/\s-]?([\w\.]*)/i, // Solaris /(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i, // AIX - /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, - // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS + /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i, + // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS/Fuchsia /(unix)\s?([\w\.]*)/i // UNIX ], [NAME, VERSION] ] diff --git a/test/os-test.json b/test/os-test.json index 86aa837..5dc4c1d 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -433,11 +433,20 @@ }, { "desc" : "Chromium OS", - "ua" : "", + "ua" : "Mozilla/5.0 (X11; CrOS x86_64 10575.58.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", "expect" : { - "name" : "", - "version" : "" + "name" : "Chromium OS", + "version" : "10575.58.0" + } + }, + { + "desc" : "Fuchsia", + "ua" : "Mozilla/5.0 (X11; Fuchsia x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3557.0 Safari/537.36", + "expect" : + { + "name" : "Fuchsia", + "version" : "undefined" } }, { From a400d2163ccc314c915866ddc2bb49fe8953b4dc Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 26 Oct 2018 00:52:27 +0700 Subject: [PATCH 157/170] Fix #347 Pixel C in Chrome 70 --- 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 fef4b83..1212bbf 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -674,7 +674,7 @@ /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ - /android.+;\s(pixel c)\s/i // Google Pixel C + /android.+;\s(pixel c)[\s)]/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ /android.+;\s(pixel( [23])?( xl)?)\s/i // Google Pixel From 7f8f357995b0ee9974528d8dc4a84ce584dd2097 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 26 Oct 2018 01:15:35 +0700 Subject: [PATCH 158/170] Remove Node 0.10 from Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4d23aa0..fbc68cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - stable - - "0.10" + - lts/* notifications: email: false From 7aca357879ba18ec2e57d36403d391c860a1be2e Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 26 Oct 2018 01:35:15 +0700 Subject: [PATCH 159/170] Fix #328 New release 0.7.19 --- 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 52bd54f..c83d0a9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ua-parser-js", - "version": "0.7.18", + "version": "0.7.19", "authors": [ "Faisal Salman " ], diff --git a/dist/ua-parser.min.js b/dist/ua-parser.min.js index ad74810..c12f2ef 100644 --- a/dist/ua-parser.min.js +++ b/dist/ua-parser.min.js @@ -1,9 +1,9 @@ /*! - * UAParser.js v0.7.18 + * UAParser.js v0.7.19 * 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 */ -(function(window,undefined){"use strict";var LIBVERSION="0.7.18",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.18",o="",r="?",n="function",a="undefined",d="object",t="string",l="major",w="model",u="name",c="type",m="vendor",p="version",b="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 (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 1212bbf..a6ccb3f 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,5 +1,5 @@ /*! - * UAParser.js v0.7.18 + * UAParser.js v0.7.19 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * @@ -16,7 +16,7 @@ ///////////// - var LIBVERSION = '0.7.18', + var LIBVERSION = '0.7.19', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', From f6ef14d0cdc1663b1a54358e2e5c65d09b7b5b31 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 9 Nov 2018 12:29:19 +0700 Subject: [PATCH 160/170] Fix #349 Sony w/ Chrome >=70 --- 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 a6ccb3f..b8da7e4 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -567,7 +567,7 @@ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony /(sony)?(?:sgp.+)\sbuild\//i ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [ - /android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i + /android.+\s([c-g]\d{4}|so[-l]\w+)(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i ], [MODEL, [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /\s(ouya)\s/i, // Ouya diff --git a/test/device-test.json b/test/device-test.json index 31d6e6a..ecae4eb 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -342,6 +342,15 @@ "type": "smarttv" } }, + { + "desc": "Sony G8141 (Xperia XZ Premium)", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; G8141) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "G8141", + "type": "mobile" + } + }, { "desc": "Sony C5303 (Xperia SP)", "ua": "Mozilla/5.0 (Linux; Android 4.3; C5303 Build/12.1.A.1.205) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36", From 3a5a701375ba263a752a2b8df9353fd95f7f9e77 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Nov 2018 12:53:26 +0700 Subject: [PATCH 161/170] Fix #246 #247 - Add Engine: Blink --- src/ua-parser.js | 3 +++ test/engine-test.json | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index b8da7e4..52abbca 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -828,6 +828,9 @@ /windows.+\sedge\/([\w\.]+)/i // EdgeHTML ], [VERSION, [NAME, 'EdgeHTML']], [ + /webkit\/537\.36.+chrome\/(?!27)/i // Blink + ], [[NAME, 'Blink']], [ + /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links diff --git a/test/engine-test.json b/test/engine-test.json index 875057d..6bbd623 100644 --- a/test/engine-test.json +++ b/test/engine-test.json @@ -1,4 +1,13 @@ [ + { + "desc" : "Blink", + "ua" : "Mozilla/5.0 (Linux; Android 7.0; SM-G920I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/3.4.9 SamsungBrowser/4.0 Chrome/57.0.2987.146 Mobile VR Safari/537.36", + "expect" : + { + "name" : "Blink", + "version" : "undefined" + } + }, { "desc" : "EdgeHTML", "ua" : "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0", @@ -70,5 +79,14 @@ "name" : "WebKit", "version" : "533.19.4" } + }, + { + "desc" : "WebKit", + "ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/27.0.1453.110 Safari/537.36", + "expect" : + { + "name" : "WebKit", + "version" : "537.36" + } } ] From 7c5991a725e005f756297e36a11b2d11da2333e3 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Nov 2018 13:49:59 +0700 Subject: [PATCH 162/170] Fix #341: Detect Konqueror before Safari --- src/ua-parser.js | 4 +++- test/browser-test.json | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 52abbca..18170af 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -258,6 +258,9 @@ // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser ], [NAME, VERSION], [ + /(konqueror)\/([\w\.]+)/i // Konqueror + ], [[NAME, 'Konqueror'], VERSION], [ + /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ @@ -359,7 +362,6 @@ /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [ - /(konqueror)\/([\w\.]+)/i, // Konqueror /(webkit|khtml)\/([\w\.]+)/i ], [NAME, VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index f0626dc..ffe1d66 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -448,6 +448,16 @@ "major" : "3" } }, + { + "desc" : "Konqueror", + "ua" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.34 (KHTML, like Gecko) konqueror/5.0.97 Safari/534.34", + "expect" : + { + "name" : "Konqueror", + "version" : "5.0.97", + "major" : "5" + } + }, { "desc" : "LINE on Android", "ua" : "Mozilla/5.0 (Linux; Android 5.0; ASUS_Z00AD Build/LRX21V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.81 Mobile Safari/537.36 Line/6.5.1/IAB", From 61e5d24bb52cb42d821b53e8ee7808dea9a231f0 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Nov 2018 23:33:42 +0700 Subject: [PATCH 163/170] Add Engine: Goanna --- src/ua-parser.js | 3 ++- test/engine-test.json | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 18170af..a3610f4 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -834,7 +834,8 @@ ], [[NAME, 'Blink']], [ /(presto)\/([\w\.]+)/i, // Presto - /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m + /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, + // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab ], [NAME, VERSION], [ diff --git a/test/engine-test.json b/test/engine-test.json index 6bbd623..c1afba3 100644 --- a/test/engine-test.json +++ b/test/engine-test.json @@ -26,6 +26,15 @@ "version" : "2.0b9pre" } }, + { + "desc" : "Goanna", + "ua" : "Mozilla/5.0 (Windows NT 5.1; rv:38.9) Gecko/20100101 Goanna/2.2 Firefox/38.9 PaleMoon/26.5.0", + "expect" : + { + "name" : "Goanna", + "version" : "2.2" + } + }, { "desc" : "KHTML", "ua" : "Mozilla/5.0 (compatible; Konqueror/4.5; FreeBSD) KHTML/4.5.4 (like Gecko)", From ed1ccb3902eeb746491e10945369ef2d62197d3b Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 22 Nov 2018 23:40:26 +0700 Subject: [PATCH 164/170] Fix #340 - Add Browser: QupZilla, Falkon --- src/ua-parser.js | 4 ++-- test/browser-test.json | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index a3610f4..a0231bc 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -254,8 +254,8 @@ // Webkit/KHTML based /(rekonq)\/([\w\.]*)/i, // Rekonq - /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i - // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser + /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i + // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon ], [NAME, VERSION], [ /(konqueror)\/([\w\.]+)/i // Konqueror diff --git a/test/browser-test.json b/test/browser-test.json index ffe1d66..b98db59 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -289,6 +289,16 @@ "major" : "91" } }, + { + "desc" : "Falkon", + "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Falkon/3.0.0 Chrome/61.0.3163.140 Safari/537.36", + "expect" : + { + "name" : "Falkon", + "version" : "3.0.0", + "major" : "3" + } + }, { "desc" : "Firebird", "ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7", @@ -788,6 +798,16 @@ "major" : "7" } }, + { + "desc" : "QupZilla", + "ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.8.9 Safari/538.1", + "expect" : + { + "name" : "QupZilla", + "version" : "1.8.9", + "major" : "1" + } + }, { "desc" : "RockMelt", "ua" : "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) RockMelt/0.8.36.78 Chrome/7.0.517.44 Safari/534.7", From 213d2296df1f80ff2f2ecb9e4851baf9f8a2aae5 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 23 Nov 2018 00:17:42 +0700 Subject: [PATCH 165/170] Update list --- readme.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index f7a3a5b..fb356c3 100644 --- a/readme.md +++ b/readme.md @@ -30,16 +30,16 @@ 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, Fennec, Firebird, Firefox, Flock, GSA, GoBrowser, +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, RockMelt, Safari, Samsung Browser, SeaMonkey, -Silk, Skyfire, Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, UCBrowser, -Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m, ... +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, ... # 'browser.version' determined dynamically ``` @@ -65,8 +65,8 @@ RIM, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE, ... ```sh # Possible 'engine.name' -Amaya, EdgeHTML, Gecko, 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 ``` From 60c4c2b6931188e8b8266fc608678934f7d2d611 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 23 Nov 2018 00:38:19 +0700 Subject: [PATCH 166/170] Fix #252: Detection for HTC Desire 820 --- 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 a0231bc..b405ca2 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -588,7 +588,7 @@ /(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i // Lenovo tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ - /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC + /(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 diff --git a/test/device-test.json b/test/device-test.json index ecae4eb..a4fad68 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -34,6 +34,15 @@ "type": "mobile" } }, + { + "desc": "HTC Desire 820", + "ua": "Mozilla/5.0 (Linux; Android 6.0.1; HTC Desire 820 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36", + "expect": { + "vendor": "HTC", + "model": "Desire 820", + "type": "mobile" + } + }, { "desc": "HTC Evo Shift 4G", "ua": "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0", From 56978dec0a1889a5dc415d7daa24d5bf5603709e Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 23 Nov 2018 00:52:07 +0700 Subject: [PATCH 167/170] Fix #327: iPad identified as mobile when using UCBrowser --- 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 b405ca2..0cd1990 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -525,7 +525,7 @@ device : [[ - /\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook + /\((ipad|playbook);[\w\s\),;-]+(rim|apple)/i // iPad/PlayBook ], [MODEL, VENDOR, [TYPE, TABLET]], [ /applecoremedia\/[\w\.]+ \((ipad)/ // iPad diff --git a/test/device-test.json b/test/device-test.json index a4fad68..7f0b3b0 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -97,6 +97,15 @@ "type": "mobile" } }, + { + "desc": "iPad using UCBrowser", + "ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3", + "expect": { + "vendor": "Apple", + "model": "iPad", + "type": "tablet" + } + }, { "desc": "iPod", "ua": "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", From ce95d9ac170510f5ac69d66176b8901abb2eb065 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 23 Nov 2018 01:15:06 +0700 Subject: [PATCH 168/170] Fix #323 - Detect Asus ZenPad 10 --- 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 0cd1990..4aeb23e 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -563,7 +563,7 @@ /\(bb10;\s(\w+)/i // BlackBerry 10 ], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [ // Asus Tablets - /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i + /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone|p00c)/i ], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony diff --git a/test/device-test.json b/test/device-test.json index 7f0b3b0..0e245ee 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -16,6 +16,15 @@ "type": "tablet" } }, + { + "desc": "Asus ZenPad 10", + "ua": "Mozilla/5.0 (Linux; Android 6.0; P00C Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Safari/537.36", + "expect": { + "vendor": "Asus", + "model": "P00C", + "type": "tablet" + } + }, { "desc": "Desktop (IE11 with Tablet string)", "ua": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", From ddcc29f63fe4da41fbf699a9c615e0ea68c22c1c Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 23 Nov 2018 09:23:13 +0700 Subject: [PATCH 169/170] Fix #303 - Acer Iconia --- 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 4aeb23e..114eaad 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -644,7 +644,7 @@ /(nokia)[\s_-]?([\w-]*)/i ], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [ - /android\s3\.[\s\w;-]{10}(a\d{3})/i // Acer + /android[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i // Acer ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [ /android.+([vl]k\-?\d{3})\s+build/i // LG Tablet diff --git a/test/device-test.json b/test/device-test.json index 0e245ee..e5f8c6c 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -25,6 +25,15 @@ "type": "tablet" } }, + { + "desc": "Acer Iconia A1-810", + "ua": "Mozilla/5.0 (Linux; Android 4.2.2; A1-810 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Safari/537.36", + "expect": { + "vendor": "Acer", + "model": "A1-810", + "type": "tablet" + } + }, { "desc": "Desktop (IE11 with Tablet string)", "ua": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko", From 732cf5834e6a8605c75f48db492a14426345d475 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Fri, 23 Nov 2018 10:26:00 +0700 Subject: [PATCH 170/170] Fix #337 - Samsung Smart-TV --- src/ua-parser.js | 3 +++ test/device-test.json | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index 114eaad..d982c4e 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -769,6 +769,9 @@ /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ + /[\s\/\(](smart-?tv)[;\)]/i // SmartTV + ], [[TYPE, SMARTTV]], [ + /(android[\w\.\s\-]{0,9});.+build/i // Generic Android Device ], [MODEL, [VENDOR, 'Generic']] diff --git a/test/device-test.json b/test/device-test.json index e5f8c6c..a283f76 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -369,6 +369,15 @@ "type": "smarttv" } }, + { + "desc": "Samsung SmartTV", + "ua": "Mozilla/5.0 (SMART-TV; X11; Linux armv7l) AppleWebkit/537.42 (KHTML, like Gecko) Safari/537.42", + "expect": { + "vendor": "undefined", + "model": "undefined", + "type": "smarttv" + } + }, { "desc": "Samsung SmartTV", "ua": "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1",