ninjs 0.13.6 → 0.13.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. data/VERSION +1 -1
  2. data/ninjs.gemspec +5 -290
  3. metadata +52 -345
  4. data/.bundle/config +0 -2
  5. data/CNAME +0 -1
  6. data/Gemfile +0 -16
  7. data/Gemfile.lock +0 -36
  8. data/LICENSE +0 -29
  9. data/README.md +0 -348
  10. data/bin/ninjs +0 -218
  11. data/lib/ninjs.rb +0 -10
  12. data/lib/ninjs/command.rb +0 -91
  13. data/lib/ninjs/configuration.rb +0 -72
  14. data/lib/ninjs/dependencies.rb +0 -16
  15. data/lib/ninjs/generator.rb +0 -57
  16. data/lib/ninjs/helpers.rb +0 -17
  17. data/lib/ninjs/manifest.rb +0 -9
  18. data/lib/ninjs/notification.rb +0 -37
  19. data/lib/ninjs/project.rb +0 -233
  20. data/repository/jquery/1.1.4.js +0 -2508
  21. data/repository/jquery/1.2.6.js +0 -32
  22. data/repository/jquery/1.3.2.js +0 -19
  23. data/repository/jquery/1.4.2.js +0 -154
  24. data/repository/jquery/1.4.3.js +0 -166
  25. data/repository/jquery/1.4.4.js +0 -167
  26. data/repository/jquery/1.5.js +0 -16
  27. data/repository/jquery/fancybox/1.3.1.js +0 -1079
  28. data/repository/jquery/fancybox/assets/1.3.1/css/fancybox.css +0 -363
  29. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/blank.gif +0 -0
  30. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_close.png +0 -0
  31. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_loading.png +0 -0
  32. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_left.png +0 -0
  33. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_right.png +0 -0
  34. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_e.png +0 -0
  35. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_n.png +0 -0
  36. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_ne.png +0 -0
  37. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_nw.png +0 -0
  38. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_s.png +0 -0
  39. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_se.png +0 -0
  40. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_sw.png +0 -0
  41. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_w.png +0 -0
  42. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_left.png +0 -0
  43. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_main.png +0 -0
  44. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_over.png +0 -0
  45. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_right.png +0 -0
  46. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-x.png +0 -0
  47. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-y.png +0 -0
  48. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox.png +0 -0
  49. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/jquery.easing-1.3.pack.js +0 -72
  50. data/repository/jquery/fancybox/latest.js +0 -1
  51. data/repository/jquery/latest.js +0 -1
  52. data/repository/jquery/mobile/1.0a3.js +0 -123
  53. data/repository/jquery/mobile/1.0a3/assets/css/jquery.mobile.css +0 -1652
  54. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/ajax-loader.png +0 -0
  55. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-off.png +0 -0
  56. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-on.png +0 -0
  57. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-off.png +0 -0
  58. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-on.png +0 -0
  59. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icon-search-black.png +0 -0
  60. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-black.png +0 -0
  61. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-white.png +0 -0
  62. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-black.png +0 -0
  63. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-white.png +0 -0
  64. data/repository/jquery/mobile/latest.js +0 -1
  65. data/repository/jquery/mousewheel/3.0.2.js +0 -11
  66. data/repository/jquery/mousewheel/latest.js +0 -1
  67. data/repository/jquery/ui/1.8.7.js +0 -783
  68. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.accordion.css +0 -19
  69. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.all.css +0 -11
  70. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.autocomplete.css +0 -53
  71. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.base.css +0 -11
  72. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.button.css +0 -38
  73. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.core.css +0 -41
  74. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.datepicker.css +0 -68
  75. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.dialog.css +0 -21
  76. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.progressbar.css +0 -11
  77. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.resizable.css +0 -20
  78. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.selectable.css +0 -10
  79. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.slider.css +0 -24
  80. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.tabs.css +0 -18
  81. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.theme.css +0 -252
  82. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  83. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  84. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  85. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  86. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_dadada_1x400.png +0 -0
  87. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  88. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  89. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  90. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_222222_256x240.png +0 -0
  91. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_2e83ff_256x240.png +0 -0
  92. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_454545_256x240.png +0 -0
  93. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_888888_256x240.png +0 -0
  94. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_cd0a0a_256x240.png +0 -0
  95. data/repository/jquery/ui/latest.js +0 -1
  96. data/repository/json2.js +0 -482
  97. data/repository/modernizr/1.5.js +0 -28
  98. data/repository/modernizr/latest.js +0 -1
  99. data/repository/ninjs/core/.core.pdoc.yaml +0 -0
  100. data/repository/ninjs/core/.existence.pdoc.yaml +0 -12
  101. data/repository/ninjs/core/.extend.pdoc.yaml +0 -0
  102. data/repository/ninjs/core/.nin.pdoc.yaml +0 -0
  103. data/repository/ninjs/core/application.js +0 -47
  104. data/repository/ninjs/core/existence.js +0 -277
  105. data/repository/ninjs/core/extend.js +0 -77
  106. data/repository/ninjs/core/module.js +0 -135
  107. data/repository/ninjs/core/nin.js +0 -4
  108. data/repository/ninjs/docs/Data/ClassHierarchy.nd +0 -0
  109. data/repository/ninjs/docs/Data/ConfigFileInfo.nd +0 -0
  110. data/repository/ninjs/docs/Data/FileInfo.nd +0 -16
  111. data/repository/ninjs/docs/Data/ImageFileInfo.nd +0 -0
  112. data/repository/ninjs/docs/Data/ImageReferenceTable.nd +0 -0
  113. data/repository/ninjs/docs/Data/IndexInfo.nd +0 -0
  114. data/repository/ninjs/docs/Data/PreviousMenuState.nd +0 -0
  115. data/repository/ninjs/docs/Data/PreviousSettings.nd +0 -0
  116. data/repository/ninjs/docs/Data/SymbolTable.nd +0 -0
  117. data/repository/ninjs/docs/Languages.txt +0 -113
  118. data/repository/ninjs/docs/Menu.txt +0 -63
  119. data/repository/ninjs/docs/Topics.txt +0 -81
  120. data/repository/ninjs/docs/files/core/application-js.html +0 -44
  121. data/repository/ninjs/docs/files/core/existence-js.html +0 -60
  122. data/repository/ninjs/docs/files/core/extend-js.html +0 -55
  123. data/repository/ninjs/docs/files/core/module-js.html +0 -80
  124. data/repository/ninjs/docs/files/core/nin-js.html +0 -38
  125. data/repository/ninjs/docs/index.html +0 -1
  126. data/repository/ninjs/docs/index/Classes.html +0 -33
  127. data/repository/ninjs/docs/index/Files.html +0 -45
  128. data/repository/ninjs/docs/index/Functions.html +0 -65
  129. data/repository/ninjs/docs/index/General.html +0 -85
  130. data/repository/ninjs/docs/index/Variables.html +0 -45
  131. data/repository/ninjs/docs/javascript/main.js +0 -841
  132. data/repository/ninjs/docs/javascript/prettify.js +0 -1526
  133. data/repository/ninjs/docs/javascript/searchdata.js +0 -152
  134. data/repository/ninjs/docs/search/ClassesN.html +0 -20
  135. data/repository/ninjs/docs/search/FilesA.html +0 -20
  136. data/repository/ninjs/docs/search/FilesE.html +0 -20
  137. data/repository/ninjs/docs/search/FilesM.html +0 -20
  138. data/repository/ninjs/docs/search/FilesN.html +0 -20
  139. data/repository/ninjs/docs/search/FunctionsA.html +0 -20
  140. data/repository/ninjs/docs/search/FunctionsC.html +0 -20
  141. data/repository/ninjs/docs/search/FunctionsE.html +0 -20
  142. data/repository/ninjs/docs/search/FunctionsI.html +0 -20
  143. data/repository/ninjs/docs/search/FunctionsM.html +0 -20
  144. data/repository/ninjs/docs/search/FunctionsR.html +0 -20
  145. data/repository/ninjs/docs/search/FunctionsS.html +0 -20
  146. data/repository/ninjs/docs/search/FunctionsSymbols.html +0 -20
  147. data/repository/ninjs/docs/search/FunctionsU.html +0 -20
  148. data/repository/ninjs/docs/search/GeneralA.html +0 -20
  149. data/repository/ninjs/docs/search/GeneralC.html +0 -20
  150. data/repository/ninjs/docs/search/GeneralD.html +0 -20
  151. data/repository/ninjs/docs/search/GeneralE.html +0 -20
  152. data/repository/ninjs/docs/search/GeneralF.html +0 -20
  153. data/repository/ninjs/docs/search/GeneralI.html +0 -20
  154. data/repository/ninjs/docs/search/GeneralM.html +0 -20
  155. data/repository/ninjs/docs/search/GeneralN.html +0 -20
  156. data/repository/ninjs/docs/search/GeneralR.html +0 -20
  157. data/repository/ninjs/docs/search/GeneralS.html +0 -20
  158. data/repository/ninjs/docs/search/GeneralSymbols.html +0 -20
  159. data/repository/ninjs/docs/search/GeneralT.html +0 -20
  160. data/repository/ninjs/docs/search/GeneralU.html +0 -20
  161. data/repository/ninjs/docs/search/GeneralV.html +0 -20
  162. data/repository/ninjs/docs/search/NoResults.html +0 -15
  163. data/repository/ninjs/docs/search/VariablesD.html +0 -20
  164. data/repository/ninjs/docs/search/VariablesN.html +0 -20
  165. data/repository/ninjs/docs/search/VariablesR.html +0 -20
  166. data/repository/ninjs/docs/search/VariablesT.html +0 -20
  167. data/repository/ninjs/docs/styles/main.css +0 -828
  168. data/repository/ninjs/extensions/jquery.elements.js +0 -60
  169. data/repository/ninjs/tests/index.html +0 -21
  170. data/repository/ninjs/tests/ninjs.test.js +0 -188
  171. data/repository/ninjs/tests/ninjs.utilities.test.js +0 -137
  172. data/repository/ninjs/tests/qunit/qunit.css +0 -197
  173. data/repository/ninjs/tests/qunit/qunit.js +0 -1415
  174. data/repository/ninjs/utilities/all.js +0 -5
  175. data/repository/ninjs/utilities/array.js +0 -29
  176. data/repository/ninjs/utilities/cookie.js +0 -0
  177. data/repository/ninjs/utilities/css.js +0 -51
  178. data/repository/ninjs/utilities/number.js +0 -11
  179. data/repository/ninjs/utilities/string.js +0 -61
  180. data/repository/nullconsole.js +0 -7
  181. data/repository/qunit/assets/css/qunit.css +0 -196
  182. data/repository/qunit/qunit.js +0 -1374
  183. data/repository/selectivizr/1.0.js +0 -5
  184. data/repository/selectivizr/latest.js +0 -1
  185. data/repository/syntaxhighlighter/all.js +0 -11
  186. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCore.css +0 -226
  187. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDefault.css +0 -328
  188. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDjango.css +0 -331
  189. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEclipse.css +0 -339
  190. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEmacs.css +0 -324
  191. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
  192. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMDUltra.css +0 -324
  193. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMidnight.css +0 -324
  194. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreRDark.css +0 -324
  195. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDefault.css +0 -117
  196. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDjango.css +0 -120
  197. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEclipse.css +0 -128
  198. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEmacs.css +0 -113
  199. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
  200. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMDUltra.css +0 -113
  201. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMidnight.css +0 -113
  202. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeRDark.css +0 -113
  203. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCore.scss +0 -216
  204. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDefault.scss +0 -2
  205. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDjango.scss +0 -2
  206. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEclipse.scss +0 -2
  207. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEmacs.scss +0 -2
  208. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreFadeToGrey.scss +0 -2
  209. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMDUltra.scss +0 -2
  210. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMidnight.scss +0 -2
  211. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreRDark.scss +0 -2
  212. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDefault.scss +0 -7
  213. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDjango.scss +0 -36
  214. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEclipse.scss +0 -48
  215. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEmacs.scss +0 -32
  216. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeFadeToGrey.scss +0 -36
  217. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMDUltra.scss +0 -32
  218. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMidnight.scss +0 -32
  219. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeRDark.scss +0 -32
  220. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_theme_template.scss +0 -120
  221. data/repository/syntaxhighlighter/shAutoloader.js +0 -17
  222. data/repository/syntaxhighlighter/shBrushAS3.js +0 -59
  223. data/repository/syntaxhighlighter/shBrushAppleScript.js +0 -75
  224. data/repository/syntaxhighlighter/shBrushBash.js +0 -59
  225. data/repository/syntaxhighlighter/shBrushCSharp.js +0 -65
  226. data/repository/syntaxhighlighter/shBrushColdFusion.js +0 -100
  227. data/repository/syntaxhighlighter/shBrushCpp.js +0 -97
  228. data/repository/syntaxhighlighter/shBrushCss.js +0 -91
  229. data/repository/syntaxhighlighter/shBrushDelphi.js +0 -55
  230. data/repository/syntaxhighlighter/shBrushDiff.js +0 -41
  231. data/repository/syntaxhighlighter/shBrushErlang.js +0 -52
  232. data/repository/syntaxhighlighter/shBrushGroovy.js +0 -67
  233. data/repository/syntaxhighlighter/shBrushJScript.js +0 -52
  234. data/repository/syntaxhighlighter/shBrushJava.js +0 -57
  235. data/repository/syntaxhighlighter/shBrushJavaFX.js +0 -58
  236. data/repository/syntaxhighlighter/shBrushPerl.js +0 -72
  237. data/repository/syntaxhighlighter/shBrushPhp.js +0 -88
  238. data/repository/syntaxhighlighter/shBrushPlain.js +0 -33
  239. data/repository/syntaxhighlighter/shBrushPowerShell.js +0 -74
  240. data/repository/syntaxhighlighter/shBrushPython.js +0 -64
  241. data/repository/syntaxhighlighter/shBrushRuby.js +0 -55
  242. data/repository/syntaxhighlighter/shBrushSass.js +0 -94
  243. data/repository/syntaxhighlighter/shBrushScala.js +0 -51
  244. data/repository/syntaxhighlighter/shBrushSql.js +0 -66
  245. data/repository/syntaxhighlighter/shBrushVb.js +0 -56
  246. data/repository/syntaxhighlighter/shBrushXml.js +0 -69
  247. data/repository/syntaxhighlighter/shCore.js +0 -17
  248. data/repository/syntaxhighlighter/shLegacy.js +0 -17
  249. data/spec/fixtures/global.js +0 -7
  250. data/spec/fixtures/global.module.js +0 -7
  251. data/spec/fixtures/myapplication.js +0 -576
  252. data/spec/fixtures/nin.js +0 -573
  253. data/spec/fixtures/ninjs.conf +0 -6
  254. data/spec/fixtures/test.elements.js +0 -4
  255. data/spec/fixtures/test.js +0 -15
  256. data/spec/fixtures/test.model.js +0 -3
  257. data/spec/fixtures/test.module.js +0 -10
  258. data/spec/fixtures/updated.myapplication.js +0 -27
  259. data/spec/fixtures/utilities.js +0 -162
  260. data/spec/helpers_spec.rb +0 -11
  261. data/spec/integration_spec.rb +0 -257
  262. data/spec/manifest_spec.rb +0 -8
  263. data/spec/ninjs_spec.rb +0 -36
  264. data/spec/notification_spec.rb +0 -27
  265. data/spec/spec_helper.rb +0 -5
  266. data/tmp/ff9e83aa019b712b90200b8d1b8fa0c7e14576af.json +0 -1
  267. data/tmp/metric_fu/_data/20110305.yml +0 -1548
  268. data/tmp/metric_fu/output/bluff-min.js +0 -1
  269. data/tmp/metric_fu/output/excanvas.js +0 -35
  270. data/tmp/metric_fu/output/js-class.js +0 -1
  271. data/tmp/metric_fu/output/lib_ninjs_dependencies.rb.html +0 -34
  272. data/tmp/metric_fu/output/lib_ninjs_helpers.rb.html +0 -34
  273. data/tmp/metric_fu/output/lib_ninjs_manifest.rb.html +0 -27
  274. data/tmp/metric_fu/output/rails_best_practices.js +0 -11
  275. data/tmp/metric_fu/scratch/rcov/rcov.txt +0 -1
@@ -1,573 +0,0 @@
1
- /* File: nin.js */
2
- /* File: extend.js */
3
- /* File: existence.js */
4
- if (is_defined === undefined) {
5
- /*
6
- Function: is_defined
7
- Checks if a variable is undefined.
8
-
9
- Parameters:
10
- suspect - suspect variable to test
11
-
12
- Returns:
13
- bool
14
-
15
- See Also:
16
-
17
- <is_undefined>
18
- */
19
- var is_defined = function(suspect) {
20
- return (suspect === undefined) ? false : true;
21
- };
22
- }
23
-
24
- if (!is_defined(is_undefined)) {
25
- /*
26
- Function: is_undefined
27
- Checks if a variable is defined.
28
-
29
- Parameters:
30
- suspect - suspect variable to test
31
-
32
- Returns:
33
- bool
34
-
35
- See Also:
36
-
37
- <is_defined>
38
- */
39
- var is_undefined = function(suspect) {
40
- return (suspect === undefined) ? true : false;
41
- };
42
- }
43
-
44
- if (is_undefined(is_typeof)) {
45
- /*
46
- Function: is_typeof
47
- Determine an object's type strictly by comparing constructors.
48
-
49
- Parameters:
50
- type - The type you expect (ie. String, Number, Array without quotes: is_typeof(String, 'hello'): // true)
51
- suspect - The variable to check against type
52
-
53
- Returns:
54
- bool
55
-
56
- See Also:
57
- <is_numeric>,
58
- <is_string>,
59
- <is_array>,
60
- <is_number>,
61
- <is_date>,
62
- <is_bool>,
63
- <is_regex>
64
- */
65
- var is_typeof = function(type, suspect) {
66
- try {
67
- if (is_undefined(type)) {
68
- throw new SyntaxError("is_typeof(Type, suspect): type is undefined");
69
- }
70
- if (is_undefined(suspect)) {
71
- throw new SyntaxError("is_typeof(Type, suspect): suspect is undefined");
72
- }
73
-
74
- return (suspect.constructor == type) ? true : false;
75
- }
76
- catch(error) {
77
- alert(error.message);
78
- }
79
- };
80
- }
81
-
82
- if (is_undefined(is_numeric)) {
83
- /*
84
- Function: is_numeric
85
- Determine if the suspect string represents a numeric value.
86
-
87
- Parameters:
88
- suspect - variable to check for numeric value
89
-
90
- Returns:
91
- bool
92
-
93
- See Also:
94
- <is_number>
95
- */
96
- var is_numeric = function(suspect) {
97
- if(is_typeof(Number, suspect)) {
98
- return true;
99
- }
100
- else {
101
- var pattern = /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i;
102
- return pattern.test(suspect);
103
- }
104
- };
105
- }
106
-
107
- if (is_undefined(is_string)) {
108
- /*
109
- Function: is_string
110
- Determine the suspect is a String. This is a proxy method for is_typeof(String, suspect).
111
-
112
- Parameters:
113
- suspect - supect variable to test
114
-
115
- Returns:
116
- bool
117
-
118
- See Also:
119
- <is_typeof>,
120
- <is_numeric>,
121
- <is_array>,
122
- <is_number>,
123
- <is_date>,
124
- <is_bool>,
125
- <is_regex>
126
- */
127
- var is_string = function(suspect) {
128
- return is_typeof(String, suspect);
129
- };
130
- }
131
-
132
- if (is_undefined(is_array)) {
133
- /*
134
- Function: is_array
135
- Determine if the suspect is an Array. This is a proxy method for is_typeof(Array, suspect).
136
-
137
- Parameters:
138
- suspect - suspect variable to test
139
-
140
- Returns:
141
- bool
142
-
143
- See Also:
144
- <is_typeof>,
145
- <is_numeric>,
146
- <is_string>,
147
- <is_number>,
148
- <is_date>,
149
- <is_bool>,
150
- <is_regex>
151
- */
152
- var is_array = function(suspect) {
153
- return is_typeof(Array, suspect);
154
- };
155
- }
156
-
157
- if (is_undefined(is_number)) {
158
- /*
159
- Function: is_number
160
- Determines if the suspect is a Number. This is a proxy method for is_typeof(Number, suspect).
161
-
162
- Parameters:
163
- suspect - suspect variable to test
164
-
165
- Returns:
166
- bool
167
-
168
- See Also:
169
- <is_typeof>,
170
- <is_numeric>,
171
- <is_string>,
172
- <is_array>,
173
- <is_date>,
174
- <is_bool>,
175
- <is_regex>
176
- */
177
- var is_number = function(suspect) {
178
- return is_typeof(Number, suspect);
179
- };
180
- }
181
-
182
- if (is_undefined(is_date)) {
183
- /*
184
- Function: is_date
185
- Determines if the suspect is a Date. This is a proxy method for is_typeof(Date, suspect).
186
-
187
- Parameters:
188
- suspect - suspect variable to test
189
-
190
- Returns:
191
- bool
192
-
193
- See Also:
194
- <is_typeof>,
195
- <is_numeric>,
196
- <is_string>,
197
- <is_array>,
198
- <is_number>,
199
- <is_bool>,
200
- <is_regex>
201
- */
202
- var is_date = function(suspect) {
203
- return is_typeof(Date, suspect);
204
- };
205
- }
206
-
207
- if (is_undefined(is_bool)) {
208
- /*
209
- Function: is_bool
210
- Determines if the suspect is a Boolean. This is a proxy method for is_typeof(Boolean, suspect).
211
-
212
- Parameters:
213
- suspect - suspect variable to test
214
-
215
- Returns:
216
- bool
217
-
218
- See Also:
219
- <is_typeof>,
220
- <is_numeric>,
221
- <is_string>,
222
- <is_array>,
223
- <is_number>,
224
- <is_regex>
225
- */
226
- var is_bool = function(suspect) {
227
- return is_typeof(Boolean, suspect);
228
- };
229
- }
230
-
231
- if (is_undefined(is_regex)) {
232
- /*
233
- Function: is_regex
234
- Determines if the suspect is a RegExp. This is a proxy method for is_typeof(RegExp, suspect).
235
-
236
- Parameters:
237
- suspect - suspect variable to test
238
-
239
- Returns:
240
- bool
241
-
242
- See Also:
243
- <is_typeof>,
244
- <is_numeric>,
245
- <is_string>,
246
- <is_array>,
247
- <is_number>,
248
- <is_bool>
249
- */
250
- var is_regex = function(suspect) {
251
- return is_typeof(RegExp, suspect);
252
- };
253
- }
254
-
255
- if (is_undefined(Function.prototype['method'])) {
256
- /*
257
- Function: method
258
- Method to add a method to an object (ie. String.method('my_method', my_func); //-> 'hello'.my_func())
259
-
260
- Parameters:
261
- name - name of the method
262
- func - function definition
263
-
264
- Returns:
265
- this === Function
266
-
267
- > String.method('custom_method', function() {
268
- > // define custom_method
269
- > });
270
- >
271
- > "hello".custom_method();
272
- */
273
- Function.prototype.method = function(name, func) {
274
- try {
275
- if (is_undefined(name)) {
276
- throw new SyntaxError("Object.method(name, func): name is undefined");
277
- }
278
- if (is_undefined(func)) {
279
- throw new SyntaxError("Object.method(name, func): func is undefined");
280
- }
281
-
282
- if (is_undefined(this.prototype[name])) {
283
- this.prototype[name] = func;
284
- return this;
285
- }
286
- }
287
- catch(error) {
288
- alert(error.message);
289
- }
290
- };
291
- }
292
- /*
293
- File: module.js
294
-
295
- Class: NinjsModule
296
- A NinjsModule is an object which encapsulates a certain behavior or functionality.
297
-
298
- Parameters:
299
- name - the name of the module
300
-
301
- See Also:
302
- <NinjsApplication>
303
- */
304
- var NinjsModule = function(name) {
305
- /*
306
- Variable: data
307
- The module's data object
308
- */
309
- this.data = {};
310
- /*
311
- Variable: name
312
- The module's name (string)
313
- */
314
- this.name = name;
315
- /*
316
- Variable: run_tests (beta)
317
- Boolean to turn tests on/off
318
- */
319
- this.run_tests = false;
320
- /*
321
- Variable: tests (beta)
322
- Array of test files to run
323
- */
324
- this.tests = [];
325
- };
326
-
327
- /*
328
- Method: actions
329
- The actions method contains code to be executed when run is called. This method is a placeholder to be overwritten.
330
-
331
- > MyModule.actions = function() {
332
- > // define actions here
333
- >};
334
- */
335
- NinjsModule.method('actions', function() {});
336
-
337
-
338
- /*
339
- Method: run
340
- Waits for the DOM to load then calls execute.
341
-
342
- > MyModule.run();
343
- */
344
- NinjsModule.method('run', function() {
345
- this.call_on_ready(this.execute);
346
- });
347
-
348
- /*
349
- Method: call_on_ready
350
- Waits for the DOM to be ready and then executes a callback.
351
-
352
- Parameters:
353
- callback - function to be called when the DOM is ready
354
-
355
- > MyModule.call_on_ready(function() {
356
- > // some code to execute when the DOM is ready
357
- > });
358
- */
359
- NinjsModule.method('call_on_ready', function(callback) {
360
- var timer;
361
- var module = this;
362
-
363
- function check_ready() {
364
- timer = setInterval(is_ready, 13);
365
- }
366
-
367
- function is_ready() {
368
- if (document && document.getElementsByTagName && document.getElementById && document.body) {
369
- clearInterval(timer);
370
- timer = null;
371
- callback.call(module);
372
- }
373
- }
374
-
375
- check_ready();
376
- });
377
-
378
- /*
379
- Method: execute
380
- Wrapper method that set's up the environment and then calls actions.
381
-
382
- > MyModule.execute();
383
- */
384
- NinjsModule.method('execute', function() {
385
- this.old__ = is_defined(window.__) ? window.__ : undefined;
386
- window.__ = this;
387
-
388
- if (this.run_tests) {
389
- this._run_tests();
390
- }
391
- this.actions();
392
-
393
- if(is_defined(this.old__)) {
394
- window.__ = this.old__;
395
- }
396
- });
397
-
398
- /*
399
- Method: elements
400
- Method to define module elements.
401
-
402
- Parameters:
403
- callback - function to define a module's elements
404
-
405
- > MyModule.elements(function() {
406
- > // element definitions go here
407
- > });
408
- */
409
- NinjsModule.method('elements', function(callback) {
410
- this.old__ = is_defined(window.__) ? window.__ : undefined;
411
- window.__ = this;
412
-
413
- this.call_on_ready(callback);
414
-
415
- if(is_defined(this.old__)) {
416
- window.__ = this.old__;
417
- }
418
- });
419
-
420
-
421
- /*
422
- Method: set_data
423
- Adds properties to the module's data object.
424
-
425
- Parameters:
426
- key - string or object (if string = key, if object sets multiple properties)
427
- value - value of key if key is string
428
-
429
- > MyModule.set_data('some_key', 'some_value');
430
- > MyModule.data.some_key === 'some_value'
431
-
432
- > MyModule.set_data({
433
- > 'property_one': 'value_one',
434
- > 'property_two': 'value_two'
435
- > });
436
- > MyModule.data.property_one === 'value_one'
437
- > MyModule.data.property_two === 'value_two'
438
- */
439
- NinjsModule.method('set_data', function(key, value) {
440
- try {
441
- if (is_undefined(key)) {
442
- throw new SyntaxError('NinjsModule.set_data(key, value): key is undefined');
443
- }
444
-
445
- if (is_typeof(String, key) && is_undefined(value)) {
446
- throw new SyntaxError('NinjsModule.set_data(key, value): value is undefined');
447
- }
448
-
449
- if (is_typeof(String, key)) {
450
- this.data[key] = value;
451
- }
452
- else if (is_typeof(Object, key)) {
453
- var data = key;
454
- for(var property in data) {
455
- this.data[property] = data[property];
456
- }
457
- }
458
-
459
- return this;
460
- }
461
- catch(error) {
462
- alert(error.message);
463
- }
464
- });
465
-
466
- /*
467
- Method: add_test
468
- Adds a test file to the tests array (beta).
469
-
470
- Parameters:
471
- test_file - File to add to the tests array
472
-
473
- > MyModule.add_test('mytest.test.js');
474
- */
475
- NinjsModule.method('add_test', function(test_file) {
476
- this.tests.push(test_file);
477
- });
478
-
479
- /*
480
- Method: _run_tests
481
- Runs the test files in the test array. This method is automatically called by the execute method if run_tests === true
482
- */
483
- NinjsModule.method('_run_tests', function() {
484
- var test_template = [];
485
- test_template.push('<div class="test-results" title="Test Results">');
486
- test_template.push('<h1 id="qunit-header">' + this.name + ' module tests</h1>');
487
- test_template.push('<h2 id="qunit-banner"></h2>');
488
- test_template.push('<h2 id="qunit-userAgent"></h2>');
489
- test_template.push('<ol id="qunit-tests"></ol>');
490
- test_template.push('</div>');
491
-
492
- var qunit_dependencies = '<script src="' + _.tests_path +'qunit/qunit.js"></script>';
493
- $.getScript(_.tests_path + 'qunit/qunit.js');
494
- var qunit_styles = '<link rel="stylesheet" href="' + _.tests_path + 'qunit/qunit.css">';
495
- $('body').append(qunit_styles);
496
- $('body').append(test_template.join("\n"));
497
-
498
- this.tests.each(function(test) {
499
- $.getScript(_.tests_path + test + '.test.js', function() {
500
- var test_results_dialog = $('.test-results');
501
- var height = $(window).height() - 200;
502
- var width = $(window).width() - 300;
503
- try {
504
- test_results_dialog.dialog({
505
- width: width,
506
- height: height,
507
- autoOpen: false,
508
- buttons: {
509
- "Thanks buddy": function() {
510
- test_results_dialog.dialog('close');
511
- }
512
- }
513
- });
514
- var failed = $('.failed');
515
- console.log(failed.html());
516
- test_results_dialog.dialog('open');
517
- }
518
- catch(error) {
519
- alert("Test harness requires jQueryUI");
520
- }
521
- });
522
- });
523
- });
524
- /*
525
- File: application.js
526
-
527
- Class: NinjsApplication
528
- An NinjsApplication object serves as your application's namespace and includes a utility to add modules to the application object.
529
-
530
- See Also:
531
- <NinjsModule>
532
- */
533
- var NinjsApplication = function(base_url, tests_path) {
534
- if (is_undefined(window._)) {
535
- window._ = this;
536
- }
537
-
538
- if(is_defined(tests_path)) {
539
- this.tests_path = tests_path;
540
- }
541
-
542
- if(is_defined(base_url)) {
543
- this.site_url = function(path) {
544
- var path = path || '';
545
- return base_url + path;
546
- }
547
- }
548
- };
549
-
550
- /*
551
- Method: add_module
552
- Adds a NinjsModule to the application.
553
-
554
- Parameters:
555
- name - the name of the module
556
-
557
- > myapp.add_module('my_module');
558
- */
559
- NinjsApplication.method('add_module', function(name) {
560
- try {
561
- if (is_undefined(name)) {
562
- throw new SyntaxError("NinjsApplication.add_module(name): name is undefined");
563
- }
564
-
565
- if (is_defined(this[name])) {
566
- throw new SyntaxError("NinjsApplication.add_module(name): '" + name + "' already declared");
567
- }
568
- this[name] = new NinjsModule(name);
569
- }
570
- catch(error) {
571
- alert(error.message);
572
- }
573
- });