Compare commits

..

5 Commits

Author SHA1 Message Date
Faisal Salman
dc47b6a1e9 Detect new IE 11 user-agent 2013-03-26 13:22:58 +07:00
Faisal Salman
84a8eedad4 Exclude unintended char from being captured 2013-03-26 11:10:06 +07:00
Faisal Salman
30e1e7a98f Increment version 2013-03-26 10:29:43 +07:00
Faisal Salman
c1df106dca Fix closing braces 2013-03-26 10:27:24 +07:00
Faisal Salman
edcd5402a6 Fixes issue #15 - Attach UAParser to window 2013-03-25 23:16:40 +07:00
6 changed files with 28 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "ua-parser-js",
"version": "0.5.25",
"version": "0.5.27",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device"],
"scripts": ["src/ua-parser.js"],

View File

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

View File

@@ -1,4 +1,4 @@
// UAParser.js v0.5.25
// UAParser.js v0.5.27
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
@@ -78,7 +78,7 @@
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof(q) === OBJ_TYPE) {
if (typeof(q) === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
// assign given value, ignore regex match
result[q[0]] = q[1];
@@ -209,7 +209,7 @@
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/ms(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
/((?:ms|\()ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
@@ -306,7 +306,7 @@
/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC
/(zte)-(\w+)*/i, // ZTE
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|;\ssony)[_\s-]?([\w-]+)*/i
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
@@ -448,7 +448,7 @@
device : this.getDevice()
};
};
this.getUA = function() {
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
@@ -471,14 +471,15 @@
exports = module.exports = UAParser;
}
exports.UAParser = UAParser;
} else if (typeof(define) === FUNC_TYPE && define.amd) {
// requirejs env
define(function() {
return UAParser;
});
} else {
// browser env
window.UAParser = UAParser;
window.UAParser = UAParser;
// requirejs env (optional)
if (typeof(define) === FUNC_TYPE && define.amd) {
define(function () {
return UAParser;
});
}
// jQuery specific (optional)
if (typeof(window.jQuery) !== UNDEF_TYPE) {
var $ = window.jQuery;
@@ -487,7 +488,7 @@
$.ua.get = function() {
return parser.getUA();
};
$.ua.set = function(uastring) {
$.ua.set = function (uastring) {
parser.setUA(uastring);
var result = parser.getResult();
for (var prop in result) {

File diff suppressed because one or more lines are too long

View File

@@ -239,6 +239,16 @@
"major" : "7"
}
},
{
"desc" : "IE 11",
"ua" : "Mozilla/5.0 (IE 11.0; Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko",
"expect" :
{
"name" : "IE",
"version" : "11.0",
"major" : "11"
}
},
{
"desc" : "K-Meleon",
"ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031016 K-Meleon/0.8.2",

View File

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