Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 6d17ca2

Browse files
committed
Place more common consumer Windows OS names before Windows Server names.
Eg. "Windows Server 2008 R2 / 7" → "Windows 7 / Server 2008 R2". Ref. #88.
1 parent f2140ce commit 6d17ca2

File tree

2 files changed

+59
-58
lines changed

2 files changed

+59
-58
lines changed

platform.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
'6.4': '10',
8484
'6.3': '8.1',
8585
'6.2': '8',
86-
'6.1': 'Server 2008 R2 / 7',
87-
'6.0': 'Server 2008 / Vista',
88-
'5.2': 'Server 2003 / XP 64-bit',
86+
'6.1': '7 / Server 2008 R2',
87+
'6.0': 'Vista / Server 2008',
88+
'5.2': 'XP 64-bit / Server 2003',
8989
'5.1': 'XP',
9090
'5.01': '2000 SP1',
9191
'5.0': '2000',
@@ -332,7 +332,7 @@
332332
/** The browser/environment version */
333333
var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
334334

335-
/** A flag to indicate if the OS ends with "/ Version" */
335+
/** A flag to indicate if the OS begins with "Name Version /" */
336336
var isSpecialCasedOS;
337337

338338
/* Detectable layout engines (order is important) */
@@ -945,8 +945,9 @@
945945
}
946946
// parse OS into an object
947947
if (os) {
948-
data = / ([\d.+]+)$/.exec(os);
949-
isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
948+
data =
949+
/ ([\d.+]+)$/.exec(os) ||
950+
(isSpecialCasedOS = /^[a-z]+ ([\d.+]+) \//i.exec(os));
950951
os = {
951952
'architecture': 32,
952953
'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
@@ -1067,7 +1068,7 @@
10671068
* The family of the OS.
10681069
*
10691070
* Common values include:
1070-
* "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
1071+
* "Windows", "Windows 7 / Server 2008 R2", "Windows Vista / Server 2008",
10711072
* "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE",
10721073
* "Android", "iOS" and "Windows Phone"
10731074
*

test/test.js

+51-51
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@
247247
'version': '0.4'
248248
},
249249

250-
'Arora 0.6 (like Safari 4.x) on Windows Server 2008 / Vista': {
250+
'Arora 0.6 (like Safari 4.x) on Windows Vista / Server 2008': {
251251
'ua': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6 (Change: )',
252252
'layout': 'WebKit',
253253
'name': 'Arora',
254-
'os': 'Windows Server 2008 / Vista',
254+
'os': 'Windows Vista / Server 2008',
255255
'version': '0.6'
256256
},
257257

@@ -271,12 +271,12 @@
271271
'version': '0.11.0'
272272
},
273273

274-
'Avant Browser on Windows Server 2008 / Vista': {
274+
'Avant Browser on Windows Vista / Server 2008': {
275275
'ua': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Avant Browser)',
276276
'layout': 'Trident',
277277
'mode': 8,
278278
'name': 'Avant Browser',
279-
'os': 'Windows Server 2008 / Vista'
279+
'os': 'Windows Vista / Server 2008'
280280
},
281281

282282
'Avant Browser (IE 7 mode) on Windows XP': {
@@ -455,11 +455,11 @@
455455
'version': '34.0.1847.137'
456456
},
457457

458-
'Chrome 38.0.2103.0 on Windows Server 2008 R2 / 7 64-bit': {
458+
'Chrome 38.0.2103.0 on Windows 7 / Server 2008 R2 64-bit': {
459459
'ua': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2103.0 Safari/537.36',
460460
'layout': 'Blink',
461461
'name': 'Chrome',
462-
'os': 'Windows Server 2008 R2 / 7 64-bit',
462+
'os': 'Windows 7 / Server 2008 R2 64-bit',
463463
'version': '38.0.2103.0'
464464
},
465465

@@ -625,21 +625,21 @@
625625
'version': '3.7#{alpha}5'
626626
},
627627

628-
'Firefox 4.0#{beta}8 on Windows Server 2008 / Vista 64-bit': {
628+
'Firefox 4.0#{beta}8 on Windows Vista / Server 2008 64-bit': {
629629
'ua': 'Mozilla/5.0 (Windows NT 6.0; Win64; IA64; rv:2.0b8pre) Gecko/20101213 Firefox/4.0b8pre',
630630
'layout': 'Gecko',
631631
'name': 'Firefox',
632-
'os': 'Windows Server 2008 / Vista 64-bit',
632+
'os': 'Windows Vista / Server 2008 64-bit',
633633
'platform': 'Win64',
634634
'prerelease': 'beta',
635635
'version': '4.0#{beta}8'
636636
},
637637

638-
'Firefox 4.0#{beta}8 32-bit on Windows Server 2008 R2 / 7 64-bit': {
638+
'Firefox 4.0#{beta}8 32-bit on Windows 7 / Server 2008 R2 64-bit': {
639639
'ua': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101114 Firefox/4.0b8pre',
640640
'layout': 'Gecko',
641641
'name': 'Firefox',
642-
'os': 'Windows Server 2008 R2 / 7 64-bit',
642+
'os': 'Windows 7 / Server 2008 R2 64-bit',
643643
'platform': 'Win32',
644644
'prerelease': 'beta',
645645
'version': '4.0#{beta}8'
@@ -932,11 +932,11 @@
932932
'version': '6.1'
933933
},
934934

935-
'IE 7.0#{beta} on Windows Server 2003 / XP 64-bit': {
935+
'IE 7.0#{beta} on Windows XP 64-bit / Server 2003': {
936936
'ua': 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2)',
937937
'layout': 'Trident',
938938
'name': 'IE',
939-
'os': 'Windows Server 2003 / XP 64-bit',
939+
'os': 'Windows XP 64-bit / Server 2003',
940940
'prerelease': 'beta',
941941
'version': '7.0#{beta}'
942942
},
@@ -987,58 +987,58 @@
987987
'version': '8.0'
988988
},
989989

990-
'IE 8.0 32-bit on Windows Server 2008 / Vista 64-bit': {
990+
'IE 8.0 32-bit on Windows Vista / Server 2008 64-bit': {
991991
'ua': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0)',
992992
'cpuClass': 'x86',
993993
'layout': 'Trident',
994994
'mode': 8,
995995
'name': 'IE',
996-
'os': 'Windows Server 2008 / Vista 64-bit',
996+
'os': 'Windows Vista / Server 2008 64-bit',
997997
'platform': 'Win32',
998998
'version': '8.0'
999999
},
10001000

1001-
'IE 8.0 on Windows Server 2008 R2 / 7 64-bit': {
1001+
'IE 8.0 on Windows 7 / Server 2008 R2 64-bit': {
10021002
'ua': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0)',
10031003
'cpuClass': 'x64',
10041004
'layout': 'Trident',
10051005
'mode': 8,
10061006
'name': 'IE',
1007-
'os': 'Windows Server 2008 R2 / 7 64-bit',
1007+
'os': 'Windows 7 / Server 2008 R2 64-bit',
10081008
'platform': 'Win64',
10091009
'version': '8.0'
10101010
},
10111011

1012-
'IE 9.0 (platform preview) on Windows Server 2008 R2 / 7': {
1012+
'IE 9.0 (platform preview) on Windows 7 / Server 2008 R2': {
10131013
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
10141014
'external': null,
10151015
'layout': 'Trident',
10161016
'mode': 9,
10171017
'name': 'IE',
1018-
'os': 'Windows Server 2008 R2 / 7',
1018+
'os': 'Windows 7 / Server 2008 R2',
10191019
'version': '9.0'
10201020
},
10211021

1022-
'IE 9.0#{beta} (IE 7 mode) on Windows Server 2008 R2 / 7': {
1022+
'IE 9.0#{beta} (IE 7 mode) on Windows 7 / Server 2008 R2': {
10231023
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
10241024
'appMinorVersion': 'beta',
10251025
'layout': 'Trident',
10261026
'mode': 7,
10271027
'name': 'IE',
1028-
'os': 'Windows Server 2008 R2 / 7',
1028+
'os': 'Windows 7 / Server 2008 R2',
10291029
'prerelease': 'beta',
10301030
'version': '9.0#{beta}'
10311031
},
10321032

1033-
'IE 9.0#{beta} (platform preview; IE 8 mode) on Windows Server 2008 R2 / 7': {
1033+
'IE 9.0#{beta} (platform preview; IE 8 mode) on Windows 7 / Server 2008 R2': {
10341034
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
10351035
'appMinorVersion': 'beta',
10361036
'cpuClass': 'x86',
10371037
'external': null,
10381038
'layout': 'Trident',
10391039
'mode': 8,
10401040
'name': 'IE',
1041-
'os': 'Windows Server 2008 R2 / 7',
1041+
'os': 'Windows 7 / Server 2008 R2',
10421042
'prerelease': 'beta',
10431043
'version': '9.0#{beta}'
10441044
},
@@ -1063,12 +1063,12 @@
10631063
'version': '9.0'
10641064
},
10651065

1066-
'IE 9.0 on Windows Server 2008 R2 / 7 64-bit': {
1066+
'IE 9.0 on Windows 7 / Server 2008 R2 64-bit': {
10671067
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; AMD64; Trident/5.0)',
10681068
'layout': 'Trident',
10691069
'mode': 9,
10701070
'name': 'IE',
1071-
'os': 'Windows Server 2008 R2 / 7 64-bit',
1071+
'os': 'Windows 7 / Server 2008 R2 64-bit',
10721072
'version': '9.0'
10731073
},
10741074

@@ -1082,13 +1082,13 @@
10821082
'version': '10.0'
10831083
},
10841084

1085-
'IE 10.0 (platform preview) on Windows Server 2008 / Vista': {
1085+
'IE 10.0 (platform preview) on Windows Vista / Server 2008': {
10861086
'ua': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.0; Trident/6.0)',
10871087
'external': null,
10881088
'layout': 'Trident',
10891089
'mode': 10,
10901090
'name': 'IE',
1091-
'os': 'Windows Server 2008 / Vista',
1091+
'os': 'Windows Vista / Server 2008',
10921092
'version': '10.0'
10931093
},
10941094

@@ -1110,21 +1110,21 @@
11101110
'version': '11.0'
11111111
},
11121112

1113-
'IE 11.0 32-bit (identifying as Firefox 12.0) on Windows Server 2008 R2 / 7 64-bit': {
1113+
'IE 11.0 32-bit (identifying as Firefox 12.0) on Windows 7 / Server 2008 R2 64-bit': {
11141114
'ua': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko/20100101 Firefox/12.0',
11151115
'layout': 'Trident',
11161116
'mode': 11,
11171117
'name': 'IE',
1118-
'os': 'Windows Server 2008 R2 / 7 64-bit',
1118+
'os': 'Windows 7 / Server 2008 R2 64-bit',
11191119
'version': '11.0'
11201120
},
11211121

1122-
'IE 11.0 32-bit (identifying as Firefox 22.0) on Windows Server 2008 R2 / 7 64-bit': {
1122+
'IE 11.0 32-bit (identifying as Firefox 22.0) on Windows 7 / Server 2008 R2 64-bit': {
11231123
'ua': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko/20100101 Firefox/22.0',
11241124
'layout': 'Trident',
11251125
'mode': 11,
11261126
'name': 'IE',
1127-
'os': 'Windows Server 2008 R2 / 7 64-bit',
1127+
'os': 'Windows 7 / Server 2008 R2 64-bit',
11281128
'version': '11.0'
11291129
},
11301130

@@ -1269,11 +1269,11 @@
12691269
'version': '11.0'
12701270
},
12711271

1272-
'SRWare Iron 0.2.152.0 on Windows Server 2008 / Vista': {
1272+
'SRWare Iron 0.2.152.0 on Windows Vista / Server 2008': {
12731273
'ua': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Iron/0.2.152.0 Safari/41562480.525',
12741274
'layout': 'WebKit',
12751275
'name': 'SRWare Iron',
1276-
'os': 'Windows Server 2008 / Vista',
1276+
'os': 'Windows Vista / Server 2008',
12771277
'version': '0.2.152.0'
12781278
},
12791279

@@ -1338,40 +1338,40 @@
13381338
'version': '4.7.1'
13391339
},
13401340

1341-
'Lunascape 5.0#{alpha}3 (Trident) on Windows Server 2003 / XP 64-bit': {
1341+
'Lunascape 5.0#{alpha}3 (Trident) on Windows XP 64-bit / Server 2003': {
13421342
'ua': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Lunascape 5.0 alpha3)',
13431343
'layout': 'Trident',
13441344
'name': 'Lunascape',
1345-
'os': 'Windows Server 2003 / XP 64-bit',
1345+
'os': 'Windows XP 64-bit / Server 2003',
13461346
'prerelease': 'alpha',
13471347
'version': '5.0#{alpha}3'
13481348
},
13491349

1350-
'Lunascape 6.1.7.21880 (Trident) on Windows Server 2008 R2 / 7': {
1350+
'Lunascape 6.1.7.21880 (Trident) on Windows 7 / Server 2008 R2': {
13511351
'ua': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; Lunascape 6.1.7.21880)',
13521352
'layout': 'Trident',
13531353
'mode': 8,
13541354
'name': 'Lunascape',
1355-
'os': 'Windows Server 2008 R2 / 7',
1355+
'os': 'Windows 7 / Server 2008 R2',
13561356
'version': '6.1.7.21880'
13571357
},
13581358

1359-
'Lunascape 6.2.1.22445 (Gecko) on Windows Server 2008 / Vista': {
1359+
'Lunascape 6.2.1.22445 (Gecko) on Windows Vista / Server 2008': {
13601360
'ua': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.13) Gecko/20100917 Firefox/3.5.13 Lunascape/6.2.1.22445',
13611361
'layout': 'Gecko',
13621362
'name': 'Lunascape',
1363-
'os': 'Windows Server 2008 / Vista',
1363+
'os': 'Windows Vista / Server 2008',
13641364
'version': '6.2.1.22445'
13651365
},
13661366

1367-
'Lunascape 6.3.1.22729#{beta} (Trident) on Windows Server 2008 / Vista': {
1367+
'Lunascape 6.3.1.22729#{beta} (Trident) on Windows Vista / Server 2008': {
13681368
'ua': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; Lunascape/6.3.1.22729)',
13691369
'appMinorVersion': 'beta',
13701370
'external': null,
13711371
'layout': 'Trident',
13721372
'mode': 9,
13731373
'name': 'Lunascape',
1374-
'os': 'Windows Server 2008 / Vista',
1374+
'os': 'Windows Vista / Server 2008',
13751375
'prerelease': 'beta',
13761376
'version': '6.3.1.22729#{beta}'
13771377
},
@@ -1844,11 +1844,11 @@
18441844
'version': '4.0.4'
18451845
},
18461846

1847-
'Safari 5.1 on Windows Server 2008 R2 / 7': {
1847+
'Safari 5.1 on Windows 7 / Server 2008 R2': {
18481848
'ua': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50',
18491849
'layout': 'WebKit',
18501850
'name': 'Safari',
1851-
'os': 'Windows Server 2008 R2 / 7',
1851+
'os': 'Windows 7 / Server 2008 R2',
18521852
'version': '5.1'
18531853
},
18541854

@@ -1921,11 +1921,11 @@
19211921
'version': '1.1.13'
19221922
},
19231923

1924-
'SeaMonkey 2.0#{beta}1 on Windows Server 2008 / Vista': {
1924+
'SeaMonkey 2.0#{beta}1 on Windows Vista / Server 2008': {
19251925
'ua': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1pre) Gecko/20090717 SeaMonkey/2.0b1',
19261926
'layout': 'Gecko',
19271927
'name': 'SeaMonkey',
1928-
'os': 'Windows Server 2008 / Vista',
1928+
'os': 'Windows Vista / Server 2008',
19291929
'prerelease': 'beta',
19301930
'version': '2.0#{beta}1'
19311931
},
@@ -2045,12 +2045,12 @@
20452045
'version': '2.9.2#{beta}'
20462046
},
20472047

2048-
'Sleipnir 2.9.4 (IE 7 mode) on Windows Server 2008 / Vista': {
2048+
'Sleipnir 2.9.4 (IE 7 mode) on Windows Vista / Server 2008': {
20492049
'ua': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; Sleipnir/2.9.4)',
20502050
'layout': 'Trident',
20512051
'mode': 7,
20522052
'name': 'Sleipnir',
2053-
'os': 'Windows Server 2008 / Vista',
2053+
'os': 'Windows Vista / Server 2008',
20542054
'version': '2.9.4'
20552055
},
20562056

@@ -2062,12 +2062,12 @@
20622062
'os': 'Windows XP'
20632063
},
20642064

2065-
'SlimBrowser (IE 5 mode) on Windows Server 2008 R2 / 7': {
2065+
'SlimBrowser (IE 5 mode) on Windows 7 / Server 2008 R2': {
20662066
'ua': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SlimBrowser)',
20672067
'layout': 'Trident',
20682068
'mode': 5,
20692069
'name': 'SlimBrowser',
2070-
'os': 'Windows Server 2008 R2 / 7'
2070+
'os': 'Windows 7 / Server 2008 R2'
20712071
},
20722072

20732073
'Sunrise 1.7.5 on OS X 10.5.5': {
@@ -2192,7 +2192,7 @@
21922192
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:7.0) Gecko/20110929 Firefox/7.0-x64 PaleMoon/7.0-x64': {
21932193
'ua': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:7.0) Gecko/20110929 Firefox/7.0-x64 PaleMoon/7.0-x64',
21942194
'layout': 'Gecko',
2195-
'os': 'Windows Server 2008 R2 / 7 64-bit'
2195+
'os': 'Windows 7 / Server 2008 R2 64-bit'
21962196
},
21972197

21982198
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Prism/1.0b2': {
@@ -2283,7 +2283,7 @@
22832283

22842284
QUnit.test('parses IE identifying as Firefox 12.0', function(assert) {
22852285
var actual = parse('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko/20100101 Firefox/12.0'),
2286-
expected = 'IE 11.0 32-bit (identifying as Firefox 12.0) on Windows Server 2008 R2 / 7 64-bit';
2286+
expected = 'IE 11.0 32-bit (identifying as Firefox 12.0) on Windows 7 / Server 2008 R2 64-bit';
22872287

22882288
assert.strictEqual(actual.description, expected);
22892289
});
@@ -2360,7 +2360,7 @@
23602360

23612361
QUnit.test('parses Windows 7 OS', function(assert) {
23622362
var actual = parse('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36'),
2363-
expected = 'Windows Server 2008 R2 / 7';
2363+
expected = 'Windows 7 / Server 2008 R2';
23642364

23652365
assert.strictEqual(actual.os.family, expected);
23662366
assert.strictEqual(actual.os.version, '7');

0 commit comments

Comments
 (0)