mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
Fix documentation
This commit is contained in:
parent
1486d1c0b3
commit
3223931d91
12
index.html
12
index.html
@ -104,7 +104,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1><a href="">UA-Parser.js</a></h1>
|
||||
<h1><a href="">UA-Parser.JS</a></h1>
|
||||
<h2>Lightweight JavaScript-based User-Agent String Parser</h2>
|
||||
<hr />
|
||||
<p class="share">
|
||||
@ -182,10 +182,10 @@
|
||||
if(arr.hasOwnProperty(i)){
|
||||
var isobj = typeof arr[i] === 'object';
|
||||
var r = isobj ? new RegExp(arr[i][0], 'i') : new RegExp(arr[i], 'i');
|
||||
if(r.test(prop['name'])){
|
||||
if(r.test(prop[key])){
|
||||
img.src = 'images/'+(isobj?arr[i][1]:arr[i])+'.png';
|
||||
return img;
|
||||
} else if(prop['name'] !== undefined){
|
||||
} else if(prop[key] !== undefined){
|
||||
img.src = 'images/check.png';
|
||||
}
|
||||
}
|
||||
@ -208,9 +208,9 @@
|
||||
imgMap(browser, 'name', ['ie', 'chrome', 'chromium', 'konqueror', 'safari', 'opera', 'firefox', ['fennec', 'firefox'], 'mozilla', 'midori', 'arora', 'camino', 'iceweasel', 'dolfin', 'rockmelt', 'flock']),
|
||||
imgMap(engine, 'name', [['trident', 'ie'], ['webkit', 'safari'], ['khtml', 'konqueror'], ['presto', 'opera'], ['gecko', 'mozilla']]),
|
||||
imgMap(os, 'name', ['meego', 'symbian', 'android', 'blackberry', 'bada', ['windows phone os', 'winphone'], 'windows', 'chromium', 'mac', 'freebsd', 'bsd', 'kubuntu', 'xubuntu', 'lubuntu', 'ubuntu', 'gentoo', 'fedora', 'mandriva', 'redhat', 'suse', 'debian', 'slackware', 'arch', 'linux', 'solaris', 'webos', 'ios', 'centos', 'pclinuxos', ['ios', 'mac'], ['rim', 'blackberry']]),
|
||||
imgMap(device, 'name', [['undefined', 'pc'], 'ipad', ['tablet', 'ipad'], ['playbook', 'ipad'], ['\\w+', 'phone']]),
|
||||
browser.name, engine.name, os.name, device.name,
|
||||
browser.version, engine.version, os.version, device.version];
|
||||
imgMap(device, 'type', [['undefined', 'pc'], ['tablet', 'ipad'], ['mobile', 'phone']]),
|
||||
browser.name, engine.name, os.name, device.vendor,
|
||||
browser.version, engine.version, os.version, device.model];
|
||||
for(var i = 0; i < prop.length; i++){
|
||||
fill(tbl[i], prop[i]);
|
||||
}
|
||||
|
33
ua-parser.js
33
ua-parser.js
@ -103,17 +103,17 @@
|
||||
|
||||
browser : [[
|
||||
|
||||
// Mixed
|
||||
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
|
||||
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)/i,
|
||||
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
|
||||
|
||||
// Presto based
|
||||
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
|
||||
/(opera\smobi)\/((\d+)?[\w\.-]+)/i, // Opera Mobile
|
||||
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
|
||||
/(opera)[\/\s]+((\d+)?[\w\.]+)/i, // Opera < 9.80
|
||||
|
||||
// Mixed
|
||||
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
|
||||
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)/i,
|
||||
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
|
||||
|
||||
// Trident based
|
||||
/(avant\sbrowser|iemobile|slimbrowser)[\/\s]?((\d+)?[\w\.]*)/i, // Avant/IEMobile/SlimBrowser
|
||||
/ms(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
|
||||
@ -144,16 +144,17 @@
|
||||
|
||||
device : [[
|
||||
|
||||
/\(((ip[honead]+|playbook));/i, // iPod/iPhone/iPad/PlayBook
|
||||
/\(((ipad|playbook));/i, // iPad/PlayBook
|
||||
/(hp).+(touchpad)/i, // HP TouchPad
|
||||
/(kindle)\/([\w\.]+)/i, // Kindle
|
||||
/\s(nook)[\w\s]+build\/(\w+)/i, // Nook
|
||||
/(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak
|
||||
], ['vendor', 'model', ['type', 'Tablet']], [
|
||||
|
||||
/\(((ip[honed]+));/i, // iPod/iPhone
|
||||
/(blackberry)[\s-]?(\w+)/i, // BlackBerry
|
||||
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|nexus|huawei|meizu)[\s_-]?([\w-]+)*/i,
|
||||
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Nexus/Huawei/Meizu
|
||||
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,
|
||||
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola
|
||||
/(hp)\s([\w\s]+\w)/i, // HP iPAQ
|
||||
/(asus)-?(\w+)/i // Asus
|
||||
], ['vendor', 'model', ['type', 'Mobile']], [
|
||||
@ -195,14 +196,14 @@
|
||||
|
||||
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG
|
||||
], [['vendor', 'LG'], 'model', ['type', 'Tablet']], [
|
||||
/(lg)[e;\s-]+(\w+)*/i
|
||||
/(lg)[e;\s-\/]+(\w+)*/i
|
||||
], [['vendor', 'LG'], 'model', ['type', 'Mobile']]
|
||||
],
|
||||
|
||||
engine : [[
|
||||
|
||||
/(presto)\/([\w\.]+)/i, // Presto
|
||||
/([aple]*webkit|trident)\/([\w\.]+)/i, // Webkit/Trident
|
||||
/([aple]*webkit|trident|netfront)\/([\w\.]+)/i, // Webkit/Trident/NetFront
|
||||
/(khtml)\/([\w\.]+)/i // KHTML
|
||||
], ['name', 'version'], [
|
||||
|
||||
@ -213,7 +214,7 @@
|
||||
os : [[
|
||||
|
||||
// Windows based
|
||||
/(windows\sphone\sos|windows)\s?([ntce\d\.\s]+\d)/i // Windows
|
||||
/(windows\sphone\sos|windows\s?[mobile]*)[\s\/]?([ntce\d\.\s]+\w)/i // Windows
|
||||
], ['name', ['version', mapper.string, maps.os.windows.version]], [
|
||||
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
|
||||
], [['name', 'Windows'], ['version', mapper.string, maps.os.windows.version]], [
|
||||
@ -221,8 +222,12 @@
|
||||
// Mobile/Embedded OS
|
||||
/(blackberry).+version\/([\w\.]+)/i, // Blackberry
|
||||
/(tizen)\/([\w\.]+)/i, // Tizen
|
||||
/(android|symbianos|symbos|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i,
|
||||
// Android/Symbian/WebOS/Palm/QNX/Bada/RIM/MeeGo
|
||||
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
|
||||
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
|
||||
], ['name', 'version'], [
|
||||
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
|
||||
], [['name', 'Symbian'], 'version'],[
|
||||
|
||||
/(nintendo|playstation)\s([wids3portable]+)/i, // Nintendo/Playstation
|
||||
|
||||
// GNU/Linux based
|
||||
@ -233,7 +238,7 @@
|
||||
/(gnu|linux)\s?([\w\.]+)*/i // Other GNU/Linux
|
||||
], ['name', 'version'], [
|
||||
|
||||
/(cros)\s([\w\.\s]+\d)/i // Chromium OS
|
||||
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
|
||||
], [['name', 'Chromium OS'], 'version'],[
|
||||
|
||||
// Solaris
|
||||
|
Loading…
x
Reference in New Issue
Block a user