Merge branch 'master' into fix/util-extend

* master:
  Meteor fixes
  fix it for opera mini 8 above on iphone
  Add name to UA-Parser
  Fix image #150
  Increment build version: 0.7.10
  Check for tablet first
  Fix #153 mistaken Search phrase for Arch OS
  Seems to fix the issue for specific UA found in #159
  UAParser is exposed globally to the window object. It can be used directly.
  Fix detection of Firefox on iOS.
  Added hasOwnProperty check
  Generalize the check for an unidentifiable mobile or tablet to correctly categorize unidentifiable Android smartphones as "mobile".
  travis update: node_js stable, cache node_modules, sudo false
  Detect Nexus 6 as Motorola only.
  Add Playstation 4 support.
  Added Nexus 6 detection
  Added DEVICE regular expressions for "Samsung galaxy S6" and "Samsung Galaxy S6 Edge" devices + test cases
  Adding PhantomJS (http://phantomjs.org/)
  Add Sleipnir
This commit is contained in:
Malash 2016-02-22 15:15:09 +08:00
commit d929c3e508
13 changed files with 191 additions and 121 deletions

View File

@ -1,5 +1,13 @@
language: node_js
node_js:
- "0.10"
- stable
- "0.10"
notifications:
email: false
cache:
directories:
- node_modules
sudo: false

View File

@ -1,6 +1,6 @@
{
"name": "ua-parser-js",
"version": "0.7.9",
"version": "0.7.10",
"authors": [
"Faisal Salman <fyzlman@gmail.com>"
],

View File

@ -1,6 +1,6 @@
{
"name": "ua-parser-js",
"version": "0.7.9",
"version": "0.7.10",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [
"user-agent",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,12 @@
Package.describe({
name: 'faisalman:ua-parser-js',
version: '0.7.9',
version: '0.7.10',
summary: 'Lightweight JavaScript-based user-agent string parser',
git: 'https://github.com/faisalman/ua-parser-js.git',
documentation: 'readme.md'
});
Package.on_use(function (api) {
api.export("UAParser");
Package.onUse(function (api) {
api.addFiles("src/ua-parser.js");
api.export("UAParser");
});

View File

@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "0.7.9",
"version": "0.7.10",
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [

View File

@ -13,7 +13,7 @@ Lightweight JavaScript-based User-Agent string parser. Supports browser & node.j
Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model purely from user-agent string with relatively lightweight footprint (~11KB minified / ~4KB gzipped). Written in vanilla js, which means it doesn't depends on any other library.
![It's over 9000](https://pbs.twimg.com/media/A9LpEG6CIAA5VrT.jpg)
![It's over 9000](https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/over9000.jpg)
## Methods
@ -28,8 +28,8 @@ Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, IceDrago
Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links,
Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari,
Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet],
Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, Swiftfox,
Tizen, UCBrowser, Vivaldi, w3m, Yandex
PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser,
Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, Yandex
# 'browser.version' determined dynamically
```

View File

@ -1,5 +1,5 @@
/**
* UAParser.js v0.7.9
* UAParser.js v0.7.10
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
@ -16,7 +16,7 @@
/////////////
var LIBVERSION = '0.7.9',
var LIBVERSION = '0.7.10',
EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
@ -92,11 +92,13 @@
if (typeof result === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof q === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
if (props.hasOwnProperty(p)){
q = props[p];
if (typeof q === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
}
@ -234,9 +236,11 @@
/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/([\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80
], [NAME, VERSION], [
/(OPiOS)[\/\s]+([\w\.]+)/i // Opera mini on iphone >= 8.0
], [[NAME, 'Opera Mini'], VERSION], [
/\s(opr)\/([\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION], [
@ -252,8 +256,8 @@
// Webkit/KHTML based
/(rekonq)\/([\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium)\/([\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS
], [NAME, VERSION], [
/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11
@ -295,6 +299,9 @@
/FBAV\/([\w\.]+);/i // Facebook App for iOS
], [VERSION, [NAME, 'Facebook']], [
/fxios\/([\w\.-]+)/i // Firefox for iOS
], [VERSION, [NAME, 'Firefox']], [
/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, [NAME, 'Mobile Safari']], [
@ -311,8 +318,6 @@
// Gecko based
/(navigator|netscape)\/([\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION], [
/fxios\/([\w\.-]+)/i // Firefox for iOS
], [VERSION, [NAME, 'Firefox']], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
@ -321,8 +326,8 @@
/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir
/(links)\s\(([\w\.]+)/i, // Links
/(gobrowser)\/?([\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser
@ -520,7 +525,7 @@
/android.+;\s(shield)\sbuild/i // Nvidia
], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
/(playstation\s[3portablevi]+)/i // Playstation
/(playstation\s[34portablevi]+)/i // Playstation
], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [
/(sprint\s(\w+))/i // Sprint Phones
@ -546,7 +551,8 @@
// Motorola
/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,
/mot[\s-]?(\w+)*/i,
/(XT\d{3,4}) build\//i
/(XT\d{3,4}) build\//i,
/(nexus\s[6])/i
], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [
/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i
], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [
@ -598,7 +604,8 @@
/android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi
], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [
/(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable
/\s(tablet)[;\/\s]/i, // Unidentifiable Tablet
/\s(mobile)[;\/\s]/i // Unidentifiable Mobile
], [[TYPE, util.lowerize], VENDOR, MODEL]
/*//////////////////////////
@ -707,12 +714,12 @@
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
/(nintendo|playstation)\s([wids34portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
@ -730,7 +737,7 @@
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
/(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,
@ -845,7 +852,7 @@
} else {
// requirejs env (optional)
if (typeof(define) === FUNC_TYPE && define.amd) {
define(function () {
define("ua-parser-js", [], function () {
return UAParser;
});
} else {

View File

@ -529,6 +529,16 @@
"major" : "5"
}
},
{
"desc" : "Opera Mini 8 above on iPhone",
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) OPiOS/12.1.1.98980 Mobile/13C75 Safari/9537.53",
"expect" :
{
"name" : "Opera Mini",
"version" : "12.1.1.98980",
"major" : "12"
}
},
{
"desc" : "Opera Tablet",
"ua" : "Opera/9.80 (Windows NT 6.1; Opera Tablet/15165; U; en) Presto/2.8.149 Version/11.1",
@ -539,6 +549,16 @@
"major" : "11"
}
},
{
"desc" : "PhantomJS",
"ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34",
"expect" :
{
"name" : "PhantomJS",
"version" : "1.9.2",
"major" : "1"
}
},
{
"desc" : "Phoenix",
"ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021029 Phoenix/0.4",
@ -728,5 +748,15 @@
"version" : "43.8",
"major" : "43"
}
},
{
"desc" : "Firefox iOS",
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) FxiOS/1.1 Mobile/13B143 Safari/601.1.46",
"expect" :
{
"name" : "Firefox",
"version" : "1.1",
"major" : "1"
}
}
]

View File

@ -39,6 +39,16 @@
"type" : "mobile"
}
},
{
"desc" : "Motorola Nexus 6",
"ua" : "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36",
"expect" :
{
"vendor" : "Motorola",
"model" : "Nexus 6",
"type" : "mobile"
}
},
{
"desc" : "Motorola Droid RAZR 4G",
"ua" : "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; DROID RAZR 4G Build/6.5.1-73_DHD-11_M1-29) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
@ -238,5 +248,25 @@
"model" : "MI-ONE Plus",
"type" : "mobile"
}
},
{
"desc" : "PlayStation 4",
"ua" : "Mozilla/5.0 (PlayStation 4 3.00) AppleWebKit/537.73 (KHTML, like Gecko)",
"expect" :
{
"vendor" : "Sony",
"model" : "PlayStation 4",
"type" : "console"
}
},
{
"desc" : "Galaxy Nexus",
"ua" : "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
"expect" :
{
"vendor" : "Samsung",
"model" : "Galaxy Nexus",
"type" : "mobile"
}
}
]

View File

@ -251,6 +251,15 @@
"version" : ""
}
},
{
"desc" : "PlayStation 4",
"ua" : "Mozilla/5.0 (PlayStation 4 3.00) AppleWebKit/537.73 (KHTML, like Gecko)",
"expect" :
{
"name" : "PlayStation",
"version" : "4"
}
},
{
"desc" : "Mint",
"ua" : "",

View File

@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "0.7.9",
"version": "0.7.10",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [
"user-agent",