From 8ebfe6cd4871944e5b9c43aec35a6f7a8e20b23a Mon Sep 17 00:00:00 2001 From: Dustin Diaz Date: Sat, 1 Mar 2014 10:22:06 -0800 Subject: [PATCH] update readme with better info --- README.md | 59 +++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index c177ee8..4a3ed15 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -Bowser ------- +## Bowser A Browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms. [![bowser ci](https://secure.travis-ci.org/ded/bowser.png)](https://travis-ci.org/ded/bowser/) @@ -12,8 +11,7 @@ if (bowser.msie && bowser.version <= 6) { } ``` -Flags set for detected Browsers[Engines] ------ +## Flags set for detected Browsers[Engines] * `chrome`[`webkit`] * `firefox`[`gecko`] @@ -33,8 +31,7 @@ Flags set for detected Browsers[Engines] For all detected browsers the browser version is set in the `version` field. -Flags set for detected mobile Operating Systems ------ +## Flags set for detected mobile Operating Systems * `android` * Windows Phone as `windowsphone` @@ -50,8 +47,7 @@ Android, iOS, Windows Phone, WebOS, Bada, and Tizen will all report the OS versi All detected mobile OSes are additionally flagged `mobile`, **if they are not powering a tablet device**. If a tablet device is detected, the flag `tablet` is set instead. -Notes ----- +### Notes Safari, Chrome and some other minor browsers will report that they have `webkit` engines, Firefox and Seamonkey will report that they have `gecko` engines. ``` js @@ -60,26 +56,23 @@ if (bowser.webkit) { } ``` -Ender installation ------ -If you don't already have [Ender](http://ender.no.de) (an npm package) install it now (and don't look back) +### Ender Support - $ npm install ender +`package.json` -then add bowser to your module collection - - $ ender add bowser - -use it like this: - -``` js -if ($.browser.chrome) { - alert('Hello Silicon Valley'); +``` json +"dependencies": { + "bowser": "x.x.x" } ``` -Graded Browser Support ---------- +``` js +if (require('bowser').chrome) { + alert('Hello Silicon Valley') +} +``` + +### Graded Browser Support One useful feature of Bowser is that aside from checking one browser from another -- it will keep up to date with [Yahoo's Graded Browser Support](http://developer.yahoo.com/yui/articles/gbs/) chart, giving you access to each grade on the bowser object ``` js @@ -94,20 +87,18 @@ else { } ``` -Building --------- +### Contributing +If you'd like to contribute a change to bowser, modify the files in `src/`, then run the following (you'll need node + npm installed): -If you'd like to contribute a change to bowser, modify the files in src/, then run the following (you'll need node + npm installed): +``` sh +$ npm install +$ make test +``` - $ npm install - $ make +Please do not check-in the built files `bowser.js` and `bowser.min.js` in pull requests. - -Testing -------- -We started a list `src/useragents.js` with example user agents and their expected bowser object. +### Adding tests +See the list in `src/useragents.js` with example user agents and their expected bowser object. Whenever you add support for new browsers or notice a bug / mismatch, please update the list and check if all tests are still passing. - -To run the test call `$ make test`