Add meteor support

This commit is contained in:
Faisal Salman 2015-04-07 02:40:50 +07:00
parent fa6f8de25f
commit cce9dc1474
9 changed files with 34 additions and 22 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ npm-debug.log
Session.vim Session.vim
.netrwhist .netrwhist
*~ *~
.versions
### OSX ### ### OSX ###
.DS_Store .DS_Store

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
Package.describe({ Package.describe({
name: 'faisalman:ua-parser-js', name: 'faisalman:ua-parser-js',
version: '0.7.4', version: '0.7.5',
summary: 'Lightweight JavaScript-based user-agent string parser', summary: 'Lightweight JavaScript-based user-agent string parser',
git: 'https://github.com/faisalman/ua-parser-js.git', git: 'https://github.com/faisalman/ua-parser-js.git',
documentation: 'readme.md' documentation: 'readme.md'

View File

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

View File

@ -1,6 +1,6 @@
# UAParser.js # UAParser.js
Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as jQuery/Zepto plugin, Component package, Bower package, & AMD module Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as jQuery/Zepto plugin, Component package, Bower package, Meteor package, & AMD module
[![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js)
@ -221,6 +221,12 @@ console.log(parser.getResult());
$ bower install ua-parser-js $ bower install ua-parser-js
``` ```
### Using meteor
```sh
$ meteor add faisalman:ua-parser-js
```
### Using jQuery/Zepto ($.ua) ### Using jQuery/Zepto ($.ua)
Although written in vanilla js (which means it doesn't depends on jQuery), this library will automatically detect if jQuery/Zepto is present and create `$.ua` object based on browser's user-agent (although in case you need, `window.UAParser` constructor is still present). To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`. Although written in vanilla js (which means it doesn't depends on jQuery), this library will automatically detect if jQuery/Zepto is present and create `$.ua` object based on browser's user-agent (although in case you need, `window.UAParser` constructor is still present). To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`.
@ -259,7 +265,7 @@ Then submit a pull request to https://github.com/faisalman/ua-parser-js under `d
Dual licensed under GPLv2 & MIT Dual licensed under GPLv2 & MIT
Copyright © 2012-2014 Faisal Salman <<fyzlman@gmail.com>> Copyright © 2012-2015 Faisal Salman <<fyzlman@gmail.com>>
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View File

@ -1,9 +1,9 @@
/** /**
* UAParser.js v0.7.4 * UAParser.js v0.7.5
* Lightweight JavaScript-based User-Agent string parser * Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js * https://github.com/faisalman/ua-parser-js
* *
* Copyright © 2012-2014 Faisal Salman <fyzlman@gmail.com> * Copyright © 2012-2015 Faisal Salman <fyzlman@gmail.com>
* Dual licensed under GPLv2 & MIT * Dual licensed under GPLv2 & MIT
*/ */
@ -16,7 +16,7 @@
///////////// /////////////
var LIBVERSION = '0.7.4', var LIBVERSION = '0.7.5',
EMPTY = '', EMPTY = '',
UNKNOWN = '?', UNKNOWN = '?',
FUNC_TYPE = 'function', FUNC_TYPE = 'function',
@ -734,10 +734,10 @@
//////////////// ////////////////
var UAParser = function (uastring, extensions) { var _UAParser = function (uastring, extensions) {
if (!(this instanceof UAParser)) { if (!(this instanceof _UAParser)) {
return new UAParser(uastring, extensions).getResult(); return new _UAParser(uastring, extensions).getResult();
} }
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);
@ -781,16 +781,16 @@
return this; return this;
}; };
UAParser.VERSION = LIBVERSION; _UAParser.VERSION = LIBVERSION;
UAParser.BROWSER = { _UAParser.BROWSER = {
NAME : NAME, NAME : NAME,
MAJOR : MAJOR, MAJOR : MAJOR,
VERSION : VERSION VERSION : VERSION
}; };
UAParser.CPU = { _UAParser.CPU = {
ARCHITECTURE : ARCHITECTURE ARCHITECTURE : ARCHITECTURE
}; };
UAParser.DEVICE = { _UAParser.DEVICE = {
MODEL : MODEL, MODEL : MODEL,
VENDOR : VENDOR, VENDOR : VENDOR,
TYPE : TYPE, TYPE : TYPE,
@ -801,11 +801,11 @@
WEARABLE: WEARABLE, WEARABLE: WEARABLE,
EMBEDDED: EMBEDDED EMBEDDED: EMBEDDED
}; };
UAParser.ENGINE = { _UAParser.ENGINE = {
NAME : NAME, NAME : NAME,
VERSION : VERSION VERSION : VERSION
}; };
UAParser.OS = { _UAParser.OS = {
NAME : NAME, NAME : NAME,
VERSION : VERSION VERSION : VERSION
}; };
@ -818,12 +818,17 @@
// check js environment // check js environment
if (typeof(exports) !== UNDEF_TYPE) { if (typeof(exports) !== UNDEF_TYPE) {
var UAParser = _UAParser;
// nodejs env // nodejs env
if (typeof(module) !== UNDEF_TYPE && module.exports) { if (typeof(module) !== UNDEF_TYPE && module.exports) {
exports = module.exports = UAParser; exports = module.exports = UAParser;
} }
exports.UAParser = UAParser; exports.UAParser = UAParser;
} else if (typeof(Package) !== UNDEF_TYPE) {
// meteor
UAParser = _UAParser;
} else { } else {
var UAParser = _UAParser;
// browser env // browser env
window.UAParser = UAParser; window.UAParser = UAParser;
// requirejs env (optional) // requirejs env (optional)

View File

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