Skip to content

Commit

Permalink
v0.0.2 multiple changes
Browse files Browse the repository at this point in the history
- move doc to gh-pages
- generate rules-keys for JSDoc
- use Mobile-Detect/ualist.json instead of php
- streamline test
  • Loading branch information
hgoebl committed Oct 18, 2013
1 parent 180f00e commit 4301adc
Show file tree
Hide file tree
Showing 24 changed files with 3,835 additions and 5,161 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
*.iml
# *.iml
node_modules
9 changes: 5 additions & 4 deletions Gruntfile.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ module.exports = function (grunt) {
},
jsdoc: {
dist: {
src: ['<%= uglify.dist.src %>', 'README.md'],
src: ['<%= uglify.dist.src %>'],
options: {
destination: 'doc',
destination: '../mobile-detect.js@gh-pages/doc',
//template: "default",
encoding: "utf8",
"private": false,
Expand Down Expand Up @@ -100,6 +100,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-jasmine-node');

// Default task.
grunt.registerTask('default', ['jshint', 'exec:generate', 'jasmine_node', 'uglify', 'jsdoc']);
grunt.registerTask('dev', ['jshint']);
grunt.registerTask('default', ['jshint', 'exec:generate', 'jasmine_node', 'uglify']);
grunt.registerTask('dev', ['jshint']);
grunt.registerTask('gh-pages', ['jshint', 'exec:generate', 'jsdoc']);
};
29 changes: 19 additions & 10 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,33 @@ You can find out information about the device rendering your web page:

## Browser

```html
<script src="mobile-detect.js"></script>
<script>
var md = new MobileDetect(window.navigator.userAgent);
// ... see below
</script>
```

## Node.js / Express

```js
var MobileDetect = require('mobile-detect'),
md = new MobileDetect(req.headers['user-agent']);
// ... see below
```

## General

```js
// more typically we would instantiate with `window.navigator.userAgent` as user-agent
var md = new MobileDetect('Mozilla/5.0 (Linux; U; Android 4.0.3; en-in; SonyEricssonMT11i Build/4.1.A.0.562) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30');
var md = new MobileDetect(
'Mozilla/5.0 (Linux; U; Android 4.0.3; en-in; SonyEricssonMT11i' +
' Build/4.1.A.0.562) AppleWebKit/534.30 (KHTML, like Gecko)' +
' Version/4.0 Mobile Safari/534.30');

// more typically we would instantiate with 'window.navigator.userAgent'
// as user-agent; this string literal is only for better understanding

console.log(md.mobile()); // 'Sony'
console.log(md.phone()); // 'Sony'
console.log(md.tablet()); // null
Expand All @@ -45,7 +55,9 @@ console.log(md.version('Webkit')); // 534.3

## More Info ...

Open generated JSDoc in `doc/index.html`
There is some documentation generated by JSDoc:

<http://hgoebl.github.io/mobile-detect.js/doc/MobileDetect.html>

## Side Effects

Expand All @@ -60,10 +72,9 @@ You can easily extend it, e.g. `android`, `iphone`, etc.

## Size (bytes)

* development: 30025
* minified: 18045
* minified + gzipped: 7149

* development: 34300
* minified: 20595
* minified + gzipped: 8262 (`cat mobile-detect.min.js | gzip -9f | wc -c`)

# Installation

Expand All @@ -75,8 +86,6 @@ You can easily extend it, e.g. `android`, `iphone`, etc.

## Node.js / npm

**TODO** is not working yet, since project is not tagged w/ a version and not published to npmjs.org!

$ npm install mobile-detect --save

# Alternatives
Expand Down Expand Up @@ -152,4 +161,4 @@ If you want, you can donate to [Mobile-Detect](https://github.com/serbanghita/Mo

* Extend RegEx patterns so that test passes
* update mobilegrade() function to PHP-version
* Provide gh_pages w/ JSDoc and a live example
* Provide a live example on gh-pages
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobile-detect.js",
"version": "0.0.1",
"version": "0.0.2",
"main": "mobile-detect.js",
"ignore": [
"**/.*",
Expand Down
Loading

0 comments on commit 4301adc

Please sign in to comment.