rango 0.2 → 0.2.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/.gitignore +9 -0
  2. data/.gitmodules +3 -0
  3. data/CHANGELOG +5 -0
  4. data/CONTRIBUTORS +1 -0
  5. data/Gemfile +20 -0
  6. data/LICENSE +1 -1
  7. data/README.textile +5 -4
  8. data/benchmarks/ab.rb +6 -0
  9. data/benchmarks/bm/boot.rb +20 -0
  10. data/{spec/rango/version_spec.rb → benchmarks/bm/callbacks.rb} +0 -0
  11. data/benchmarks/bm/request.rb +4 -0
  12. data/benchmarks/bm/routers.rb +22 -0
  13. data/benchmarks/bm/stack.rb +19 -0
  14. data/{spec/stubs/acqs/dir/lib.rb → benchmarks/bm/templates.rb} +0 -0
  15. data/benchmarks/helper.rb +7 -0
  16. data/benchmarks/stubs/merb-app/.gitignore +21 -0
  17. data/benchmarks/stubs/merb-app/Rakefile +35 -0
  18. data/benchmarks/stubs/merb-app/app/controllers/application.rb +4 -0
  19. data/benchmarks/stubs/merb-app/app/controllers/exceptions.rb +15 -0
  20. data/benchmarks/stubs/merb-app/app/helpers/global_helpers.rb +7 -0
  21. data/benchmarks/stubs/merb-app/app/models/user.rb +19 -0
  22. data/benchmarks/stubs/merb-app/app/views/exceptions/not_acceptable.html.erb +63 -0
  23. data/benchmarks/stubs/merb-app/app/views/exceptions/not_found.html.erb +47 -0
  24. data/benchmarks/stubs/merb-app/app/views/layout/application.html.erb +12 -0
  25. data/benchmarks/stubs/merb-app/autotest/discover.rb +4 -0
  26. data/benchmarks/stubs/merb-app/autotest/merb.rb +154 -0
  27. data/benchmarks/stubs/merb-app/autotest/merb_rspec.rb +167 -0
  28. data/benchmarks/stubs/merb-app/config/database.yml +33 -0
  29. data/benchmarks/stubs/merb-app/config/dependencies.rb +36 -0
  30. data/benchmarks/stubs/merb-app/config/environments/development.rb +17 -0
  31. data/benchmarks/stubs/merb-app/config/environments/production.rb +12 -0
  32. data/benchmarks/stubs/merb-app/config/environments/rake.rb +13 -0
  33. data/benchmarks/stubs/merb-app/config/environments/staging.rb +12 -0
  34. data/benchmarks/stubs/merb-app/config/environments/test.rb +14 -0
  35. data/benchmarks/stubs/merb-app/config/init.rb +26 -0
  36. data/benchmarks/stubs/merb-app/config/rack.rb +13 -0
  37. data/benchmarks/stubs/merb-app/config/router.rb +46 -0
  38. data/benchmarks/stubs/merb-app/doc/rdoc/generators/merb_generator.rb +1364 -0
  39. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/api_grease.js +640 -0
  40. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/index.html.erb +37 -0
  41. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.css +252 -0
  42. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.rb +353 -0
  43. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb_doc_styles.css +492 -0
  44. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/prototype.js +2515 -0
  45. data/benchmarks/stubs/merb-app/merb/merb-auth/setup.rb +46 -0
  46. data/benchmarks/stubs/merb-app/merb/merb-auth/strategies.rb +13 -0
  47. data/benchmarks/stubs/merb-app/merb/session/session.rb +11 -0
  48. data/benchmarks/stubs/merb-app/public/.htaccess +17 -0
  49. data/benchmarks/stubs/merb-app/public/favicon.ico +0 -0
  50. data/benchmarks/stubs/merb-app/public/images/merb.jpg +0 -0
  51. data/benchmarks/stubs/merb-app/public/javascripts/application.js +1 -0
  52. data/benchmarks/stubs/merb-app/public/javascripts/jquery.js +19 -0
  53. data/benchmarks/stubs/merb-app/public/merb.fcgi +22 -0
  54. data/benchmarks/stubs/merb-app/public/robots.txt +5 -0
  55. data/benchmarks/stubs/merb-app/public/stylesheets/master.css +119 -0
  56. data/{spec/stubs/acqs/dir/lib_spec.rb → benchmarks/stubs/merb-app/spec/spec.opts} +0 -0
  57. data/benchmarks/stubs/merb-app/spec/spec_helper.rb +27 -0
  58. data/benchmarks/stubs/merb-app/tasks/doc.thor +151 -0
  59. data/benchmarks/stubs/merb-app/tasks/merb.thor/app_script.rb +33 -0
  60. data/benchmarks/stubs/merb-app/tasks/merb.thor/common.rb +70 -0
  61. data/benchmarks/stubs/merb-app/tasks/merb.thor/gem_ext.rb +127 -0
  62. data/benchmarks/stubs/merb-app/tasks/merb.thor/main.thor +152 -0
  63. data/benchmarks/stubs/merb-app/tasks/merb.thor/ops.rb +95 -0
  64. data/benchmarks/stubs/merb-app/tasks/merb.thor/utils.rb +42 -0
  65. data/benchmarks/stubs/merb-core/.gitignore +21 -0
  66. data/benchmarks/stubs/merb-core/Rakefile +35 -0
  67. data/benchmarks/stubs/merb-core/app/controllers/application.rb +4 -0
  68. data/benchmarks/stubs/merb-core/app/controllers/exceptions.rb +15 -0
  69. data/benchmarks/stubs/merb-core/app/helpers/global_helpers.rb +7 -0
  70. data/benchmarks/stubs/merb-core/app/views/exceptions/not_acceptable.html.erb +63 -0
  71. data/benchmarks/stubs/merb-core/app/views/exceptions/not_found.html.erb +47 -0
  72. data/benchmarks/stubs/merb-core/app/views/layout/application.html.erb +12 -0
  73. data/benchmarks/stubs/merb-core/autotest/discover.rb +1 -0
  74. data/benchmarks/stubs/merb-core/autotest/merb.rb +151 -0
  75. data/benchmarks/stubs/merb-core/autotest/merb_rspec.rb +167 -0
  76. data/benchmarks/stubs/merb-core/config/environments/development.rb +17 -0
  77. data/benchmarks/stubs/merb-core/config/environments/production.rb +12 -0
  78. data/benchmarks/stubs/merb-core/config/environments/rake.rb +13 -0
  79. data/benchmarks/stubs/merb-core/config/environments/staging.rb +12 -0
  80. data/benchmarks/stubs/merb-core/config/environments/test.rb +14 -0
  81. data/benchmarks/stubs/merb-core/config/init.rb +27 -0
  82. data/benchmarks/stubs/merb-core/config/rack.rb +13 -0
  83. data/benchmarks/stubs/merb-core/config/router.rb +43 -0
  84. data/benchmarks/stubs/merb-core/doc/rdoc/generators/merb_generator.rb +1364 -0
  85. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/api_grease.js +640 -0
  86. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/index.html.erb +37 -0
  87. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.css +252 -0
  88. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.rb +353 -0
  89. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb_doc_styles.css +492 -0
  90. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/prototype.js +2515 -0
  91. data/benchmarks/stubs/merb-core/public/.htaccess +17 -0
  92. data/benchmarks/stubs/merb-core/public/favicon.ico +0 -0
  93. data/benchmarks/stubs/merb-core/public/images/merb.jpg +0 -0
  94. data/benchmarks/stubs/merb-core/public/javascripts/application.js +1 -0
  95. data/benchmarks/stubs/merb-core/public/merb.fcgi +22 -0
  96. data/benchmarks/stubs/merb-core/public/robots.txt +5 -0
  97. data/benchmarks/stubs/merb-core/public/stylesheets/master.css +119 -0
  98. data/{spec/stubs/acqs/lib.rb → benchmarks/stubs/merb-core/spec/spec.opts} +0 -0
  99. data/benchmarks/stubs/merb-core/spec/spec_helper.rb +22 -0
  100. data/benchmarks/stubs/merb-core/tasks/merb.thor/app_script.rb +33 -0
  101. data/benchmarks/stubs/merb-core/tasks/merb.thor/common.rb +70 -0
  102. data/benchmarks/stubs/merb-core/tasks/merb.thor/gem_ext.rb +127 -0
  103. data/benchmarks/stubs/merb-core/tasks/merb.thor/main.thor +152 -0
  104. data/benchmarks/stubs/merb-core/tasks/merb.thor/ops.rb +95 -0
  105. data/benchmarks/stubs/merb-core/tasks/merb.thor/utils.rb +42 -0
  106. data/benchmarks/stubs/merb-flat/.gitignore +21 -0
  107. data/benchmarks/stubs/merb-flat/README.txt +10 -0
  108. data/benchmarks/stubs/merb-flat/Rakefile +35 -0
  109. data/benchmarks/stubs/merb-flat/application.rb +17 -0
  110. data/benchmarks/stubs/merb-flat/config/framework.rb +9 -0
  111. data/benchmarks/stubs/merb-flat/config/init.rb +42 -0
  112. data/benchmarks/stubs/merb-flat/spec/spec_helper.rb +26 -0
  113. data/benchmarks/stubs/merb-flat/tasks/merb.thor/app_script.rb +33 -0
  114. data/benchmarks/stubs/merb-flat/tasks/merb.thor/common.rb +70 -0
  115. data/benchmarks/stubs/merb-flat/tasks/merb.thor/gem_ext.rb +127 -0
  116. data/benchmarks/stubs/merb-flat/tasks/merb.thor/main.thor +152 -0
  117. data/benchmarks/stubs/merb-flat/tasks/merb.thor/ops.rb +95 -0
  118. data/benchmarks/stubs/merb-flat/tasks/merb.thor/utils.rb +42 -0
  119. data/benchmarks/stubs/merb-flat/views/foo.html.erb +3 -0
  120. data/benchmarks/stubs/merb-very-flat/.gitignore +21 -0
  121. data/benchmarks/stubs/merb-very-flat/Rakefile +35 -0
  122. data/benchmarks/stubs/merb-very-flat/merb-very-flat.rb +61 -0
  123. data/benchmarks/stubs/merb-very-flat/spec/spec_helper.rb +26 -0
  124. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/app_script.rb +33 -0
  125. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/common.rb +70 -0
  126. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/gem_ext.rb +127 -0
  127. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/main.thor +152 -0
  128. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/ops.rb +95 -0
  129. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/utils.rb +42 -0
  130. data/benchmarks/stubs/rails/README +243 -0
  131. data/benchmarks/stubs/rails/Rakefile +10 -0
  132. data/benchmarks/stubs/rails/app/controllers/application_controller.rb +12 -0
  133. data/benchmarks/stubs/rails/app/helpers/application_helper.rb +5 -0
  134. data/benchmarks/stubs/rails/config/boot.rb +112 -0
  135. data/benchmarks/stubs/rails/config/database.yml +22 -0
  136. data/benchmarks/stubs/rails/config/environment.rb +43 -0
  137. data/benchmarks/stubs/rails/config/environments/development.rb +19 -0
  138. data/benchmarks/stubs/rails/config/environments/production.rb +30 -0
  139. data/benchmarks/stubs/rails/config/environments/test.rb +30 -0
  140. data/benchmarks/stubs/rails/config/initializers/backtrace_silencers.rb +9 -0
  141. data/benchmarks/stubs/rails/config/initializers/inflections.rb +12 -0
  142. data/benchmarks/stubs/rails/config/initializers/mime_types.rb +7 -0
  143. data/benchmarks/stubs/rails/config/initializers/new_rails_defaults.rb +21 -0
  144. data/benchmarks/stubs/rails/config/initializers/session_store.rb +17 -0
  145. data/benchmarks/stubs/rails/config/locales/en.yml +5 -0
  146. data/benchmarks/stubs/rails/config/routes.rb +45 -0
  147. data/benchmarks/stubs/rails/doc/README_FOR_APP +2 -0
  148. data/{spec/stubs/acqs/tasks.thor → benchmarks/stubs/rails/log/development.log} +0 -0
  149. data/{stubs/stack/content/TODO.txt → benchmarks/stubs/rails/log/production.log} +0 -0
  150. data/benchmarks/stubs/rails/log/server.log +0 -0
  151. data/benchmarks/stubs/rails/log/test.log +0 -0
  152. data/benchmarks/stubs/rails/public/404.html +30 -0
  153. data/benchmarks/stubs/rails/public/422.html +30 -0
  154. data/benchmarks/stubs/rails/public/500.html +30 -0
  155. data/benchmarks/stubs/rails/public/favicon.ico +0 -0
  156. data/benchmarks/stubs/rails/public/images/rails.png +0 -0
  157. data/benchmarks/stubs/rails/public/index.html +275 -0
  158. data/benchmarks/stubs/rails/public/javascripts/application.js +2 -0
  159. data/benchmarks/stubs/rails/public/javascripts/controls.js +963 -0
  160. data/benchmarks/stubs/rails/public/javascripts/dragdrop.js +973 -0
  161. data/benchmarks/stubs/rails/public/javascripts/effects.js +1128 -0
  162. data/benchmarks/stubs/rails/public/javascripts/prototype.js +4320 -0
  163. data/benchmarks/stubs/rails/public/robots.txt +5 -0
  164. data/benchmarks/stubs/rails/script/about +4 -0
  165. data/benchmarks/stubs/rails/script/console +3 -0
  166. data/benchmarks/stubs/rails/script/dbconsole +3 -0
  167. data/benchmarks/stubs/rails/script/destroy +3 -0
  168. data/benchmarks/stubs/rails/script/generate +3 -0
  169. data/benchmarks/stubs/rails/script/performance/benchmarker +3 -0
  170. data/benchmarks/stubs/rails/script/performance/profiler +3 -0
  171. data/benchmarks/stubs/rails/script/plugin +3 -0
  172. data/benchmarks/stubs/rails/script/runner +3 -0
  173. data/benchmarks/stubs/rails/script/server +3 -0
  174. data/benchmarks/stubs/rails/test/performance/browsing_test.rb +11 -0
  175. data/benchmarks/stubs/rails/test/test_helper.rb +40 -0
  176. data/benchmarks/stubs/ramaze.rb +0 -0
  177. data/benchmarks/stubs/sinatra.rb +11 -0
  178. data/bin/rango +2 -2
  179. data/deps.rip +7 -0
  180. data/deps.rip.rbe +7 -0
  181. data/gems/cache/abstract-1.0.0.gem +0 -0
  182. data/gems/cache/code-cleaner-0.1.gem +0 -0
  183. data/gems/cache/code-cleaner-0.2.gem +0 -0
  184. data/gems/cache/code-cleaner-0.3.gem +0 -0
  185. data/gems/cache/code-cleaner-0.4.gem +0 -0
  186. data/gems/cache/code-cleaner-0.5.gem +0 -0
  187. data/gems/cache/code-cleaner-0.6.gem +0 -0
  188. data/gems/cache/code-cleaner-0.7.gem +0 -0
  189. data/gems/cache/code-cleaner-0.8.1.gem +0 -0
  190. data/gems/cache/code-cleaner-0.8.gem +0 -0
  191. data/gems/cache/erubis-2.6.5.gem +0 -0
  192. data/gems/cache/extlib-0.9.14.gem +0 -0
  193. data/gems/cache/haml-2.2.16.gem +0 -0
  194. data/gems/cache/haml-2.2.17.gem +0 -0
  195. data/gems/cache/nake-0.0.2.gem +0 -0
  196. data/gems/cache/nake-0.0.3.gem +0 -0
  197. data/gems/cache/nake-0.0.5.gem +0 -0
  198. data/gems/cache/nake-0.0.6.gem +0 -0
  199. data/gems/cache/nake-0.0.8.gem +0 -0
  200. data/gems/cache/rack-1.0.1.gem +0 -0
  201. data/gems/cache/rack-1.1.0.gem +0 -0
  202. data/gems/cache/rspec-1.2.9.gem +0 -0
  203. data/gems/cache/rspec-1.3.0.gem +0 -0
  204. data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
  205. data/gems/cache/tilt-0.4.gem +0 -0
  206. data/gems/cache/tilt-0.5.gem +0 -0
  207. data/lib/rango.rb +28 -28
  208. data/lib/rango/cli.rb +34 -0
  209. data/lib/rango/contrib/pagination/adapters/datamapper.rb +21 -17
  210. data/lib/rango/controller.rb +36 -4
  211. data/lib/rango/environments.rb +1 -15
  212. data/lib/rango/exceptions.rb +144 -86
  213. data/lib/rango/helpers.rb +10 -2
  214. data/lib/rango/mailer.rb +48 -0
  215. data/lib/rango/mixins/action_args.rb +5 -7
  216. data/lib/rango/mixins/filters.rb +18 -14
  217. data/lib/rango/mixins/message.rb +30 -24
  218. data/lib/rango/mixins/rendering.rb +54 -0
  219. data/lib/rango/orm/tasks/datamapper.nake +81 -0
  220. data/lib/rango/orm/tasks/sequel.nake +43 -0
  221. data/lib/rango/router/adapters/usher.rb +2 -1
  222. data/lib/rango/stacks/controller.rb +12 -0
  223. data/lib/rango/tasks/spec.nake +9 -0
  224. data/lib/rango/templates/exts/haml.rb +1 -1
  225. data/lib/rango/templates/exts/tilt.rb +10 -0
  226. data/lib/rango/templates/helpers.rb +29 -25
  227. data/lib/rango/templates/template.rb +7 -6
  228. data/rango.gemspec +52 -0
  229. data/rango.pre.gemspec +8 -0
  230. data/spec/rango/environments_spec.rb +1 -1
  231. data/spec/rango/exceptions_spec.rb +8 -7
  232. data/spec/rango/mixins/render_spec.rb +1 -1
  233. data/spec/rango/templates/template_spec.rb +1 -1
  234. data/stubs/stack/content/%name%.gemspec.rbt +52 -0
  235. data/stubs/stack/content/%name%.pre.gemspec.rbt +8 -0
  236. data/stubs/stack/content/CHANGELOG +0 -0
  237. data/stubs/stack/content/Gemfile.rbt +22 -11
  238. data/stubs/stack/content/README.textile.rbt +7 -0
  239. data/stubs/stack/content/config.ru.rbt +33 -62
  240. data/stubs/stack/content/deps.rip +0 -0
  241. data/stubs/stack/content/init.rb.rbt +14 -39
  242. data/stubs/stack/content/lib/%name%.rb.rbt +8 -0
  243. data/stubs/stack/content/lib/%name%/config.rb.rbt +0 -0
  244. data/stubs/stack/content/{environments.rb.rbt → lib/%name%/environments/development.rb.rbt} +5 -0
  245. data/stubs/stack/content/lib/%name%/environments/production.rb.rbt +0 -0
  246. data/stubs/stack/content/lib/%name%/environments/stagging.rb.rbt +0 -0
  247. data/stubs/stack/content/lib/%name%/initializers/middlewares.rb.rbt +5 -0
  248. data/stubs/stack/content/lib/%name%/initializers/urls.rb.rbt +24 -0
  249. data/stubs/stack/content/{models.rb.rbt → lib/%name%/models.rb.rbt} +7 -0
  250. data/stubs/stack/content/{views.rb.rbt → lib/%name%/views.rb.rbt} +2 -8
  251. data/stubs/stack/content/rackup.rb.rbt +41 -0
  252. data/stubs/stack/content/tasks.rb.rbt +52 -0
  253. data/stubs/stack/setup.rb +7 -1
  254. data/support/hooks/pre-commit +12 -0
  255. data/tasks.rb +49 -0
  256. metadata +250 -54
  257. data/Rakefile +0 -33
  258. data/lib/rango/rack/middlewares/email_obfuscator.rb +0 -25
  259. data/lib/rango/version.rb +0 -7
  260. data/stubs/stack/content/.rvmrc.rbt +0 -2
  261. data/stubs/stack/content/Rakefile.rbt +0 -12
@@ -0,0 +1,640 @@
1
+
2
+ function setupPage(){
3
+ hookUpActiveSearch();
4
+ hookUpTabs();
5
+ suppressPostbacks();
6
+ var url_params = getUrlParams();
7
+ if (url_params != null){
8
+ loadUrlParams(url_params);
9
+ }else{
10
+ loadDefaults();
11
+ }
12
+ resizeDivs();
13
+ window.onresize = function(){ resizeDivs(); };
14
+ }
15
+
16
+ function getUrlParams(){
17
+ var window_location = window.location.href
18
+ var param_pos = window_location.search(/\?/)
19
+ if (param_pos > 0){
20
+ return(window_location.slice(param_pos, window_location.length));
21
+ }else{
22
+ return(null);
23
+ }
24
+ }
25
+
26
+ function loadUrlParams(url_param){
27
+ //get the tabs
28
+ var t = getTabs();
29
+ // now find our variables
30
+ var s_params = /(\?)(a=.+?)(&)(name=.*)/;
31
+ var results = url_param.match(s_params);
32
+ url_anchor = results[2].replace(/a=/,'');
33
+
34
+ if (url_anchor.match(/M.+/)){//load the methods tab and scroller content
35
+ setActiveTabAndLoadContent(t[0]);
36
+ }else{
37
+ if(url_anchor.match(/C.+/)){ //load the classes tab and scroller content
38
+ setActiveTabAndLoadContent(t[1]);
39
+ }else{
40
+ if (url_anchor.match(/F.+/)){//load the files tab
41
+ setActiveTabAndLoadContent(t[2]);
42
+ }else{
43
+ // default to loading the methods
44
+ setActiveTabAndLoadContent(t[0]);
45
+ }
46
+ }
47
+ }
48
+ paramLoadOfContentAnchor(url_anchor + "_link");
49
+ }
50
+
51
+ function updateUrlParams(anchor_id, name){
52
+ //Also setting the page title
53
+ //window.document.title = name + " method - MerbBrain.com ";
54
+
55
+ //updating the window location
56
+ var current_href = window.location.href;
57
+ //var m_name = name.replace("?","?");
58
+ var rep_str = ".html?a=" + anchor_id + "&name=" + name;
59
+ var new_href = current_href.replace(/\.html.*/, rep_str);
60
+ if (new_href != current_href){
61
+ window.location.href = new_href;
62
+ }
63
+ }
64
+
65
+ //does as it says...
66
+ function hookUpActiveSearch(){
67
+
68
+ var s_field = $('searchForm').getInputs('text')[0];
69
+ //var s_field = document.forms[0].searchText;
70
+ Event.observe(s_field, 'keydown', function(event) {
71
+ var el = Event.element(event);
72
+ var key = event.which || event.keyCode;
73
+
74
+ switch (key) {
75
+ case Event.KEY_RETURN:
76
+ forceLoadOfContentAnchor(getCurrentAnchor());
77
+ Event.stop(event);
78
+ break;
79
+
80
+ case Event.KEY_UP:
81
+ scrollListToElementOffset(getCurrentAnchor(),-1);
82
+ break;
83
+
84
+ case Event.KEY_DOWN:
85
+ scrollListToElementOffset(getCurrentAnchor(),1);
86
+ break;
87
+
88
+ default:
89
+ break;
90
+ }
91
+
92
+ });
93
+
94
+ Event.observe(s_field, 'keyup', function(event) {
95
+ var el = Event.element(event);
96
+ var key = event.which || event.keyCode;
97
+ switch (key) {
98
+ case Event.KEY_RETURN:
99
+ Event.stop(event);
100
+ break;
101
+
102
+ case Event.KEY_UP:
103
+ break;
104
+
105
+ case Event.KEY_DOWN:
106
+ break;
107
+
108
+ default:
109
+ scrollToName(el.value);
110
+ setSavedSearch(getCurrentTab(), el.value);
111
+ break;
112
+ }
113
+
114
+ });
115
+
116
+ Event.observe(s_field, 'keypress', function(event){
117
+ var el = Event.element(event);
118
+ var key = event.which || event.keyCode;
119
+ switch (key) {
120
+ case Event.KEY_RETURN:
121
+ Event.stop(event);
122
+ break;
123
+
124
+ default:
125
+ break;
126
+ }
127
+
128
+ });
129
+
130
+ //Event.observe(document, 'keypress', function(event){
131
+ // var key = event.which || event.keyCode;
132
+ // if (key == Event.KEY_TAB){
133
+ // cycleNextTab();
134
+ // Event.stop(event);
135
+ // }
136
+ //});
137
+ }
138
+
139
+ function hookUpTabs(){
140
+
141
+ var tabs = getTabs();
142
+ for(x=0; x < tabs.length; x++)
143
+ {
144
+ Event.observe(tabs[x], 'click', function(event){
145
+ var el = Event.element(event);
146
+ setActiveTabAndLoadContent(el);
147
+ });
148
+ //tabs[x].onclick = function (){ return setActiveTabAndLoadContent(this);}; //the prototype guys say this is bad..
149
+ }
150
+
151
+ }
152
+
153
+ function suppressPostbacks(){
154
+ Event.observe('searchForm', 'submit', function(event){
155
+ Event.stop(event);
156
+ });
157
+ }
158
+
159
+ function loadDefaults(){
160
+ var t = getTabs();
161
+ setActiveTabAndLoadContent(t[0]); //default loading of the first tab
162
+ }
163
+
164
+ function resizeDivs(){
165
+ var inner_height = 700;
166
+ if (window.innerHeight){
167
+ inner_height = window.innerHeight; //all browsers except IE use this to determine the space available inside a window. Thank you Microsoft!!
168
+ }else{
169
+ if(document.documentElement.clientHeight > 0){ //IE uses this in 'strict' mode
170
+ inner_height = document.documentElement.clientHeight;
171
+ }else{
172
+ inner_height = document.body.clientHeight; //IE uses this in 'quirks' mode
173
+ }
174
+ }
175
+ $('rdocContent').style.height = (inner_height - 92) + "px";//Thankfully all browsers can agree on how to set the height of a div
176
+ $('listScroller').style.height = (inner_height - 88) + "px";
177
+ }
178
+
179
+ //The main function for handling clicks on the tabs
180
+ function setActiveTabAndLoadContent(current_tab){
181
+ changeLoadingStatus("on");
182
+ var tab_string = String(current_tab.innerHTML).strip(); //thank you ProtoType!
183
+ switch (tab_string){
184
+ case "classes":
185
+ setCurrentTab("classes");
186
+ loadScrollerContent('fr_class_index.html');
187
+ setSearchFieldValue(getSavedSearch("classes"));
188
+ scrollToName(getSavedSearch("classes"));
189
+ setSearchFocus();
190
+ break;
191
+
192
+ case "files":
193
+ setCurrentTab("files");
194
+ loadScrollerContent('fr_file_index.html');
195
+ setSearchFieldValue(getSavedSearch("files"));
196
+ scrollToName(getSavedSearch("files"));
197
+ setSearchFocus();
198
+ break;
199
+
200
+ case "methods":
201
+ setCurrentTab("methods");
202
+ loadScrollerContent('fr_method_index.html');
203
+ setSearchFieldValue(getSavedSearch("methods"));
204
+ scrollToName(getSavedSearch("methods"));
205
+ setSearchFocus();
206
+ break;
207
+
208
+ default:
209
+ break;
210
+ }
211
+ changeLoadingStatus("off");
212
+ }
213
+
214
+ function cycleNextTab(){
215
+ var currentT = getCurrentTab();
216
+ var tabs = getTabs();
217
+ if (currentT == "methods"){
218
+ setActiveTabAndLoadContent(tabs[1]);
219
+ setSearchFocus();
220
+ }else{
221
+ if (currentT == "classes"){
222
+ setActiveTabAndLoadContent(tabs[2]);
223
+ setSearchFocus();
224
+ }else{
225
+ if (currentT == "files"){
226
+ setActiveTabAndLoadContent(tabs[0]);
227
+ setSearchFocus();
228
+ }
229
+ }
230
+ }
231
+ }
232
+
233
+ function getTabs(){
234
+ return($('groupType').getElementsByTagName('li'));
235
+ }
236
+
237
+ var Active_Tab = "";
238
+ function getCurrentTab(){
239
+ return Active_Tab;
240
+ }
241
+
242
+ function setCurrentTab(tab_name){
243
+ var tabs = getTabs();
244
+ for(x=0; x < tabs.length; x++)
245
+ {
246
+ if(tabs[x].innerHTML.strip() == tab_name) //W00t!!! String.prototype.strip!
247
+ {
248
+ tabs[x].className = "activeLi";
249
+ Active_Tab = tab_name;
250
+ }
251
+ else
252
+ {
253
+ tabs[x].className = "";
254
+ }
255
+ }
256
+ }
257
+
258
+ //These globals should not be used globally (hence the getters and setters)
259
+ var File_Search = "";
260
+ var Method_Search = "";
261
+ var Class_Search = "";
262
+ function setSavedSearch(tab_name, s_val){
263
+ switch(tab_name){
264
+ case "methods":
265
+ Method_Search = s_val;
266
+ break;
267
+ case "files":
268
+ File_Search = s_val;
269
+ break;
270
+ case "classes":
271
+ Class_Search = s_val;
272
+ break;
273
+ }
274
+ }
275
+
276
+ function getSavedSearch(tab_name){
277
+ switch(tab_name){
278
+ case "methods":
279
+ return (Method_Search);
280
+ break;
281
+ case "files":
282
+ return (File_Search);
283
+ break;
284
+ case "classes":
285
+ return (Class_Search);
286
+ break;
287
+ }
288
+ }
289
+
290
+ //These globals handle the history stack
291
+
292
+
293
+ function setListScrollerContent(s){
294
+
295
+ $('listScroller').innerHTML = s;
296
+ }
297
+
298
+ function setMainContent(s){
299
+
300
+ $('rdocContent').innerHTML = s;
301
+ }
302
+
303
+ function setSearchFieldValue(s){
304
+
305
+ document.forms[0].searchText.value = s;
306
+ }
307
+
308
+ function getSearchFieldValue(){
309
+
310
+ return Form.Element.getValue('searchText');
311
+ }
312
+
313
+ function setSearchFocus(){
314
+
315
+ document.forms[0].searchText.focus();
316
+ }
317
+
318
+ var Anchor_ID_Of_Current = null; // holds the last highlighted anchor tag in the scroll lsit
319
+ function getCurrentAnchor(){
320
+ return(Anchor_ID_Of_Current);
321
+ }
322
+
323
+ function setCurrentAnchor(a_id){
324
+ Anchor_ID_Of_Current = a_id;
325
+ }
326
+
327
+ //var Index_Of_Current = 0; //holds the last highlighted index
328
+ //function getCurrentIndex(){
329
+ // return (Index_Of_Current);
330
+ //}
331
+
332
+ //function setCurrentIndex(new_i){
333
+ // Index_Of_Current = new_i;
334
+ //}
335
+
336
+ function loadScrollerContent(url){
337
+
338
+ var scrollerHtml = new Ajax.Request(url, {
339
+ asynchronous: false,
340
+ method: 'get',
341
+ onComplete: function(method_data) {
342
+ setListScrollerContent(method_data.responseText);
343
+ }
344
+ });
345
+
346
+ }
347
+
348
+ //called primarily from the links inside the scroller list
349
+ //loads the main page div then jumps to the anchor/element with id
350
+ function loadContent(url, anchor_id){
351
+
352
+ var mainHtml = new Ajax.Request(url, {
353
+ method: 'get',
354
+ onLoading: changeLoadingStatus("on"),
355
+ onSuccess: function(method_data) {
356
+ setMainContent(method_data.responseText);},
357
+ onComplete: function(request) {
358
+ changeLoadingStatus("off");
359
+ new jumpToAnchor(anchor_id);
360
+ }
361
+ });
362
+ }
363
+
364
+ //An alternative function that also will stuff the index history for methods, files, classes
365
+ function loadIndexContent(url, anchor_id, name, scope)
366
+ {
367
+ if (From_URL_Param == true){
368
+ var mainHtml = new Ajax.Request(url, {
369
+ method: 'get',
370
+ onLoading: changeLoadingStatus("on"),
371
+ onSuccess: function(method_data) {
372
+ setMainContent(method_data.responseText);},
373
+ onComplete: function(request) {
374
+ changeLoadingStatus("off");
375
+ updateBrowserBar(name, anchor_id, scope);
376
+ new jumpToAnchor(anchor_id);}
377
+ });
378
+ From_URL_Param = false;
379
+ }else{
380
+ updateUrlParams(anchor_id, name);
381
+ }
382
+
383
+ }
384
+
385
+ function updateBrowserBar(name, anchor_id, scope){
386
+ if (getCurrentTab() == "methods"){
387
+ $('browserBarInfo').update("<small>class/module:</small>&nbsp;<a href=\"#\" onclick=\"jumpToTop();\">" + scope + "</a>&nbsp;&nbsp;<small>method:</small>&nbsp;<strong><a href=\"#\" onclick=\"jumpToAnchor('"+ anchor_id +"')\">" + name + "</a></strong> ");
388
+ }else{ if(getCurrentTab() == "classes"){
389
+ $('browserBarInfo').update("<small>class/module:</small>&nbsp;<a href=\"#\" onclick=\"jumpToTop();\">" + scope + "::" + name + "</strong> ");
390
+ }else{
391
+ $('browserBarInfo').update("<small>file:</small>&nbsp;<a href=\"#\" onclick=\"jumpToTop();\">" + scope + "/" + name + "</strong> ");
392
+ }
393
+ }
394
+ }
395
+
396
+
397
+ // Force loads the contents of the index of the current scroller list. It does this by
398
+ // pulling the onclick method out and executing it manually.
399
+ function forceLoadOfContent(index_to_load){
400
+ var scroller = $('listScroller');
401
+ var a_array = scroller.getElementsByTagName('a');
402
+ if ((index_to_load >= 0) && (index_to_load < a_array.length)){
403
+ var load_element = a_array[index_to_load];
404
+ var el_text = load_element.innerHTML.strip();
405
+ setSearchFieldValue(el_text);
406
+ setSavedSearch(getCurrentTab(), el_text);
407
+ eval("new " + load_element.onclick);
408
+ }
409
+ }
410
+
411
+ function forceLoadOfContentAnchor(anchor_id){
412
+
413
+ var load_element = $(anchor_id);
414
+ if (load_element != null){
415
+ var el_text = load_element.innerHTML.strip();
416
+ setSearchFieldValue(el_text);
417
+ scrollToAnchor(anchor_id);
418
+ setSavedSearch(getCurrentTab(), el_text);
419
+ eval("new " + load_element.onclick);
420
+ }
421
+ }
422
+
423
+ var From_URL_Param = false;
424
+ function paramLoadOfContentAnchor(anchor_id){
425
+ From_URL_Param = true;
426
+ forceLoadOfContentAnchor(anchor_id);
427
+ }
428
+
429
+ //this handles the up/down keystrokes to move the selection of items in the list
430
+ function scrollListToElementOffset(anchor_id, offset){
431
+ var scroller = $('listScroller');
432
+ var a_array = scroller.getElementsByTagName('a');
433
+ var current_index = findIndexOfAnchor(a_array, anchor_id);
434
+ if ((current_index >= 0) && (current_index < a_array.length)){
435
+ scrollListToAnchor(a_array[current_index + offset].id);
436
+ setListActiveAnchor(a_array[current_index + offset].id);
437
+ }
438
+ }
439
+
440
+ function findIndexOfAnchor(a_array, anchor_id){
441
+ var found=false;
442
+ var counter = 0;
443
+ while(!found && counter < a_array.length){
444
+ if (a_array[counter].id == anchor_id){
445
+ found = true;
446
+ }else{
447
+ counter +=1;
448
+ }
449
+ }
450
+ return(counter);
451
+ }
452
+
453
+ function scrollToName(searcher_name){
454
+
455
+ var scroller = $('listScroller');
456
+ var a_array = scroller.getElementsByTagName('a');
457
+
458
+ if (!searcher_name.match(new RegExp(/\s+/))){ //if searcher name is blank
459
+
460
+ var searcher_pattern = new RegExp("^"+searcher_name, "i"); //the "i" is for case INsensitive
461
+ var found_index = -1;
462
+
463
+ var found = false;
464
+ var x = 0;
465
+ while(!found && x < a_array.length){
466
+ if(a_array[x].innerHTML.match(searcher_pattern)){
467
+ found = true;
468
+ found_index = x;
469
+ }
470
+ else{
471
+ x++;
472
+ }
473
+ }
474
+
475
+ // // an attempt at binary searching... have not given up on this yet...
476
+ //found_index = binSearcher(searcher_pattern, a_array, 0, a_array.length);
477
+
478
+ if ((found_index >= 0) && (found_index < a_array.length)){
479
+
480
+ scrollListToAnchor(a_array[found_index].id);//scroll to the item
481
+ setListActiveAnchor(a_array[found_index].id);//highlight the item
482
+ }
483
+ }else{ //since searcher name is blank
484
+ //scrollListToIndex(a_array, 0);//scroll to the item
485
+ //setListActiveItem(a_array, 0);//highlight the item
486
+ }
487
+ }
488
+
489
+ function scrollToAnchor(anchor_id){
490
+ var scroller = $('listScroller');
491
+ if ($(anchor_id) != null){
492
+ scrollListToAnchor(anchor_id);
493
+ setListActiveAnchor(anchor_id);
494
+ }
495
+ }
496
+
497
+ function getY(element){
498
+
499
+ var y = 0;
500
+ for( var e = element; e; e = e.offsetParent)//iterate the offset Parents
501
+ {
502
+ y += e.offsetTop; //add up the offsetTop values
503
+ }
504
+ //for( e = element.parentNode; e && e != document.body; e = e.parentNode)
505
+ // if (e.scrollTop) y -= e.scrollTop; //subtract scrollbar values
506
+ return y;
507
+ }
508
+
509
+ //function setListActiveItem(item_array, active_index){
510
+ //
511
+ // item_array[getCurrentIndex()].className = "";
512
+ // setCurrentIndex(active_index);
513
+ // item_array[getCurrentIndex()].className = "activeA"; //setting the active class name
514
+ //}
515
+
516
+ function setListActiveAnchor(active_anchor){
517
+ if ((getCurrentAnchor() != null) && ($(getCurrentAnchor()) != null)){
518
+ $(getCurrentAnchor()).className = "";
519
+ }
520
+ setCurrentAnchor(active_anchor);
521
+ $(getCurrentAnchor()).className = "activeA";
522
+
523
+ }
524
+
525
+ //handles the scrolling of the list and setting of the current index
526
+ //function scrollListToIndex(a_array, scroll_index){
527
+ // if (scroll_index > 0){
528
+ // var scroller = $('listScroller');
529
+ // scroller.scrollTop = getY(a_array[scroll_index]) - 120; //the -120 is what keeps it from going to the top...
530
+ // }
531
+ //}
532
+
533
+ function scrollListToAnchor(scroll2_anchor){
534
+ var scroller = $('listScroller');
535
+ scroller.scrollTop = getY($(scroll2_anchor)) - 120;
536
+ }
537
+
538
+ function jumpToAnchor(anchor_id){
539
+
540
+ var contentScroller = $('rdocContent');
541
+ var a_div = $(anchor_id);
542
+ contentScroller.scrollTop = getY(a_div) - 80; //80 is the offset to adjust scroll point
543
+ var a_title = $(anchor_id + "_title");
544
+ a_title.style.backgroundColor = "#222";
545
+ a_title.style.color = "#FFF";
546
+ a_title.style.padding = "3px";
547
+ // a_title.style.borderBottom = "2px solid #ccc";
548
+
549
+ //other attempts
550
+ //a_div.className = "activeMethod"; //setting the active class name
551
+ //a_div.style.backgroundColor = "#ffc";
552
+ //var titles = a_div.getElementsByClassName("title");
553
+ //titles[0].className = "activeTitle";
554
+
555
+ }
556
+
557
+ function jumpToTop(){
558
+ $('rdocContent').scrollTop = 0;
559
+ }
560
+
561
+ function changeLoadingStatus(status){
562
+ if (status == "on"){
563
+ $('loadingStatus').show();
564
+ }
565
+ else{
566
+ $('loadingStatus').hide();
567
+ }
568
+ }
569
+
570
+ //************* Misc functions (mostly from the old rdocs) ***********************
571
+ //snagged code from the old templating system
572
+ function toggleSource( id ){
573
+
574
+ var elem
575
+ var link
576
+
577
+ if( document.getElementById )
578
+ {
579
+ elem = document.getElementById( id )
580
+ link = document.getElementById( "l_" + id )
581
+ }
582
+ else if ( document.all )
583
+ {
584
+ elem = eval( "document.all." + id )
585
+ link = eval( "document.all.l_" + id )
586
+ }
587
+ else
588
+ return false;
589
+
590
+ if( elem.style.display == "block" )
591
+ {
592
+ elem.style.display = "none"
593
+ link.innerHTML = "show source"
594
+ }
595
+ else
596
+ {
597
+ elem.style.display = "block"
598
+ link.innerHTML = "hide source"
599
+ }
600
+ }
601
+
602
+ function openCode( url ){
603
+ window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
604
+ }
605
+
606
+ //this function handles the ajax calling and afterits loaded the jumping to the anchor...
607
+ function jsHref(url){
608
+ //alert(url);
609
+ var mainHtml = new Ajax.Request(url, {
610
+ method: 'get',
611
+ onSuccess: function(method_data) {
612
+ setMainContent(method_data.responseText);}
613
+ });
614
+ }
615
+
616
+ //function comparePatterns(string, regexp){
617
+ // var direction = 0;
618
+ //
619
+ //
620
+ // return (direction)
621
+ //}
622
+
623
+ ////returns the index of the element
624
+ //function binSearcher(regexp_pattern, list, start_index, stop_index){
625
+ // //divide the list in half
626
+ // var split_point = 0;
627
+ // split_point = parseInt((stop_index - start_index)/2);
628
+ // direction = comparePatterns(list[split_point].innerHTML, regexp_pattern);
629
+ // if(direction < 0)
630
+ // return (binSearcher(regexp_pattern, list, start_index, split_point));
631
+ // else
632
+ // if(direction > 0)
633
+ // return (binSearcher(regexp_pattern, list, split_point, stop_index));
634
+ // else
635
+ // return(split_point);
636
+ //
637
+ //}
638
+
639
+
640
+