[e29cc2e] | 1 | /////////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | /* UAParser.js v0.7.31
|
---|
| 3 | Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
|
---|
| 4 | MIT License *//*
|
---|
| 5 | Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
---|
| 6 | Supports browser & node.js environment.
|
---|
| 7 | Demo : https://faisalman.github.io/ua-parser-js
|
---|
| 8 | Source : https://github.com/faisalman/ua-parser-js */
|
---|
| 9 | /////////////////////////////////////////////////////////////////////////////////
|
---|
[6a3a178] | 10 |
|
---|
| 11 | (function (window, undefined) {
|
---|
| 12 |
|
---|
| 13 | 'use strict';
|
---|
| 14 |
|
---|
| 15 | //////////////
|
---|
| 16 | // Constants
|
---|
| 17 | /////////////
|
---|
| 18 |
|
---|
| 19 |
|
---|
[e29cc2e] | 20 | var LIBVERSION = '0.7.31',
|
---|
[6a3a178] | 21 | EMPTY = '',
|
---|
| 22 | UNKNOWN = '?',
|
---|
| 23 | FUNC_TYPE = 'function',
|
---|
| 24 | UNDEF_TYPE = 'undefined',
|
---|
| 25 | OBJ_TYPE = 'object',
|
---|
| 26 | STR_TYPE = 'string',
|
---|
[e29cc2e] | 27 | MAJOR = 'major',
|
---|
[6a3a178] | 28 | MODEL = 'model',
|
---|
| 29 | NAME = 'name',
|
---|
| 30 | TYPE = 'type',
|
---|
| 31 | VENDOR = 'vendor',
|
---|
| 32 | VERSION = 'version',
|
---|
| 33 | ARCHITECTURE= 'architecture',
|
---|
| 34 | CONSOLE = 'console',
|
---|
| 35 | MOBILE = 'mobile',
|
---|
| 36 | TABLET = 'tablet',
|
---|
| 37 | SMARTTV = 'smarttv',
|
---|
| 38 | WEARABLE = 'wearable',
|
---|
| 39 | EMBEDDED = 'embedded',
|
---|
| 40 | UA_MAX_LENGTH = 255;
|
---|
| 41 |
|
---|
[e29cc2e] | 42 | var AMAZON = 'Amazon',
|
---|
| 43 | APPLE = 'Apple',
|
---|
| 44 | ASUS = 'ASUS',
|
---|
| 45 | BLACKBERRY = 'BlackBerry',
|
---|
| 46 | BROWSER = 'Browser',
|
---|
| 47 | CHROME = 'Chrome',
|
---|
| 48 | EDGE = 'Edge',
|
---|
| 49 | FIREFOX = 'Firefox',
|
---|
| 50 | GOOGLE = 'Google',
|
---|
| 51 | HUAWEI = 'Huawei',
|
---|
| 52 | LG = 'LG',
|
---|
| 53 | MICROSOFT = 'Microsoft',
|
---|
| 54 | MOTOROLA = 'Motorola',
|
---|
| 55 | OPERA = 'Opera',
|
---|
| 56 | SAMSUNG = 'Samsung',
|
---|
| 57 | SONY = 'Sony',
|
---|
| 58 | XIAOMI = 'Xiaomi',
|
---|
| 59 | ZEBRA = 'Zebra',
|
---|
| 60 | FACEBOOK = 'Facebook';
|
---|
[6a3a178] | 61 |
|
---|
| 62 | ///////////
|
---|
| 63 | // Helper
|
---|
| 64 | //////////
|
---|
| 65 |
|
---|
[e29cc2e] | 66 | var extend = function (regexes, extensions) {
|
---|
[6a3a178] | 67 | var mergedRegexes = {};
|
---|
| 68 | for (var i in regexes) {
|
---|
| 69 | if (extensions[i] && extensions[i].length % 2 === 0) {
|
---|
| 70 | mergedRegexes[i] = extensions[i].concat(regexes[i]);
|
---|
| 71 | } else {
|
---|
| 72 | mergedRegexes[i] = regexes[i];
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | return mergedRegexes;
|
---|
| 76 | },
|
---|
[e29cc2e] | 77 | enumerize = function (arr) {
|
---|
| 78 | var enums = {};
|
---|
| 79 | for (var i=0; i<arr.length; i++) {
|
---|
| 80 | enums[arr[i].toUpperCase()] = arr[i];
|
---|
| 81 | }
|
---|
| 82 | return enums;
|
---|
| 83 | },
|
---|
| 84 | has = function (str1, str2) {
|
---|
| 85 | return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;
|
---|
[6a3a178] | 86 | },
|
---|
[e29cc2e] | 87 | lowerize = function (str) {
|
---|
[6a3a178] | 88 | return str.toLowerCase();
|
---|
| 89 | },
|
---|
[e29cc2e] | 90 | majorize = function (version) {
|
---|
| 91 | return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g, EMPTY).split('.')[0] : undefined;
|
---|
[6a3a178] | 92 | },
|
---|
[e29cc2e] | 93 | trim = function (str, len) {
|
---|
| 94 | if (typeof(str) === STR_TYPE) {
|
---|
| 95 | str = str.replace(/^\s\s*/, EMPTY).replace(/\s\s*$/, EMPTY);
|
---|
| 96 | return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
|
---|
| 97 | }
|
---|
[6a3a178] | 98 | };
|
---|
| 99 |
|
---|
| 100 | ///////////////
|
---|
| 101 | // Map helper
|
---|
| 102 | //////////////
|
---|
| 103 |
|
---|
[e29cc2e] | 104 | var rgxMapper = function (ua, arrays) {
|
---|
[6a3a178] | 105 |
|
---|
| 106 | var i = 0, j, k, p, q, matches, match;
|
---|
| 107 |
|
---|
| 108 | // loop through all regexes maps
|
---|
| 109 | while (i < arrays.length && !matches) {
|
---|
| 110 |
|
---|
| 111 | var regex = arrays[i], // even sequence (0,2,4,..)
|
---|
| 112 | props = arrays[i + 1]; // odd sequence (1,3,5,..)
|
---|
| 113 | j = k = 0;
|
---|
| 114 |
|
---|
| 115 | // try matching uastring with regexes
|
---|
| 116 | while (j < regex.length && !matches) {
|
---|
| 117 |
|
---|
| 118 | matches = regex[j++].exec(ua);
|
---|
| 119 |
|
---|
| 120 | if (!!matches) {
|
---|
| 121 | for (p = 0; p < props.length; p++) {
|
---|
| 122 | match = matches[++k];
|
---|
| 123 | q = props[p];
|
---|
| 124 | // check if given property is actually array
|
---|
| 125 | if (typeof q === OBJ_TYPE && q.length > 0) {
|
---|
[e29cc2e] | 126 | if (q.length === 2) {
|
---|
[6a3a178] | 127 | if (typeof q[1] == FUNC_TYPE) {
|
---|
| 128 | // assign modified match
|
---|
| 129 | this[q[0]] = q[1].call(this, match);
|
---|
| 130 | } else {
|
---|
| 131 | // assign given value, ignore regex match
|
---|
| 132 | this[q[0]] = q[1];
|
---|
| 133 | }
|
---|
[e29cc2e] | 134 | } else if (q.length === 3) {
|
---|
[6a3a178] | 135 | // check whether function or regex
|
---|
| 136 | if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
|
---|
| 137 | // call function (usually string mapper)
|
---|
| 138 | this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
|
---|
| 139 | } else {
|
---|
| 140 | // sanitize match using given regex
|
---|
| 141 | this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
---|
| 142 | }
|
---|
[e29cc2e] | 143 | } else if (q.length === 4) {
|
---|
[6a3a178] | 144 | this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
|
---|
| 145 | }
|
---|
| 146 | } else {
|
---|
| 147 | this[q] = match ? match : undefined;
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 | }
|
---|
| 151 | }
|
---|
| 152 | i += 2;
|
---|
| 153 | }
|
---|
| 154 | },
|
---|
| 155 |
|
---|
[e29cc2e] | 156 | strMapper = function (str, map) {
|
---|
[6a3a178] | 157 |
|
---|
| 158 | for (var i in map) {
|
---|
[e29cc2e] | 159 | // check if current value is array
|
---|
[6a3a178] | 160 | if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
|
---|
| 161 | for (var j = 0; j < map[i].length; j++) {
|
---|
[e29cc2e] | 162 | if (has(map[i][j], str)) {
|
---|
[6a3a178] | 163 | return (i === UNKNOWN) ? undefined : i;
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
[e29cc2e] | 166 | } else if (has(map[i], str)) {
|
---|
[6a3a178] | 167 | return (i === UNKNOWN) ? undefined : i;
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 | return str;
|
---|
| 171 | };
|
---|
| 172 |
|
---|
| 173 | ///////////////
|
---|
| 174 | // String map
|
---|
| 175 | //////////////
|
---|
| 176 |
|
---|
[e29cc2e] | 177 | // Safari < 3.0
|
---|
| 178 | var oldSafariMap = {
|
---|
| 179 | '1.0' : '/8',
|
---|
| 180 | '1.2' : '/1',
|
---|
| 181 | '1.3' : '/3',
|
---|
| 182 | '2.0' : '/412',
|
---|
| 183 | '2.0.2' : '/416',
|
---|
| 184 | '2.0.3' : '/417',
|
---|
| 185 | '2.0.4' : '/419',
|
---|
| 186 | '?' : '/'
|
---|
[6a3a178] | 187 | },
|
---|
[e29cc2e] | 188 | windowsVersionMap = {
|
---|
| 189 | 'ME' : '4.90',
|
---|
| 190 | 'NT 3.11' : 'NT3.51',
|
---|
| 191 | 'NT 4.0' : 'NT4.0',
|
---|
| 192 | '2000' : 'NT 5.0',
|
---|
| 193 | 'XP' : ['NT 5.1', 'NT 5.2'],
|
---|
| 194 | 'Vista' : 'NT 6.0',
|
---|
| 195 | '7' : 'NT 6.1',
|
---|
| 196 | '8' : 'NT 6.2',
|
---|
| 197 | '8.1' : 'NT 6.3',
|
---|
| 198 | '10' : ['NT 6.4', 'NT 10.0'],
|
---|
| 199 | 'RT' : 'ARM'
|
---|
[6a3a178] | 200 | };
|
---|
| 201 |
|
---|
| 202 | //////////////
|
---|
| 203 | // Regex map
|
---|
| 204 | /////////////
|
---|
| 205 |
|
---|
| 206 | var regexes = {
|
---|
| 207 |
|
---|
| 208 | browser : [[
|
---|
| 209 |
|
---|
| 210 | /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
|
---|
| 211 | ], [VERSION, [NAME, 'Chrome']], [
|
---|
| 212 | /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge
|
---|
| 213 | ], [VERSION, [NAME, 'Edge']], [
|
---|
| 214 |
|
---|
| 215 | // Presto based
|
---|
[e29cc2e] | 216 | /(opera mini)\/([-\w\.]+)/i, // Opera Mini
|
---|
| 217 | /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet
|
---|
| 218 | /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera
|
---|
[6a3a178] | 219 | ], [NAME, VERSION], [
|
---|
[e29cc2e] | 220 | /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0
|
---|
| 221 | ], [VERSION, [NAME, OPERA+' Mini']], [
|
---|
| 222 | /\bopr\/([\w\.]+)/i // Opera Webkit
|
---|
| 223 | ], [VERSION, [NAME, OPERA]], [
|
---|
[6a3a178] | 224 |
|
---|
| 225 | // Mixed
|
---|
| 226 | /(kindle)\/([\w\.]+)/i, // Kindle
|
---|
[e29cc2e] | 227 | /(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer
|
---|
[6a3a178] | 228 | // Trident based
|
---|
[e29cc2e] | 229 | /(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser
|
---|
| 230 | /(ba?idubrowser)[\/ ]?([\w\.]+)/i, // Baidu Browser
|
---|
| 231 | /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
|
---|
| 232 |
|
---|
| 233 | // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
|
---|
| 234 | /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,
|
---|
| 235 | // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
|
---|
[6a3a178] | 236 | /(weibo)__([\d\.]+)/i // Weibo
|
---|
| 237 | ], [NAME, VERSION], [
|
---|
[e29cc2e] | 238 | /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
|
---|
| 239 | ], [VERSION, [NAME, 'UC'+BROWSER]], [
|
---|
| 240 | /\bqbcore\/([\w\.]+)/i // WeChat Desktop for Windows Built-in Browser
|
---|
[6a3a178] | 241 | ], [VERSION, [NAME, 'WeChat(Win) Desktop']], [
|
---|
| 242 | /micromessenger\/([\w\.]+)/i // WeChat
|
---|
| 243 | ], [VERSION, [NAME, 'WeChat']], [
|
---|
| 244 | /konqueror\/([\w\.]+)/i // Konqueror
|
---|
| 245 | ], [VERSION, [NAME, 'Konqueror']], [
|
---|
[e29cc2e] | 246 | /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
|
---|
[6a3a178] | 247 | ], [VERSION, [NAME, 'IE']], [
|
---|
| 248 | /yabrowser\/([\w\.]+)/i // Yandex
|
---|
| 249 | ], [VERSION, [NAME, 'Yandex']], [
|
---|
| 250 | /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser
|
---|
[e29cc2e] | 251 | ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [
|
---|
| 252 | /\bfocus\/([\w\.]+)/i // Firefox Focus
|
---|
| 253 | ], [VERSION, [NAME, FIREFOX+' Focus']], [
|
---|
| 254 | /\bopt\/([\w\.]+)/i // Opera Touch
|
---|
| 255 | ], [VERSION, [NAME, OPERA+' Touch']], [
|
---|
| 256 | /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser
|
---|
[6a3a178] | 257 | ], [VERSION, [NAME, 'Coc Coc']], [
|
---|
| 258 | /dolfin\/([\w\.]+)/i // Dolphin
|
---|
| 259 | ], [VERSION, [NAME, 'Dolphin']], [
|
---|
| 260 | /coast\/([\w\.]+)/i // Opera Coast
|
---|
[e29cc2e] | 261 | ], [VERSION, [NAME, OPERA+' Coast']], [
|
---|
| 262 | /miuibrowser\/([\w\.]+)/i // MIUI Browser
|
---|
| 263 | ], [VERSION, [NAME, 'MIUI '+BROWSER]], [
|
---|
| 264 | /fxios\/([-\w\.]+)/i // Firefox for iOS
|
---|
| 265 | ], [VERSION, [NAME, FIREFOX]], [
|
---|
| 266 | /\bqihu|(qi?ho?o?|360)browser/i // 360
|
---|
| 267 | ], [[NAME, '360 '+BROWSER]], [
|
---|
[6a3a178] | 268 | /(oculus|samsung|sailfish)browser\/([\w\.]+)/i
|
---|
[e29cc2e] | 269 | ], [[NAME, /(.+)/, '$1 '+BROWSER], VERSION], [ // Oculus/Samsung/Sailfish Browser
|
---|
[6a3a178] | 270 | /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
|
---|
| 271 | ], [[NAME, /_/g, ' '], VERSION], [
|
---|
[e29cc2e] | 272 | /(electron)\/([\w\.]+) safari/i, // Electron-based App
|
---|
| 273 | /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
|
---|
| 274 | /m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/Baidu App/2345 Browser
|
---|
[6a3a178] | 275 | ], [NAME, VERSION], [
|
---|
[e29cc2e] | 276 | /(metasr)[\/ ]?([\w\.]+)/i, // SouGouBrowser
|
---|
| 277 | /(lbbrowser)/i // LieBao Browser
|
---|
[6a3a178] | 278 | ], [NAME], [
|
---|
| 279 |
|
---|
| 280 | // WebView
|
---|
[e29cc2e] | 281 | /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
|
---|
| 282 | ], [[NAME, FACEBOOK], VERSION], [
|
---|
| 283 | /safari (line)\/([\w\.]+)/i, // Line App for iOS
|
---|
[6a3a178] | 284 | /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
|
---|
[e29cc2e] | 285 | /(chromium|instagram)[\/ ]([-\w\.]+)/i // Chromium/Instagram
|
---|
[6a3a178] | 286 | ], [NAME, VERSION], [
|
---|
[e29cc2e] | 287 | /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
|
---|
[6a3a178] | 288 | ], [VERSION, [NAME, 'GSA']], [
|
---|
| 289 |
|
---|
[e29cc2e] | 290 | /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
|
---|
| 291 | ], [VERSION, [NAME, CHROME+' Headless']], [
|
---|
[6a3a178] | 292 |
|
---|
[e29cc2e] | 293 | / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
|
---|
| 294 | ], [[NAME, CHROME+' WebView'], VERSION], [
|
---|
[6a3a178] | 295 |
|
---|
[e29cc2e] | 296 | /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
|
---|
| 297 | ], [VERSION, [NAME, 'Android '+BROWSER]], [
|
---|
[6a3a178] | 298 |
|
---|
[e29cc2e] | 299 | /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
|
---|
[6a3a178] | 300 | ], [NAME, VERSION], [
|
---|
| 301 |
|
---|
[e29cc2e] | 302 | /version\/([\w\.]+) .*mobile\/\w+ (safari)/i // Mobile Safari
|
---|
[6a3a178] | 303 | ], [VERSION, [NAME, 'Mobile Safari']], [
|
---|
[e29cc2e] | 304 | /version\/([\w\.]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
|
---|
[6a3a178] | 305 | ], [VERSION, NAME], [
|
---|
[e29cc2e] | 306 | /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
|
---|
| 307 | ], [NAME, [VERSION, strMapper, oldSafariMap]], [
|
---|
[6a3a178] | 308 |
|
---|
| 309 | /(webkit|khtml)\/([\w\.]+)/i
|
---|
| 310 | ], [NAME, VERSION], [
|
---|
| 311 |
|
---|
| 312 | // Gecko based
|
---|
[e29cc2e] | 313 | /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
|
---|
[6a3a178] | 314 | ], [[NAME, 'Netscape'], VERSION], [
|
---|
[e29cc2e] | 315 | /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
|
---|
| 316 | ], [VERSION, [NAME, FIREFOX+' Reality']], [
|
---|
[6a3a178] | 317 | /ekiohf.+(flow)\/([\w\.]+)/i, // Flow
|
---|
| 318 | /(swiftfox)/i, // Swiftfox
|
---|
[e29cc2e] | 319 | /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,
|
---|
| 320 | // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar
|
---|
| 321 | /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
|
---|
[6a3a178] | 322 | // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
---|
[e29cc2e] | 323 | /(firefox)\/([\w\.]+)/i, // Other Firefox-based
|
---|
| 324 | /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla
|
---|
[6a3a178] | 325 |
|
---|
| 326 | // Other
|
---|
[e29cc2e] | 327 | /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
|
---|
| 328 | // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
|
---|
| 329 | /(links) \(([\w\.]+)/i // Links
|
---|
[6a3a178] | 330 | ], [NAME, VERSION]
|
---|
| 331 | ],
|
---|
| 332 |
|
---|
| 333 | cpu : [[
|
---|
| 334 |
|
---|
[e29cc2e] | 335 | /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i // AMD64 (x64)
|
---|
[6a3a178] | 336 | ], [[ARCHITECTURE, 'amd64']], [
|
---|
| 337 |
|
---|
| 338 | /(ia32(?=;))/i // IA32 (quicktime)
|
---|
[e29cc2e] | 339 | ], [[ARCHITECTURE, lowerize]], [
|
---|
[6a3a178] | 340 |
|
---|
| 341 | /((?:i[346]|x)86)[;\)]/i // IA32 (x86)
|
---|
| 342 | ], [[ARCHITECTURE, 'ia32']], [
|
---|
| 343 |
|
---|
[e29cc2e] | 344 | /\b(aarch64|arm(v?8e?l?|_?64))\b/i // ARM64
|
---|
[6a3a178] | 345 | ], [[ARCHITECTURE, 'arm64']], [
|
---|
| 346 |
|
---|
| 347 | /\b(arm(?:v[67])?ht?n?[fl]p?)\b/i // ARMHF
|
---|
| 348 | ], [[ARCHITECTURE, 'armhf']], [
|
---|
| 349 |
|
---|
| 350 | // PocketPC mistakenly identified as PowerPC
|
---|
[e29cc2e] | 351 | /windows (ce|mobile); ppc;/i
|
---|
[6a3a178] | 352 | ], [[ARCHITECTURE, 'arm']], [
|
---|
| 353 |
|
---|
[e29cc2e] | 354 | /((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i // PowerPC
|
---|
| 355 | ], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [
|
---|
[6a3a178] | 356 |
|
---|
| 357 | /(sun4\w)[;\)]/i // SPARC
|
---|
| 358 | ], [[ARCHITECTURE, 'sparc']], [
|
---|
| 359 |
|
---|
[e29cc2e] | 360 | /((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
|
---|
[6a3a178] | 361 | // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
|
---|
[e29cc2e] | 362 | ], [[ARCHITECTURE, lowerize]]
|
---|
[6a3a178] | 363 | ],
|
---|
| 364 |
|
---|
| 365 | device : [[
|
---|
| 366 |
|
---|
| 367 | //////////////////////////
|
---|
| 368 | // MOBILES & TABLETS
|
---|
| 369 | // Ordered by popularity
|
---|
| 370 | /////////////////////////
|
---|
| 371 |
|
---|
| 372 | // Samsung
|
---|
[e29cc2e] | 373 | /\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
|
---|
| 374 | ], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
|
---|
| 375 | /\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,
|
---|
| 376 | /samsung[- ]([-\w]+)/i,
|
---|
[6a3a178] | 377 | /sec-(sgh\w+)/i
|
---|
[e29cc2e] | 378 | ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 379 |
|
---|
| 380 | // Apple
|
---|
[e29cc2e] | 381 | /\((ip(?:hone|od)[\w ]*);/i // iPod/iPhone
|
---|
| 382 | ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
|
---|
| 383 | /\((ipad);[-\w\),; ]+apple/i, // iPad
|
---|
| 384 | /applecoremedia\/[\w\.]+ \((ipad)/i,
|
---|
[6a3a178] | 385 | /\b(ipad)\d\d?,\d\d?[;\]].+ios/i
|
---|
[e29cc2e] | 386 | ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
|
---|
[6a3a178] | 387 |
|
---|
| 388 | // Huawei
|
---|
[e29cc2e] | 389 | /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
|
---|
| 390 | ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
|
---|
| 391 | /(?:huawei|honor)([-\w ]+)[;\)]/i,
|
---|
| 392 | /\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i
|
---|
| 393 | ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 394 |
|
---|
| 395 | // Xiaomi
|
---|
[e29cc2e] | 396 | /\b(poco[\w ]+)(?: bui|\))/i, // Xiaomi POCO
|
---|
| 397 | /\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
|
---|
| 398 | /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
|
---|
| 399 | /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
|
---|
| 400 | /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
|
---|
| 401 | ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
|
---|
| 402 | /\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
|
---|
| 403 | ],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
|
---|
[6a3a178] | 404 |
|
---|
| 405 | // OPPO
|
---|
[e29cc2e] | 406 | /; (\w+) bui.+ oppo/i,
|
---|
| 407 | /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
|
---|
[6a3a178] | 408 | ], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [
|
---|
| 409 |
|
---|
| 410 | // Vivo
|
---|
[e29cc2e] | 411 | /vivo (\w+)(?: bui|\))/i,
|
---|
| 412 | /\b(v[12]\d{3}\w?[at])(?: bui|;)/i
|
---|
[6a3a178] | 413 | ], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [
|
---|
| 414 |
|
---|
| 415 | // Realme
|
---|
[e29cc2e] | 416 | /\b(rmx[12]\d{3})(?: bui|;|\))/i
|
---|
[6a3a178] | 417 | ], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [
|
---|
| 418 |
|
---|
| 419 | // Motorola
|
---|
[e29cc2e] | 420 | /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
|
---|
| 421 | /\bmot(?:orola)?[- ](\w*)/i,
|
---|
| 422 | /((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
|
---|
| 423 | ], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [
|
---|
| 424 | /\b(mz60\d|xoom[2 ]{0,2}) build\//i
|
---|
| 425 | ], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [
|
---|
[6a3a178] | 426 |
|
---|
| 427 | // LG
|
---|
[e29cc2e] | 428 | /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
|
---|
| 429 | ], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
|
---|
| 430 | /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
|
---|
| 431 | /\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
|
---|
| 432 | /\blg-?([\d\w]+) bui/i
|
---|
| 433 | ], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 434 |
|
---|
| 435 | // Lenovo
|
---|
[e29cc2e] | 436 | /(ideatab[-\w ]+)/i,
|
---|
| 437 | /lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
|
---|
[6a3a178] | 438 | ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [
|
---|
| 439 |
|
---|
| 440 | // Nokia
|
---|
[e29cc2e] | 441 | /(?:maemo|nokia).*(n900|lumia \d+)/i,
|
---|
| 442 | /nokia[-_ ]?([-\w\.]*)/i
|
---|
[6a3a178] | 443 | ], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [
|
---|
| 444 |
|
---|
| 445 | // Google
|
---|
[e29cc2e] | 446 | /(pixel c)\b/i // Google Pixel C
|
---|
| 447 | ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [
|
---|
| 448 | /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel
|
---|
| 449 | ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 450 |
|
---|
| 451 | // Sony
|
---|
[e29cc2e] | 452 | /droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
|
---|
| 453 | ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
|
---|
| 454 | /sony tablet [ps]/i,
|
---|
| 455 | /\b(?:sony)?sgp\w+(?: bui|\))/i
|
---|
| 456 | ], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
|
---|
[6a3a178] | 457 |
|
---|
| 458 | // OnePlus
|
---|
[e29cc2e] | 459 | / (kb2005|in20[12]5|be20[12][59])\b/i,
|
---|
| 460 | /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
|
---|
[6a3a178] | 461 | ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [
|
---|
| 462 |
|
---|
| 463 | // Amazon
|
---|
| 464 | /(alexa)webm/i,
|
---|
[e29cc2e] | 465 | /(kf[a-z]{2}wi)( bui|\))/i, // Kindle Fire without Silk
|
---|
| 466 | /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD
|
---|
| 467 | ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
|
---|
| 468 | /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone
|
---|
| 469 | ], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 470 |
|
---|
| 471 | // BlackBerry
|
---|
[e29cc2e] | 472 | /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook
|
---|
[6a3a178] | 473 | ], [MODEL, VENDOR, [TYPE, TABLET]], [
|
---|
[e29cc2e] | 474 | /\b((?:bb[a-f]|st[hv])100-\d)/i,
|
---|
| 475 | /\(bb10; (\w+)/i // BlackBerry 10
|
---|
| 476 | ], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 477 |
|
---|
| 478 | // Asus
|
---|
[e29cc2e] | 479 | /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
|
---|
| 480 | ], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [
|
---|
| 481 | / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
|
---|
| 482 | ], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 483 |
|
---|
| 484 | // HTC
|
---|
[e29cc2e] | 485 | /(nexus 9)/i // HTC Nexus 9
|
---|
[6a3a178] | 486 | ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 487 | /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC
|
---|
[6a3a178] | 488 |
|
---|
| 489 | // ZTE
|
---|
[e29cc2e] | 490 | /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
|
---|
| 491 | /(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
|
---|
[6a3a178] | 492 | ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
---|
| 493 |
|
---|
| 494 | // Acer
|
---|
[e29cc2e] | 495 | /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
|
---|
[6a3a178] | 496 | ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
|
---|
| 497 |
|
---|
| 498 | // Meizu
|
---|
[e29cc2e] | 499 | /droid.+; (m[1-5] note) bui/i,
|
---|
| 500 | /\bmz-([-\w]{2,})/i
|
---|
[6a3a178] | 501 | ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
|
---|
| 502 |
|
---|
[e29cc2e] | 503 | // Sharp
|
---|
| 504 | /\b(sh-?[altvz]?\d\d[a-ekm]?)/i
|
---|
| 505 | ], [MODEL, [VENDOR, 'Sharp'], [TYPE, MOBILE]], [
|
---|
| 506 |
|
---|
[6a3a178] | 507 | // MIXED
|
---|
[e29cc2e] | 508 | /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
|
---|
[6a3a178] | 509 | // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
|
---|
[e29cc2e] | 510 | /(hp) ([\w ]+\w)/i, // HP iPAQ
|
---|
[6a3a178] | 511 | /(asus)-?(\w+)/i, // Asus
|
---|
[e29cc2e] | 512 | /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia
|
---|
| 513 | /(lenovo)[-_ ]?([-\w]+)/i, // Lenovo
|
---|
| 514 | /(jolla)/i, // Jolla
|
---|
| 515 | /(oppo) ?([\w ]+) bui/i // OPPO
|
---|
[6a3a178] | 516 | ], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
---|
| 517 |
|
---|
[e29cc2e] | 518 | /(archos) (gamepad2?)/i, // Archos
|
---|
[6a3a178] | 519 | /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad
|
---|
| 520 | /(kindle)\/([\w\.]+)/i, // Kindle
|
---|
[e29cc2e] | 521 | /(nook)[\w ]+build\/(\w+)/i, // Nook
|
---|
| 522 | /(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
|
---|
| 523 | /(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
|
---|
| 524 | /(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
|
---|
| 525 | /(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
|
---|
| 526 | /(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
|
---|
[6a3a178] | 527 | ], [VENDOR, MODEL, [TYPE, TABLET]], [
|
---|
| 528 |
|
---|
[e29cc2e] | 529 | /(surface duo)/i // Surface Duo
|
---|
| 530 | ], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [
|
---|
| 531 | /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone
|
---|
[6a3a178] | 532 | ], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 533 | /(u304aa)/i // AT&T
|
---|
[6a3a178] | 534 | ], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 535 | /\bsie-(\w*)/i // Siemens
|
---|
[6a3a178] | 536 | ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 537 | /\b(rct\w+) b/i // RCA Tablets
|
---|
[6a3a178] | 538 | ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 539 | /\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
|
---|
[6a3a178] | 540 | ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 541 | /\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
|
---|
[6a3a178] | 542 | ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 543 | /\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
|
---|
[6a3a178] | 544 | ], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 545 | /\b(tm\d{3}\w+) b/i
|
---|
[6a3a178] | 546 | ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 547 | /\b(k88) b/i // ZTE K Series Tablet
|
---|
[6a3a178] | 548 | ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 549 | /\b(nx\d{3}j) b/i // ZTE Nubia
|
---|
[6a3a178] | 550 | ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 551 | /\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
|
---|
[6a3a178] | 552 | ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 553 | /\b(zur\d{3}) b/i // Swiss ZUR Tablet
|
---|
[6a3a178] | 554 | ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 555 | /\b((zeki)?tb.*\b) b/i // Zeki Tablets
|
---|
[6a3a178] | 556 | ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 557 | /\b([yr]\d{2}) b/i,
|
---|
| 558 | /\b(dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
|
---|
[6a3a178] | 559 | ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [
|
---|
[e29cc2e] | 560 | /\b(ns-?\w{0,9}) b/i // Insignia Tablets
|
---|
[6a3a178] | 561 | ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 562 | /\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
|
---|
[6a3a178] | 563 | ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 564 | /\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
|
---|
| 565 | ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
|
---|
| 566 | /\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
|
---|
[6a3a178] | 567 | ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 568 | /\b(ph-1) /i // Essential PH-1
|
---|
| 569 | ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
|
---|
| 570 | /\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
|
---|
[6a3a178] | 571 | ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 572 | /\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
|
---|
[6a3a178] | 573 | ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 574 | /\btu_(1491) b/i // Rotor Tablets
|
---|
[6a3a178] | 575 | ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 576 | /(shield[\w ]+) b/i // Nvidia Shield Tablets
|
---|
[6a3a178] | 577 | ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, TABLET]], [
|
---|
[e29cc2e] | 578 | /(sprint) (\w+)/i // Sprint Phones
|
---|
[6a3a178] | 579 | ], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
---|
| 580 | /(kin\.[onetw]{3})/i // Microsoft Kin
|
---|
[e29cc2e] | 581 | ], [[MODEL, /\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [
|
---|
| 582 | /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra
|
---|
| 583 | ], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [
|
---|
| 584 | /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
|
---|
| 585 | ], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [
|
---|
[6a3a178] | 586 |
|
---|
| 587 | ///////////////////
|
---|
| 588 | // CONSOLES
|
---|
| 589 | ///////////////////
|
---|
| 590 |
|
---|
[e29cc2e] | 591 | /(ouya)/i, // Ouya
|
---|
| 592 | /(nintendo) ([wids3utch]+)/i // Nintendo
|
---|
[6a3a178] | 593 | ], [VENDOR, MODEL, [TYPE, CONSOLE]], [
|
---|
[e29cc2e] | 594 | /droid.+; (shield) bui/i // Nvidia
|
---|
[6a3a178] | 595 | ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
|
---|
[e29cc2e] | 596 | /(playstation [345portablevi]+)/i // Playstation
|
---|
| 597 | ], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [
|
---|
| 598 | /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox
|
---|
| 599 | ], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [
|
---|
[6a3a178] | 600 |
|
---|
| 601 | ///////////////////
|
---|
| 602 | // SMARTTVS
|
---|
| 603 | ///////////////////
|
---|
| 604 |
|
---|
| 605 | /smart-tv.+(samsung)/i // Samsung
|
---|
| 606 | ], [VENDOR, [TYPE, SMARTTV]], [
|
---|
| 607 | /hbbtv.+maple;(\d+)/i
|
---|
[e29cc2e] | 608 | ], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [
|
---|
| 609 | /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i // LG SmartTV
|
---|
| 610 | ], [[VENDOR, LG], [TYPE, SMARTTV]], [
|
---|
| 611 | /(apple) ?tv/i // Apple TV
|
---|
| 612 | ], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
|
---|
[6a3a178] | 613 | /crkey/i // Google Chromecast
|
---|
[e29cc2e] | 614 | ], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
---|
| 615 | /droid.+aft(\w)( bui|\))/i // Fire TV
|
---|
| 616 | ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
|
---|
[6a3a178] | 617 | /\(dtv[\);].+(aquos)/i // Sharp
|
---|
| 618 | ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [
|
---|
[e29cc2e] | 619 | /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
|
---|
| 620 | /hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i // HbbTV devices
|
---|
| 621 | ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
|
---|
| 622 | /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors
|
---|
[6a3a178] | 623 | ], [[TYPE, SMARTTV]], [
|
---|
| 624 |
|
---|
| 625 | ///////////////////
|
---|
| 626 | // WEARABLES
|
---|
| 627 | ///////////////////
|
---|
| 628 |
|
---|
[e29cc2e] | 629 | /((pebble))app/i // Pebble
|
---|
[6a3a178] | 630 | ], [VENDOR, MODEL, [TYPE, WEARABLE]], [
|
---|
[e29cc2e] | 631 | /droid.+; (glass) \d/i // Google Glass
|
---|
| 632 | ], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
|
---|
| 633 | /droid.+; (wt63?0{2,3})\)/i
|
---|
| 634 | ], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
|
---|
| 635 | /(quest( 2)?)/i // Oculus Quest
|
---|
| 636 | ], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [
|
---|
[6a3a178] | 637 |
|
---|
| 638 | ///////////////////
|
---|
| 639 | // EMBEDDED
|
---|
| 640 | ///////////////////
|
---|
| 641 |
|
---|
[e29cc2e] | 642 | /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla
|
---|
[6a3a178] | 643 | ], [VENDOR, [TYPE, EMBEDDED]], [
|
---|
| 644 |
|
---|
| 645 | ////////////////////
|
---|
| 646 | // MIXED (GENERIC)
|
---|
| 647 | ///////////////////
|
---|
| 648 |
|
---|
[e29cc2e] | 649 | /droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
|
---|
[6a3a178] | 650 | ], [MODEL, [TYPE, MOBILE]], [
|
---|
[e29cc2e] | 651 | /droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
|
---|
[6a3a178] | 652 | ], [MODEL, [TYPE, TABLET]], [
|
---|
[e29cc2e] | 653 | /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
|
---|
| 654 | ], [[TYPE, TABLET]], [
|
---|
| 655 | /(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
|
---|
| 656 | ], [[TYPE, MOBILE]], [
|
---|
| 657 | /(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
|
---|
| 658 | ], [MODEL, [VENDOR, 'Generic']]
|
---|
[6a3a178] | 659 | ],
|
---|
| 660 |
|
---|
| 661 | engine : [[
|
---|
| 662 |
|
---|
[e29cc2e] | 663 | /windows.+ edge\/([\w\.]+)/i // EdgeHTML
|
---|
| 664 | ], [VERSION, [NAME, EDGE+'HTML']], [
|
---|
[6a3a178] | 665 |
|
---|
| 666 | /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
|
---|
| 667 | ], [VERSION, [NAME, 'Blink']], [
|
---|
| 668 |
|
---|
| 669 | /(presto)\/([\w\.]+)/i, // Presto
|
---|
| 670 | /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
|
---|
| 671 | /ekioh(flow)\/([\w\.]+)/i, // Flow
|
---|
[e29cc2e] | 672 | /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
|
---|
| 673 | /(icab)[\/ ]([23]\.[\d\.]+)/i // iCab
|
---|
[6a3a178] | 674 | ], [NAME, VERSION], [
|
---|
| 675 |
|
---|
| 676 | /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko
|
---|
| 677 | ], [VERSION, NAME]
|
---|
| 678 | ],
|
---|
| 679 |
|
---|
| 680 | os : [[
|
---|
| 681 |
|
---|
| 682 | // Windows
|
---|
[e29cc2e] | 683 | /microsoft (windows) (vista|xp)/i // Windows (iTunes)
|
---|
[6a3a178] | 684 | ], [NAME, VERSION], [
|
---|
[e29cc2e] | 685 | /(windows) nt 6\.2; (arm)/i, // Windows RT
|
---|
| 686 | /(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i, // Windows Phone
|
---|
| 687 | /(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i
|
---|
| 688 | ], [NAME, [VERSION, strMapper, windowsVersionMap]], [
|
---|
| 689 | /(win(?=3|9|n)|win 9x )([nt\d\.]+)/i
|
---|
| 690 | ], [[NAME, 'Windows'], [VERSION, strMapper, windowsVersionMap]], [
|
---|
[6a3a178] | 691 |
|
---|
| 692 | // iOS/macOS
|
---|
[e29cc2e] | 693 | /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
|
---|
[6a3a178] | 694 | /cfnetwork\/.+darwin/i
|
---|
| 695 | ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
|
---|
[e29cc2e] | 696 | /(mac os x) ?([\w\. ]*)/i,
|
---|
| 697 | /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
|
---|
[6a3a178] | 698 | ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
|
---|
| 699 |
|
---|
[e29cc2e] | 700 | // Mobile OSes
|
---|
| 701 | /droid ([\w\.]+)\b.+(android[- ]x86)/i // Android-x86
|
---|
| 702 | ], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
|
---|
| 703 | /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
|
---|
[6a3a178] | 704 | /(blackberry)\w*\/([\w\.]*)/i, // Blackberry
|
---|
[e29cc2e] | 705 | /(tizen|kaios)[\/ ]([\w\.]+)/i, // Tizen/KaiOS
|
---|
[6a3a178] | 706 | /\((series40);/i // Series 40
|
---|
| 707 | ], [NAME, VERSION], [
|
---|
| 708 | /\(bb(10);/i // BlackBerry 10
|
---|
[e29cc2e] | 709 | ], [VERSION, [NAME, BLACKBERRY]], [
|
---|
| 710 | /(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i // Symbian
|
---|
[6a3a178] | 711 | ], [VERSION, [NAME, 'Symbian']], [
|
---|
[e29cc2e] | 712 | /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
|
---|
| 713 | ], [VERSION, [NAME, FIREFOX+' OS']], [
|
---|
[6a3a178] | 714 | /web0s;.+rt(tv)/i,
|
---|
| 715 | /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
|
---|
| 716 | ], [VERSION, [NAME, 'webOS']], [
|
---|
| 717 |
|
---|
| 718 | // Google Chromecast
|
---|
| 719 | /crkey\/([\d\.]+)/i // Google Chromecast
|
---|
[e29cc2e] | 720 | ], [VERSION, [NAME, CHROME+'cast']], [
|
---|
| 721 | /(cros) [\w]+ ([\w\.]+\w)/i // Chromium OS
|
---|
[6a3a178] | 722 | ], [[NAME, 'Chromium OS'], VERSION],[
|
---|
| 723 |
|
---|
| 724 | // Console
|
---|
[e29cc2e] | 725 | /(nintendo|playstation) ([wids345portablevuch]+)/i, // Nintendo/Playstation
|
---|
| 726 | /(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)
|
---|
[6a3a178] | 727 |
|
---|
| 728 | // Other
|
---|
[e29cc2e] | 729 | /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm
|
---|
| 730 | /(mint)[\/\(\) ]?(\w*)/i, // Mint
|
---|
| 731 | /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux
|
---|
| 732 | /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
|
---|
| 733 | // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
|
---|
| 734 | /(hurd|linux) ?([\w\.]*)/i, // Hurd/Linux
|
---|
| 735 | /(gnu) ?([\w\.]*)/i, // GNU
|
---|
| 736 | /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
|
---|
| 737 | /(haiku) (\w+)/i // Haiku
|
---|
| 738 | ], [NAME, VERSION], [
|
---|
| 739 | /(sunos) ?([\w\.\d]*)/i // Solaris
|
---|
[6a3a178] | 740 | ], [[NAME, 'Solaris'], VERSION], [
|
---|
[e29cc2e] | 741 | /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris
|
---|
| 742 | /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX
|
---|
| 743 | /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX
|
---|
| 744 | /(unix) ?([\w\.]*)/i // UNIX
|
---|
[6a3a178] | 745 | ], [NAME, VERSION]
|
---|
| 746 | ]
|
---|
| 747 | };
|
---|
| 748 |
|
---|
| 749 | /////////////////
|
---|
| 750 | // Constructor
|
---|
| 751 | ////////////////
|
---|
[e29cc2e] | 752 |
|
---|
[6a3a178] | 753 | var UAParser = function (ua, extensions) {
|
---|
| 754 |
|
---|
[e29cc2e] | 755 | if (typeof ua === OBJ_TYPE) {
|
---|
[6a3a178] | 756 | extensions = ua;
|
---|
| 757 | ua = undefined;
|
---|
| 758 | }
|
---|
| 759 |
|
---|
| 760 | if (!(this instanceof UAParser)) {
|
---|
| 761 | return new UAParser(ua, extensions).getResult();
|
---|
| 762 | }
|
---|
| 763 |
|
---|
[e29cc2e] | 764 | var _ua = ua || ((typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
|
---|
| 765 | var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
|
---|
[6a3a178] | 766 |
|
---|
| 767 | this.getBrowser = function () {
|
---|
[e29cc2e] | 768 | var _browser = {};
|
---|
| 769 | _browser[NAME] = undefined;
|
---|
| 770 | _browser[VERSION] = undefined;
|
---|
| 771 | rgxMapper.call(_browser, _ua, _rgxmap.browser);
|
---|
| 772 | _browser.major = majorize(_browser.version);
|
---|
[6a3a178] | 773 | return _browser;
|
---|
| 774 | };
|
---|
| 775 | this.getCPU = function () {
|
---|
[e29cc2e] | 776 | var _cpu = {};
|
---|
| 777 | _cpu[ARCHITECTURE] = undefined;
|
---|
| 778 | rgxMapper.call(_cpu, _ua, _rgxmap.cpu);
|
---|
[6a3a178] | 779 | return _cpu;
|
---|
| 780 | };
|
---|
| 781 | this.getDevice = function () {
|
---|
[e29cc2e] | 782 | var _device = {};
|
---|
| 783 | _device[VENDOR] = undefined;
|
---|
| 784 | _device[MODEL] = undefined;
|
---|
| 785 | _device[TYPE] = undefined;
|
---|
| 786 | rgxMapper.call(_device, _ua, _rgxmap.device);
|
---|
[6a3a178] | 787 | return _device;
|
---|
| 788 | };
|
---|
| 789 | this.getEngine = function () {
|
---|
[e29cc2e] | 790 | var _engine = {};
|
---|
| 791 | _engine[NAME] = undefined;
|
---|
| 792 | _engine[VERSION] = undefined;
|
---|
| 793 | rgxMapper.call(_engine, _ua, _rgxmap.engine);
|
---|
[6a3a178] | 794 | return _engine;
|
---|
| 795 | };
|
---|
| 796 | this.getOS = function () {
|
---|
[e29cc2e] | 797 | var _os = {};
|
---|
| 798 | _os[NAME] = undefined;
|
---|
| 799 | _os[VERSION] = undefined;
|
---|
| 800 | rgxMapper.call(_os, _ua, _rgxmap.os);
|
---|
[6a3a178] | 801 | return _os;
|
---|
| 802 | };
|
---|
| 803 | this.getResult = function () {
|
---|
| 804 | return {
|
---|
| 805 | ua : this.getUA(),
|
---|
| 806 | browser : this.getBrowser(),
|
---|
| 807 | engine : this.getEngine(),
|
---|
| 808 | os : this.getOS(),
|
---|
| 809 | device : this.getDevice(),
|
---|
| 810 | cpu : this.getCPU()
|
---|
| 811 | };
|
---|
| 812 | };
|
---|
| 813 | this.getUA = function () {
|
---|
| 814 | return _ua;
|
---|
| 815 | };
|
---|
| 816 | this.setUA = function (ua) {
|
---|
[e29cc2e] | 817 | _ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua;
|
---|
[6a3a178] | 818 | return this;
|
---|
| 819 | };
|
---|
| 820 | this.setUA(_ua);
|
---|
| 821 | return this;
|
---|
| 822 | };
|
---|
| 823 |
|
---|
| 824 | UAParser.VERSION = LIBVERSION;
|
---|
[e29cc2e] | 825 | UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR]);
|
---|
| 826 | UAParser.CPU = enumerize([ARCHITECTURE]);
|
---|
| 827 | UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);
|
---|
| 828 | UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);
|
---|
[6a3a178] | 829 |
|
---|
| 830 | ///////////
|
---|
| 831 | // Export
|
---|
| 832 | //////////
|
---|
| 833 |
|
---|
| 834 | // check js environment
|
---|
| 835 | if (typeof(exports) !== UNDEF_TYPE) {
|
---|
| 836 | // nodejs env
|
---|
| 837 | if (typeof module !== UNDEF_TYPE && module.exports) {
|
---|
| 838 | exports = module.exports = UAParser;
|
---|
| 839 | }
|
---|
| 840 | exports.UAParser = UAParser;
|
---|
| 841 | } else {
|
---|
| 842 | // requirejs env (optional)
|
---|
[e29cc2e] | 843 | if (typeof(define) === FUNC_TYPE && define.amd) {
|
---|
[6a3a178] | 844 | define(function () {
|
---|
| 845 | return UAParser;
|
---|
| 846 | });
|
---|
[e29cc2e] | 847 | } else if (typeof window !== UNDEF_TYPE) {
|
---|
[6a3a178] | 848 | // browser env
|
---|
| 849 | window.UAParser = UAParser;
|
---|
| 850 | }
|
---|
| 851 | }
|
---|
| 852 |
|
---|
| 853 | // jQuery/Zepto specific (optional)
|
---|
| 854 | // Note:
|
---|
| 855 | // In AMD env the global scope should be kept clean, but jQuery is an exception.
|
---|
| 856 | // jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
|
---|
| 857 | // and we should catch that.
|
---|
[e29cc2e] | 858 | var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);
|
---|
[6a3a178] | 859 | if ($ && !$.ua) {
|
---|
| 860 | var parser = new UAParser();
|
---|
| 861 | $.ua = parser.getResult();
|
---|
| 862 | $.ua.get = function () {
|
---|
| 863 | return parser.getUA();
|
---|
| 864 | };
|
---|
[e29cc2e] | 865 | $.ua.set = function (ua) {
|
---|
| 866 | parser.setUA(ua);
|
---|
[6a3a178] | 867 | var result = parser.getResult();
|
---|
| 868 | for (var prop in result) {
|
---|
| 869 | $.ua[prop] = result[prop];
|
---|
| 870 | }
|
---|
| 871 | };
|
---|
| 872 | }
|
---|
| 873 |
|
---|
| 874 | })(typeof window === 'object' ? window : this);
|
---|