1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

adds windows version detection

This commit is contained in:
rkurbatov 2017-05-18 00:28:51 +03:00
parent 9b87b2f3af
commit 98538362b3
2 changed files with 58 additions and 2 deletions

View File

@ -336,9 +336,27 @@
result.linux = t result.linux = t
} }
function getWindowsVersion (s) {
switch (s) {
case 'NT': return 'NT'
case 'XP': return 'XP'
case 'NT 5.0': return '2000'
case 'NT 5.1': return 'XP'
case 'NT 5.2': return '2003'
case 'NT 6.0': return 'Vista'
case 'NT 6.1': return '7'
case 'NT 6.2': return '8'
case 'NT 6.3': return '8.1'
case 'NT 10.0': return '10'
default: return undefined
}
}
// OS version extraction // OS version extraction
var osVersion = ''; var osVersion = '';
if (result.windowsphone) { if (result.windows) {
osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i))
} else if (result.windowsphone) {
osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i); osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
} else if (iosdevice) { } else if (iosdevice) {
osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i); osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
@ -359,7 +377,7 @@
} }
// device type extraction // device type extraction
var osMajorVersion = osVersion.split('.')[0]; var osMajorVersion = !result.windows && osVersion.split('.')[0];
if ( if (
tablet tablet
|| nexusTablet || nexusTablet

View File

@ -85,6 +85,7 @@ module.exports.useragents = {
chrome: true chrome: true
, version: '30.0' , version: '30.0'
, windows: true , windows: true
, osversion: '8'
, blink: true , blink: true
, a: true , a: true
} }
@ -92,6 +93,7 @@ module.exports.useragents = {
chrome: true chrome: true
, version: '29.0' , version: '29.0'
, windows: true , windows: true
, osversion: '7'
, blink: true , blink: true
, a: true , a: true
} }
@ -107,6 +109,7 @@ module.exports.useragents = {
chrome: true chrome: true
, version: '29.0' , version: '29.0'
, windows: true , windows: true
, osversion: '8'
, blink: true , blink: true
, a: true , a: true
} }
@ -114,6 +117,7 @@ module.exports.useragents = {
chrome: true chrome: true
, version: '28.0' , version: '28.0'
, windows: true , windows: true
, osversion: '7'
, blink: true , blink: true
, a: true , a: true
} }
@ -222,6 +226,7 @@ module.exports.useragents = {
, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.100': { , 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.100': {
opera: true opera: true
, windows: true , windows: true
, osversion: '7'
, blink: true , blink: true
, version: '15.0' , version: '15.0'
, a: true , a: true
@ -246,24 +251,28 @@ module.exports.useragents = {
opera: true opera: true
, version: '12.14' , version: '12.14'
, windows: true , windows: true
, osversion: 'Vista'
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14': { , 'Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14': {
opera: true opera: true
, version: '12.14' , version: '12.14'
, windows: true , windows: true
, osversion: 'Vista'
, a: true , a: true
} }
, 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14': { , 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14': {
opera: true opera: true
, version: '12.14' , version: '12.14'
, windows: true , windows: true
, osversion: 'Vista'
, a: true , a: true
} }
, 'Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02': { , 'Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02': {
opera: true opera: true
, version: '12.02' , version: '12.02'
, windows: true , windows: true
, osversion: 'XP'
, a: true , a: true
} }
, 'Opera/9.80 (X11; Linux i686; U; es-ES) Presto/2.8.131 Version/11.11': { , 'Opera/9.80 (X11; Linux i686; U; es-ES) Presto/2.8.131 Version/11.11': {
@ -282,6 +291,7 @@ module.exports.useragents = {
opera: true opera: true
, version: '10.63' , version: '10.63'
, windows: true , windows: true
, osversion: '2003'
, a: true , a: true
} }
, 'Opera/9.80 (X11; Linux i686; U; it) Presto/2.5.24 Version/10.54': { , 'Opera/9.80 (X11; Linux i686; U; it) Presto/2.5.24 Version/10.54': {
@ -377,6 +387,7 @@ module.exports.useragents = {
safari: true safari: true
, version: '5.0' , version: '5.0'
, windows: true , windows: true
, osversion: 'XP'
, webkit: true , webkit: true
, c: true , c: true
} }
@ -391,6 +402,7 @@ module.exports.useragents = {
safari: true safari: true
, version: '4.1' , version: '4.1'
, windows: true , windows: true
, osversion: '2000'
, webkit: true , webkit: true
, c: true , c: true
} }
@ -575,72 +587,84 @@ module.exports.useragents = {
msie: true msie: true
, version: '11.0' , version: '11.0'
, windows: true , windows: true
, osversion: '8.1'
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko': { , 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko': {
msie: true msie: true
, version: '11.0' , version: '11.0'
, windows: true , windows: true
, osversion: '8.1'
, a: true , a: true
} }
, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; ARM; Touch; WPDesktop)': { , 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; ARM; Touch; WPDesktop)': {
msie: true msie: true
, version: '10.0' , version: '10.0'
, windows: true , windows: true
, osversion: '8'
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko': { , 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko': {
msie: true msie: true
, version: '11.0' , version: '11.0'
, windows: true , windows: true
, osversion: '8.1'
, a: true , a: true
} }
, 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0': { , 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0': {
msie: true msie: true
, version: '10.6' , version: '10.6'
, windows: true , windows: true
, osversion: '7'
, a: true , a: true
} }
, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)': { , 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)': {
msie: true msie: true
, version: '10.0' , version: '10.0'
, windows: true , windows: true
, osversion: '7'
, a: true , a: true
} }
, 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)': { , 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)': {
msie: true msie: true
, version: '9.0' , version: '9.0'
, windows: true , windows: true
, osversion: '7'
, c: true , c: true
} }
, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)': { , 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)': {
msie: true msie: true
, version: '8.0' , version: '8.0'
, windows: true , windows: true
, osversion: '7'
, c: true , c: true
} }
, 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)': { , 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)': {
msie: true msie: true
, version: '7.0' , version: '7.0'
, windows: true , windows: true
, osversion: 'XP'
, c: true , c: true
} }
, 'Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)': { , 'Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)': {
msie: true msie: true
, version: '6.1' , version: '6.1'
, windows: true , windows: true
, osversion: 'XP'
, c: true , c: true
} }
, 'Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)': { , 'Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)': {
msie: true msie: true
, version: '6.0' , version: '6.0'
, windows: true , windows: true
, osversion: 'XP'
, c: true , c: true
} }
, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)': { , 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)': {
msie: true msie: true
, version: '5.01' , version: '5.01'
, windows: true , windows: true
, osversion: 'NT'
, c: true , c: true
} }
, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Xbox; Xbox One)': { , 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Xbox; Xbox One)': {
@ -654,12 +678,14 @@ module.exports.useragents = {
, version: '11.0' , version: '11.0'
, a: true , a: true
, windows: true , windows: true
, osversion: '8.1'
} }
, 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; LCTE; rv:11.0)': { , 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; LCTE; rv:11.0)': {
msie: true msie: true
, version: '11.0' , version: '11.0'
, a: true , a: true
, windows: true , windows: true
, osversion: '10'
} }
} }
, 'Microsoft Edge': { , 'Microsoft Edge': {
@ -667,6 +693,7 @@ module.exports.useragents = {
msedge: true msedge: true
, version: '12.0' , version: '12.0'
, windows: true , windows: true
, osversion: '10'
, a: true , a: true
} }
} }
@ -716,6 +743,7 @@ module.exports.useragents = {
, firefox: true , firefox: true
, version: '25.0' , version: '25.0'
, windows: true , windows: true
, osversion: '7'
, a: true , a: true
} }
, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0': { , 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0': {
@ -751,6 +779,7 @@ module.exports.useragents = {
, firefox: true , firefox: true
, version: '15.0' , version: '15.0'
, windows: true , windows: true
, osversion: '8'
, c: true , c: true
} }
, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:2.0.4) Gecko/20120718 AskTbAVR-IDW/3.12.5.17700 Firefox/14.0.1': { , 'Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:2.0.4) Gecko/20120718 AskTbAVR-IDW/3.12.5.17700 Firefox/14.0.1': {
@ -758,6 +787,7 @@ module.exports.useragents = {
, firefox: true , firefox: true
, version: '14.0' , version: '14.0'
, windows: true , windows: true
, osversion: '7'
, c: true , c: true
} }
, 'Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0 FirePHP/0.6': { , 'Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0 FirePHP/0.6': {
@ -765,6 +795,7 @@ module.exports.useragents = {
, firefox: true , firefox: true
, version: '6.0' , version: '6.0'
, windows: true , windows: true
, osversion: 'XP'
, c: true , c: true
} }
, 'Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre': { , 'Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre': {
@ -786,6 +817,7 @@ module.exports.useragents = {
, firefox: true , firefox: true
, version: '3.6' , version: '3.6'
, windows: true , windows: true
, osversion: '7'
, c: true , c: true
} }
, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.15) Gecko/2009101601 Firefox 2.1 (.NET CLR 3.5.30729)': { , 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.15) Gecko/2009101601 Firefox 2.1 (.NET CLR 3.5.30729)': {
@ -793,6 +825,7 @@ module.exports.useragents = {
, firefox: true , firefox: true
, version: '2.1' , version: '2.1'
, windows: true , windows: true
, osversion: 'Vista'
, c: true , c: true
} }
, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061014 Firefox/1.5.0.7': { , 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061014 Firefox/1.5.0.7': {
@ -819,6 +852,7 @@ module.exports.useragents = {
, seamonkey: true , seamonkey: true
, version: '2.7' , version: '2.7'
, windows: true , windows: true
, osversion: '2003'
, x: true , x: true
} }
, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': { , 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': {
@ -1166,6 +1200,7 @@ module.exports.useragents = {
vivaldi: true vivaldi: true
, version: '1.0' , version: '1.0'
, windows: true , windows: true
, osversion: '10'
, blink: true , blink: true
, a: true , a: true
} }
@ -1225,6 +1260,7 @@ module.exports.useragents = {
}, },
'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) QupZilla/1.8.6 Safari/537.21': { 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) QupZilla/1.8.6 Safari/537.21': {
windows: true, windows: true,
osversion: '8',
qupzilla: true, qupzilla: true,
version: '1.8.6', version: '1.8.6',
webkit: true, webkit: true,
@ -1265,6 +1301,7 @@ module.exports.useragents = {
sleipnir: true sleipnir: true
, blink: true , blink: true
, windows: true , windows: true
, osversion: '7'
, x: true , x: true
, version: '6.1.4' , version: '6.1.4'
} }
@ -1272,6 +1309,7 @@ module.exports.useragents = {
, 'K-Meleon': { , 'K-Meleon': {
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20140105 Firefox/24.0 K-Meleon/74.0': { 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20140105 Firefox/24.0 K-Meleon/74.0': {
windows: true windows: true
, osversion: '7'
, kMeleon: true , kMeleon: true
, version: '74.0' , version: '74.0'
, gecko: true , gecko: true