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

Commit

Permalink
Update Chrome ua detection
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsLeenheer committed Apr 21, 2012
1 parent d04c12f commit cd8bd6c
Showing 1 changed file with 38 additions and 61 deletions.
99 changes: 38 additions & 61 deletions scripts/useragents.js
Expand Up @@ -4079,80 +4079,57 @@ var UserAgents = (function(){
* Chrome * Chrome
*/ */


if (match = /Chrome\/([0-9.]*)/.exec(ua)) { if (match = /(?:Chrome|CrMo)\/([0-9.]*)/.exec(ua)) {
this.browser.stock = false; this.browser.stock = false;
this.browser.name = 'Chrome'; this.browser.name = 'Chrome';
this.browser.version = new Version({ value: match[1] }); this.browser.version = new Version({ value: match[1] });


switch (match[1].split('.', 3).join('.')) { if (this.os.name == 'Android') {
case '0.2.149':
case '0.3.154':
case '0.4.154':
case '1.0.154':
case '2.0.172':
case '3.0.195':
case '4.0.249':
case '4.1.249':
case '5.0.375':
case '6.0.472':
case '7.0.517':
case '8.0.552':
case '9.0.597':
case '10.0.648':
case '11.0.696':
case '12.0.742':
case '13.0.782':
case '14.0.835':
case '15.0.874':
case '16.0.912':
case '17.0.963':
case '18.0.1025':
if (this.browser.version.minor == 0)
this.browser.version.details = 1;
else
this.browser.version.details = 2;

break;
default:
this.browser.channel = 'Nightly';
break;
}
}

/****************************************************
* Chrome Mobile
*/

if (ua.match('CrMo')) {
this.browser.stock = false;
this.browser.name = 'Chrome';

if (match = /CrMo\/([0-9.]*)/.exec(ua)) {
this.browser.version = new Version({ value: match[1] });

switch (match[1].split('.', 3).join('.')) { switch (match[1].split('.', 3).join('.')) {
case '16.0.912': case '16.0.912':
case '18.0.1025':
this.browser.channel = 'Beta'; this.browser.channel = 'Beta';
break; break;
default: default:
this.browser.channel = 'Nightly'; this.browser.channel = 'Nightly';
break; break;
} }
} }
}

else {
if (match = /Chrome\/([0-9.]*) Mobile/.exec(ua)) { switch (match[1].split('.', 3).join('.')) {
this.browser.stock = false; case '0.2.149':
this.browser.name = 'Chrome'; case '0.3.154':
this.browser.version = new Version({ value: match[1] }); case '0.4.154':

case '1.0.154':
switch (match[1].split('.', 3).join('.')) { case '2.0.172':
case '18.0.1025': case '3.0.195':
this.browser.channel = 'Beta'; case '4.0.249':
break; case '4.1.249':
default: case '5.0.375':
this.browser.channel = 'Nightly'; case '6.0.472':
break; case '7.0.517':
case '8.0.552':
case '9.0.597':
case '10.0.648':
case '11.0.696':
case '12.0.742':
case '13.0.782':
case '14.0.835':
case '15.0.874':
case '16.0.912':
case '17.0.963':
case '18.0.1025':
if (this.browser.version.minor == 0)
this.browser.version.details = 1;
else
this.browser.version.details = 2;

break;
default:
this.browser.channel = 'Nightly';
break;
}
} }
} }


Expand Down

0 comments on commit cd8bd6c

Please sign in to comment.