Pistos-ramaze 2008.09

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (588) hide show
  1. data/README.markdown +481 -0
  2. data/Rakefile +228 -0
  3. data/benchmark/results.txt +131 -0
  4. data/benchmark/run.rb +362 -0
  5. data/benchmark/suite/minimal.rb +13 -0
  6. data/benchmark/suite/no_informer.rb +9 -0
  7. data/benchmark/suite/no_sessions.rb +10 -0
  8. data/benchmark/suite/no_template.rb +9 -0
  9. data/benchmark/suite/simple.rb +7 -0
  10. data/benchmark/suite/template_amrita2.rb +17 -0
  11. data/benchmark/suite/template_builder.rb +12 -0
  12. data/benchmark/suite/template_erubis.rb +10 -0
  13. data/benchmark/suite/template_ezamar.rb +10 -0
  14. data/benchmark/suite/template_haml.rb +15 -0
  15. data/benchmark/suite/template_liquid.rb +13 -0
  16. data/benchmark/suite/template_markaby.rb +11 -0
  17. data/benchmark/suite/template_nagoro.rb +10 -0
  18. data/benchmark/suite/template_redcloth.rb +15 -0
  19. data/benchmark/suite/template_tenjin.rb +10 -0
  20. data/benchmark/test.rb +35 -0
  21. data/bin/ramaze +80 -0
  22. data/doc/AUTHORS +29 -0
  23. data/doc/CHANGELOG +19530 -0
  24. data/doc/COPYING +56 -0
  25. data/doc/FAQ +92 -0
  26. data/doc/GPL +339 -0
  27. data/doc/INSTALL +92 -0
  28. data/doc/LEGAL +26 -0
  29. data/doc/TODO +29 -0
  30. data/doc/meta/announcement.txt +99 -0
  31. data/doc/meta/configuration.txt +163 -0
  32. data/doc/meta/internals.txt +278 -0
  33. data/doc/meta/users.kml +64 -0
  34. data/doc/readme_chunks/appendix.txt +10 -0
  35. data/doc/readme_chunks/examples.txt +38 -0
  36. data/doc/readme_chunks/features.txt +148 -0
  37. data/doc/readme_chunks/getting_help.txt +5 -0
  38. data/doc/readme_chunks/getting_started.txt +18 -0
  39. data/doc/readme_chunks/installing.txt +92 -0
  40. data/doc/readme_chunks/introduction.txt +18 -0
  41. data/doc/readme_chunks/principles.txt +56 -0
  42. data/doc/readme_chunks/thanks.txt +59 -0
  43. data/doc/tutorial/todolist.html +742 -0
  44. data/doc/tutorial/todolist.mkd +787 -0
  45. data/examples/app/auth/auth.rb +54 -0
  46. data/examples/app/auth/template/layout.haml +20 -0
  47. data/examples/app/auth/template/login.haml +16 -0
  48. data/examples/app/blog/README +3 -0
  49. data/examples/app/blog/controller/main.rb +29 -0
  50. data/examples/app/blog/model/entry.rb +30 -0
  51. data/examples/app/blog/public/styles/blog.css +132 -0
  52. data/examples/app/blog/spec/blog.rb +87 -0
  53. data/examples/app/blog/start.rb +7 -0
  54. data/examples/app/blog/view/edit.xhtml +17 -0
  55. data/examples/app/blog/view/index.xhtml +17 -0
  56. data/examples/app/blog/view/layout.xhtml +11 -0
  57. data/examples/app/blog/view/new.xhtml +16 -0
  58. data/examples/app/chat/model/history.rb +36 -0
  59. data/examples/app/chat/model/message.rb +7 -0
  60. data/examples/app/chat/public/css/chat.css +13 -0
  61. data/examples/app/chat/public/js/chat.js +22 -0
  62. data/examples/app/chat/public/js/jquery.js +3436 -0
  63. data/examples/app/chat/start.rb +40 -0
  64. data/examples/app/chat/view/chat.xhtml +9 -0
  65. data/examples/app/chat/view/index.xhtml +7 -0
  66. data/examples/app/chat/view/layout.xhtml +13 -0
  67. data/examples/app/localization/start.rb +35 -0
  68. data/examples/app/rapaste/Rakefile +34 -0
  69. data/examples/app/rapaste/controller/paste.rb +101 -0
  70. data/examples/app/rapaste/model/paste.rb +58 -0
  71. data/examples/app/rapaste/public/css/active4d.css +114 -0
  72. data/examples/app/rapaste/public/css/all_hallows_eve.css +72 -0
  73. data/examples/app/rapaste/public/css/amy.css +147 -0
  74. data/examples/app/rapaste/public/css/blackboard.css +88 -0
  75. data/examples/app/rapaste/public/css/brilliance_black.css +605 -0
  76. data/examples/app/rapaste/public/css/brilliance_dull.css +599 -0
  77. data/examples/app/rapaste/public/css/cobalt.css +149 -0
  78. data/examples/app/rapaste/public/css/dawn.css +121 -0
  79. data/examples/app/rapaste/public/css/display.css +197 -0
  80. data/examples/app/rapaste/public/css/eiffel.css +121 -0
  81. data/examples/app/rapaste/public/css/espresso_libre.css +109 -0
  82. data/examples/app/rapaste/public/css/idle.css +62 -0
  83. data/examples/app/rapaste/public/css/iplastic.css +80 -0
  84. data/examples/app/rapaste/public/css/lazy.css +73 -0
  85. data/examples/app/rapaste/public/css/mac_classic.css +123 -0
  86. data/examples/app/rapaste/public/css/magicwb_amiga.css +104 -0
  87. data/examples/app/rapaste/public/css/pastels_on_dark.css +188 -0
  88. data/examples/app/rapaste/public/css/slush_poppies.css +85 -0
  89. data/examples/app/rapaste/public/css/spacecadet.css +51 -0
  90. data/examples/app/rapaste/public/css/sunburst.css +180 -0
  91. data/examples/app/rapaste/public/css/twilight.css +137 -0
  92. data/examples/app/rapaste/public/css/zenburnesque.css +91 -0
  93. data/examples/app/rapaste/public/js/jquery.js +11 -0
  94. data/examples/app/rapaste/spec/rapaste.rb +51 -0
  95. data/examples/app/rapaste/start.rb +25 -0
  96. data/examples/app/rapaste/view/copy.xhtml +10 -0
  97. data/examples/app/rapaste/view/index.xhtml +9 -0
  98. data/examples/app/rapaste/view/layout.xhtml +25 -0
  99. data/examples/app/rapaste/view/list.xhtml +29 -0
  100. data/examples/app/rapaste/view/search.xhtml +41 -0
  101. data/examples/app/rapaste/view/view.xhtml +37 -0
  102. data/examples/app/sourceview/public/coderay.css +104 -0
  103. data/examples/app/sourceview/public/images/file.gif +0 -0
  104. data/examples/app/sourceview/public/images/folder.gif +0 -0
  105. data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
  106. data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
  107. data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
  108. data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
  109. data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
  110. data/examples/app/sourceview/public/images/tv-item.gif +0 -0
  111. data/examples/app/sourceview/public/jquery.js +11 -0
  112. data/examples/app/sourceview/public/jquery.treeview.css +48 -0
  113. data/examples/app/sourceview/public/jquery.treeview.js +223 -0
  114. data/examples/app/sourceview/public/sourceview.js +52 -0
  115. data/examples/app/sourceview/sourceview.rb +77 -0
  116. data/examples/app/sourceview/template/index.haml +59 -0
  117. data/examples/app/todolist/README +1 -0
  118. data/examples/app/todolist/public/favicon.ico +0 -0
  119. data/examples/app/todolist/public/js/jquery.js +1923 -0
  120. data/examples/app/todolist/public/ramaze.png +0 -0
  121. data/examples/app/todolist/spec/todolist.rb +132 -0
  122. data/examples/app/todolist/src/controller/main.rb +70 -0
  123. data/examples/app/todolist/src/element/page.rb +31 -0
  124. data/examples/app/todolist/src/model.rb +14 -0
  125. data/examples/app/todolist/start.rb +11 -0
  126. data/examples/app/todolist/template/index.xhtml +17 -0
  127. data/examples/app/todolist/template/new.xhtml +7 -0
  128. data/examples/app/upload/start.rb +19 -0
  129. data/examples/app/upload/view/index.xhtml +25 -0
  130. data/examples/app/whywiki/spec/whywiki.rb +58 -0
  131. data/examples/app/whywiki/start.rb +46 -0
  132. data/examples/app/whywiki/template/edit.xhtml +14 -0
  133. data/examples/app/whywiki/template/show.xhtml +18 -0
  134. data/examples/app/wikore/spec/wikore.rb +111 -0
  135. data/examples/app/wikore/src/controller.rb +80 -0
  136. data/examples/app/wikore/src/model.rb +53 -0
  137. data/examples/app/wikore/start.rb +9 -0
  138. data/examples/app/wikore/template/index.xhtml +8 -0
  139. data/examples/app/wiktacular/README +2 -0
  140. data/examples/app/wiktacular/mkd/link/2007-07-20_19-45-51.mkd +1 -0
  141. data/examples/app/wiktacular/mkd/link/current.mkd +1 -0
  142. data/examples/app/wiktacular/mkd/main/2007-07-20_16-31-33.mkd +1 -0
  143. data/examples/app/wiktacular/mkd/main/2007-07-20_19-21-12.mkd +1 -0
  144. data/examples/app/wiktacular/mkd/main/2007-07-20_19-23-10.mkd +2 -0
  145. data/examples/app/wiktacular/mkd/main/2007-07-20_19-45-07.mkd +2 -0
  146. data/examples/app/wiktacular/mkd/main/current.mkd +2 -0
  147. data/examples/app/wiktacular/mkd/markdown/current.mkd +3 -0
  148. data/examples/app/wiktacular/mkd/testing/2007-07-20_16-43-46.mkd +2 -0
  149. data/examples/app/wiktacular/mkd/testing/2007-07-20_19-43-50.mkd +3 -0
  150. data/examples/app/wiktacular/mkd/testing/2007-07-21_18-46-01.mkd +11 -0
  151. data/examples/app/wiktacular/mkd/testing/2007-07-21_18-46-32.mkd +13 -0
  152. data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-08.mkd +17 -0
  153. data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-54.mkd +17 -0
  154. data/examples/app/wiktacular/mkd/testing/current.mkd +17 -0
  155. data/examples/app/wiktacular/public/favicon.ico +0 -0
  156. data/examples/app/wiktacular/public/screen.css +72 -0
  157. data/examples/app/wiktacular/spec/wiktacular.rb +157 -0
  158. data/examples/app/wiktacular/src/controller.rb +55 -0
  159. data/examples/app/wiktacular/src/model.rb +102 -0
  160. data/examples/app/wiktacular/start.rb +8 -0
  161. data/examples/app/wiktacular/template/edit.xhtml +6 -0
  162. data/examples/app/wiktacular/template/html_layout.xhtml +27 -0
  163. data/examples/app/wiktacular/template/index.xhtml +9 -0
  164. data/examples/app/wiktacular/template/new.xhtml +6 -0
  165. data/examples/basic/element.rb +45 -0
  166. data/examples/basic/gestalt.rb +27 -0
  167. data/examples/basic/hello.rb +15 -0
  168. data/examples/basic/layout.rb +28 -0
  169. data/examples/basic/linking.rb +29 -0
  170. data/examples/basic/simple.rb +56 -0
  171. data/examples/helpers/cache.rb +31 -0
  172. data/examples/helpers/form_with_sequel.rb +24 -0
  173. data/examples/helpers/httpdigest.rb +50 -0
  174. data/examples/helpers/identity.rb +18 -0
  175. data/examples/helpers/nitro_form.rb +23 -0
  176. data/examples/helpers/paginate.rb +71 -0
  177. data/examples/helpers/provide.rb +23 -0
  178. data/examples/helpers/rest.rb +28 -0
  179. data/examples/helpers/simple_captcha.rb +29 -0
  180. data/examples/misc/css.rb +37 -0
  181. data/examples/misc/facebook.rb +159 -0
  182. data/examples/misc/memleak_detector.rb +32 -0
  183. data/examples/misc/nagoro_element.rb +43 -0
  184. data/examples/misc/ramaise.rb +132 -0
  185. data/examples/misc/rapp.rb +45 -0
  186. data/examples/misc/sequel_scaffolding.rb +34 -0
  187. data/examples/misc/simple_auth.rb +35 -0
  188. data/examples/templates/template/external.amrita +19 -0
  189. data/examples/templates/template/external.haml +22 -0
  190. data/examples/templates/template/external.liquid +28 -0
  191. data/examples/templates/template/external.mab +30 -0
  192. data/examples/templates/template/external.nag +28 -0
  193. data/examples/templates/template/external.redcloth +19 -0
  194. data/examples/templates/template/external.rem +30 -0
  195. data/examples/templates/template/external.rhtml +28 -0
  196. data/examples/templates/template/external.tenjin +28 -0
  197. data/examples/templates/template/external.xsl +57 -0
  198. data/examples/templates/template/external.zmr +28 -0
  199. data/examples/templates/template_amrita2.rb +74 -0
  200. data/examples/templates/template_erubis.rb +53 -0
  201. data/examples/templates/template_ezamar.rb +50 -0
  202. data/examples/templates/template_haml.rb +50 -0
  203. data/examples/templates/template_liquid.rb +65 -0
  204. data/examples/templates/template_markaby.rb +58 -0
  205. data/examples/templates/template_nagoro.rb +51 -0
  206. data/examples/templates/template_redcloth.rb +59 -0
  207. data/examples/templates/template_remarkably.rb +55 -0
  208. data/examples/templates/template_tenjin.rb +53 -0
  209. data/examples/templates/template_xslt.rb +49 -0
  210. data/lib/proto/controller/init.rb +10 -0
  211. data/lib/proto/controller/main.rb +20 -0
  212. data/lib/proto/model/init.rb +4 -0
  213. data/lib/proto/public/css/ramaze_error.css +90 -0
  214. data/lib/proto/public/dispatch.fcgi +11 -0
  215. data/lib/proto/public/favicon.ico +0 -0
  216. data/lib/proto/public/js/jquery.js +3549 -0
  217. data/lib/proto/public/ramaze.png +0 -0
  218. data/lib/proto/spec/main.rb +25 -0
  219. data/lib/proto/start.rb +8 -0
  220. data/lib/proto/start.ru +16 -0
  221. data/lib/proto/view/error.xhtml +64 -0
  222. data/lib/proto/view/index.xhtml +34 -0
  223. data/lib/proto/view/page.xhtml +27 -0
  224. data/lib/ramaze/action/render.rb +191 -0
  225. data/lib/ramaze/action.rb +153 -0
  226. data/lib/ramaze/adapter/base.rb +128 -0
  227. data/lib/ramaze/adapter/cgi.rb +20 -0
  228. data/lib/ramaze/adapter/ebb.rb +18 -0
  229. data/lib/ramaze/adapter/evented_mongrel.rb +7 -0
  230. data/lib/ramaze/adapter/fake.rb +12 -0
  231. data/lib/ramaze/adapter/fcgi.rb +18 -0
  232. data/lib/ramaze/adapter/lsws.rb +19 -0
  233. data/lib/ramaze/adapter/mongrel.rb +21 -0
  234. data/lib/ramaze/adapter/scgi.rb +18 -0
  235. data/lib/ramaze/adapter/swiftiplied_mongrel.rb +7 -0
  236. data/lib/ramaze/adapter/thin.rb +17 -0
  237. data/lib/ramaze/adapter/webrick.rb +43 -0
  238. data/lib/ramaze/adapter.rb +97 -0
  239. data/lib/ramaze/cache/memcached.rb +69 -0
  240. data/lib/ramaze/cache/memory.rb +6 -0
  241. data/lib/ramaze/cache/yaml_store.rb +68 -0
  242. data/lib/ramaze/cache.rb +113 -0
  243. data/lib/ramaze/contrib/auto_params/get_args.rb +58 -0
  244. data/lib/ramaze/contrib/auto_params.rb +135 -0
  245. data/lib/ramaze/contrib/email.rb +84 -0
  246. data/lib/ramaze/contrib/facebook/facebook.rb +171 -0
  247. data/lib/ramaze/contrib/facebook.rb +23 -0
  248. data/lib/ramaze/contrib/file_cache.rb +65 -0
  249. data/lib/ramaze/contrib/gems.rb +78 -0
  250. data/lib/ramaze/contrib/gettext/mo.rb +155 -0
  251. data/lib/ramaze/contrib/gettext/parser.rb +46 -0
  252. data/lib/ramaze/contrib/gettext/po.rb +109 -0
  253. data/lib/ramaze/contrib/gettext.rb +113 -0
  254. data/lib/ramaze/contrib/gzip_filter.rb +69 -0
  255. data/lib/ramaze/contrib/maruku_uv.rb +59 -0
  256. data/lib/ramaze/contrib/profiling.rb +36 -0
  257. data/lib/ramaze/contrib/rest.rb +17 -0
  258. data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
  259. data/lib/ramaze/contrib/sequel/fill.rb +12 -0
  260. data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
  261. data/lib/ramaze/contrib/sequel/image.rb +198 -0
  262. data/lib/ramaze/contrib/sequel/relation.rb +82 -0
  263. data/lib/ramaze/contrib/sequel_cache.rb +92 -0
  264. data/lib/ramaze/contrib.rb +82 -0
  265. data/lib/ramaze/controller/error.rb +46 -0
  266. data/lib/ramaze/controller/main.rb +2 -0
  267. data/lib/ramaze/controller/resolve.rb +273 -0
  268. data/lib/ramaze/controller.rb +280 -0
  269. data/lib/ramaze/current/request.rb +205 -0
  270. data/lib/ramaze/current/response.rb +39 -0
  271. data/lib/ramaze/current/session/flash.rb +87 -0
  272. data/lib/ramaze/current/session/hash.rb +66 -0
  273. data/lib/ramaze/current/session.rb +181 -0
  274. data/lib/ramaze/current.rb +110 -0
  275. data/lib/ramaze/dispatcher/action.rb +48 -0
  276. data/lib/ramaze/dispatcher/directory.rb +119 -0
  277. data/lib/ramaze/dispatcher/error.rb +108 -0
  278. data/lib/ramaze/dispatcher/file.rb +95 -0
  279. data/lib/ramaze/dispatcher.rb +145 -0
  280. data/lib/ramaze/error.rb +24 -0
  281. data/lib/ramaze/gestalt.rb +124 -0
  282. data/lib/ramaze/helper/aspect.rb +106 -0
  283. data/lib/ramaze/helper/auth.rb +125 -0
  284. data/lib/ramaze/helper/cache.rb +140 -0
  285. data/lib/ramaze/helper/cgi.rb +39 -0
  286. data/lib/ramaze/helper/flash.rb +59 -0
  287. data/lib/ramaze/helper/form.rb +281 -0
  288. data/lib/ramaze/helper/formatting.rb +158 -0
  289. data/lib/ramaze/helper/gestalt.rb +15 -0
  290. data/lib/ramaze/helper/gravatar.rb +15 -0
  291. data/lib/ramaze/helper/httpdigest.rb +59 -0
  292. data/lib/ramaze/helper/identity.rb +119 -0
  293. data/lib/ramaze/helper/link.rb +122 -0
  294. data/lib/ramaze/helper/markaby.rb +31 -0
  295. data/lib/ramaze/helper/maruku.rb +7 -0
  296. data/lib/ramaze/helper/nitroform.rb +14 -0
  297. data/lib/ramaze/helper/pager.rb +366 -0
  298. data/lib/ramaze/helper/paginate.rb +234 -0
  299. data/lib/ramaze/helper/partial.rb +105 -0
  300. data/lib/ramaze/helper/redirect.rb +82 -0
  301. data/lib/ramaze/helper/rest.rb +43 -0
  302. data/lib/ramaze/helper/sendfile.rb +16 -0
  303. data/lib/ramaze/helper/sequel.rb +55 -0
  304. data/lib/ramaze/helper/simple_captcha.rb +31 -0
  305. data/lib/ramaze/helper/stack.rb +77 -0
  306. data/lib/ramaze/helper/tagz.rb +19 -0
  307. data/lib/ramaze/helper/thread.rb +17 -0
  308. data/lib/ramaze/helper/ultraviolet.rb +44 -0
  309. data/lib/ramaze/helper/user.rb +110 -0
  310. data/lib/ramaze/helper/xhtml.rb +23 -0
  311. data/lib/ramaze/helper.rb +79 -0
  312. data/lib/ramaze/log/analogger.rb +40 -0
  313. data/lib/ramaze/log/growl.rb +38 -0
  314. data/lib/ramaze/log/hub.rb +41 -0
  315. data/lib/ramaze/log/informer.rb +128 -0
  316. data/lib/ramaze/log/knotify.rb +28 -0
  317. data/lib/ramaze/log/logger.rb +26 -0
  318. data/lib/ramaze/log/logging.rb +89 -0
  319. data/lib/ramaze/log/syslog.rb +51 -0
  320. data/lib/ramaze/log/xosd.rb +92 -0
  321. data/lib/ramaze/log.rb +27 -0
  322. data/lib/ramaze/option/dsl.rb +45 -0
  323. data/lib/ramaze/option/holder.rb +131 -0
  324. data/lib/ramaze/option/merger.rb +108 -0
  325. data/lib/ramaze/option.rb +156 -0
  326. data/lib/ramaze/reloader.rb +186 -0
  327. data/lib/ramaze/route.rb +97 -0
  328. data/lib/ramaze/setup.rb +50 -0
  329. data/lib/ramaze/snippets/array/put_within.rb +44 -0
  330. data/lib/ramaze/snippets/binding/locals.rb +25 -0
  331. data/lib/ramaze/snippets/blankslate.rb +7 -0
  332. data/lib/ramaze/snippets/dictionary.rb +504 -0
  333. data/lib/ramaze/snippets/divide.rb +20 -0
  334. data/lib/ramaze/snippets/fiber.rb +63 -0
  335. data/lib/ramaze/snippets/kernel/constant.rb +41 -0
  336. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +21 -0
  337. data/lib/ramaze/snippets/metaid.rb +17 -0
  338. data/lib/ramaze/snippets/numeric/filesize_format.rb +32 -0
  339. data/lib/ramaze/snippets/numeric/time.rb +63 -0
  340. data/lib/ramaze/snippets/object/__dir__.rb +29 -0
  341. data/lib/ramaze/snippets/object/acquire.rb +40 -0
  342. data/lib/ramaze/snippets/object/instance_variable_defined.rb +19 -0
  343. data/lib/ramaze/snippets/object/pretty.rb +16 -0
  344. data/lib/ramaze/snippets/object/scope.rb +18 -0
  345. data/lib/ramaze/snippets/object/traits.rb +76 -0
  346. data/lib/ramaze/snippets/ordered_set.rb +51 -0
  347. data/lib/ramaze/snippets/proc/locals.rb +19 -0
  348. data/lib/ramaze/snippets/ramaze/caller_info.rb +30 -0
  349. data/lib/ramaze/snippets/ramaze/caller_lines.rb +51 -0
  350. data/lib/ramaze/snippets/ramaze/deprecated.rb +20 -0
  351. data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
  352. data/lib/ramaze/snippets/ramaze/state.rb +86 -0
  353. data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
  354. data/lib/ramaze/snippets/string/camel_case.rb +21 -0
  355. data/lib/ramaze/snippets/string/color.rb +31 -0
  356. data/lib/ramaze/snippets/string/each.rb +19 -0
  357. data/lib/ramaze/snippets/string/end_with.rb +20 -0
  358. data/lib/ramaze/snippets/string/esc.rb +34 -0
  359. data/lib/ramaze/snippets/string/ord.rb +21 -0
  360. data/lib/ramaze/snippets/string/snake_case.rb +21 -0
  361. data/lib/ramaze/snippets/string/start_with.rb +19 -0
  362. data/lib/ramaze/snippets/string/unindent.rb +28 -0
  363. data/lib/ramaze/snippets/thread/into.rb +18 -0
  364. data/lib/ramaze/snippets.rb +22 -0
  365. data/lib/ramaze/spec/helper/bacon.rb +7 -0
  366. data/lib/ramaze/spec/helper/browser.rb +88 -0
  367. data/lib/ramaze/spec/helper/mock_http.rb +63 -0
  368. data/lib/ramaze/spec/helper/pretty_output.rb +82 -0
  369. data/lib/ramaze/spec/helper/requester.rb +63 -0
  370. data/lib/ramaze/spec/helper/simple_http.rb +434 -0
  371. data/lib/ramaze/spec/helper/snippets.rb +14 -0
  372. data/lib/ramaze/spec/helper.rb +135 -0
  373. data/lib/ramaze/spec.rb +1 -0
  374. data/lib/ramaze/store/default.rb +109 -0
  375. data/lib/ramaze/template/amrita2.rb +45 -0
  376. data/lib/ramaze/template/builder.rb +28 -0
  377. data/lib/ramaze/template/erubis.rb +41 -0
  378. data/lib/ramaze/template/ezamar/element.rb +169 -0
  379. data/lib/ramaze/template/ezamar/engine.rb +76 -0
  380. data/lib/ramaze/template/ezamar/morpher.rb +135 -0
  381. data/lib/ramaze/template/ezamar/render_partial.rb +31 -0
  382. data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
  383. data/lib/ramaze/template/ezamar.rb +42 -0
  384. data/lib/ramaze/template/haml.rb +37 -0
  385. data/lib/ramaze/template/liquid.rb +36 -0
  386. data/lib/ramaze/template/markaby.rb +52 -0
  387. data/lib/ramaze/template/maruku.rb +34 -0
  388. data/lib/ramaze/template/nagoro.rb +52 -0
  389. data/lib/ramaze/template/none.rb +14 -0
  390. data/lib/ramaze/template/redcloth.rb +25 -0
  391. data/lib/ramaze/template/remarkably.rb +38 -0
  392. data/lib/ramaze/template/sass.rb +37 -0
  393. data/lib/ramaze/template/tagz.rb +79 -0
  394. data/lib/ramaze/template/tenjin.rb +74 -0
  395. data/lib/ramaze/template/xslt.rb +100 -0
  396. data/lib/ramaze/template.rb +87 -0
  397. data/lib/ramaze/tool/create.rb +48 -0
  398. data/lib/ramaze/tool/daemonize.rb +37 -0
  399. data/lib/ramaze/tool/localize.rb +202 -0
  400. data/lib/ramaze/tool/mime.rb +35 -0
  401. data/lib/ramaze/tool/mime_types.yaml +615 -0
  402. data/lib/ramaze/tool/project_creator.rb +110 -0
  403. data/lib/ramaze/tool/record.rb +6 -0
  404. data/lib/ramaze/tool.rb +9 -0
  405. data/lib/ramaze/trinity.rb +16 -0
  406. data/lib/ramaze/version.rb +6 -0
  407. data/lib/ramaze.rb +133 -0
  408. data/lib/vendor/bacon.rb +323 -0
  409. data/rake_tasks/conf.rake +71 -0
  410. data/rake_tasks/coverage.rake +46 -0
  411. data/rake_tasks/gem.rake +74 -0
  412. data/rake_tasks/git.rake +41 -0
  413. data/rake_tasks/maintenance.rake +386 -0
  414. data/rake_tasks/metric.rake +24 -0
  415. data/rake_tasks/release.rake +76 -0
  416. data/rake_tasks/spec.rake +61 -0
  417. data/ramaze.gemspec +773 -0
  418. data/spec/contrib/auto_params.rb +121 -0
  419. data/spec/contrib/profiling.rb +29 -0
  420. data/spec/contrib/sequel/fill.rb +47 -0
  421. data/spec/examples/caching.rb +19 -0
  422. data/spec/examples/css.rb +15 -0
  423. data/spec/examples/element.rb +15 -0
  424. data/spec/examples/hello.rb +11 -0
  425. data/spec/examples/linking.rb +18 -0
  426. data/spec/examples/simple.rb +45 -0
  427. data/spec/examples/simple_auth.rb +32 -0
  428. data/spec/examples/templates/template_amrita2.rb +16 -0
  429. data/spec/examples/templates/template_erubis.rb +23 -0
  430. data/spec/examples/templates/template_ezamar.rb +23 -0
  431. data/spec/examples/templates/template_haml.rb +23 -0
  432. data/spec/examples/templates/template_liquid.rb +29 -0
  433. data/spec/examples/templates/template_markaby.rb +23 -0
  434. data/spec/examples/templates/template_redcloth.rb +28 -0
  435. data/spec/examples/templates/template_remarkably.rb +23 -0
  436. data/spec/examples/templates/template_tenjin.rb +28 -0
  437. data/spec/helper.rb +3 -0
  438. data/spec/ramaze/action/basics.rb +36 -0
  439. data/spec/ramaze/action/cache.rb +87 -0
  440. data/spec/ramaze/action/file_cache.rb +70 -0
  441. data/spec/ramaze/action/layout.rb +190 -0
  442. data/spec/ramaze/action/render.rb +31 -0
  443. data/spec/ramaze/action/view/bar.xhtml +1 -0
  444. data/spec/ramaze/action/view/instancevars/layout.xhtml +1 -0
  445. data/spec/ramaze/action/view/other_wrapper.xhtml +1 -0
  446. data/spec/ramaze/action/view/single_wrapper.xhtml +1 -0
  447. data/spec/ramaze/action/view/sub/sub_wrapper.xhtml +1 -0
  448. data/spec/ramaze/adapter/ebb.rb +12 -0
  449. data/spec/ramaze/adapter/mongrel.rb +12 -0
  450. data/spec/ramaze/adapter/record.rb +31 -0
  451. data/spec/ramaze/adapter/webrick.rb +12 -0
  452. data/spec/ramaze/adapter.rb +49 -0
  453. data/spec/ramaze/cache.rb +140 -0
  454. data/spec/ramaze/controller/actionless_templates.rb +32 -0
  455. data/spec/ramaze/controller/resolve.rb +32 -0
  456. data/spec/ramaze/controller/subclass.rb +36 -0
  457. data/spec/ramaze/controller/template_resolving.rb +113 -0
  458. data/spec/ramaze/controller/view/bar.xhtml +1 -0
  459. data/spec/ramaze/controller/view/base/another.xhtml +1 -0
  460. data/spec/ramaze/controller/view/greet.xhtml +1 -0
  461. data/spec/ramaze/controller/view/list.xhtml +1 -0
  462. data/spec/ramaze/controller/view/other/greet/other.xhtml +1 -0
  463. data/spec/ramaze/controller/view/other_wrapper.xhtml +1 -0
  464. data/spec/ramaze/controller.rb +180 -0
  465. data/spec/ramaze/current/request.rb +30 -0
  466. data/spec/ramaze/current/session.rb +97 -0
  467. data/spec/ramaze/dispatcher/directory.rb +55 -0
  468. data/spec/ramaze/dispatcher/file.rb +60 -0
  469. data/spec/ramaze/dispatcher/public/favicon.ico +0 -0
  470. data/spec/ramaze/dispatcher/public/file name.txt +1 -0
  471. data/spec/ramaze/dispatcher/public/test_download.css +141 -0
  472. data/spec/ramaze/dispatcher.rb +31 -0
  473. data/spec/ramaze/element.rb +107 -0
  474. data/spec/ramaze/error.rb +94 -0
  475. data/spec/ramaze/gestalt.rb +131 -0
  476. data/spec/ramaze/helper/aspect.rb +101 -0
  477. data/spec/ramaze/helper/auth.rb +66 -0
  478. data/spec/ramaze/helper/cache.rb +160 -0
  479. data/spec/ramaze/helper/cgi.rb +43 -0
  480. data/spec/ramaze/helper/file.rb +18 -0
  481. data/spec/ramaze/helper/flash.rb +133 -0
  482. data/spec/ramaze/helper/form.rb +118 -0
  483. data/spec/ramaze/helper/formatting.rb +54 -0
  484. data/spec/ramaze/helper/link.rb +124 -0
  485. data/spec/ramaze/helper/pager.rb +99 -0
  486. data/spec/ramaze/helper/partial.rb +88 -0
  487. data/spec/ramaze/helper/redirect.rb +112 -0
  488. data/spec/ramaze/helper/simple_captcha.rb +22 -0
  489. data/spec/ramaze/helper/stack.rb +73 -0
  490. data/spec/ramaze/helper/user.rb +43 -0
  491. data/spec/ramaze/helper/view/locals.xhtml +1 -0
  492. data/spec/ramaze/helper/view/loop.xhtml +4 -0
  493. data/spec/ramaze/helper/view/num.xhtml +1 -0
  494. data/spec/ramaze/helper/view/partial.xhtml +1 -0
  495. data/spec/ramaze/helper/view/recursive.xhtml +8 -0
  496. data/spec/ramaze/helper/view/recursive_local_ivars.xhtml +7 -0
  497. data/spec/ramaze/helper/view/recursive_locals.xhtml +7 -0
  498. data/spec/ramaze/helper/view/test_template.xhtml +1 -0
  499. data/spec/ramaze/localize.rb +89 -0
  500. data/spec/ramaze/log/informer.rb +72 -0
  501. data/spec/ramaze/log/syslog.rb +73 -0
  502. data/spec/ramaze/morpher.rb +111 -0
  503. data/spec/ramaze/params.rb +157 -0
  504. data/spec/ramaze/public/error404.xhtml +1 -0
  505. data/spec/ramaze/public/favicon.ico +0 -0
  506. data/spec/ramaze/public/ramaze.png +0 -0
  507. data/spec/ramaze/public/test_download.css +141 -0
  508. data/spec/ramaze/request/ebb.rb +9 -0
  509. data/spec/ramaze/request/mongrel.rb +9 -0
  510. data/spec/ramaze/request/thin.rb +9 -0
  511. data/spec/ramaze/request/webrick.rb +5 -0
  512. data/spec/ramaze/request.rb +185 -0
  513. data/spec/ramaze/rewrite/file.css +1 -0
  514. data/spec/ramaze/rewrite.rb +36 -0
  515. data/spec/ramaze/route.rb +131 -0
  516. data/spec/ramaze/session.rb +94 -0
  517. data/spec/ramaze/store/default.rb +71 -0
  518. data/spec/ramaze/struct.rb +47 -0
  519. data/spec/ramaze/template/amrita2/external.amrita +6 -0
  520. data/spec/ramaze/template/amrita2/sum.amrita +1 -0
  521. data/spec/ramaze/template/amrita2.rb +50 -0
  522. data/spec/ramaze/template/builder/external.rxml +3 -0
  523. data/spec/ramaze/template/builder.rb +51 -0
  524. data/spec/ramaze/template/erubis/sum.rhtml +1 -0
  525. data/spec/ramaze/template/erubis.rb +41 -0
  526. data/spec/ramaze/template/ezamar/another/long/action.zmr +1 -0
  527. data/spec/ramaze/template/ezamar/combined.zmr +1 -0
  528. data/spec/ramaze/template/ezamar/file_only.zmr +1 -0
  529. data/spec/ramaze/template/ezamar/index.zmr +1 -0
  530. data/spec/ramaze/template/ezamar/nested.zmr +1 -0
  531. data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
  532. data/spec/ramaze/template/ezamar/some__long__action.zmr +1 -0
  533. data/spec/ramaze/template/ezamar/sum.zmr +1 -0
  534. data/spec/ramaze/template/ezamar.rb +63 -0
  535. data/spec/ramaze/template/haml/index.haml +5 -0
  536. data/spec/ramaze/template/haml/locals.haml +2 -0
  537. data/spec/ramaze/template/haml/with_vars.haml +4 -0
  538. data/spec/ramaze/template/haml.rb +66 -0
  539. data/spec/ramaze/template/liquid/index.liquid +1 -0
  540. data/spec/ramaze/template/liquid/products.liquid +45 -0
  541. data/spec/ramaze/template/liquid.rb +99 -0
  542. data/spec/ramaze/template/markaby/external.mab +8 -0
  543. data/spec/ramaze/template/markaby/sum.mab +1 -0
  544. data/spec/ramaze/template/markaby.rb +61 -0
  545. data/spec/ramaze/template/nagoro/another/long/action.nag +1 -0
  546. data/spec/ramaze/template/nagoro/combined.nag +1 -0
  547. data/spec/ramaze/template/nagoro/file_only.nag +1 -0
  548. data/spec/ramaze/template/nagoro/index.nag +1 -0
  549. data/spec/ramaze/template/nagoro/nested.nag +1 -0
  550. data/spec/ramaze/template/nagoro/some__long__action.nag +1 -0
  551. data/spec/ramaze/template/nagoro/sum.nag +1 -0
  552. data/spec/ramaze/template/nagoro.rb +64 -0
  553. data/spec/ramaze/template/ramaze/external.test +1 -0
  554. data/spec/ramaze/template/redcloth/external.redcloth +1 -0
  555. data/spec/ramaze/template/redcloth.rb +38 -0
  556. data/spec/ramaze/template/remarkably/external.rem +8 -0
  557. data/spec/ramaze/template/remarkably/sum.rem +1 -0
  558. data/spec/ramaze/template/remarkably.rb +58 -0
  559. data/spec/ramaze/template/sass/file.css.sass +5 -0
  560. data/spec/ramaze/template/sass.rb +69 -0
  561. data/spec/ramaze/template/tagz/external.tagz +8 -0
  562. data/spec/ramaze/template/tagz/sum.tagz +1 -0
  563. data/spec/ramaze/template/tagz.rb +62 -0
  564. data/spec/ramaze/template/tenjin/external.tenjin +1 -0
  565. data/spec/ramaze/template/tenjin.rb +47 -0
  566. data/spec/ramaze/template/xslt/concat_words.xsl +16 -0
  567. data/spec/ramaze/template/xslt/index.xsl +14 -0
  568. data/spec/ramaze/template/xslt/products.xsl +32 -0
  569. data/spec/ramaze/template/xslt/ruby_version.xsl +14 -0
  570. data/spec/ramaze/template/xslt.rb +90 -0
  571. data/spec/ramaze/template.rb +128 -0
  572. data/spec/snippets/array/put_within.rb +33 -0
  573. data/spec/snippets/binding/locals.rb +9 -0
  574. data/spec/snippets/divide.rb +19 -0
  575. data/spec/snippets/kernel/constant.rb +23 -0
  576. data/spec/snippets/numeric/filesize_format.rb +12 -0
  577. data/spec/snippets/numeric/time.rb +12 -0
  578. data/spec/snippets/object/__dir__.rb +8 -0
  579. data/spec/snippets/object/acquire.rb +71 -0
  580. data/spec/snippets/ordered_set.rb +63 -0
  581. data/spec/snippets/ramaze/caller_info.rb +39 -0
  582. data/spec/snippets/ramaze/caller_lines.rb +30 -0
  583. data/spec/snippets/string/camel_case.rb +25 -0
  584. data/spec/snippets/string/color.rb +11 -0
  585. data/spec/snippets/string/snake_case.rb +24 -0
  586. data/spec/snippets/string/unindent.rb +43 -0
  587. data/spec/snippets/thread/into.rb +20 -0
  588. metadata +823 -0
@@ -0,0 +1,1923 @@
1
+ /* prevent execution of jQuery if included more then once */
2
+ if(typeof window.jQuery == "undefined") {
3
+ /*
4
+ * jQuery 1.0.2 - New Wave Javascript
5
+ *
6
+ * Copyright (c) 2006 John Resig (jquery.com)
7
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
8
+ * and GPL (GPL-LICENSE.txt) licenses.
9
+ *
10
+ * $Date: 2006-10-09 20:23:18 -0400 (Mon, 09 Oct 2006) $
11
+ * $Rev: 413 $
12
+ */
13
+
14
+ // Global undefined variable
15
+ window.undefined = window.undefined;
16
+ jQuery = function(a,c) {
17
+
18
+ // Shortcut for document ready (because $(document).each() is silly)
19
+ if ( a && typeof a == "function" && jQuery.fn.ready )
20
+ return jQuery(document).ready(a);
21
+
22
+ // Make sure that a selection was provided
23
+ a = a || jQuery.context || document;
24
+
25
+ // Watch for when a jQuery object is passed as the selector
26
+ if ( a.jquery )
27
+ return jQuery( jQuery.merge( a, [] ) );
28
+
29
+ // Watch for when a jQuery object is passed at the context
30
+ if ( c && c.jquery )
31
+ return jQuery( c ).find(a);
32
+
33
+ // If the context is global, return a new object
34
+ if ( window == this )
35
+ return new jQuery(a,c);
36
+
37
+ // Handle HTML strings
38
+ var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
39
+ if ( m ) a = jQuery.clean( [ m[1] ] );
40
+
41
+ // Watch for when an array is passed in
42
+ this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ?
43
+ // Assume that it is an array of DOM Elements
44
+ jQuery.merge( a, [] ) :
45
+
46
+ // Find the matching elements and save them for later
47
+ jQuery.find( a, c ) );
48
+
49
+ // See if an extra function was provided
50
+ var fn = arguments[ arguments.length - 1 ];
51
+
52
+ // If so, execute it in context
53
+ if ( fn && typeof fn == "function" )
54
+ this.each(fn);
55
+ };
56
+
57
+ // Map over the $ in case of overwrite
58
+ if ( typeof $ != "undefined" )
59
+ jQuery._$ = $;
60
+
61
+ // Map the jQuery namespace to the '$' one
62
+ var $ = jQuery;
63
+
64
+ jQuery.fn = jQuery.prototype = {
65
+ jquery: "1.0.2",
66
+
67
+ size: function() {
68
+ return this.length;
69
+ },
70
+
71
+ get: function( num ) {
72
+ // Watch for when an array (of elements) is passed in
73
+ if ( num && num.constructor == Array ) {
74
+
75
+ // Use a tricky hack to make the jQuery object
76
+ // look and feel like an array
77
+ this.length = 0;
78
+ [].push.apply( this, num );
79
+
80
+ return this;
81
+ } else
82
+ return num == undefined ?
83
+
84
+ // Return a 'clean' array
85
+ jQuery.merge( this, [] ) :
86
+
87
+ // Return just the object
88
+ this[num];
89
+ },
90
+ each: function( fn, args ) {
91
+ return jQuery.each( this, fn, args );
92
+ },
93
+ index: function( obj ) {
94
+ var pos = -1;
95
+ this.each(function(i){
96
+ if ( this == obj ) pos = i;
97
+ });
98
+ return pos;
99
+ },
100
+
101
+ attr: function( key, value, type ) {
102
+ // Check to see if we're setting style values
103
+ return key.constructor != String || value != undefined ?
104
+ this.each(function(){
105
+ // See if we're setting a hash of styles
106
+ if ( value == undefined )
107
+ // Set all the styles
108
+ for ( var prop in key )
109
+ jQuery.attr(
110
+ type ? this.style : this,
111
+ prop, key[prop]
112
+ );
113
+
114
+ // See if we're setting a single key/value style
115
+ else
116
+ jQuery.attr(
117
+ type ? this.style : this,
118
+ key, value
119
+ );
120
+ }) :
121
+
122
+ // Look for the case where we're accessing a style value
123
+ jQuery[ type || "attr" ]( this[0], key );
124
+ },
125
+
126
+ css: function( key, value ) {
127
+ return this.attr( key, value, "curCSS" );
128
+ },
129
+ text: function(e) {
130
+ e = e || this;
131
+ var t = "";
132
+ for ( var j = 0; j < e.length; j++ ) {
133
+ var r = e[j].childNodes;
134
+ for ( var i = 0; i < r.length; i++ )
135
+ if ( r[i].nodeType != 8 )
136
+ t += r[i].nodeType != 1 ?
137
+ r[i].nodeValue : jQuery.fn.text([ r[i] ]);
138
+ }
139
+ return t;
140
+ },
141
+
142
+ wrap: function() {
143
+ // The elements to wrap the target around
144
+ var a = jQuery.clean(arguments);
145
+
146
+ // Wrap each of the matched elements individually
147
+ return this.each(function(){
148
+ // Clone the structure that we're using to wrap
149
+ var b = a[0].cloneNode(true);
150
+
151
+ // Insert it before the element to be wrapped
152
+ this.parentNode.insertBefore( b, this );
153
+
154
+ // Find the deepest point in the wrap structure
155
+ while ( b.firstChild )
156
+ b = b.firstChild;
157
+
158
+ // Move the matched element to within the wrap structure
159
+ b.appendChild( this );
160
+ });
161
+ },
162
+
163
+ append: function() {
164
+ return this.domManip(arguments, true, 1, function(a){
165
+ this.appendChild( a );
166
+ });
167
+ },
168
+
169
+ prepend: function() {
170
+ return this.domManip(arguments, true, -1, function(a){
171
+ this.insertBefore( a, this.firstChild );
172
+ });
173
+ },
174
+
175
+ before: function() {
176
+ return this.domManip(arguments, false, 1, function(a){
177
+ this.parentNode.insertBefore( a, this );
178
+ });
179
+ },
180
+
181
+ after: function() {
182
+ return this.domManip(arguments, false, -1, function(a){
183
+ this.parentNode.insertBefore( a, this.nextSibling );
184
+ });
185
+ },
186
+ end: function() {
187
+ return this.get( this.stack.pop() );
188
+ },
189
+ find: function(t) {
190
+ return this.pushStack( jQuery.map( this, function(a){
191
+ return jQuery.find(t,a);
192
+ }), arguments );
193
+ },
194
+ clone: function(deep) {
195
+ return this.pushStack( jQuery.map( this, function(a){
196
+ return a.cloneNode( deep != undefined ? deep : true );
197
+ }), arguments );
198
+ },
199
+
200
+ filter: function(t) {
201
+ return this.pushStack(
202
+ t.constructor == Array &&
203
+ jQuery.map(this,function(a){
204
+ for ( var i = 0; i < t.length; i++ )
205
+ if ( jQuery.filter(t[i],[a]).r.length )
206
+ return a;
207
+ }) ||
208
+
209
+ t.constructor == Boolean &&
210
+ ( t ? this.get() : [] ) ||
211
+
212
+ typeof t == "function" &&
213
+ jQuery.grep( this, t ) ||
214
+
215
+ jQuery.filter(t,this).r, arguments );
216
+ },
217
+
218
+ not: function(t) {
219
+ return this.pushStack( t.constructor == String ?
220
+ jQuery.filter(t,this,false).r :
221
+ jQuery.grep(this,function(a){ return a != t; }), arguments );
222
+ },
223
+
224
+ add: function(t) {
225
+ return this.pushStack( jQuery.merge( this, t.constructor == String ?
226
+ jQuery.find(t) : t.constructor == Array ? t : [t] ), arguments );
227
+ },
228
+ is: function(expr) {
229
+ return expr ? jQuery.filter(expr,this).r.length > 0 : false;
230
+ },
231
+ domManip: function(args, table, dir, fn){
232
+ var clone = this.size() > 1;
233
+ var a = jQuery.clean(args);
234
+
235
+ return this.each(function(){
236
+ var obj = this;
237
+
238
+ if ( table && this.nodeName.toUpperCase() == "TABLE" && a[0].nodeName.toUpperCase() != "THEAD" ) {
239
+ var tbody = this.getElementsByTagName("tbody");
240
+
241
+ if ( !tbody.length ) {
242
+ obj = document.createElement("tbody");
243
+ this.appendChild( obj );
244
+ } else
245
+ obj = tbody[0];
246
+ }
247
+
248
+ for ( var i = ( dir < 0 ? a.length - 1 : 0 );
249
+ i != ( dir < 0 ? dir : a.length ); i += dir ) {
250
+ fn.apply( obj, [ clone ? a[i].cloneNode(true) : a[i] ] );
251
+ }
252
+ });
253
+ },
254
+ pushStack: function(a,args) {
255
+ var fn = args && args[args.length-1];
256
+ var fn2 = args && args[args.length-2];
257
+
258
+ if ( fn && fn.constructor != Function ) fn = null;
259
+ if ( fn2 && fn2.constructor != Function ) fn2 = null;
260
+
261
+ if ( !fn ) {
262
+ if ( !this.stack ) this.stack = [];
263
+ this.stack.push( this.get() );
264
+ this.get( a );
265
+ } else {
266
+ var old = this.get();
267
+ this.get( a );
268
+
269
+ if ( fn2 && a.length || !fn2 )
270
+ this.each( fn2 || fn ).get( old );
271
+ else
272
+ this.get( old ).each( fn );
273
+ }
274
+
275
+ return this;
276
+ }
277
+ };
278
+
279
+ jQuery.extend = jQuery.fn.extend = function(obj,prop) {
280
+ if ( !prop ) { prop = obj; obj = this; }
281
+ for ( var i in prop ) obj[i] = prop[i];
282
+ return obj;
283
+ };
284
+
285
+ jQuery.extend({
286
+ init: function(){
287
+ jQuery.initDone = true;
288
+
289
+ jQuery.each( jQuery.macros.axis, function(i,n){
290
+ jQuery.fn[ i ] = function(a) {
291
+ var ret = jQuery.map(this,n);
292
+ if ( a && a.constructor == String )
293
+ ret = jQuery.filter(a,ret).r;
294
+ return this.pushStack( ret, arguments );
295
+ };
296
+ });
297
+
298
+ jQuery.each( jQuery.macros.to, function(i,n){
299
+ jQuery.fn[ i ] = function(){
300
+ var a = arguments;
301
+ return this.each(function(){
302
+ for ( var j = 0; j < a.length; j++ )
303
+ jQuery(a[j])[n]( this );
304
+ });
305
+ };
306
+ });
307
+
308
+ jQuery.each( jQuery.macros.each, function(i,n){
309
+ jQuery.fn[ i ] = function() {
310
+ return this.each( n, arguments );
311
+ };
312
+ });
313
+
314
+ jQuery.each( jQuery.macros.filter, function(i,n){
315
+ jQuery.fn[ n ] = function(num,fn) {
316
+ return this.filter( ":" + n + "(" + num + ")", fn );
317
+ };
318
+ });
319
+
320
+ jQuery.each( jQuery.macros.attr, function(i,n){
321
+ n = n || i;
322
+ jQuery.fn[ i ] = function(h) {
323
+ return h == undefined ?
324
+ this.length ? this[0][n] : null :
325
+ this.attr( n, h );
326
+ };
327
+ });
328
+
329
+ jQuery.each( jQuery.macros.css, function(i,n){
330
+ jQuery.fn[ n ] = function(h) {
331
+ return h == undefined ?
332
+ ( this.length ? jQuery.css( this[0], n ) : null ) :
333
+ this.css( n, h );
334
+ };
335
+ });
336
+
337
+ },
338
+ each: function( obj, fn, args ) {
339
+ if ( obj.length == undefined )
340
+ for ( var i in obj )
341
+ fn.apply( obj[i], args || [i, obj[i]] );
342
+ else
343
+ for ( var i = 0; i < obj.length; i++ )
344
+ fn.apply( obj[i], args || [i, obj[i]] );
345
+ return obj;
346
+ },
347
+
348
+ className: {
349
+ add: function(o,c){
350
+ if (jQuery.className.has(o,c)) return;
351
+ o.className += ( o.className ? " " : "" ) + c;
352
+ },
353
+ remove: function(o,c){
354
+ if( !c ) {
355
+ o.className = "";
356
+ } else {
357
+ var classes = o.className.split(" ");
358
+ for(var i=0; i<classes.length; i++) {
359
+ if(classes[i] == c) {
360
+ classes.splice(i, 1);
361
+ break;
362
+ }
363
+ }
364
+ o.className = classes.join(' ');
365
+ }
366
+ },
367
+ has: function(e,a) {
368
+ if ( e.className != undefined )
369
+ e = e.className;
370
+ return new RegExp("(^|\\s)" + a + "(\\s|$)").test(e);
371
+ }
372
+ },
373
+ swap: function(e,o,f) {
374
+ for ( var i in o ) {
375
+ e.style["old"+i] = e.style[i];
376
+ e.style[i] = o[i];
377
+ }
378
+ f.apply( e, [] );
379
+ for ( var i in o )
380
+ e.style[i] = e.style["old"+i];
381
+ },
382
+
383
+ css: function(e,p) {
384
+ if ( p == "height" || p == "width" ) {
385
+ var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
386
+
387
+ for ( var i in d ) {
388
+ old["padding" + d[i]] = 0;
389
+ old["border" + d[i] + "Width"] = 0;
390
+ }
391
+
392
+ jQuery.swap( e, old, function() {
393
+ if (jQuery.css(e,"display") != "none") {
394
+ oHeight = e.offsetHeight;
395
+ oWidth = e.offsetWidth;
396
+ } else {
397
+ e = jQuery(e.cloneNode(true)).css({
398
+ visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
399
+ }).appendTo(e.parentNode)[0];
400
+
401
+ var parPos = jQuery.css(e.parentNode,"position");
402
+ if ( parPos == "" || parPos == "static" )
403
+ e.parentNode.style.position = "relative";
404
+
405
+ oHeight = e.clientHeight;
406
+ oWidth = e.clientWidth;
407
+
408
+ if ( parPos == "" || parPos == "static" )
409
+ e.parentNode.style.position = "static";
410
+
411
+ e.parentNode.removeChild(e);
412
+ }
413
+ });
414
+
415
+ return p == "height" ? oHeight : oWidth;
416
+ }
417
+
418
+ return jQuery.curCSS( e, p );
419
+ },
420
+
421
+ curCSS: function(elem, prop, force) {
422
+ var ret;
423
+
424
+ if (prop == 'opacity' && jQuery.browser.msie)
425
+ return jQuery.attr(elem.style, 'opacity');
426
+
427
+ if (!force && elem.style[prop]) {
428
+
429
+ ret = elem.style[prop];
430
+
431
+ } else if (elem.currentStyle) {
432
+
433
+ var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
434
+ ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
435
+
436
+ } else if (document.defaultView && document.defaultView.getComputedStyle) {
437
+
438
+ prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
439
+ var cur = document.defaultView.getComputedStyle(elem, null);
440
+
441
+ if ( cur )
442
+ ret = cur.getPropertyValue(prop);
443
+ else if ( prop == 'display' )
444
+ ret = 'none';
445
+ else
446
+ jQuery.swap(elem, { display: 'block' }, function() {
447
+ ret = document.defaultView.getComputedStyle(this,null).getPropertyValue(prop);
448
+ });
449
+
450
+ }
451
+
452
+ return ret;
453
+ },
454
+
455
+ clean: function(a) {
456
+ var r = [];
457
+ for ( var i = 0; i < a.length; i++ ) {
458
+ if ( a[i].constructor == String ) {
459
+ // trim whitespace, otherwise indexOf won't work as expected
460
+ a[i] = jQuery.trim(a[i]);
461
+
462
+ var table = "";
463
+
464
+ if ( !a[i].indexOf("<thead") || !a[i].indexOf("<tbody") ) {
465
+ table = "thead";
466
+ a[i] = "<table>" + a[i] + "</table>";
467
+ } else if ( !a[i].indexOf("<tr") ) {
468
+ table = "tr";
469
+ a[i] = "<table>" + a[i] + "</table>";
470
+ } else if ( !a[i].indexOf("<td") || !a[i].indexOf("<th") ) {
471
+ table = "td";
472
+ a[i] = "<table><tbody><tr>" + a[i] + "</tr></tbody></table>";
473
+ }
474
+
475
+ var div = document.createElement("div");
476
+ div.innerHTML = a[i];
477
+
478
+ if ( table ) {
479
+ div = div.firstChild;
480
+ if ( table != "thead" ) div = div.firstChild;
481
+ if ( table == "td" ) div = div.firstChild;
482
+ }
483
+
484
+ for ( var j = 0; j < div.childNodes.length; j++ )
485
+ r.push( div.childNodes[j] );
486
+ } else if ( a[i].jquery || a[i].length && !a[i].nodeType )
487
+ for ( var k = 0; k < a[i].length; k++ )
488
+ r.push( a[i][k] );
489
+ else if ( a[i] !== null )
490
+ r.push( a[i].nodeType ? a[i] : document.createTextNode(a[i].toString()) );
491
+ }
492
+ return r;
493
+ },
494
+
495
+ expr: {
496
+ "": "m[2]== '*'||a.nodeName.toUpperCase()==m[2].toUpperCase()",
497
+ "#": "a.getAttribute('id')&&a.getAttribute('id')==m[2]",
498
+ ":": {
499
+ // Position Checks
500
+ lt: "i<m[3]-0",
501
+ gt: "i>m[3]-0",
502
+ nth: "m[3]-0==i",
503
+ eq: "m[3]-0==i",
504
+ first: "i==0",
505
+ last: "i==r.length-1",
506
+ even: "i%2==0",
507
+ odd: "i%2",
508
+
509
+ // Child Checks
510
+ "nth-child": "jQuery.sibling(a,m[3]).cur",
511
+ "first-child": "jQuery.sibling(a,0).cur",
512
+ "last-child": "jQuery.sibling(a,0).last",
513
+ "only-child": "jQuery.sibling(a).length==1",
514
+
515
+ // Parent Checks
516
+ parent: "a.childNodes.length",
517
+ empty: "!a.childNodes.length",
518
+
519
+ // Text Check
520
+ contains: "(a.innerText||a.innerHTML).indexOf(m[3])>=0",
521
+
522
+ // Visibility
523
+ visible: "a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",
524
+ hidden: "a.type=='hidden'||jQuery.css(a,'display')=='none'||jQuery.css(a,'visibility')=='hidden'",
525
+
526
+ // Form attributes
527
+ enabled: "!a.disabled",
528
+ disabled: "a.disabled",
529
+ checked: "a.checked",
530
+ selected: "a.selected || jQuery.attr(a, 'selected')",
531
+
532
+ // Form elements
533
+ text: "a.type=='text'",
534
+ radio: "a.type=='radio'",
535
+ checkbox: "a.type=='checkbox'",
536
+ file: "a.type=='file'",
537
+ password: "a.type=='password'",
538
+ submit: "a.type=='submit'",
539
+ image: "a.type=='image'",
540
+ reset: "a.type=='reset'",
541
+ button: "a.type=='button'",
542
+ input: "a.nodeName.toLowerCase().match(/input|select|textarea|button/)"
543
+ },
544
+ ".": "jQuery.className.has(a,m[2])",
545
+ "@": {
546
+ "=": "z==m[4]",
547
+ "!=": "z!=m[4]",
548
+ "^=": "z && !z.indexOf(m[4])",
549
+ "$=": "z && z.substr(z.length - m[4].length,m[4].length)==m[4]",
550
+ "*=": "z && z.indexOf(m[4])>=0",
551
+ "": "z"
552
+ },
553
+ "[": "jQuery.find(m[2],a).length"
554
+ },
555
+
556
+ token: [
557
+ "\\.\\.|/\\.\\.", "a.parentNode",
558
+ ">|/", "jQuery.sibling(a.firstChild)",
559
+ "\\+", "jQuery.sibling(a).next",
560
+ "~", function(a){
561
+ var r = [];
562
+ var s = jQuery.sibling(a);
563
+ if ( s.n > 0 )
564
+ for ( var i = s.n; i < s.length; i++ )
565
+ r.push( s[i] );
566
+ return r;
567
+ }
568
+ ],
569
+ find: function( t, context ) {
570
+ // Make sure that the context is a DOM Element
571
+ if ( context && context.nodeType == undefined )
572
+ context = null;
573
+
574
+ // Set the correct context (if none is provided)
575
+ context = context || jQuery.context || document;
576
+
577
+ if ( t.constructor != String ) return [t];
578
+
579
+ if ( !t.indexOf("//") ) {
580
+ context = context.documentElement;
581
+ t = t.substr(2,t.length);
582
+ } else if ( !t.indexOf("/") ) {
583
+ context = context.documentElement;
584
+ t = t.substr(1,t.length);
585
+ // FIX Assume the root element is right :(
586
+ if ( t.indexOf("/") >= 1 )
587
+ t = t.substr(t.indexOf("/"),t.length);
588
+ }
589
+
590
+ var ret = [context];
591
+ var done = [];
592
+ var last = null;
593
+
594
+ while ( t.length > 0 && last != t ) {
595
+ var r = [];
596
+ last = t;
597
+
598
+ t = jQuery.trim(t).replace( /^\/\//i, "" );
599
+
600
+ var foundToken = false;
601
+
602
+ for ( var i = 0; i < jQuery.token.length; i += 2 ) {
603
+ if ( foundToken ) continue;
604
+
605
+ var re = new RegExp("^(" + jQuery.token[i] + ")");
606
+ var m = re.exec(t);
607
+
608
+ if ( m ) {
609
+ r = ret = jQuery.map( ret, jQuery.token[i+1] );
610
+ t = jQuery.trim( t.replace( re, "" ) );
611
+ foundToken = true;
612
+ }
613
+ }
614
+
615
+ if ( !foundToken ) {
616
+ if ( !t.indexOf(",") || !t.indexOf("|") ) {
617
+ if ( ret[0] == context ) ret.shift();
618
+ done = jQuery.merge( done, ret );
619
+ r = ret = [context];
620
+ t = " " + t.substr(1,t.length);
621
+ } else {
622
+ var re2 = /^([#.]?)([a-z0-9\\*_-]*)/i;
623
+ var m = re2.exec(t);
624
+
625
+ if ( m[1] == "#" ) {
626
+ // Ummm, should make this work in all XML docs
627
+ var oid = document.getElementById(m[2]);
628
+ r = ret = oid ? [oid] : [];
629
+ t = t.replace( re2, "" );
630
+ } else {
631
+ if ( !m[2] || m[1] == "." ) m[2] = "*";
632
+
633
+ for ( var i = 0; i < ret.length; i++ )
634
+ r = jQuery.merge( r,
635
+ m[2] == "*" ?
636
+ jQuery.getAll(ret[i]) :
637
+ ret[i].getElementsByTagName(m[2])
638
+ );
639
+ }
640
+ }
641
+
642
+ }
643
+
644
+ if ( t ) {
645
+ var val = jQuery.filter(t,r);
646
+ ret = r = val.r;
647
+ t = jQuery.trim(val.t);
648
+ }
649
+ }
650
+
651
+ if ( ret && ret[0] == context ) ret.shift();
652
+ done = jQuery.merge( done, ret );
653
+
654
+ return done;
655
+ },
656
+
657
+ getAll: function(o,r) {
658
+ r = r || [];
659
+ var s = o.childNodes;
660
+ for ( var i = 0; i < s.length; i++ )
661
+ if ( s[i].nodeType == 1 ) {
662
+ r.push( s[i] );
663
+ jQuery.getAll( s[i], r );
664
+ }
665
+ return r;
666
+ },
667
+
668
+ attr: function(elem, name, value){
669
+ var fix = {
670
+ "for": "htmlFor",
671
+ "class": "className",
672
+ "float": "cssFloat",
673
+ innerHTML: "innerHTML",
674
+ className: "className",
675
+ value: "value",
676
+ disabled: "disabled",
677
+ checked: "checked"
678
+ };
679
+
680
+ // IE actually uses filters for opacity ... elem is actually elem.style
681
+ if (name == "opacity" && jQuery.browser.msie && value != undefined) {
682
+ // IE has trouble with opacity if it does not have layout
683
+ // Would prefer to check element.hasLayout first but don't have access to the element here
684
+ elem['zoom'] = 1;
685
+ if (value == 1) // Remove filter to avoid more IE weirdness
686
+ return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"");
687
+ else
688
+ return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"") + "alpha(opacity=" + value * 100 + ")";
689
+ } else if (name == "opacity" && jQuery.browser.msie) {
690
+ return elem["filter"] ? parseFloat( elem["filter"].match(/alpha\(opacity=(.*)\)/)[1] )/100 : 1;
691
+ }
692
+
693
+ // Mozilla doesn't play well with opacity 1
694
+ if (name == "opacity" && jQuery.browser.mozilla && value == 1) value = 0.9999;
695
+
696
+ if ( fix[name] ) {
697
+ if ( value != undefined ) elem[fix[name]] = value;
698
+ return elem[fix[name]];
699
+ } else if( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == 'FORM' && (name == 'action' || name == 'method') ) {
700
+ return elem.getAttributeNode(name).nodeValue;
701
+ } else if ( elem.getAttribute != undefined ) {
702
+ if ( value != undefined ) elem.setAttribute( name, value );
703
+ return elem.getAttribute( name, 2 );
704
+ } else {
705
+ name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
706
+ if ( value != undefined ) elem[name] = value;
707
+ return elem[name];
708
+ }
709
+ },
710
+
711
+ // The regular expressions that power the parsing engine
712
+ parse: [
713
+ // Match: [@value='test'], [@foo]
714
+ "\\[ *(@)S *([!*$^=]*) *('?\"?)(.*?)\\4 *\\]",
715
+
716
+ // Match: [div], [div p]
717
+ "(\\[)\s*(.*?)\s*\\]",
718
+
719
+ // Match: :contains('foo')
720
+ "(:)S\\(\"?'?([^\\)]*?)\"?'?\\)",
721
+
722
+ // Match: :even, :last-chlid
723
+ "([:.#]*)S"
724
+ ],
725
+
726
+ filter: function(t,r,not) {
727
+ // Figure out if we're doing regular, or inverse, filtering
728
+ var g = not !== false ? jQuery.grep :
729
+ function(a,f) {return jQuery.grep(a,f,true);};
730
+
731
+ while ( t && /^[a-z[({<*:.#]/i.test(t) ) {
732
+
733
+ var p = jQuery.parse;
734
+
735
+ for ( var i = 0; i < p.length; i++ ) {
736
+
737
+ // Look for, and replace, string-like sequences
738
+ // and finally build a regexp out of it
739
+ var re = new RegExp(
740
+ "^" + p[i].replace("S", "([a-z*_-][a-z0-9_-]*)"), "i" );
741
+
742
+ var m = re.exec( t );
743
+
744
+ if ( m ) {
745
+ // Re-organize the first match
746
+ if ( !i )
747
+ m = ["",m[1], m[3], m[2], m[5]];
748
+
749
+ // Remove what we just matched
750
+ t = t.replace( re, "" );
751
+
752
+ break;
753
+ }
754
+ }
755
+
756
+ // :not() is a special case that can be optimized by
757
+ // keeping it out of the expression list
758
+ if ( m[1] == ":" && m[2] == "not" )
759
+ r = jQuery.filter(m[3],r,false).r;
760
+
761
+ // Otherwise, find the expression to execute
762
+ else {
763
+ var f = jQuery.expr[m[1]];
764
+ if ( f.constructor != String )
765
+ f = jQuery.expr[m[1]][m[2]];
766
+
767
+ // Build a custom macro to enclose it
768
+ eval("f = function(a,i){" +
769
+ ( m[1] == "@" ? "z=jQuery.attr(a,m[3]);" : "" ) +
770
+ "return " + f + "}");
771
+
772
+ // Execute it against the current filter
773
+ r = g( r, f );
774
+ }
775
+ }
776
+
777
+ // Return an array of filtered elements (r)
778
+ // and the modified expression string (t)
779
+ return { r: r, t: t };
780
+ },
781
+ trim: function(t){
782
+ return t.replace(/^\s+|\s+$/g, "");
783
+ },
784
+ parents: function( elem ){
785
+ var matched = [];
786
+ var cur = elem.parentNode;
787
+ while ( cur && cur != document ) {
788
+ matched.push( cur );
789
+ cur = cur.parentNode;
790
+ }
791
+ return matched;
792
+ },
793
+ sibling: function(elem, pos, not) {
794
+ var elems = [];
795
+
796
+ if(elem) {
797
+ var siblings = elem.parentNode.childNodes;
798
+ for ( var i = 0; i < siblings.length; i++ ) {
799
+ if ( not === true && siblings[i] == elem ) continue;
800
+
801
+ if ( siblings[i].nodeType == 1 )
802
+ elems.push( siblings[i] );
803
+ if ( siblings[i] == elem )
804
+ elems.n = elems.length - 1;
805
+ }
806
+ }
807
+
808
+ return jQuery.extend( elems, {
809
+ last: elems.n == elems.length - 1,
810
+ cur: pos == "even" && elems.n % 2 == 0 || pos == "odd" && elems.n % 2 || elems[pos] == elem,
811
+ prev: elems[elems.n - 1],
812
+ next: elems[elems.n + 1]
813
+ });
814
+ },
815
+ merge: function(first, second) {
816
+ var result = [];
817
+
818
+ // Move b over to the new array (this helps to avoid
819
+ // StaticNodeList instances)
820
+ for ( var k = 0; k < first.length; k++ )
821
+ result[k] = first[k];
822
+
823
+ // Now check for duplicates between a and b and only
824
+ // add the unique items
825
+ for ( var i = 0; i < second.length; i++ ) {
826
+ var noCollision = true;
827
+
828
+ // The collision-checking process
829
+ for ( var j = 0; j < first.length; j++ )
830
+ if ( second[i] == first[j] )
831
+ noCollision = false;
832
+
833
+ // If the item is unique, add it
834
+ if ( noCollision )
835
+ result.push( second[i] );
836
+ }
837
+
838
+ return result;
839
+ },
840
+ grep: function(elems, fn, inv) {
841
+ // If a string is passed in for the function, make a function
842
+ // for it (a handy shortcut)
843
+ if ( fn.constructor == String )
844
+ fn = new Function("a","i","return " + fn);
845
+
846
+ var result = [];
847
+
848
+ // Go through the array, only saving the items
849
+ // that pass the validator function
850
+ for ( var i = 0; i < elems.length; i++ )
851
+ if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
852
+ result.push( elems[i] );
853
+
854
+ return result;
855
+ },
856
+ map: function(elems, fn) {
857
+ // If a string is passed in for the function, make a function
858
+ // for it (a handy shortcut)
859
+ if ( fn.constructor == String )
860
+ fn = new Function("a","return " + fn);
861
+
862
+ var result = [];
863
+
864
+ // Go through the array, translating each of the items to their
865
+ // new value (or values).
866
+ for ( var i = 0; i < elems.length; i++ ) {
867
+ var val = fn(elems[i],i);
868
+
869
+ if ( val !== null && val != undefined ) {
870
+ if ( val.constructor != Array ) val = [val];
871
+ result = jQuery.merge( result, val );
872
+ }
873
+ }
874
+
875
+ return result;
876
+ },
877
+
878
+ /*
879
+ * A number of helper functions used for managing events.
880
+ * Many of the ideas behind this code orignated from Dean Edwards' addEvent library.
881
+ */
882
+ event: {
883
+
884
+ // Bind an event to an element
885
+ // Original by Dean Edwards
886
+ add: function(element, type, handler) {
887
+ // For whatever reason, IE has trouble passing the window object
888
+ // around, causing it to be cloned in the process
889
+ if ( jQuery.browser.msie && element.setInterval != undefined )
890
+ element = window;
891
+
892
+ // Make sure that the function being executed has a unique ID
893
+ if ( !handler.guid )
894
+ handler.guid = this.guid++;
895
+
896
+ // Init the element's event structure
897
+ if (!element.events)
898
+ element.events = {};
899
+
900
+ // Get the current list of functions bound to this event
901
+ var handlers = element.events[type];
902
+
903
+ // If it hasn't been initialized yet
904
+ if (!handlers) {
905
+ // Init the event handler queue
906
+ handlers = element.events[type] = {};
907
+
908
+ // Remember an existing handler, if it's already there
909
+ if (element["on" + type])
910
+ handlers[0] = element["on" + type];
911
+ }
912
+
913
+ // Add the function to the element's handler list
914
+ handlers[handler.guid] = handler;
915
+
916
+ // And bind the global event handler to the element
917
+ element["on" + type] = this.handle;
918
+
919
+ // Remember the function in a global list (for triggering)
920
+ if (!this.global[type])
921
+ this.global[type] = [];
922
+ this.global[type].push( element );
923
+ },
924
+
925
+ guid: 1,
926
+ global: {},
927
+
928
+ // Detach an event or set of events from an element
929
+ remove: function(element, type, handler) {
930
+ if (element.events)
931
+ if (type && element.events[type])
932
+ if ( handler )
933
+ delete element.events[type][handler.guid];
934
+ else
935
+ for ( var i in element.events[type] )
936
+ delete element.events[type][i];
937
+ else
938
+ for ( var j in element.events )
939
+ this.remove( element, j );
940
+ },
941
+
942
+ trigger: function(type,data,element) {
943
+ // Touch up the incoming data
944
+ data = data || [];
945
+
946
+ // Handle a global trigger
947
+ if ( !element ) {
948
+ var g = this.global[type];
949
+ if ( g )
950
+ for ( var i = 0; i < g.length; i++ )
951
+ this.trigger( type, data, g[i] );
952
+
953
+ // Handle triggering a single element
954
+ } else if ( element["on" + type] ) {
955
+ // Pass along a fake event
956
+ data.unshift( this.fix({ type: type, target: element }) );
957
+
958
+ // Trigger the event
959
+ element["on" + type].apply( element, data );
960
+ }
961
+ },
962
+
963
+ handle: function(event) {
964
+ if ( typeof jQuery == "undefined" ) return;
965
+
966
+ event = event || jQuery.event.fix( window.event );
967
+
968
+ // If no correct event was found, fail
969
+ if ( !event ) return;
970
+
971
+ var returnValue = true;
972
+
973
+ var c = this.events[event.type];
974
+
975
+ var args = [].slice.call( arguments, 1 );
976
+ args.unshift( event );
977
+
978
+ for ( var j in c ) {
979
+ if ( c[j].apply( this, args ) === false ) {
980
+ event.preventDefault();
981
+ event.stopPropagation();
982
+ returnValue = false;
983
+ }
984
+ }
985
+
986
+ return returnValue;
987
+ },
988
+
989
+ fix: function(event) {
990
+ if ( event ) {
991
+ event.preventDefault = function() {
992
+ this.returnValue = false;
993
+ };
994
+
995
+ event.stopPropagation = function() {
996
+ this.cancelBubble = true;
997
+ };
998
+ }
999
+
1000
+ return event;
1001
+ }
1002
+
1003
+ }
1004
+ });
1005
+ new function() {
1006
+ var b = navigator.userAgent.toLowerCase();
1007
+
1008
+ // Figure out what browser is being used
1009
+ jQuery.browser = {
1010
+ safari: /webkit/.test(b),
1011
+ opera: /opera/.test(b),
1012
+ msie: /msie/.test(b) && !/opera/.test(b),
1013
+ mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b)
1014
+ };
1015
+
1016
+ // Check to see if the W3C box model is being used
1017
+ jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
1018
+ };
1019
+
1020
+ jQuery.macros = {
1021
+ to: {
1022
+ appendTo: "append",
1023
+ prependTo: "prepend",
1024
+ insertBefore: "before",
1025
+ insertAfter: "after"
1026
+ },
1027
+
1028
+ css: "width,height,top,left,position,float,overflow,color,background".split(","),
1029
+
1030
+ filter: [ "eq", "lt", "gt", "contains" ],
1031
+
1032
+ attr: {
1033
+
1034
+ val: "value",
1035
+
1036
+ html: "innerHTML",
1037
+
1038
+ id: null,
1039
+
1040
+ title: null,
1041
+
1042
+ name: null,
1043
+
1044
+ href: null,
1045
+
1046
+ src: null,
1047
+
1048
+ rel: null
1049
+ },
1050
+
1051
+ axis: {
1052
+
1053
+ parent: "a.parentNode",
1054
+
1055
+ ancestors: jQuery.parents,
1056
+
1057
+ parents: jQuery.parents,
1058
+
1059
+ next: "jQuery.sibling(a).next",
1060
+
1061
+ prev: "jQuery.sibling(a).prev",
1062
+
1063
+ siblings: "jQuery.sibling(a, null, true)",
1064
+
1065
+ children: "jQuery.sibling(a.firstChild)"
1066
+ },
1067
+
1068
+ each: {
1069
+ removeAttr: function( key ) {
1070
+ this.removeAttribute( key );
1071
+ },
1072
+ show: function(){
1073
+ this.style.display = this.oldblock ? this.oldblock : "";
1074
+ if ( jQuery.css(this,"display") == "none" )
1075
+ this.style.display = "block";
1076
+ },
1077
+ hide: function(){
1078
+ this.oldblock = this.oldblock || jQuery.css(this,"display");
1079
+ if ( this.oldblock == "none" )
1080
+ this.oldblock = "block";
1081
+ this.style.display = "none";
1082
+ },
1083
+ toggle: function(){
1084
+ jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ].apply( jQuery(this), arguments );
1085
+ },
1086
+ addClass: function(c){
1087
+ jQuery.className.add(this,c);
1088
+ },
1089
+ removeClass: function(c){
1090
+ jQuery.className.remove(this,c);
1091
+ },
1092
+ toggleClass: function( c ){
1093
+ jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this,c);
1094
+ },
1095
+
1096
+ remove: function(a){
1097
+ if ( !a || jQuery.filter( a, [this] ).r )
1098
+ this.parentNode.removeChild( this );
1099
+ },
1100
+ empty: function(){
1101
+ while ( this.firstChild )
1102
+ this.removeChild( this.firstChild );
1103
+ },
1104
+ bind: function( type, fn ) {
1105
+ if ( fn.constructor == String )
1106
+ fn = new Function("e", ( !fn.indexOf(".") ? "jQuery(this)" : "return " ) + fn);
1107
+ jQuery.event.add( this, type, fn );
1108
+ },
1109
+
1110
+ unbind: function( type, fn ) {
1111
+ jQuery.event.remove( this, type, fn );
1112
+ },
1113
+ trigger: function( type, data ) {
1114
+ jQuery.event.trigger( type, data, this );
1115
+ }
1116
+ }
1117
+ };
1118
+
1119
+ jQuery.init();
1120
+ jQuery.fn.extend({
1121
+
1122
+ // We're overriding the old toggle function, so
1123
+ // remember it for later
1124
+ _toggle: jQuery.fn.toggle,
1125
+ toggle: function(a,b) {
1126
+ // If two functions are passed in, we're
1127
+ // toggling on a click
1128
+ return a && b && a.constructor == Function && b.constructor == Function ? this.click(function(e){
1129
+ // Figure out which function to execute
1130
+ this.last = this.last == a ? b : a;
1131
+
1132
+ // Make sure that clicks stop
1133
+ e.preventDefault();
1134
+
1135
+ // and execute the function
1136
+ return this.last.apply( this, [e] ) || false;
1137
+ }) :
1138
+
1139
+ // Otherwise, execute the old toggle function
1140
+ this._toggle.apply( this, arguments );
1141
+ },
1142
+ hover: function(f,g) {
1143
+
1144
+ // A private function for haandling mouse 'hovering'
1145
+ function handleHover(e) {
1146
+ // Check if mouse(over|out) are still within the same parent element
1147
+ var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
1148
+
1149
+ // Traverse up the tree
1150
+ while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; };
1151
+
1152
+ // If we actually just moused on to a sub-element, ignore it
1153
+ if ( p == this ) return false;
1154
+
1155
+ // Execute the right function
1156
+ return (e.type == "mouseover" ? f : g).apply(this, [e]);
1157
+ }
1158
+
1159
+ // Bind the function to the two event listeners
1160
+ return this.mouseover(handleHover).mouseout(handleHover);
1161
+ },
1162
+ ready: function(f) {
1163
+ // If the DOM is already ready
1164
+ if ( jQuery.isReady )
1165
+ // Execute the function immediately
1166
+ f.apply( document );
1167
+
1168
+ // Otherwise, remember the function for later
1169
+ else {
1170
+ // Add the function to the wait list
1171
+ jQuery.readyList.push( f );
1172
+ }
1173
+
1174
+ return this;
1175
+ }
1176
+ });
1177
+
1178
+ jQuery.extend({
1179
+ /*
1180
+ * All the code that makes DOM Ready work nicely.
1181
+ */
1182
+ isReady: false,
1183
+ readyList: [],
1184
+
1185
+ // Handle when the DOM is ready
1186
+ ready: function() {
1187
+ // Make sure that the DOM is not already loaded
1188
+ if ( !jQuery.isReady ) {
1189
+ // Remember that the DOM is ready
1190
+ jQuery.isReady = true;
1191
+
1192
+ // If there are functions bound, to execute
1193
+ if ( jQuery.readyList ) {
1194
+ // Execute all of them
1195
+ for ( var i = 0; i < jQuery.readyList.length; i++ )
1196
+ jQuery.readyList[i].apply( document );
1197
+
1198
+ // Reset the list of functions
1199
+ jQuery.readyList = null;
1200
+ }
1201
+ // Remove event lisenter to avoid memory leak
1202
+ if ( jQuery.browser.mozilla || jQuery.browser.opera )
1203
+ document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
1204
+ }
1205
+ }
1206
+ });
1207
+
1208
+ new function(){
1209
+
1210
+ var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
1211
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," +
1212
+ "submit,keydown,keypress,keyup,error").split(",");
1213
+
1214
+ // Go through all the event names, but make sure that
1215
+ // it is enclosed properly
1216
+ for ( var i = 0; i < e.length; i++ ) new function(){
1217
+
1218
+ var o = e[i];
1219
+
1220
+ // Handle event binding
1221
+ jQuery.fn[o] = function(f){
1222
+ return f ? this.bind(o, f) : this.trigger(o);
1223
+ };
1224
+
1225
+ // Handle event unbinding
1226
+ jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };
1227
+
1228
+ // Finally, handle events that only fire once
1229
+ jQuery.fn["one"+o] = function(f){
1230
+ // Attach the event listener
1231
+ return this.each(function(){
1232
+
1233
+ var count = 0;
1234
+
1235
+ // Add the event
1236
+ jQuery.event.add( this, o, function(e){
1237
+ // If this function has already been executed, stop
1238
+ if ( count++ ) return;
1239
+
1240
+ // And execute the bound function
1241
+ return f.apply(this, [e]);
1242
+ });
1243
+ });
1244
+ };
1245
+
1246
+ };
1247
+
1248
+ // If Mozilla is used
1249
+ if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
1250
+ // Use the handy event callback
1251
+ document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
1252
+
1253
+ // If IE is used, use the excellent hack by Matthias Miller
1254
+ // http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
1255
+ } else if ( jQuery.browser.msie ) {
1256
+
1257
+ // Only works if you document.write() it
1258
+ document.write("<scr" + "ipt id=__ie_init defer=true " +
1259
+ "src=//:><\/script>");
1260
+
1261
+ // Use the defer script hack
1262
+ var script = document.getElementById("__ie_init");
1263
+ script.onreadystatechange = function() {
1264
+ if ( this.readyState != "complete" ) return;
1265
+ this.parentNode.removeChild( this );
1266
+ jQuery.ready();
1267
+ };
1268
+
1269
+ // Clear from memory
1270
+ script = null;
1271
+
1272
+ // If Safari is used
1273
+ } else if ( jQuery.browser.safari ) {
1274
+ // Continually check to see if the document.readyState is valid
1275
+ jQuery.safariTimer = setInterval(function(){
1276
+ // loaded and complete are both valid states
1277
+ if ( document.readyState == "loaded" ||
1278
+ document.readyState == "complete" ) {
1279
+
1280
+ // If either one are found, remove the timer
1281
+ clearInterval( jQuery.safariTimer );
1282
+ jQuery.safariTimer = null;
1283
+
1284
+ // and execute any waiting functions
1285
+ jQuery.ready();
1286
+ }
1287
+ }, 10);
1288
+ }
1289
+
1290
+ // A fallback to window.onload, that will always work
1291
+ jQuery.event.add( window, "load", jQuery.ready );
1292
+
1293
+ };
1294
+
1295
+ // Clean up after IE to avoid memory leaks
1296
+ if (jQuery.browser.msie) jQuery(window).unload(function() {
1297
+ var event = jQuery.event, global = event.global;
1298
+ for (var type in global) {
1299
+ var els = global[type], i = els.length;
1300
+ if (i>0) do if (type != 'unload') event.remove(els[i-1], type); while (--i);
1301
+ }
1302
+ });
1303
+ jQuery.fn.extend({
1304
+
1305
+ // overwrite the old show method
1306
+ _show: jQuery.fn.show,
1307
+
1308
+ show: function(speed,callback){
1309
+ return speed ? this.animate({
1310
+ height: "show", width: "show", opacity: "show"
1311
+ }, speed, callback) : this._show();
1312
+ },
1313
+
1314
+ // Overwrite the old hide method
1315
+ _hide: jQuery.fn.hide,
1316
+
1317
+ hide: function(speed,callback){
1318
+ return speed ? this.animate({
1319
+ height: "hide", width: "hide", opacity: "hide"
1320
+ }, speed, callback) : this._hide();
1321
+ },
1322
+
1323
+ slideDown: function(speed,callback){
1324
+ return this.animate({height: "show"}, speed, callback);
1325
+ },
1326
+
1327
+ slideUp: function(speed,callback){
1328
+ return this.animate({height: "hide"}, speed, callback);
1329
+ },
1330
+
1331
+ slideToggle: function(speed,callback){
1332
+ return this.each(function(){
1333
+ var state = jQuery(this).is(":hidden") ? "show" : "hide";
1334
+ jQuery(this).animate({height: state}, speed, callback);
1335
+ });
1336
+ },
1337
+
1338
+ fadeIn: function(speed,callback){
1339
+ return this.animate({opacity: "show"}, speed, callback);
1340
+ },
1341
+
1342
+ fadeOut: function(speed,callback){
1343
+ return this.animate({opacity: "hide"}, speed, callback);
1344
+ },
1345
+
1346
+ fadeTo: function(speed,to,callback){
1347
+ return this.animate({opacity: to}, speed, callback);
1348
+ },
1349
+ animate: function(prop,speed,callback) {
1350
+ return this.queue(function(){
1351
+
1352
+ this.curAnim = prop;
1353
+
1354
+ for ( var p in prop ) {
1355
+ var e = new jQuery.fx( this, jQuery.speed(speed,callback), p );
1356
+ if ( prop[p].constructor == Number )
1357
+ e.custom( e.cur(), prop[p] );
1358
+ else
1359
+ e[ prop[p] ]( prop );
1360
+ }
1361
+
1362
+ });
1363
+ },
1364
+ queue: function(type,fn){
1365
+ if ( !fn ) {
1366
+ fn = type;
1367
+ type = "fx";
1368
+ }
1369
+
1370
+ return this.each(function(){
1371
+ if ( !this.queue )
1372
+ this.queue = {};
1373
+
1374
+ if ( !this.queue[type] )
1375
+ this.queue[type] = [];
1376
+
1377
+ this.queue[type].push( fn );
1378
+
1379
+ if ( this.queue[type].length == 1 )
1380
+ fn.apply(this);
1381
+ });
1382
+ }
1383
+
1384
+ });
1385
+
1386
+ jQuery.extend({
1387
+
1388
+ setAuto: function(e,p) {
1389
+ if ( e.notAuto ) return;
1390
+
1391
+ if ( p == "height" && e.scrollHeight != parseInt(jQuery.curCSS(e,p)) ) return;
1392
+ if ( p == "width" && e.scrollWidth != parseInt(jQuery.curCSS(e,p)) ) return;
1393
+
1394
+ // Remember the original height
1395
+ var a = e.style[p];
1396
+
1397
+ // Figure out the size of the height right now
1398
+ var o = jQuery.curCSS(e,p,1);
1399
+
1400
+ if ( p == "height" && e.scrollHeight != o ||
1401
+ p == "width" && e.scrollWidth != o ) return;
1402
+
1403
+ // Set the height to auto
1404
+ e.style[p] = e.currentStyle ? "" : "auto";
1405
+
1406
+ // See what the size of "auto" is
1407
+ var n = jQuery.curCSS(e,p,1);
1408
+
1409
+ // Revert back to the original size
1410
+ if ( o != n && n != "auto" ) {
1411
+ e.style[p] = a;
1412
+ e.notAuto = true;
1413
+ }
1414
+ },
1415
+
1416
+ speed: function(s,o) {
1417
+ o = o || {};
1418
+
1419
+ if ( o.constructor == Function )
1420
+ o = { complete: o };
1421
+
1422
+ var ss = { slow: 600, fast: 200 };
1423
+ o.duration = (s && s.constructor == Number ? s : ss[s]) || 400;
1424
+
1425
+ // Queueing
1426
+ o.oldComplete = o.complete;
1427
+ o.complete = function(){
1428
+ jQuery.dequeue(this, "fx");
1429
+ if ( o.oldComplete && o.oldComplete.constructor == Function )
1430
+ o.oldComplete.apply( this );
1431
+ };
1432
+
1433
+ return o;
1434
+ },
1435
+
1436
+ queue: {},
1437
+
1438
+ dequeue: function(elem,type){
1439
+ type = type || "fx";
1440
+
1441
+ if ( elem.queue && elem.queue[type] ) {
1442
+ // Remove self
1443
+ elem.queue[type].shift();
1444
+
1445
+ // Get next function
1446
+ var f = elem.queue[type][0];
1447
+
1448
+ if ( f ) f.apply( elem );
1449
+ }
1450
+ },
1451
+
1452
+ /*
1453
+ * I originally wrote fx() as a clone of moo.fx and in the process
1454
+ * of making it small in size the code became illegible to sane
1455
+ * people. You've been warned.
1456
+ */
1457
+
1458
+ fx: function( elem, options, prop ){
1459
+
1460
+ var z = this;
1461
+
1462
+ // The users options
1463
+ z.o = {
1464
+ duration: options.duration || 400,
1465
+ complete: options.complete,
1466
+ step: options.step
1467
+ };
1468
+
1469
+ // The element
1470
+ z.el = elem;
1471
+
1472
+ // The styles
1473
+ var y = z.el.style;
1474
+
1475
+ // Simple function for setting a style value
1476
+ z.a = function(){
1477
+ if ( options.step )
1478
+ options.step.apply( elem, [ z.now ] );
1479
+
1480
+ if ( prop == "opacity" )
1481
+ jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
1482
+ else if ( parseInt(z.now) ) // My hate for IE will never die
1483
+ y[prop] = parseInt(z.now) + "px";
1484
+
1485
+ y.display = "block";
1486
+ };
1487
+
1488
+ // Figure out the maximum number to run to
1489
+ z.max = function(){
1490
+ return parseFloat( jQuery.css(z.el,prop) );
1491
+ };
1492
+
1493
+ // Get the current size
1494
+ z.cur = function(){
1495
+ var r = parseFloat( jQuery.curCSS(z.el, prop) );
1496
+ return r && r > -10000 ? r : z.max();
1497
+ };
1498
+
1499
+ // Start an animation from one number to another
1500
+ z.custom = function(from,to){
1501
+ z.startTime = (new Date()).getTime();
1502
+ z.now = from;
1503
+ z.a();
1504
+
1505
+ z.timer = setInterval(function(){
1506
+ z.step(from, to);
1507
+ }, 13);
1508
+ };
1509
+
1510
+ // Simple 'show' function
1511
+ z.show = function( p ){
1512
+ if ( !z.el.orig ) z.el.orig = {};
1513
+
1514
+ // Remember where we started, so that we can go back to it later
1515
+ z.el.orig[prop] = this.cur();
1516
+
1517
+ // Begin the animation
1518
+ if (prop == "opacity")
1519
+ z.custom(z.el.orig[prop], 1);
1520
+ else
1521
+ z.custom(0, z.el.orig[prop]);
1522
+
1523
+ // Stupid IE, look what you made me do
1524
+ if ( prop != "opacity" )
1525
+ y[prop] = "1px";
1526
+ };
1527
+
1528
+ // Simple 'hide' function
1529
+ z.hide = function(){
1530
+ if ( !z.el.orig ) z.el.orig = {};
1531
+
1532
+ // Remember where we started, so that we can go back to it later
1533
+ z.el.orig[prop] = this.cur();
1534
+
1535
+ z.o.hide = true;
1536
+
1537
+ // Begin the animation
1538
+ z.custom(z.el.orig[prop], 0);
1539
+ };
1540
+
1541
+ // Remember the overflow of the element
1542
+ if ( !z.el.oldOverlay )
1543
+ z.el.oldOverflow = jQuery.css( z.el, "overflow" );
1544
+
1545
+ // Make sure that nothing sneaks out
1546
+ y.overflow = "hidden";
1547
+
1548
+ // Each step of an animation
1549
+ z.step = function(firstNum, lastNum){
1550
+ var t = (new Date()).getTime();
1551
+
1552
+ if (t > z.o.duration + z.startTime) {
1553
+ // Stop the timer
1554
+ clearInterval(z.timer);
1555
+ z.timer = null;
1556
+
1557
+ z.now = lastNum;
1558
+ z.a();
1559
+
1560
+ z.el.curAnim[ prop ] = true;
1561
+
1562
+ var done = true;
1563
+ for ( var i in z.el.curAnim )
1564
+ if ( z.el.curAnim[i] !== true )
1565
+ done = false;
1566
+
1567
+ if ( done ) {
1568
+ // Reset the overflow
1569
+ y.overflow = z.el.oldOverflow;
1570
+
1571
+ // Hide the element if the "hide" operation was done
1572
+ if ( z.o.hide )
1573
+ y.display = 'none';
1574
+
1575
+ // Reset the property, if the item has been hidden
1576
+ if ( z.o.hide ) {
1577
+ for ( var p in z.el.curAnim ) {
1578
+ if (p == "opacity" && jQuery.browser.msie)
1579
+ jQuery.attr(y, p, z.el.orig[p]);
1580
+ else
1581
+ y[ p ] = z.el.orig[p] + "px";
1582
+
1583
+ // set its height and/or width to auto
1584
+ if ( p == 'height' || p == 'width' )
1585
+ jQuery.setAuto( z.el, p );
1586
+ }
1587
+ }
1588
+ }
1589
+
1590
+ // If a callback was provided, execute it
1591
+ if( done && z.o.complete && z.o.complete.constructor == Function )
1592
+ // Execute the complete function
1593
+ z.o.complete.apply( z.el );
1594
+ } else {
1595
+ // Figure out where in the animation we are and set the number
1596
+ var p = (t - this.startTime) / z.o.duration;
1597
+ z.now = ((-Math.cos(p*Math.PI)/2) + 0.5) * (lastNum-firstNum) + firstNum;
1598
+
1599
+ // Perform the next step of the animation
1600
+ z.a();
1601
+ }
1602
+ };
1603
+
1604
+ }
1605
+
1606
+ });
1607
+ jQuery.fn.extend({
1608
+ loadIfModified: function( url, params, callback ) {
1609
+ this.load( url, params, callback, 1 );
1610
+ },
1611
+ load: function( url, params, callback, ifModified ) {
1612
+ if ( url.constructor == Function )
1613
+ return this.bind("load", url);
1614
+
1615
+ callback = callback || function(){};
1616
+
1617
+ // Default to a GET request
1618
+ var type = "GET";
1619
+
1620
+ // If the second parameter was provided
1621
+ if ( params ) {
1622
+ // If it's a function
1623
+ if ( params.constructor == Function ) {
1624
+ // We assume that it's the callback
1625
+ callback = params;
1626
+ params = null;
1627
+
1628
+ // Otherwise, build a param string
1629
+ } else {
1630
+ params = jQuery.param( params );
1631
+ type = "POST";
1632
+ }
1633
+ }
1634
+
1635
+ var self = this;
1636
+
1637
+ // Request the remote document
1638
+ jQuery.ajax( type, url, params,function(res, status){
1639
+
1640
+ if ( status == "success" || !ifModified && status == "notmodified" ) {
1641
+ // Inject the HTML into all the matched elements
1642
+ self.html(res.responseText).each( callback, [res.responseText, status] );
1643
+
1644
+ // Execute all the scripts inside of the newly-injected HTML
1645
+ jQuery("script", self).each(function(){
1646
+ if ( this.src )
1647
+ jQuery.getScript( this.src );
1648
+ else
1649
+ eval.call( window, this.text || this.textContent || this.innerHTML || "" );
1650
+ });
1651
+ } else
1652
+ callback.apply( self, [res.responseText, status] );
1653
+
1654
+ }, ifModified);
1655
+
1656
+ return this;
1657
+ },
1658
+ serialize: function() {
1659
+ return jQuery.param( this );
1660
+ }
1661
+
1662
+ });
1663
+
1664
+ // If IE is used, create a wrapper for the XMLHttpRequest object
1665
+ if ( jQuery.browser.msie && typeof XMLHttpRequest == "undefined" )
1666
+ XMLHttpRequest = function(){
1667
+ return new ActiveXObject(
1668
+ navigator.userAgent.indexOf("MSIE 5") >= 0 ?
1669
+ "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"
1670
+ );
1671
+ };
1672
+
1673
+ // Attach a bunch of functions for handling common AJAX events
1674
+
1675
+
1676
+
1677
+ new function(){
1678
+ var e = "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess".split(",");
1679
+
1680
+ for ( var i = 0; i < e.length; i++ ) new function(){
1681
+ var o = e[i];
1682
+ jQuery.fn[o] = function(f){
1683
+ return this.bind(o, f);
1684
+ };
1685
+ };
1686
+ };
1687
+
1688
+ jQuery.extend({
1689
+ get: function( url, data, callback, type, ifModified ) {
1690
+ if ( data.constructor == Function ) {
1691
+ type = callback;
1692
+ callback = data;
1693
+ data = null;
1694
+ }
1695
+
1696
+ // append ? + data or & + data, in case there are already params
1697
+ if ( data ) url += ((url.indexOf("?") > -1) ? "&" : "?") + jQuery.param(data);
1698
+
1699
+ // Build and start the HTTP Request
1700
+ jQuery.ajax( "GET", url, null, function(r, status) {
1701
+ if ( callback ) callback( jQuery.httpData(r,type), status );
1702
+ }, ifModified);
1703
+ },
1704
+ getIfModified: function( url, data, callback, type ) {
1705
+ jQuery.get(url, data, callback, type, 1);
1706
+ },
1707
+ getScript: function( url, callback ) {
1708
+ jQuery.get(url, callback, "script");
1709
+ },
1710
+ getJSON: function( url, data, callback ) {
1711
+ if(callback)
1712
+ jQuery.get(url, data, callback, "json");
1713
+ else {
1714
+ jQuery.get(url, data, "json");
1715
+ }
1716
+ },
1717
+ post: function( url, data, callback, type ) {
1718
+ // Build and start the HTTP Request
1719
+ jQuery.ajax( "POST", url, jQuery.param(data), function(r, status) {
1720
+ if ( callback ) callback( jQuery.httpData(r,type), status );
1721
+ });
1722
+ },
1723
+
1724
+ // timeout (ms)
1725
+ timeout: 0,
1726
+ ajaxTimeout: function(timeout) {
1727
+ jQuery.timeout = timeout;
1728
+ },
1729
+
1730
+ // Last-Modified header cache for next request
1731
+ lastModified: {},
1732
+ ajax: function( type, url, data, ret, ifModified ) {
1733
+ // If only a single argument was passed in,
1734
+ // assume that it is a object of key/value pairs
1735
+ if ( !url ) {
1736
+ ret = type.complete;
1737
+ var success = type.success;
1738
+ var error = type.error;
1739
+ var dataType = type.dataType;
1740
+ var global = typeof type.global == "boolean" ? type.global : true;
1741
+ var timeout = typeof type.timeout == "number" ? type.timeout : jQuery.timeout;
1742
+ var ifModified = type.ifModified || false;
1743
+ data = type.data;
1744
+ url = type.url;
1745
+ type = type.type;
1746
+ }
1747
+
1748
+ // Watch for a new set of requests
1749
+ if ( global && ! jQuery.active++ )
1750
+ jQuery.event.trigger( "ajaxStart" );
1751
+
1752
+ var requestDone = false;
1753
+
1754
+ // Create the request object
1755
+ var xml = new XMLHttpRequest();
1756
+
1757
+ // Open the socket
1758
+ xml.open(type || "GET", url, true);
1759
+
1760
+ // Set the correct header, if data is being sent
1761
+ if ( data )
1762
+ xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
1763
+
1764
+ // Set the If-Modified-Since header, if ifModified mode.
1765
+ if ( ifModified )
1766
+ xml.setRequestHeader("If-Modified-Since",
1767
+ jQuery.lastModified[url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
1768
+
1769
+ // Set header so the called script knows that it's an XMLHttpRequest
1770
+ xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
1771
+
1772
+ // Make sure the browser sends the right content length
1773
+ if ( xml.overrideMimeType )
1774
+ xml.setRequestHeader("Connection", "close");
1775
+
1776
+ // Wait for a response to come back
1777
+ var onreadystatechange = function(istimeout){
1778
+ // The transfer is complete and the data is available, or the request timed out
1779
+ if ( xml && (xml.readyState == 4 || istimeout == "timeout") ) {
1780
+ requestDone = true;
1781
+
1782
+ var status = jQuery.httpSuccess( xml ) && istimeout != "timeout" ?
1783
+ ifModified && jQuery.httpNotModified( xml, url ) ? "notmodified" : "success" : "error";
1784
+
1785
+ // Make sure that the request was successful or notmodified
1786
+ if ( status != "error" ) {
1787
+ // Cache Last-Modified header, if ifModified mode.
1788
+ var modRes;
1789
+ try {
1790
+ modRes = xml.getResponseHeader("Last-Modified");
1791
+ } catch(e) {} // swallow exception thrown by FF if header is not available
1792
+
1793
+ if ( ifModified && modRes )
1794
+ jQuery.lastModified[url] = modRes;
1795
+
1796
+ // If a local callback was specified, fire it
1797
+ if ( success )
1798
+ success( jQuery.httpData( xml, dataType ), status );
1799
+
1800
+ // Fire the global callback
1801
+ if( global )
1802
+ jQuery.event.trigger( "ajaxSuccess" );
1803
+
1804
+ // Otherwise, the request was not successful
1805
+ } else {
1806
+ // If a local callback was specified, fire it
1807
+ if ( error ) error( xml, status );
1808
+
1809
+ // Fire the global callback
1810
+ if( global )
1811
+ jQuery.event.trigger( "ajaxError" );
1812
+ }
1813
+
1814
+ // The request was completed
1815
+ if( global )
1816
+ jQuery.event.trigger( "ajaxComplete" );
1817
+
1818
+ // Handle the global AJAX counter
1819
+ if ( global && ! --jQuery.active )
1820
+ jQuery.event.trigger( "ajaxStop" );
1821
+
1822
+ // Process result
1823
+ if ( ret ) ret(xml, status);
1824
+
1825
+ // Stop memory leaks
1826
+ xml.onreadystatechange = function(){};
1827
+ xml = null;
1828
+
1829
+ }
1830
+ };
1831
+ xml.onreadystatechange = onreadystatechange;
1832
+
1833
+ // Timeout checker
1834
+ if(timeout > 0)
1835
+ setTimeout(function(){
1836
+ // Check to see if the request is still happening
1837
+ if (xml) {
1838
+ // Cancel the request
1839
+ xml.abort();
1840
+
1841
+ if ( !requestDone ) onreadystatechange( "timeout" );
1842
+
1843
+ // Clear from memory
1844
+ xml = null;
1845
+ }
1846
+ }, timeout);
1847
+
1848
+ // Send the data
1849
+ xml.send(data);
1850
+ },
1851
+
1852
+ // Counter for holding the number of active queries
1853
+ active: 0,
1854
+
1855
+ // Determines if an XMLHttpRequest was successful or not
1856
+ httpSuccess: function(r) {
1857
+ try {
1858
+ return !r.status && location.protocol == "file:" ||
1859
+ ( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
1860
+ jQuery.browser.safari && r.status == undefined;
1861
+ } catch(e){}
1862
+
1863
+ return false;
1864
+ },
1865
+
1866
+ // Determines if an XMLHttpRequest returns NotModified
1867
+ httpNotModified: function(xml, url) {
1868
+ try {
1869
+ var xmlRes = xml.getResponseHeader("Last-Modified");
1870
+
1871
+ // Firefox always returns 200. check Last-Modified date
1872
+ return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
1873
+ jQuery.browser.safari && xml.status == undefined;
1874
+ } catch(e){}
1875
+
1876
+ return false;
1877
+ },
1878
+
1879
+ /* Get the data out of an XMLHttpRequest.
1880
+ * Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
1881
+ * otherwise return plain text.
1882
+ * (String) data - The type of data that you're expecting back,
1883
+ * (e.g. "xml", "html", "script")
1884
+ */
1885
+ httpData: function(r,type) {
1886
+ var ct = r.getResponseHeader("content-type");
1887
+ var data = !type && ct && ct.indexOf("xml") >= 0;
1888
+ data = type == "xml" || data ? r.responseXML : r.responseText;
1889
+
1890
+ // If the type is "script", eval it
1891
+ if ( type == "script" ) eval.call( window, data );
1892
+
1893
+ // Get the JavaScript object, if JSON is used.
1894
+ if ( type == "json" ) eval( "data = " + data );
1895
+
1896
+ return data;
1897
+ },
1898
+
1899
+ // Serialize an array of form elements or a set of
1900
+ // key/values into a query string
1901
+ param: function(a) {
1902
+ var s = [];
1903
+
1904
+ // If an array was passed in, assume that it is an array
1905
+ // of form elements
1906
+ if ( a.constructor == Array || a.jquery ) {
1907
+ // Serialize the form elements
1908
+ for ( var i = 0; i < a.length; i++ )
1909
+ s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) );
1910
+
1911
+ // Otherwise, assume that it's an object of key/value pairs
1912
+ } else {
1913
+ // Serialize the key/values
1914
+ for ( var j in a )
1915
+ s.push( j + "=" + encodeURIComponent( a[j] ) );
1916
+ }
1917
+
1918
+ // Return the resulting serialization
1919
+ return s.join("&");
1920
+ }
1921
+
1922
+ });
1923
+ } // close: if(typeof window.jQuery == "undefined") {