jax 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (446) hide show
  1. data/.gitignore +12 -0
  2. data/.gitmodules +3 -0
  3. data/.rvmrc +7 -0
  4. data/Gemfile +4 -0
  5. data/README.rdoc +32 -0
  6. data/Rakefile +144 -0
  7. data/bin/jax +11 -0
  8. data/builtin/shaders/basic/common.ejs +11 -0
  9. data/builtin/shaders/basic/fragment.ejs +5 -0
  10. data/builtin/shaders/basic/vertex.ejs +13 -0
  11. data/builtin/shaders/depthmap/common.ejs +1 -0
  12. data/builtin/shaders/depthmap/fragment.ejs +5 -0
  13. data/builtin/shaders/depthmap/vertex.ejs +7 -0
  14. data/builtin/shaders/fog/common.ejs +7 -0
  15. data/builtin/shaders/fog/fragment.ejs +23 -0
  16. data/builtin/shaders/fog/manifest.yml +12 -0
  17. data/builtin/shaders/fog/material.js +34 -0
  18. data/builtin/shaders/fog/vertex.ejs +10 -0
  19. data/builtin/shaders/functions/depth_map.ejs +24 -0
  20. data/builtin/shaders/functions/lights.ejs +155 -0
  21. data/builtin/shaders/lighting/common.ejs +5 -0
  22. data/builtin/shaders/lighting/fragment.ejs +34 -0
  23. data/builtin/shaders/lighting/manifest.yml +4 -0
  24. data/builtin/shaders/lighting/material.js +26 -0
  25. data/builtin/shaders/lighting/vertex.ejs +7 -0
  26. data/builtin/shaders/normal_map/common.ejs +12 -0
  27. data/builtin/shaders/normal_map/fragment.ejs +26 -0
  28. data/builtin/shaders/normal_map/manifest.yml +17 -0
  29. data/builtin/shaders/normal_map/material.js +16 -0
  30. data/builtin/shaders/normal_map/vertex.ejs +57 -0
  31. data/builtin/shaders/paraboloid-depthmap/common.ejs +6 -0
  32. data/builtin/shaders/paraboloid-depthmap/fragment.ejs +8 -0
  33. data/builtin/shaders/paraboloid-depthmap/material.js +15 -0
  34. data/builtin/shaders/paraboloid-depthmap/vertex.ejs +26 -0
  35. data/builtin/shaders/shadow_map/common.ejs +14 -0
  36. data/builtin/shaders/shadow_map/fragment.ejs +66 -0
  37. data/builtin/shaders/shadow_map/manifest.yml +1 -0
  38. data/builtin/shaders/shadow_map/material.js +26 -0
  39. data/builtin/shaders/shadow_map/vertex.ejs +46 -0
  40. data/builtin/shaders/texture/common.ejs +4 -0
  41. data/builtin/shaders/texture/fragment.ejs +11 -0
  42. data/builtin/shaders/texture/manifest.yml +17 -0
  43. data/builtin/shaders/texture/material.js +18 -0
  44. data/builtin/shaders/texture/vertex.ejs +9 -0
  45. data/guides/assets/images/book_icon.gif +0 -0
  46. data/guides/assets/images/bullet.gif +0 -0
  47. data/guides/assets/images/chapters_icon.gif +0 -0
  48. data/guides/assets/images/check_bullet.gif +0 -0
  49. data/guides/assets/images/credits_pic_blank.gif +0 -0
  50. data/guides/assets/images/edge_badge.png +0 -0
  51. data/guides/assets/images/feature_tile.gif +0 -0
  52. data/guides/assets/images/footer_tile.gif +0 -0
  53. data/guides/assets/images/getting_started/clean_passing_jasmine_suite.png +0 -0
  54. data/guides/assets/images/getting_started/rock.png +0 -0
  55. data/guides/assets/images/getting_started/rock_normal.png +0 -0
  56. data/guides/assets/images/grey_bullet.gif +0 -0
  57. data/guides/assets/images/header_backdrop.png +0 -0
  58. data/guides/assets/images/header_tile.gif +0 -0
  59. data/guides/assets/images/icons/README +5 -0
  60. data/guides/assets/images/icons/callouts/1.png +0 -0
  61. data/guides/assets/images/icons/callouts/10.png +0 -0
  62. data/guides/assets/images/icons/callouts/11.png +0 -0
  63. data/guides/assets/images/icons/callouts/12.png +0 -0
  64. data/guides/assets/images/icons/callouts/13.png +0 -0
  65. data/guides/assets/images/icons/callouts/14.png +0 -0
  66. data/guides/assets/images/icons/callouts/15.png +0 -0
  67. data/guides/assets/images/icons/callouts/2.png +0 -0
  68. data/guides/assets/images/icons/callouts/3.png +0 -0
  69. data/guides/assets/images/icons/callouts/4.png +0 -0
  70. data/guides/assets/images/icons/callouts/5.png +0 -0
  71. data/guides/assets/images/icons/callouts/6.png +0 -0
  72. data/guides/assets/images/icons/callouts/7.png +0 -0
  73. data/guides/assets/images/icons/callouts/8.png +0 -0
  74. data/guides/assets/images/icons/callouts/9.png +0 -0
  75. data/guides/assets/images/icons/caution.png +0 -0
  76. data/guides/assets/images/icons/example.png +0 -0
  77. data/guides/assets/images/icons/home.png +0 -0
  78. data/guides/assets/images/icons/important.png +0 -0
  79. data/guides/assets/images/icons/next.png +0 -0
  80. data/guides/assets/images/icons/note.png +0 -0
  81. data/guides/assets/images/icons/prev.png +0 -0
  82. data/guides/assets/images/icons/tip.png +0 -0
  83. data/guides/assets/images/icons/up.png +0 -0
  84. data/guides/assets/images/icons/warning.png +0 -0
  85. data/guides/assets/images/nav_arrow.gif +0 -0
  86. data/guides/assets/images/tab_grey.gif +0 -0
  87. data/guides/assets/images/tab_info.gif +0 -0
  88. data/guides/assets/images/tab_note.gif +0 -0
  89. data/guides/assets/images/tab_red.gif +0 -0
  90. data/guides/assets/images/tab_yellow.gif +0 -0
  91. data/guides/assets/images/tab_yellow.png +0 -0
  92. data/guides/assets/javascripts/guides.js +7 -0
  93. data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
  94. data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
  95. data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
  96. data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
  97. data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
  98. data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
  99. data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
  100. data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
  101. data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
  102. data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
  103. data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
  104. data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
  105. data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
  106. data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
  107. data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
  108. data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
  109. data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
  110. data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
  111. data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
  112. data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
  113. data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
  114. data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
  115. data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
  116. data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
  117. data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
  118. data/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
  119. data/guides/assets/stylesheets/fixes.css +16 -0
  120. data/guides/assets/stylesheets/main.css +445 -0
  121. data/guides/assets/stylesheets/print.css +52 -0
  122. data/guides/assets/stylesheets/reset.css +43 -0
  123. data/guides/assets/stylesheets/style.css +13 -0
  124. data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
  125. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
  126. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
  127. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
  128. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
  129. data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  130. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
  131. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
  132. data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
  133. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
  134. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
  135. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
  136. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
  137. data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  138. data/guides/assets/stylesheets/syntaxhighlighter/shThemeJaxGuides.css +116 -0
  139. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
  140. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
  141. data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
  142. data/guides/jax_guides.rb +41 -0
  143. data/guides/jax_guides/common.rb +7 -0
  144. data/guides/jax_guides/generator.rb +287 -0
  145. data/guides/jax_guides/helpers.rb +29 -0
  146. data/guides/jax_guides/indexer.rb +69 -0
  147. data/guides/jax_guides/levenshtein.rb +31 -0
  148. data/guides/jax_guides/textile_extensions.rb +61 -0
  149. data/guides/source/getting_started.textile +1171 -0
  150. data/guides/source/index.html.erb +50 -0
  151. data/guides/source/layout.html.erb +158 -0
  152. data/guides/source/lighting.textile +5 -0
  153. data/guides/source/materials.textile +5 -0
  154. data/guides/source/shaders.textile +5 -0
  155. data/guides/source/testing.textile +5 -0
  156. data/guides/w3c_validator.rb +91 -0
  157. data/jax.gems +1 -0
  158. data/jax.gemspec +40 -0
  159. data/lib/jax.rb +28 -0
  160. data/lib/jax/application.rb +92 -0
  161. data/lib/jax/application/configuration.rb +27 -0
  162. data/lib/jax/generators/app.rb +17 -0
  163. data/lib/jax/generators/app/app_generator.rb +78 -0
  164. data/lib/jax/generators/app/templates/Gemfile.tt +3 -0
  165. data/lib/jax/generators/app/templates/Rakefile +6 -0
  166. data/lib/jax/generators/app/templates/app/controllers/application_controller.js.tt +5 -0
  167. data/lib/jax/generators/app/templates/app/helpers/application_helper.js.tt +3 -0
  168. data/lib/jax/generators/app/templates/app/models/.empty_directory +0 -0
  169. data/lib/jax/generators/app/templates/app/resources/.empty_directory +0 -0
  170. data/lib/jax/generators/app/templates/app/views/.empty_directory +0 -0
  171. data/lib/jax/generators/app/templates/config/application.rb.tt +6 -0
  172. data/lib/jax/generators/app/templates/config/boot.rb +13 -0
  173. data/lib/jax/generators/app/templates/config/routes.rb.tt +5 -0
  174. data/lib/jax/generators/app/templates/public/javascripts/jax.js +7561 -0
  175. data/lib/jax/generators/app/templates/public/webgl_not_supported.html +26 -0
  176. data/lib/jax/generators/app/templates/script/jax +7 -0
  177. data/lib/jax/generators/app/templates/spec/javascripts/controllers/application_controller_spec.js +11 -0
  178. data/lib/jax/generators/app/templates/spec/javascripts/helpers/application_helper_spec.js +12 -0
  179. data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine.yml +90 -0
  180. data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine_config.rb +23 -0
  181. data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine_runner.rb +32 -0
  182. data/lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_helper.js +216 -0
  183. data/lib/jax/generators/app/templates/spec/javascripts/support/spec_layout.html.erb +63 -0
  184. data/lib/jax/generators/commands.rb +81 -0
  185. data/lib/jax/generators/controller/USAGE +9 -0
  186. data/lib/jax/generators/controller/controller_generator.rb +59 -0
  187. data/lib/jax/generators/controller/templates/controller_source.js.tt +16 -0
  188. data/lib/jax/generators/controller/templates/controller_test.js.tt +11 -0
  189. data/lib/jax/generators/controller/templates/helper.js.tt +3 -0
  190. data/lib/jax/generators/controller/templates/helper_test.js.tt +12 -0
  191. data/lib/jax/generators/controller/templates/view.js.tt +4 -0
  192. data/lib/jax/generators/light_source/USAGE +14 -0
  193. data/lib/jax/generators/light_source/light_source_generator.rb +47 -0
  194. data/lib/jax/generators/light_source/templates/light.yml.tt +39 -0
  195. data/lib/jax/generators/material/USAGE +29 -0
  196. data/lib/jax/generators/material/material_generator.rb +81 -0
  197. data/lib/jax/generators/material/templates/append.yml.tt +7 -0
  198. data/lib/jax/generators/material/templates/material.yml.tt +33 -0
  199. data/lib/jax/generators/model/USAGE +5 -0
  200. data/lib/jax/generators/model/model_generator.rb +42 -0
  201. data/lib/jax/generators/model/templates/model.js.tt +11 -0
  202. data/lib/jax/generators/model/templates/test.js.tt +11 -0
  203. data/lib/jax/generators/script_jax_loader.rb +32 -0
  204. data/lib/jax/monkeypatch/jasmine.rb +3 -0
  205. data/lib/jax/monkeypatch/jasmine/config.rb +21 -0
  206. data/lib/jax/monkeypatch/jasmine/server.rb +50 -0
  207. data/lib/jax/packager.rb +58 -0
  208. data/lib/jax/packager/sprockets_template.rb +49 -0
  209. data/lib/jax/resource_compiler.rb +50 -0
  210. data/lib/jax/routes.rb +61 -0
  211. data/lib/jax/shader.rb +158 -0
  212. data/lib/jax/tasks/rake.rb +34 -0
  213. data/lib/jax/version.rb +12 -0
  214. data/public/images/brickwall.jpg +0 -0
  215. data/public/images/jacks.jpg +0 -0
  216. data/public/images/normal_map.jpg +0 -0
  217. data/public/images/rock.png +0 -0
  218. data/public/images/rockNormal.png +0 -0
  219. data/public/images/rss.png +0 -0
  220. data/public/webgl_not_supported.html +26 -0
  221. data/spec/example_app/Gemfile +1 -0
  222. data/spec/example_app/Rakefile +15 -0
  223. data/spec/example_app/app/controllers/application_controller.js +5 -0
  224. data/spec/example_app/app/controllers/courthouse_controller.js +24 -0
  225. data/spec/example_app/app/controllers/lighting_controller.js +69 -0
  226. data/spec/example_app/app/controllers/shadows_controller.js +130 -0
  227. data/spec/example_app/app/controllers/textures_controller.js +52 -0
  228. data/spec/example_app/app/helpers/application_helper.js +3 -0
  229. data/spec/example_app/app/helpers/textures_helper.js +3 -0
  230. data/spec/example_app/app/models/character.js +23 -0
  231. data/spec/example_app/app/models/door.js +10 -0
  232. data/spec/example_app/app/models/scene.js +19 -0
  233. data/spec/example_app/app/resources/characters/judge.yml +3 -0
  234. data/spec/example_app/app/resources/doors/courthouse_door.yml +5 -0
  235. data/spec/example_app/app/resources/light_sources/directional_light.yml +13 -0
  236. data/spec/example_app/app/resources/light_sources/point_light.yml +31 -0
  237. data/spec/example_app/app/resources/light_sources/spot_light.yml +15 -0
  238. data/spec/example_app/app/resources/light_sources/sun.yml +7 -0
  239. data/spec/example_app/app/resources/light_sources/textures_point.yml +34 -0
  240. data/spec/example_app/app/resources/materials/bricks.yml +36 -0
  241. data/spec/example_app/app/resources/materials/lighting_with_shadows.yml +27 -0
  242. data/spec/example_app/app/resources/scenes/courthouse.yml +4 -0
  243. data/spec/example_app/app/views/courthouse/index.js +4 -0
  244. data/spec/example_app/app/views/lighting/index.js +4 -0
  245. data/spec/example_app/app/views/shadows/index.js +6 -0
  246. data/spec/example_app/app/views/textures/index.js +4 -0
  247. data/spec/example_app/config/application.rb +6 -0
  248. data/spec/example_app/config/boot.rb +13 -0
  249. data/spec/example_app/config/routes.rb +6 -0
  250. data/spec/example_app/public/images/185__normalmap.png +0 -0
  251. data/spec/example_app/public/images/face_norm.jpg +0 -0
  252. data/spec/example_app/public/images/rock.png +0 -0
  253. data/spec/example_app/public/images/rockNormal.png +0 -0
  254. data/spec/example_app/public/images/rss.png +0 -0
  255. data/spec/example_app/public/webgl_not_supported.html +26 -0
  256. data/spec/example_app/script/jax +7 -0
  257. data/spec/example_app/spec/javascripts/controllers/textures_controller_spec.js +11 -0
  258. data/spec/example_app/spec/javascripts/helpers/application_helper_spec.js +12 -0
  259. data/spec/example_app/spec/javascripts/resources/directional_light_spec.js +16 -0
  260. data/spec/example_app/spec/javascripts/resources/point_light_spec.js +17 -0
  261. data/spec/example_app/spec/javascripts/resources/spot_light_spec.js +18 -0
  262. data/spec/example_app/spec/javascripts/support/jasmine.yml +89 -0
  263. data/spec/example_app/spec/javascripts/support/jasmine_runner.rb +32 -0
  264. data/spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js +93 -0
  265. data/spec/example_app/spec/javascripts/support/spec_layout.html.erb +84 -0
  266. data/spec/generators/app_generator_spec.rb +46 -0
  267. data/spec/generators/controller_generator_spec.rb +68 -0
  268. data/spec/generators/light_generator_spec.rb +51 -0
  269. data/spec/generators/material_generator_spec.rb +35 -0
  270. data/spec/generators/model_generator_spec.rb +43 -0
  271. data/spec/javascripts/Player.js +58 -0
  272. data/spec/javascripts/helpers/SpecHelper.js +216 -0
  273. data/spec/javascripts/jax/builtin/materials/core_materials_spec.js +41 -0
  274. data/spec/javascripts/jax/builtin/materials/dual_paraboloid_spec.js +37 -0
  275. data/spec/javascripts/jax/builtin/materials/fog_spec.js +19 -0
  276. data/spec/javascripts/jax/builtin/materials/lighting_spec.js +19 -0
  277. data/spec/javascripts/jax/builtin/materials/normal_map_spec.js +19 -0
  278. data/spec/javascripts/jax/builtin/materials/shadow_map_spec.js +19 -0
  279. data/spec/javascripts/jax/builtin/materials/texture_spec.js +19 -0
  280. data/spec/javascripts/jax/builtin/meshes/cube_spec.js +10 -0
  281. data/spec/javascripts/jax/builtin/meshes/plane_spec.js +8 -0
  282. data/spec/javascripts/jax/builtin/meshes/quad_spec.js +8 -0
  283. data/spec/javascripts/jax/builtin/meshes/sphere_spec.js +8 -0
  284. data/spec/javascripts/jax/builtin/meshes/teapot_spec.js +8 -0
  285. data/spec/javascripts/jax/builtin/meshes/torus_spec.js +8 -0
  286. data/spec/javascripts/jax/compatibility_spec.js +50 -0
  287. data/spec/javascripts/jax/context_spec.js +82 -0
  288. data/spec/javascripts/jax/controller_spec.js +145 -0
  289. data/spec/javascripts/jax/core/delegation_spec.js +48 -0
  290. data/spec/javascripts/jax/core/events_spec.js +17 -0
  291. data/spec/javascripts/jax/core/matrix_stack_spec.js +28 -0
  292. data/spec/javascripts/jax/core/utils_spec.js +256 -0
  293. data/spec/javascripts/jax/helper_spec.js +33 -0
  294. data/spec/javascripts/jax/model_spec.js +87 -0
  295. data/spec/javascripts/jax/optimizations/material_limitations_spec.js +87 -0
  296. data/spec/javascripts/jax/optimizations/shaders/basic_spec.js +68 -0
  297. data/spec/javascripts/jax/prototype/extensions_spec.js +34 -0
  298. data/spec/javascripts/jax/route_set_spec.js +67 -0
  299. data/spec/javascripts/jax/view_manager_spec.js +17 -0
  300. data/spec/javascripts/jax/webgl/camera_spec.js +159 -0
  301. data/spec/javascripts/jax/webgl/framebuffer_spec.js +46 -0
  302. data/spec/javascripts/jax/webgl/lighting_spec.js +61 -0
  303. data/spec/javascripts/jax/webgl/material_spec.js +118 -0
  304. data/spec/javascripts/jax/webgl/mesh_spec.js +86 -0
  305. data/spec/javascripts/jax/webgl/shader/manifest_spec.js +60 -0
  306. data/spec/javascripts/jax/webgl/shader_chain_spec.js +192 -0
  307. data/spec/javascripts/jax/webgl/shader_spec.js +276 -0
  308. data/spec/javascripts/jax/webgl/tangent_space_spec.js +142 -0
  309. data/spec/javascripts/jax/webgl/texture_spec.js +162 -0
  310. data/spec/javascripts/jax/webgl_spec.js +5 -0
  311. data/spec/javascripts/jax/world_spec.js +88 -0
  312. data/spec/javascripts/jax_spec.js +27 -0
  313. data/spec/javascripts/support/jasmine.yml +85 -0
  314. data/spec/javascripts/support/jasmine_runner.rb +32 -0
  315. data/spec/lib/jax/routes_spec.rb +24 -0
  316. data/spec/lib/jax/shader_spec.rb +57 -0
  317. data/spec/lib/jax/tasks/jax_rake_spec.rb +79 -0
  318. data/spec/spec_helper.rb +11 -0
  319. data/spec/support/file_exist_matcher.rb +23 -0
  320. data/spec/support/spec_shell.rb +97 -0
  321. data/src/jax.js +84 -0
  322. data/src/jax/anim_frame.js +47 -0
  323. data/src/jax/builtin/all.js +7 -0
  324. data/src/jax/builtin/meshes/cube.js +62 -0
  325. data/src/jax/builtin/meshes/plane.js +36 -0
  326. data/src/jax/builtin/meshes/quad.js +80 -0
  327. data/src/jax/builtin/meshes/sphere.js +46 -0
  328. data/src/jax/builtin/meshes/teapot.js +38 -0
  329. data/src/jax/builtin/meshes/torus.js +46 -0
  330. data/src/jax/compatibility.js +140 -0
  331. data/src/jax/context.js +253 -0
  332. data/src/jax/controller.js +157 -0
  333. data/src/jax/core.js +39 -0
  334. data/src/jax/core/math.js +40 -0
  335. data/src/jax/core/matrix_stack.js +306 -0
  336. data/src/jax/core/util.js +226 -0
  337. data/src/jax/events.js +179 -0
  338. data/src/jax/geometry.js +3 -0
  339. data/src/jax/geometry/plane.js +59 -0
  340. data/src/jax/helper.js +8 -0
  341. data/src/jax/model.js +163 -0
  342. data/src/jax/prototype/class.js +78 -0
  343. data/src/jax/prototype/core.js +112 -0
  344. data/src/jax/prototype/extensions.js +124 -0
  345. data/src/jax/route_set.js +125 -0
  346. data/src/jax/vendor/ejs.js +4 -0
  347. data/src/jax/vendor/glMatrix.js +3 -0
  348. data/src/jax/view.js +37 -0
  349. data/src/jax/view_manager.js +46 -0
  350. data/src/jax/webgl.js +98 -0
  351. data/src/jax/webgl/camera.js +526 -0
  352. data/src/jax/webgl/core.js +6 -0
  353. data/src/jax/webgl/core/buffer.js +161 -0
  354. data/src/jax/webgl/core/edge.js +6 -0
  355. data/src/jax/webgl/core/events.js +25 -0
  356. data/src/jax/webgl/core/face.js +8 -0
  357. data/src/jax/webgl/core/framebuffer.js +206 -0
  358. data/src/jax/webgl/material.js +375 -0
  359. data/src/jax/webgl/mesh.js +412 -0
  360. data/src/jax/webgl/scene.js +11 -0
  361. data/src/jax/webgl/scene/frustum.js +260 -0
  362. data/src/jax/webgl/scene/light_manager.js +112 -0
  363. data/src/jax/webgl/scene/light_source.js +248 -0
  364. data/src/jax/webgl/shader.js +282 -0
  365. data/src/jax/webgl/shader/delegator.js +13 -0
  366. data/src/jax/webgl/shader/delegator/attribute.js +53 -0
  367. data/src/jax/webgl/shader/delegator/uniform.js +71 -0
  368. data/src/jax/webgl/shader/manifest.js +64 -0
  369. data/src/jax/webgl/shader/program.js +140 -0
  370. data/src/jax/webgl/shader_chain.js +256 -0
  371. data/src/jax/webgl/texture.js +312 -0
  372. data/src/jax/webgl/world.js +119 -0
  373. data/vendor/ejs/.svn/all-wcprops +17 -0
  374. data/vendor/ejs/.svn/entries +114 -0
  375. data/vendor/ejs/.svn/text-base/Eratta.txt.svn-base +3 -0
  376. data/vendor/ejs/.svn/text-base/license.txt.svn-base +21 -0
  377. data/vendor/ejs/Eratta.txt +3 -0
  378. data/vendor/ejs/example/.svn/all-wcprops +29 -0
  379. data/vendor/ejs/example/.svn/entries +164 -0
  380. data/vendor/ejs/example/.svn/prop-base/ejs.gif.svn-base +5 -0
  381. data/vendor/ejs/example/.svn/text-base/demo.html.svn-base +54 -0
  382. data/vendor/ejs/example/.svn/text-base/ejs.gif.svn-base +0 -0
  383. data/vendor/ejs/example/.svn/text-base/example.css.svn-base +31 -0
  384. data/vendor/ejs/example/.svn/text-base/example.js.svn-base +88 -0
  385. data/vendor/ejs/example/demo.html +54 -0
  386. data/vendor/ejs/example/ejs.gif +0 -0
  387. data/vendor/ejs/example/example.css +31 -0
  388. data/vendor/ejs/example/example.js +88 -0
  389. data/vendor/ejs/lib/.svn/all-wcprops +11 -0
  390. data/vendor/ejs/lib/.svn/entries +62 -0
  391. data/vendor/ejs/lib/.svn/text-base/ejs_fulljslint.js.svn-base +3774 -0
  392. data/vendor/ejs/lib/ejs_fulljslint.js +3774 -0
  393. data/vendor/ejs/license.txt +21 -0
  394. data/vendor/ejs/script/.svn/all-wcprops +17 -0
  395. data/vendor/ejs/script/.svn/entries +96 -0
  396. data/vendor/ejs/script/.svn/prop-base/yuicompressor-2.2.4.jar.svn-base +5 -0
  397. data/vendor/ejs/script/.svn/text-base/production.bat.svn-base +4 -0
  398. data/vendor/ejs/script/.svn/text-base/yuicompressor-2.2.4.jar.svn-base +0 -0
  399. data/vendor/ejs/script/production.bat +4 -0
  400. data/vendor/ejs/script/yuicompressor-2.2.4.jar +0 -0
  401. data/vendor/ejs/src/.svn/all-wcprops +17 -0
  402. data/vendor/ejs/src/.svn/entries +96 -0
  403. data/vendor/ejs/src/.svn/text-base/ejs.js.svn-base +505 -0
  404. data/vendor/ejs/src/.svn/text-base/view.js.svn-base +200 -0
  405. data/vendor/ejs/src/ejs.js +505 -0
  406. data/vendor/ejs/src/view.js +200 -0
  407. data/vendor/ejs/test/.svn/all-wcprops +23 -0
  408. data/vendor/ejs/test/.svn/entries +139 -0
  409. data/vendor/ejs/test/.svn/text-base/index.html.svn-base +18 -0
  410. data/vendor/ejs/test/.svn/text-base/setup_test.html.svn-base +44 -0
  411. data/vendor/ejs/test/.svn/text-base/sidebar.html.svn-base +28 -0
  412. data/vendor/ejs/test/included/.svn/all-wcprops +23 -0
  413. data/vendor/ejs/test/included/.svn/entries +130 -0
  414. data/vendor/ejs/test/included/.svn/text-base/prototype.js.svn-base +4184 -0
  415. data/vendor/ejs/test/included/.svn/text-base/test.css.svn-base +44 -0
  416. data/vendor/ejs/test/included/.svn/text-base/unittest.js.svn-base +564 -0
  417. data/vendor/ejs/test/included/prototype.js +4184 -0
  418. data/vendor/ejs/test/included/test.css +44 -0
  419. data/vendor/ejs/test/included/unittest.js +564 -0
  420. data/vendor/ejs/test/index.html +18 -0
  421. data/vendor/ejs/test/setup_test.html +44 -0
  422. data/vendor/ejs/test/sidebar.html +28 -0
  423. data/vendor/ejs/test/templates/.svn/all-wcprops +11 -0
  424. data/vendor/ejs/test/templates/.svn/entries +62 -0
  425. data/vendor/ejs/test/templates/.svn/text-base/test.ejs.svn-base +3 -0
  426. data/vendor/ejs/test/templates/test.ejs +3 -0
  427. data/vendor/ejs/test/tests/.svn/all-wcprops +23 -0
  428. data/vendor/ejs/test/tests/.svn/entries +130 -0
  429. data/vendor/ejs/test/tests/.svn/text-base/rendering.js.svn-base +94 -0
  430. data/vendor/ejs/test/tests/.svn/text-base/templating.js.svn-base +43 -0
  431. data/vendor/ejs/test/tests/.svn/text-base/views.js.svn-base +100 -0
  432. data/vendor/ejs/test/tests/rendering.js +94 -0
  433. data/vendor/ejs/test/tests/templating.js +43 -0
  434. data/vendor/ejs/test/tests/views.js +100 -0
  435. data/vendor/glmatrix/benchmark/js/CanvasMatrix.js +722 -0
  436. data/vendor/glmatrix/benchmark/js/EWGL_math.js +742 -0
  437. data/vendor/glmatrix/benchmark/js/mjs.js +1230 -0
  438. data/vendor/glmatrix/benchmark/matrix_benchmark.html +419 -0
  439. data/vendor/glmatrix/glMatrix-min.js +32 -0
  440. data/vendor/glmatrix/glMatrix.js +1815 -0
  441. data/vendor/glmatrix/unit tests/glMatrix-test.js +74 -0
  442. data/vendor/glmatrix/unit tests/qunit.css +119 -0
  443. data/vendor/glmatrix/unit tests/qunit.js +1069 -0
  444. data/vendor/glmatrix/unit tests/test_glMatrix.html +21 -0
  445. data/vendor/yuicompressor-2.4.2.jar +0 -0
  446. metadata +748 -0
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Test glMatrix using qunit.js/qunit.css.
3
+ */
4
+
5
+ var glMatrix_runtests = function() {
6
+
7
+ module("Test glMatrix routines");
8
+
9
+ test("vec3",function () {
10
+
11
+ var v1 = vec3.create();
12
+
13
+ ok(v1,"vec3.create()");
14
+ equals(v1[0],0,"first component 0");
15
+ equals(v1[1],0,"second component 0");
16
+ equals(v1[2],0,"third component 0");
17
+
18
+ var v2 = vec3.create([1,2,3]);
19
+ equals(v2[0],1,"set first component in vec3.create");
20
+ equals(v2[1],2,"set second component in vec3.create");
21
+ equals(v2[2],3,"set third component in vec3.create");
22
+
23
+ vec3.set([4,5,6],v2);
24
+ equals(v2[0],4,"set first component");
25
+ equals(v2[1],5,"set second component");
26
+ equals(v2[2],6,"set third component");
27
+
28
+
29
+ });
30
+
31
+ test("mat3",function () {
32
+
33
+ });
34
+
35
+ test("mat4",function () {
36
+
37
+ var i,j;
38
+
39
+ var m1 = mat4.create();
40
+
41
+ var ident = mat4.identity(m1);
42
+ ok(ident,"identity matrix");
43
+
44
+ function testIdentity(m) {
45
+ for (i = 0 ; i < 4 ; i++) {
46
+ for (j = 0 ; j < 4 ; j++) {
47
+ if (m[i + 4*j] !=(i==j ? 1.0 : 0.0) )
48
+ return false;
49
+ }
50
+ return true;
51
+ }
52
+
53
+
54
+ }
55
+
56
+ ok(testIdentity(ident),"identity matrix");
57
+
58
+ try {
59
+ mat4.lookAt([0,0,0],[0,0,0],[0,1,0],m1)
60
+ } catch (e) {
61
+ ok(false, "we shouldn't have died here");
62
+ }});
63
+
64
+
65
+ test("quat4",function () {
66
+
67
+ });
68
+ }
69
+
70
+
71
+
72
+
73
+
74
+
@@ -0,0 +1,119 @@
1
+
2
+ ol#qunit-tests {
3
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
4
+ margin:0;
5
+ padding:0;
6
+ list-style-position:inside;
7
+
8
+ font-size: smaller;
9
+ }
10
+ ol#qunit-tests li{
11
+ padding:0.4em 0.5em 0.4em 2.5em;
12
+ border-bottom:1px solid #fff;
13
+ font-size:small;
14
+ list-style-position:inside;
15
+ }
16
+ ol#qunit-tests li ol{
17
+ box-shadow: inset 0px 2px 13px #999;
18
+ -moz-box-shadow: inset 0px 2px 13px #999;
19
+ -webkit-box-shadow: inset 0px 2px 13px #999;
20
+ margin-top:0.5em;
21
+ margin-left:0;
22
+ padding:0.5em;
23
+ background-color:#fff;
24
+ border-radius:15px;
25
+ -moz-border-radius: 15px;
26
+ -webkit-border-radius: 15px;
27
+ }
28
+ ol#qunit-tests li li{
29
+ border-bottom:none;
30
+ margin:0.5em;
31
+ background-color:#fff;
32
+ list-style-position: inside;
33
+ padding:0.4em 0.5em 0.4em 0.5em;
34
+ }
35
+
36
+ ol#qunit-tests li li.pass{
37
+ border-left:26px solid #C6E746;
38
+ background-color:#fff;
39
+ color:#5E740B;
40
+ }
41
+ ol#qunit-tests li li.fail{
42
+ border-left:26px solid #EE5757;
43
+ background-color:#fff;
44
+ color:#710909;
45
+ }
46
+ ol#qunit-tests li.pass{
47
+ background-color:#D2E0E6;
48
+ color:#528CE0;
49
+ }
50
+ ol#qunit-tests li.fail{
51
+ background-color:#EE5757;
52
+ color:#000;
53
+ }
54
+ ol#qunit-tests li strong {
55
+ cursor:pointer;
56
+ }
57
+ h1#qunit-header{
58
+ background-color:#0d3349;
59
+ margin:0;
60
+ padding:0.5em 0 0.5em 1em;
61
+ color:#fff;
62
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
63
+ border-top-right-radius:15px;
64
+ border-top-left-radius:15px;
65
+ -moz-border-radius-topright:15px;
66
+ -moz-border-radius-topleft:15px;
67
+ -webkit-border-top-right-radius:15px;
68
+ -webkit-border-top-left-radius:15px;
69
+ text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;
70
+ }
71
+ h2#qunit-banner{
72
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
73
+ height:5px;
74
+ margin:0;
75
+ padding:0;
76
+ }
77
+ h2#qunit-banner.qunit-pass{
78
+ background-color:#C6E746;
79
+ }
80
+ h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar {
81
+ background-color:#EE5757;
82
+ }
83
+ #qunit-testrunner-toolbar {
84
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
85
+ padding:0;
86
+ /*width:80%;*/
87
+ padding:0em 0 0.5em 2em;
88
+ font-size: small;
89
+ }
90
+ h2#qunit-userAgent {
91
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
92
+ background-color:#2b81af;
93
+ margin:0;
94
+ padding:0;
95
+ color:#fff;
96
+ font-size: small;
97
+ padding:0.5em 0 0.5em 2.5em;
98
+ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
99
+ }
100
+ p#qunit-testresult{
101
+ font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
102
+ margin:0;
103
+ font-size: small;
104
+ color:#2b81af;
105
+ border-bottom-right-radius:15px;
106
+ border-bottom-left-radius:15px;
107
+ -moz-border-radius-bottomright:15px;
108
+ -moz-border-radius-bottomleft:15px;
109
+ -webkit-border-bottom-right-radius:15px;
110
+ -webkit-border-bottom-left-radius:15px;
111
+ background-color:#D2E0E6;
112
+ padding:0.5em 0.5em 0.5em 2.5em;
113
+ }
114
+ strong b.fail{
115
+ color:#710909;
116
+ }
117
+ strong b.pass{
118
+ color:#5E740B;
119
+ }
@@ -0,0 +1,1069 @@
1
+ /*
2
+ * QUnit - A JavaScript Unit Testing Framework
3
+ *
4
+ * http://docs.jquery.com/QUnit
5
+ *
6
+ * Copyright (c) 2009 John Resig, Jörn Zaefferer
7
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
8
+ * and GPL (GPL-LICENSE.txt) licenses.
9
+ */
10
+
11
+ (function(window) {
12
+
13
+ var QUnit = {
14
+
15
+ // Initialize the configuration options
16
+ init: function() {
17
+ config = {
18
+ stats: { all: 0, bad: 0 },
19
+ moduleStats: { all: 0, bad: 0 },
20
+ started: +new Date,
21
+ updateRate: 1000,
22
+ blocking: false,
23
+ autorun: false,
24
+ assertions: [],
25
+ filters: [],
26
+ queue: []
27
+ };
28
+
29
+ var tests = id("qunit-tests"),
30
+ banner = id("qunit-banner"),
31
+ result = id("qunit-testresult");
32
+
33
+ if ( tests ) {
34
+ tests.innerHTML = "";
35
+ }
36
+
37
+ if ( banner ) {
38
+ banner.className = "";
39
+ }
40
+
41
+ if ( result ) {
42
+ result.parentNode.removeChild( result );
43
+ }
44
+ },
45
+
46
+ // call on start of module test to prepend name to all tests
47
+ module: function(name, testEnvironment) {
48
+ config.currentModule = name;
49
+
50
+ synchronize(function() {
51
+ if ( config.currentModule ) {
52
+ QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
53
+ }
54
+
55
+ config.currentModule = name;
56
+ config.moduleTestEnvironment = testEnvironment;
57
+ config.moduleStats = { all: 0, bad: 0 };
58
+
59
+ QUnit.moduleStart( name, testEnvironment );
60
+ });
61
+ },
62
+
63
+ asyncTest: function(testName, expected, callback) {
64
+ if ( arguments.length === 2 ) {
65
+ callback = expected;
66
+ expected = 0;
67
+ }
68
+
69
+ QUnit.test(testName, expected, callback, true);
70
+ },
71
+
72
+ test: function(testName, expected, callback, async) {
73
+ var name = testName, testEnvironment, testEnvironmentArg;
74
+
75
+ if ( arguments.length === 2 ) {
76
+ callback = expected;
77
+ expected = null;
78
+ }
79
+ // is 2nd argument a testEnvironment?
80
+ if ( expected && typeof expected === 'object') {
81
+ testEnvironmentArg = expected;
82
+ expected = null;
83
+ }
84
+
85
+ if ( config.currentModule ) {
86
+ name = config.currentModule + " module: " + name;
87
+ }
88
+
89
+ if ( !validTest(name) ) {
90
+ return;
91
+ }
92
+
93
+ synchronize(function() {
94
+ QUnit.testStart( testName );
95
+
96
+ testEnvironment = extend({
97
+ setup: function() {},
98
+ teardown: function() {}
99
+ }, config.moduleTestEnvironment);
100
+ if (testEnvironmentArg) {
101
+ extend(testEnvironment,testEnvironmentArg);
102
+ }
103
+
104
+ // allow utility functions to access the current test environment
105
+ QUnit.current_testEnvironment = testEnvironment;
106
+
107
+ config.assertions = [];
108
+ config.expected = expected;
109
+
110
+ try {
111
+ if ( !config.pollution ) {
112
+ saveGlobal();
113
+ }
114
+
115
+ testEnvironment.setup.call(testEnvironment);
116
+ } catch(e) {
117
+ QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
118
+ }
119
+
120
+ if ( async ) {
121
+ QUnit.stop();
122
+ }
123
+
124
+ try {
125
+ callback.call(testEnvironment);
126
+ } catch(e) {
127
+ fail("Test " + name + " died, exception and test follows", e, callback);
128
+ QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );
129
+ // else next test will carry the responsibility
130
+ saveGlobal();
131
+
132
+ // Restart the tests if they're blocking
133
+ if ( config.blocking ) {
134
+ start();
135
+ }
136
+ }
137
+ });
138
+
139
+ synchronize(function() {
140
+ try {
141
+ checkPollution();
142
+ testEnvironment.teardown.call(testEnvironment);
143
+ } catch(e) {
144
+ QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
145
+ }
146
+
147
+ try {
148
+ QUnit.reset();
149
+ } catch(e) {
150
+ fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);
151
+ }
152
+
153
+ if ( config.expected && config.expected != config.assertions.length ) {
154
+ QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );
155
+ }
156
+
157
+ var good = 0, bad = 0,
158
+ tests = id("qunit-tests");
159
+
160
+ config.stats.all += config.assertions.length;
161
+ config.moduleStats.all += config.assertions.length;
162
+
163
+ if ( tests ) {
164
+ var ol = document.createElement("ol");
165
+ ol.style.display = "none";
166
+
167
+ for ( var i = 0; i < config.assertions.length; i++ ) {
168
+ var assertion = config.assertions[i];
169
+
170
+ var li = document.createElement("li");
171
+ li.className = assertion.result ? "pass" : "fail";
172
+ li.appendChild(document.createTextNode(assertion.message || "(no message)"));
173
+ ol.appendChild( li );
174
+
175
+ if ( assertion.result ) {
176
+ good++;
177
+ } else {
178
+ bad++;
179
+ config.stats.bad++;
180
+ config.moduleStats.bad++;
181
+ }
182
+ }
183
+
184
+ var b = document.createElement("strong");
185
+ b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>";
186
+
187
+ addEvent(b, "click", function() {
188
+ var next = b.nextSibling, display = next.style.display;
189
+ next.style.display = display === "none" ? "block" : "none";
190
+ });
191
+
192
+ addEvent(b, "dblclick", function(e) {
193
+ var target = e && e.target ? e.target : window.event.srcElement;
194
+ if ( target.nodeName.toLowerCase() === "strong" ) {
195
+ var text = "", node = target.firstChild;
196
+
197
+ while ( node.nodeType === 3 ) {
198
+ text += node.nodeValue;
199
+ node = node.nextSibling;
200
+ }
201
+
202
+ text = text.replace(/(^\s*|\s*$)/g, "");
203
+
204
+ if ( window.location ) {
205
+ window.location.href = window.location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent(text);
206
+ }
207
+ }
208
+ });
209
+
210
+ var li = document.createElement("li");
211
+ li.className = bad ? "fail" : "pass";
212
+ li.appendChild( b );
213
+ li.appendChild( ol );
214
+ tests.appendChild( li );
215
+
216
+ if ( bad ) {
217
+ var toolbar = id("qunit-testrunner-toolbar");
218
+ if ( toolbar ) {
219
+ toolbar.style.display = "block";
220
+ id("qunit-filter-pass").disabled = null;
221
+ id("qunit-filter-missing").disabled = null;
222
+ }
223
+ }
224
+
225
+ } else {
226
+ for ( var i = 0; i < config.assertions.length; i++ ) {
227
+ if ( !config.assertions[i].result ) {
228
+ bad++;
229
+ config.stats.bad++;
230
+ config.moduleStats.bad++;
231
+ }
232
+ }
233
+ }
234
+
235
+ QUnit.testDone( testName, bad, config.assertions.length );
236
+
237
+ if ( !window.setTimeout && !config.queue.length ) {
238
+ done();
239
+ }
240
+ });
241
+
242
+ if ( window.setTimeout && !config.doneTimer ) {
243
+ config.doneTimer = window.setTimeout(function(){
244
+ if ( !config.queue.length ) {
245
+ done();
246
+ } else {
247
+ synchronize( done );
248
+ }
249
+ }, 13);
250
+ }
251
+ },
252
+
253
+ /**
254
+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
255
+ */
256
+ expect: function(asserts) {
257
+ config.expected = asserts;
258
+ },
259
+
260
+ /**
261
+ * Asserts true.
262
+ * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
263
+ */
264
+ ok: function(a, msg) {
265
+ QUnit.log(a, msg);
266
+
267
+ config.assertions.push({
268
+ result: !!a,
269
+ message: msg
270
+ });
271
+ },
272
+
273
+ /**
274
+ * Checks that the first two arguments are equal, with an optional message.
275
+ * Prints out both actual and expected values.
276
+ *
277
+ * Prefered to ok( actual == expected, message )
278
+ *
279
+ * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
280
+ *
281
+ * @param Object actual
282
+ * @param Object expected
283
+ * @param String message (optional)
284
+ */
285
+ equal: function(actual, expected, message) {
286
+ push(expected == actual, actual, expected, message);
287
+ },
288
+
289
+ notEqual: function(actual, expected, message) {
290
+ push(expected != actual, actual, expected, message);
291
+ },
292
+
293
+ deepEqual: function(a, b, message) {
294
+ push(QUnit.equiv(a, b), a, b, message);
295
+ },
296
+
297
+ notDeepEqual: function(a, b, message) {
298
+ push(!QUnit.equiv(a, b), a, b, message);
299
+ },
300
+
301
+ strictEqual: function(actual, expected, message) {
302
+ push(expected === actual, actual, expected, message);
303
+ },
304
+
305
+ notStrictEqual: function(actual, expected, message) {
306
+ push(expected !== actual, actual, expected, message);
307
+ },
308
+
309
+ start: function() {
310
+ // A slight delay, to avoid any current callbacks
311
+ if ( window.setTimeout ) {
312
+ window.setTimeout(function() {
313
+ if ( config.timeout ) {
314
+ clearTimeout(config.timeout);
315
+ }
316
+
317
+ config.blocking = false;
318
+ process();
319
+ }, 13);
320
+ } else {
321
+ config.blocking = false;
322
+ process();
323
+ }
324
+ },
325
+
326
+ stop: function(timeout) {
327
+ config.blocking = true;
328
+
329
+ if ( timeout && window.setTimeout ) {
330
+ config.timeout = window.setTimeout(function() {
331
+ QUnit.ok( false, "Test timed out" );
332
+ QUnit.start();
333
+ }, timeout);
334
+ }
335
+ },
336
+
337
+ /**
338
+ * Resets the test setup. Useful for tests that modify the DOM.
339
+ */
340
+ reset: function() {
341
+ if ( window.jQuery ) {
342
+ jQuery("#main").html( config.fixture );
343
+ jQuery.event.global = {};
344
+ jQuery.ajaxSettings = extend({}, config.ajaxSettings);
345
+ }
346
+ },
347
+
348
+ /**
349
+ * Trigger an event on an element.
350
+ *
351
+ * @example triggerEvent( document.body, "click" );
352
+ *
353
+ * @param DOMElement elem
354
+ * @param String type
355
+ */
356
+ triggerEvent: function( elem, type, event ) {
357
+ if ( document.createEvent ) {
358
+ event = document.createEvent("MouseEvents");
359
+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
360
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
361
+ elem.dispatchEvent( event );
362
+
363
+ } else if ( elem.fireEvent ) {
364
+ elem.fireEvent("on"+type);
365
+ }
366
+ },
367
+
368
+ // Safe object type checking
369
+ is: function( type, obj ) {
370
+ return Object.prototype.toString.call( obj ) === "[object "+ type +"]";
371
+ },
372
+
373
+ // Logging callbacks
374
+ done: function(failures, total) {},
375
+ log: function(result, message) {},
376
+ testStart: function(name) {},
377
+ testDone: function(name, failures, total) {},
378
+ moduleStart: function(name, testEnvironment) {},
379
+ moduleDone: function(name, failures, total) {}
380
+ };
381
+
382
+ // Backwards compatibility, deprecated
383
+ QUnit.equals = QUnit.equal;
384
+ QUnit.same = QUnit.deepEqual;
385
+
386
+ // Maintain internal state
387
+ var config = {
388
+ // The queue of tests to run
389
+ queue: [],
390
+
391
+ // block until document ready
392
+ blocking: true
393
+ };
394
+
395
+ // Load paramaters
396
+ (function() {
397
+ var location = window.location || { search: "", protocol: "file:" },
398
+ GETParams = location.search.slice(1).split('&');
399
+
400
+ for ( var i = 0; i < GETParams.length; i++ ) {
401
+ GETParams[i] = decodeURIComponent( GETParams[i] );
402
+ if ( GETParams[i] === "noglobals" ) {
403
+ GETParams.splice( i, 1 );
404
+ i--;
405
+ config.noglobals = true;
406
+ } else if ( GETParams[i].search('=') > -1 ) {
407
+ GETParams.splice( i, 1 );
408
+ i--;
409
+ }
410
+ }
411
+
412
+ // restrict modules/tests by get parameters
413
+ config.filters = GETParams;
414
+
415
+ // Figure out if we're running the tests from a server or not
416
+ QUnit.isLocal = !!(location.protocol === 'file:');
417
+ })();
418
+
419
+ // Expose the API as global variables, unless an 'exports'
420
+ // object exists, in that case we assume we're in CommonJS
421
+ if ( typeof exports === "undefined" || typeof require === "undefined" ) {
422
+ extend(window, QUnit);
423
+ window.QUnit = QUnit;
424
+ } else {
425
+ extend(exports, QUnit);
426
+ exports.QUnit = QUnit;
427
+ }
428
+
429
+ if ( typeof document === "undefined" || document.readyState === "complete" ) {
430
+ config.autorun = true;
431
+ }
432
+
433
+ addEvent(window, "load", function() {
434
+ // Initialize the config, saving the execution queue
435
+ var oldconfig = extend({}, config);
436
+ QUnit.init();
437
+ extend(config, oldconfig);
438
+
439
+ config.blocking = false;
440
+
441
+ var userAgent = id("qunit-userAgent");
442
+ if ( userAgent ) {
443
+ userAgent.innerHTML = navigator.userAgent;
444
+ }
445
+
446
+ var toolbar = id("qunit-testrunner-toolbar");
447
+ if ( toolbar ) {
448
+ toolbar.style.display = "none";
449
+
450
+ var filter = document.createElement("input");
451
+ filter.type = "checkbox";
452
+ filter.id = "qunit-filter-pass";
453
+ filter.disabled = true;
454
+ addEvent( filter, "click", function() {
455
+ var li = document.getElementsByTagName("li");
456
+ for ( var i = 0; i < li.length; i++ ) {
457
+ if ( li[i].className.indexOf("pass") > -1 ) {
458
+ li[i].style.display = filter.checked ? "none" : "";
459
+ }
460
+ }
461
+ });
462
+ toolbar.appendChild( filter );
463
+
464
+ var label = document.createElement("label");
465
+ label.setAttribute("for", "qunit-filter-pass");
466
+ label.innerHTML = "Hide passed tests";
467
+ toolbar.appendChild( label );
468
+
469
+ var missing = document.createElement("input");
470
+ missing.type = "checkbox";
471
+ missing.id = "qunit-filter-missing";
472
+ missing.disabled = true;
473
+ addEvent( missing, "click", function() {
474
+ var li = document.getElementsByTagName("li");
475
+ for ( var i = 0; i < li.length; i++ ) {
476
+ if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) {
477
+ li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block";
478
+ }
479
+ }
480
+ });
481
+ toolbar.appendChild( missing );
482
+
483
+ label = document.createElement("label");
484
+ label.setAttribute("for", "qunit-filter-missing");
485
+ label.innerHTML = "Hide missing tests (untested code is broken code)";
486
+ toolbar.appendChild( label );
487
+ }
488
+
489
+ var main = id('main');
490
+ if ( main ) {
491
+ config.fixture = main.innerHTML;
492
+ }
493
+
494
+ if ( window.jQuery ) {
495
+ config.ajaxSettings = window.jQuery.ajaxSettings;
496
+ }
497
+
498
+ QUnit.start();
499
+ });
500
+
501
+ function done() {
502
+ if ( config.doneTimer && window.clearTimeout ) {
503
+ window.clearTimeout( config.doneTimer );
504
+ config.doneTimer = null;
505
+ }
506
+
507
+ if ( config.queue.length ) {
508
+ config.doneTimer = window.setTimeout(function(){
509
+ if ( !config.queue.length ) {
510
+ done();
511
+ } else {
512
+ synchronize( done );
513
+ }
514
+ }, 13);
515
+
516
+ return;
517
+ }
518
+
519
+ config.autorun = true;
520
+
521
+ // Log the last module results
522
+ if ( config.currentModule ) {
523
+ QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
524
+ }
525
+
526
+ var banner = id("qunit-banner"),
527
+ tests = id("qunit-tests"),
528
+ html = ['Tests completed in ',
529
+ +new Date - config.started, ' milliseconds.<br/>',
530
+ '<span class="passed">', config.stats.all - config.stats.bad, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad,'</span> failed.'].join('');
531
+
532
+ if ( banner ) {
533
+ banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
534
+ }
535
+
536
+ if ( tests ) {
537
+ var result = id("qunit-testresult");
538
+
539
+ if ( !result ) {
540
+ result = document.createElement("p");
541
+ result.id = "qunit-testresult";
542
+ result.className = "result";
543
+ tests.parentNode.insertBefore( result, tests.nextSibling );
544
+ }
545
+
546
+ result.innerHTML = html;
547
+ }
548
+
549
+ QUnit.done( config.stats.bad, config.stats.all );
550
+ }
551
+
552
+ function validTest( name ) {
553
+ var i = config.filters.length,
554
+ run = false;
555
+
556
+ if ( !i ) {
557
+ return true;
558
+ }
559
+
560
+ while ( i-- ) {
561
+ var filter = config.filters[i],
562
+ not = filter.charAt(0) == '!';
563
+
564
+ if ( not ) {
565
+ filter = filter.slice(1);
566
+ }
567
+
568
+ if ( name.indexOf(filter) !== -1 ) {
569
+ return !not;
570
+ }
571
+
572
+ if ( not ) {
573
+ run = true;
574
+ }
575
+ }
576
+
577
+ return run;
578
+ }
579
+
580
+ function push(result, actual, expected, message) {
581
+ message = message || (result ? "okay" : "failed");
582
+ QUnit.ok( result, result ? message + ": " + QUnit.jsDump.parse(expected) : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) );
583
+ }
584
+
585
+ function synchronize( callback ) {
586
+ config.queue.push( callback );
587
+
588
+ if ( config.autorun && !config.blocking ) {
589
+ process();
590
+ }
591
+ }
592
+
593
+ function process() {
594
+ var start = (new Date()).getTime();
595
+
596
+ while ( config.queue.length && !config.blocking ) {
597
+ if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
598
+ config.queue.shift()();
599
+
600
+ } else {
601
+ setTimeout( process, 13 );
602
+ break;
603
+ }
604
+ }
605
+ }
606
+
607
+ function saveGlobal() {
608
+ config.pollution = [];
609
+
610
+ if ( config.noglobals ) {
611
+ for ( var key in window ) {
612
+ config.pollution.push( key );
613
+ }
614
+ }
615
+ }
616
+
617
+ function checkPollution( name ) {
618
+ var old = config.pollution;
619
+ saveGlobal();
620
+
621
+ var newGlobals = diff( old, config.pollution );
622
+ if ( newGlobals.length > 0 ) {
623
+ ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
624
+ config.expected++;
625
+ }
626
+
627
+ var deletedGlobals = diff( config.pollution, old );
628
+ if ( deletedGlobals.length > 0 ) {
629
+ ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
630
+ config.expected++;
631
+ }
632
+ }
633
+
634
+ // returns a new Array with the elements that are in a but not in b
635
+ function diff( a, b ) {
636
+ var result = a.slice();
637
+ for ( var i = 0; i < result.length; i++ ) {
638
+ for ( var j = 0; j < b.length; j++ ) {
639
+ if ( result[i] === b[j] ) {
640
+ result.splice(i, 1);
641
+ i--;
642
+ break;
643
+ }
644
+ }
645
+ }
646
+ return result;
647
+ }
648
+
649
+ function fail(message, exception, callback) {
650
+ if ( typeof console !== "undefined" && console.error && console.warn ) {
651
+ console.error(message);
652
+ console.error(exception);
653
+ console.warn(callback.toString());
654
+
655
+ } else if ( window.opera && opera.postError ) {
656
+ opera.postError(message, exception, callback.toString);
657
+ }
658
+ }
659
+
660
+ function extend(a, b) {
661
+ for ( var prop in b ) {
662
+ a[prop] = b[prop];
663
+ }
664
+
665
+ return a;
666
+ }
667
+
668
+ function addEvent(elem, type, fn) {
669
+ if ( elem.addEventListener ) {
670
+ elem.addEventListener( type, fn, false );
671
+ } else if ( elem.attachEvent ) {
672
+ elem.attachEvent( "on" + type, fn );
673
+ } else {
674
+ fn();
675
+ }
676
+ }
677
+
678
+ function id(name) {
679
+ return !!(typeof document !== "undefined" && document && document.getElementById) &&
680
+ document.getElementById( name );
681
+ }
682
+
683
+ // Test for equality any JavaScript type.
684
+ // Discussions and reference: http://philrathe.com/articles/equiv
685
+ // Test suites: http://philrathe.com/tests/equiv
686
+ // Author: Philippe Rathé <prathe@gmail.com>
687
+ QUnit.equiv = function () {
688
+
689
+ var innerEquiv; // the real equiv function
690
+ var callers = []; // stack to decide between skip/abort functions
691
+ var parents = []; // stack to avoiding loops from circular referencing
692
+
693
+
694
+ // Determine what is o.
695
+ function hoozit(o) {
696
+ if (QUnit.is("String", o)) {
697
+ return "string";
698
+
699
+ } else if (QUnit.is("Boolean", o)) {
700
+ return "boolean";
701
+
702
+ } else if (QUnit.is("Number", o)) {
703
+
704
+ if (isNaN(o)) {
705
+ return "nan";
706
+ } else {
707
+ return "number";
708
+ }
709
+
710
+ } else if (typeof o === "undefined") {
711
+ return "undefined";
712
+
713
+ // consider: typeof null === object
714
+ } else if (o === null) {
715
+ return "null";
716
+
717
+ // consider: typeof [] === object
718
+ } else if (QUnit.is( "Array", o)) {
719
+ return "array";
720
+
721
+ // consider: typeof new Date() === object
722
+ } else if (QUnit.is( "Date", o)) {
723
+ return "date";
724
+
725
+ // consider: /./ instanceof Object;
726
+ // /./ instanceof RegExp;
727
+ // typeof /./ === "function"; // => false in IE and Opera,
728
+ // true in FF and Safari
729
+ } else if (QUnit.is( "RegExp", o)) {
730
+ return "regexp";
731
+
732
+ } else if (typeof o === "object") {
733
+ return "object";
734
+
735
+ } else if (QUnit.is( "Function", o)) {
736
+ return "function";
737
+ } else {
738
+ return undefined;
739
+ }
740
+ }
741
+
742
+ // Call the o related callback with the given arguments.
743
+ function bindCallbacks(o, callbacks, args) {
744
+ var prop = hoozit(o);
745
+ if (prop) {
746
+ if (hoozit(callbacks[prop]) === "function") {
747
+ return callbacks[prop].apply(callbacks, args);
748
+ } else {
749
+ return callbacks[prop]; // or undefined
750
+ }
751
+ }
752
+ }
753
+
754
+ var callbacks = function () {
755
+
756
+ // for string, boolean, number and null
757
+ function useStrictEquality(b, a) {
758
+ if (b instanceof a.constructor || a instanceof b.constructor) {
759
+ // to catch short annotaion VS 'new' annotation of a declaration
760
+ // e.g. var i = 1;
761
+ // var j = new Number(1);
762
+ return a == b;
763
+ } else {
764
+ return a === b;
765
+ }
766
+ }
767
+
768
+ return {
769
+ "string": useStrictEquality,
770
+ "boolean": useStrictEquality,
771
+ "number": useStrictEquality,
772
+ "null": useStrictEquality,
773
+ "undefined": useStrictEquality,
774
+
775
+ "nan": function (b) {
776
+ return isNaN(b);
777
+ },
778
+
779
+ "date": function (b, a) {
780
+ return hoozit(b) === "date" && a.valueOf() === b.valueOf();
781
+ },
782
+
783
+ "regexp": function (b, a) {
784
+ return hoozit(b) === "regexp" &&
785
+ a.source === b.source && // the regex itself
786
+ a.global === b.global && // and its modifers (gmi) ...
787
+ a.ignoreCase === b.ignoreCase &&
788
+ a.multiline === b.multiline;
789
+ },
790
+
791
+ // - skip when the property is a method of an instance (OOP)
792
+ // - abort otherwise,
793
+ // initial === would have catch identical references anyway
794
+ "function": function () {
795
+ var caller = callers[callers.length - 1];
796
+ return caller !== Object &&
797
+ typeof caller !== "undefined";
798
+ },
799
+
800
+ "array": function (b, a) {
801
+ var i, j, loop;
802
+ var len;
803
+
804
+ // b could be an object literal here
805
+ if ( ! (hoozit(b) === "array")) {
806
+ return false;
807
+ }
808
+
809
+ len = a.length;
810
+ if (len !== b.length) { // safe and faster
811
+ return false;
812
+ }
813
+
814
+ //track reference to avoid circular references
815
+ parents.push(a);
816
+ for (i = 0; i < len; i++) {
817
+ loop = false;
818
+ for(j=0;j<parents.length;j++){
819
+ if(parents[j] === a[i]){
820
+ loop = true;//dont rewalk array
821
+ }
822
+ }
823
+ if (!loop && ! innerEquiv(a[i], b[i])) {
824
+ parents.pop();
825
+ return false;
826
+ }
827
+ }
828
+ parents.pop();
829
+ return true;
830
+ },
831
+
832
+ "object": function (b, a) {
833
+ var i, j, loop;
834
+ var eq = true; // unless we can proove it
835
+ var aProperties = [], bProperties = []; // collection of strings
836
+
837
+ // comparing constructors is more strict than using instanceof
838
+ if ( a.constructor !== b.constructor) {
839
+ return false;
840
+ }
841
+
842
+ // stack constructor before traversing properties
843
+ callers.push(a.constructor);
844
+ //track reference to avoid circular references
845
+ parents.push(a);
846
+
847
+ for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
848
+ loop = false;
849
+ for(j=0;j<parents.length;j++){
850
+ if(parents[j] === a[i])
851
+ loop = true; //don't go down the same path twice
852
+ }
853
+ aProperties.push(i); // collect a's properties
854
+
855
+ if (!loop && ! innerEquiv(a[i], b[i])) {
856
+ eq = false;
857
+ break;
858
+ }
859
+ }
860
+
861
+ callers.pop(); // unstack, we are done
862
+ parents.pop();
863
+
864
+ for (i in b) {
865
+ bProperties.push(i); // collect b's properties
866
+ }
867
+
868
+ // Ensures identical properties name
869
+ return eq && innerEquiv(aProperties.sort(), bProperties.sort());
870
+ }
871
+ };
872
+ }();
873
+
874
+ innerEquiv = function () { // can take multiple arguments
875
+ var args = Array.prototype.slice.apply(arguments);
876
+ if (args.length < 2) {
877
+ return true; // end transition
878
+ }
879
+
880
+ return (function (a, b) {
881
+ if (a === b) {
882
+ return true; // catch the most you can
883
+ } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {
884
+ return false; // don't lose time with error prone cases
885
+ } else {
886
+ return bindCallbacks(a, callbacks, [b, a]);
887
+ }
888
+
889
+ // apply transition with (1..n) arguments
890
+ })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
891
+ };
892
+
893
+ return innerEquiv;
894
+
895
+ }();
896
+
897
+ /**
898
+ * jsDump
899
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
900
+ * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
901
+ * Date: 5/15/2008
902
+ * @projectDescription Advanced and extensible data dumping for Javascript.
903
+ * @version 1.0.0
904
+ * @author Ariel Flesler
905
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
906
+ */
907
+ QUnit.jsDump = (function() {
908
+ function quote( str ) {
909
+ return '"' + str.toString().replace(/"/g, '\\"') + '"';
910
+ };
911
+ function literal( o ) {
912
+ return o + '';
913
+ };
914
+ function join( pre, arr, post ) {
915
+ var s = jsDump.separator(),
916
+ base = jsDump.indent(),
917
+ inner = jsDump.indent(1);
918
+ if ( arr.join )
919
+ arr = arr.join( ',' + s + inner );
920
+ if ( !arr )
921
+ return pre + post;
922
+ return [ pre, inner + arr, base + post ].join(s);
923
+ };
924
+ function array( arr ) {
925
+ var i = arr.length, ret = Array(i);
926
+ this.up();
927
+ while ( i-- )
928
+ ret[i] = this.parse( arr[i] );
929
+ this.down();
930
+ return join( '[', ret, ']' );
931
+ };
932
+
933
+ var reName = /^function (\w+)/;
934
+
935
+ var jsDump = {
936
+ parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
937
+ var parser = this.parsers[ type || this.typeOf(obj) ];
938
+ type = typeof parser;
939
+
940
+ return type == 'function' ? parser.call( this, obj ) :
941
+ type == 'string' ? parser :
942
+ this.parsers.error;
943
+ },
944
+ typeOf:function( obj ) {
945
+ var type;
946
+ if ( obj === null ) {
947
+ type = "null";
948
+ } else if (typeof obj === "undefined") {
949
+ type = "undefined";
950
+ } else if (QUnit.is("RegExp", obj)) {
951
+ type = "regexp";
952
+ } else if (QUnit.is("Date", obj)) {
953
+ type = "date";
954
+ } else if (QUnit.is("Function", obj)) {
955
+ type = "function";
956
+ } else if (obj.setInterval && obj.document && !obj.nodeType) {
957
+ type = "window";
958
+ } else if (obj.nodeType === 9) {
959
+ type = "document";
960
+ } else if (obj.nodeType) {
961
+ type = "node";
962
+ } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
963
+ type = "array";
964
+ } else {
965
+ type = typeof obj;
966
+ }
967
+ return type;
968
+ },
969
+ separator:function() {
970
+ return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
971
+ },
972
+ indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
973
+ if ( !this.multiline )
974
+ return '';
975
+ var chr = this.indentChar;
976
+ if ( this.HTML )
977
+ chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
978
+ return Array( this._depth_ + (extra||0) ).join(chr);
979
+ },
980
+ up:function( a ) {
981
+ this._depth_ += a || 1;
982
+ },
983
+ down:function( a ) {
984
+ this._depth_ -= a || 1;
985
+ },
986
+ setParser:function( name, parser ) {
987
+ this.parsers[name] = parser;
988
+ },
989
+ // The next 3 are exposed so you can use them
990
+ quote:quote,
991
+ literal:literal,
992
+ join:join,
993
+ //
994
+ _depth_: 1,
995
+ // This is the list of parsers, to modify them, use jsDump.setParser
996
+ parsers:{
997
+ window: '[Window]',
998
+ document: '[Document]',
999
+ error:'[ERROR]', //when no parser is found, shouldn't happen
1000
+ unknown: '[Unknown]',
1001
+ 'null':'null',
1002
+ undefined:'undefined',
1003
+ 'function':function( fn ) {
1004
+ var ret = 'function',
1005
+ name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
1006
+ if ( name )
1007
+ ret += ' ' + name;
1008
+ ret += '(';
1009
+
1010
+ ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');
1011
+ return join( ret, this.parse(fn,'functionCode'), '}' );
1012
+ },
1013
+ array: array,
1014
+ nodelist: array,
1015
+ arguments: array,
1016
+ object:function( map ) {
1017
+ var ret = [ ];
1018
+ this.up();
1019
+ for ( var key in map )
1020
+ ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );
1021
+ this.down();
1022
+ return join( '{', ret, '}' );
1023
+ },
1024
+ node:function( node ) {
1025
+ var open = this.HTML ? '&lt;' : '<',
1026
+ close = this.HTML ? '&gt;' : '>';
1027
+
1028
+ var tag = node.nodeName.toLowerCase(),
1029
+ ret = open + tag;
1030
+
1031
+ for ( var a in this.DOMAttrs ) {
1032
+ var val = node[this.DOMAttrs[a]];
1033
+ if ( val )
1034
+ ret += ' ' + a + '=' + this.parse( val, 'attribute' );
1035
+ }
1036
+ return ret + close + open + '/' + tag + close;
1037
+ },
1038
+ functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
1039
+ var l = fn.length;
1040
+ if ( !l ) return '';
1041
+
1042
+ var args = Array(l);
1043
+ while ( l-- )
1044
+ args[l] = String.fromCharCode(97+l);//97 is 'a'
1045
+ return ' ' + args.join(', ') + ' ';
1046
+ },
1047
+ key:quote, //object calls it internally, the key part of an item in a map
1048
+ functionCode:'[code]', //function calls it internally, it's the content of the function
1049
+ attribute:quote, //node calls it internally, it's an html attribute value
1050
+ string:quote,
1051
+ date:quote,
1052
+ regexp:literal, //regex
1053
+ number:literal,
1054
+ 'boolean':literal
1055
+ },
1056
+ DOMAttrs:{//attributes to dump from nodes, name=>realName
1057
+ id:'id',
1058
+ name:'name',
1059
+ 'class':'className'
1060
+ },
1061
+ HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
1062
+ indentChar:' ',//indentation unit
1063
+ multiline:false //if true, items in a collection, are separated by a \n, else just a space.
1064
+ };
1065
+
1066
+ return jsDump;
1067
+ })();
1068
+
1069
+ })(this);