mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-28 00:18:45 +03:00
update 0.7.14
This commit is contained in:
parent
e20b78fa6a
commit
b8b39dcfd2
14
index.html
14
index.html
@ -7,18 +7,18 @@
|
|||||||
<meta name="description" content="UAParser.js Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as jQuery plugin & AMD module." />
|
<meta name="description" content="UAParser.js Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as jQuery plugin & AMD module." />
|
||||||
<meta name="keywords" content="user agent, parser, javascript, detect, details, new, browser, engine, mobile, device, operating system" />
|
<meta name="keywords" content="user agent, parser, javascript, detect, details, new, browser, engine, mobile, device, operating system" />
|
||||||
<style>
|
<style>
|
||||||
@import url("//fonts.googleapis.com/css?family=Raleway");
|
@import url("https://fonts.googleapis.com/css?family=Kalam");
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: Raleway, Helvetica, Ubuntu, Arial, Georgia, sans-serif;
|
font-family: Kalam, Helvetica, Ubuntu, Arial, Georgia, sans-serif;
|
||||||
}
|
}
|
||||||
html, input, select {
|
html, input, select {
|
||||||
font: 14px/20px Helvetica, Ubuntu, Arial, Georgia, sans-serif;
|
font: 14px/20px Helvetica, Ubuntu, Arial, Georgia, sans-serif;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
background: #33A6B2;
|
background: #548796;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 960px;
|
width: 960px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -29,17 +29,17 @@
|
|||||||
}
|
}
|
||||||
header {
|
header {
|
||||||
padding: 100px 50px 50px;
|
padding: 100px 50px 50px;
|
||||||
background-color: #196674;
|
background-color: #2A4149;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
section {
|
section {
|
||||||
background-color: #F0F0F0;
|
background-color: #E3F0C6;
|
||||||
}
|
}
|
||||||
section.test {
|
section.test {
|
||||||
background-color: #218777;
|
background-color: #ACCBB5;
|
||||||
}
|
}
|
||||||
footer {
|
footer {
|
||||||
background-color: #33332D;
|
background-color: #FE6B44;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
footer a {
|
footer a {
|
||||||
|
@ -874,7 +874,7 @@
|
|||||||
/////////////////
|
/////////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
////////////////
|
////////////////
|
||||||
|
/*
|
||||||
var Browser = function (name, version) {
|
var Browser = function (name, version) {
|
||||||
this[NAME] = name;
|
this[NAME] = name;
|
||||||
this[VERSION] = version;
|
this[VERSION] = version;
|
||||||
@ -889,7 +889,7 @@
|
|||||||
};
|
};
|
||||||
var Engine = Browser;
|
var Engine = Browser;
|
||||||
var OS = Browser;
|
var OS = Browser;
|
||||||
|
*/
|
||||||
var UAParser = function (uastring, extensions) {
|
var UAParser = function (uastring, extensions) {
|
||||||
|
|
||||||
if (typeof uastring === 'object') {
|
if (typeof uastring === 'object') {
|
||||||
@ -903,30 +903,35 @@
|
|||||||
|
|
||||||
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
|
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
|
||||||
var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
|
var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
|
||||||
var browser = new Browser();
|
//var browser = new Browser();
|
||||||
var cpu = new CPU();
|
//var cpu = new CPU();
|
||||||
var device = new Device();
|
//var device = new Device();
|
||||||
var engine = new Engine();
|
//var engine = new Engine();
|
||||||
var os = new OS();
|
//var os = new OS();
|
||||||
|
|
||||||
this.getBrowser = function () {
|
this.getBrowser = function () {
|
||||||
|
var browser = { name: undefined, version: undefined };
|
||||||
mapper.rgx.call(browser, ua, rgxmap.browser);
|
mapper.rgx.call(browser, ua, rgxmap.browser);
|
||||||
browser.major = util.major(browser.version); // deprecated
|
browser.major = util.major(browser.version); // deprecated
|
||||||
return browser;
|
return browser;
|
||||||
};
|
};
|
||||||
this.getCPU = function () {
|
this.getCPU = function () {
|
||||||
|
var cpu = { architecture: undefined };
|
||||||
mapper.rgx.call(cpu, ua, rgxmap.cpu);
|
mapper.rgx.call(cpu, ua, rgxmap.cpu);
|
||||||
return cpu;
|
return cpu;
|
||||||
};
|
};
|
||||||
this.getDevice = function () {
|
this.getDevice = function () {
|
||||||
|
var device = { vendor: undefined, model: undefined, type: undefined };
|
||||||
mapper.rgx.call(device, ua, rgxmap.device);
|
mapper.rgx.call(device, ua, rgxmap.device);
|
||||||
return device;
|
return device;
|
||||||
};
|
};
|
||||||
this.getEngine = function () {
|
this.getEngine = function () {
|
||||||
|
var engine = { name: undefined, version: undefined };
|
||||||
mapper.rgx.call(engine, ua, rgxmap.engine);
|
mapper.rgx.call(engine, ua, rgxmap.engine);
|
||||||
return engine;
|
return engine;
|
||||||
};
|
};
|
||||||
this.getOS = function () {
|
this.getOS = function () {
|
||||||
|
var os = { name: undefined, version: undefined };
|
||||||
mapper.rgx.call(os, ua, rgxmap.os);
|
mapper.rgx.call(os, ua, rgxmap.os);
|
||||||
return os;
|
return os;
|
||||||
};
|
};
|
||||||
@ -945,11 +950,11 @@
|
|||||||
};
|
};
|
||||||
this.setUA = function (uastring) {
|
this.setUA = function (uastring) {
|
||||||
ua = uastring;
|
ua = uastring;
|
||||||
browser = new Browser();
|
//browser = new Browser();
|
||||||
cpu = new CPU();
|
//cpu = new CPU();
|
||||||
device = new Device();
|
//device = new Device();
|
||||||
engine = new Engine();
|
//engine = new Engine();
|
||||||
os = new OS();
|
//os = new OS();
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user