Permalink
Browse files

tidy up

  • Loading branch information...
1 parent ef552a7 commit 27ffb8907baaee940269c684a3851d2dfb7fbba3 @jamesgpearce committed Dec 2, 2011
Showing with 27 additions and 22 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 LICENSE
  3. +10 −10 README.md
  4. +1 −1 example.js
  5. +13 −10 package.json
View
2 .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+run.js
View
2 LICENSE
@@ -1,6 +1,6 @@
(The MIT License)
-Copyright (c) 2010 James G Pearce.
+Copyright (c) 2010 James G Pearce; http://tripleodeon.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
20 README.md
@@ -1,20 +1,20 @@
-# Monomi
+# monomi
A.K.A. MObile NOde MIddleware
-Monomi is middleware for node.js/[Connect](http://github.com/senchalabs/connect)
+monomi is middleware for node.js/[Connect](http://github.com/senchalabs/connect)
that provides tools for handling mobile (and other types of) browsers.
-Monomi detects which type of browser the client is using to access the node.js
+monomi detects which type of browser the client is using to access the node.js
server, by providing the 'detectBrowserType' middleware. It places the type of
browser (as a string) in the request.monomi.browserType property:
var Connect = require("connect"),
- Monomi = require("monomi");
+ monomi = require("monomi");
Connect.createServer(
- Monomi.detectBrowserType(),
+ monomi.detectBrowserType(),
function(request, response, next) {
response.writeHead(200, {'Content-Type': 'text/plain'});
@@ -33,12 +33,12 @@ For example, if this server is accessed with an iPad, the browser type is
if accessed by any other mobile device, it is 'mobile'; and it defaults to
'desktop'.
-Monomi is sensitive to mobile carrier transcoders that move device headers
+monomi is sensitive to mobile carrier transcoders that move device headers
into their 'x-device-*' equivalents.
## Changing groupings
-Over time, and as new mobile browsers come out, Monomi will continue to provide
+Over time, and as new mobile browsers come out, monomi will continue to provide
support for recognizing them. In the meantime, applications can override how
they wish the recognition to work.
@@ -64,13 +64,13 @@ The options can be passed like this:
}
-The 'order' property tells Monomi which order to run the recognitions, looking
+The 'order' property tells monomi which order to run the recognitions, looking
for a positive result. For example, the iPhone will match both the 'touch' and
'mobile' groups by default, but the ordering ensures that the first, 'touch', is
returned.
The 'default' property specifies what string should be returned if none of the
-other browser types match. (However, Monomi's default desktop recognition
+other browser types match. (However, monomi's default desktop recognition
returns true, so unless you alter that algorithm, 'unknown' will never get
returned.)
@@ -88,7 +88,7 @@ indicate that the device is a tablet.
Other headers can also be matched against regular expressions, but you must also
provide an 'order' property that indicates which order to apply the regex
-conditions. For example:
+conditions in. For example:
'mobile': {
'order':['x-wap-profile', 'profile', 'accept', 'user-agent'],
View
2 example.js
@@ -10,5 +10,5 @@ Connect.createServer(
response.write('Hello World, ');
response.end('and thanks for using a ' + request.monomi.browserType + ' browser');
}
-
+
).listen(8080);
View
23 package.json
@@ -1,12 +1,15 @@
{
- "name" : "monomi",
- "description" : "Middleware for Connect (node.js) for handling mobile (and other types of) browsers.",
- "version" : "0.0.1",
- "author" : "James Pearce <james@tripleodeon.com>",
- "engines" : ["node"],
- "directories" : { "lib" : "./lib" },
- "main" : "./lib/monomi",
- "repository" : [
- { "type":"git", "url":"https://github.com/jamesgpearce/monomi.git" }
- ]
+ "name" : "monomi",
+ "description" : "Middleware for Connect (node.js) for handling mobile (and other types of) browsers.",
+ "version" : "0.0.1",
+ "author" : "James Pearce <james@tripleodeon.com>",
+ "engines": ["node >= 0.2.0"],
+ "directories" : { "lib" : "./lib" },
+ "main" : "./lib/monomi",
+ "dependencies": {
+ "connect": ">=0.2.5",
+ },
+ "repository" : [
+ { "type":"git", "url":"https://github.com/jamesgpearce/monomi.git" }
+ ]
}

0 comments on commit 27ffb89

Please sign in to comment.