Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

登录注册

  • Loading branch information...
commit 244a40ad6d52bd52ae7d70c3fd085b4f4e8015cf 0 parents
@dead-horse authored
Showing with 21,236 additions and 0 deletions.
  1. +65 −0 app.js
  2. +11 −0 config.js
  3. +41 −0 controllers/home.js
  4. +108 −0 controllers/sign.js
  5. +66 −0 lib/utils.js
  6. +24 −0 models/index.js
  7. 0  models/user.js
  8. +3 −0  node_modules/EventProxy.js/.gitmodules
  9. +23 −0 node_modules/EventProxy.js/MIT-License
  10. +127 −0 node_modules/EventProxy.js/README.md
  11. +303 −0 node_modules/EventProxy.js/eventproxy.js
  12. +1 −0  node_modules/EventProxy.js/index.js
  13. +225 −0 node_modules/EventProxy.js/jsdoc/files.html
  14. +218 −0 node_modules/EventProxy.js/jsdoc/index.html
  15. +926 −0 node_modules/EventProxy.js/jsdoc/symbols/EventProxy.html
  16. +498 −0 node_modules/EventProxy.js/jsdoc/symbols/_global_.html
  17. +311 −0 node_modules/EventProxy.js/jsdoc/symbols/src/Y__git_eventproxy_eventproxy.js.html
  18. +311 −0 node_modules/EventProxy.js/jsdoc/symbols/src/eventproxy.js.html
  19. +12 −0 node_modules/EventProxy.js/package.json
  20. +17 −0 node_modules/EventProxy.js/test/test.html
  21. +155 −0 node_modules/EventProxy.js/test/test.js
  22. +3 −0  node_modules/connect-mredis/.gitmodules
  23. +1 −0  node_modules/connect-mredis/.npmignore
  24. +100 −0 node_modules/connect-mredis/History.md
  25. +7 −0 node_modules/connect-mredis/Makefile
  26. +37 −0 node_modules/connect-mredis/Readme.md
  27. +21 −0 node_modules/connect-mredis/bm.js
  28. +232 −0 node_modules/connect-mredis/index.html
  29. +2 −0  node_modules/connect-mredis/index.js
  30. +131 −0 node_modules/connect-mredis/lib/connect-mredis.js
  31. +9 −0 node_modules/connect-mredis/node_modules/mredis/Makefile
  32. +22 −0 node_modules/connect-mredis/node_modules/mredis/README.md
  33. +1 −0  node_modules/connect-mredis/node_modules/mredis/index.js
  34. +360 −0 node_modules/connect-mredis/node_modules/mredis/lib/multi_redis.js
  35. +39 −0 node_modules/connect-mredis/node_modules/mredis/package.json
  36. +47 −0 node_modules/connect-mredis/node_modules/mredis/test.js
  37. +3 −0  node_modules/connect-mredis/node_modules/mredis/test/mocha.opts
  38. +92 −0 node_modules/connect-mredis/node_modules/mredis/test/multi_redis_functional_test.js
  39. +93 −0 node_modules/connect-mredis/node_modules/mredis/test/multi_redis_stability_test.js
  40. +30 −0 node_modules/connect-mredis/package.json
  41. +41 −0 node_modules/connect-mredis/test.js
  42. +1 −0  node_modules/connect-render/.npmignore
  43. +3 −0  node_modules/connect-render/.travis.yml
  44. +10 −0 node_modules/connect-render/Makefile
  45. +36 −0 node_modules/connect-render/README.md
  46. +20 −0 node_modules/connect-render/example/helloworld.js
  47. +1 −0  node_modules/connect-render/example/views/copyright.html
  48. +5 −0 node_modules/connect-render/example/views/footer.html
  49. +3 −0  node_modules/connect-render/example/views/index.html
  50. +12 −0 node_modules/connect-render/example/views/layout.html
  51. +49 −0 node_modules/connect-render/package.json
  52. +170 −0 node_modules/connect-render/render.js
  53. +2 −0  node_modules/connect-render/test/mocha.opts
  54. +137 −0 node_modules/connect-render/test/render.test.js
  55. +5 −0 node_modules/connect-render/test/success.html
  56. +121 −0 node_modules/connect-render/test/support/http.js
  57. +1 −0  node_modules/connect-render/test/views/error.html
  58. +3 −0  node_modules/connect-render/test/views/footer.html
  59. +1 −0  node_modules/connect-render/test/views/index.html
  60. +1 −0  node_modules/connect-render/test/views/js/count.js
  61. +3 −0  node_modules/connect-render/test/views/layout.html
  62. +1 −0  node_modules/connect-render/test/views/nolayout.html
  63. +1 −0  node_modules/connect-render/test/views/options.scope.html
  64. +1 −0  node_modules/connect-render/test/views/partial_in_partial.html
  65. +1 −0  node_modules/connect-render/test/views/partial_not_exists.html
  66. +11 −0 node_modules/connect/.npmignore
  67. +24 −0 node_modules/connect/LICENSE
  68. +10 −0 node_modules/connect/hello.js
  69. +4 −0 node_modules/connect/index.js
  70. +81 −0 node_modules/connect/lib/cache.js
  71. +106 −0 node_modules/connect/lib/connect.js
  72. +217 −0 node_modules/connect/lib/http.js
  73. +47 −0 node_modules/connect/lib/https.js
  74. +46 −0 node_modules/connect/lib/index.js
  75. +93 −0 node_modules/connect/lib/middleware/basicAuth.js
  76. +203 −0 node_modules/connect/lib/middleware/bodyParser.js
  77. +163 −0 node_modules/connect/lib/middleware/compiler.js
  78. +46 −0 node_modules/connect/lib/middleware/cookieParser.js
  79. +104 −0 node_modules/connect/lib/middleware/csrf.js
  80. +222 −0 node_modules/connect/lib/middleware/directory.js
  81. +100 −0 node_modules/connect/lib/middleware/errorHandler.js
  82. +76 −0 node_modules/connect/lib/middleware/favicon.js
  83. +82 −0 node_modules/connect/lib/middleware/limit.js
  84. +299 −0 node_modules/connect/lib/middleware/logger.js
  85. +38 −0 node_modules/connect/lib/middleware/methodOverride.js
  86. +100 −0 node_modules/connect/lib/middleware/profiler.js
  87. +40 −0 node_modules/connect/lib/middleware/query.js
  88. +34 −0 node_modules/connect/lib/middleware/responseTime.js
  89. +379 −0 node_modules/connect/lib/middleware/router.js
  90. +346 −0 node_modules/connect/lib/middleware/session.js
  91. +126 −0 node_modules/connect/lib/middleware/session/cookie.js
  92. +131 −0 node_modules/connect/lib/middleware/session/memory.js
  93. +137 −0 node_modules/connect/lib/middleware/session/session.js
  94. +87 −0 node_modules/connect/lib/middleware/session/store.js
  95. +225 −0 node_modules/connect/lib/middleware/static.js
  96. +175 −0 node_modules/connect/lib/middleware/staticCache.js
  97. +44 −0 node_modules/connect/lib/middleware/vhost.js
  98. +79 −0 node_modules/connect/lib/patch.js
  99. +75 −0 node_modules/connect/lib/public/directory.html
  100. +13 −0 node_modules/connect/lib/public/error.html
  101. BIN  node_modules/connect/lib/public/favicon.ico
  102. BIN  node_modules/connect/lib/public/icons/page.png
  103. BIN  node_modules/connect/lib/public/icons/page_add.png
  104. BIN  node_modules/connect/lib/public/icons/page_attach.png
  105. BIN  node_modules/connect/lib/public/icons/page_code.png
  106. BIN  node_modules/connect/lib/public/icons/page_copy.png
  107. BIN  node_modules/connect/lib/public/icons/page_delete.png
  108. BIN  node_modules/connect/lib/public/icons/page_edit.png
  109. BIN  node_modules/connect/lib/public/icons/page_error.png
  110. BIN  node_modules/connect/lib/public/icons/page_excel.png
  111. BIN  node_modules/connect/lib/public/icons/page_find.png
  112. BIN  node_modules/connect/lib/public/icons/page_gear.png
  113. BIN  node_modules/connect/lib/public/icons/page_go.png
  114. BIN  node_modules/connect/lib/public/icons/page_green.png
  115. BIN  node_modules/connect/lib/public/icons/page_key.png
  116. BIN  node_modules/connect/lib/public/icons/page_lightning.png
  117. BIN  node_modules/connect/lib/public/icons/page_link.png
  118. BIN  node_modules/connect/lib/public/icons/page_paintbrush.png
  119. BIN  node_modules/connect/lib/public/icons/page_paste.png
  120. BIN  node_modules/connect/lib/public/icons/page_red.png
  121. BIN  node_modules/connect/lib/public/icons/page_refresh.png
  122. BIN  node_modules/connect/lib/public/icons/page_save.png
  123. BIN  node_modules/connect/lib/public/icons/page_white.png
  124. BIN  node_modules/connect/lib/public/icons/page_white_acrobat.png
  125. BIN  node_modules/connect/lib/public/icons/page_white_actionscript.png
  126. BIN  node_modules/connect/lib/public/icons/page_white_add.png
  127. BIN  node_modules/connect/lib/public/icons/page_white_c.png
  128. BIN  node_modules/connect/lib/public/icons/page_white_camera.png
  129. BIN  node_modules/connect/lib/public/icons/page_white_cd.png
  130. BIN  node_modules/connect/lib/public/icons/page_white_code.png
  131. BIN  node_modules/connect/lib/public/icons/page_white_code_red.png
  132. BIN  node_modules/connect/lib/public/icons/page_white_coldfusion.png
  133. BIN  node_modules/connect/lib/public/icons/page_white_compressed.png
  134. BIN  node_modules/connect/lib/public/icons/page_white_copy.png
  135. BIN  node_modules/connect/lib/public/icons/page_white_cplusplus.png
  136. BIN  node_modules/connect/lib/public/icons/page_white_csharp.png
  137. BIN  node_modules/connect/lib/public/icons/page_white_cup.png
  138. BIN  node_modules/connect/lib/public/icons/page_white_database.png
  139. BIN  node_modules/connect/lib/public/icons/page_white_delete.png
  140. BIN  node_modules/connect/lib/public/icons/page_white_dvd.png
  141. BIN  node_modules/connect/lib/public/icons/page_white_edit.png
  142. BIN  node_modules/connect/lib/public/icons/page_white_error.png
  143. BIN  node_modules/connect/lib/public/icons/page_white_excel.png
  144. BIN  node_modules/connect/lib/public/icons/page_white_find.png
  145. BIN  node_modules/connect/lib/public/icons/page_white_flash.png
  146. BIN  node_modules/connect/lib/public/icons/page_white_freehand.png
  147. BIN  node_modules/connect/lib/public/icons/page_white_gear.png
  148. BIN  node_modules/connect/lib/public/icons/page_white_get.png
  149. BIN  node_modules/connect/lib/public/icons/page_white_go.png
  150. BIN  node_modules/connect/lib/public/icons/page_white_h.png
  151. BIN  node_modules/connect/lib/public/icons/page_white_horizontal.png
  152. BIN  node_modules/connect/lib/public/icons/page_white_key.png
  153. BIN  node_modules/connect/lib/public/icons/page_white_lightning.png
  154. BIN  node_modules/connect/lib/public/icons/page_white_link.png
  155. BIN  node_modules/connect/lib/public/icons/page_white_magnify.png
  156. BIN  node_modules/connect/lib/public/icons/page_white_medal.png
  157. BIN  node_modules/connect/lib/public/icons/page_white_office.png
  158. BIN  node_modules/connect/lib/public/icons/page_white_paint.png
  159. BIN  node_modules/connect/lib/public/icons/page_white_paintbrush.png
  160. BIN  node_modules/connect/lib/public/icons/page_white_paste.png
  161. BIN  node_modules/connect/lib/public/icons/page_white_php.png
  162. BIN  node_modules/connect/lib/public/icons/page_white_picture.png
  163. BIN  node_modules/connect/lib/public/icons/page_white_powerpoint.png
  164. BIN  node_modules/connect/lib/public/icons/page_white_put.png
  165. BIN  node_modules/connect/lib/public/icons/page_white_ruby.png
  166. BIN  node_modules/connect/lib/public/icons/page_white_stack.png
  167. BIN  node_modules/connect/lib/public/icons/page_white_star.png
  168. BIN  node_modules/connect/lib/public/icons/page_white_swoosh.png
  169. BIN  node_modules/connect/lib/public/icons/page_white_text.png
  170. BIN  node_modules/connect/lib/public/icons/page_white_text_width.png
  171. BIN  node_modules/connect/lib/public/icons/page_white_tux.png
  172. BIN  node_modules/connect/lib/public/icons/page_white_vector.png
  173. BIN  node_modules/connect/lib/public/icons/page_white_visualstudio.png
  174. BIN  node_modules/connect/lib/public/icons/page_white_width.png
  175. BIN  node_modules/connect/lib/public/icons/page_white_word.png
  176. BIN  node_modules/connect/lib/public/icons/page_white_world.png
  177. BIN  node_modules/connect/lib/public/icons/page_white_wrench.png
  178. BIN  node_modules/connect/lib/public/icons/page_white_zip.png
  179. BIN  node_modules/connect/lib/public/icons/page_word.png
  180. BIN  node_modules/connect/lib/public/icons/page_world.png
  181. +141 −0 node_modules/connect/lib/public/style.css
  182. +457 −0 node_modules/connect/lib/utils.js
  183. +4 −0 node_modules/connect/node_modules/formidable/.gitignore
  184. +4 −0 node_modules/connect/node_modules/formidable/.npmignore
  185. +4 −0 node_modules/connect/node_modules/formidable/.travis.yml
  186. +14 −0 node_modules/connect/node_modules/formidable/Makefile
  187. +286 −0 node_modules/connect/node_modules/formidable/Readme.md
  188. +3 −0  node_modules/connect/node_modules/formidable/TODO
  189. +70 −0 node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
  190. +50 −0 node_modules/connect/node_modules/formidable/example/post.js
  191. +64 −0 node_modules/connect/node_modules/formidable/example/upload.js
  192. +1 −0  node_modules/connect/node_modules/formidable/index.js
  193. +61 −0 node_modules/connect/node_modules/formidable/lib/file.js
  194. +403 −0 node_modules/connect/node_modules/formidable/lib/incoming_form.js
  195. +3 −0  node_modules/connect/node_modules/formidable/lib/index.js
  196. +312 −0 node_modules/connect/node_modules/formidable/lib/multipart_parser.js
  197. +25 −0 node_modules/connect/node_modules/formidable/lib/querystring_parser.js
  198. +6 −0 node_modules/connect/node_modules/formidable/lib/util.js
  199. +24 −0 node_modules/connect/node_modules/formidable/package.json
  200. +19 −0 node_modules/connect/node_modules/formidable/test/common.js
  201. +1 −0  node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
  202. +1 −0  node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
  203. +13 −0 node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http
  204. +3 −0  node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
  205. +26 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http
  206. +24 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http
  207. +23 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http
  208. +24 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http
  209. +22 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http
  210. +22 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http
  211. +22 −0 node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http
  212. +3 −0  node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
  213. +21 −0 node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
  214. +72 −0 node_modules/connect/node_modules/formidable/test/fixture/multipart.js
  215. +89 −0 node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
  216. +24 −0 node_modules/connect/node_modules/formidable/test/legacy/common.js
  217. +80 −0 node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
  218. +104 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
  219. +715 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
  220. +50 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
  221. +45 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
  222. +72 −0 node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
  223. +2 −0  node_modules/connect/node_modules/formidable/test/run.js
  224. +63 −0 node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
  225. +47 −0 node_modules/connect/node_modules/formidable/tool/record.js
  226. +24 −0 node_modules/connect/node_modules/http_patch/lib/http_patch.js
  227. +9 −0 node_modules/connect/node_modules/http_patch/package.json
  228. +19 −0 node_modules/connect/node_modules/mime/LICENSE
  229. +50 −0 node_modules/connect/node_modules/mime/README.md
  230. +92 −0 node_modules/connect/node_modules/mime/mime.js
  231. +22 −0 node_modules/connect/node_modules/mime/package.json
  232. +79 −0 node_modules/connect/node_modules/mime/test.js
  233. +1,479 −0 node_modules/connect/node_modules/mime/types/mime.types
  234. +43 −0 node_modules/connect/node_modules/mime/types/node.types
  235. +1 −0  node_modules/connect/node_modules/qs/.gitignore
  236. +6 −0 node_modules/connect/node_modules/qs/.gitmodules
  237. +63 −0 node_modules/connect/node_modules/qs/History.md
  238. +5 −0 node_modules/connect/node_modules/qs/Makefile
  239. +47 −0 node_modules/connect/node_modules/qs/Readme.md
  240. +17 −0 node_modules/connect/node_modules/qs/benchmark.js
  241. +48 −0 node_modules/connect/node_modules/qs/examples.js
  242. +2 −0  node_modules/connect/node_modules/qs/index.js
  243. +282 −0 node_modules/connect/node_modules/qs/lib/querystring.js
  244. +16 −0 node_modules/connect/node_modules/qs/package.json
  245. +2 −0  node_modules/connect/node_modules/qs/test/mocha.opts
  246. +202 −0 node_modules/connect/node_modules/qs/test/parse.js
  247. +95 −0 node_modules/connect/node_modules/qs/test/stringify.js
  248. +25 −0 node_modules/connect/package.json
  249. +52 −0 node_modules/connect/test.js
  250. +4 −0 node_modules/ejs/.gitignore
  251. 0  node_modules/ejs/.gitmodules
  252. +88 −0 node_modules/ejs/History.md
  253. +21 −0 node_modules/ejs/Makefile
  254. +150 −0 node_modules/ejs/Readme.md
  255. +14 −0 node_modules/ejs/benchmark.js
  256. +565 −0 node_modules/ejs/ejs.js
  257. +2 −0  node_modules/ejs/ejs.min.js
  258. +24 −0 node_modules/ejs/examples/client.html
  259. +7 −0 node_modules/ejs/examples/list.ejs
  260. +14 −0 node_modules/ejs/examples/list.js
  261. +2 −0  node_modules/ejs/index.js
  262. +288 −0 node_modules/ejs/lib/ejs.js
  263. +198 −0 node_modules/ejs/lib/filters.js
  264. +23 −0 node_modules/ejs/lib/utils.js
  265. +11 −0 node_modules/ejs/package.json
  266. +173 −0 node_modules/ejs/support/compile.js
  267. +290 −0 node_modules/ejs/test/ejs.test.js
  268. +1 −0  node_modules/ejs/test/fixtures/user.ejs
  269. +1 −0  node_modules/mongoskin/.npmignore
  270. +22 −0 node_modules/mongoskin/History.md
  271. +533 −0 node_modules/mongoskin/Readme.md
  272. +15 −0 node_modules/mongoskin/examples/gridfs.js
  273. +1 −0  node_modules/mongoskin/index.js
  274. +203 −0 node_modules/mongoskin/integration/integration_tests.js
  275. +26 −0 node_modules/mongoskin/lib/mongoskin/admin.js
  276. +227 −0 node_modules/mongoskin/lib/mongoskin/collection.js
  277. +76 −0 node_modules/mongoskin/lib/mongoskin/cursor.js
  278. +234 −0 node_modules/mongoskin/lib/mongoskin/db.js
  279. +39 −0 node_modules/mongoskin/lib/mongoskin/gridfs.js
  280. +130 −0 node_modules/mongoskin/lib/mongoskin/index.js
  281. +24 −0 node_modules/mongoskin/lib/mongoskin/router.js
  282. +3 −0  node_modules/mongoskin/node_modules/mongodb/.npmignore
  283. +182 −0 node_modules/mongoskin/node_modules/mongodb/HISTORY
  284. +59 −0 node_modules/mongoskin/node_modules/mongodb/Makefile
  285. +397 −0 node_modules/mongoskin/node_modules/mongodb/Readme.md
  286. +7 −0 node_modules/mongoskin/node_modules/mongodb/TODO
  287. +279 −0 node_modules/mongoskin/node_modules/mongodb/articles/NodeKOArticle1.md
  288. +199 −0 node_modules/mongoskin/node_modules/mongodb/articles/NodeKOArticle2.md
  289. +4 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/.gitignore
  290. +42 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/History.md
  291. +6 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/Makefile
  292. +118 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/README.md
  293. +190 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/index.js
  294. +22 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/package.json
  295. +215 −0 node_modules/mongoskin/node_modules/mongodb/deps/gleak/test/index.js
  296. +3 −0  node_modules/mongoskin/node_modules/mongodb/deps/nodeunit/.npmignore
  297. +60 −0 node_modules/mongoskin/node_modules/mongodb/deps/nodeunit/CONTRIBUTORS.md
  298. +19 −0 node_modules/mongoskin/node_modules/mongodb/deps/nodeunit/LICENSE
  299. +126 −0 node_modules/mongoskin/node_modules/mongodb/deps/nodeunit/Makefile
  300. +433 −0 node_modules/mongoskin/node_modules/mongodb/deps/nodeunit/README.md
Sorry, we could not display the entire diff because too many files (511) changed.
65 app.js
@@ -0,0 +1,65 @@
+/*!
+ * mailSys - app.js
+ */
+
+/**
+ * Module dependencies.
+ */
+var config = require('./config');
+var connect = require('connect');
+var render = require('connect-render');
+var RedisStore = require('connect-mredis')(connect);
+var utils = require('./lib/utils');
+var sign = require('./controllers/sign');
+var home = require('./controllers/home');
+
+var app = connect(
+ connect.favicon(),
+ connect.static(__dirname + '/public'),
+ connect.query(),
+ connect.cookieParser(),
+ connect.session({
+ secret: config.sessionSecret,
+ cookie: {path:'/', httpOnly: true, maxAge: 3600000 * 24}
+ }),
+ connect.bodyParser(),
+ connect.csrf(),
+ render({
+ root: __dirname + '/views',
+ layout: 'layout.html',
+ cache: !config.debug,
+ helpers: {
+ config: config
+ }
+ })
+);
+
+app.use('/sign/', sign.auth());
+app.use('/sign/', connect.router(sign));
+
+app.use('/', home.auth());
+app.use('/', connect.router(home));
+
+app.use(function(err, req, res, next) {
+ var msg = {
+ method: req.method,
+ url: req.url,
+ error: err.message
+ };
+ if (config.debug) {
+ msg.stack = err.stack;
+ }
+ utils.sendJSON(res, 500, msg);
+ err.url = req.url;
+});
+
+app.use(function(req, res, next) {
+ utils.sendJSON(res, 404, {
+ method: req.method,
+ url: req.url,
+ error: 'NotFound'
+ });
+});
+
+
+app.listen(config.port);
11 config.js
@@ -0,0 +1,11 @@
+module.exports = {
+ port: 1991,
+ sessionSecret: 'input_your_session_secret',
+ sessionTimeOut: 1000 * 60 * 60 * 24 * 14,
+ pswSecret: 'input_your_psw_secret',
+ debug: false,
+ staticVersion: '0.0.1',
+ site_name: '邮件收发系统',
+
+ mongoUrl: 'localhost:27017/mailsystem',
+};
41 controllers/home.js
@@ -0,0 +1,41 @@
+/*!
+ * mailSys - controllers/home.js
+ */
+
+/**
+ * Module dependencies.
+ */
+var config = require('../config');
+var EventProxy = require('EventProxy.js');
+var user = require('../models').user;
+var utils = require('../lib/utils');
+
+exports = module.exports = function(app) {
+ app.get('/', homePage);
+ app.get('/list', listPage);
+}
+
+function homePage(req, res, next) {
+ res.render('home.html', {layout: false});
+}
+
+function listPage(req, res, next) {
+ res.render('list.html', {layout: false});
+}
+
+exports.auth = function() {
+ return function(req, res, next) {
+ if (!req.session || !req.session.user) {
+ return utils.redirect(res, '/sign/login', 302);
+ }
+ user.findOne({name: req.session.user}, function(err, user) {
+ if (err) {
+ return next(err);
+ }
+ if (!user) {
+ return utils.redirect(res, '/sign/login', 302);
+ }
+ next();
+ });
+ }
+}
108 controllers/sign.js
@@ -0,0 +1,108 @@
+/*!
+ * mailSys - controllers/sign.js
+ */
+
+/**
+ * Module dependencies.
+ */
+var config = require('../config');
+var EventProxy = require('EventProxy.js');
+var user = require('../models').user;
+var utils = require('../lib/utils');
+var pswSecret = config.pswSecret;
+
+exports = module.exports = function(app) {
+ app.get('/login', loginPage);
+ app.get('/regist', registPage);
+ app.post('/login.do', handleLogin);
+ app.post('/regist.do', handleRegist);
+ app.get('/logout', handleLogout);
+}
+
+function loginPage(req, res, next) {
+ res.render('sign/login.html', {
+ layout: 'signLayout.html',
+ redirectUrl: req.query.ref|| '',
+ warn: '',
+ });
+}
+
+function registPage(req, res, next) {
+ res.render('sign/regist.html', {
+ layout: 'signLayout.html'
+ })
+}
+
+function handleLogin(req, res, next) {
+ var name = req.body.name || '';
+ var pwd = req.body.pwd || '';
+ var ref = req.body.redirectUrl || '';
+ var autoLogin = req.body.remeber_me||'';
+ if (!name) {
+ return next(new Error('请输入用户名'));
+ }
+ if (!pwd) {
+ return next(new Error('请输入密码'));
+ }
+ user.findOne({name: name, password: utils.md5(pswSecret + pwd + pswSecret)}, function(err, data) {
+ if (err) {
+ return next(err);
+ }
+ if (!data) {
+ return next(new Error('用户名或密码错误'));
+ }
+ if (autoLogin) {
+ var timeOut = config.sessionTimeOut;
+ req.session.cookie.expires = new Date(Date.now() + timeOut);
+ req.session.cookie.maxAge = timeOut;
+ }
+ req.session.user = name;
+ utils.redirect(res, ref && ref[0] === '/' ? ref : '/');
+ })
+}
+
+function handleRegist(req, res, next) {
+ var name = req.body.newUserName || '';
+ var pass = req.body.newPassword || '';
+ var con = req.body.passwordCon || '';
+ if (!name) {
+ return next(new Error('请输入用户名'));
+ }
+ if (!pass) {
+ return next(new Error('请输入密码'));
+ }
+ if (pass !== con) {
+ return next(new Error('两次密码输入不相同'));
+ }
+ user.newUser({name: name, password: utils.md5(pswSecret + pass + pswSecret)}, function(err) {
+ if (err) {
+ return next(err);
+ }
+ req.session.user = name;
+ utils.redirect(res, '/', 302);
+ });
+}
+
+function handleLogout(req, res, next) {
+ req.session.destroy(function(err){});
+}
+exports.auth = function() {
+ return function(req, res, next) {
+ if (req.url.indexOf('/logout') === 0) {
+ next();
+ }
+ if (req.session && req.session.user) {
+ user.findOne({name: req.session.user}, function(err, data) {
+ if (err) {
+ return next(err);
+ }
+ if (data) {
+ return utils.redirect(res, '/', 302);
+ }
+ next();
+ })
+ } else {
+ next();
+ }
+ }
+}
66 lib/utils.js
@@ -0,0 +1,66 @@
+/*!
+ * tcif - utils
+ * Copyright(c) 2012 fengmk2 <fengmk2@gmail.com>
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto');
+
+/**
+ * md5 hash
+ *
+ * @param {String} s
+ * @return {String} md5 hash string
+ * @api public
+ */
+exports.md5 = function(s) {
+ var md5sum = crypto.createHash('md5');
+ md5sum.update(s, Buffer.isBuffer(s) ? 'binary' : 'utf8');
+ return md5sum.digest('hex');
+};
+
+/**
+ * Send data in JSON format use res.end(), will auto set JSON header.
+ *
+ * @param {Object} res, http.Response instance
+ * @param {Number} status, response status code
+ * @param {Object} data
+ * @api public
+ */
+exports.sendJSON = function(res, status, data) {
+ var buf = new Buffer(JSON.stringify(data));
+ res.statusCode = status;
+ res.setHeader('Content-Type', 'application/json');
+ res.setHeader('Content-Length', buf.length);
+ res.end(buf);
+};
+
+/**
+ * Send redirect response.
+ *
+ * @param {Response} res, http.Response instance
+ * @param {String} url, redirect URL
+ * @param {Number|String} status, response status code, default is `302`
+ * @api public
+ */
+exports.redirect = function(res, url, status) {
+ res.statusCode = status || 302;
+ res.setHeader('Location', url);
+ res.end('Redirect to ' + url);
+}
+
+/**
+ * HBase rowkey,
+ * return md5(old_row_key)[0:2] + old_row_key
+ *
+ * @param {String} s
+ * @return {String}
+ */
+exports.rowkey = function(s) {
+ var md5sum = crypto.createHash('md5');
+ md5sum.update('' + s);
+ return md5sum.digest('hex').substring(0, 4) + s;
+}
24 models/index.js
@@ -0,0 +1,24 @@
+/**
+ * models/index.js
+ */
+
+/**
+ * Module dependencies
+ */
+var mongo = require('mongoskin');
+var config = require('../config');
+
+var db = exports.db = mongo.db(config.mongoUrl);
+var empty = function() {};
+var user = exports.user = exports.db.collection('user');
+user.ensureIndex({'name': 1}, {unique: true}, empty);
+
+db.bind('user', {
+ newUser: function(options, fn) {
+ this.findOne({name: options.name}, function(err, user) {
+ if (err) return fn(err);
+ if (user) return fn(new Error('用户名已存在'));
+ this.save(options, fn);
+ }.bind(this));
+ }
+})
0  models/user.js
No changes.
3  node_modules/EventProxy.js/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "test/qunit"]
+ path = test/qunit
+ url = https://github.com/jquery/qunit.git
23 node_modules/EventProxy.js/MIT-License
@@ -0,0 +1,23 @@
+Copyright (c) 2011 Jackson Tian
+http://weibo.com/shyvo
+
+The MIT License
+
+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 the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
127 node_modules/EventProxy.js/README.md
@@ -0,0 +1,127 @@
+这个世界上不存在所谓回调函数深度嵌套的问题。 —— Jackson Tian(http://weibo.com/shyvo)
+---
+
+EventProxy.js仅仅是一个很轻量的工具,但是能够带来一种事件式编程的思维变化。有几个特点:
+
+ 1. 利用事件机制解耦复杂业务逻辑
+ 2. 移除被广为诟病的深度callback嵌套问题
+ 3. 将串行等待变成并行等待,提升多异步场景下的执行效率
+ 4. 无平台依赖,适合前后端,能用于浏览器和NodeJS
+
+现在的,无深度嵌套的,并行的
+
+ var proxy = new EventProxy();
+ var render = function (template, data, l10n){
+ _.template(template, data);
+ };
+ proxy.assign("template", "data", "l10n", render);
+ $.get("template", function (template) {
+ // something
+ proxy.trigger("template", template);
+ });
+ $.get("data", function (data) {
+ // something
+ proxy.trigger("data", data);
+ });
+ $.get("l10n", function (l10n) {
+ // something
+ proxy.trigger("l10n", l10n);
+ });
+
+过去的,深度嵌套的,串行的。
+
+ var render = function (template, data){
+ _.template(template, data);
+ };
+ $.get("template", function (template) {
+ // something
+ $.get("data", function (data) {
+ // something
+ $.get("l10n", function (l10n) {
+ // something
+ render(template, data);
+ });
+ });
+ });
+
+For Frontend user:
+
+Assign once. The callback will be executed once when all event were fired.
+
+ <script src="eventproxy.js"></script>
+ <script>
+ var proxy = new EventProxy();
+ var render = function (template, data, l10n){
+ _.template(template, data);
+ };
+ proxy.assign("template", "data", "l10n", render);
+ $.get("template", function (template) {
+ // something
+ proxy.trigger("template", template);
+ });
+ $.get("data", function (data) {
+ // something
+ proxy.trigger("data", data);
+ });
+ $.get("l10n", function (l10n) {
+ // something
+ proxy.trigger("l10n", l10n);
+ });
+ </script>
+
+Assign always. The callback will be executed first time when all event were fired. And after that, any event was fired will trigger callback. It's useful when you need refresh UI with newest data, e.g. stock app.
+
+ <script src="eventproxy.js"></script>
+ <script>
+ var proxy = new EventProxy();
+ var render = function (template, data, l10n){
+ _.template(template, data);
+ };
+ proxy.assignAll("template", "dataUpdate", "l10n", render);
+ $.get("template", function (template) {
+ // something
+ proxy.trigger("template", template);
+ });
+
+ $.get("l10n", function (l10n) {
+ // something
+ proxy.trigger("l10n", l10n);
+ });
+
+ // Need refresh data and UI for some realtime application.
+ setInterval(function () {
+ $.get("data", function (data) {
+ // something
+ proxy.trigger("dataUpdate", data);
+ });
+ }, 1000);
+ </script>
+
+For NodeJS user:
+
+ npm install EventProxy.js
+
+Sample code:
+
+ var EventProxy = require("eventproxy.js").EventProxy;
+
+ var proxy = new EventProxy();
+ var render = function (template, data, l10n){
+ return _.template(template, data);
+ };
+ proxy.assign("template", "data", "l10n", render);
+ $.get("template", function (template) {
+ // something
+ proxy.trigger("template", template);
+ });
+ $.get("data", function (data) {
+ // something
+ proxy.trigger("data", data);
+ });
+ $.get("l10n", function (l10n) {
+ // something
+ proxy.trigger("l10n", l10n);
+ });
+
+---
+[EventProxy API Documentation](http://eventproxy.html5ify.com/jsdoc/symbols/EventProxy.html)
303 node_modules/EventProxy.js/eventproxy.js
@@ -0,0 +1,303 @@
+/*global exports */
+/**
+ * @fileoverview This file is used for define the EventProxy library.
+ * @author <a href="mailto:shyvo1987@gmail.com">Jackson Tian</a>
+ * @version 0.4
+ */
+(function () {
+ /**
+ * @description EventProxy. A module that can be mixed in to *any object* in order to provide it with
+ * custom events. You may `bind` or `unbind` a callback function to an event;
+ * `trigger`-ing an event fires all callbacks in succession.
+ * @constructor
+ * @name EventProxy
+ * @class EventProxy. An implementation of task/event based asynchronous pattern.
+ * @example
+ * var render = function (template, resources) {};
+ * var proxy = new EventProxy();
+ * proxy.assign("template", "l10n", render);
+ * proxy.trigger("template", template);
+ * proxy.trigger("l10n", resources);
+ */
+ var EventProxy = function () {
+ this._callbacks = {};
+ this._fired = {};
+ };
+
+ /**
+ * @description Bind an event, specified by a string name, `ev`, to a `callback` function.
+ * Passing `"all"` will bind the callback to all events fired.
+ * @memberOf EventProxy#
+ * @param {string} eventName Event name.
+ * @param {function} callback Callback.
+ */
+ EventProxy.prototype.addListener = function (ev, callback) {
+ this._callbacks = this._callbacks || {};
+ var list = this._callbacks[ev] || (this._callbacks[ev] = []);
+ list.push(callback);
+ return this;
+ };
+ EventProxy.prototype.bind = EventProxy.prototype.addListener;
+ EventProxy.prototype.on = EventProxy.prototype.addListener;
+
+ /**
+ * @description Remove one or many callbacks. If `callback` is null, removes all
+ * callbacks for the event. If `ev` is null, removes all bound callbacks
+ * for all events.
+ * @memberOf EventProxy#
+ * @param {string} eventName Event name.
+ * @param {function} callback Callback.
+ */
+ EventProxy.prototype.removeListener = function (ev, callback) {
+ var calls, i, l;
+ if (!ev) {
+ this._callbacks = {};
+ } else if (calls = this._callbacks) {
+ if (!callback) {
+ calls[ev] = [];
+ } else {
+ var list = calls[ev];
+ if (!list) {
+ return this;
+ }
+ l = list.length;
+ for (i = 0; i < l; i++) {
+ if (callback === list[i]) {
+ list[i] = null;
+ break;
+ }
+ }
+ }
+ }
+ return this;
+ };
+ EventProxy.prototype.unbind = EventProxy.prototype.removeListener;
+
+ /**
+ * @description Remove all listeners.
+ * It equals unbind(); Just add this API for as same as Event.Emitter.
+ * @memberOf EventProxy#
+ * @param {string} event Event name.
+ */
+ EventProxy.prototype.removeAllListeners = function (event) {
+ return this.unbind(event);
+ };
+
+ /**
+ * @description Trigger an event, firing all bound callbacks. Callbacks are passed the
+ * same arguments as `trigger` is, apart from the event name.
+ * Listening for `"all"` passes the true event name as the first argument.
+ * @param {string} eventName Event name.
+ * @param {mix} data Pass in data.
+ */
+ EventProxy.prototype.trigger = function (eventName, data) {
+ var list, calls, ev, callback, args, i, l;
+ var both = 2;
+ if (!(calls = this._callbacks)) {
+ return this;
+ }
+ while (both--) {
+ ev = both ? eventName : 'all';
+ if (list = calls[ev]) {
+ for (i = 0, l = list.length; i < l; i++) {
+ if (!(callback = list[i])) {
+ list.splice(i, 1); i--; l--;
+ } else {
+ args = both ? Array.prototype.slice.call(arguments, 1) : arguments;
+ callback.apply(this, args);
+ }
+ }
+ }
+ }
+ return this;
+ };
+ EventProxy.prototype.emit = EventProxy.prototype.trigger;
+ EventProxy.prototype.fire = EventProxy.prototype.trigger;
+
+ /**
+ * @description Bind an event like the bind method, but will remove the listener after it was fired.
+ * @param {string} ev Event name.
+ * @param {function} callback Callback.
+ */
+ EventProxy.prototype.once = function (ev, callback) {
+ var self = this,
+ wrapper = function () {
+ callback.apply(self, arguments);
+ self.unbind(ev, wrapper);
+ };
+ this.bind(ev, wrapper);
+ return this;
+ };
+
+ /**
+ * @description Bind an event, and trigger it immediately.
+ * @param {string} ev Event name.
+ * @param {function} callback Callback.
+ * @param {mix} data The data that will be passed to calback as arguments.
+ */
+ EventProxy.prototype.immediate = function (ev, callback, data) {
+ this.bind(ev, callback);
+ this.trigger(ev, data);
+ return this;
+ };
+
+ var _assign = function (eventname1, eventname2, cb, once) {
+ var proxy = this, length, index = 0, argsLength = arguments.length,
+ bind, _all,
+ callback, events, isOnce, times = 0, flag = {};
+
+ // Check the arguments length.
+ if (argsLength < 3) {
+ return this;
+ }
+
+ events = [].slice.apply(arguments, [0, argsLength - 2]);
+ callback = arguments[argsLength - 2];
+ isOnce = arguments[argsLength - 1];
+
+ // Check the callback type.
+ if (typeof callback !== "function") {
+ return this;
+ }
+
+ length = events.length;
+ bind = function (key) {
+ var method = isOnce ? "once" : "bind";
+ proxy[method](key, function (data) {
+ proxy._fired[key] = proxy._fired[key] || {};
+ proxy._fired[key].data = data;
+ if (!flag[key]) {
+ flag[key] = true;
+ times++;
+ }
+ });
+ };
+
+ for (index = 0; index < length; index++) {
+ bind(events[index]);
+ }
+
+ _all = function () {
+ if (times < length) {
+ return;
+ }
+ var data = [];
+ for (index = 0; index < length; index++) {
+ data.push(proxy._fired[events[index]].data);
+ }
+ if (isOnce) {
+ proxy.unbind("all", _all);
+ }
+ callback.apply(null, data);
+ };
+ proxy.bind("all", _all);
+ };
+
+ /**
+ * @description Assign some events, after all events were fired, the callback will be executed once.
+ * @param {string} eventName1 First event name.
+ * @param {string} eventName2 Second event name.
+ * @param {function} callback Callback, that will be called after predefined events were fired.
+ */
+ EventProxy.prototype.all = function (eventname1, eventname2, cb) {
+ var args = [].slice.call(arguments);
+ args.push(true);
+ _assign.apply(this, args);
+ return this;
+ };
+ EventProxy.prototype.assign = EventProxy.prototype.all;
+
+ /**
+ * @description Assign some events, after all events were fired, the callback will be executed first time.
+ * then any event that predefined be fired again, the callback will executed with the newest data.
+ * @memberOf EventProxy#
+ * @param {string} eventName1 First event name.
+ * @param {string} eventName2 Second event name.
+ * @param {function} callback Callback, that will be called after predefined events were fired.
+ */
+ EventProxy.prototype.tail = function () {
+ var args = [].slice.call(arguments);
+ args.push(false);
+ _assign.apply(this, args);
+ return this;
+ };
+ EventProxy.prototype.assignAll = EventProxy.prototype.tail;
+ EventProxy.prototype.assignAlways = EventProxy.prototype.tail;
+
+ /**
+ * @description The callback will be executed after the event be fired N times.
+ * @memberOf EventProxy#
+ * @param {string} eventName Event name.
+ * @param {number} times N times.
+ * @param {function} callback Callback, that will be called after event was fired N times.
+ */
+ EventProxy.prototype.after = function (eventName, times, callback) {
+ var proxy = this,
+ firedData = [],
+ all;
+ all = function (name, data) {
+ if (name === eventName) {
+ times--;
+ firedData.push(data);
+ if (times < 1) {
+ proxy.unbind("all", all);
+ callback.apply(null, [firedData]);
+ }
+ }
+ };
+ proxy.bind("all", all);
+ return this;
+ };
+
+ /**
+ * @description The callback will be executed after any registered event was fired. It only executed once.
+ * @memberOf EventProxy#
+ * @param {string} eventName1 Event name.
+ * @param {string} eventName2 Event name.
+ * @param {function} callback The callback will get a map that has data and eventName attributes.
+ */
+ EventProxy.prototype.any = function () {
+ var proxy = this,
+ index, _bind,
+ len = arguments.length,
+ callback = arguments[len - 1],
+ events = [].slice.apply(arguments, [0, len - 1]),
+ count = events.length,
+ _eventName = events.join("_");
+
+ proxy.once(_eventName, callback);
+
+ _bind = function (key) {
+ proxy.bind(key, function (data) {
+ proxy.trigger(_eventName, {"data": data, eventName: key});
+ });
+ };
+
+ for (index = 0; index < count; index++) {
+ _bind(events[index]);
+ }
+ };
+
+ /**
+ * @description The callback will be executed when the evnet name not equals with assigned evnet.
+ * @memberOf EventProxy#
+ * @param {string} eventName Event name.
+ * @param {function} callback Callback.
+ */
+ EventProxy.prototype.not = function (eventName, callback) {
+ var proxy = this;
+ proxy.bind("all", function (name, data) {
+ if (name !== eventName) {
+ callback(data);
+ }
+ });
+ };
+
+ // Event proxy can be used in browser and Nodejs both.
+ if (typeof exports !== "undefined") {
+ exports.EventProxy = EventProxy;
+ } else {
+ this.EventProxy = EventProxy;
+ }
+
+}());
1  node_modules/EventProxy.js/index.js
@@ -0,0 +1 @@
+module.exports = require('./eventproxy');
225 node_modules/EventProxy.js/jsdoc/files.html
@@ -0,0 +1,225 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+ <title>JsDoc Reference - File Index</title>
+ <meta name="generator" content="JsDoc Toolkit" />
+
+ <style type="text/css">
+ /* default.css */
+body
+{
+ font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
+ width: 800px;
+}
+
+.header
+{
+ clear: both;
+ background-color: #ccc;
+ padding: 8px;
+}
+
+h1
+{
+ font-size: 150%;
+ font-weight: bold;
+ padding: 0;
+ margin: 1em 0 0 .3em;
+}
+
+hr
+{
+ border: none 0;
+ border-top: 1px solid #7F8FB1;
+ height: 1px;
+}
+
+pre.code
+{
+ display: block;
+ padding: 8px;
+ border: 1px dashed #ccc;
+}
+
+#index
+{
+ margin-top: 24px;
+ float: left;
+ width: 160px;
+ position: absolute;
+ left: 8px;
+ background-color: #F3F3F3;
+ padding: 8px;
+}
+
+#content
+{
+ margin-left: 190px;
+ width: 600px;
+}
+
+.classList
+{
+ list-style-type: none;
+ padding: 0;
+ margin: 0 0 0 8px;
+ font-family: arial, sans-serif;
+ font-size: 1em;
+ overflow: auto;
+}
+
+.classList li
+{
+ padding: 0;
+ margin: 0 0 8px 0;
+}
+
+.summaryTable { width: 100%; }
+
+h1.classTitle
+{
+ font-size:170%;
+ line-height:130%;
+}
+
+h2 { font-size: 110%; }
+caption, div.sectionTitle
+{
+ background-color: #7F8FB1;
+ color: #fff;
+ font-size:130%;
+ text-align: left;
+ padding: 2px 6px 2px 6px;
+ border: 1px #7F8FB1 solid;
+}
+
+div.sectionTitle { margin-bottom: 8px; }
+.summaryTable thead { display: none; }
+
+.summaryTable td
+{
+ vertical-align: top;
+ padding: 4px;
+ border-bottom: 1px #7F8FB1 solid;
+ border-right: 1px #7F8FB1 solid;
+}
+
+/*col#summaryAttributes {}*/
+.summaryTable td.attributes
+{
+ border-left: 1px #7F8FB1 solid;
+ width: 140px;
+ text-align: right;
+}
+
+td.attributes, .fixedFont
+{
+ line-height: 15px;
+ color: #002EBE;
+ font-family: "Courier New",Courier,monospace;
+ font-size: 13px;
+}
+
+.summaryTable td.nameDescription
+{
+ text-align: left;
+ font-size: 13px;
+ line-height: 15px;
+}
+
+.summaryTable td.nameDescription, .description
+{
+ line-height: 15px;
+ padding: 4px;
+ padding-left: 4px;
+}
+
+.summaryTable { margin-bottom: 8px; }
+
+ul.inheritsList
+{
+ list-style: square;
+ margin-left: 20px;
+ padding-left: 0;
+}
+
+.detailList {
+ margin-left: 20px;
+ line-height: 15px;
+}
+.detailList dt { margin-left: 20px; }
+
+.detailList .heading
+{
+ font-weight: bold;
+ padding-bottom: 6px;
+ margin-left: 0;
+}
+
+.light, td.attributes, .light a:link, .light a:visited
+{
+ color: #777;
+ font-style: italic;
+}
+
+.fineprint
+{
+ text-align: right;
+ font-size: 10px;
+}
+ </style>
+ </head>
+
+ <body>
+ <div id="header">
+</div>
+
+ <div id="index">
+ <div align="center"><a href="index.html">Class Index</a>
+| <a href="files.html">File Index</a></div>
+<hr />
+<h2>Classes</h2>
+<ul class="classList">
+
+ <li><i><a href="symbols/_global_.html">_global_</a></i></li>
+
+ <li><a href="symbols/EventProxy.html">EventProxy</a></li>
+
+</ul>
+<hr />
+ </div>
+
+ <div id="content">
+ <h1 class="classTitle">File Index</h1>
+
+
+ <div>
+ <h2><a href="symbols/src/Y__git_eventproxy_eventproxy.js.html">eventproxy.js</a></h2>
+
+This file is used for define the EventProxy library.
+ <dl>
+
+ <dt class="heading">Author:</dt>
+ <dd><a href="mailto:shyvo1987@gmail.com">Jackson Tian</a></dd>
+
+
+ <dt class="heading">Version:</dt>
+ <dd>0.3</dd>
+
+
+
+ </dl>
+ </div>
+ <hr />
+
+
+ </div>
+ <div class="fineprint" style="clear:both">
+
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Thu Oct 27 2011 14:25:19 GMT+0800 (CST)
+ </div>
+ </body>
+</html>
218 node_modules/EventProxy.js/jsdoc/index.html
@@ -0,0 +1,218 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+ <title>JsDoc Reference - Index</title>
+ <meta name="generator" content="JsDoc Toolkit" />
+
+ <style type="text/css">
+ /* default.css */
+body
+{
+ font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
+ width: 800px;
+}
+
+.header
+{
+ clear: both;
+ background-color: #ccc;
+ padding: 8px;
+}
+
+h1
+{
+ font-size: 150%;
+ font-weight: bold;
+ padding: 0;
+ margin: 1em 0 0 .3em;
+}
+
+hr
+{
+ border: none 0;
+ border-top: 1px solid #7F8FB1;
+ height: 1px;
+}
+
+pre.code
+{
+ display: block;
+ padding: 8px;
+ border: 1px dashed #ccc;
+}
+
+#index
+{
+ margin-top: 24px;
+ float: left;
+ width: 160px;
+ position: absolute;
+ left: 8px;
+ background-color: #F3F3F3;
+ padding: 8px;
+}
+
+#content
+{
+ margin-left: 190px;
+ width: 600px;
+}
+
+.classList
+{
+ list-style-type: none;
+ padding: 0;
+ margin: 0 0 0 8px;
+ font-family: arial, sans-serif;
+ font-size: 1em;
+ overflow: auto;
+}
+
+.classList li
+{
+ padding: 0;
+ margin: 0 0 8px 0;
+}
+
+.summaryTable { width: 100%; }
+
+h1.classTitle
+{
+ font-size:170%;
+ line-height:130%;
+}
+
+h2 { font-size: 110%; }
+caption, div.sectionTitle
+{
+ background-color: #7F8FB1;
+ color: #fff;
+ font-size:130%;
+ text-align: left;
+ padding: 2px 6px 2px 6px;
+ border: 1px #7F8FB1 solid;
+}
+
+div.sectionTitle { margin-bottom: 8px; }
+.summaryTable thead { display: none; }
+
+.summaryTable td
+{
+ vertical-align: top;
+ padding: 4px;
+ border-bottom: 1px #7F8FB1 solid;
+ border-right: 1px #7F8FB1 solid;
+}
+
+/*col#summaryAttributes {}*/
+.summaryTable td.attributes
+{
+ border-left: 1px #7F8FB1 solid;
+ width: 140px;
+ text-align: right;
+}
+
+td.attributes, .fixedFont
+{
+ line-height: 15px;
+ color: #002EBE;
+ font-family: "Courier New",Courier,monospace;
+ font-size: 13px;
+}
+
+.summaryTable td.nameDescription
+{
+ text-align: left;
+ font-size: 13px;
+ line-height: 15px;
+}
+
+.summaryTable td.nameDescription, .description
+{
+ line-height: 15px;
+ padding: 4px;
+ padding-left: 4px;
+}
+
+.summaryTable { margin-bottom: 8px; }
+
+ul.inheritsList
+{
+ list-style: square;
+ margin-left: 20px;
+ padding-left: 0;
+}
+
+.detailList {
+ margin-left: 20px;
+ line-height: 15px;
+}
+.detailList dt { margin-left: 20px; }
+
+.detailList .heading
+{
+ font-weight: bold;
+ padding-bottom: 6px;
+ margin-left: 0;
+}
+
+.light, td.attributes, .light a:link, .light a:visited
+{
+ color: #777;
+ font-style: italic;
+}
+
+.fineprint
+{
+ text-align: right;
+ font-size: 10px;
+}
+ </style>
+ </head>
+
+ <body>
+ <div id="header">
+</div>
+
+ <div id="index">
+ <div align="center"><a href="index.html">Class Index</a>
+| <a href="files.html">File Index</a></div>
+<hr />
+<h2>Classes</h2>
+<ul class="classList">
+
+ <li><i><a href="symbols/_global_.html">_global_</a></i></li>
+
+ <li><a href="symbols/EventProxy.html">EventProxy</a></li>
+
+</ul>
+<hr />
+ </div>
+
+ <div id="content">
+ <h1 class="classTitle">Class Index</h1>
+
+
+ <div>
+ <h2><a href="symbols/_global_.html">_global_</a></h2>
+
+ </div>
+ <hr />
+
+ <div>
+ <h2><a href="symbols/EventProxy.html">EventProxy</a></h2>
+ EventProxy.
+ </div>
+ <hr />
+
+
+ </div>
+ <div class="fineprint" style="clear:both">
+
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Thu Oct 27 2011 14:25:19 GMT+0800 (CST)
+ </div>
+ </body>
+</html>
926 node_modules/EventProxy.js/jsdoc/symbols/EventProxy.html
@@ -0,0 +1,926 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta name="generator" content="JsDoc Toolkit" />
+
+ <title>JsDoc Reference - EventProxy</title>
+
+ <style type="text/css">
+ /* default.css */
+body
+{
+ font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
+ width: 800px;
+}
+
+.header
+{
+ clear: both;
+ background-color: #ccc;
+ padding: 8px;
+}
+
+h1
+{
+ font-size: 150%;
+ font-weight: bold;
+ padding: 0;
+ margin: 1em 0 0 .3em;
+}
+
+hr
+{
+ border: none 0;
+ border-top: 1px solid #7F8FB1;
+ height: 1px;
+}
+
+pre.code
+{
+ display: block;
+ padding: 8px;
+ border: 1px dashed #ccc;
+}
+
+#index
+{
+ margin-top: 24px;
+ float: left;
+ width: 160px;
+ position: absolute;
+ left: 8px;
+ background-color: #F3F3F3;
+ padding: 8px;
+}
+
+#content
+{
+ margin-left: 190px;
+ width: 600px;
+}
+
+.classList
+{
+ list-style-type: none;
+ padding: 0;
+ margin: 0 0 0 8px;
+ font-family: arial, sans-serif;
+ font-size: 1em;
+ overflow: auto;
+}
+
+.classList li
+{
+ padding: 0;
+ margin: 0 0 8px 0;
+}
+
+.summaryTable { width: 100%; }
+
+h1.classTitle
+{
+ font-size:170%;
+ line-height:130%;
+}
+
+h2 { font-size: 110%; }
+caption, div.sectionTitle
+{
+ background-color: #7F8FB1;
+ color: #fff;
+ font-size:130%;
+ text-align: left;
+ padding: 2px 6px 2px 6px;
+ border: 1px #7F8FB1 solid;
+}
+
+div.sectionTitle { margin-bottom: 8px; }
+.summaryTable thead { display: none; }
+
+.summaryTable td
+{
+ vertical-align: top;
+ padding: 4px;
+ border-bottom: 1px #7F8FB1 solid;
+ border-right: 1px #7F8FB1 solid;
+}
+
+/*col#summaryAttributes {}*/
+.summaryTable td.attributes
+{
+ border-left: 1px #7F8FB1 solid;
+ width: 140px;
+ text-align: right;
+}
+
+td.attributes, .fixedFont
+{
+ line-height: 15px;
+ color: #002EBE;
+ font-family: "Courier New",Courier,monospace;
+ font-size: 13px;
+}
+
+.summaryTable td.nameDescription
+{
+ text-align: left;
+ font-size: 13px;
+ line-height: 15px;
+}
+
+.summaryTable td.nameDescription, .description
+{
+ line-height: 15px;
+ padding: 4px;
+ padding-left: 4px;
+}
+
+.summaryTable { margin-bottom: 8px; }
+
+ul.inheritsList
+{
+ list-style: square;
+ margin-left: 20px;
+ padding-left: 0;
+}
+
+.detailList {
+ margin-left: 20px;
+ line-height: 15px;
+}
+.detailList dt { margin-left: 20px; }
+
+.detailList .heading
+{
+ font-weight: bold;
+ padding-bottom: 6px;
+ margin-left: 0;
+}
+
+.light, td.attributes, .light a:link, .light a:visited
+{
+ color: #777;
+ font-style: italic;
+}
+
+.fineprint
+{
+ text-align: right;
+ font-size: 10px;
+}
+ </style>
+ </head>
+
+ <body>
+<!-- ============================== header ================================= -->
+ <!-- begin static/header.html -->
+ <div id="header">
+</div>
+ <!-- end static/header.html -->
+
+<!-- ============================== classes index ============================ -->
+ <div id="index">
+ <!-- begin publish.classesIndex -->
+ <div align="center"><a href="../index.html">Class Index</a>
+| <a href="../files.html">File Index</a></div>
+<hr />
+<h2>Classes</h2>
+<ul class="classList">
+
+ <li><i><a href="../symbols/_global_.html">_global_</a></i></li>
+
+ <li><a href="../symbols/EventProxy.html">EventProxy</a></li>
+
+</ul>
+<hr />
+ <!-- end publish.classesIndex -->
+ </div>
+
+ <div id="content">
+<!-- ============================== class title ============================ -->
+ <h1 class="classTitle">
+
+ Class EventProxy
+ </h1>
+
+<!-- ============================== class summary ========================== -->
+ <p class="description">
+
+
+
+ EventProxy. An implementation of task/event based asynchronous pattern.
+
+
+ <br /><i>Defined in: </i> <a href="../symbols/src/Y__git_eventproxy_eventproxy.js.html">eventproxy.js</a>.
+
+ </p>
+
+<!-- ============================== constructor summary ==================== -->
+
+ <table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class EventProxy.">
+ <caption>Class Summary</caption>
+ <thead>
+ <tr>
+ <th scope="col">Constructor Attributes</th>
+ <th scope="col">Constructor Name and Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription" >
+ <div class="fixedFont">
+ <b><a href="../symbols/EventProxy.html#constructor">EventProxy</a></b>()
+ </div>
+ <div class="description">EventProxy.</div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+<!-- ============================== properties summary ===================== -->
+
+
+<!-- ============================== methods summary ======================== -->
+
+
+
+ <table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class EventProxy.">
+ <caption>Method Summary</caption>
+ <thead>
+ <tr>
+ <th scope="col">Method Attributes</th>
+ <th scope="col">Method Name and Description</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#addListener">addListener</a></b>(eventName, callback)
+ </div>
+ <div class="description">Bind an event, specified by a string name, `ev`, to a `callback` function.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#after">after</a></b>(eventName, times, callback)
+ </div>
+ <div class="description">The callback will be executed after the event be fired N times.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#all">all</a></b>(eventName1, eventName2, callback)
+ </div>
+ <div class="description">Assign some events, after all events were fired, the callback will be executed once.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#any">any</a></b>(eventName1, eventName2, callback)
+ </div>
+ <div class="description">The callback will be executed after any registered event was fired.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#immediate">immediate</a></b>(ev, callback, data)
+ </div>
+ <div class="description">Bind an event, and trigger it immediately.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#not">not</a></b>(eventName, callback)
+ </div>
+ <div class="description">The callback will be executed when the evnet name not equals with assigned evnet.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#once">once</a></b>(ev, callback)
+ </div>
+ <div class="description">Bind an event like the bind method, but will remove the listener after it was fired.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#removeAllListeners">removeAllListeners</a></b>(event)
+ </div>
+ <div class="description">Remove all listeners.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#removeListener">removeListener</a></b>(eventName, callback)
+ </div>
+ <div class="description">Remove one or many callbacks.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#tail">tail</a></b>(eventName1, eventName2, callback)
+ </div>
+ <div class="description">Assign some events, after all events were fired, the callback will be executed first time.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/EventProxy.html#trigger">trigger</a></b>(eventName, data)
+ </div>
+ <div class="description">Trigger an event, firing all bound callbacks.</div>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+<!-- ============================== events summary ======================== -->
+
+
+<!-- ============================== constructor details ==================== -->
+
+ <div class="details"><a name="constructor"> </a>
+ <div class="sectionTitle">
+ Class Detail
+ </div>
+
+ <div class="fixedFont">
+ <b>EventProxy</b>()
+ </div>
+
+ <div class="description">
+ EventProxy. A module that can be mixed in to *any object* in order to provide it with
+custom events. You may `bind` or `unbind` a callback function to an event;
+`trigger`-ing an event fires all callbacks in succession.
+
+ </div>
+
+
+
+ <pre class="code">var render = function (template, resources) {};
+var proxy = new EventProxy();
+proxy.assign("template", "l10n", render);
+proxy.trigger("template", template);
+proxy.trigger("l10n", resources);</pre>
+
+
+
+
+
+
+
+
+
+
+
+
+ </div>
+
+
+<!-- ============================== field details ========================== -->
+
+
+<!-- ============================== method details ========================= -->
+
+ <div class="sectionTitle">
+ Method Detail
+ </div>
+
+ <a name="addListener"> </a>
+ <div class="fixedFont">
+
+
+ <b>addListener</b>(eventName, callback)
+
+ </div>
+ <div class="description">
+ Bind an event, specified by a string name, `ev`, to a `callback` function.
+Passing `"all"` will bind the callback to all events fired.
+
+
+ </div>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>eventName</b>
+
+ </dt>
+ <dd>Event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{function}</span> <b>callback</b>
+
+ </dt>
+ <dd>Callback.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+ <hr />
+
+ <a name="after"> </a>
+ <div class="fixedFont">
+
+
+ <b>after</b>(eventName, times, callback)
+
+ </div>
+ <div class="description">
+ The callback will be executed after the event be fired N times.
+
+
+ </div>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>eventName</b>
+
+ </dt>
+ <dd>Event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{number}</span> <b>times</b>
+
+ </dt>
+ <dd>N times.</dd>
+
+ <dt>
+ <span class="light fixedFont">{function}</span> <b>callback</b>
+
+ </dt>
+ <dd>Callback, that will be called after event was fired N times.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+ <hr />
+
+ <a name="all"> </a>
+ <div class="fixedFont">
+
+
+ <b>all</b>(eventName1, eventName2, callback)
+
+ </div>
+ <div class="description">
+ Assign some events, after all events were fired, the callback will be executed once.
+
+
+ </div>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>eventName1</b>
+
+ </dt>
+ <dd>First event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>eventName2</b>
+
+ </dt>
+ <dd>Second event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{function}</span> <b>callback</b>
+
+ </dt>
+ <dd>Callback, that will be called after predefined events were fired.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+ <hr />
+
+ <a name="any"> </a>
+ <div class="fixedFont">
+
+
+ <b>any</b>(eventName1, eventName2, callback)
+
+ </div>
+ <div class="description">
+ The callback will be executed after any registered event was fired. It only executed once.
+
+
+ </div>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>eventName1</b>
+
+ </dt>
+ <dd>Event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>eventName2</b>
+
+ </dt>
+ <dd>Event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{function}</span> <b>callback</b>
+
+ </dt>
+ <dd>The callback will get a map that has data and eventName attributes.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+ <hr />
+
+ <a name="immediate"> </a>
+ <div class="fixedFont">
+
+
+ <b>immediate</b>(ev, callback, data)
+
+ </div>
+ <div class="description">
+ Bind an event, and trigger it immediately.
+
+
+ </div>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{string}</span> <b>ev</b>
+
+ </dt>
+ <dd>Event name.</dd>
+
+ <dt>
+ <span class="light fixedFont">{function}</span> <b>callback</b>
+
+ </dt>
+ <dd>Callback.</dd>
+
+ <dt>
+ <span class="light fixedFont">{mix}</span> <b>data</b>
+
+ </dt>
+ <dd>The data that will be passed to calback as arguments.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+ <hr />
+