annotate Applications/StoneWebViewer/WebApplication/ua-parser.js @ 1578:1f812f4c95be

comments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Sep 2020 17:20:36 +0200
parents 2a4a6b967053
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /*!
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * UAParser.js v0.7.21
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Lightweight JavaScript-based User-Agent string parser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * https://github.com/faisalman/ua-parser-js
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Copyright © 2012-2019 Faisal Salman <f@faisalman.com>
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * Licensed under MIT License
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 */
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 (function (window, undefined) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 'use strict';
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 //////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 // Constants
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 /////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 var LIBVERSION = '0.7.21',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 EMPTY = '',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 UNKNOWN = '?',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 FUNC_TYPE = 'function',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 UNDEF_TYPE = 'undefined',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 OBJ_TYPE = 'object',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 STR_TYPE = 'string',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 MAJOR = 'major', // deprecated
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 MODEL = 'model',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 NAME = 'name',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 TYPE = 'type',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 VENDOR = 'vendor',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 VERSION = 'version',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 ARCHITECTURE= 'architecture',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 CONSOLE = 'console',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 MOBILE = 'mobile',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 TABLET = 'tablet',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 SMARTTV = 'smarttv',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 WEARABLE = 'wearable',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 EMBEDDED = 'embedded';
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 ///////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 // Helper
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 //////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 var util = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 extend : function (regexes, extensions) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 var mergedRegexes = {};
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 for (var i in regexes) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 if (extensions[i] && extensions[i].length % 2 === 0) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 mergedRegexes[i] = extensions[i].concat(regexes[i]);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 } else {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 mergedRegexes[i] = regexes[i];
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 return mergedRegexes;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 has : function (str1, str2) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 if (typeof str1 === "string") {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 } else {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 return false;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 lowerize : function (str) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 return str.toLowerCase();
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 major : function (version) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g,'').split(".")[0] : undefined;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 trim : function (str) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ///////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 // Map helper
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 //////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 var mapper = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 rgx : function (ua, arrays) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 var i = 0, j, k, p, q, matches, match;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 // loop through all regexes maps
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 while (i < arrays.length && !matches) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 var regex = arrays[i], // even sequence (0,2,4,..)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 props = arrays[i + 1]; // odd sequence (1,3,5,..)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 j = k = 0;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 // try matching uastring with regexes
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 while (j < regex.length && !matches) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 matches = regex[j++].exec(ua);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 if (!!matches) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 for (p = 0; p < props.length; p++) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 match = matches[++k];
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 q = props[p];
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 // check if given property is actually array
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 if (typeof q === OBJ_TYPE && q.length > 0) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 if (q.length == 2) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 if (typeof q[1] == FUNC_TYPE) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 // assign modified match
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 this[q[0]] = q[1].call(this, match);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 } else {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 // assign given value, ignore regex match
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 this[q[0]] = q[1];
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 } else if (q.length == 3) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 // check whether function or regex
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 // call function (usually string mapper)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 } else {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 // sanitize match using given regex
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 } else if (q.length == 4) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 } else {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 this[q] = match ? match : undefined;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 i += 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 str : function (str, map) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 for (var i in map) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 // check if array
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 for (var j = 0; j < map[i].length; j++) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 if (util.has(map[i][j], str)) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 return (i === UNKNOWN) ? undefined : i;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 } else if (util.has(map[i], str)) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 return (i === UNKNOWN) ? undefined : i;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 return str;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 ///////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 // String map
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 //////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 var maps = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 browser : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 oldsafari : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 version : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 '1.0' : '/8',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 '1.2' : '/1',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 '1.3' : '/3',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 '2.0' : '/412',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 '2.0.2' : '/416',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 '2.0.3' : '/417',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 '2.0.4' : '/419',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 '?' : '/'
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 device : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 amazon : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 model : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 'Fire Phone' : ['SD', 'KF']
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 sprint : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 model : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 'Evo Shift 4G' : '7373KT'
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 vendor : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 'HTC' : 'APA',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 'Sprint' : 'Sprint'
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 },
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 os : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 windows : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 version : {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 'ME' : '4.90',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 'NT 3.11' : 'NT3.51',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 'NT 4.0' : 'NT4.0',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 '2000' : 'NT 5.0',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 'XP' : ['NT 5.1', 'NT 5.2'],
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 'Vista' : 'NT 6.0',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 '7' : 'NT 6.1',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 '8' : 'NT 6.2',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 '8.1' : 'NT 6.3',
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 '10' : ['NT 6.4', 'NT 10.0'],
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 'RT' : 'ARM'
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 //////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 // Regex map
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 /////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 var regexes = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 browser : [[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 // Presto based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 /(opera\smini)\/([\w\.-]+)/i, // Opera Mini
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 /(opera).+version\/([\w\.]+)/i, // Opera > 9.80
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 /(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 /(opios)[\/\s]+([\w\.]+)/i // Opera mini on iphone >= 8.0
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 ], [[NAME, 'Opera Mini'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 /\s(opr)\/([\w\.]+)/i // Opera Webkit
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 ], [[NAME, 'Opera'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 // Mixed
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 /(kindle)\/([\w\.]+)/i, // Kindle
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 // Lunascape/Maxthon/Netfront/Jasmine/Blazer
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 // Trident based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 /(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 // Avant/IEMobile/SlimBrowser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 /(bidubrowser|baidubrowser)[\/\s]?([\w\.]+)/i, // Baidu Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 /(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 // Webkit/KHTML based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 /(rekonq)\/([\w\.]*)/i, // Rekonq
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 /(konqueror)\/([\w\.]+)/i // Konqueror
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 ], [[NAME, 'Konqueror'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 ], [[NAME, 'IE'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 /(edge|edgios|edga|edg)\/((\d+)?[\w\.]+)/i // Microsoft Edge
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 ], [[NAME, 'Edge'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 /(yabrowser)\/([\w\.]+)/i // Yandex
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 ], [[NAME, 'Yandex'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 /(Avast)\/([\w\.]+)/i // Avast Secure Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 ], [[NAME, 'Avast Secure Browser'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 /(AVG)\/([\w\.]+)/i // AVG Secure Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 ], [[NAME, 'AVG Secure Browser'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 /(puffin)\/([\w\.]+)/i // Puffin
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 ], [[NAME, 'Puffin'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 /(focus)\/([\w\.]+)/i // Firefox Focus
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 ], [[NAME, 'Firefox Focus'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 /(opt)\/([\w\.]+)/i // Opera Touch
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 ], [[NAME, 'Opera Touch'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 /((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i // UCBrowser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 ], [[NAME, 'UCBrowser'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 ], [[NAME, /_/g, ' '], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 /(windowswechat qbcore)\/([\w\.]+)/i // WeChat Desktop for Windows Built-in Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 ], [[NAME, 'WeChat(Win) Desktop'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 /(micromessenger)\/([\w\.]+)/i // WeChat
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 ], [[NAME, 'WeChat'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 /(brave)\/([\w\.]+)/i // Brave browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 ], [[NAME, 'Brave'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 /(qqbrowserlite)\/([\w\.]+)/i // QQBrowserLite
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 /(QQ)\/([\d\.]+)/i // QQ, aka ShouQ
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 /m?(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 /(baiduboxapp)[\/\s]?([\w\.]+)/i // Baidu App
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 /(2345Explorer)[\/\s]?([\w\.]+)/i // 2345 Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 /(MetaSr)[\/\s]?([\w\.]+)/i // SouGouBrowser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 ], [NAME], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 /(LBBROWSER)/i // LieBao Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 ], [NAME], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 ], [VERSION, [NAME, 'MIUI Browser']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 ], [VERSION, [NAME, 'Facebook']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 /safari\s(line)\/([\w\.]+)/i, // Line App for iOS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 /android.+(line)\/([\w\.]+)\/iab/i // Line App for Android
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 /headlesschrome(?:\/([\w\.]+)|\s)/i // Chrome Headless
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 ], [VERSION, [NAME, 'Chrome Headless']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 /((?:oculus|samsung)browser)\/([\w\.]+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 ], [[NAME, /(.+(?:g|us))(.+)/, '$1 $2'], VERSION], [ // Oculus / Samsung Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 ], [VERSION, [NAME, 'Android Browser']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 /(sailfishbrowser)\/([\w\.]+)/i // Sailfish Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 ], [[NAME, 'Sailfish Browser'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 // Chrome/OmniWeb/Arora/Tizen/Nokia
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 /(dolfin)\/([\w\.]+)/i // Dolphin
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 ], [[NAME, 'Dolphin'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 /(qihu|qhbrowser|qihoobrowser|360browser)/i // 360
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 ], [[NAME, '360 Browser']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 ], [[NAME, 'Chrome'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 /(coast)\/([\w\.]+)/i // Opera Coast
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 ], [[NAME, 'Opera Coast'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 /fxios\/([\w\.-]+)/i // Firefox for iOS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 ], [VERSION, [NAME, 'Firefox']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 /version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 ], [VERSION, [NAME, 'Mobile Safari']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 /version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 ], [VERSION, NAME], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 /webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Google Search Appliance on iOS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 ], [[NAME, 'GSA'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 ], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 /(webkit|khtml)\/([\w\.]+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 // Gecko based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 /(navigator|netscape)\/([\w\.-]+)/i // Netscape
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 ], [[NAME, 'Netscape'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 /(swiftfox)/i, // Swiftfox
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 // Other
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 /(links)\s\(([\w\.]+)/i, // Links
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 /(gobrowser)\/?([\w\.]*)/i, // GoBrowser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 /(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 /(mosaic)[\/\s]([\w\.]+)/i // Mosaic
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 ], [NAME, VERSION]
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 ],
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 cpu : [[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 /(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 ], [[ARCHITECTURE, 'amd64']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 /(ia32(?=;))/i // IA32 (quicktime)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 ], [[ARCHITECTURE, util.lowerize]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 /((?:i[346]|x)86)[;\)]/i // IA32
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 ], [[ARCHITECTURE, 'ia32']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 // PocketPC mistakenly identified as PowerPC
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 /windows\s(ce|mobile);\sppc;/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 ], [[ARCHITECTURE, 'arm']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 /((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 ], [[ARCHITECTURE, /ower/, '', util.lowerize]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 /(sun4\w)[;\)]/i // SPARC
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 ], [[ARCHITECTURE, 'sparc']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 /((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+[;l]))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 ], [[ARCHITECTURE, util.lowerize]]
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 ],
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 device : [[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 /\((ipad|playbook);[\w\s\),;-]+(rim|apple)/i // iPad/PlayBook
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 ], [MODEL, VENDOR, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 /applecoremedia\/[\w\.]+ \((ipad)/ // iPad
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 ], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 /(apple\s{0,1}tv)/i // Apple TV
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 ], [[MODEL, 'Apple TV'], [VENDOR, 'Apple'], [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 /(archos)\s(gamepad2?)/i, // Archos
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 /(hp).+(touchpad)/i, // HP TouchPad
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 /(hp).+(tablet)/i, // HP Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 /(kindle)\/([\w\.]+)/i, // Kindle
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 /\s(nook)[\w\s]+build\/(\w+)/i, // Nook
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 /(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 ], [VENDOR, MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 /(kf[A-z]+)\sbuild\/.+silk\//i // Kindle Fire HD
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 /(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i // Fire Phone
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 ], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 /android.+aft([bms])\sbuild/i // Fire TV
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 ], [MODEL, [VENDOR, 'Amazon'], [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 /\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 ], [MODEL, VENDOR, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 /\((ip[honed|\s\w*]+);/i // iPod/iPhone
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 /(blackberry)[\s-]?(\w+)/i, // BlackBerry
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 /(hp)\s([\w\s]+\w)/i, // HP iPAQ
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 /(asus)-?(\w+)/i // Asus
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 ], [VENDOR, MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 /\(bb10;\s(\w+)/i // BlackBerry 10
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 ], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 // Asus Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone|p00c)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 ], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 /(sony)?(?:sgp.+)\sbuild\//i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 /android.+\s([c-g]\d{4}|so[-l]\w+)(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 ], [MODEL, [VENDOR, 'Sony'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 /\s(ouya)\s/i, // Ouya
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 /(nintendo)\s([wids3u]+)/i // Nintendo
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 ], [VENDOR, MODEL, [TYPE, CONSOLE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 /android.+;\s(shield)\sbuild/i // Nvidia
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 /(playstation\s[34portablevi]+)/i // Playstation
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 ], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 /(sprint\s(\w+))/i // Sprint Phones
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 ], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 /(htc)[;_\s-]+([\w\s]+(?=\)|\sbuild)|\w+)/i, // HTC
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 /(zte)-(\w*)/i, // ZTE
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 /(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 /(nexus\s9)/i // HTC Nexus 9
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 /d\/huawei([\w\s-]+)[;\)]/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 /(nexus\s6p|vog-l29|ane-lx1|eml-l29|ele-l29)/i // Huawei
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 /android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 ], [MODEL, [VENDOR, 'Huawei'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 ], [VENDOR, MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 /[\s\(;](xbox(?:\sone)?)[\s\);]/i // Microsoft Xbox
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 ], [MODEL, [VENDOR, 'Microsoft'], [TYPE, CONSOLE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 /(kin\.[onetw]{3})/i // Microsoft Kin
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 ], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 // Motorola
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 /mot[\s-]?(\w*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 /(XT\d{3,4}) build\//i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 /(nexus\s6)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 ], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 /android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 ], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 /hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 ], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 /hbbtv.+maple;(\d+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 ], [[MODEL, /^/, 'SmartTV'], [VENDOR, 'Samsung'], [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 /\(dtv[\);].+(aquos)/i // Sharp
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 /((SM-T\w+))/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 /smart-tv.+(samsung)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 ], [VENDOR, [TYPE, SMARTTV], MODEL], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 /(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 /sec-((sgh\w+))/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 /sie-(\w*)/i // Siemens
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 /(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 /(nokia)[\s_-]?([\w-]*)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 ], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 /android[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i // Acer
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 /android.+([vl]k\-?\d{3})\s+build/i // LG Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 ], [MODEL, [VENDOR, 'LG'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 /android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 /(lg) netcast\.tv/i // LG SmartTV
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 ], [VENDOR, MODEL, [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 /(nexus\s[45])/i, // LG
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 /lg[e;\s\/-]+(\w*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 /android.+lg(\-?[\d\w]+)\s+build/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 ], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 /(lenovo)\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+))/i // Lenovo tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 ], [VENDOR, MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 /android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 /(lenovo)[_\s-]?([\w-]+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 ], [VENDOR, MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 /linux;.+((jolla));/i // Jolla
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 ], [VENDOR, MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 /((pebble))app\/[\d\.]+\s/i // Pebble
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 ], [VENDOR, MODEL, [TYPE, WEARABLE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 /android.+;\s(oppo)\s?([\w\s]+)\sbuild/i // OPPO
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 ], [VENDOR, MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 /crkey/i // Google Chromecast
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 ], [[MODEL, 'Chromecast'], [VENDOR, 'Google'], [TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 /android.+;\s(glass)\s\d/i // Google Glass
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 /android.+;\s(pixel c)[\s)]/i // Google Pixel C
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 /android.+;\s(pixel( [23])?( xl)?)[\s)]/i // Google Pixel
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 /android.+(mi[\s\-_]*(?:a\d|one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 // Xiaomi Mi
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 /android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i // Redmi Phones
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 /android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i // Mi Pad tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 ],[[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 /(mz)-([\w-]{2,})/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 ], [[VENDOR, 'Meizu'], MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 /android.+a000(1)\s+build/i, // OnePlus
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 /android.+oneplus\s(a\d{4})[\s)]/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 /android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i // Dell Venue Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 /android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i // Barnes & Noble Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 ], [[VENDOR, 'Barnes & Noble'], MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 /android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i // Barnes & Noble Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 /android.+;\s(k88)\sbuild/i // ZTE K Series Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 /android.+[;\/]\s*(gen\d{3})\s+build.*49h/i // Swiss GEN Mobile
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 /android.+[;\/]\s*(zur\d{3})\s+build/i // Swiss ZUR Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 /android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i // Zeki Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 /(android).+[;\/]\s+([YR]\d{2})\s+build/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i // Dragon Touch Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 /android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i // Insignia Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 /android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i // NextBook Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638 /android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 /android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i // LvTel Phones
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 /android.+;\s(PH-1)\s/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [ // Essential PH-1
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 /android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i // Le Pan Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 ], [VENDOR, MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 /android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i // Trinity Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 ], [VENDOR, MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 /android.+(KS(.+))\s+build/i // Amazon Kindle Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 /android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i // Gigaset Tablets
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 ], [VENDOR, MODEL, [TYPE, TABLET]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 ], [[TYPE, util.lowerize], VENDOR, MODEL], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 /[\s\/\(](smart-?tv)[;\)]/i // SmartTV
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 ], [[TYPE, SMARTTV]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 /(android[\w\.\s\-]{0,9});.+build/i // Generic Android Device
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 ], [MODEL, [VENDOR, 'Generic']]
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 ],
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 engine : [[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 /windows.+\sedge\/([\w\.]+)/i // EdgeHTML
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 ], [VERSION, [NAME, 'EdgeHTML']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 ], [VERSION, [NAME, 'Blink']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 /(presto)\/([\w\.]+)/i, // Presto
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 /rv\:([\w\.]{1,9}).+(gecko)/i // Gecko
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 ], [VERSION, NAME]
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 ],
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 os : [[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 // Windows based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 /microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i, // Windows Phone
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 ], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 // Mobile/Embedded OS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 /\((bb)(10);/i // BlackBerry 10
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 ], [[NAME, 'BlackBerry'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 /(blackberry)\w*\/?([\w\.]*)/i, // Blackberry
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 /(tizen|kaios)[\/\s]([\w\.]+)/i, // Tizen/KaiOS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki/Sailfish OS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i // Symbian
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 ], [[NAME, 'Symbian'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 /\((series40);/i // Series 40
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 ], [NAME], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 /mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723 ], [[NAME, 'Firefox OS'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725 // Console
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 /(nintendo|playstation)\s([wids34portablevu]+)/i, // Nintendo/Playstation
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 // GNU/Linux based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 /(mint)[\/\s\(]?(\w*)/i, // Mint
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 /(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 /(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 /(hurd|linux)\s?([\w\.]*)/i, // Hurd/Linux
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 /(gnu)\s?([\w\.]*)/i // GNU
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 ], [NAME, VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 /(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739 ], [[NAME, 'Chromium OS'], VERSION],[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 // Solaris
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 /(sunos)\s?([\w\.\d]*)/i // Solaris
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 ], [[NAME, 'Solaris'], VERSION], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 // BSD based
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 ], [NAME, VERSION],[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 /(haiku)\s(\w+)/i // Haiku
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750 ], [NAME, VERSION],[
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 /cfnetwork\/.+darwin/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 /ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i // iOS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 /(mac\sos\sx)\s?([\w\s\.]*)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 /(macintosh|mac(?=_powerpc)\s)/i // Mac OS
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 // Other
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 /((?:open)?solaris)[\/\s-]?([\w\.]*)/i, // Solaris
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 /(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i, // AIX
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS/Fuchsia
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 /(unix)\s?([\w\.]*)/i // UNIX
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 ], [NAME, VERSION]
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 ]
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 /////////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 // Constructor
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 ////////////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 var UAParser = function (uastring, extensions) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 if (typeof uastring === 'object') {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 extensions = uastring;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 uastring = undefined;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 if (!(this instanceof UAParser)) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 return new UAParser(uastring, extensions).getResult();
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 this.getBrowser = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 var browser = { name: undefined, version: undefined };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790 mapper.rgx.call(browser, ua, rgxmap.browser);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 browser.major = util.major(browser.version); // deprecated
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 return browser;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 this.getCPU = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 var cpu = { architecture: undefined };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 mapper.rgx.call(cpu, ua, rgxmap.cpu);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 return cpu;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 this.getDevice = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 var device = { vendor: undefined, model: undefined, type: undefined };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 mapper.rgx.call(device, ua, rgxmap.device);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 return device;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 this.getEngine = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 var engine = { name: undefined, version: undefined };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806 mapper.rgx.call(engine, ua, rgxmap.engine);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807 return engine;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 this.getOS = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 var os = { name: undefined, version: undefined };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 mapper.rgx.call(os, ua, rgxmap.os);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 return os;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814 this.getResult = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815 return {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816 ua : this.getUA(),
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817 browser : this.getBrowser(),
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 engine : this.getEngine(),
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819 os : this.getOS(),
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820 device : this.getDevice(),
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 cpu : this.getCPU()
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824 this.getUA = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 return ua;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827 this.setUA = function (uastring) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828 ua = uastring;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 return this;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 return this;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
832 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
833
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834 UAParser.VERSION = LIBVERSION;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835 UAParser.BROWSER = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 NAME : NAME,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837 MAJOR : MAJOR, // deprecated
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838 VERSION : VERSION
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840 UAParser.CPU = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 ARCHITECTURE : ARCHITECTURE
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843 UAParser.DEVICE = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844 MODEL : MODEL,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845 VENDOR : VENDOR,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
846 TYPE : TYPE,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 CONSOLE : CONSOLE,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
848 MOBILE : MOBILE,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849 SMARTTV : SMARTTV,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 TABLET : TABLET,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 WEARABLE: WEARABLE,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 EMBEDDED: EMBEDDED
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854 UAParser.ENGINE = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855 NAME : NAME,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856 VERSION : VERSION
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858 UAParser.OS = {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859 NAME : NAME,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
860 VERSION : VERSION
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
861 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863 ///////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
864 // Export
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 //////////
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
867
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868 // check js environment
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 if (typeof(exports) !== UNDEF_TYPE) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870 // nodejs env
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 if (typeof module !== UNDEF_TYPE && module.exports) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 exports = module.exports = UAParser;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874 exports.UAParser = UAParser;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875 } else {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 // requirejs env (optional)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877 if (typeof(define) === 'function' && define.amd) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878 define(function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 return UAParser;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 });
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881 } else if (window) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 // browser env
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883 window.UAParser = UAParser;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 // jQuery/Zepto specific (optional)
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 // Note:
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889 // In AMD env the global scope should be kept clean, but jQuery is an exception.
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
890 // jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 // and we should catch that.
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 var $ = window && (window.jQuery || window.Zepto);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 if ($ && !$.ua) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 var parser = new UAParser();
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 $.ua = parser.getResult();
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 $.ua.get = function () {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 return parser.getUA();
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 $.ua.set = function (uastring) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 parser.setUA(uastring);
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 var result = parser.getResult();
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 for (var prop in result) {
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 $.ua[prop] = result[prop];
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 };
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906 }
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 })(typeof window === 'object' ? window : this);