jax 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rvmrc +2 -3
- data/.travis.yml +8 -22
- data/README.md +2 -2
- data/Rakefile +128 -96
- data/app/assets/javascripts/jax/controller-list.js.coffee +22 -0
- data/app/assets/javascripts/jax/dom-helpers.js.coffee +17 -0
- data/app/assets/javascripts/jax/jasmine_runner.js +177 -0
- data/app/assets/javascripts/jax/runtime.js +6 -0
- data/app/assets/javascripts/jax/shader_editor.js.coffee +33 -0
- data/app/assets/stylesheets/jax/controller-list.css +5 -0
- data/app/assets/stylesheets/jax/jasmine.css +16 -0
- data/app/assets/stylesheets/jax/nav.css +41 -0
- data/app/assets/stylesheets/jax/runtime.css +47 -0
- data/app/assets/stylesheets/jax/shader_editor.css +3 -0
- data/app/assets/stylesheets/jax/suite.css +82 -0
- data/app/controllers/jax/suite_controller.rb +48 -0
- data/app/views/jax/suite/jasmine.html.erb +38 -0
- data/app/views/jax/suite/run_webgl.html.erb +49 -0
- data/app/views/jax/suite/shader_editor.html.erb +24 -0
- data/app/views/layouts/jax.html.erb +40 -0
- data/bin/jax +8 -4
- data/config/routes.rb +2 -0
- data/config.ru +5 -0
- data/features/rails/resources.feature +45 -0
- data/features/rails/shaders.feature +13 -0
- data/features/rails/specs.feature +24 -0
- data/features/runtime.feature +15 -0
- data/features/step_definitions/environment_steps.rb +15 -0
- data/features/step_definitions/response_steps.rb +13 -0
- data/features/step_definitions/runtime.rb +11 -0
- data/features/step_definitions/web_steps.rb +223 -0
- data/features/support/env.rb +75 -0
- data/features/support/paths.rb +30 -0
- data/features/support/rails_environment.rb +3 -0
- data/features/support/selectors.rb +39 -0
- data/features/support/setup.rb +17 -0
- data/jax.gemspec +22 -16
- data/lib/assets/javascripts/jax/anim_frame.js +64 -0
- data/lib/assets/javascripts/jax/application.js +16 -0
- data/lib/assets/javascripts/jax/builtin/all.js +21 -0
- data/lib/assets/javascripts/jax/builtin/meshes/cube.js +83 -0
- data/lib/assets/javascripts/jax/builtin/meshes/plane.js +67 -0
- data/lib/assets/javascripts/jax/builtin/meshes/quad.js +89 -0
- data/lib/assets/javascripts/jax/builtin/meshes/sphere.js +65 -0
- data/lib/assets/javascripts/jax/builtin/meshes/teapot.js +48 -0
- data/lib/assets/javascripts/jax/builtin/meshes/torus.js +64 -0
- data/lib/assets/javascripts/jax/compatibility.js +312 -0
- data/lib/assets/javascripts/jax/context.js +741 -0
- data/lib/assets/javascripts/jax/core/base.js +69 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/mat3.js +20 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/mat4.js +10 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/quat4.js +148 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/vec2.js +25 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/vec3.js +86 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/vec4.js +28 -0
- data/lib/assets/javascripts/jax/core/helper.js +44 -0
- data/lib/assets/javascripts/jax/core/math.js +61 -0
- data/lib/assets/javascripts/jax/core/matrix_stack.js +310 -0
- data/lib/assets/javascripts/jax/core/util.js +271 -0
- data/lib/assets/javascripts/jax/core.js +43 -0
- data/lib/assets/javascripts/jax/events.js +304 -0
- data/lib/assets/javascripts/jax/geometry/line.js +185 -0
- data/lib/assets/javascripts/jax/geometry/plane.js +371 -0
- data/lib/assets/javascripts/jax/geometry/triangle/inliner.rb +94 -0
- data/lib/assets/javascripts/jax/geometry/triangle/slow_tri_tri_intersect.js +20 -0
- data/lib/assets/javascripts/jax/geometry/triangle/tri_tri_intersect.js +281 -0
- data/lib/assets/javascripts/jax/geometry/triangle/tri_tri_intersect_optimized.js +564 -0
- data/lib/assets/javascripts/jax/geometry/triangle.js +311 -0
- data/lib/assets/javascripts/jax/geometry.js +14 -0
- data/lib/assets/javascripts/jax/mvc/controller.js +188 -0
- data/lib/assets/javascripts/jax/mvc/model.js +302 -0
- data/lib/assets/javascripts/jax/mvc/route_set.js +148 -0
- data/lib/assets/javascripts/jax/mvc/view.js +43 -0
- data/lib/assets/javascripts/jax/mvc/view_manager.js +65 -0
- data/lib/assets/javascripts/jax/noise.js +251 -0
- data/lib/assets/javascripts/jax/prototype/class.js +81 -0
- data/lib/assets/javascripts/jax/prototype/core.js +112 -0
- data/lib/assets/javascripts/jax/prototype/extensions.js +142 -0
- data/lib/assets/javascripts/jax/vendor/ejs.js +1 -0
- data/lib/assets/javascripts/jax/vendor/glMatrix.js +7 -0
- data/lib/assets/javascripts/jax/webgl/camera.js +697 -0
- data/lib/assets/javascripts/jax/webgl/cleanup.js +1 -0
- data/lib/assets/javascripts/jax/webgl/core/buffer.js +292 -0
- data/lib/assets/javascripts/jax/webgl/core/data_region.js +184 -0
- data/lib/assets/javascripts/jax/webgl/core/data_segment.js +255 -0
- data/lib/assets/javascripts/jax/webgl/core/events.js +99 -0
- data/lib/assets/javascripts/jax/webgl/core/framebuffer.js +316 -0
- data/lib/assets/javascripts/jax/webgl/core.js +6 -0
- data/lib/assets/javascripts/jax/webgl/material.js +381 -0
- data/lib/assets/javascripts/jax/webgl/mesh/normals.js +37 -0
- data/lib/assets/javascripts/jax/webgl/mesh/support.js +104 -0
- data/lib/assets/javascripts/jax/webgl/mesh/tangent_space.js +111 -0
- data/lib/assets/javascripts/jax/webgl/mesh.js +440 -0
- data/lib/assets/javascripts/jax/webgl/scene/frustum.js +422 -0
- data/lib/assets/javascripts/jax/webgl/scene/light_manager.js +141 -0
- data/lib/assets/javascripts/jax/webgl/scene/light_source.js +300 -0
- data/lib/assets/javascripts/jax/webgl/scene.js +16 -0
- data/lib/assets/javascripts/jax/webgl/shader/delegator/attribute.js +53 -0
- data/lib/assets/javascripts/jax/webgl/shader/delegator/uniform.js +71 -0
- data/lib/assets/javascripts/jax/webgl/shader/delegator.js +13 -0
- data/lib/assets/javascripts/jax/webgl/shader/manifest.js +70 -0
- data/lib/assets/javascripts/jax/webgl/shader/program.js +138 -0
- data/lib/assets/javascripts/jax/webgl/shader.js +299 -0
- data/lib/assets/javascripts/jax/webgl/shader_chain.js +267 -0
- data/lib/assets/javascripts/jax/webgl/texture.js +506 -0
- data/lib/assets/javascripts/jax/webgl/world.js +279 -0
- data/lib/assets/javascripts/jax/webgl.js +109 -0
- data/lib/assets/javascripts/jax.js +136 -0
- data/{builtin/app/shaders/basic/common.ejs → lib/assets/javascripts/shaders/basic/common.glsl} +0 -0
- data/{builtin/app/shaders/basic/fragment.ejs → lib/assets/javascripts/shaders/basic/fragment.glsl} +0 -0
- data/{builtin/app/shaders/basic/vertex.ejs → lib/assets/javascripts/shaders/basic/vertex.glsl} +1 -1
- data/{builtin/app/shaders/depthmap/common.ejs → lib/assets/javascripts/shaders/depthmap/common.glsl} +0 -0
- data/{builtin/app/shaders/depthmap/fragment.ejs → lib/assets/javascripts/shaders/depthmap/fragment.glsl} +1 -1
- data/{builtin/app → lib/assets/javascripts}/shaders/depthmap/material.js +0 -0
- data/{builtin/app/shaders/depthmap/vertex.ejs → lib/assets/javascripts/shaders/depthmap/vertex.glsl} +0 -0
- data/{builtin/app/shaders/fog/common.ejs → lib/assets/javascripts/shaders/fog/common.glsl} +0 -0
- data/{builtin/app/shaders/fog/fragment.ejs → lib/assets/javascripts/shaders/fog/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/fog/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/fog/material.js +6 -8
- data/{builtin/app/shaders/fog/vertex.ejs → lib/assets/javascripts/shaders/fog/vertex.glsl} +0 -0
- data/{builtin/app/shaders/functions/depth_map.ejs → lib/assets/javascripts/shaders/functions/depth_map.glsl} +0 -0
- data/{builtin/app/shaders/functions/lights.ejs → lib/assets/javascripts/shaders/functions/lights.glsl} +0 -0
- data/{builtin/app/shaders/functions/noise.ejs → lib/assets/javascripts/shaders/functions/noise.glsl} +0 -0
- data/lib/assets/javascripts/shaders/lighting/common.glsl +5 -0
- data/{builtin/app/shaders/lighting/fragment.ejs → lib/assets/javascripts/shaders/lighting/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/lighting/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/lighting/material.js +2 -4
- data/{builtin/app/shaders/lighting/vertex.ejs → lib/assets/javascripts/shaders/lighting/vertex.glsl} +0 -0
- data/{builtin/app/shaders/normal_map/common.ejs → lib/assets/javascripts/shaders/normal_map/common.glsl} +1 -1
- data/{builtin/app/shaders/normal_map/fragment.ejs → lib/assets/javascripts/shaders/normal_map/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/normal_map/manifest.yml +0 -0
- data/lib/assets/javascripts/shaders/normal_map/material.js +11 -0
- data/{builtin/app/shaders/normal_map/vertex.ejs → lib/assets/javascripts/shaders/normal_map/vertex.glsl} +0 -0
- data/{builtin/app/shaders/paraboloid/common.ejs → lib/assets/javascripts/shaders/paraboloid/common.glsl} +0 -0
- data/{builtin/app/shaders/paraboloid/fragment.ejs → lib/assets/javascripts/shaders/paraboloid/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/paraboloid/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/paraboloid/material.js +2 -4
- data/{builtin/app/shaders/paraboloid/vertex.ejs → lib/assets/javascripts/shaders/paraboloid/vertex.glsl} +0 -0
- data/{builtin/app/shaders/picking/common.ejs → lib/assets/javascripts/shaders/picking/common.glsl} +0 -0
- data/{builtin/app/shaders/picking/fragment.ejs → lib/assets/javascripts/shaders/picking/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/picking/material.js +2 -4
- data/{builtin/app/shaders/picking/vertex.ejs → lib/assets/javascripts/shaders/picking/vertex.glsl} +0 -0
- data/{builtin/app/shaders/shadow_map/common.ejs → lib/assets/javascripts/shaders/shadow_map/common.glsl} +2 -1
- data/{builtin/app/shaders/shadow_map/fragment.ejs → lib/assets/javascripts/shaders/shadow_map/fragment.glsl} +1 -1
- data/{builtin/app → lib/assets/javascripts}/shaders/shadow_map/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/shadow_map/material.js +4 -6
- data/{builtin/app/shaders/shadow_map/vertex.ejs → lib/assets/javascripts/shaders/shadow_map/vertex.glsl} +0 -0
- data/{builtin/app/shaders/texture/common.ejs → lib/assets/javascripts/shaders/texture/common.glsl} +0 -0
- data/{builtin/app/shaders/texture/fragment.ejs → lib/assets/javascripts/shaders/texture/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/texture/manifest.yml +0 -0
- data/lib/assets/javascripts/shaders/texture/material.js +17 -0
- data/{builtin/app/shaders/texture/vertex.ejs → lib/assets/javascripts/shaders/texture/vertex.glsl} +0 -0
- data/lib/generators/jax/all.rb +16 -0
- data/lib/generators/jax/application/application_generator.rb +48 -0
- data/lib/generators/jax/base/actions.rb +52 -0
- data/lib/generators/jax/base/coffee_generator.rb +30 -0
- data/lib/generators/jax/base/named_base.rb +17 -0
- data/lib/generators/jax/base/plugin_base.rb +108 -0
- data/lib/generators/jax/base/plugin_credentials.rb +99 -0
- data/lib/generators/jax/base/plugin_manifest.rb +75 -0
- data/lib/generators/jax/base/rails_base.rb +30 -0
- data/lib/generators/jax/base/source_root.rb +5 -0
- data/lib/generators/jax/controller/controller_generator.rb +37 -0
- data/lib/generators/jax/helper/helper_generator.rb +30 -0
- data/lib/generators/jax/install/install_generator.rb +27 -0
- data/lib/generators/jax/jax_generator.rb +13 -0
- data/lib/generators/jax/light/light_generator.rb +23 -0
- data/lib/{jax/generators → generators/jax}/material/USAGE +4 -8
- data/lib/generators/jax/material/material_generator.rb +112 -0
- data/lib/generators/jax/model/model_generator.rb +24 -0
- data/lib/generators/jax/plugin/plugin_generator.rb +72 -0
- data/lib/generators/jax/scaffold/scaffold_generator.rb +35 -0
- data/lib/generators/jax/shader/shader_generator.rb +38 -0
- data/lib/jax/commands/plugin_manager.rb +240 -0
- data/lib/jax/commands.rb +69 -0
- data/lib/jax/configuration.rb +64 -0
- data/lib/jax/directive_processor.rb +53 -0
- data/lib/jax/engine.rb +38 -54
- data/lib/jax/helper_methods.rb +3 -0
- data/lib/jax/rails/application.rb +34 -0
- data/lib/jax/resource_file.rb +29 -0
- data/lib/jax/script_loader.rb +68 -0
- data/lib/jax/server.rb +87 -0
- data/lib/jax/shader.rb +70 -172
- data/lib/jax/testing/rails_environment.rb +94 -0
- data/lib/jax/util/tar.rb +75 -0
- data/lib/jax/util.rb +3 -0
- data/lib/jax/version.rb +7 -8
- data/lib/jax.rb +23 -41
- data/spec/bin/jax_spec.rb +149 -0
- data/{lib/jax/generators/app/templates/app/models/.empty_directory → spec/fixtures/public/favicon.ico} +0 -0
- data/spec/fixtures/public/textures/brickwall.jpg +0 -0
- data/spec/fixtures/public/textures/jacks.jpg +0 -0
- data/spec/fixtures/public/textures/normal_map.jpg +0 -0
- data/spec/fixtures/public/textures/rock.png +0 -0
- data/spec/fixtures/public/textures/rock_normal.png +0 -0
- data/spec/fixtures/public/textures/rss.png +0 -0
- data/spec/generators/jax/application_generator_spec.rb +18 -0
- data/spec/generators/jax/controller_generator_spec.rb +102 -0
- data/spec/generators/jax/helper_generator_spec.rb +55 -0
- data/spec/generators/jax/install_generator_spec.rb +30 -0
- data/spec/generators/jax/jax_generator_spec.rb +21 -0
- data/spec/generators/jax/light_generator_spec.rb +27 -0
- data/spec/generators/jax/material_generator_spec.rb +62 -0
- data/spec/generators/jax/model_generator_spec.rb +72 -0
- data/spec/generators/jax/plugin_generator_spec.rb +143 -0
- data/spec/generators/jax/scaffold_generator_spec.rb +35 -0
- data/spec/generators/jax/shader_generator_spec.rb +37 -0
- data/spec/javascripts/helpers/jasmine_webgl_helper.js +13 -0
- data/{lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers → spec/javascripts/helpers}/jax_spec_environment_helper.js +7 -2
- data/{lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers → spec/javascripts/helpers}/jax_spec_helper.js +0 -0
- data/spec/javascripts/jax/builtin/meshes/cube_spec.js +10 -0
- data/spec/javascripts/jax/builtin/meshes/plane_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/quad_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/sphere_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/teapot_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/torus_spec.js +8 -0
- data/spec/javascripts/jax/compatibility_spec.js +46 -0
- data/spec/javascripts/jax/context_events_spec.js +212 -0
- data/spec/javascripts/jax/context_spec.js +305 -0
- data/spec/javascripts/jax/core/data_region_spec.js +118 -0
- data/spec/javascripts/jax/core/data_segment_spec.js +96 -0
- data/spec/javascripts/jax/core/delegation_spec.js +48 -0
- data/spec/javascripts/jax/core/events_spec.js +17 -0
- data/spec/javascripts/jax/core/glMatrix_extensions_spec.js +8 -0
- data/spec/javascripts/jax/core/helper_spec.js +61 -0
- data/spec/javascripts/jax/core/matrix_stack_spec.js +28 -0
- data/spec/javascripts/jax/core/utils_spec.js +275 -0
- data/spec/javascripts/jax/geometry/line_spec.js +20 -0
- data/spec/javascripts/jax/geometry/plane_spec.js +181 -0
- data/spec/javascripts/jax/geometry/triangle_spec.js +105 -0
- data/spec/javascripts/jax/mvc/controller_spec.js +156 -0
- data/spec/javascripts/jax/mvc/model_spec.js +93 -0
- data/spec/javascripts/jax/mvc/route_set_spec.js +49 -0
- data/spec/javascripts/jax/mvc/view_manager_spec.js +17 -0
- data/spec/javascripts/jax/noise_spec.js +50 -0
- data/spec/javascripts/jax/optimizations/material_limitations_spec.js +85 -0
- data/spec/javascripts/jax/optimizations/shaders/basic_spec.js +65 -0
- data/spec/javascripts/jax/prototype/extensions_spec.js +34 -0
- data/spec/javascripts/jax/webgl/camera_spec.js +237 -0
- data/spec/javascripts/jax/webgl/core/events_spec.js +47 -0
- data/spec/javascripts/jax/webgl/framebuffer_spec.js +44 -0
- data/spec/javascripts/jax/webgl/lighting_spec.js +108 -0
- data/spec/javascripts/jax/webgl/material_spec.js +117 -0
- data/spec/javascripts/jax/webgl/mesh_spec.js +228 -0
- data/spec/javascripts/jax/webgl/shader/manifest_spec.js +57 -0
- data/spec/javascripts/jax/webgl/shader_chain_spec.js +211 -0
- data/spec/javascripts/jax/webgl/shader_spec.js +276 -0
- data/spec/javascripts/jax/webgl/tangent_space_spec.js +142 -0
- data/spec/javascripts/jax/webgl/texture_spec.js +159 -0
- data/spec/javascripts/jax/webgl_spec.js +5 -0
- data/spec/javascripts/jax/world_spec.js +175 -0
- data/spec/javascripts/jax_spec.js +14 -0
- data/spec/javascripts/node/mocks/webgl.js +159 -0
- data/spec/javascripts/node_helper.js +51 -0
- data/spec/javascripts/shaders/core_materials_spec.js +38 -0
- data/spec/javascripts/shaders/fog_spec.js +15 -0
- data/spec/javascripts/shaders/lighting_spec.js +15 -0
- data/spec/javascripts/shaders/normal_map_spec.js +15 -0
- data/spec/javascripts/shaders/paraboloid_spec.js +33 -0
- data/spec/javascripts/shaders/preprocessor_spec.js +45 -0
- data/spec/javascripts/shaders/shadow_map_spec.js +15 -0
- data/spec/javascripts/shaders/texture_spec.js +37 -0
- data/spec/javascripts/suite/controller_select_spec.js.coffee +24 -0
- data/spec/lib/jax/commands/plugin_manager/credentials_spec.rb +56 -0
- data/spec/lib/jax/commands/plugin_manager/push_spec.rb +62 -0
- data/spec/lib/jax/commands/plugin_manager_spec.rb +204 -0
- data/spec/lib/jax/rails/application_spec.rb +23 -0
- data/spec/lib/jax/shader_spec.rb +67 -0
- data/spec/lib/jax/util/tar_spec.rb +26 -0
- data/spec/{test_helper.rb → spec_helper.rb} +37 -28
- data/spec/support/test_model_generator.rb +14 -0
- data/templates/app/Gemfile.tt +17 -0
- data/templates/app/Rakefile +4 -0
- data/templates/app/config/application.rb +16 -0
- data/{lib/jax/generators/app/templates → templates/app}/config/boot.rb +0 -0
- data/templates/app/config/environment.rb +5 -0
- data/templates/app/config/environments/production.rb +4 -0
- data/templates/app/config.ru +6 -0
- data/{lib/jax/generators/app/templates/app/resources → templates/app/public}/.empty_directory +0 -0
- data/templates/app/script/jax +8 -0
- data/{lib/jax/generators/app/templates/app/views → templates/app/spec}/.empty_directory +0 -0
- data/templates/application_controller.js.coffee.erb +3 -0
- data/templates/application_controller.js.erb +6 -0
- data/templates/application_helper.js.coffee.erb +3 -0
- data/templates/application_helper.js.erb +3 -0
- data/templates/controller.js.coffee.erb +9 -0
- data/templates/controller.js.erb +15 -0
- data/templates/controller_spec.js.coffee.erb +9 -0
- data/templates/controller_spec.js.erb +12 -0
- data/templates/helper.js.coffee.erb +2 -0
- data/templates/helper.js.erb +3 -0
- data/templates/helper_spec.js.coffee.erb +8 -0
- data/templates/helper_spec.js.erb +12 -0
- data/{lib/jax/generators/light_source/templates/light.yml.tt → templates/light_source.resource.erb} +3 -3
- data/{lib/jax/generators/material/templates/material.yml.tt → templates/material.resource.erb} +0 -9
- data/templates/model.js.coffee.erb +3 -0
- data/templates/model.js.erb +5 -0
- data/templates/model_defaults.resource.erb +5 -0
- data/templates/model_spec.js.coffee.erb +16 -0
- data/templates/model_spec.js.erb +18 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/controllers/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/helpers/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/models/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/resources/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/views/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates → templates}/new_plugin/init.rb +0 -0
- data/{lib/jax/generators/plugin/templates → templates}/new_plugin/install.rb +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/public → templates/new_plugin/spec}/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates → templates}/new_plugin/uninstall.rb +0 -0
- data/{lib/jax/generators/shader/templates/common.ejs.tt → templates/shader_common.glsl.erb} +0 -0
- data/{lib/jax/generators/shader/templates/fragment.ejs.tt → templates/shader_fragment.glsl.erb} +0 -0
- data/{lib/jax/generators/shader/templates/manifest.yml.tt → templates/shader_manifest.yml.erb} +0 -0
- data/templates/shader_material.js.coffee.erb +22 -0
- data/{lib/jax/generators/shader/templates/material.js.tt → templates/shader_material.js.erb} +0 -0
- data/templates/shader_spec.js.coffee.erb +16 -0
- data/{lib/jax/generators/shader/templates/spec.js.tt → templates/shader_spec.js.erb} +1 -1
- data/{lib/jax/generators/shader/templates/vertex.ejs.tt → templates/shader_vertex.glsl.erb} +0 -0
- data/templates/view.js.coffee.erb +3 -0
- data/{lib/jax/generators/controller/templates/view.js.tt → templates/view.js.erb} +1 -1
- data/vendor/assets/javascripts/ejs.js +505 -0
- data/vendor/assets/javascripts/glMatrix.js +1772 -0
- data/vendor/assets/javascripts/jasmine.js +2476 -0
- data/vendor/assets/stylesheets/jasmine.css +166 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/alias.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/constant.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/constructor.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/description.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/information.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/instance_method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/instance_property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/method_deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/mixin.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/namespace.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/related_to.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/search-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/section-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/section.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/selected-section-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/subclass.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/superclass.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/utility.png +0 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/application.js +478 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/prototype.js +4874 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/tabs.js +506 -0
- data/vendor/pdoc_template/html/assets/stylesheets/jax.css +30 -0
- data/vendor/pdoc_template/html/assets/stylesheets/pdoc/api.css +681 -0
- data/vendor/pdoc_template/html/assets/stylesheets/pdoc/pygments.css +62 -0
- data/vendor/pdoc_template/html/helpers.rb +35 -0
- data/vendor/pdoc_template/html/index.erb +18 -0
- data/vendor/pdoc_template/html/item_index.js.erb +6 -0
- data/vendor/pdoc_template/html/layout.erb +67 -0
- data/vendor/pdoc_template/html/leaf.erb +22 -0
- data/vendor/pdoc_template/html/node.erb +30 -0
- data/vendor/pdoc_template/html/partials/class_relationships.erb +19 -0
- data/vendor/pdoc_template/html/partials/classes.erb +7 -0
- data/vendor/pdoc_template/html/partials/constructor.erb +5 -0
- data/vendor/pdoc_template/html/partials/description.erb +5 -0
- data/vendor/pdoc_template/html/partials/link_list.erb +1 -0
- data/vendor/pdoc_template/html/partials/method_signatures.erb +14 -0
- data/vendor/pdoc_template/html/partials/methodized_note.erb +9 -0
- data/vendor/pdoc_template/html/partials/mixins.erb +7 -0
- data/vendor/pdoc_template/html/partials/namespaces.erb +7 -0
- data/vendor/pdoc_template/html/partials/related_utilities.erb +5 -0
- data/vendor/pdoc_template/html/partials/relationships.erb +11 -0
- data/vendor/pdoc_template/html/partials/short_description_list.erb +7 -0
- data/vendor/pdoc_template/html/partials/title.erb +24 -0
- data/vendor/pdoc_template/html/section.erb +18 -0
- metadata +635 -332
- data/builtin/app/shaders/lighting/common.ejs +0 -5
- data/builtin/app/shaders/normal_map/material.js +0 -16
- data/builtin/app/shaders/texture/material.js +0 -18
- data/jax.gems +0 -1
- data/lib/jax/application/builtin/configurable.rb +0 -5
- data/lib/jax/application/builtin/configuration.rb +0 -5
- data/lib/jax/application/builtin.rb +0 -12
- data/lib/jax/application/configurable.rb +0 -19
- data/lib/jax/application/configuration.rb +0 -60
- data/lib/jax/application/railties.rb +0 -26
- data/lib/jax/application.rb +0 -149
- data/lib/jax/core_ext/kernel.rb +0 -7
- data/lib/jax/engine/configurable.rb +0 -19
- data/lib/jax/engine/configuration.rb +0 -49
- data/lib/jax/generators/app/app_generator.rb +0 -96
- data/lib/jax/generators/app/templates/Gemfile.tt +0 -3
- data/lib/jax/generators/app/templates/Rakefile +0 -6
- data/lib/jax/generators/app/templates/app/controllers/application_controller.js.tt +0 -5
- data/lib/jax/generators/app/templates/app/helpers/application_helper.js.tt +0 -3
- data/lib/jax/generators/app/templates/config/application.rb.tt +0 -6
- data/lib/jax/generators/app/templates/config/environment.rb.tt +0 -5
- data/lib/jax/generators/app/templates/config/routes.rb.tt +0 -5
- data/lib/jax/generators/app/templates/public/index.html.tt +0 -26
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +0 -9462
- data/lib/jax/generators/app/templates/public/stylesheets/%file_name%.css.tt +0 -11
- data/lib/jax/generators/app/templates/public/webgl_not_supported.html +0 -26
- data/lib/jax/generators/app/templates/script/jax +0 -7
- data/lib/jax/generators/app/templates/spec/javascripts/controllers/application_controller_spec.js +0 -11
- data/lib/jax/generators/app/templates/spec/javascripts/helpers/application_helper_spec.js +0 -12
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine.yml +0 -91
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine_config.rb +0 -23
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine_runner.rb +0 -32
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_layout.html.erb +0 -104
- data/lib/jax/generators/app.rb +0 -18
- data/lib/jax/generators/commands.rb +0 -220
- data/lib/jax/generators/controller/USAGE +0 -9
- data/lib/jax/generators/controller/controller_generator.rb +0 -66
- data/lib/jax/generators/controller/templates/controller_source.js.tt +0 -16
- data/lib/jax/generators/controller/templates/controller_test.js.tt +0 -11
- data/lib/jax/generators/controller/templates/helper.js.tt +0 -3
- data/lib/jax/generators/controller/templates/helper_test.js.tt +0 -12
- data/lib/jax/generators/interactions.rb +0 -56
- data/lib/jax/generators/light_source/USAGE +0 -14
- data/lib/jax/generators/light_source/light_source_generator.rb +0 -46
- data/lib/jax/generators/material/material_generator.rb +0 -80
- data/lib/jax/generators/material/templates/append.yml.tt +0 -7
- data/lib/jax/generators/model/USAGE +0 -5
- data/lib/jax/generators/model/model_generator.rb +0 -40
- data/lib/jax/generators/model/templates/model.js.tt +0 -11
- data/lib/jax/generators/model/templates/test.js.tt +0 -11
- data/lib/jax/generators/packager/package_generator.rb +0 -32
- data/lib/jax/generators/plugin/USAGE +0 -4
- data/lib/jax/generators/plugin/all.rb +0 -113
- data/lib/jax/generators/plugin/credentials.rb +0 -108
- data/lib/jax/generators/plugin/plugin_generator.rb +0 -72
- data/lib/jax/generators/plugin/plugin_manager.rb +0 -254
- data/lib/jax/generators/plugin/templates/new_plugin/config/routes.rb +0 -3
- data/lib/jax/generators/plugin/templates/new_plugin/spec/.empty_directory +0 -0
- data/lib/jax/generators/script_jax_loader.rb +0 -49
- data/lib/jax/generators/shader/USAGE +0 -4
- data/lib/jax/generators/shader/shader_generator.rb +0 -70
- data/lib/jax/monkeypatch/jasmine/config.rb +0 -45
- data/lib/jax/monkeypatch/jasmine/server.rb +0 -50
- data/lib/jax/monkeypatch/jasmine.rb +0 -3
- data/lib/jax/packager/sprockets_template.rb +0 -77
- data/lib/jax/packager.rb +0 -59
- data/lib/jax/plugin/manifest.rb +0 -71
- data/lib/jax/plugin.rb +0 -49
- data/lib/jax/resource_compiler.rb +0 -60
- data/lib/jax/routes.rb +0 -62
- data/lib/jax/tasks/rake.rb +0 -38
- data/spec/benchmark.htm +0 -93
- data/spec/generators/app_generator_test.rb +0 -42
- data/spec/generators/controller_generator_test.rb +0 -47
- data/spec/generators/light_generator_test.rb +0 -37
- data/spec/generators/material_generator_test.rb +0 -22
- data/spec/generators/model_generator_test.rb +0 -26
- data/spec/generators/plugin_generator_test.rb +0 -114
- data/spec/generators/plugin_manager/push_test.rb +0 -59
- data/spec/generators/plugin_manager_test.rb +0 -192
- data/spec/generators/shader_generator_test.rb +0 -38
- data/spec/javascripts/support/jasmine.yml +0 -85
- data/spec/javascripts/support/jasmine_runner.rb +0 -32
- data/spec/lib/jax/application_test.rb +0 -18
- data/spec/lib/jax/generators/plugin/credentials_test.rb +0 -72
- data/spec/lib/jax/packager_test.rb +0 -87
- data/spec/lib/jax/plugin_test.rb +0 -27
- data/spec/lib/jax/reloading_test.rb +0 -23
- data/spec/lib/jax/routes_test.rb +0 -28
- data/spec/lib/jax/shader_test.rb +0 -29
- data/spec/lib/jax/tasks/jax_rake_test.rb +0 -85
- data/spec/support/bases/generator_test_case.rb +0 -108
- data/spec/support/bases/isolated_test_case.rb +0 -148
- data/spec/support/file_exist_matcher.rb +0 -23
- data/spec/support/spec_shell.rb +0 -110
- data/spec/test_app.rb +0 -3
@@ -0,0 +1,166 @@
|
|
1
|
+
body {
|
2
|
+
font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
|
3
|
+
}
|
4
|
+
|
5
|
+
|
6
|
+
.jasmine_reporter a:visited, .jasmine_reporter a {
|
7
|
+
color: #303;
|
8
|
+
}
|
9
|
+
|
10
|
+
.jasmine_reporter a:hover, .jasmine_reporter a:active {
|
11
|
+
color: blue;
|
12
|
+
}
|
13
|
+
|
14
|
+
.run_spec {
|
15
|
+
float:right;
|
16
|
+
padding-right: 5px;
|
17
|
+
font-size: .8em;
|
18
|
+
text-decoration: none;
|
19
|
+
}
|
20
|
+
|
21
|
+
.jasmine_reporter {
|
22
|
+
margin: 0 5px;
|
23
|
+
}
|
24
|
+
|
25
|
+
.banner {
|
26
|
+
color: #303;
|
27
|
+
background-color: #fef;
|
28
|
+
padding: 5px;
|
29
|
+
}
|
30
|
+
|
31
|
+
.logo {
|
32
|
+
float: left;
|
33
|
+
font-size: 1.1em;
|
34
|
+
padding-left: 5px;
|
35
|
+
}
|
36
|
+
|
37
|
+
.logo .version {
|
38
|
+
font-size: .6em;
|
39
|
+
padding-left: 1em;
|
40
|
+
}
|
41
|
+
|
42
|
+
.runner.running {
|
43
|
+
background-color: yellow;
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
.options {
|
48
|
+
text-align: right;
|
49
|
+
font-size: .8em;
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
.suite {
|
56
|
+
border: 1px outset gray;
|
57
|
+
margin: 5px 0;
|
58
|
+
padding-left: 1em;
|
59
|
+
}
|
60
|
+
|
61
|
+
.suite .suite {
|
62
|
+
margin: 5px;
|
63
|
+
}
|
64
|
+
|
65
|
+
.suite.passed {
|
66
|
+
background-color: #dfd;
|
67
|
+
}
|
68
|
+
|
69
|
+
.suite.failed {
|
70
|
+
background-color: #fdd;
|
71
|
+
}
|
72
|
+
|
73
|
+
.spec {
|
74
|
+
margin: 5px;
|
75
|
+
padding-left: 1em;
|
76
|
+
clear: both;
|
77
|
+
}
|
78
|
+
|
79
|
+
.spec.failed, .spec.passed, .spec.skipped {
|
80
|
+
padding-bottom: 5px;
|
81
|
+
border: 1px solid gray;
|
82
|
+
}
|
83
|
+
|
84
|
+
.spec.failed {
|
85
|
+
background-color: #fbb;
|
86
|
+
border-color: red;
|
87
|
+
}
|
88
|
+
|
89
|
+
.spec.passed {
|
90
|
+
background-color: #bfb;
|
91
|
+
border-color: green;
|
92
|
+
}
|
93
|
+
|
94
|
+
.spec.skipped {
|
95
|
+
background-color: #bbb;
|
96
|
+
}
|
97
|
+
|
98
|
+
.messages {
|
99
|
+
border-left: 1px dashed gray;
|
100
|
+
padding-left: 1em;
|
101
|
+
padding-right: 1em;
|
102
|
+
}
|
103
|
+
|
104
|
+
.passed {
|
105
|
+
background-color: #cfc;
|
106
|
+
display: none;
|
107
|
+
}
|
108
|
+
|
109
|
+
.failed {
|
110
|
+
background-color: #fbb;
|
111
|
+
}
|
112
|
+
|
113
|
+
.skipped {
|
114
|
+
color: #777;
|
115
|
+
background-color: #eee;
|
116
|
+
display: none;
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
/*.resultMessage {*/
|
121
|
+
/*white-space: pre;*/
|
122
|
+
/*}*/
|
123
|
+
|
124
|
+
.resultMessage span.result {
|
125
|
+
display: block;
|
126
|
+
line-height: 2em;
|
127
|
+
color: black;
|
128
|
+
}
|
129
|
+
|
130
|
+
.resultMessage .mismatch {
|
131
|
+
color: black;
|
132
|
+
}
|
133
|
+
|
134
|
+
.stackTrace {
|
135
|
+
white-space: pre;
|
136
|
+
font-size: .8em;
|
137
|
+
margin-left: 10px;
|
138
|
+
max-height: 5em;
|
139
|
+
overflow: auto;
|
140
|
+
border: 1px inset red;
|
141
|
+
padding: 1em;
|
142
|
+
background: #eef;
|
143
|
+
}
|
144
|
+
|
145
|
+
.finished-at {
|
146
|
+
padding-left: 1em;
|
147
|
+
font-size: .6em;
|
148
|
+
}
|
149
|
+
|
150
|
+
.show-passed .passed,
|
151
|
+
.show-skipped .skipped {
|
152
|
+
display: block;
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
#jasmine_content {
|
157
|
+
position:fixed;
|
158
|
+
right: 100%;
|
159
|
+
}
|
160
|
+
|
161
|
+
.runner {
|
162
|
+
border: 1px solid gray;
|
163
|
+
display: block;
|
164
|
+
margin: 5px 0;
|
165
|
+
padding: 2px 0 2px 10px;
|
166
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,478 @@
|
|
1
|
+
//= require <prototype>
|
2
|
+
|
3
|
+
if (!Prototype || Prototype.Version.indexOf('1.6') !== 0) {
|
4
|
+
throw "This script requires Prototype >= 1.6.";
|
5
|
+
}
|
6
|
+
|
7
|
+
Object.isDate = function(object) {
|
8
|
+
return object instanceof Date;
|
9
|
+
};
|
10
|
+
|
11
|
+
/**
|
12
|
+
* class Cookie
|
13
|
+
* Creates a cookie.
|
14
|
+
**/
|
15
|
+
var Cookie = Class.create({
|
16
|
+
/**
|
17
|
+
* new Cookie(name, value[, expires])
|
18
|
+
*
|
19
|
+
* - name (String): The name of the cookie.
|
20
|
+
* - value (String): The value of the cookie.
|
21
|
+
* - expires (Number | Date): Exact date (or number of days from now) that
|
22
|
+
* the cookie will expire.
|
23
|
+
**/
|
24
|
+
initialize: function(name, value, expires) {
|
25
|
+
expires = expires || "";
|
26
|
+
if (Object.isNumber(expires)) {
|
27
|
+
var days = expires;
|
28
|
+
expires = new Date();
|
29
|
+
expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
|
30
|
+
}
|
31
|
+
|
32
|
+
if (Object.isDate(expires))
|
33
|
+
expires = expires.toGMTString();
|
34
|
+
|
35
|
+
if (!Object.isUndefined(expires) && expires !== "")
|
36
|
+
expires = "; expires=" + expires;
|
37
|
+
|
38
|
+
this.name = name;
|
39
|
+
this.value = value;
|
40
|
+
this.expires = expires;
|
41
|
+
|
42
|
+
document.cookie = name + "=" + value + expires + "; path=/";
|
43
|
+
},
|
44
|
+
|
45
|
+
toString: function() {
|
46
|
+
return this.value;
|
47
|
+
},
|
48
|
+
|
49
|
+
inspect: function() {
|
50
|
+
return "#<Cookie #{name}:#{value}>".interpolate(this);
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Cookie
|
56
|
+
**/
|
57
|
+
Object.extend(Cookie, {
|
58
|
+
/**
|
59
|
+
* Cookie.set(name, value, expires)
|
60
|
+
*
|
61
|
+
* Alias of [[Cookie#initialize]].
|
62
|
+
**/
|
63
|
+
set: function(name, value, expires) {
|
64
|
+
return new Cookie(name, value, expires);
|
65
|
+
},
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Cookie.get(name)
|
69
|
+
*
|
70
|
+
* Returns the value of the cookie with the given name.
|
71
|
+
* - name (String): The name of the cookie to retrieve.
|
72
|
+
**/
|
73
|
+
get: function(name) {
|
74
|
+
var c = document.cookie.split(';');
|
75
|
+
|
76
|
+
for (var i = 0, cookie; i < c.length; i++) {
|
77
|
+
cookie = c[i].split('=');
|
78
|
+
if (cookie[0].strip() === name)
|
79
|
+
return cookie[1].strip();
|
80
|
+
}
|
81
|
+
|
82
|
+
return null;
|
83
|
+
},
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Cookie.unset(name)
|
87
|
+
*
|
88
|
+
* Deletes a cookie.
|
89
|
+
* - name (String): The name of the cookie to delete.
|
90
|
+
*
|
91
|
+
**/
|
92
|
+
unset: function(name) {
|
93
|
+
return Cookie.set(name, "", -1);
|
94
|
+
}
|
95
|
+
});
|
96
|
+
|
97
|
+
Cookie.erase = Cookie.unset;
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
if (typeof PDoc === 'undefined') {
|
102
|
+
window.PDoc = {
|
103
|
+
Sidebar: {}
|
104
|
+
};
|
105
|
+
}
|
106
|
+
|
107
|
+
// HISTORY MANAGER (sort of)
|
108
|
+
// Polls for changes to the hash.
|
109
|
+
|
110
|
+
(function() {
|
111
|
+
var PREVIOUS_HASH = null;
|
112
|
+
|
113
|
+
function poll() {
|
114
|
+
var hash = window.location.hash;
|
115
|
+
if (hash && hash !== PREVIOUS_HASH) {
|
116
|
+
document.fire('hash:changed', {
|
117
|
+
previous: PREVIOUS_HASH, current: hash
|
118
|
+
});
|
119
|
+
}
|
120
|
+
PREVIOUS_HASH = hash;
|
121
|
+
window.setTimeout(arguments.callee, 100);
|
122
|
+
}
|
123
|
+
|
124
|
+
Event.observe(window, 'load', poll);
|
125
|
+
})();
|
126
|
+
|
127
|
+
Object.extend(PDoc.Sidebar, {
|
128
|
+
getActiveTab: function() {
|
129
|
+
var activeTab = $('sidebar_tabs').down('.active');
|
130
|
+
if (!activeTab) return null;
|
131
|
+
|
132
|
+
var href = activeTab.readAttribute('href');
|
133
|
+
return href.endsWith('menu_pane') ? 'menu_pane' : 'search_pane';
|
134
|
+
},
|
135
|
+
|
136
|
+
// Remember the state of the sidebar so it can be restored on the next page.
|
137
|
+
serialize: function() {
|
138
|
+
var state = $H({
|
139
|
+
activeTab: PDoc.Sidebar.getActiveTab(),
|
140
|
+
menuScrollOffset: $('menu_pane').scrollTop,
|
141
|
+
searchScrollOffset: $('search_results').scrollTop,
|
142
|
+
searchValue: $('search').getValue()
|
143
|
+
});
|
144
|
+
|
145
|
+
return escape(state.toJSON());
|
146
|
+
},
|
147
|
+
|
148
|
+
// Restore the tree to a certain point based on a cookie.
|
149
|
+
restore: function(state) {
|
150
|
+
try {
|
151
|
+
state = unescape(state).evalJSON();
|
152
|
+
var filterer = $('search').retrieve('filterer');
|
153
|
+
filterer.setSearchValue(state.searchValue);
|
154
|
+
|
155
|
+
(function() {
|
156
|
+
$('menu_pane').scrollTop = state.menuScrollOffset;
|
157
|
+
$('search_results').scrollTop = state.searchScrollOffset;
|
158
|
+
}).defer();
|
159
|
+
} catch(error) {
|
160
|
+
console.log(error);
|
161
|
+
if (!(error instanceof SyntaxError)) throw error;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
});
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
// Live API search.
|
169
|
+
PDoc.Sidebar.Filterer = Class.create({
|
170
|
+
initialize: function(element, options) {
|
171
|
+
this.element = $(element);
|
172
|
+
this.options = Object.extend(
|
173
|
+
Object.clone(PDoc.Sidebar.Filterer.DEFAULT_OPTIONS),
|
174
|
+
options || {}
|
175
|
+
);
|
176
|
+
|
177
|
+
// The browser's "helpful" auto-complete gets in the way.
|
178
|
+
this.element.writeAttribute("autocomplete", "off");
|
179
|
+
this.element.setValue('');
|
180
|
+
|
181
|
+
// Hitting "enter" should do nothing.
|
182
|
+
this.element.up('form').observe("submit", Event.stop);
|
183
|
+
|
184
|
+
this.menu = this.options.menu;
|
185
|
+
this.links = this.menu.select('a');
|
186
|
+
|
187
|
+
this.resultsElement = this.options.resultsElement;
|
188
|
+
|
189
|
+
this.observers = {
|
190
|
+
filter: this.filter.bind(this),
|
191
|
+
keydown: this.keydown.bind(this),
|
192
|
+
keyup: this.keyup.bind(this)
|
193
|
+
};
|
194
|
+
|
195
|
+
this.menu.setStyle({ opacity: 0.9 });
|
196
|
+
this.addObservers();
|
197
|
+
},
|
198
|
+
|
199
|
+
addObservers: function() {
|
200
|
+
this.element.observe('keyup', this.observers.filter);
|
201
|
+
},
|
202
|
+
|
203
|
+
// Called whenever the list of results needs to update as a result of a
|
204
|
+
// changed search key.
|
205
|
+
filter: function(event) {
|
206
|
+
// Clear the text box on ESC.
|
207
|
+
if (event.keyCode && event.keyCode === Event.KEY_ESC) {
|
208
|
+
this.element.setValue('');
|
209
|
+
}
|
210
|
+
|
211
|
+
if (PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode))
|
212
|
+
return;
|
213
|
+
|
214
|
+
// If there's nothing in the text box, clear the results list.
|
215
|
+
var value = $F(this.element).strip().toLowerCase();
|
216
|
+
if (value === '') {
|
217
|
+
this.emptyResults();
|
218
|
+
this.hideResults();
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
|
222
|
+
var urls = this.findURLs(value);
|
223
|
+
this.buildResults(urls);
|
224
|
+
},
|
225
|
+
|
226
|
+
setSearchValue: function(value) {
|
227
|
+
this.element.setValue(value);
|
228
|
+
if (value.strip() === "") {
|
229
|
+
PDoc.Sidebar.Tabs.setActiveTab(0);
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
this.buildResults(this.findURLs(value));
|
233
|
+
},
|
234
|
+
|
235
|
+
// Given a key, finds all the PDoc objects that match.
|
236
|
+
findURLs: function(str) {
|
237
|
+
var results = [];
|
238
|
+
for (var name in PDoc.elements) {
|
239
|
+
if (name.toLowerCase().include(str.toLowerCase()))
|
240
|
+
results.push(PDoc.elements[name]);
|
241
|
+
}
|
242
|
+
return results;
|
243
|
+
},
|
244
|
+
|
245
|
+
buildResults: function(results) {
|
246
|
+
this.emptyResults();
|
247
|
+
|
248
|
+
results.each( function(result) {
|
249
|
+
var li = this._buildResult(result);
|
250
|
+
this.resultsElement.appendChild(li);
|
251
|
+
}, this);
|
252
|
+
this.showResults();
|
253
|
+
},
|
254
|
+
|
255
|
+
_buildResult: function(obj) {
|
256
|
+
var li = new Element('li', { 'class': 'menu-item' });
|
257
|
+
var a = new Element('a', {
|
258
|
+
'class': obj.type.gsub(/\s/, '-'),
|
259
|
+
'href': PDoc.pathPrefix + obj.path
|
260
|
+
}).update(obj.name);
|
261
|
+
|
262
|
+
li.appendChild(a);
|
263
|
+
return li;
|
264
|
+
},
|
265
|
+
|
266
|
+
emptyResults: function() {
|
267
|
+
this.resultsElement.update();
|
268
|
+
},
|
269
|
+
|
270
|
+
hideResults: function() {
|
271
|
+
PDoc.Sidebar.Tabs.setActiveTab(0);
|
272
|
+
//this.resultsElement.hide();
|
273
|
+
document.stopObserving('keydown', this.observers.keydown);
|
274
|
+
document.stopObserving('keyup', this.observers.keyup);
|
275
|
+
},
|
276
|
+
|
277
|
+
showResults: function() {
|
278
|
+
PDoc.Sidebar.Tabs.setActiveTab(1);
|
279
|
+
//this.resultsElement.show();
|
280
|
+
document.stopObserving('keydown', this.observers.keydown);
|
281
|
+
this.element.stopObserving('keyup', this.observers.keyup);
|
282
|
+
this.element.observe('keydown', this.observers.keydown);
|
283
|
+
document.observe('keyup', this.observers.keyup);
|
284
|
+
},
|
285
|
+
|
286
|
+
keydown: function(event) {
|
287
|
+
if (!PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode))
|
288
|
+
return;
|
289
|
+
|
290
|
+
// Also ignore if any modifier keys are present.
|
291
|
+
if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey)
|
292
|
+
return;
|
293
|
+
|
294
|
+
event.stop();
|
295
|
+
|
296
|
+
if (event.keyCode === Event.KEY_RETURN) {
|
297
|
+
// Follow the highlighted item, unless there is none.
|
298
|
+
if (!this.highlighted) return;
|
299
|
+
var a = this.highlighted.down('a');
|
300
|
+
if (a) {
|
301
|
+
window.location.href = a.href;
|
302
|
+
}
|
303
|
+
} else if ([Event.KEY_UP, Event.KEY_DOWN].include(event.keyCode)) {
|
304
|
+
// Is an arrow key.
|
305
|
+
var direction = (Event.KEY_DOWN === event.keyCode) ? 1 : -1;
|
306
|
+
this.highlighted = this.moveHighlight(direction);
|
307
|
+
|
308
|
+
if (!Prototype.Browser.WebKit) {
|
309
|
+
// If up/down key is held down, list should keep scrolling.
|
310
|
+
// WebKit does this automatically because it fires the keydown
|
311
|
+
// event over and over.
|
312
|
+
this._scrollTimer = window.setTimeout(
|
313
|
+
this.scrollList.bind(this, direction), 1000);
|
314
|
+
}
|
315
|
+
}
|
316
|
+
},
|
317
|
+
|
318
|
+
keyup: function(event) {
|
319
|
+
if (this._scrollTimer) {
|
320
|
+
window.clearTimeout(this._scrollTimer);
|
321
|
+
}
|
322
|
+
},
|
323
|
+
|
324
|
+
moveHighlight: function(direction) {
|
325
|
+
if (!this.highlighted) {
|
326
|
+
// If there is none, highlight the first result.
|
327
|
+
this.highlighted =
|
328
|
+
this.resultsElement.down('li').addClassName('highlighted');
|
329
|
+
} else {
|
330
|
+
var method = (direction === 1) ? 'next' : 'previous';
|
331
|
+
this.highlighted.removeClassName('highlighted');
|
332
|
+
var adjacent = this.highlighted[method]('li');
|
333
|
+
// If there isn't an adjacent one, we're at the top or bottom
|
334
|
+
// of the list. Flip it.
|
335
|
+
if (!adjacent) {
|
336
|
+
adjacent = method == 'next' ? this.resultsElement.down('li') :
|
337
|
+
this.resultsElement.down('li:last-of-type');
|
338
|
+
}
|
339
|
+
adjacent.addClassName('highlighted');
|
340
|
+
this.highlighted = adjacent;
|
341
|
+
}
|
342
|
+
|
343
|
+
var h = this.highlighted, r = this.resultsElement;
|
344
|
+
|
345
|
+
var distanceToBottom = h.offsetTop + h.offsetHeight;
|
346
|
+
if (distanceToBottom > (r.offsetHeight + r.scrollTop)) {
|
347
|
+
// Item is below the visible frame.
|
348
|
+
r.scrollTop = distanceToBottom - r.offsetHeight;
|
349
|
+
} else if (h.offsetTop < r.scrollTop) {
|
350
|
+
// Item is above the visible frame.
|
351
|
+
r.scrollTop = h.offsetTop;
|
352
|
+
}
|
353
|
+
|
354
|
+
return this.highlighted;
|
355
|
+
},
|
356
|
+
|
357
|
+
scrollList: function(direction) {
|
358
|
+
this.moveHighlight(direction);
|
359
|
+
this._scrollTimer = window.setTimeout(
|
360
|
+
this.scrollList.bind(this, direction), 100);
|
361
|
+
}
|
362
|
+
});
|
363
|
+
|
364
|
+
Object.extend(PDoc.Sidebar.Filterer, {
|
365
|
+
INTERCEPT_KEYS: [Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN],
|
366
|
+
DEFAULT_OPTIONS: {
|
367
|
+
interval: 0.1,
|
368
|
+
resultsElement: '.search-results'
|
369
|
+
}
|
370
|
+
});
|
371
|
+
|
372
|
+
|
373
|
+
Form.GhostedField = Class.create({
|
374
|
+
initialize: function(element, title, options) {
|
375
|
+
options = options || {};
|
376
|
+
|
377
|
+
this.element = $(element);
|
378
|
+
this.title = title;
|
379
|
+
|
380
|
+
this.isGhosted = true;
|
381
|
+
|
382
|
+
if (options.cloak) {
|
383
|
+
|
384
|
+
// Wrap the native getValue function so that it never returns the
|
385
|
+
// ghosted value. This is optional because it presumes the ghosted
|
386
|
+
// value isn't valid input for the field.
|
387
|
+
this.element.getValue = this.element.getValue.wrap(this.wrappedGetValue.bind(this));
|
388
|
+
}
|
389
|
+
|
390
|
+
this.addObservers();
|
391
|
+
|
392
|
+
this.onBlur();
|
393
|
+
},
|
394
|
+
|
395
|
+
wrappedGetValue: function($proceed) {
|
396
|
+
var value = $proceed();
|
397
|
+
return value === this.title ? "" : value;
|
398
|
+
},
|
399
|
+
|
400
|
+
addObservers: function() {
|
401
|
+
this.element.observe('focus', this.onFocus.bind(this));
|
402
|
+
this.element.observe('blur', this.onBlur.bind(this));
|
403
|
+
|
404
|
+
var form = this.element.up('form');
|
405
|
+
if (form) {
|
406
|
+
form.observe('submit', this.onSubmit.bind(this));
|
407
|
+
}
|
408
|
+
|
409
|
+
// Firefox's bfcache means that form fields need to be re-initialized
|
410
|
+
// when you hit the "back" button to return to the page.
|
411
|
+
if (Prototype.Browser.Gecko) {
|
412
|
+
window.addEventListener('pageshow', this.onBlur.bind(this), false);
|
413
|
+
}
|
414
|
+
},
|
415
|
+
|
416
|
+
onFocus: function() {
|
417
|
+
if (this.isGhosted) {
|
418
|
+
this.element.setValue('');
|
419
|
+
this.setGhosted(false);
|
420
|
+
}
|
421
|
+
},
|
422
|
+
|
423
|
+
onBlur: function() {
|
424
|
+
var value = this.element.getValue();
|
425
|
+
if (value.blank() || value == this.title) {
|
426
|
+
this.setGhosted(true);
|
427
|
+
} else {
|
428
|
+
this.setGhosted(false);
|
429
|
+
}
|
430
|
+
},
|
431
|
+
|
432
|
+
setGhosted: function(isGhosted) {
|
433
|
+
this.isGhosted = isGhosted;
|
434
|
+
this.element[isGhosted ? 'addClassName' : 'removeClassName']('ghosted');
|
435
|
+
if (isGhosted) {
|
436
|
+
this.element.setValue(this.title);
|
437
|
+
}
|
438
|
+
},
|
439
|
+
|
440
|
+
// Hook into the enclosing form's `onsubmit` event so that we clear any
|
441
|
+
// ghosted text before the form is sent.
|
442
|
+
onSubmit: function() {
|
443
|
+
if (this.isGhosted) {
|
444
|
+
this.element.setValue('');
|
445
|
+
}
|
446
|
+
}
|
447
|
+
});
|
448
|
+
|
449
|
+
document.observe('dom:loaded', function() {
|
450
|
+
PDoc.Sidebar.Tabs = new Control.Tabs($('sidebar_tabs'));
|
451
|
+
|
452
|
+
var searchField = $('search');
|
453
|
+
|
454
|
+
if (searchField) {
|
455
|
+
var filterer = new PDoc.Sidebar.Filterer(searchField, {
|
456
|
+
menu: $('api_menu'),
|
457
|
+
resultsElement: $('search_results')
|
458
|
+
});
|
459
|
+
searchField.store('filterer', filterer);
|
460
|
+
}
|
461
|
+
|
462
|
+
// Prevent horizontal scrolling in scrollable sidebar areas.
|
463
|
+
$$('.scrollable').invoke('observe', 'scroll', function() {
|
464
|
+
this.scrollLeft = 0;
|
465
|
+
});
|
466
|
+
|
467
|
+
var sidebarState = Cookie.get('sidebar_state');
|
468
|
+
if (sidebarState) {
|
469
|
+
PDoc.Sidebar.restore(sidebarState);
|
470
|
+
}
|
471
|
+
|
472
|
+
new Form.GhostedField(searchField, searchField.getAttribute('title'),
|
473
|
+
{ cloak: true });
|
474
|
+
});
|
475
|
+
|
476
|
+
Event.observe(window, 'unload', function() {
|
477
|
+
Cookie.set('sidebar_state', PDoc.Sidebar.serialize());
|
478
|
+
});
|