Skip to content

Commit

Permalink
Add meteor support
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Apr 6, 2015
1 parent fa6f8de commit cce9dc1
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ npm-debug.log
Session.vim
.netrwhist
*~
.versions

### OSX ###
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ua-parser-js",
"version": "0.7.4",
"version": "0.7.5",
"authors": [
"Faisal Salman <[email protected]>"
],
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ua-parser-js",
"version": "0.7.4",
"version": "0.7.5",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device", "cpu"],
"scripts": ["src/ua-parser.js"],
Expand Down
6 changes: 3 additions & 3 deletions dist/ua-parser.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'faisalman:ua-parser-js',
version: '0.7.4',
version: '0.7.5',
summary: 'Lightweight JavaScript-based user-agent string parser',
git: 'https://github.com/faisalman/ua-parser-js.git',
documentation: 'readme.md'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "0.7.4",
"version": "0.7.5",
"author": "Faisal Salman <[email protected]> (http://faisalman.com)",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [
Expand Down
10 changes: 8 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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)

Expand Down Expand Up @@ -221,6 +221,12 @@ console.log(parser.getResult());
$ bower install ua-parser-js
```

### Using meteor

```sh
$ meteor add faisalman:ua-parser-js
```

### 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)`.
Expand Down Expand Up @@ -259,7 +265,7 @@ Then submit a pull request to https://github.com/faisalman/ua-parser-js under `d

Dual licensed under GPLv2 & MIT

Copyright © 2012-2014 Faisal Salman <<[email protected]>>
Copyright © 2012-2015 Faisal Salman <<[email protected]>>

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
Expand Down
29 changes: 17 additions & 12 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* UAParser.js v0.7.4
* UAParser.js v0.7.5
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
* Copyright © 2012-2014 Faisal Salman <[email protected]>
* Copyright © 2012-2015 Faisal Salman <[email protected]>
* Dual licensed under GPLv2 & MIT
*/

Expand All @@ -16,7 +16,7 @@
/////////////


var LIBVERSION = '0.7.4',
var LIBVERSION = '0.7.5',
EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
Expand Down Expand Up @@ -734,10 +734,10 @@
////////////////


var UAParser = function (uastring, extensions) {
var _UAParser = function (uastring, extensions) {

if (!(this instanceof UAParser)) {
return new UAParser(uastring, extensions).getResult();
if (!(this instanceof _UAParser)) {
return new _UAParser(uastring, extensions).getResult();
}

var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
Expand Down Expand Up @@ -781,16 +781,16 @@
return this;
};

UAParser.VERSION = LIBVERSION;
UAParser.BROWSER = {
_UAParser.VERSION = LIBVERSION;
_UAParser.BROWSER = {
NAME : NAME,
MAJOR : MAJOR,
VERSION : VERSION
};
UAParser.CPU = {
_UAParser.CPU = {
ARCHITECTURE : ARCHITECTURE
};
UAParser.DEVICE = {
_UAParser.DEVICE = {
MODEL : MODEL,
VENDOR : VENDOR,
TYPE : TYPE,
Expand All @@ -801,11 +801,11 @@
WEARABLE: WEARABLE,
EMBEDDED: EMBEDDED
};
UAParser.ENGINE = {
_UAParser.ENGINE = {
NAME : NAME,
VERSION : VERSION
};
UAParser.OS = {
_UAParser.OS = {
NAME : NAME,
VERSION : VERSION
};
Expand All @@ -818,12 +818,17 @@

// check js environment
if (typeof(exports) !== UNDEF_TYPE) {
var UAParser = _UAParser;
// nodejs env
if (typeof(module) !== UNDEF_TYPE && module.exports) {
exports = module.exports = UAParser;
}
exports.UAParser = UAParser;
} else if (typeof(Package) !== UNDEF_TYPE) {
// meteor
UAParser = _UAParser;
} else {
var UAParser = _UAParser;
// browser env
window.UAParser = UAParser;
// requirejs env (optional)
Expand Down
2 changes: 1 addition & 1 deletion ua-parser-js.jquery.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "0.7.4",
"version": "0.7.5",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [
"user-agent",
Expand Down

0 comments on commit cce9dc1

Please sign in to comment.