javascriptmvc 3.0.0.pre15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (550) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/README.markdown +15 -0
  4. data/Rakefile +17 -0
  5. data/VERSION +1 -0
  6. data/bin/jmvc-build +4 -0
  7. data/bin/jmvc-gen +4 -0
  8. data/bin/jmvc-get +4 -0
  9. data/bin/jmvc-init +4 -0
  10. data/bin/jmvc-update +4 -0
  11. data/lib/javascriptmvc.rb +97 -0
  12. data/lib/javascriptmvc/documentjs/README +0 -0
  13. data/lib/javascriptmvc/documentjs/add.js +76 -0
  14. data/lib/javascriptmvc/documentjs/application.js +285 -0
  15. data/lib/javascriptmvc/documentjs/attribute.js +61 -0
  16. data/lib/javascriptmvc/documentjs/baseclass.js +537 -0
  17. data/lib/javascriptmvc/documentjs/class.js +141 -0
  18. data/lib/javascriptmvc/documentjs/constructor.js +145 -0
  19. data/lib/javascriptmvc/documentjs/directives.js +394 -0
  20. data/lib/javascriptmvc/documentjs/distance.js +49 -0
  21. data/lib/javascriptmvc/documentjs/document +21 -0
  22. data/lib/javascriptmvc/documentjs/documentjs.js +76 -0
  23. data/lib/javascriptmvc/documentjs/file.js +55 -0
  24. data/lib/javascriptmvc/documentjs/function.js +112 -0
  25. data/lib/javascriptmvc/documentjs/jmvcdoc/images/close.png +0 -0
  26. data/lib/javascriptmvc/documentjs/jmvcdoc/images/download.png +0 -0
  27. data/lib/javascriptmvc/documentjs/jmvcdoc/images/fav-off.png +0 -0
  28. data/lib/javascriptmvc/documentjs/jmvcdoc/images/fav-on.png +0 -0
  29. data/lib/javascriptmvc/documentjs/jmvcdoc/images/favicon.ico +0 -0
  30. data/lib/javascriptmvc/documentjs/jmvcdoc/images/logo.png +0 -0
  31. data/lib/javascriptmvc/documentjs/jmvcdoc/images/pre.png +0 -0
  32. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  33. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  34. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  35. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  36. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  37. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  38. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  39. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  40. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_222222_256x240.png +0 -0
  41. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_2e83ff_256x240.png +0 -0
  42. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_454545_256x240.png +0 -0
  43. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_888888_256x240.png +0 -0
  44. data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_cd0a0a_256x240.png +0 -0
  45. data/lib/javascriptmvc/documentjs/jmvcdoc/images/video.png +0 -0
  46. data/lib/javascriptmvc/documentjs/jmvcdoc/production.js +552 -0
  47. data/lib/javascriptmvc/documentjs/jmvcdoc/style.css +354 -0
  48. data/lib/javascriptmvc/documentjs/jmvcdoc/summary.ejs +134 -0
  49. data/lib/javascriptmvc/documentjs/json.js +172 -0
  50. data/lib/javascriptmvc/documentjs/page.js +107 -0
  51. data/lib/javascriptmvc/documentjs/pair.js +302 -0
  52. data/lib/javascriptmvc/documentjs/prototype.js +13 -0
  53. data/lib/javascriptmvc/documentjs/scripts/build.js +6 -0
  54. data/lib/javascriptmvc/documentjs/static.js +25 -0
  55. data/lib/javascriptmvc/documentjs/test/docs/Something.json +1 -0
  56. data/lib/javascriptmvc/documentjs/test/docs/searchData.json +1 -0
  57. data/lib/javascriptmvc/documentjs/test/something.js +8 -0
  58. data/lib/javascriptmvc/documentjs/test/test.html +6 -0
  59. data/lib/javascriptmvc/documentjs/test_doc.html +1 -0
  60. data/lib/javascriptmvc/documentjs/update +5 -0
  61. data/lib/javascriptmvc/funcunit/README +17 -0
  62. data/lib/javascriptmvc/funcunit/autosuggest/auto_suggest.js +495 -0
  63. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.css +24 -0
  64. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.html +26 -0
  65. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.js +17 -0
  66. data/lib/javascriptmvc/funcunit/autosuggest/autosuggest_test.js +14 -0
  67. data/lib/javascriptmvc/funcunit/autosuggest/funcunit.html +15 -0
  68. data/lib/javascriptmvc/funcunit/build.js +54 -0
  69. data/lib/javascriptmvc/funcunit/drivers/selenium.js +129 -0
  70. data/lib/javascriptmvc/funcunit/drivers/standard.js +169 -0
  71. data/lib/javascriptmvc/funcunit/envjs +13 -0
  72. data/lib/javascriptmvc/funcunit/envjs.bat +28 -0
  73. data/lib/javascriptmvc/funcunit/funcunit.html +20 -0
  74. data/lib/javascriptmvc/funcunit/funcunit.js +1509 -0
  75. data/lib/javascriptmvc/funcunit/java/selenium-java-client-driver.jar +0 -0
  76. data/lib/javascriptmvc/funcunit/java/selenium-server.jar +0 -0
  77. data/lib/javascriptmvc/funcunit/qunit.html +22 -0
  78. data/lib/javascriptmvc/funcunit/qunit/qunit.css +119 -0
  79. data/lib/javascriptmvc/funcunit/qunit/qunit.js +1124 -0
  80. data/lib/javascriptmvc/funcunit/qunit/rhino/rhino.js +24 -0
  81. data/lib/javascriptmvc/funcunit/qunit/test/qunit.html +18 -0
  82. data/lib/javascriptmvc/funcunit/qunit/test/test.js +7 -0
  83. data/lib/javascriptmvc/funcunit/resources/funcunit.js +31 -0
  84. data/lib/javascriptmvc/funcunit/resources/jquery.js +6378 -0
  85. data/lib/javascriptmvc/funcunit/resources/json.js +201 -0
  86. data/lib/javascriptmvc/funcunit/resources/selenium_start.js +43 -0
  87. data/lib/javascriptmvc/funcunit/scripts/run.js +36 -0
  88. data/lib/javascriptmvc/funcunit/scripts/test.js +55 -0
  89. data/lib/javascriptmvc/funcunit/settings.js +10 -0
  90. data/lib/javascriptmvc/funcunit/synthetic/browsers.js +151 -0
  91. data/lib/javascriptmvc/funcunit/synthetic/demo.html +150 -0
  92. data/lib/javascriptmvc/funcunit/synthetic/demo/record.js +254 -0
  93. data/lib/javascriptmvc/funcunit/synthetic/drag/drag.html +41 -0
  94. data/lib/javascriptmvc/funcunit/synthetic/drag/drag.js +268 -0
  95. data/lib/javascriptmvc/funcunit/synthetic/drag/qunit.html +20 -0
  96. data/lib/javascriptmvc/funcunit/synthetic/drag/test/qunit/drag_test.js +195 -0
  97. data/lib/javascriptmvc/funcunit/synthetic/drag/test/qunit/qunit.js +7 -0
  98. data/lib/javascriptmvc/funcunit/synthetic/key.js +832 -0
  99. data/lib/javascriptmvc/funcunit/synthetic/mouse.js +291 -0
  100. data/lib/javascriptmvc/funcunit/synthetic/qunit.html +22 -0
  101. data/lib/javascriptmvc/funcunit/synthetic/recorder.html +303 -0
  102. data/lib/javascriptmvc/funcunit/synthetic/synthetic.html +85 -0
  103. data/lib/javascriptmvc/funcunit/synthetic/synthetic.js +796 -0
  104. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/key_test.js +391 -0
  105. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/mouse_test.js +233 -0
  106. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/qunit.js +6 -0
  107. data/lib/javascriptmvc/funcunit/synthetic/test/qunit/synthetic_test.js +91 -0
  108. data/lib/javascriptmvc/funcunit/synthetic/test/submit.html +29 -0
  109. data/lib/javascriptmvc/funcunit/synthetic/test/submitted.html +3 -0
  110. data/lib/javascriptmvc/funcunit/template.html +18 -0
  111. data/lib/javascriptmvc/funcunit/test/drag.html +63 -0
  112. data/lib/javascriptmvc/funcunit/test/funcunit/funcunit.js +3 -0
  113. data/lib/javascriptmvc/funcunit/test/funcunit/funcunit_test.js +87 -0
  114. data/lib/javascriptmvc/funcunit/test/funcunit/open_test.js +28 -0
  115. data/lib/javascriptmvc/funcunit/test/funcunit/protodrag_test.js +13 -0
  116. data/lib/javascriptmvc/funcunit/test/funcunit/syn_test.js +41 -0
  117. data/lib/javascriptmvc/funcunit/test/jquery.event.drag.js +801 -0
  118. data/lib/javascriptmvc/funcunit/test/jquery.event.drop.js +439 -0
  119. data/lib/javascriptmvc/funcunit/test/jquery.js +6360 -0
  120. data/lib/javascriptmvc/funcunit/test/myapp.html +103 -0
  121. data/lib/javascriptmvc/funcunit/test/myotherapp.html +15 -0
  122. data/lib/javascriptmvc/funcunit/test/protodrag/dragdrop.js +974 -0
  123. data/lib/javascriptmvc/funcunit/test/protodrag/effects.js +1123 -0
  124. data/lib/javascriptmvc/funcunit/test/protodrag/funcunit_test.js +20 -0
  125. data/lib/javascriptmvc/funcunit/test/protodrag/myapp.html +63 -0
  126. data/lib/javascriptmvc/funcunit/test/protodrag/prototype.js +4874 -0
  127. data/lib/javascriptmvc/funcunit/test/protodrag/scriptaculous.js +68 -0
  128. data/lib/javascriptmvc/funcunit/update +5 -0
  129. data/lib/javascriptmvc/jquery/README +24 -0
  130. data/lib/javascriptmvc/jquery/build.js +73 -0
  131. data/lib/javascriptmvc/jquery/class/class.html +109 -0
  132. data/lib/javascriptmvc/jquery/class/class.js +627 -0
  133. data/lib/javascriptmvc/jquery/class/qunit.html +15 -0
  134. data/lib/javascriptmvc/jquery/class/test/qunit/class_test.js +146 -0
  135. data/lib/javascriptmvc/jquery/class/test/qunit/qunit.js +5 -0
  136. data/lib/javascriptmvc/jquery/class/test/qunit/test.html +20 -0
  137. data/lib/javascriptmvc/jquery/controller/controller.html +89 -0
  138. data/lib/javascriptmvc/jquery/controller/controller.js +735 -0
  139. data/lib/javascriptmvc/jquery/controller/history/history.html +44 -0
  140. data/lib/javascriptmvc/jquery/controller/history/history.js +177 -0
  141. data/lib/javascriptmvc/jquery/controller/qunit.html +21 -0
  142. data/lib/javascriptmvc/jquery/controller/subscribe/funcunit.html +21 -0
  143. data/lib/javascriptmvc/jquery/controller/subscribe/scripts/compress.js +6 -0
  144. data/lib/javascriptmvc/jquery/controller/subscribe/scripts/docs.js +6 -0
  145. data/lib/javascriptmvc/jquery/controller/subscribe/subscribe.html +56 -0
  146. data/lib/javascriptmvc/jquery/controller/subscribe/subscribe.js +27 -0
  147. data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/funcunit.js +3 -0
  148. data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/run.js +10 -0
  149. data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/subscribe_test.js +11 -0
  150. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/qunit.html +21 -0
  151. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/qunit.js +9 -0
  152. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/run.js +2 -0
  153. data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/subscribe_test.js +4 -0
  154. data/lib/javascriptmvc/jquery/controller/test/qunit/controller_test.js +170 -0
  155. data/lib/javascriptmvc/jquery/controller/test/qunit/qunit.js +9 -0
  156. data/lib/javascriptmvc/jquery/controller/view/qunit.html +21 -0
  157. data/lib/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js +15 -0
  158. data/lib/javascriptmvc/jquery/controller/view/test/qunit/qunit.js +6 -0
  159. data/lib/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro +1 -0
  160. data/lib/javascriptmvc/jquery/controller/view/view.js +102 -0
  161. data/lib/javascriptmvc/jquery/dom/closest/closest.html +23 -0
  162. data/lib/javascriptmvc/jquery/dom/closest/closest.js +47 -0
  163. data/lib/javascriptmvc/jquery/dom/closest/funcunit.html +20 -0
  164. data/lib/javascriptmvc/jquery/dom/closest/qunit.html +22 -0
  165. data/lib/javascriptmvc/jquery/dom/closest/scripts/compress.js +3 -0
  166. data/lib/javascriptmvc/jquery/dom/closest/scripts/doc.js +4 -0
  167. data/lib/javascriptmvc/jquery/dom/closest/scripts/test.js +55 -0
  168. data/lib/javascriptmvc/jquery/dom/closest/settings.js +40 -0
  169. data/lib/javascriptmvc/jquery/dom/closest/test/funcunit/funcunit.js +3 -0
  170. data/lib/javascriptmvc/jquery/dom/closest/test/funcunit/tests/basic.js +11 -0
  171. data/lib/javascriptmvc/jquery/dom/closest/test/qunit/qunit.js +4 -0
  172. data/lib/javascriptmvc/jquery/dom/closest/test/qunit/tests/basic.js +4 -0
  173. data/lib/javascriptmvc/jquery/dom/compare/compare.html +88 -0
  174. data/lib/javascriptmvc/jquery/dom/compare/compare.js +67 -0
  175. data/lib/javascriptmvc/jquery/dom/compare/qunit.html +20 -0
  176. data/lib/javascriptmvc/jquery/dom/compare/test/qunit/compare_test.js +19 -0
  177. data/lib/javascriptmvc/jquery/dom/compare/test/qunit/qunit.js +5 -0
  178. data/lib/javascriptmvc/jquery/dom/cookie/cookie.html +25 -0
  179. data/lib/javascriptmvc/jquery/dom/cookie/cookie.js +119 -0
  180. data/lib/javascriptmvc/jquery/dom/cookie/scripts/compress.js +6 -0
  181. data/lib/javascriptmvc/jquery/dom/cookie/scripts/doc.js +6 -0
  182. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/cookie_test.js +11 -0
  183. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/funcunit.html +21 -0
  184. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/funcunit.js +3 -0
  185. data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/run.js +10 -0
  186. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/cookie_test.js +4 -0
  187. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/qunit.html +21 -0
  188. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/qunit.js +9 -0
  189. data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/run.js +2 -0
  190. data/lib/javascriptmvc/jquery/dom/cur_styles/cur_styles.html +71 -0
  191. data/lib/javascriptmvc/jquery/dom/cur_styles/cur_styles.js +120 -0
  192. data/lib/javascriptmvc/jquery/dom/cur_styles/qunit.html +22 -0
  193. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/curStyles.micro +3 -0
  194. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/cur_styles_test.js +22 -0
  195. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/outer.micro +0 -0
  196. data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/qunit.js +4 -0
  197. data/lib/javascriptmvc/jquery/dom/dimensions/curstyles.html +22 -0
  198. data/lib/javascriptmvc/jquery/dom/dimensions/dimensions.html +132 -0
  199. data/lib/javascriptmvc/jquery/dom/dimensions/dimensions.js +140 -0
  200. data/lib/javascriptmvc/jquery/dom/dimensions/qunit.html +22 -0
  201. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro +3 -0
  202. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js +8 -0
  203. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/outer.micro +0 -0
  204. data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js +4 -0
  205. data/lib/javascriptmvc/jquery/dom/dom.js +7 -0
  206. data/lib/javascriptmvc/jquery/dom/fixture/fixture.html +143 -0
  207. data/lib/javascriptmvc/jquery/dom/fixture/fixture.js +521 -0
  208. data/lib/javascriptmvc/jquery/dom/fixture/fixtures/messages.html +31 -0
  209. data/lib/javascriptmvc/jquery/dom/fixture/fixtures/test.json +3 -0
  210. data/lib/javascriptmvc/jquery/dom/fixture/qunit.html +22 -0
  211. data/lib/javascriptmvc/jquery/dom/fixture/test/qunit/fixture_test.js +50 -0
  212. data/lib/javascriptmvc/jquery/dom/fixture/test/qunit/qunit.js +4 -0
  213. data/lib/javascriptmvc/jquery/dom/form_params/form_params.html +57 -0
  214. data/lib/javascriptmvc/jquery/dom/form_params/form_params.js +106 -0
  215. data/lib/javascriptmvc/jquery/dom/form_params/qunit.html +22 -0
  216. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro +27 -0
  217. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro +20 -0
  218. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js +43 -0
  219. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js +4 -0
  220. data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro +8 -0
  221. data/lib/javascriptmvc/jquery/dom/within/within.js +67 -0
  222. data/lib/javascriptmvc/jquery/error/background.png +0 -0
  223. data/lib/javascriptmvc/jquery/error/error.html +31 -0
  224. data/lib/javascriptmvc/jquery/error/error.js +227 -0
  225. data/lib/javascriptmvc/jquery/error/setup.js +4 -0
  226. data/lib/javascriptmvc/jquery/error/test/test.html +23 -0
  227. data/lib/javascriptmvc/jquery/error/test/test.js +4 -0
  228. data/lib/javascriptmvc/jquery/event/default/compress.js +7 -0
  229. data/lib/javascriptmvc/jquery/event/default/default.html +85 -0
  230. data/lib/javascriptmvc/jquery/event/default/default.js +193 -0
  231. data/lib/javascriptmvc/jquery/event/default/defaultjquery.html +117 -0
  232. data/lib/javascriptmvc/jquery/event/default/qunit.html +22 -0
  233. data/lib/javascriptmvc/jquery/event/default/test/qunit/default_test.js +104 -0
  234. data/lib/javascriptmvc/jquery/event/default/test/qunit/html.micro +8 -0
  235. data/lib/javascriptmvc/jquery/event/default/test/qunit/qunit.js +6 -0
  236. data/lib/javascriptmvc/jquery/event/default/test/qunit/run.js +2 -0
  237. data/lib/javascriptmvc/jquery/event/destroyed/destroyed.html +24 -0
  238. data/lib/javascriptmvc/jquery/event/destroyed/destroyed.js +40 -0
  239. data/lib/javascriptmvc/jquery/event/destroyed/destroyed_menu.html +96 -0
  240. data/lib/javascriptmvc/jquery/event/destroyed/qunit.html +21 -0
  241. data/lib/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js +12 -0
  242. data/lib/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js +6 -0
  243. data/lib/javascriptmvc/jquery/event/drag/drag.html +105 -0
  244. data/lib/javascriptmvc/jquery/event/drag/drag.js +466 -0
  245. data/lib/javascriptmvc/jquery/event/drag/limit/limit.html +74 -0
  246. data/lib/javascriptmvc/jquery/event/drag/limit/limit.js +56 -0
  247. data/lib/javascriptmvc/jquery/event/drag/limit/scripts/compress.js +6 -0
  248. data/lib/javascriptmvc/jquery/event/drag/limit/scripts/doc.js +6 -0
  249. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/funcunit.html +21 -0
  250. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/funcunit.js +3 -0
  251. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/limit_test.js +11 -0
  252. data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/run.js +10 -0
  253. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/limit_test.js +4 -0
  254. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/qunit.html +21 -0
  255. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/qunit.js +9 -0
  256. data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/run.js +2 -0
  257. data/lib/javascriptmvc/jquery/event/drag/qunit.html +16 -0
  258. data/lib/javascriptmvc/jquery/event/drag/scroll/scroll.js +120 -0
  259. data/lib/javascriptmvc/jquery/event/drag/test/qunit/drag_test.js +130 -0
  260. data/lib/javascriptmvc/jquery/event/drag/test/qunit/qunit.js +4 -0
  261. data/lib/javascriptmvc/jquery/event/drop/drop.html +74 -0
  262. data/lib/javascriptmvc/jquery/event/drop/drop.js +301 -0
  263. data/lib/javascriptmvc/jquery/event/event.js +6 -0
  264. data/lib/javascriptmvc/jquery/event/hashchange/hashchange.js +245 -0
  265. data/lib/javascriptmvc/jquery/event/hover/compress.js +7 -0
  266. data/lib/javascriptmvc/jquery/event/hover/hover.html +56 -0
  267. data/lib/javascriptmvc/jquery/event/hover/hover.js +219 -0
  268. data/lib/javascriptmvc/jquery/event/hover/qunit.html +16 -0
  269. data/lib/javascriptmvc/jquery/event/hover/test/qunit/hover_test.js +55 -0
  270. data/lib/javascriptmvc/jquery/event/hover/test/qunit/qunit.js +4 -0
  271. data/lib/javascriptmvc/jquery/event/livehack/compress.js +7 -0
  272. data/lib/javascriptmvc/jquery/event/livehack/funcunit.html +21 -0
  273. data/lib/javascriptmvc/jquery/event/livehack/livehack.html +25 -0
  274. data/lib/javascriptmvc/jquery/event/livehack/livehack.js +167 -0
  275. data/lib/javascriptmvc/jquery/event/offline/funcunit.html +20 -0
  276. data/lib/javascriptmvc/jquery/event/offline/offline.html +26 -0
  277. data/lib/javascriptmvc/jquery/event/offline/offline.js +36 -0
  278. data/lib/javascriptmvc/jquery/event/offline/qunit.html +22 -0
  279. data/lib/javascriptmvc/jquery/event/offline/scripts/compress.js +3 -0
  280. data/lib/javascriptmvc/jquery/event/offline/scripts/doc.js +4 -0
  281. data/lib/javascriptmvc/jquery/event/offline/settings.js +41 -0
  282. data/lib/javascriptmvc/jquery/event/offline/test/funcunit/funcunit.js +3 -0
  283. data/lib/javascriptmvc/jquery/event/offline/test/funcunit/tests/basic.js +11 -0
  284. data/lib/javascriptmvc/jquery/event/offline/test/qunit/qunit.js +4 -0
  285. data/lib/javascriptmvc/jquery/event/offline/test/qunit/tests/basic.js +4 -0
  286. data/lib/javascriptmvc/jquery/event/resize/funcunit.html +20 -0
  287. data/lib/javascriptmvc/jquery/event/resize/qunit.html +22 -0
  288. data/lib/javascriptmvc/jquery/event/resize/resize.html +23 -0
  289. data/lib/javascriptmvc/jquery/event/resize/resize.js +50 -0
  290. data/lib/javascriptmvc/jquery/event/resize/scripts/compress.js +3 -0
  291. data/lib/javascriptmvc/jquery/event/resize/scripts/doc.js +4 -0
  292. data/lib/javascriptmvc/jquery/event/resize/scripts/test.js +55 -0
  293. data/lib/javascriptmvc/jquery/event/resize/settings.js +40 -0
  294. data/lib/javascriptmvc/jquery/event/resize/test/funcunit/funcunit.js +3 -0
  295. data/lib/javascriptmvc/jquery/event/resize/test/funcunit/tests/basic.js +11 -0
  296. data/lib/javascriptmvc/jquery/event/resize/test/qunit/qunit.js +4 -0
  297. data/lib/javascriptmvc/jquery/event/resize/test/qunit/tests/basic.js +4 -0
  298. data/lib/javascriptmvc/jquery/event/select/scripts/compress.js +6 -0
  299. data/lib/javascriptmvc/jquery/event/select/scripts/doc.js +6 -0
  300. data/lib/javascriptmvc/jquery/event/select/select.html +63 -0
  301. data/lib/javascriptmvc/jquery/event/select/select.js +65 -0
  302. data/lib/javascriptmvc/jquery/event/select/test/funcunit/funcunit.html +21 -0
  303. data/lib/javascriptmvc/jquery/event/select/test/funcunit/funcunit.js +3 -0
  304. data/lib/javascriptmvc/jquery/event/select/test/funcunit/run.js +10 -0
  305. data/lib/javascriptmvc/jquery/event/select/test/funcunit/select_test.js +11 -0
  306. data/lib/javascriptmvc/jquery/event/select/test/qunit/qunit.html +21 -0
  307. data/lib/javascriptmvc/jquery/event/select/test/qunit/qunit.js +5 -0
  308. data/lib/javascriptmvc/jquery/event/select/test/qunit/run.js +2 -0
  309. data/lib/javascriptmvc/jquery/event/select/test/qunit/select_test.js +4 -0
  310. data/lib/javascriptmvc/jquery/generate/app +23 -0
  311. data/lib/javascriptmvc/jquery/generate/controller +21 -0
  312. data/lib/javascriptmvc/jquery/generate/model +26 -0
  313. data/lib/javascriptmvc/jquery/generate/page +20 -0
  314. data/lib/javascriptmvc/jquery/generate/plugin +20 -0
  315. data/lib/javascriptmvc/jquery/generate/scaffold +23 -0
  316. data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).css.ejs +4 -0
  317. data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).html.ejs +23 -0
  318. data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).js.ejs +21 -0
  319. data/lib/javascriptmvc/jquery/generate/templates/app/controllers/.ignore +0 -0
  320. data/lib/javascriptmvc/jquery/generate/templates/app/docs/.ignore +0 -0
  321. data/lib/javascriptmvc/jquery/generate/templates/app/fixtures/.ignore +0 -0
  322. data/lib/javascriptmvc/jquery/generate/templates/app/funcunit.html.ejs +15 -0
  323. data/lib/javascriptmvc/jquery/generate/templates/app/models/.ignore +0 -0
  324. data/lib/javascriptmvc/jquery/generate/templates/app/qunit.html.ejs +20 -0
  325. data/lib/javascriptmvc/jquery/generate/templates/app/resources/.ignore +0 -0
  326. data/lib/javascriptmvc/jquery/generate/templates/app/scripts/build.js.ejs +6 -0
  327. data/lib/javascriptmvc/jquery/generate/templates/app/scripts/clean.js.ejs +6 -0
  328. data/lib/javascriptmvc/jquery/generate/templates/app/scripts/docs.js.ejs +4 -0
  329. data/lib/javascriptmvc/jquery/generate/templates/app/test/funcunit/(application_name)_test.js.ejs +9 -0
  330. data/lib/javascriptmvc/jquery/generate/templates/app/test/funcunit/funcunit.js.ejs +3 -0
  331. data/lib/javascriptmvc/jquery/generate/templates/app/test/qunit/(application_name)_test.js.ejs +5 -0
  332. data/lib/javascriptmvc/jquery/generate/templates/app/test/qunit/qunit.js.ejs +3 -0
  333. data/lib/javascriptmvc/jquery/generate/templates/app/views/.ignore +0 -0
  334. data/lib/javascriptmvc/jquery/generate/templates/controller/controllers/(underscore)_controller.js.ejs +12 -0
  335. data/lib/javascriptmvc/jquery/generate/templates/model/fixtures.link +1 -0
  336. data/lib/javascriptmvc/jquery/generate/templates/model/models.link +1 -0
  337. data/lib/javascriptmvc/jquery/generate/templates/model/test/qunit.link +1 -0
  338. data/lib/javascriptmvc/jquery/generate/templates/page.ejs +23 -0
  339. data/lib/javascriptmvc/jquery/generate/templates/plugin/(application_name).html.ejs +23 -0
  340. data/lib/javascriptmvc/jquery/generate/templates/plugin/(application_name).js.ejs +3 -0
  341. data/lib/javascriptmvc/jquery/generate/templates/plugin/fixtures/.ignore +0 -0
  342. data/lib/javascriptmvc/jquery/generate/templates/plugin/funcunit.html.ejs +15 -0
  343. data/lib/javascriptmvc/jquery/generate/templates/plugin/qunit.html.ejs +20 -0
  344. data/lib/javascriptmvc/jquery/generate/templates/plugin/resources/.ignore +0 -0
  345. data/lib/javascriptmvc/jquery/generate/templates/plugin/scripts.link +1 -0
  346. data/lib/javascriptmvc/jquery/generate/templates/plugin/test.link +1 -0
  347. data/lib/javascriptmvc/jquery/generate/templates/plugin/views/.ignore +0 -0
  348. data/lib/javascriptmvc/jquery/generate/templates/scaffold/controllers/(underscore)_controller.js.ejs +96 -0
  349. data/lib/javascriptmvc/jquery/generate/templates/scaffold/fixtures/(plural).json.get.ejs +3 -0
  350. data/lib/javascriptmvc/jquery/generate/templates/scaffold/models/(underscore).js.ejs +83 -0
  351. data/lib/javascriptmvc/jquery/generate/templates/scaffold/test/funcunit/(underscore)_controller_test.js.ejs +63 -0
  352. data/lib/javascriptmvc/jquery/generate/templates/scaffold/test/qunit/(underscore)_test.js.ejs +45 -0
  353. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/edit.ejs.ejs +10 -0
  354. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/init.ejs.ejs +26 -0
  355. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/list.ejs.ejs +5 -0
  356. data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/show.ejs.ejs +10 -0
  357. data/lib/javascriptmvc/jquery/jquery.js +6360 -0
  358. data/lib/javascriptmvc/jquery/lang/json/json.html +25 -0
  359. data/lib/javascriptmvc/jquery/lang/json/json.js +201 -0
  360. data/lib/javascriptmvc/jquery/lang/json/scripts/compress.js +6 -0
  361. data/lib/javascriptmvc/jquery/lang/json/scripts/doc.js +6 -0
  362. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/funcunit.html +21 -0
  363. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/funcunit.js +3 -0
  364. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/json_test.js +11 -0
  365. data/lib/javascriptmvc/jquery/lang/json/test/funcunit/run.js +10 -0
  366. data/lib/javascriptmvc/jquery/lang/json/test/qunit/json_test.js +4 -0
  367. data/lib/javascriptmvc/jquery/lang/json/test/qunit/qunit.html +21 -0
  368. data/lib/javascriptmvc/jquery/lang/json/test/qunit/qunit.js +9 -0
  369. data/lib/javascriptmvc/jquery/lang/json/test/qunit/run.js +2 -0
  370. data/lib/javascriptmvc/jquery/lang/lang.html +27 -0
  371. data/lib/javascriptmvc/jquery/lang/lang.js +104 -0
  372. data/lib/javascriptmvc/jquery/lang/openajax/openajax.js +202 -0
  373. data/lib/javascriptmvc/jquery/lang/rsplit/rsplit.js +31 -0
  374. data/lib/javascriptmvc/jquery/lang/vector/vector.js +167 -0
  375. data/lib/javascriptmvc/jquery/model/associations/associations.html +25 -0
  376. data/lib/javascriptmvc/jquery/model/associations/associations.js +46 -0
  377. data/lib/javascriptmvc/jquery/model/associations/qunit.html +21 -0
  378. data/lib/javascriptmvc/jquery/model/associations/test/qunit/associations_test.js +51 -0
  379. data/lib/javascriptmvc/jquery/model/associations/test/qunit/qunit.js +9 -0
  380. data/lib/javascriptmvc/jquery/model/associations/test/qunit/run.js +2 -0
  381. data/lib/javascriptmvc/jquery/model/backup/backup.js +82 -0
  382. data/lib/javascriptmvc/jquery/model/json_rest/json_rest.js +91 -0
  383. data/lib/javascriptmvc/jquery/model/list/list.js +148 -0
  384. data/lib/javascriptmvc/jquery/model/list/qunit.html +16 -0
  385. data/lib/javascriptmvc/jquery/model/list/test/qunit/list_test.js +58 -0
  386. data/lib/javascriptmvc/jquery/model/list/test/qunit/qunit.js +6 -0
  387. data/lib/javascriptmvc/jquery/model/list/test/qunit/run.js +0 -0
  388. data/lib/javascriptmvc/jquery/model/model.js +537 -0
  389. data/lib/javascriptmvc/jquery/model/qunit.html +17 -0
  390. data/lib/javascriptmvc/jquery/model/store/store.js +66 -0
  391. data/lib/javascriptmvc/jquery/model/test/qunit/model_test.js +71 -0
  392. data/lib/javascriptmvc/jquery/model/test/qunit/qunit.js +5 -0
  393. data/lib/javascriptmvc/jquery/qunit.html +15 -0
  394. data/lib/javascriptmvc/jquery/test/funcunit/funcunit.html +21 -0
  395. data/lib/javascriptmvc/jquery/test/funcunit/funcunit.js +3 -0
  396. data/lib/javascriptmvc/jquery/test/funcunit/jquerytest_test.js +11 -0
  397. data/lib/javascriptmvc/jquery/test/funcunit/run.js +10 -0
  398. data/lib/javascriptmvc/jquery/test/qunit/qunit.js +22 -0
  399. data/lib/javascriptmvc/jquery/update +5 -0
  400. data/lib/javascriptmvc/jquery/view/compress.js +7 -0
  401. data/lib/javascriptmvc/jquery/view/ejs/ejs.html +25 -0
  402. data/lib/javascriptmvc/jquery/view/ejs/ejs.js +489 -0
  403. data/lib/javascriptmvc/jquery/view/ejs/funcunit.html +21 -0
  404. data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/ejs_test.js +11 -0
  405. data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/funcunit.js +3 -0
  406. data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/run.js +10 -0
  407. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/ejs_test.js +4 -0
  408. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/qunit.html +21 -0
  409. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/qunit.js +9 -0
  410. data/lib/javascriptmvc/jquery/view/ejs/test/qunit/run.js +2 -0
  411. data/lib/javascriptmvc/jquery/view/fulljslint.js +3774 -0
  412. data/lib/javascriptmvc/jquery/view/helpers/helpers.js +338 -0
  413. data/lib/javascriptmvc/jquery/view/jaml/compress.js +7 -0
  414. data/lib/javascriptmvc/jquery/view/jaml/funcunit.html +21 -0
  415. data/lib/javascriptmvc/jquery/view/jaml/jaml.html +25 -0
  416. data/lib/javascriptmvc/jquery/view/jaml/jaml.js +73 -0
  417. data/lib/javascriptmvc/jquery/view/jaml/node.js +149 -0
  418. data/lib/javascriptmvc/jquery/view/jaml/template.js +131 -0
  419. data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/funcunit.js +3 -0
  420. data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/jaml_test.js +11 -0
  421. data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/run.js +10 -0
  422. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/jaml_test.js +4 -0
  423. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/qunit.html +21 -0
  424. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/qunit.js +9 -0
  425. data/lib/javascriptmvc/jquery/view/jaml/test/qunit/run.js +2 -0
  426. data/lib/javascriptmvc/jquery/view/micro/compress.js +7 -0
  427. data/lib/javascriptmvc/jquery/view/micro/funcunit.html +21 -0
  428. data/lib/javascriptmvc/jquery/view/micro/micro.html +25 -0
  429. data/lib/javascriptmvc/jquery/view/micro/micro.js +57 -0
  430. data/lib/javascriptmvc/jquery/view/micro/test/funcunit/funcunit.js +3 -0
  431. data/lib/javascriptmvc/jquery/view/micro/test/funcunit/micro_test.js +11 -0
  432. data/lib/javascriptmvc/jquery/view/micro/test/funcunit/run.js +10 -0
  433. data/lib/javascriptmvc/jquery/view/micro/test/qunit/micro_test.js +4 -0
  434. data/lib/javascriptmvc/jquery/view/micro/test/qunit/qunit.html +21 -0
  435. data/lib/javascriptmvc/jquery/view/micro/test/qunit/qunit.js +9 -0
  436. data/lib/javascriptmvc/jquery/view/micro/test/qunit/run.js +2 -0
  437. data/lib/javascriptmvc/jquery/view/qunit.html +16 -0
  438. data/lib/javascriptmvc/jquery/view/test/compression/compression.html +12 -0
  439. data/lib/javascriptmvc/jquery/view/test/compression/compression.js +11 -0
  440. data/lib/javascriptmvc/jquery/view/test/compression/run.js +36 -0
  441. data/lib/javascriptmvc/jquery/view/test/funcunit/funcunit.js +3 -0
  442. data/lib/javascriptmvc/jquery/view/test/funcunit/run.js +10 -0
  443. data/lib/javascriptmvc/jquery/view/test/funcunit/view_test.js +11 -0
  444. data/lib/javascriptmvc/jquery/view/test/qunit/nested_plugin.ejs +1 -0
  445. data/lib/javascriptmvc/jquery/view/test/qunit/plugin.ejs +1 -0
  446. data/lib/javascriptmvc/jquery/view/test/qunit/qunit.js +9 -0
  447. data/lib/javascriptmvc/jquery/view/test/qunit/template.ejs +1 -0
  448. data/lib/javascriptmvc/jquery/view/test/qunit/template.jaml +3 -0
  449. data/lib/javascriptmvc/jquery/view/test/qunit/template.micro +1 -0
  450. data/lib/javascriptmvc/jquery/view/test/qunit/template.tmpl +1 -0
  451. data/lib/javascriptmvc/jquery/view/test/qunit/view_test.js +24 -0
  452. data/lib/javascriptmvc/jquery/view/tmpl/tmpl.js +150 -0
  453. data/lib/javascriptmvc/jquery/view/view.html +65 -0
  454. data/lib/javascriptmvc/jquery/view/view.js +296 -0
  455. data/lib/javascriptmvc/js +56 -0
  456. data/lib/javascriptmvc/js.bat +57 -0
  457. data/lib/javascriptmvc/steal/README +26 -0
  458. data/lib/javascriptmvc/steal/build/apps/apps.js +208 -0
  459. data/lib/javascriptmvc/steal/build/apps/test.js +4 -0
  460. data/lib/javascriptmvc/steal/build/build.js +281 -0
  461. data/lib/javascriptmvc/steal/build/pluginify.js +73 -0
  462. data/lib/javascriptmvc/steal/build/scripts/compiler.jar +0 -0
  463. data/lib/javascriptmvc/steal/build/scripts/scripts.js +155 -0
  464. data/lib/javascriptmvc/steal/build/styles/cssmin.js +17 -0
  465. data/lib/javascriptmvc/steal/build/styles/styles.js +84 -0
  466. data/lib/javascriptmvc/steal/build/test/basicpage.html +6 -0
  467. data/lib/javascriptmvc/steal/build/test/basicproduction.js +1 -0
  468. data/lib/javascriptmvc/steal/build/test/basicsource.js +6 -0
  469. data/lib/javascriptmvc/steal/build/test/css/css/css1.css +1 -0
  470. data/lib/javascriptmvc/steal/build/test/css/css/justin.png +0 -0
  471. data/lib/javascriptmvc/steal/build/test/css/css2.css +5 -0
  472. data/lib/javascriptmvc/steal/build/test/css/page.html +9 -0
  473. data/lib/javascriptmvc/steal/build/test/css/production.css +1 -0
  474. data/lib/javascriptmvc/steal/build/test/css/test.js +7 -0
  475. data/lib/javascriptmvc/steal/build/test/css/upload.PNG +0 -0
  476. data/lib/javascriptmvc/steal/build/test/foreign.html +6 -0
  477. data/lib/javascriptmvc/steal/build/test/foreign.js +2 -0
  478. data/lib/javascriptmvc/steal/build/test/removecode.js +11 -0
  479. data/lib/javascriptmvc/steal/build/test/run.js +57 -0
  480. data/lib/javascriptmvc/steal/build/test/stealpage.html +10 -0
  481. data/lib/javascriptmvc/steal/build/test/stealprodpage.html +10 -0
  482. data/lib/javascriptmvc/steal/build/test/test.js +3 -0
  483. data/lib/javascriptmvc/steal/buildjs +21 -0
  484. data/lib/javascriptmvc/steal/clean/beautify.js +1108 -0
  485. data/lib/javascriptmvc/steal/clean/clean.js +179 -0
  486. data/lib/javascriptmvc/steal/clean/jslint.js +5662 -0
  487. data/lib/javascriptmvc/steal/clean/test.js +7 -0
  488. data/lib/javascriptmvc/steal/cleanjs +5 -0
  489. data/lib/javascriptmvc/steal/coffee/coffee-script.js +9 -0
  490. data/lib/javascriptmvc/steal/coffee/coffee.js +56 -0
  491. data/lib/javascriptmvc/steal/dev/dev.js +83 -0
  492. data/lib/javascriptmvc/steal/end.js +1 -0
  493. data/lib/javascriptmvc/steal/generate/app +23 -0
  494. data/lib/javascriptmvc/steal/generate/ejs.js +470 -0
  495. data/lib/javascriptmvc/steal/generate/generate.js +211 -0
  496. data/lib/javascriptmvc/steal/generate/inflector.js +117 -0
  497. data/lib/javascriptmvc/steal/generate/system.js +33 -0
  498. data/lib/javascriptmvc/steal/generate/templates/app/(application_name).css.ejs +10 -0
  499. data/lib/javascriptmvc/steal/generate/templates/app/(application_name).html.ejs +18 -0
  500. data/lib/javascriptmvc/steal/generate/templates/app/(application_name).js.ejs +10 -0
  501. data/lib/javascriptmvc/steal/generate/templates/app/docs/.ignore +0 -0
  502. data/lib/javascriptmvc/steal/generate/templates/app/resources/.ignore +0 -0
  503. data/lib/javascriptmvc/steal/generate/templates/app/resources/example.coffee.ejs +5 -0
  504. data/lib/javascriptmvc/steal/generate/templates/app/resources/example.js.ejs +13 -0
  505. data/lib/javascriptmvc/steal/generate/templates/app/resources/example.less.ejs +9 -0
  506. data/lib/javascriptmvc/steal/generate/templates/app/scripts/build.js.ejs +6 -0
  507. data/lib/javascriptmvc/steal/generate/templates/app/scripts/clean.js.ejs +6 -0
  508. data/lib/javascriptmvc/steal/generate/templates/app/test/.ignore +0 -0
  509. data/lib/javascriptmvc/steal/generate/templates/page.ejs +23 -0
  510. data/lib/javascriptmvc/steal/generate/test/test.js +92 -0
  511. data/lib/javascriptmvc/steal/get/get.js +163 -0
  512. data/lib/javascriptmvc/steal/get/gets.json +10 -0
  513. data/lib/javascriptmvc/steal/get/getter.js +115 -0
  514. data/lib/javascriptmvc/steal/get/github.js +134 -0
  515. data/lib/javascriptmvc/steal/get/json.js +172 -0
  516. data/lib/javascriptmvc/steal/getjs +5 -0
  517. data/lib/javascriptmvc/steal/js +56 -0
  518. data/lib/javascriptmvc/steal/js.bat +57 -0
  519. data/lib/javascriptmvc/steal/less/less.js +117 -0
  520. data/lib/javascriptmvc/steal/less/less_engine.js +2529 -0
  521. data/lib/javascriptmvc/steal/rhino/blank.html +6 -0
  522. data/lib/javascriptmvc/steal/rhino/build.js +31 -0
  523. data/lib/javascriptmvc/steal/rhino/docs.js +68 -0
  524. data/lib/javascriptmvc/steal/rhino/empty.html +12 -0
  525. data/lib/javascriptmvc/steal/rhino/env.js +11537 -0
  526. data/lib/javascriptmvc/steal/rhino/file.js +299 -0
  527. data/lib/javascriptmvc/steal/rhino/js.jar +0 -0
  528. data/lib/javascriptmvc/steal/rhino/loader.js +8 -0
  529. data/lib/javascriptmvc/steal/rhino/prompt.js +49 -0
  530. data/lib/javascriptmvc/steal/rhino/steal.js +122 -0
  531. data/lib/javascriptmvc/steal/rhino/test.js +16 -0
  532. data/lib/javascriptmvc/steal/steal.js +1317 -0
  533. data/lib/javascriptmvc/steal/steal.production.js +23 -0
  534. data/lib/javascriptmvc/steal/test/absoluteurl.html +7 -0
  535. data/lib/javascriptmvc/steal/test/absoluteurl/absoluteurl.js +1 -0
  536. data/lib/javascriptmvc/steal/test/absoluteurl/alert.js +1 -0
  537. data/lib/javascriptmvc/steal/test/another/two.js +2 -0
  538. data/lib/javascriptmvc/steal/test/one/four.js +1 -0
  539. data/lib/javascriptmvc/steal/test/one/one.js +6 -0
  540. data/lib/javascriptmvc/steal/test/qunit/qunit.html +22 -0
  541. data/lib/javascriptmvc/steal/test/qunit/qunit.js +3 -0
  542. data/lib/javascriptmvc/steal/test/qunit/steal_test.js +197 -0
  543. data/lib/javascriptmvc/steal/test/run.js +12 -0
  544. data/lib/javascriptmvc/steal/test/steal.html +37 -0
  545. data/lib/javascriptmvc/steal/test/test.js +82 -0
  546. data/lib/javascriptmvc/steal/test/three.js +3 -0
  547. data/lib/javascriptmvc/steal/testing/test.html +20 -0
  548. data/lib/javascriptmvc/steal/testing/testing.js +48 -0
  549. data/lib/javascriptmvc/steal/update +5 -0
  550. metadata +622 -0
@@ -0,0 +1,16 @@
1
+ load('steal/rhino/steal.js')
2
+ steal('//steal/test/test', function(s){
3
+
4
+ //test options
5
+ var res = s.opts("-n abc def -other foo",{
6
+ name : {
7
+ shortcut : "-n",
8
+ args: ["first","second"]
9
+ },
10
+ other : 1
11
+ })
12
+
13
+ s.test.ok(res.name)
14
+ s.test.ok(res.name[0] == "abc")
15
+ s.test.ok(res.name[1] == "def")
16
+ })
@@ -0,0 +1,1317 @@
1
+ /*
2
+ * JavaScriptMVC - steal.js
3
+ * (c) 2010 Jupiter JavaScript Consulting
4
+ *
5
+ * steal provides dependency management
6
+ * steal('path/to/file').then(function(){
7
+ * //do stuff with file
8
+ * })
9
+ */
10
+
11
+ /*jslint evil: true */
12
+ /*global steal: true, window: false */
13
+ //put everything in function to keep space clean
14
+ (function() {
15
+
16
+ if ( typeof steal != 'undefined' && steal.nodeType ) {
17
+ throw ("steal is defined an element's id!");
18
+ }
19
+
20
+ // HELPERS (if you are trying to understand steal, skip this part)
21
+ // keep a reference to the old steal
22
+ var oldsteal = window.steal,
23
+ // returns the document head (creates one if necessary)
24
+ head = function() {
25
+ var d = document,
26
+ de = d.documentElement,
27
+ heads = d.getElementsByTagName("head");
28
+ if ( heads.length > 0 ) {
29
+ return heads[0];
30
+ }
31
+ var head = d.createElement('head');
32
+ de.insertBefore(head, de.firstChild);
33
+ return head;
34
+ },
35
+ // creates a script tag
36
+ scriptTag = function() {
37
+ var start = document.createElement('script');
38
+ start.type = 'text/javascript';
39
+ return start;
40
+ },
41
+ extend = function( d, s ) {
42
+ for ( var p in s ) {
43
+ d[p] = s[p];
44
+ }
45
+ return d;
46
+ },
47
+ getLastPart = function( p ) {
48
+ return p.match(/[^\/]+$/)[0];
49
+ },
50
+ browser = {
51
+ msie: !! (window.attachEvent && !window.opera),
52
+ opera: !! window.opera,
53
+ safari: navigator.userAgent.indexOf('AppleWebKit/') > -1,
54
+ firefox: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
55
+ mobilesafari: !! navigator.userAgent.match(/Apple.*Mobile.*Safari/),
56
+ rhino: navigator.userAgent.match(/Rhino/) && true
57
+ },
58
+ factory = function() {
59
+ return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
60
+ },
61
+ // writes a steal to the page in a way that steal.end gets called after the script gets run
62
+ insert = function( options ) {
63
+ // source we need to know how to get to steal, then load
64
+ // relative to path to steal
65
+ options = extend({
66
+ id: options.src && steal.cleanId(options.src)
67
+ }, options);
68
+
69
+ var text = "",
70
+ scriptTag = '<script ',
71
+ bodyText;
72
+ if ( options.src ) {
73
+ var src_file = steal.File(options.src);
74
+ if (!src_file.isLocalAbsolute() && !src_file.protocol() ) {
75
+ options.src = steal.root.join(options.src);
76
+ }
77
+ }
78
+
79
+
80
+ if ( options.type && options.process ) {
81
+ text = steal.request(options.src);
82
+ if (!text ) {
83
+ throw "steal.js there is nothing at " + options.src;
84
+ }
85
+ bodyText = options.process(text);
86
+ options.type = 'text/javascript';
87
+ delete options.process;
88
+ delete options.src;
89
+
90
+ } else if ( options.type && options.type != 'text/javascript' && !browser.rhino ) {
91
+ text = steal.request(options.src);
92
+ if (!text ) {
93
+ throw "steal.js there is nothing at " + options.src;
94
+ }
95
+ options.text = text;
96
+ delete options.src;
97
+ }
98
+
99
+ for ( var attr in options ) {
100
+ scriptTag += attr + "='" + options[attr] + "' ";
101
+ }
102
+ if ( steal.support.load && !steal.browser.rhino && !bodyText ) {
103
+ scriptTag += steal.loadErrorTimer(options);
104
+ }
105
+ scriptTag += '>' + (bodyText || '') + '</script>';
106
+ if ( steal.support.load ) {
107
+ scriptTag += '<script type="text/javascript"' + '>steal.end()</script>';
108
+ }
109
+ else {
110
+ scriptTag += '<script type="text/javascript" src="' + steal.root.join('steal/end.js') + '"></script>';
111
+ }
112
+ document.write((options.src || bodyText ? scriptTag : ''));
113
+ };
114
+
115
+ /**
116
+ * @constructor steal
117
+ * @parent stealjs
118
+ * <p>Steal makes JavaScript dependency management and resource loading easy.</p>
119
+ * <p>This page details the steal script (<code>steal/steal.js</code>),
120
+ * and steal function which are used to load files into your page.
121
+ * For documentation of other Steal projects, read [stealjs StealJS].</p>
122
+ * <h3>Quick Overview</h3>
123
+ *
124
+ * <p>To start using steal, add the steal script to your page, and tell it the first
125
+ * file to load:</p>
126
+ * </p>
127
+ * @codestart html
128
+ *&lt;script type='text/javascript'
129
+ * src='public/steal/steal.js?<u><b>myapp/myapp.js</b></u>'>&lt;/script>
130
+ * @codeend
131
+ *
132
+ * <p>In the file (<code>public/myapp/myapp.js</code>),
133
+ * 'steal' all other files that you need like:</p>
134
+ * @codestart
135
+ * steal("anotherFile") //loads myapp/anotherFiles.js
136
+ * .css('style') // myapp/style.css
137
+ * .plugins('jquery/view', // jquery/view/view.js
138
+ * 'steal/less') // steal/less/less.js
139
+ * .then(function(){ //called when all prior files have completed
140
+ * steal.less('myapp') //loads myapp/myapp.less
141
+ * })
142
+ * .views('//myapp/show.ejs') //loads myapp/show.ejs
143
+ * @codeend
144
+ * <p>Finally compress your page's JavaScript and CSS with:</p>
145
+ * @codestart
146
+ * > js steal/buildjs path/to/mypage.html
147
+ * @codeend
148
+ * <h2>Use</h2>
149
+ * Use of steal.js is broken into 5 parts:
150
+ * <ul>
151
+ * <li>Loading steal.js </li>
152
+ * <li>Loading your 'application' file.</li>
153
+ * <li>"Stealing" scripts</li>
154
+ * <li>Building (Concatenating+Compressing) the app</li>
155
+ * <li>Switching to the production build</li>
156
+ * </ul>
157
+ *
158
+ *
159
+ * <h3>Loading <code>steal.js</code></h3>
160
+ * <p>First, you need to [download download JavaScriptMVC] (or steal standalone) and unzip it into a
161
+ * public folder on your server. For this example, lets assume you have the steal script in
162
+ * <code>public/steal/steal.js</code>.
163
+ * </p>
164
+ * <p>Next, you need to load the <code>steal.js</code> script in your html page. We suggest
165
+ * [http://developer.yahoo.com/performance/rules.html#js_bottom bottom loading] your scripts.
166
+ * For example, if your page is in <code>pages/myapp.html</code>, you can get steal like:
167
+ * </p>
168
+ * @codestart html
169
+ * &lt;script type='text/javascript'
170
+ * src='../public/steal/steal.js'>
171
+ * &lt;/script>
172
+ * @codeend
173
+ * <h3>Loading your 'application' file</h3>
174
+ * <p>The first file your application loads
175
+ * is referred to as an "application" file. It loads all the files and resources
176
+ * that your application needs. For this example, we'll put our application file in:
177
+ * <code>public/myapp/myapp.js</code>
178
+ * </p>
179
+ * <p>You have to tell steal where to find it by configuring [steal.static.options].
180
+ * There are a lot of ways to configure steal to load your app file, but we've made it really easy:</p>
181
+ * @codestart html
182
+ * &lt;script type='text/javascript'
183
+ * src='../public/steal/steal.js?<u><b>myapp/myapp.js</b></u>'>
184
+ * &lt;/script>
185
+ * @codeend
186
+ * This sets ...
187
+ * @codestart
188
+ * steal.options.startFile = 'myapp/myapp.js'
189
+ * @codeend
190
+ *
191
+ * ... and results in steal loading
192
+ * <code>public/myapp/myapp.js</code>.</p>
193
+ *
194
+ * <div class='whisper'>
195
+ * TIP: If startFile doesn't end with <code>.js</code> (ex: myapp), steal assumes
196
+ * you are using JavaScriptMVC's folder pattern and will load:
197
+ * <code>myapp/myapp.js<code> just to save you 9 characters.
198
+ * </div>
199
+ * <h3>Stealing Scripts</h3>
200
+ * In your files, use the steal function and its helpers
201
+ * to load dependencies then describe your functionality.
202
+ * Typically, most of the 'stealing' is done in your application file. Loading
203
+ * jQuery and jQuery.UI from google, a local helpers.js
204
+ * and then adding tabs might look something like this:
205
+ * @codestart
206
+ * steal( 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js',
207
+ * 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.js',
208
+ * 'helpers')
209
+ * .then( function(){
210
+ * $('#tabs').tabs();
211
+ * });
212
+ * @codeend
213
+ * There's a few things to notice:
214
+ * <ul>
215
+ * <li>the steal function can take multiple arguments. Each argument
216
+ * can be a string, object, or function. Learn more about what can be passed to
217
+ * steal in the [steal.prototype.init] documentation.
218
+ *
219
+ * </li>
220
+ * <li>steal can load cross domain</li>
221
+ * <li>steal loads relative to the current file</li>
222
+ * <li>steal adds .js if not present</li>
223
+ * <li>steal is chainable (most function return steal)</li>
224
+ * </ul>
225
+ * <h3>Building the app</h3>
226
+ * <p>Building the app means combining and compressing your apps JavaScript and CSS into a single file.
227
+ * A lot more details can be found on building in the
228
+ * [steal.build steal.build documentation]. But, if you used JavaScriptMVC's app or plugin
229
+ * generator, you can build
230
+ * your app's JS and CSS with:
231
+ * <p>
232
+ * @codestart no-highlight
233
+ * js myapp\scripts\compress.js
234
+ * @codeend
235
+ * <p>Or if you are using steal without JavaScriptMVC:</p>
236
+ * @codestart no-highlight
237
+ * js steal/buildjs pages/myapp.html -to public/myapp
238
+ * @codeend
239
+ * <p>This creates <code>public/myapp/production.js</code> and <code>public/myapp/production.css</code>.
240
+ *
241
+ * <h3>Switching to the production build</h3>
242
+ * <p>To use the production files, load steal.production.js instead of steal.js in your html file:</p>
243
+ * @codestart html
244
+ * &lt;script type='text/javascript'
245
+ * src='../public/steal/<u><b>steal.production.js</b></u>?myapp/myapp.js'>
246
+ * &lt;/script>
247
+ * @codeend
248
+ * <h2>Steal helpers</h2>
249
+ * There are a number of steal helper functions that can be used to load files in a particular location
250
+ * or of a type other than JavaScript:
251
+ * <ul>
252
+ * <li>[steal.static.coffee] - loads
253
+ * [http://jashkenas.github.com/coffee-script/ CoffeeScript] scripts.</li>
254
+ * <li>[steal.static.controllers] - loads controllers relative to the current path.</li>
255
+ * <li>[steal.static.css] - loads a css file.</li>
256
+ * <li>[steal.static.less] - loads [http://lesscss.org/ Less] style sheets.</li>
257
+ * <li>[steal.static.models] - loads models relative to the current path.</li>
258
+ * <li>[steal.static.plugins] - loads JavaScript files relative to steal's root folder.</li>
259
+ * <li>[steal.static.resources] - loads a script in a relative resources folder.</li>
260
+ * <li>[steal.static.views] - loads a client side template to be compiled into the production build.</li>
261
+ * </ul>
262
+ *
263
+ * <h2>Script Load Order</h2>
264
+ * The load order for your scripts follows a consistent last-in first-out order across all browsers.
265
+ * This is the same way the following document.write would work in msie, Firefox, or Safari:
266
+ * @codestart
267
+ * document.write('&lt;script type="text/javascript" src="some_script.js"></script>')
268
+ * @codeend
269
+ * An example helps illustrate this.<br/>
270
+ * <img src='http://wiki.javascriptmvc.com/images/last_in_first_out.png'/>
271
+ * <table class="options">
272
+ * <tr class="top">
273
+ * <th>Load Order</th>
274
+ * <th class="right">File</th>
275
+ * </tr>
276
+ * <tbody>
277
+ * <tr>
278
+ * <td>1</td>
279
+ * <td class="right">1.js</td>
280
+ * </tr>
281
+ * <tr>
282
+ * <td>2</td>
283
+ * <td class="right">3.js</td>
284
+ * </tr>
285
+ * <tr>
286
+ * <td>3</td>
287
+ * <td class="right">4.js</td>
288
+ * </tr>
289
+ * <tr>
290
+ * <td>4</td>
291
+ * <td class="right">2.js</td>
292
+ * </tr>
293
+ * <tr>
294
+ * <td>5</td>
295
+ * <td class="right">5.js</td>
296
+ * </tr>
297
+ * <tr class="bottom">
298
+ * <td>6</td>
299
+ * <td class="right">6.js</td>
300
+ * </tr>
301
+ * </tbody></table>
302
+ * @init
303
+ * Loads files or runs functions after all previous files and functions have been loaded.
304
+ * @param {String|Object|Function+} resource Each argument represents a resource or function.
305
+ * Arguments can be a String, Option, or Function.
306
+ * <table class='options'>
307
+ * <tr>
308
+ * <th>Type</th><th>Description</th>
309
+ * </tr>
310
+ * <tr><td>String</td>
311
+ * <td>A path to a JavaScript file. The path can optionally end in '.js'.<br/>
312
+ * Paths are typically assumed to be relative to the current JavaScript file. But paths, that start
313
+ * with:
314
+ * <ul>
315
+ * <li><code>http(s)://</code> are absolutely referenced.</li>
316
+ * <li><code>/</code> are referenced from the current domain.</li>
317
+ * <li><code>//</code> are referenced from the ROOT folder.</li>
318
+ *
319
+ * </td></tr>
320
+ * <tr><td>Object</td>
321
+ * <td>An Object with the following properties:
322
+ * <ul>
323
+ * <li>path {String} - relative path to a JavaScript file. </li>
324
+ * <li>type {optional:String} - Script type (defaults to text/javascript)</li>
325
+ * <li>skipInsert {optional:Boolean} - Include not added as script tag</li>
326
+ * <li>compress {optional:String} - "false" if you don't want to compress script</li>
327
+ * <li>package {optional:String} - Script package name (defaults to production.js)</li>
328
+ * </ul>
329
+ * </td></tr>
330
+ * <tr><td>Function</td><td>A function to run after all the prior steals have finished loading</td></tr>
331
+ * </table>
332
+ * @return {steal} returns itself for chaining.
333
+ */
334
+ steal = function() {
335
+ for ( var i = 0; i < arguments.length; i++ ) {
336
+ steal.add(new steal.fn.init(arguments[i]));
337
+ }
338
+ return steal;
339
+ };
340
+
341
+ (function() {
342
+ var eventSupported = function( eventName, tag ) {
343
+ var el = document.createElement(tag);
344
+ eventName = "on" + eventName;
345
+
346
+ var isSupported = (eventName in el);
347
+ if (!isSupported ) {
348
+ el.setAttribute(eventName, "return;");
349
+ isSupported = typeof el[eventName] === "function";
350
+ }
351
+ el = null;
352
+ return isSupported;
353
+ };
354
+ steal.support = {
355
+ load: eventSupported("load", "script"),
356
+ readystatechange: eventSupported("readystatechange", "script"),
357
+ error: eventSupported("readystatechange", "script")
358
+ };
359
+ })();
360
+
361
+
362
+ steal.fn = steal.prototype = {
363
+ // sets up a steal instance and records the current path, etc
364
+ init: function( options ) {
365
+ if ( typeof options == 'function' ) {
366
+ var path = steal.getCurrent();
367
+ this.path = path;
368
+ this.func = function() {
369
+ steal.curDir(path);
370
+ options(steal.send || window.jQuery || steal); //should return what was steald before 'then'
371
+ };
372
+ this.options = options;
373
+ return;
374
+ }
375
+ if ( typeof options == 'string' ) {
376
+ if (/\.js$/i.test(options) ) {
377
+ options = {
378
+ path: options
379
+ };
380
+ } else {
381
+ options = {
382
+ path: options + '.js'
383
+ };
384
+ }
385
+ }
386
+ extend(this, options);
387
+
388
+ this.options = options; //TODO: needed?
389
+ this.originalPath = this.path;
390
+
391
+ //get actual path
392
+ var pathFile = steal.File(this.path);
393
+
394
+ this.path = pathFile.normalize();
395
+ if ( this.originalPath.match(/^\/\//) ) {
396
+ this.absolute = steal.root.join(this.originalPath.substr(2));
397
+ }
398
+ else {
399
+ this.absolute = pathFile.relative() ? pathFile.joinFrom(steal.getAbsolutePath(), true) : this.path;
400
+ }
401
+
402
+ this.dir = steal.File(this.path).dir();
403
+ },
404
+ /**
405
+ * Adds a script tag to the dom, loading and running the steal's JavaScript file.
406
+ * @hide
407
+ */
408
+ run: function() {
409
+ //set next to current so other includes will be added to it
410
+ steal.cur(this);
411
+ //only load if actually pulled, this helps us mark only once
412
+ this.dependencies = [];
413
+ var isProduction = (steal.options.env == "production"),
414
+ options = extend({
415
+ type: "text/javascript",
416
+ compress: "true",
417
+ "package": "production.js"
418
+ }, extend({
419
+ src: this.path
420
+ }, this.options));
421
+
422
+ if ( this.func ) {
423
+ //console.log("run FUNCTION")
424
+ //run function and continue to next steald
425
+ this.func();
426
+ steal.end();
427
+ } else if (!isProduction || this.force ) { //force is for packaging
428
+ //console.log("run INSERT",this.path)
429
+ if ( this.type ) {
430
+ insert(options);
431
+ } else {
432
+ steal.curDir(this.path);
433
+ insert(this.skipInsert ? undefined : options);
434
+ }
435
+ } else {
436
+ //console.log("run VIRTUAL ",this.path)
437
+ if (!this.type ) {
438
+ steal.curDir(this.path);
439
+ }
440
+ }
441
+
442
+ },
443
+ /**
444
+ * Loads the steal code immediately. This is typically used after DOM has loaded.
445
+ * @hide
446
+ */
447
+ runNow: function() {
448
+ steal.curDir(this.path);
449
+
450
+ return browser.rhino ? load(this.path) : steal.insertHead(steal.root.join(this.path));
451
+ }
452
+
453
+ };
454
+ steal.fn.init.prototype = steal.fn;
455
+ //where the root steal folder is
456
+ steal.root = null;
457
+ //where the page is
458
+ steal.pageDir = null;
459
+ //provide extend to others
460
+ steal.extend = extend;
461
+ //save a reference to the browser
462
+ steal.browser = browser;
463
+
464
+
465
+ /**
466
+ * @Constructor
467
+ * Used for getting information out of a path
468
+ * @init
469
+ * Takes a path
470
+ * @param {String} path
471
+ */
472
+ steal.File = function( path ) {
473
+ if ( this.constructor != steal.File ) {
474
+ return new steal.File(path);
475
+ }
476
+ this.path = path;
477
+ };
478
+ var File = steal.File;
479
+ extend(File.prototype, /* @prototype */ {
480
+ /**
481
+ * Removes hash and params
482
+ * @return {String}
483
+ */
484
+ clean: function() {
485
+ return this.path.match(/([^\?#]*)/)[1];
486
+ },
487
+ /**
488
+ * Returns everything before the last /
489
+ */
490
+ dir: function() {
491
+ var last = this.clean().lastIndexOf('/'),
492
+ dir = (last != -1) ? this.clean().substring(0, last) : '',
493
+ parts = dir !== '' && dir.match(/^(https?:\/|file:\/)$/);
494
+ return parts && parts[1] ? this.clean() : dir;
495
+ },
496
+ /**
497
+ * Returns the domain for the current path.
498
+ * Returns null if the domain is a file.
499
+ */
500
+ domain: function() {
501
+ if ( this.path.indexOf('file:') === 0 ) {
502
+ return null;
503
+ }
504
+ var http = this.path.match(/^(?:https?:\/\/)([^\/]*)/);
505
+ return http ? http[1] : null;
506
+ },
507
+ /**
508
+ * Joins url onto path
509
+ * @param {String} url
510
+ */
511
+ join: function( url ) {
512
+ return File(url).joinFrom(this.path);
513
+ },
514
+ /**
515
+ * Returns the path of this file referenced from another url or path.
516
+ * @codestart
517
+ * new steal.File('a/b.c').joinFrom('/d/e')//-> /d/e/a/b.c
518
+ * @codeend
519
+ * @param {String} url
520
+ * @param {Boolean} expand if the path should be expanded
521
+ * @return {String}
522
+ */
523
+ joinFrom: function( url, expand ) {
524
+ var u = File(url);
525
+ if ( this.protocol() ) { //if we are absolutely referenced
526
+ //try to shorten the path as much as possible:
527
+ if ( this.domain() && this.domain() == u.domain() ) {
528
+ return this.afterDomain();
529
+ }
530
+ else if ( this.domain() == u.domain() ) { // we are from a file
531
+ return this.toReferenceFromSameDomain(url);
532
+ } else {
533
+ return this.path;
534
+ }
535
+
536
+ } else if ( url == steal.pageDir && !expand ) {
537
+
538
+ return this.path;
539
+
540
+ } else if ( this.isLocalAbsolute() ) { // we are a path like /page.js
541
+ if (!u.domain() ) {
542
+ return this.path;
543
+ }
544
+
545
+ return u.protocol() + "//" + u.domain() + this.path;
546
+
547
+ }
548
+ else { //we have 2 relative paths, remove folders with every ../
549
+ if ( url === '' ) {
550
+ return this.path.replace(/\/$/, '');
551
+ }
552
+ var urls = url.split('/'),
553
+ paths = this.path.split('/'),
554
+ path = paths[0];
555
+
556
+ if ( url.match(/\/$/) ) {
557
+ urls.pop();
558
+ }
559
+
560
+ while ( path == '..' && paths.length > 0 ) {
561
+ paths.shift();
562
+ urls.pop();
563
+ path = paths[0];
564
+ }
565
+ return urls.concat(paths).join('/');
566
+ }
567
+ },
568
+ /**
569
+ * Joins the file to the current working directory.
570
+ */
571
+ joinCurrent: function() {
572
+ return this.joinFrom(steal.curDir());
573
+ },
574
+ /**
575
+ * Returns true if the file is relative
576
+ */
577
+ relative: function() {
578
+ return this.path.match(/^(https?:|file:|\/)/) === null;
579
+ },
580
+ /**
581
+ * Returns the part of the path that is after the domain part
582
+ */
583
+ afterDomain: function() {
584
+ return this.path.match(/https?:\/\/[^\/]*(.*)/)[1];
585
+ },
586
+ /**
587
+ * Returns the relative path between two paths with common folders.
588
+ * @codestart
589
+ * new steal.File('a/b/c/x/y').toReferenceFromSameDomain('a/b/c/d/e')//-> ../../x/y
590
+ * @codeend
591
+ * @param {Object} url
592
+ * @return {String}
593
+ */
594
+ toReferenceFromSameDomain: function( url ) {
595
+ var parts = this.path.split('/'),
596
+ other_parts = url.split('/'),
597
+ result = '';
598
+ while ( parts.length > 0 && other_parts.length > 0 && parts[0] == other_parts[0] ) {
599
+ parts.shift();
600
+ other_parts.shift();
601
+ }
602
+ for ( var i = 0; i < other_parts.length; i++ ) {
603
+ result += '../';
604
+ }
605
+ return result + parts.join('/');
606
+ },
607
+ /**
608
+ * Is the file on the same domain as our page.
609
+ */
610
+ isCrossDomain: function() {
611
+ return this.isLocalAbsolute() ? false : this.domain() != File(window.location.href).domain();
612
+ },
613
+ isLocalAbsolute: function() {
614
+ return this.path.indexOf('/') === 0;
615
+ },
616
+ protocol: function() {
617
+ var match = this.path.match(/^(https?:|file:)/);
618
+ return match && match[0];
619
+ },
620
+ /**
621
+ * For a given path, a given working directory, and file location, update the path so
622
+ * it points to a location relative to steal's root.
623
+ */
624
+ normalize: function() {
625
+
626
+ var current = steal.curDir(),
627
+ //if you are cross domain from the page, and providing a path that doesn't have an domain
628
+ path = this.path;
629
+
630
+ if (/^\/\//.test(this.path) ) { //if path is rooted from steal's root
631
+ path = this.path.substr(2);
632
+
633
+ } else if ( this.relative() || (steal.isCurrentCrossDomain() && //if current file is on another domain and
634
+ !this.protocol()) ) { //this file doesn't have a protocol
635
+ path = this.joinFrom(current);
636
+
637
+ }
638
+ return path;
639
+ }
640
+ });
641
+ /**
642
+ * @add steal
643
+ */
644
+ // break
645
+ /* @static */
646
+ //break
647
+ /**
648
+ * @attribute pageDir
649
+ * @hide
650
+ * The current page's folder's path.
651
+ */
652
+ steal.pageDir = File(window.location.href).dir();
653
+
654
+ //find steal
655
+ /**
656
+ * @attribute options
657
+ * Options that deal with steal
658
+ * <table class='options'>
659
+ * <tr>
660
+ * <th>Option</th><th>Default</th><th>Description</th>
661
+ * </tr>
662
+ * <tr><td>env</td><td>development</td><td>Which environment is currently running</td></tr>
663
+ * <tr><td>encoding</td><td>utf-8</td><td>What encoding to use for script loading</td></tr>
664
+ * <tr><td>cacheInclude</td><td>true</td><td>true if you want to let browser determine if it should cache script; false will always load script</td></tr>
665
+ * <tr><td>debug</td><td>true</td><td>turns on debug support</td></tr>
666
+ * <tr><td>done</td><td>null</td><td>If a function is present, calls function when all steals have been loaded</td></tr>
667
+ * <tr><td>documentLocation</td><td>null</td><td>If present, ajax request will reference this instead of the current window location.
668
+ * Set this in run_unit, to force unit tests to use a real server for ajax requests. </td></tr>
669
+ * <tr><td>startFile</td><td>null</td><td>This is the first file to load. It is typically determined from the first script option parameter
670
+ * in the inclue script. </td></tr>
671
+ * </table>
672
+ * <ul>
673
+ * <li><code>steal.options.startFile</code> - the first file steal loads. This file
674
+ * loads all other scripts needed by your application.</li>
675
+ * <li><code>steal.options.env</code> - the environment (development or production)
676
+ * that determines if steal loads your all your script files or a single
677
+ * compressed file.
678
+ * </li>
679
+ * </ul>
680
+ * <p><code>steal.options</code> can be configured by:</p>
681
+ * <ul>
682
+ * <li>The steal.js script tag in your page (most common pattern).</li>
683
+ * <li>An existing steal object in the window object</li>
684
+ * <li><code>window.location.hash</code></li>
685
+ * </ul>
686
+ * <p>
687
+ * The steal.js script tag is by far the most common approach.
688
+ * For the other methods,
689
+ * check out [steal.static.options] documentation.
690
+ * To load <code>myapp/myapp.js</code> in development mode, your
691
+ * script tag would look like:
692
+ * </p>
693
+ *
694
+ * @codestart
695
+ * &lt;script type='text/javascript'
696
+ * src='path/to/steal.js?<u><b>myapp/myapp.js</b></u>,<u><b>development</b></u>'>
697
+ * &lt;/script>
698
+ * @codeend
699
+ * <div class='whisper'>
700
+ * Typically you want this script tag right before the closing body tag (<code>&lt;/body></code>) of your page.
701
+ * </div>
702
+ * <p>Note that the path to <code>myapp/myapp.js</code>
703
+ * is relative to the 'steal' folder's parent folder. This
704
+ * is typically called the JavaScriptMVC root folder or just root folder if you're cool.</p>
705
+ * <p>And since JavaScriptMVC likes folder structures like:</p>
706
+ * @codestart text
707
+ * \myapp
708
+ * \myapp.js
709
+ * \steal
710
+ * \steal.js
711
+ * @codeend
712
+ * <p>If your path doesn't end with <code>.js</code>, JavaScriptMVC assumes you are loading an
713
+ * application and will add <code>/myapp.js</code> on for you. This means that this does the same thing too:</p>
714
+ * @codestart
715
+ * &lt;script type='text/javascript'
716
+ * src='path/to/steal.js?<u><b>myapp</b></u>'>&lt;/script>
717
+ * @codeend
718
+ * <div class='whisper'>Steal, and everything else in JavaScriptMVC, provide these little shortcuts
719
+ * when you are doing things 'right'. In this case, you save 9 characters
720
+ * (<code>/myapp.js</code>) by organizing your app the way, JavaScriptMVC expects.</div>
721
+ * </div>
722
+ */
723
+ steal.options = {
724
+ loadProduction: true,
725
+ env: 'development',
726
+ production: null,
727
+ encoding: "utf-8",
728
+ cacheInclude: true,
729
+ debug: true
730
+ };
731
+
732
+ // variables used while including
733
+ var first = true,
734
+ //If we haven't steald a file yet
735
+ first_wave_done = false,
736
+ //a list of all steald paths
737
+ cwd = '',
738
+ // the current steal
739
+ cur = null,
740
+ //where we are currently including
741
+ steals = [],
742
+ //
743
+ current_steals = [],
744
+ //steals that are pending to be steald
745
+ total = []; //
746
+ extend(steal, {
747
+ /**
748
+ * Sets options from script
749
+ * @hide
750
+ */
751
+ setScriptOptions: function() {
752
+ var scripts = document.getElementsByTagName("script"),
753
+ scriptOptions, commaSplit, stealReg = /steal\.(production\.)?js/;
754
+
755
+ //find the steal script and setup initial paths.
756
+ for ( var i = 0; i < scripts.length; i++ ) {
757
+ var src = scripts[i].src;
758
+ if ( src && stealReg.test(src) ) { //if script has steal.js
759
+ var mvc_root = File(File(src).joinFrom(steal.pageDir)).dir(),
760
+ loc = /\.\.$/.test(mvc_root) ? mvc_root + '/..' : mvc_root.replace(/steal$/, '');
761
+
762
+ if (/.+\/$/.test(loc) ) {
763
+ loc = loc.replace(/\/$/, '');
764
+ }
765
+
766
+ if (/steal\.production\.js/.test(src) ) {
767
+ steal.options.env = "production";
768
+ }
769
+ steal.root = File(loc);
770
+ if ( src.indexOf('?') != -1 ) {
771
+ scriptOptions = src.split('?')[1];
772
+ }
773
+ }
774
+
775
+ }
776
+
777
+ //if there is stuff after ?
778
+ if ( scriptOptions ) {
779
+ // if it looks like steal[xyz]=bar, add those to the options
780
+ if ( scriptOptions.indexOf('=') > -1 ) {
781
+ scriptOptions.replace(/steal\[([^\]]+)\]=([^&]+)/g, function( whoe, prop, val ) {
782
+ steal.options[prop] = val;
783
+ });
784
+ } else {
785
+ //set with comma style
786
+ commaSplit = scriptOptions.split(",");
787
+ if ( commaSplit[0] && commaSplit[0].lastIndexOf('.js') > 0 ) {
788
+ steal.options.startFile = commaSplit[0];
789
+ } else if ( commaSplit[0] ) {
790
+ steal.options.app = commaSplit[0];
791
+ }
792
+ if ( steal.options.env != "production" ) {
793
+ steal.options.env = commaSplit[1];
794
+ }
795
+ }
796
+
797
+ }
798
+
799
+ },
800
+ setOldIncludeOptions: function() {
801
+ extend(steal.options, oldsteal);
802
+ },
803
+ setHashOptions: function() {
804
+ window.location.hash.replace(/steal\[(\w+)\]=(\w+)/g, function( whoe, prop, val ) {
805
+ steal.options[prop] = val;
806
+ });
807
+ },
808
+ /**
809
+ * Starts including files, sets options.
810
+ * @hide
811
+ */
812
+ init: function() {
813
+ this.setScriptOptions();
814
+ //force into development mode to prevent errors
815
+ if(steal.browser.rhino){
816
+ steal.options.env = 'development';
817
+ }
818
+ this.setOldIncludeOptions();
819
+ this.setHashOptions();
820
+ //clean up any options
821
+ if ( steal.options.app ) {
822
+ steal.options.startFile = steal.options.app + "/" + steal.options.app.match(/[^\/]+$/)[0] + ".js";
823
+ }
824
+ if ( steal.options.ignoreControllers ) {
825
+ steal.controllers = function() {
826
+ return steal;
827
+ };
828
+ steal.controller = function() {
829
+ return steal;
830
+ };
831
+ }
832
+ //calculate production location;
833
+ if (!steal.options.production && steal.options.startFile ) {
834
+ steal.options.production = "//" + File(steal.options.startFile).dir() + '/production';
835
+ }
836
+ if ( steal.options.production ) {
837
+ steal.options.production = steal.options.production + (steal.options.production.indexOf('.js') == -1 ? '.js' : '');
838
+ }
839
+ //we only load things with force = true
840
+ if ( steal.options.env == 'production' && steal.options.loadProduction ) {
841
+ if ( steal.options.production ) {
842
+ first = false; //makes it so we call close after
843
+ //steal(steal.options.startFile);
844
+ steal({
845
+ path: steal.options.production,
846
+ force: true
847
+ });
848
+ }
849
+
850
+ } else {
851
+
852
+ var current_path = steal.getCurrent();
853
+ steal({
854
+ path: 'steal/dev/dev.js',
855
+ ignore: true
856
+ });
857
+ steal.curDir(current_path);
858
+
859
+
860
+
861
+
862
+ //if you have a startFile load it
863
+ if ( steal.options.startFile ) {
864
+ first = false; //makes it so we call close after
865
+ //steal(steal.options.startFile);
866
+ steal._start = new steal.fn.init(steal.options.startFile);
867
+ steal.add(steal._start);
868
+ }
869
+
870
+ }
871
+
872
+
873
+
874
+ if ( steal.options.startFile ) {
875
+ steal.start();
876
+ }
877
+ },
878
+ /**
879
+ * Gets or sets the current directory your relative steals will reference.
880
+ * @param {String} [path] the new current directory path
881
+ * @return {String|steal} the path of the current directory or steal for chaining.
882
+ */
883
+ curDir: function( path ) {
884
+ if ( path !== undefined ) {
885
+ cwd = path;
886
+ return steal;
887
+ } else {
888
+ var dir = File(cwd).dir();
889
+ //make sure it has a /
890
+ return dir ? dir + (dir.lastIndexOf('/') === dir.length - 1 ? '' : '/') : dir;
891
+ }
892
+
893
+ },
894
+ cur: function( steal ) {
895
+ if ( steal !== undefined ) {
896
+ return (cur = steal);
897
+ } else {
898
+ return cur;
899
+ }
900
+ },
901
+ //is the current folder cross domain from our folder?
902
+ isCurrentCrossDomain: function() {
903
+ return File(steal.getAbsolutePath()).isCrossDomain();
904
+ },
905
+ getCurrent: function() {
906
+ return cwd;
907
+ },
908
+ getAbsolutePath: function() {
909
+ var dir = this.curDir(),
910
+ fwd = File(this.curDir());
911
+ return fwd.relative() ? fwd.joinFrom(steal.root.path, true) : dir;
912
+ },
913
+ // Adds a steal to the pending list of steals.
914
+ add: function( newInclude ) {
915
+ //If steal is a function, add to list, and unshift
916
+ if ( typeof newInclude.func == 'function' ) {
917
+ //console.log("add","FUNCTION")
918
+ current_steals.unshift(newInclude); //add to the front
919
+ return;
920
+ }
921
+ var cur = steal.cur();
922
+ if ( cur ) {
923
+ cur.dependencies.push(newInclude);
924
+ }
925
+
926
+ //if we have already performed loads, insert new steals in head
927
+ //now we should check if it has already been steald or added earlier in this file
928
+ if ( steal.shouldAdd(newInclude) ) {
929
+ if ( first_wave_done ) {
930
+ return newInclude.runNow();
931
+ }
932
+ //but the file could still be in the list of steals but we need it earlier, so remove it and add it here
933
+ var path = newInclude.absolute || newInclude.path;
934
+ for ( var i = 0; i < steals.length; i++ ) {
935
+ if ( steals[i].absolute == path ) {
936
+ steals.splice(i, 1);
937
+ break;
938
+ }
939
+ }
940
+ //console.log("add FILE",newInclude.path)
941
+ current_steals.unshift(newInclude);
942
+ }
943
+ },
944
+ //this should probably be kept as a hash.
945
+ shouldAdd: function( inc ) {
946
+ var path = inc.absolute || inc.path,
947
+ i;
948
+ for ( i = 0; i < total.length; i++ ) {
949
+ if ( total[i].absolute == path ) {
950
+ return false;
951
+ }
952
+ }
953
+ for ( i = 0; i < current_steals.length; i++ ) {
954
+ if ( current_steals[i].absolute == path ) {
955
+ return false;
956
+ }
957
+ }
958
+ return true;
959
+ },
960
+ done: function() {
961
+ if ( typeof steal.options.done == "function" ) {
962
+ steal.options.done(total);
963
+ }
964
+ },
965
+ // Called after every file is loaded. Gets the next file and steals it.
966
+ end: function( src ) {
967
+ //prevents warning of bad includes
968
+ clearTimeout(steal.timer);
969
+ // add steals that were just added to the end of the list
970
+ steals = steals.concat(current_steals);
971
+ if (!steals.length ) {
972
+ return;
973
+ }
974
+
975
+ // take the last one
976
+ var next = steals.pop();
977
+
978
+ // if there are no more
979
+ if (!next ) {
980
+ first_wave_done = true;
981
+ steal.done();
982
+ } else {
983
+ //add to the total list of things that have been steald, and clear current steals
984
+ total.push(next);
985
+ current_steals = [];
986
+ next.run();
987
+
988
+ }
989
+
990
+ },
991
+
992
+ /**
993
+ * Starts loading files. This is useful when steal is being used without providing an initial file or app to load.
994
+ * You can steal files, but then call steal.start() to start actually loading them.
995
+ *
996
+ * <h3>Example:</h3>
997
+ * @codestart html
998
+ * &lt;script src='steal/steal.js'>&lt;/script>
999
+ * &lt;script type='text/javascript'>
1000
+ * steal.plugins('controller')
1001
+ * steal.start();
1002
+ * &lt;/script>
1003
+ * @codeend
1004
+ * The above code loads steal, then uses steal to load the plugin controller.
1005
+ */
1006
+ start: function() {
1007
+ steal.end();
1008
+ },
1009
+ /**
1010
+ * Loads css files from the given relative path.
1011
+ * @codestart
1012
+ * steal.css('mystyles') //loads mystyles.css
1013
+ * @codeend
1014
+ * Styles loaded in this way will be compressed into a single style.
1015
+ * @param {String+} relative URL(s) to stylesheets
1016
+ * @return {steal} steal for chaining
1017
+ */
1018
+ css: function() {
1019
+ //if production,
1020
+ if ( steal.options.env == 'production' ) {
1021
+ if ( steal.loadedProductionCSS ) {
1022
+ return steal;
1023
+ } else {
1024
+ var productionCssPath = steal.File(steal.options.production.replace(".js", ".css")).normalize();
1025
+ productionCssPath = steal.root.join(productionCssPath);
1026
+ steal.createLink(productionCssPath);
1027
+ steal.loadedProductionCSS = true;
1028
+ return steal;
1029
+ }
1030
+ }
1031
+ var current;
1032
+ for ( var i = 0; i < arguments.length; i++ ) {
1033
+ current = File(arguments[i] + ".css").joinCurrent();
1034
+ steal.createLink(steal.root.join(current));
1035
+ }
1036
+ return this;
1037
+ },
1038
+ /**
1039
+ * Creates a css link and appends it to head.
1040
+ * @hide
1041
+ * @param {Object} location
1042
+ * @return {HTMLLinkElement}
1043
+ */
1044
+ createLink: function( location, options ) {
1045
+ options = options || {};
1046
+ var link = document.createElement('link');
1047
+ link.rel = options.rel || "stylesheet";
1048
+ link.href = location;
1049
+ link.type = options.type || 'text/css';
1050
+ head().appendChild(link);
1051
+ return link;
1052
+ },
1053
+ /**
1054
+ * @hide
1055
+ * Synchronously requests a file. This is here to read a file for other types. *
1056
+ * @param {String} path path of file you want to load
1057
+ * @param {optional:String} content_type optional content type
1058
+ * @return {String} text of file
1059
+ */
1060
+ request: function( path, content_type ) {
1061
+ var contentType = (content_type || "application/x-www-form-urlencoded; charset=" + steal.options.encoding),
1062
+ request = factory();
1063
+ request.open("GET", path, false);
1064
+ request.setRequestHeader('Content-type', contentType);
1065
+ if ( request.overrideMimeType ) {
1066
+ request.overrideMimeType(contentType);
1067
+ }
1068
+
1069
+ try {
1070
+ request.send(null);
1071
+ }
1072
+ catch (e) {
1073
+ return null;
1074
+ }
1075
+ if ( request.status === 500 || request.status === 404 || request.status === 2 || (request.status === 0 && request.responseText === '') ) {
1076
+ return null;
1077
+ }
1078
+ return request.responseText;
1079
+ },
1080
+ /**
1081
+ * Inserts a script tag in head with the encoding.
1082
+ * @hide
1083
+ * @param {Object} src
1084
+ * @param {Object} encode
1085
+ */
1086
+ insertHead: function( src, encode, type, text, id ) {
1087
+ encode = encode || "UTF-8";
1088
+ var script = scriptTag();
1089
+ if ( src ) {
1090
+ script.src = src;
1091
+ }
1092
+ if ( id ) {
1093
+ script.id = id;
1094
+ }
1095
+ script.charset = encode;
1096
+ script.type = type || "text/javascript";
1097
+ if ( text ) {
1098
+ script.text = text;
1099
+ }
1100
+ head().appendChild(script);
1101
+ },
1102
+ write: function( src, encode ) {
1103
+ encode = encode || "UTF-8";
1104
+ document.write('<script type="text/javascript" src="' + src + '" encode="+encode+"></script>');
1105
+ },
1106
+ resetApp: function( f ) {
1107
+ return function( name ) {
1108
+ var current_path = steal.getCurrent();
1109
+ steal.curDir("");
1110
+ if ( name.path ) {
1111
+ name.path = f(name.path);
1112
+ } else {
1113
+ name = f(name);
1114
+ }
1115
+ steal(name);
1116
+ steal.curDir(current_path);
1117
+ return steal;
1118
+ };
1119
+ },
1120
+ callOnArgs: function( f ) {
1121
+ return function() {
1122
+ for ( var i = 0; i < arguments.length; i++ ) {
1123
+ f(arguments[i]);
1124
+ }
1125
+ return steal;
1126
+ };
1127
+
1128
+ },
1129
+ // Returns a function that applies a function to a list of arguments. Then steals those
1130
+ // arguments.
1131
+ applier: function( f ) {
1132
+ return function() {
1133
+ var args = [];
1134
+ for ( var i = 0; i < arguments.length; i++ ) {
1135
+ if ( typeof arguments[i] == "function" ) {
1136
+ args[i] = arguments[i];
1137
+ } else {
1138
+ args[i] = f(arguments[i]);
1139
+ }
1140
+
1141
+ }
1142
+ steal.apply(null, args);
1143
+ return steal;
1144
+ };
1145
+ },
1146
+ then: steal,
1147
+ total: total
1148
+ });
1149
+ steal.plugin = steal.resetApp(function( p ) {
1150
+ return p + '/' + getLastPart(p);
1151
+ });
1152
+ steal.packs = function() {
1153
+ for ( var i = 0; i < arguments.length; i++ ) {
1154
+ if ( typeof arguments[i] == "function" ) {
1155
+ steal(arguments[i]);
1156
+ } else {
1157
+ steal({
1158
+ force: true,
1159
+ path: "//packages/" + arguments[i] + ".js"
1160
+ });
1161
+ }
1162
+ }
1163
+ return this;
1164
+ };
1165
+
1166
+ extend(steal, {
1167
+
1168
+ /**
1169
+ * @function plugins
1170
+ * Loads a list of plugins given a path relative to the project's root.
1171
+ * @param {String} plugin_location location of a plugin, ex: jquery/dom/history.
1172
+ * @return {steal} a new steal object
1173
+ * @codestart
1174
+ * steal.plugins('jquery/controller',
1175
+ * 'jquery/controller/view',
1176
+ * 'jquery/view',
1177
+ * 'jquery/model')
1178
+ * @codeend
1179
+ */
1180
+ plugins: steal.callOnArgs(steal.plugin),
1181
+
1182
+
1183
+ /**
1184
+ * @function controllers
1185
+ * Loads controllers from the current file's <b>controllers</b> directory.
1186
+ * <br>
1187
+ * <code>steal.controllers</code> adds the suffix <code>_controller.js</code> to each name passed in.
1188
+ * <br>
1189
+ * <br>
1190
+ * Example:
1191
+ * <br>
1192
+ * If you want to load controllers/recipe_controller.js and controllers/ingredient_controller.js,
1193
+ * write:
1194
+ * @codestart
1195
+ * steal.controllers('recipe',
1196
+ * 'ingredient')
1197
+ * @codeend
1198
+ * @param {String+} controller the name of of the {NAME}_controller.js file to load. You can pass multiple controller names.
1199
+ * @return {steal} the steal function for chaining.
1200
+ */
1201
+ controllers: steal.applier(function( i ) {
1202
+ if ( i.match(/^\/\//) ) {
1203
+ i = steal.root.join(i.substr(2));
1204
+ return i;
1205
+ }
1206
+ return 'controllers/' + i + '_controller';
1207
+ }),
1208
+
1209
+ /**
1210
+ * @function models
1211
+ * Loads models from the current file's <b>models</b> directory.
1212
+ * <br>
1213
+ * <br>
1214
+ * Example:
1215
+ * <br>
1216
+ * If you want to include models/recipe.js and models/ingredient.js,
1217
+ * write:
1218
+ * @codestart
1219
+ * steal.models('recipe',
1220
+ * 'ingredient')
1221
+ * @codeend
1222
+ * @param {String+} model The name of the model file you want to load. You can pass multiple model names.
1223
+ * @return {steal} the steal function for chaining.
1224
+ */
1225
+ models: steal.applier(function( i ) {
1226
+ if ( i.match(/^\/\//) ) {
1227
+ i = steal.root.join(i.substr(2));
1228
+ return i;
1229
+ }
1230
+ return 'models/' + i;
1231
+ }),
1232
+
1233
+ /**
1234
+ * @function resources
1235
+ * Loads resources from the current file's <b>resources</b> directory.
1236
+ * <br>
1237
+ * <br>
1238
+ * Example:
1239
+ * <br>
1240
+ * If you want to load resources/i18n.js, write:
1241
+ * @codestart
1242
+ * steal.resources('i18n')
1243
+ * @codeend
1244
+ * @param {String+} resource The name of the resource file you want to load. You can pass multiple model names.
1245
+ * @return {steal} the steal function for chaining.
1246
+ */
1247
+ resources: steal.applier(function( i ) {
1248
+ if ( i.match(/^\/\//) ) {
1249
+ i = steal.root.join(i.substr(2));
1250
+ return i;
1251
+ }
1252
+ return 'resources/' + i;
1253
+ }),
1254
+
1255
+ /**
1256
+ * @function views
1257
+ * Loads views to be added to the production build. Paths must be given from steal's ROOT folder.
1258
+ * <br>
1259
+ * <br>
1260
+ * Example:
1261
+ * <br>
1262
+ * The following loads, coookbook/views/recipe/show.ejs and coookbook/views/recipe/list.ejs:
1263
+ * @codestart
1264
+ * steal.views('//coookbook/views/recipe/show.ejs',
1265
+ * '//coookbook/views/recipe/list.ejs')
1266
+ * @codeend
1267
+ * @param {String} path The view's path rooted from steal's root folder.
1268
+ * @return {steal} the steal function for chaining.
1269
+ */
1270
+ views: function() {
1271
+ // Only includes views for compression and docs (when running in rhino)
1272
+ if ( browser.rhino || steal.options.env == "production" ) {
1273
+ for ( var i = 0; i < arguments.length; i++ ) {
1274
+ steal.view(arguments[i]);
1275
+ }
1276
+ }
1277
+ return steal;
1278
+ },
1279
+
1280
+ timerCount: 0,
1281
+ view: function( path ) {
1282
+ var type = path.match(/\.\w+$/gi)[0].replace(".", "");
1283
+ steal({
1284
+ path: path,
1285
+ type: "text/" + type,
1286
+ compress: "false"
1287
+ });
1288
+ return steal;
1289
+ },
1290
+ timers: {},
1291
+ //tracks the last script
1292
+ ct: function( id ) { //for clear timer
1293
+ clearTimeout(steal.timers[id]);
1294
+ delete steal.timers[id];
1295
+ },
1296
+ loadErrorTimer: function( options ) {
1297
+ var count = ++steal.timerCount;
1298
+ steal.timers[count] = setTimeout(function() {
1299
+ throw "steal.js Could not load " + options.src + ". Are you sure you have the right path?";
1300
+ }, 5000);
1301
+ return "onLoad='steal.ct(" + count + ")' ";
1302
+ },
1303
+ cleanId: function( id ) {
1304
+ return id.replace(/[\/\.]/g, "_");
1305
+ }
1306
+ });
1307
+ //for integration with other build types
1308
+ if (!steal.build ) {
1309
+ steal.build = {
1310
+ types: {}
1311
+ };
1312
+ }
1313
+
1314
+ steal.loadedProductionCSS = false;
1315
+
1316
+ steal.init();
1317
+ })();