bloggit 1.0.3

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 (423) hide show
  1. data/History +4 -0
  2. data/Manifest +422 -0
  3. data/Rakefile +64 -0
  4. data/ReadMe +69 -0
  5. data/Todo +26 -0
  6. data/bin/bloggit +5 -0
  7. data/docs/index.html +57 -0
  8. data/docs/specifications.html +100 -0
  9. data/docs/src/_layout.rhtml +53 -0
  10. data/docs/src/index.markdown +5 -0
  11. data/docs/src/specifications.markdown +48 -0
  12. data/lib/bloggit.rb +28 -0
  13. data/lib/bloggit/boilerplate/Rakefile +2 -0
  14. data/lib/bloggit/boilerplate/pages/about.page +5 -0
  15. data/lib/bloggit/boilerplate/plugins/haloscan/init.rb +5 -0
  16. data/lib/bloggit/boilerplate/settings.yml +28 -0
  17. data/lib/bloggit/boilerplate/themes/default/styles/main.css +145 -0
  18. data/lib/bloggit/boilerplate/themes/default/templates/archive.rhtml +20 -0
  19. data/lib/bloggit/boilerplate/themes/default/templates/home.rhtml +6 -0
  20. data/lib/bloggit/boilerplate/themes/default/templates/layouts/main.rhtml +15 -0
  21. data/lib/bloggit/boilerplate/themes/default/templates/layouts/two-columns.rhtml +21 -0
  22. data/lib/bloggit/boilerplate/themes/default/templates/page.rhtml +8 -0
  23. data/lib/bloggit/boilerplate/themes/default/templates/post.rhtml +3 -0
  24. data/lib/bloggit/boilerplate/themes/default/templates/snippets/blog_entry.rhtml +16 -0
  25. data/lib/bloggit/boilerplate/themes/default/templates/snippets/navigation.rhtml +12 -0
  26. data/lib/bloggit/boilerplate/themes/default/templates/snippets/tag_list.rhtml +9 -0
  27. data/lib/bloggit/boilerplate/themes/default/templates/tag_archive.rhtml +38 -0
  28. data/lib/bloggit/checksum.rb +39 -0
  29. data/lib/bloggit/client/index.html +2 -0
  30. data/lib/bloggit/client/scripts/adapter/jquery/ext-jquery-adapter.js +12 -0
  31. data/lib/bloggit/client/scripts/adapter/jquery/jquery-plugins.js +965 -0
  32. data/lib/bloggit/client/scripts/adapter/jquery/jquery.js +2201 -0
  33. data/lib/bloggit/client/scripts/adapter/prototype/effects.js +1098 -0
  34. data/lib/bloggit/client/scripts/adapter/prototype/ext-prototype-adapter.js +12 -0
  35. data/lib/bloggit/client/scripts/adapter/prototype/prototype.js +2523 -0
  36. data/lib/bloggit/client/scripts/adapter/prototype/scriptaculous.js +59 -0
  37. data/lib/bloggit/client/scripts/adapter/yui/ext-yui-adapter.js +12 -0
  38. data/lib/bloggit/client/scripts/adapter/yui/yui-utilities.js +18 -0
  39. data/lib/bloggit/client/scripts/app.js +121 -0
  40. data/lib/bloggit/client/scripts/ext-all.js +256 -0
  41. data/lib/bloggit/client/scripts/resources/css/README.txt +3 -0
  42. data/lib/bloggit/client/scripts/resources/css/basic-dialog.css +286 -0
  43. data/lib/bloggit/client/scripts/resources/css/box.css +111 -0
  44. data/lib/bloggit/client/scripts/resources/css/button.css +148 -0
  45. data/lib/bloggit/client/scripts/resources/css/combo.css +46 -0
  46. data/lib/bloggit/client/scripts/resources/css/core.css +290 -0
  47. data/lib/bloggit/client/scripts/resources/css/date-picker.css +155 -0
  48. data/lib/bloggit/client/scripts/resources/css/dd.css +61 -0
  49. data/lib/bloggit/client/scripts/resources/css/debug.css +55 -0
  50. data/lib/bloggit/client/scripts/resources/css/ext-all.css +3167 -0
  51. data/lib/bloggit/client/scripts/resources/css/form.css +359 -0
  52. data/lib/bloggit/client/scripts/resources/css/grid.css +295 -0
  53. data/lib/bloggit/client/scripts/resources/css/layout.css +252 -0
  54. data/lib/bloggit/client/scripts/resources/css/menu.css +116 -0
  55. data/lib/bloggit/client/scripts/resources/css/panel.css +258 -0
  56. data/lib/bloggit/client/scripts/resources/css/qtips.css +119 -0
  57. data/lib/bloggit/client/scripts/resources/css/reset-min.css +9 -0
  58. data/lib/bloggit/client/scripts/resources/css/resizable.css +143 -0
  59. data/lib/bloggit/client/scripts/resources/css/tabs.css +134 -0
  60. data/lib/bloggit/client/scripts/resources/css/toolbar.css +160 -0
  61. data/lib/bloggit/client/scripts/resources/css/tree.css +179 -0
  62. data/lib/bloggit/client/scripts/resources/css/window.css +155 -0
  63. data/lib/bloggit/client/scripts/resources/css/ytheme-aero.css +581 -0
  64. data/lib/bloggit/client/scripts/resources/css/ytheme-gray.css +438 -0
  65. data/lib/bloggit/client/scripts/resources/css/ytheme-vista.css +511 -0
  66. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/aero-close-over.gif +0 -0
  67. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/aero-close.gif +0 -0
  68. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/bg-center.gif +0 -0
  69. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/bg-left.gif +0 -0
  70. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/bg-right.gif +0 -0
  71. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/close.gif +0 -0
  72. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/collapse-over.gif +0 -0
  73. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/collapse.gif +0 -0
  74. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/e-handle.gif +0 -0
  75. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/expand-over.gif +0 -0
  76. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/expand.gif +0 -0
  77. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/hd-sprite.gif +0 -0
  78. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/s-handle.gif +0 -0
  79. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/se-handle.gif +0 -0
  80. data/lib/bloggit/client/scripts/resources/images/aero/basic-dialog/w-handle.gif +0 -0
  81. data/lib/bloggit/client/scripts/resources/images/aero/gradient-bg.gif +0 -0
  82. data/lib/bloggit/client/scripts/resources/images/aero/grid/grid-blue-split.gif +0 -0
  83. data/lib/bloggit/client/scripts/resources/images/aero/grid/grid-hrow.gif +0 -0
  84. data/lib/bloggit/client/scripts/resources/images/aero/grid/grid-split.gif +0 -0
  85. data/lib/bloggit/client/scripts/resources/images/aero/grid/grid-vista-hd.gif +0 -0
  86. data/lib/bloggit/client/scripts/resources/images/aero/grid/pspbrwse.jbf +0 -0
  87. data/lib/bloggit/client/scripts/resources/images/aero/grid/sort-col-bg.gif +0 -0
  88. data/lib/bloggit/client/scripts/resources/images/aero/grid/sort_asc.gif +0 -0
  89. data/lib/bloggit/client/scripts/resources/images/aero/grid/sort_desc.gif +0 -0
  90. data/lib/bloggit/client/scripts/resources/images/aero/layout/collapse.gif +0 -0
  91. data/lib/bloggit/client/scripts/resources/images/aero/layout/expand.gif +0 -0
  92. data/lib/bloggit/client/scripts/resources/images/aero/layout/gradient-bg.gif +0 -0
  93. data/lib/bloggit/client/scripts/resources/images/aero/layout/ns-collapse.gif +0 -0
  94. data/lib/bloggit/client/scripts/resources/images/aero/layout/ns-expand.gif +0 -0
  95. data/lib/bloggit/client/scripts/resources/images/aero/layout/panel-close.gif +0 -0
  96. data/lib/bloggit/client/scripts/resources/images/aero/layout/panel-title-bg.gif +0 -0
  97. data/lib/bloggit/client/scripts/resources/images/aero/layout/panel-title-light-bg.gif +0 -0
  98. data/lib/bloggit/client/scripts/resources/images/aero/layout/tab-close-on.gif +0 -0
  99. data/lib/bloggit/client/scripts/resources/images/aero/layout/tab-close.gif +0 -0
  100. data/lib/bloggit/client/scripts/resources/images/aero/qtip/bg.gif +0 -0
  101. data/lib/bloggit/client/scripts/resources/images/aero/s.gif +0 -0
  102. data/lib/bloggit/client/scripts/resources/images/aero/sizer/e-handle-dark.gif +0 -0
  103. data/lib/bloggit/client/scripts/resources/images/aero/sizer/e-handle.gif +0 -0
  104. data/lib/bloggit/client/scripts/resources/images/aero/sizer/ne-handle-dark.gif +0 -0
  105. data/lib/bloggit/client/scripts/resources/images/aero/sizer/ne-handle.gif +0 -0
  106. data/lib/bloggit/client/scripts/resources/images/aero/sizer/nw-handle-dark.gif +0 -0
  107. data/lib/bloggit/client/scripts/resources/images/aero/sizer/nw-handle.gif +0 -0
  108. data/lib/bloggit/client/scripts/resources/images/aero/sizer/s-handle-dark.gif +0 -0
  109. data/lib/bloggit/client/scripts/resources/images/aero/sizer/s-handle.gif +0 -0
  110. data/lib/bloggit/client/scripts/resources/images/aero/sizer/se-handle-dark.gif +0 -0
  111. data/lib/bloggit/client/scripts/resources/images/aero/sizer/se-handle.gif +0 -0
  112. data/lib/bloggit/client/scripts/resources/images/aero/sizer/sw-handle-dark.gif +0 -0
  113. data/lib/bloggit/client/scripts/resources/images/aero/sizer/sw-handle.gif +0 -0
  114. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-btm-inactive-left-bg.gif +0 -0
  115. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-btm-inactive-right-bg.gif +0 -0
  116. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-btm-left-bg.gif +0 -0
  117. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-btm-right-bg.gif +0 -0
  118. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-sprite.gif +0 -0
  119. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-strip-bg.gif +0 -0
  120. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-strip-bg.png +0 -0
  121. data/lib/bloggit/client/scripts/resources/images/aero/tabs/tab-strip-btm-bg.gif +0 -0
  122. data/lib/bloggit/client/scripts/resources/images/aero/toolbar/bg.gif +0 -0
  123. data/lib/bloggit/client/scripts/resources/images/aero/toolbar/tb-btn-sprite.gif +0 -0
  124. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/btn-arrow.gif +0 -0
  125. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/btn-sprite.gif +0 -0
  126. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/close.gif +0 -0
  127. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/collapse.gif +0 -0
  128. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/e-handle.gif +0 -0
  129. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/expand.gif +0 -0
  130. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/hd-sprite.gif +0 -0
  131. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/progress.gif +0 -0
  132. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/progress2.gif +0 -0
  133. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/s-handle.gif +0 -0
  134. data/lib/bloggit/client/scripts/resources/images/default/basic-dialog/se-handle.gif +0 -0
  135. data/lib/bloggit/client/scripts/resources/images/default/box/corners-blue.gif +0 -0
  136. data/lib/bloggit/client/scripts/resources/images/default/box/corners.gif +0 -0
  137. data/lib/bloggit/client/scripts/resources/images/default/box/l-blue.gif +0 -0
  138. data/lib/bloggit/client/scripts/resources/images/default/box/l.gif +0 -0
  139. data/lib/bloggit/client/scripts/resources/images/default/box/r-blue.gif +0 -0
  140. data/lib/bloggit/client/scripts/resources/images/default/box/r.gif +0 -0
  141. data/lib/bloggit/client/scripts/resources/images/default/box/tb-blue.gif +0 -0
  142. data/lib/bloggit/client/scripts/resources/images/default/box/tb.gif +0 -0
  143. data/lib/bloggit/client/scripts/resources/images/default/dd/drop-add.gif +0 -0
  144. data/lib/bloggit/client/scripts/resources/images/default/dd/drop-no.gif +0 -0
  145. data/lib/bloggit/client/scripts/resources/images/default/dd/drop-yes.gif +0 -0
  146. data/lib/bloggit/client/scripts/resources/images/default/form/date-trigger.gif +0 -0
  147. data/lib/bloggit/client/scripts/resources/images/default/form/error-tip-corners.gif +0 -0
  148. data/lib/bloggit/client/scripts/resources/images/default/form/exclamation.gif +0 -0
  149. data/lib/bloggit/client/scripts/resources/images/default/form/text-bg.gif +0 -0
  150. data/lib/bloggit/client/scripts/resources/images/default/form/trigger.gif +0 -0
  151. data/lib/bloggit/client/scripts/resources/images/default/gradient-bg.gif +0 -0
  152. data/lib/bloggit/client/scripts/resources/images/default/grid/Thumbs.db +0 -0
  153. data/lib/bloggit/client/scripts/resources/images/default/grid/arrow-left-white.gif +0 -0
  154. data/lib/bloggit/client/scripts/resources/images/default/grid/arrow-right-white.gif +0 -0
  155. data/lib/bloggit/client/scripts/resources/images/default/grid/col-move-bottom.gif +0 -0
  156. data/lib/bloggit/client/scripts/resources/images/default/grid/col-move-top.gif +0 -0
  157. data/lib/bloggit/client/scripts/resources/images/default/grid/dirty.gif +0 -0
  158. data/lib/bloggit/client/scripts/resources/images/default/grid/done.gif +0 -0
  159. data/lib/bloggit/client/scripts/resources/images/default/grid/drop-no.gif +0 -0
  160. data/lib/bloggit/client/scripts/resources/images/default/grid/drop-yes.gif +0 -0
  161. data/lib/bloggit/client/scripts/resources/images/default/grid/footer-bg.gif +0 -0
  162. data/lib/bloggit/client/scripts/resources/images/default/grid/grid-blue-hd.gif +0 -0
  163. data/lib/bloggit/client/scripts/resources/images/default/grid/grid-blue-split.gif +0 -0
  164. data/lib/bloggit/client/scripts/resources/images/default/grid/grid-hrow.gif +0 -0
  165. data/lib/bloggit/client/scripts/resources/images/default/grid/grid-loading.gif +0 -0
  166. data/lib/bloggit/client/scripts/resources/images/default/grid/grid-split.gif +0 -0
  167. data/lib/bloggit/client/scripts/resources/images/default/grid/grid-vista-hd.gif +0 -0
  168. data/lib/bloggit/client/scripts/resources/images/default/grid/hd-pop.gif +0 -0
  169. data/lib/bloggit/client/scripts/resources/images/default/grid/hmenu-asc.gif +0 -0
  170. data/lib/bloggit/client/scripts/resources/images/default/grid/hmenu-desc.gif +0 -0
  171. data/lib/bloggit/client/scripts/resources/images/default/grid/hmenu-lock.gif +0 -0
  172. data/lib/bloggit/client/scripts/resources/images/default/grid/hmenu-lock.png +0 -0
  173. data/lib/bloggit/client/scripts/resources/images/default/grid/hmenu-unlock.gif +0 -0
  174. data/lib/bloggit/client/scripts/resources/images/default/grid/hmenu-unlock.png +0 -0
  175. data/lib/bloggit/client/scripts/resources/images/default/grid/invalid_line.gif +0 -0
  176. data/lib/bloggit/client/scripts/resources/images/default/grid/loading.gif +0 -0
  177. data/lib/bloggit/client/scripts/resources/images/default/grid/mso-hd.gif +0 -0
  178. data/lib/bloggit/client/scripts/resources/images/default/grid/nowait.gif +0 -0
  179. data/lib/bloggit/client/scripts/resources/images/default/grid/page-first-disabled.gif +0 -0
  180. data/lib/bloggit/client/scripts/resources/images/default/grid/page-first.gif +0 -0
  181. data/lib/bloggit/client/scripts/resources/images/default/grid/page-last-disabled.gif +0 -0
  182. data/lib/bloggit/client/scripts/resources/images/default/grid/page-last.gif +0 -0
  183. data/lib/bloggit/client/scripts/resources/images/default/grid/page-next-disabled.gif +0 -0
  184. data/lib/bloggit/client/scripts/resources/images/default/grid/page-next.gif +0 -0
  185. data/lib/bloggit/client/scripts/resources/images/default/grid/page-prev-disabled.gif +0 -0
  186. data/lib/bloggit/client/scripts/resources/images/default/grid/page-prev.gif +0 -0
  187. data/lib/bloggit/client/scripts/resources/images/default/grid/pick-button.gif +0 -0
  188. data/lib/bloggit/client/scripts/resources/images/default/grid/refresh.gif +0 -0
  189. data/lib/bloggit/client/scripts/resources/images/default/grid/sort_asc.gif +0 -0
  190. data/lib/bloggit/client/scripts/resources/images/default/grid/sort_desc.gif +0 -0
  191. data/lib/bloggit/client/scripts/resources/images/default/grid/wait.gif +0 -0
  192. data/lib/bloggit/client/scripts/resources/images/default/layout/collapse.gif +0 -0
  193. data/lib/bloggit/client/scripts/resources/images/default/layout/expand.gif +0 -0
  194. data/lib/bloggit/client/scripts/resources/images/default/layout/gradient-bg.gif +0 -0
  195. data/lib/bloggit/client/scripts/resources/images/default/layout/ns-collapse.gif +0 -0
  196. data/lib/bloggit/client/scripts/resources/images/default/layout/ns-expand.gif +0 -0
  197. data/lib/bloggit/client/scripts/resources/images/default/layout/panel-close.gif +0 -0
  198. data/lib/bloggit/client/scripts/resources/images/default/layout/panel-title-bg.gif +0 -0
  199. data/lib/bloggit/client/scripts/resources/images/default/layout/panel-title-light-bg.gif +0 -0
  200. data/lib/bloggit/client/scripts/resources/images/default/layout/stick.gif +0 -0
  201. data/lib/bloggit/client/scripts/resources/images/default/layout/stuck.gif +0 -0
  202. data/lib/bloggit/client/scripts/resources/images/default/layout/tab-close-on.gif +0 -0
  203. data/lib/bloggit/client/scripts/resources/images/default/layout/tab-close.gif +0 -0
  204. data/lib/bloggit/client/scripts/resources/images/default/menu/checked.gif +0 -0
  205. data/lib/bloggit/client/scripts/resources/images/default/menu/group-checked.gif +0 -0
  206. data/lib/bloggit/client/scripts/resources/images/default/menu/menu-parent.gif +0 -0
  207. data/lib/bloggit/client/scripts/resources/images/default/menu/menu.gif +0 -0
  208. data/lib/bloggit/client/scripts/resources/images/default/menu/unchecked.gif +0 -0
  209. data/lib/bloggit/client/scripts/resources/images/default/qtip/bg.gif +0 -0
  210. data/lib/bloggit/client/scripts/resources/images/default/qtip/close.gif +0 -0
  211. data/lib/bloggit/client/scripts/resources/images/default/qtip/tip-sprite.gif +0 -0
  212. data/lib/bloggit/client/scripts/resources/images/default/s.gif +0 -0
  213. data/lib/bloggit/client/scripts/resources/images/default/shadow-c.png +0 -0
  214. data/lib/bloggit/client/scripts/resources/images/default/shadow-lr.png +0 -0
  215. data/lib/bloggit/client/scripts/resources/images/default/shadow.png +0 -0
  216. data/lib/bloggit/client/scripts/resources/images/default/shared/calendar.gif +0 -0
  217. data/lib/bloggit/client/scripts/resources/images/default/shared/left-btn.gif +0 -0
  218. data/lib/bloggit/client/scripts/resources/images/default/shared/right-btn.gif +0 -0
  219. data/lib/bloggit/client/scripts/resources/images/default/shared/warning.gif +0 -0
  220. data/lib/bloggit/client/scripts/resources/images/default/sizer/e-handle-dark.gif +0 -0
  221. data/lib/bloggit/client/scripts/resources/images/default/sizer/e-handle.gif +0 -0
  222. data/lib/bloggit/client/scripts/resources/images/default/sizer/ne-handle-dark.gif +0 -0
  223. data/lib/bloggit/client/scripts/resources/images/default/sizer/ne-handle.gif +0 -0
  224. data/lib/bloggit/client/scripts/resources/images/default/sizer/nw-handle-dark.gif +0 -0
  225. data/lib/bloggit/client/scripts/resources/images/default/sizer/nw-handle.gif +0 -0
  226. data/lib/bloggit/client/scripts/resources/images/default/sizer/s-handle-dark.gif +0 -0
  227. data/lib/bloggit/client/scripts/resources/images/default/sizer/s-handle.gif +0 -0
  228. data/lib/bloggit/client/scripts/resources/images/default/sizer/se-handle-dark.gif +0 -0
  229. data/lib/bloggit/client/scripts/resources/images/default/sizer/se-handle.gif +0 -0
  230. data/lib/bloggit/client/scripts/resources/images/default/sizer/square.gif +0 -0
  231. data/lib/bloggit/client/scripts/resources/images/default/sizer/sw-handle-dark.gif +0 -0
  232. data/lib/bloggit/client/scripts/resources/images/default/sizer/sw-handle.gif +0 -0
  233. data/lib/bloggit/client/scripts/resources/images/default/tabs/tab-btm-inactive-left-bg.gif +0 -0
  234. data/lib/bloggit/client/scripts/resources/images/default/tabs/tab-btm-inactive-right-bg.gif +0 -0
  235. data/lib/bloggit/client/scripts/resources/images/default/tabs/tab-btm-left-bg.gif +0 -0
  236. data/lib/bloggit/client/scripts/resources/images/default/tabs/tab-btm-right-bg.gif +0 -0
  237. data/lib/bloggit/client/scripts/resources/images/default/tabs/tab-sprite.gif +0 -0
  238. data/lib/bloggit/client/scripts/resources/images/default/toolbar/btn-arrow-light.gif +0 -0
  239. data/lib/bloggit/client/scripts/resources/images/default/toolbar/btn-arrow.gif +0 -0
  240. data/lib/bloggit/client/scripts/resources/images/default/toolbar/btn-over-bg.gif +0 -0
  241. data/lib/bloggit/client/scripts/resources/images/default/toolbar/gray-bg.gif +0 -0
  242. data/lib/bloggit/client/scripts/resources/images/default/toolbar/tb-bg.gif +0 -0
  243. data/lib/bloggit/client/scripts/resources/images/default/toolbar/tb-btn-sprite.gif +0 -0
  244. data/lib/bloggit/client/scripts/resources/images/default/tree/drop-add.gif +0 -0
  245. data/lib/bloggit/client/scripts/resources/images/default/tree/drop-between.gif +0 -0
  246. data/lib/bloggit/client/scripts/resources/images/default/tree/drop-no.gif +0 -0
  247. data/lib/bloggit/client/scripts/resources/images/default/tree/drop-over.gif +0 -0
  248. data/lib/bloggit/client/scripts/resources/images/default/tree/drop-under.gif +0 -0
  249. data/lib/bloggit/client/scripts/resources/images/default/tree/drop-yes.gif +0 -0
  250. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-end-minus-nl.gif +0 -0
  251. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-end-minus.gif +0 -0
  252. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-end-plus-nl.gif +0 -0
  253. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-end-plus.gif +0 -0
  254. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-end.gif +0 -0
  255. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-line.gif +0 -0
  256. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-minus-nl.gif +0 -0
  257. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-minus.gif +0 -0
  258. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-plus-nl.gif +0 -0
  259. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow-plus.gif +0 -0
  260. data/lib/bloggit/client/scripts/resources/images/default/tree/elbow.gif +0 -0
  261. data/lib/bloggit/client/scripts/resources/images/default/tree/folder-open.gif +0 -0
  262. data/lib/bloggit/client/scripts/resources/images/default/tree/folder.gif +0 -0
  263. data/lib/bloggit/client/scripts/resources/images/default/tree/leaf.gif +0 -0
  264. data/lib/bloggit/client/scripts/resources/images/default/tree/loading.gif +0 -0
  265. data/lib/bloggit/client/scripts/resources/images/default/tree/s.gif +0 -0
  266. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/close.gif +0 -0
  267. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/collapse.gif +0 -0
  268. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/dlg-bg.gif +0 -0
  269. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/e-handle.gif +0 -0
  270. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/expand.gif +0 -0
  271. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/hd-sprite.gif +0 -0
  272. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/s-handle.gif +0 -0
  273. data/lib/bloggit/client/scripts/resources/images/gray/basic-dialog/se-handle.gif +0 -0
  274. data/lib/bloggit/client/scripts/resources/images/gray/gradient-bg.gif +0 -0
  275. data/lib/bloggit/client/scripts/resources/images/gray/grid/grid-hrow.gif +0 -0
  276. data/lib/bloggit/client/scripts/resources/images/gray/layout/collapse.gif +0 -0
  277. data/lib/bloggit/client/scripts/resources/images/gray/layout/expand.gif +0 -0
  278. data/lib/bloggit/client/scripts/resources/images/gray/layout/gradient-bg.gif +0 -0
  279. data/lib/bloggit/client/scripts/resources/images/gray/layout/ns-collapse.gif +0 -0
  280. data/lib/bloggit/client/scripts/resources/images/gray/layout/ns-expand.gif +0 -0
  281. data/lib/bloggit/client/scripts/resources/images/gray/layout/panel-close.gif +0 -0
  282. data/lib/bloggit/client/scripts/resources/images/gray/layout/panel-title-bg.gif +0 -0
  283. data/lib/bloggit/client/scripts/resources/images/gray/layout/panel-title-light-bg.gif +0 -0
  284. data/lib/bloggit/client/scripts/resources/images/gray/layout/stick.gif +0 -0
  285. data/lib/bloggit/client/scripts/resources/images/gray/layout/tab-close-on.gif +0 -0
  286. data/lib/bloggit/client/scripts/resources/images/gray/layout/tab-close.gif +0 -0
  287. data/lib/bloggit/client/scripts/resources/images/gray/menu/checked.gif +0 -0
  288. data/lib/bloggit/client/scripts/resources/images/gray/menu/group-checked.gif +0 -0
  289. data/lib/bloggit/client/scripts/resources/images/gray/menu/menu-parent.gif +0 -0
  290. data/lib/bloggit/client/scripts/resources/images/gray/menu/menu.gif +0 -0
  291. data/lib/bloggit/client/scripts/resources/images/gray/menu/unchecked.gif +0 -0
  292. data/lib/bloggit/client/scripts/resources/images/gray/qtip/bg.gif +0 -0
  293. data/lib/bloggit/client/scripts/resources/images/gray/qtip/tip-sprite.gif +0 -0
  294. data/lib/bloggit/client/scripts/resources/images/gray/s.gif +0 -0
  295. data/lib/bloggit/client/scripts/resources/images/gray/sizer/e-handle-dark.gif +0 -0
  296. data/lib/bloggit/client/scripts/resources/images/gray/sizer/e-handle.gif +0 -0
  297. data/lib/bloggit/client/scripts/resources/images/gray/sizer/ne-handle-dark.gif +0 -0
  298. data/lib/bloggit/client/scripts/resources/images/gray/sizer/ne-handle.gif +0 -0
  299. data/lib/bloggit/client/scripts/resources/images/gray/sizer/nw-handle-dark.gif +0 -0
  300. data/lib/bloggit/client/scripts/resources/images/gray/sizer/nw-handle.gif +0 -0
  301. data/lib/bloggit/client/scripts/resources/images/gray/sizer/s-handle-dark.gif +0 -0
  302. data/lib/bloggit/client/scripts/resources/images/gray/sizer/s-handle.gif +0 -0
  303. data/lib/bloggit/client/scripts/resources/images/gray/sizer/se-handle-dark.gif +0 -0
  304. data/lib/bloggit/client/scripts/resources/images/gray/sizer/se-handle.gif +0 -0
  305. data/lib/bloggit/client/scripts/resources/images/gray/sizer/sw-handle-dark.gif +0 -0
  306. data/lib/bloggit/client/scripts/resources/images/gray/sizer/sw-handle.gif +0 -0
  307. data/lib/bloggit/client/scripts/resources/images/gray/tabs/tab-btm-inactive-left-bg.gif +0 -0
  308. data/lib/bloggit/client/scripts/resources/images/gray/tabs/tab-btm-inactive-right-bg.gif +0 -0
  309. data/lib/bloggit/client/scripts/resources/images/gray/tabs/tab-btm-left-bg.gif +0 -0
  310. data/lib/bloggit/client/scripts/resources/images/gray/tabs/tab-btm-right-bg.gif +0 -0
  311. data/lib/bloggit/client/scripts/resources/images/gray/tabs/tab-sprite.gif +0 -0
  312. data/lib/bloggit/client/scripts/resources/images/gray/toolbar/gray-bg.gif +0 -0
  313. data/lib/bloggit/client/scripts/resources/images/gray/toolbar/tb-btn-sprite.gif +0 -0
  314. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/bg-center.gif +0 -0
  315. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/bg-left.gif +0 -0
  316. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/bg-right.gif +0 -0
  317. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/close.gif +0 -0
  318. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/collapse.gif +0 -0
  319. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/dlg-bg.gif +0 -0
  320. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/e-handle.gif +0 -0
  321. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/expand.gif +0 -0
  322. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/hd-sprite.gif +0 -0
  323. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/s-handle.gif +0 -0
  324. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/se-handle.gif +0 -0
  325. data/lib/bloggit/client/scripts/resources/images/vista/basic-dialog/w-handle.gif +0 -0
  326. data/lib/bloggit/client/scripts/resources/images/vista/gradient-bg.gif +0 -0
  327. data/lib/bloggit/client/scripts/resources/images/vista/grid/grid-split.gif +0 -0
  328. data/lib/bloggit/client/scripts/resources/images/vista/grid/grid-vista-hd.gif +0 -0
  329. data/lib/bloggit/client/scripts/resources/images/vista/layout/collapse.gif +0 -0
  330. data/lib/bloggit/client/scripts/resources/images/vista/layout/expand.gif +0 -0
  331. data/lib/bloggit/client/scripts/resources/images/vista/layout/gradient-bg.gif +0 -0
  332. data/lib/bloggit/client/scripts/resources/images/vista/layout/ns-collapse.gif +0 -0
  333. data/lib/bloggit/client/scripts/resources/images/vista/layout/ns-expand.gif +0 -0
  334. data/lib/bloggit/client/scripts/resources/images/vista/layout/panel-close.gif +0 -0
  335. data/lib/bloggit/client/scripts/resources/images/vista/layout/panel-title-bg.gif +0 -0
  336. data/lib/bloggit/client/scripts/resources/images/vista/layout/panel-title-light-bg.gif +0 -0
  337. data/lib/bloggit/client/scripts/resources/images/vista/layout/stick.gif +0 -0
  338. data/lib/bloggit/client/scripts/resources/images/vista/layout/tab-close-on.gif +0 -0
  339. data/lib/bloggit/client/scripts/resources/images/vista/layout/tab-close.gif +0 -0
  340. data/lib/bloggit/client/scripts/resources/images/vista/qtip/bg.gif +0 -0
  341. data/lib/bloggit/client/scripts/resources/images/vista/qtip/tip-sprite.gif +0 -0
  342. data/lib/bloggit/client/scripts/resources/images/vista/s.gif +0 -0
  343. data/lib/bloggit/client/scripts/resources/images/vista/sizer/e-handle-dark.gif +0 -0
  344. data/lib/bloggit/client/scripts/resources/images/vista/sizer/e-handle.gif +0 -0
  345. data/lib/bloggit/client/scripts/resources/images/vista/sizer/ne-handle-dark.gif +0 -0
  346. data/lib/bloggit/client/scripts/resources/images/vista/sizer/ne-handle.gif +0 -0
  347. data/lib/bloggit/client/scripts/resources/images/vista/sizer/nw-handle-dark.gif +0 -0
  348. data/lib/bloggit/client/scripts/resources/images/vista/sizer/nw-handle.gif +0 -0
  349. data/lib/bloggit/client/scripts/resources/images/vista/sizer/s-handle-dark.gif +0 -0
  350. data/lib/bloggit/client/scripts/resources/images/vista/sizer/s-handle.gif +0 -0
  351. data/lib/bloggit/client/scripts/resources/images/vista/sizer/se-handle-dark.gif +0 -0
  352. data/lib/bloggit/client/scripts/resources/images/vista/sizer/se-handle.gif +0 -0
  353. data/lib/bloggit/client/scripts/resources/images/vista/sizer/sw-handle-dark.gif +0 -0
  354. data/lib/bloggit/client/scripts/resources/images/vista/sizer/sw-handle.gif +0 -0
  355. data/lib/bloggit/client/scripts/resources/images/vista/tabs/tab-btm-inactive-left-bg.gif +0 -0
  356. data/lib/bloggit/client/scripts/resources/images/vista/tabs/tab-btm-inactive-right-bg.gif +0 -0
  357. data/lib/bloggit/client/scripts/resources/images/vista/tabs/tab-btm-left-bg.gif +0 -0
  358. data/lib/bloggit/client/scripts/resources/images/vista/tabs/tab-btm-right-bg.gif +0 -0
  359. data/lib/bloggit/client/scripts/resources/images/vista/tabs/tab-sprite.gif +0 -0
  360. data/lib/bloggit/client/scripts/resources/images/vista/toolbar/gray-bg.gif +0 -0
  361. data/lib/bloggit/client/scripts/resources/images/vista/toolbar/tb-btn-sprite.gif +0 -0
  362. data/lib/bloggit/client/scripts/resources/license.txt +25 -0
  363. data/lib/bloggit/client/scripts/resources/raw-images/shadow.psd +0 -0
  364. data/lib/bloggit/client/scripts/resources/resources.jsb +522 -0
  365. data/lib/bloggit/client/templates/json.rhtml +5 -0
  366. data/lib/bloggit/client/templates/main.rhtml +109 -0
  367. data/lib/bloggit/commandline.rb +52 -0
  368. data/lib/bloggit/commands/page_cmd.rb +17 -0
  369. data/lib/bloggit/commands/plugin_cmd.rb +89 -0
  370. data/lib/bloggit/commands/post_cmd.rb +17 -0
  371. data/lib/bloggit/commands/site_cmd.rb +82 -0
  372. data/lib/bloggit/commands/theme_cmd.rb +16 -0
  373. data/lib/bloggit/etc/hash.rb +24 -0
  374. data/lib/bloggit/etc/string.rb +5 -0
  375. data/lib/bloggit/generator.rb +331 -0
  376. data/lib/bloggit/hooks.rb +21 -0
  377. data/lib/bloggit/media.rb +40 -0
  378. data/lib/bloggit/page.rb +98 -0
  379. data/lib/bloggit/plugin.rb +52 -0
  380. data/lib/bloggit/post.rb +169 -0
  381. data/lib/bloggit/publisher.rb +115 -0
  382. data/lib/bloggit/server.rb +102 -0
  383. data/lib/bloggit/site.rb +183 -0
  384. data/lib/bloggit/tag.rb +61 -0
  385. data/lib/bloggit/tasks/client.rb +9 -0
  386. data/lib/bloggit/tasks/publishing.rb +36 -0
  387. data/lib/bloggit/tasks/scm.rb +78 -0
  388. data/lib/bloggit/tasks/specs.rb +128 -0
  389. data/lib/bloggit/template.rb +334 -0
  390. data/lib/bloggit/text_formatter.rb +50 -0
  391. data/lib/util/fixed_hoe.rb +553 -0
  392. data/test/fixtures/test.blog/Rakefile +7 -0
  393. data/test/fixtures/test.blog/pages/about.page +7 -0
  394. data/test/fixtures/test.blog/pages/coming-soon.page +3 -0
  395. data/test/fixtures/test.blog/pages/todo.page +23 -0
  396. data/test/fixtures/test.blog/plugins/example/init.rb +69 -0
  397. data/test/fixtures/test.blog/plugins/haloscan/init.rb +25 -0
  398. data/test/fixtures/test.blog/plugins/js_search/init.rb +51 -0
  399. data/test/fixtures/test.blog/plugins/rdoc_formatter/init.rb +14 -0
  400. data/test/fixtures/test.blog/posts/2004.03.07_to-boldly-go.post +11 -0
  401. data/test/fixtures/test.blog/posts/2007.03.25_sure-whatever.post +10 -0
  402. data/test/fixtures/test.blog/posts/2007.03.27_rdoc-anyone.post +13 -0
  403. data/test/fixtures/test.blog/posts/2010.12.07_35-already.post +5 -0
  404. data/test/fixtures/test.blog/settings.yml +34 -0
  405. data/test/fixtures/test.blog/themes/default/styles/main.css +145 -0
  406. data/test/fixtures/test.blog/themes/default/templates/archive.rhtml +22 -0
  407. data/test/fixtures/test.blog/themes/default/templates/home.rhtml +9 -0
  408. data/test/fixtures/test.blog/themes/default/templates/layouts/main.rhtml +17 -0
  409. data/test/fixtures/test.blog/themes/default/templates/layouts/two-columns.rhtml +21 -0
  410. data/test/fixtures/test.blog/themes/default/templates/page.rhtml +8 -0
  411. data/test/fixtures/test.blog/themes/default/templates/post.rhtml +15 -0
  412. data/test/fixtures/test.blog/themes/default/templates/snippets/blog_entry.rhtml +10 -0
  413. data/test/fixtures/test.blog/themes/default/templates/snippets/navigation.rhtml +12 -0
  414. data/test/fixtures/test.blog/themes/default/templates/snippets/tag_list.rhtml +9 -0
  415. data/test/fixtures/test.blog/themes/default/templates/tag_archive.rhtml +41 -0
  416. data/test/helpers.rb +25 -0
  417. data/test/unit/bloggit_test.rb +9 -0
  418. data/test/unit/page_test.rb +28 -0
  419. data/test/unit/post_test.rb +36 -0
  420. data/test/unit/site_test.rb +27 -0
  421. data/test/unit/template_test.rb +21 -0
  422. data/test/unit/text_formatter_test.rb +43 -0
  423. metadata +520 -0
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Ext JS Library 1.0.1
3
+ * Copyright(c) 2006-2007, Ext JS, LLC.
4
+ * licensing@extjs.com
5
+ *
6
+ * http://www.extjs.com/license
7
+ */
8
+
9
+ Ext={};window["undefined"]=window["undefined"];Ext.apply=function(o,c,_3){if(_3){Ext.apply(o,_3);}if(o&&c&&typeof c=="object"){for(var p in c){o[p]=c[p];}}return o;};(function(){var _5=0;var ua=navigator.userAgent.toLowerCase();var _7=document.compatMode=="CSS1Compat",_8=ua.indexOf("opera")>-1,_9=(/webkit|khtml/).test(ua),_a=ua.indexOf("msie")>-1,_b=ua.indexOf("msie 7")>-1,_c=!_9&&ua.indexOf("gecko")>-1,_d=_a&&!_7,_e=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),_f=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),_10=window.location.href.toLowerCase().indexOf("https")===0;if(_a&&!_b){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}Ext.apply(Ext,{isStrict:_7,isSecure:_10,isReady:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p];}}}return o;},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o);});return;}var _15={};for(var b in o){var _17=b.split("@");if(_17[1]){var s=_17[0];if(!_15[s]){_15[s]=Ext.select(s);}_15[s].on(_17[1],o[b]);}}_15=null;},id:function(el,_1a){_1a=_1a||"ext-gen";el=Ext.getDom(el);var id=_1a+(++_5);return el?(el.id?el.id:(el.id=id)):id;},extend:function(){var io=function(o){for(var m in o){this[m]=o[m];}};return function(sb,sp,_21){if(typeof sp=="object"){_21=sp;sp=sb;sb=function(){sp.apply(this,arguments);};}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==Object.prototype.constructor){spp.constructor=sp;}sb.override=function(o){Ext.override(sb,o);};sbp.override=io;sbp.__extcls=sb;Ext.override(sb,_21);return sb;};}(),override:function(_26,_27){if(_27){var p=_26.prototype;for(var _29 in _27){p[_29]=_27[_29];}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+" == \"undefined\"){"+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}},urlEncode:function(o){if(!o){return "";}var buf=[];for(var key in o){var ov=o[key];var _34=typeof ov;if(_34=="undefined"){buf.push(encodeURIComponent(key),"=&");}else{if(_34!="function"&&_34!="object"){buf.push(encodeURIComponent(key),"=",encodeURIComponent(ov),"&");}else{if(ov instanceof Array){for(var i=0,len=ov.length;i<len;i++){buf.push(encodeURIComponent(key),"=",encodeURIComponent(ov[i]===undefined?"":ov[i]),"&");}}}}}buf.pop();return buf.join("");},urlDecode:function(_37,_38){if(!_37||!_37.length){return {};}var obj={};var _3a=_37.split("&");var _3b,_3c,_3d;for(var i=0,len=_3a.length;i<len;i++){_3b=_3a[i].split("=");_3c=decodeURIComponent(_3b[0]);_3d=decodeURIComponent(_3b[1]);if(_38!==true){if(typeof obj[_3c]=="undefined"){obj[_3c]=_3d;}else{if(typeof obj[_3c]=="string"){obj[_3c]=[obj[_3c]];obj[_3c].push(_3d);}else{obj[_3c].push(_3d);}}}else{obj[_3c]=_3d;}}return obj;},each:function(_40,fn,_42){if(typeof _40.length=="undefined"||typeof _40=="string"){_40=[_40];}for(var i=0,len=_40.length;i<len;i++){if(fn.call(_42||_40[i],_40[i],i,_40)===false){return i;}}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(a instanceof Array){r=r.concat(a);}else{if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0));}else{r.push(a);}}}return r;},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");},callback:function(cb,_4c,_4d,_4e){if(typeof cb=="function"){if(_4e){cb.defer(_4e,_4c,_4d||[]);}else{cb.apply(_4c,_4d||[]);}}},getDom:function(el){if(!el){return null;}return el.dom?el.dom:(typeof el=="string"?document.getElementById(el):el);},getCmp:function(id){return Ext.ComponentMgr.get(id);},num:function(v,_52){if(typeof v!="number"){return _52;}return v;},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;i++){var as=a[i];if(as){if(as.dom){as.removeAllListeners();as.remove();continue;}if(typeof as.purgeListeners=="function"){as.purgeListeners();}if(typeof as.destroy=="function"){as.destroy();}}}},isOpera:_8,isSafari:_9,isIE:_a,isIE7:_b,isGecko:_c,isBorderBox:_d,isWindows:_e,isMac:_f,useShims:((_a&&!_b)||(_c&&_f))});})();Ext.namespace("Ext","Ext.util","Ext.grid","Ext.dd","Ext.tree","Ext.data","Ext.form","Ext.menu","Ext.state","Ext.lib","Ext.layout");Ext.apply(Function.prototype,{createCallback:function(){var _57=arguments;var _58=this;return function(){return _58.apply(window,_57);};},createDelegate:function(obj,_5a,_5b){var _5c=this;return function(){var _5d=_5a||arguments;if(_5b===true){_5d=Array.prototype.slice.call(arguments,0);_5d=_5d.concat(_5a);}else{if(typeof _5b=="number"){_5d=Array.prototype.slice.call(arguments,0);var _5e=[_5b,0].concat(_5a);Array.prototype.splice.apply(_5d,_5e);}}return _5c.apply(obj||window,_5d);};},defer:function(_5f,obj,_61,_62){var fn=this.createDelegate(obj,_61,_62);if(_5f){return setTimeout(fn,_5f);}fn();return 0;},createSequence:function(fcn,_65){if(typeof fcn!="function"){return this;}var _66=this;return function(){var _67=_66.apply(this||window,arguments);fcn.apply(_65||this||window,arguments);return _67;};},createInterceptor:function(fcn,_69){if(typeof fcn!="function"){return this;}var _6a=this;return function(){fcn.target=this;fcn.method=_6a;if(fcn.apply(_69||this||window,arguments)===false){return;}return _6a.apply(this||window,arguments);};}});Ext.applyIf(String,{escape:function(_6b){return _6b.replace(/('|\\)/g,"\\$1");},leftPad:function(val,_6d,ch){var _6f=new String(val);if(ch==null){ch=" ";}while(_6f.length<_6d){_6f=ch+_6f;}return _6f;},format:function(_70){var _71=Array.prototype.slice.call(arguments,1);return _70.replace(/\{(\d+)\}/g,function(m,i){return _71[i];});}});String.prototype.toggle=function(_74,_75){return this==_74?_75:_74;};Ext.applyIf(Number.prototype,{constrain:function(min,max){return Math.min(Math.max(this,min),max);}});Ext.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,len=this.length;i<len;i++){if(this[i]==o){return i;}}return -1;},remove:function(o){var _7c=this.indexOf(o);if(_7c!=-1){this.splice(_7c,1);}}});Date.prototype.getElapsed=function(_7d){return Math.abs((_7d||new Date()).getTime()-this.getTime());};
10
+
11
+ (function(){var _1;Ext.lib.Dom={getViewWidth:function(_2){return _2?this.getDocumentWidth():this.getViewportWidth();},getViewHeight:function(_3){return _3?this.getDocumentHeight():this.getViewportHeight();},getDocumentHeight:function(){var _4=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(_4,this.getViewportHeight());},getDocumentWidth:function(){var _5=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(_5,this.getViewportWidth());},getViewportHeight:function(){var _6=self.innerHeight;var _7=document.compatMode;if((_7||Ext.isIE)&&!Ext.isOpera){_6=(_7=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return _6;},getViewportWidth:function(){var _8=self.innerWidth;var _9=document.compatMode;if(_9||Ext.isIE){_8=(_9=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return _8;},isAncestor:function(p,c){p=Ext.getDom(p);c=Ext.getDom(c);if(!p||!c){return false;}if(p.contains&&!Ext.isSafari){return p.contains(c);}else{if(p.compareDocumentPosition){return !!(p.compareDocumentPosition(c)&16);}else{var _c=c.parentNode;while(_c){if(_c==p){return true;}else{if(!_c.tagName||_c.tagName.toUpperCase()=="HTML"){return false;}}_c=_c.parentNode;}return false;}}},getRegion:function(el){return Ext.lib.Region.getRegion(el);},getY:function(el){return this.getXY(el)[1];},getX:function(el){return this.getXY(el)[0];},getXY:function(el){var p,pe,b,_14,bd=document.body;el=Ext.getDom(el);if(el.getBoundingClientRect){b=el.getBoundingClientRect();_14=fly(document).getScroll();return [b.left+_14.left,b.top+_14.top];}else{var x=el.offsetLeft,y=el.offsetTop;p=el.offsetParent;var _18=false;if(p!=el){while(p){x+=p.offsetLeft;y+=p.offsetTop;if(Ext.isSafari&&!_18&&fly(p).getStyle("position")=="absolute"){_18=true;}if(Ext.isGecko){pe=fly(p);var bt=parseInt(pe.getStyle("borderTopWidth"),10)||0;var bl=parseInt(pe.getStyle("borderLeftWidth"),10)||0;x+=bl;y+=bt;if(p!=el&&pe.getStyle("overflow")!="visible"){x+=bl;y+=bt;}}p=p.offsetParent;}}if(Ext.isSafari&&(_18||fly(el).getStyle("position")=="absolute")){x-=bd.offsetLeft;y-=bd.offsetTop;}}p=el.parentNode;while(p&&p!=bd){if(!Ext.isOpera||(Ext.isOpera&&p.tagName!="TR"&&fly(p).getStyle("display")!="inline")){x-=p.scrollLeft;y-=p.scrollTop;}p=p.parentNode;}return [x,y];},setXY:function(el,xy){el=Ext.fly(el,"_setXY");el.position();var pts=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=pts.left+"px";}if(xy[1]!==false){el.dom.style.top=pts.top+"px";}},setX:function(el,x){this.setXY(el,[x,false]);},setY:function(el,y){this.setXY(el,[false,y]);}};Ext.lib.Event={getPageX:function(e){return Event.pointerX(e.browserEvent||e);},getPageY:function(e){return Event.pointerY(e.browserEvent||e);},getXY:function(e){e=e.browserEvent||e;return [Event.pointerX(e),Event.pointerY(e)];},getTarget:function(e){return Event.element(e.browserEvent||e);},resolveTextNode:function(_26){if(_26&&3==_26.nodeType){return _26.parentNode;}else{return _26;}},getRelatedTarget:function(ev){ev=ev.browserEvent||ev;var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},on:function(el,_2a,fn){Event.observe(el,_2a,fn,false);},un:function(el,_2d,fn){Event.stopObserving(el,_2d,fn,false);},purgeElement:function(el){},preventDefault:function(e){e=e.browserEvent||e;if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}},stopPropagation:function(e){e=e.browserEvent||e;if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble=true;}},stopEvent:function(e){Event.stop(e.browserEvent||e);},onAvailable:function(el,fn,_35,_36){var _37=new Date(),iid;var f=function(){if(_37.getElapsed()>10000){clearInterval(iid);}var el=document.getElementById(id);if(el){clearInterval(iid);fn.call(_35||window,el);}};iid=setInterval(f,50);}};Ext.lib.Ajax=function(){var _3b=function(cb){return cb.success?function(xhr){cb.success.call(cb.scope||window,{responseText:xhr.responseText,responseXML:xhr.responseXML,argument:cb.argument});}:Ext.emptyFn;};var _3e=function(cb){return cb.failure?function(xhr){cb.failure.call(cb.scope||window,{responseText:xhr.responseText,responseXML:xhr.responseXML,argument:cb.argument});}:Ext.emptyFn;};return {request:function(_41,uri,cb,_44){new Ajax.Request(uri,{method:_41,parameters:_44||"",timeout:cb.timeout,onSuccess:_3b(cb),onFailure:_3e(cb)});},formRequest:function(_45,uri,cb,_48,_49,_4a){new Ajax.Request(uri,{method:Ext.getDom(_45).method||"POST",parameters:Form.serialize(_45)+(_48?"&"+_48:""),timeout:cb.timeout,onSuccess:_3b(cb),onFailure:_3e(cb)});},isCallInProgress:function(_4b){return false;},abort:function(_4c){return false;},serializeForm:function(_4d){return Form.serialize(_4d.dom||_4d,true);}};}();Ext.lib.Anim=function(){var _4e={easeOut:function(pos){return 1-Math.pow(1-pos,2);},easeIn:function(pos){return 1-Math.pow(1-pos,2);}};var _51=function(cb,_53){return {stop:function(_54){this.effect.cancel();},isAnimated:function(){return this.effect.state=="running";},proxyCallback:function(){Ext.callback(cb,_53);}};};return {scroll:function(el,_56,_57,_58,cb,_5a){var _5b=_51(cb,_5a);el=Ext.getDom(el);el.scrollLeft=_56.to[0];el.scrollTop=_56.to[1];_5b.proxyCallback();return _5b;},motion:function(el,_5d,_5e,_5f,cb,_61){return this.run(el,_5d,_5e,_5f,cb,_61);},color:function(el,_63,_64,_65,cb,_67){return this.run(el,_63,_64,_65,cb,_67);},run:function(el,_69,_6a,_6b,cb,_6d,_6e){var o={};for(var k in _69){switch(k){case "points":var by,pts,e=Ext.fly(el,"_animrun");e.position();if(by=_69.points.by){var xy=e.getXY();pts=e.translatePoints([xy[0]+by[0],xy[1]+by[1]]);}else{pts=e.translatePoints(_69.points.to);}o.left=pts.left+"px";o.top=pts.top+"px";break;case "width":o.width=_69.width.to+"px";break;case "height":o.height=_69.height.to+"px";break;case "opacity":o.opacity=String(_69.opacity.to);break;default:o[k]=String(_69[k].to);break;}}var _75=_51(cb,_6d);_75.effect=new Effect.Morph(Ext.id(el),{duration:_6a,afterFinish:_75.proxyCallback,transition:_4e[_6b]||Effect.Transitions.linear,style:o});return _75;}};}();function fly(el){if(!_1){_1=new Ext.Element.Flyweight();}_1.dom=el;return _1;}Ext.lib.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};Ext.lib.Region.prototype={contains:function(_7b){return (_7b.left>=this.left&&_7b.right<=this.right&&_7b.top>=this.top&&_7b.bottom<=this.bottom);},getArea:function(){return ((this.bottom-this.top)*(this.right-this.left));},intersect:function(_7c){var t=Math.max(this.top,_7c.top);var r=Math.min(this.right,_7c.right);var b=Math.min(this.bottom,_7c.bottom);var l=Math.max(this.left,_7c.left);if(b>=t&&r>=l){return new Ext.lib.Region(t,r,b,l);}else{return null;}},union:function(_81){var t=Math.min(this.top,_81.top);var r=Math.max(this.right,_81.right);var b=Math.max(this.bottom,_81.bottom);var l=Math.min(this.left,_81.left);return new Ext.lib.Region(t,r,b,l);},adjust:function(t,l,b,r){this.top+=t;this.left+=l;this.right+=r;this.bottom+=b;return this;}};Ext.lib.Region.getRegion=function(el){var p=Ext.lib.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new Ext.lib.Region(t,r,b,l);};Ext.lib.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};Ext.lib.Point.prototype=new Ext.lib.Region();if(Ext.isIE){Event.observe(window,"unload",function(){var p=Function.prototype;delete p.createSequence;delete p.defer;delete p.createDelegate;delete p.createCallback;delete p.createInterceptor;});}})();
12
+
@@ -0,0 +1,2523 @@
1
+ /*
2
+ * Ext JS Library 1.0 Beta 1
3
+ * Copyright(c) 2006-2007, Ext JS, LLC.
4
+ * licensing@extjs.com
5
+ *
6
+ * http://www.extjs.com/license
7
+ */
8
+
9
+ /* Prototype JavaScript framework, version 1.5.0
10
+ * (c) 2005-2007 Sam Stephenson
11
+ *
12
+ * Prototype is freely distributable under the terms of an MIT-style license.
13
+ * For details, see the Prototype web site: http://prototype.conio.net/
14
+ *
15
+ /*--------------------------------------------------------------------------*/
16
+
17
+ var Prototype = {
18
+ Version: '1.5.0',
19
+ BrowserFeatures: {
20
+ XPath: !!document.evaluate
21
+ },
22
+
23
+ ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
24
+ emptyFunction: function() {},
25
+ K: function(x) { return x }
26
+ }
27
+
28
+ var Class = {
29
+ create: function() {
30
+ return function() {
31
+ this.initialize.apply(this, arguments);
32
+ }
33
+ }
34
+ }
35
+
36
+ var Abstract = new Object();
37
+
38
+ Object.extend = function(destination, source) {
39
+ for (var property in source) {
40
+ destination[property] = source[property];
41
+ }
42
+ return destination;
43
+ }
44
+
45
+ Object.extend(Object, {
46
+ inspect: function(object) {
47
+ try {
48
+ if (object === undefined) return 'undefined';
49
+ if (object === null) return 'null';
50
+ return object.inspect ? object.inspect() : object.toString();
51
+ } catch (e) {
52
+ if (e instanceof RangeError) return '...';
53
+ throw e;
54
+ }
55
+ },
56
+
57
+ keys: function(object) {
58
+ var keys = [];
59
+ for (var property in object)
60
+ keys.push(property);
61
+ return keys;
62
+ },
63
+
64
+ values: function(object) {
65
+ var values = [];
66
+ for (var property in object)
67
+ values.push(object[property]);
68
+ return values;
69
+ },
70
+
71
+ clone: function(object) {
72
+ return Object.extend({}, object);
73
+ }
74
+ });
75
+
76
+ Function.prototype.bind = function() {
77
+ var __method = this, args = $A(arguments), object = args.shift();
78
+ return function() {
79
+ return __method.apply(object, args.concat($A(arguments)));
80
+ }
81
+ }
82
+
83
+ Function.prototype.bindAsEventListener = function(object) {
84
+ var __method = this, args = $A(arguments), object = args.shift();
85
+ return function(event) {
86
+ return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
87
+ }
88
+ }
89
+
90
+ Object.extend(Number.prototype, {
91
+ toColorPart: function() {
92
+ var digits = this.toString(16);
93
+ if (this < 16) return '0' + digits;
94
+ return digits;
95
+ },
96
+
97
+ succ: function() {
98
+ return this + 1;
99
+ },
100
+
101
+ times: function(iterator) {
102
+ $R(0, this, true).each(iterator);
103
+ return this;
104
+ }
105
+ });
106
+
107
+ var Try = {
108
+ these: function() {
109
+ var returnValue;
110
+
111
+ for (var i = 0, length = arguments.length; i < length; i++) {
112
+ var lambda = arguments[i];
113
+ try {
114
+ returnValue = lambda();
115
+ break;
116
+ } catch (e) {}
117
+ }
118
+
119
+ return returnValue;
120
+ }
121
+ }
122
+
123
+ /*--------------------------------------------------------------------------*/
124
+
125
+ var PeriodicalExecuter = Class.create();
126
+ PeriodicalExecuter.prototype = {
127
+ initialize: function(callback, frequency) {
128
+ this.callback = callback;
129
+ this.frequency = frequency;
130
+ this.currentlyExecuting = false;
131
+
132
+ this.registerCallback();
133
+ },
134
+
135
+ registerCallback: function() {
136
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
137
+ },
138
+
139
+ stop: function() {
140
+ if (!this.timer) return;
141
+ clearInterval(this.timer);
142
+ this.timer = null;
143
+ },
144
+
145
+ onTimerEvent: function() {
146
+ if (!this.currentlyExecuting) {
147
+ try {
148
+ this.currentlyExecuting = true;
149
+ this.callback(this);
150
+ } finally {
151
+ this.currentlyExecuting = false;
152
+ }
153
+ }
154
+ }
155
+ }
156
+ String.interpret = function(value){
157
+ return value == null ? '' : String(value);
158
+ }
159
+
160
+ Object.extend(String.prototype, {
161
+ gsub: function(pattern, replacement) {
162
+ var result = '', source = this, match;
163
+ replacement = arguments.callee.prepareReplacement(replacement);
164
+
165
+ while (source.length > 0) {
166
+ if (match = source.match(pattern)) {
167
+ result += source.slice(0, match.index);
168
+ result += String.interpret(replacement(match));
169
+ source = source.slice(match.index + match[0].length);
170
+ } else {
171
+ result += source, source = '';
172
+ }
173
+ }
174
+ return result;
175
+ },
176
+
177
+ sub: function(pattern, replacement, count) {
178
+ replacement = this.gsub.prepareReplacement(replacement);
179
+ count = count === undefined ? 1 : count;
180
+
181
+ return this.gsub(pattern, function(match) {
182
+ if (--count < 0) return match[0];
183
+ return replacement(match);
184
+ });
185
+ },
186
+
187
+ scan: function(pattern, iterator) {
188
+ this.gsub(pattern, iterator);
189
+ return this;
190
+ },
191
+
192
+ truncate: function(length, truncation) {
193
+ length = length || 30;
194
+ truncation = truncation === undefined ? '...' : truncation;
195
+ return this.length > length ?
196
+ this.slice(0, length - truncation.length) + truncation : this;
197
+ },
198
+
199
+ strip: function() {
200
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
201
+ },
202
+
203
+ stripTags: function() {
204
+ return this.replace(/<\/?[^>]+>/gi, '');
205
+ },
206
+
207
+ stripScripts: function() {
208
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
209
+ },
210
+
211
+ extractScripts: function() {
212
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
213
+ var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
214
+ return (this.match(matchAll) || []).map(function(scriptTag) {
215
+ return (scriptTag.match(matchOne) || ['', ''])[1];
216
+ });
217
+ },
218
+
219
+ evalScripts: function() {
220
+ return this.extractScripts().map(function(script) { return eval(script) });
221
+ },
222
+
223
+ escapeHTML: function() {
224
+ var div = document.createElement('div');
225
+ var text = document.createTextNode(this);
226
+ div.appendChild(text);
227
+ return div.innerHTML;
228
+ },
229
+
230
+ unescapeHTML: function() {
231
+ var div = document.createElement('div');
232
+ div.innerHTML = this.stripTags();
233
+ return div.childNodes[0] ? (div.childNodes.length > 1 ?
234
+ $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
235
+ div.childNodes[0].nodeValue) : '';
236
+ },
237
+
238
+ toQueryParams: function(separator) {
239
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
240
+ if (!match) return {};
241
+
242
+ return match[1].split(separator || '&').inject({}, function(hash, pair) {
243
+ if ((pair = pair.split('='))[0]) {
244
+ var name = decodeURIComponent(pair[0]);
245
+ var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;
246
+
247
+ if (hash[name] !== undefined) {
248
+ if (hash[name].constructor != Array)
249
+ hash[name] = [hash[name]];
250
+ if (value) hash[name].push(value);
251
+ }
252
+ else hash[name] = value;
253
+ }
254
+ return hash;
255
+ });
256
+ },
257
+
258
+ toArray: function() {
259
+ return this.split('');
260
+ },
261
+
262
+ succ: function() {
263
+ return this.slice(0, this.length - 1) +
264
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
265
+ },
266
+
267
+ camelize: function() {
268
+ var parts = this.split('-'), len = parts.length;
269
+ if (len == 1) return parts[0];
270
+
271
+ var camelized = this.charAt(0) == '-'
272
+ ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
273
+ : parts[0];
274
+
275
+ for (var i = 1; i < len; i++)
276
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
277
+
278
+ return camelized;
279
+ },
280
+
281
+ capitalize: function(){
282
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
283
+ },
284
+
285
+ underscore: function() {
286
+ return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
287
+ },
288
+
289
+ dasherize: function() {
290
+ return this.gsub(/_/,'-');
291
+ },
292
+
293
+ inspect: function(useDoubleQuotes) {
294
+ var escapedString = this.replace(/\\/g, '\\\\');
295
+ if (useDoubleQuotes)
296
+ return '"' + escapedString.replace(/"/g, '\\"') + '"';
297
+ else
298
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
299
+ }
300
+ });
301
+
302
+ String.prototype.gsub.prepareReplacement = function(replacement) {
303
+ if (typeof replacement == 'function') return replacement;
304
+ var template = new Template(replacement);
305
+ return function(match) { return template.evaluate(match) };
306
+ }
307
+
308
+ String.prototype.parseQuery = String.prototype.toQueryParams;
309
+
310
+ var Template = Class.create();
311
+ Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
312
+ Template.prototype = {
313
+ initialize: function(template, pattern) {
314
+ this.template = template.toString();
315
+ this.pattern = pattern || Template.Pattern;
316
+ },
317
+
318
+ evaluate: function(object) {
319
+ return this.template.gsub(this.pattern, function(match) {
320
+ var before = match[1];
321
+ if (before == '\\') return match[2];
322
+ return before + String.interpret(object[match[3]]);
323
+ });
324
+ }
325
+ }
326
+
327
+ var $break = new Object();
328
+ var $continue = new Object();
329
+
330
+ var Enumerable = {
331
+ each: function(iterator) {
332
+ var index = 0;
333
+ try {
334
+ this._each(function(value) {
335
+ try {
336
+ iterator(value, index++);
337
+ } catch (e) {
338
+ if (e != $continue) throw e;
339
+ }
340
+ });
341
+ } catch (e) {
342
+ if (e != $break) throw e;
343
+ }
344
+ return this;
345
+ },
346
+
347
+ eachSlice: function(number, iterator) {
348
+ var index = -number, slices = [], array = this.toArray();
349
+ while ((index += number) < array.length)
350
+ slices.push(array.slice(index, index+number));
351
+ return slices.map(iterator);
352
+ },
353
+
354
+ all: function(iterator) {
355
+ var result = true;
356
+ this.each(function(value, index) {
357
+ result = result && !!(iterator || Prototype.K)(value, index);
358
+ if (!result) throw $break;
359
+ });
360
+ return result;
361
+ },
362
+
363
+ any: function(iterator) {
364
+ var result = false;
365
+ this.each(function(value, index) {
366
+ if (result = !!(iterator || Prototype.K)(value, index))
367
+ throw $break;
368
+ });
369
+ return result;
370
+ },
371
+
372
+ collect: function(iterator) {
373
+ var results = [];
374
+ this.each(function(value, index) {
375
+ results.push((iterator || Prototype.K)(value, index));
376
+ });
377
+ return results;
378
+ },
379
+
380
+ detect: function(iterator) {
381
+ var result;
382
+ this.each(function(value, index) {
383
+ if (iterator(value, index)) {
384
+ result = value;
385
+ throw $break;
386
+ }
387
+ });
388
+ return result;
389
+ },
390
+
391
+ findAll: function(iterator) {
392
+ var results = [];
393
+ this.each(function(value, index) {
394
+ if (iterator(value, index))
395
+ results.push(value);
396
+ });
397
+ return results;
398
+ },
399
+
400
+ grep: function(pattern, iterator) {
401
+ var results = [];
402
+ this.each(function(value, index) {
403
+ var stringValue = value.toString();
404
+ if (stringValue.match(pattern))
405
+ results.push((iterator || Prototype.K)(value, index));
406
+ })
407
+ return results;
408
+ },
409
+
410
+ include: function(object) {
411
+ var found = false;
412
+ this.each(function(value) {
413
+ if (value == object) {
414
+ found = true;
415
+ throw $break;
416
+ }
417
+ });
418
+ return found;
419
+ },
420
+
421
+ inGroupsOf: function(number, fillWith) {
422
+ fillWith = fillWith === undefined ? null : fillWith;
423
+ return this.eachSlice(number, function(slice) {
424
+ while(slice.length < number) slice.push(fillWith);
425
+ return slice;
426
+ });
427
+ },
428
+
429
+ inject: function(memo, iterator) {
430
+ this.each(function(value, index) {
431
+ memo = iterator(memo, value, index);
432
+ });
433
+ return memo;
434
+ },
435
+
436
+ invoke: function(method) {
437
+ var args = $A(arguments).slice(1);
438
+ return this.map(function(value) {
439
+ return value[method].apply(value, args);
440
+ });
441
+ },
442
+
443
+ max: function(iterator) {
444
+ var result;
445
+ this.each(function(value, index) {
446
+ value = (iterator || Prototype.K)(value, index);
447
+ if (result == undefined || value >= result)
448
+ result = value;
449
+ });
450
+ return result;
451
+ },
452
+
453
+ min: function(iterator) {
454
+ var result;
455
+ this.each(function(value, index) {
456
+ value = (iterator || Prototype.K)(value, index);
457
+ if (result == undefined || value < result)
458
+ result = value;
459
+ });
460
+ return result;
461
+ },
462
+
463
+ partition: function(iterator) {
464
+ var trues = [], falses = [];
465
+ this.each(function(value, index) {
466
+ ((iterator || Prototype.K)(value, index) ?
467
+ trues : falses).push(value);
468
+ });
469
+ return [trues, falses];
470
+ },
471
+
472
+ pluck: function(property) {
473
+ var results = [];
474
+ this.each(function(value, index) {
475
+ results.push(value[property]);
476
+ });
477
+ return results;
478
+ },
479
+
480
+ reject: function(iterator) {
481
+ var results = [];
482
+ this.each(function(value, index) {
483
+ if (!iterator(value, index))
484
+ results.push(value);
485
+ });
486
+ return results;
487
+ },
488
+
489
+ sortBy: function(iterator) {
490
+ return this.map(function(value, index) {
491
+ return {value: value, criteria: iterator(value, index)};
492
+ }).sort(function(left, right) {
493
+ var a = left.criteria, b = right.criteria;
494
+ return a < b ? -1 : a > b ? 1 : 0;
495
+ }).pluck('value');
496
+ },
497
+
498
+ toArray: function() {
499
+ return this.map();
500
+ },
501
+
502
+ zip: function() {
503
+ var iterator = Prototype.K, args = $A(arguments);
504
+ if (typeof args.last() == 'function')
505
+ iterator = args.pop();
506
+
507
+ var collections = [this].concat(args).map($A);
508
+ return this.map(function(value, index) {
509
+ return iterator(collections.pluck(index));
510
+ });
511
+ },
512
+
513
+ size: function() {
514
+ return this.toArray().length;
515
+ },
516
+
517
+ inspect: function() {
518
+ return '#<Enumerable:' + this.toArray().inspect() + '>';
519
+ }
520
+ }
521
+
522
+ Object.extend(Enumerable, {
523
+ map: Enumerable.collect,
524
+ find: Enumerable.detect,
525
+ select: Enumerable.findAll,
526
+ member: Enumerable.include,
527
+ entries: Enumerable.toArray
528
+ });
529
+ var $A = Array.from = function(iterable) {
530
+ if (!iterable) return [];
531
+ if (iterable.toArray) {
532
+ return iterable.toArray();
533
+ } else {
534
+ var results = [];
535
+ for (var i = 0, length = iterable.length; i < length; i++)
536
+ results.push(iterable[i]);
537
+ return results;
538
+ }
539
+ }
540
+
541
+ Object.extend(Array.prototype, Enumerable);
542
+
543
+ if (!Array.prototype._reverse)
544
+ Array.prototype._reverse = Array.prototype.reverse;
545
+
546
+ Object.extend(Array.prototype, {
547
+ _each: function(iterator) {
548
+ for (var i = 0, length = this.length; i < length; i++)
549
+ iterator(this[i]);
550
+ },
551
+
552
+ clear: function() {
553
+ this.length = 0;
554
+ return this;
555
+ },
556
+
557
+ first: function() {
558
+ return this[0];
559
+ },
560
+
561
+ last: function() {
562
+ return this[this.length - 1];
563
+ },
564
+
565
+ compact: function() {
566
+ return this.select(function(value) {
567
+ return value != null;
568
+ });
569
+ },
570
+
571
+ flatten: function() {
572
+ return this.inject([], function(array, value) {
573
+ return array.concat(value && value.constructor == Array ?
574
+ value.flatten() : [value]);
575
+ });
576
+ },
577
+
578
+ without: function() {
579
+ var values = $A(arguments);
580
+ return this.select(function(value) {
581
+ return !values.include(value);
582
+ });
583
+ },
584
+
585
+ indexOf: function(object) {
586
+ for (var i = 0, length = this.length; i < length; i++)
587
+ if (this[i] == object) return i;
588
+ return -1;
589
+ },
590
+
591
+ reverse: function(inline) {
592
+ return (inline !== false ? this : this.toArray())._reverse();
593
+ },
594
+
595
+ reduce: function() {
596
+ return this.length > 1 ? this : this[0];
597
+ },
598
+
599
+ uniq: function() {
600
+ return this.inject([], function(array, value) {
601
+ return array.include(value) ? array : array.concat([value]);
602
+ });
603
+ },
604
+
605
+ clone: function() {
606
+ return [].concat(this);
607
+ },
608
+
609
+ size: function() {
610
+ return this.length;
611
+ },
612
+
613
+ inspect: function() {
614
+ return '[' + this.map(Object.inspect).join(', ') + ']';
615
+ }
616
+ });
617
+
618
+ Array.prototype.toArray = Array.prototype.clone;
619
+
620
+ function $w(string){
621
+ string = string.strip();
622
+ return string ? string.split(/\s+/) : [];
623
+ }
624
+
625
+ if(window.opera){
626
+ Array.prototype.concat = function(){
627
+ var array = [];
628
+ for(var i = 0, length = this.length; i < length; i++) array.push(this[i]);
629
+ for(var i = 0, length = arguments.length; i < length; i++) {
630
+ if(arguments[i].constructor == Array) {
631
+ for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
632
+ array.push(arguments[i][j]);
633
+ } else {
634
+ array.push(arguments[i]);
635
+ }
636
+ }
637
+ return array;
638
+ }
639
+ }
640
+ var Hash = function(obj) {
641
+ Object.extend(this, obj || {});
642
+ };
643
+
644
+ Object.extend(Hash, {
645
+ toQueryString: function(obj) {
646
+ var parts = [];
647
+
648
+ this.prototype._each.call(obj, function(pair) {
649
+ if (!pair.key) return;
650
+
651
+ if (pair.value && pair.value.constructor == Array) {
652
+ var values = pair.value.compact();
653
+ if (values.length < 2) pair.value = values.reduce();
654
+ else {
655
+ key = encodeURIComponent(pair.key);
656
+ values.each(function(value) {
657
+ value = value != undefined ? encodeURIComponent(value) : '';
658
+ parts.push(key + '=' + encodeURIComponent(value));
659
+ });
660
+ return;
661
+ }
662
+ }
663
+ if (pair.value == undefined) pair[1] = '';
664
+ parts.push(pair.map(encodeURIComponent).join('='));
665
+ });
666
+
667
+ return parts.join('&');
668
+ }
669
+ });
670
+
671
+ Object.extend(Hash.prototype, Enumerable);
672
+ Object.extend(Hash.prototype, {
673
+ _each: function(iterator) {
674
+ for (var key in this) {
675
+ var value = this[key];
676
+ if (value && value == Hash.prototype[key]) continue;
677
+
678
+ var pair = [key, value];
679
+ pair.key = key;
680
+ pair.value = value;
681
+ iterator(pair);
682
+ }
683
+ },
684
+
685
+ keys: function() {
686
+ return this.pluck('key');
687
+ },
688
+
689
+ values: function() {
690
+ return this.pluck('value');
691
+ },
692
+
693
+ merge: function(hash) {
694
+ return $H(hash).inject(this, function(mergedHash, pair) {
695
+ mergedHash[pair.key] = pair.value;
696
+ return mergedHash;
697
+ });
698
+ },
699
+
700
+ remove: function() {
701
+ var result;
702
+ for(var i = 0, length = arguments.length; i < length; i++) {
703
+ var value = this[arguments[i]];
704
+ if (value !== undefined){
705
+ if (result === undefined) result = value;
706
+ else {
707
+ if (result.constructor != Array) result = [result];
708
+ result.push(value)
709
+ }
710
+ }
711
+ delete this[arguments[i]];
712
+ }
713
+ return result;
714
+ },
715
+
716
+ toQueryString: function() {
717
+ return Hash.toQueryString(this);
718
+ },
719
+
720
+ inspect: function() {
721
+ return '#<Hash:{' + this.map(function(pair) {
722
+ return pair.map(Object.inspect).join(': ');
723
+ }).join(', ') + '}>';
724
+ }
725
+ });
726
+
727
+ function $H(object) {
728
+ if (object && object.constructor == Hash) return object;
729
+ return new Hash(object);
730
+ };
731
+ ObjectRange = Class.create();
732
+ Object.extend(ObjectRange.prototype, Enumerable);
733
+ Object.extend(ObjectRange.prototype, {
734
+ initialize: function(start, end, exclusive) {
735
+ this.start = start;
736
+ this.end = end;
737
+ this.exclusive = exclusive;
738
+ },
739
+
740
+ _each: function(iterator) {
741
+ var value = this.start;
742
+ while (this.include(value)) {
743
+ iterator(value);
744
+ value = value.succ();
745
+ }
746
+ },
747
+
748
+ include: function(value) {
749
+ if (value < this.start)
750
+ return false;
751
+ if (this.exclusive)
752
+ return value < this.end;
753
+ return value <= this.end;
754
+ }
755
+ });
756
+
757
+ var $R = function(start, end, exclusive) {
758
+ return new ObjectRange(start, end, exclusive);
759
+ }
760
+
761
+ var Ajax = {
762
+ getTransport: function() {
763
+ return Try.these(
764
+ function() {return new XMLHttpRequest()},
765
+ function() {return new ActiveXObject('Msxml2.XMLHTTP')},
766
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')}
767
+ ) || false;
768
+ },
769
+
770
+ activeRequestCount: 0
771
+ }
772
+
773
+ Ajax.Responders = {
774
+ responders: [],
775
+
776
+ _each: function(iterator) {
777
+ this.responders._each(iterator);
778
+ },
779
+
780
+ register: function(responder) {
781
+ if (!this.include(responder))
782
+ this.responders.push(responder);
783
+ },
784
+
785
+ unregister: function(responder) {
786
+ this.responders = this.responders.without(responder);
787
+ },
788
+
789
+ dispatch: function(callback, request, transport, json) {
790
+ this.each(function(responder) {
791
+ if (typeof responder[callback] == 'function') {
792
+ try {
793
+ responder[callback].apply(responder, [request, transport, json]);
794
+ } catch (e) {}
795
+ }
796
+ });
797
+ }
798
+ };
799
+
800
+ Object.extend(Ajax.Responders, Enumerable);
801
+
802
+ Ajax.Responders.register({
803
+ onCreate: function() {
804
+ Ajax.activeRequestCount++;
805
+ },
806
+ onComplete: function() {
807
+ Ajax.activeRequestCount--;
808
+ }
809
+ });
810
+
811
+ Ajax.Base = function() {};
812
+ Ajax.Base.prototype = {
813
+ setOptions: function(options) {
814
+ this.options = {
815
+ method: 'post',
816
+ asynchronous: true,
817
+ contentType: 'application/x-www-form-urlencoded',
818
+ encoding: 'UTF-8',
819
+ parameters: ''
820
+ }
821
+ Object.extend(this.options, options || {});
822
+
823
+ this.options.method = this.options.method.toLowerCase();
824
+ if (typeof this.options.parameters == 'string')
825
+ this.options.parameters = this.options.parameters.toQueryParams();
826
+ }
827
+ }
828
+
829
+ Ajax.Request = Class.create();
830
+ Ajax.Request.Events =
831
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
832
+
833
+ Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
834
+ _complete: false,
835
+
836
+ initialize: function(url, options) {
837
+ this.transport = Ajax.getTransport();
838
+ this.setOptions(options);
839
+ this.request(url);
840
+ },
841
+
842
+ request: function(url) {
843
+ this.url = url;
844
+ this.method = this.options.method;
845
+ var params = this.options.parameters;
846
+
847
+ if (!['get', 'post'].include(this.method)) {
848
+ // simulate other verbs over post
849
+ params['_method'] = this.method;
850
+ this.method = 'post';
851
+ }
852
+
853
+ params = Hash.toQueryString(params);
854
+ if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='
855
+
856
+ // when GET, append parameters to URL
857
+ if (this.method == 'get' && params)
858
+ this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params;
859
+
860
+ try {
861
+ Ajax.Responders.dispatch('onCreate', this, this.transport);
862
+
863
+ this.transport.open(this.method.toUpperCase(), this.url,
864
+ this.options.asynchronous);
865
+
866
+ if (this.options.asynchronous)
867
+ setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
868
+
869
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
870
+ this.setRequestHeaders();
871
+
872
+ var body = this.method == 'post' ? (this.options.postBody || params) : null;
873
+
874
+ this.transport.send(body);
875
+
876
+ /* Force Firefox to handle ready state 4 for synchronous requests */
877
+ if (!this.options.asynchronous && this.transport.overrideMimeType)
878
+ this.onStateChange();
879
+
880
+ }
881
+ catch (e) {
882
+ this.dispatchException(e);
883
+ }
884
+ },
885
+
886
+ onStateChange: function() {
887
+ var readyState = this.transport.readyState;
888
+ if (readyState > 1 && !((readyState == 4) && this._complete))
889
+ this.respondToReadyState(this.transport.readyState);
890
+ },
891
+
892
+ setRequestHeaders: function() {
893
+ var headers = {
894
+ 'X-Requested-With': 'XMLHttpRequest',
895
+ 'X-Prototype-Version': Prototype.Version,
896
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
897
+ };
898
+
899
+ if (this.method == 'post') {
900
+ headers['Content-type'] = this.options.contentType +
901
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
902
+
903
+ /* Force "Connection: close" for older Mozilla browsers to work
904
+ * around a bug where XMLHttpRequest sends an incorrect
905
+ * Content-length header. See Mozilla Bugzilla #246651.
906
+ */
907
+ if (this.transport.overrideMimeType &&
908
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
909
+ headers['Connection'] = 'close';
910
+ }
911
+
912
+ // user-defined headers
913
+ if (typeof this.options.requestHeaders == 'object') {
914
+ var extras = this.options.requestHeaders;
915
+
916
+ if (typeof extras.push == 'function')
917
+ for (var i = 0, length = extras.length; i < length; i += 2)
918
+ headers[extras[i]] = extras[i+1];
919
+ else
920
+ $H(extras).each(function(pair) { headers[pair.key] = pair.value });
921
+ }
922
+
923
+ for (var name in headers)
924
+ this.transport.setRequestHeader(name, headers[name]);
925
+ },
926
+
927
+ success: function() {
928
+ return !this.transport.status
929
+ || (this.transport.status >= 200 && this.transport.status < 300);
930
+ },
931
+
932
+ respondToReadyState: function(readyState) {
933
+ var state = Ajax.Request.Events[readyState];
934
+ var transport = this.transport, json = this.evalJSON();
935
+
936
+ if (state == 'Complete') {
937
+ try {
938
+ this._complete = true;
939
+ (this.options['on' + this.transport.status]
940
+ || this.options['on' + (this.success() ? 'Success' : 'Failure')]
941
+ || Prototype.emptyFunction)(transport, json);
942
+ } catch (e) {
943
+ this.dispatchException(e);
944
+ }
945
+
946
+ if ((this.getHeader('Content-type') || 'text/javascript').strip().
947
+ match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
948
+ this.evalResponse();
949
+ }
950
+
951
+ try {
952
+ (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
953
+ Ajax.Responders.dispatch('on' + state, this, transport, json);
954
+ } catch (e) {
955
+ this.dispatchException(e);
956
+ }
957
+
958
+ if (state == 'Complete') {
959
+ // avoid memory leak in MSIE: clean up
960
+ this.transport.onreadystatechange = Prototype.emptyFunction;
961
+ }
962
+ },
963
+
964
+ getHeader: function(name) {
965
+ try {
966
+ return this.transport.getResponseHeader(name);
967
+ } catch (e) { return null }
968
+ },
969
+
970
+ evalJSON: function() {
971
+ try {
972
+ var json = this.getHeader('X-JSON');
973
+ return json ? eval('(' + json + ')') : null;
974
+ } catch (e) { return null }
975
+ },
976
+
977
+ evalResponse: function() {
978
+ try {
979
+ return eval(this.transport.responseText);
980
+ } catch (e) {
981
+ this.dispatchException(e);
982
+ }
983
+ },
984
+
985
+ dispatchException: function(exception) {
986
+ (this.options.onException || Prototype.emptyFunction)(this, exception);
987
+ Ajax.Responders.dispatch('onException', this, exception);
988
+ }
989
+ });
990
+
991
+ Ajax.Updater = Class.create();
992
+
993
+ Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
994
+ initialize: function(container, url, options) {
995
+ this.container = {
996
+ success: (container.success || container),
997
+ failure: (container.failure || (container.success ? null : container))
998
+ }
999
+
1000
+ this.transport = Ajax.getTransport();
1001
+ this.setOptions(options);
1002
+
1003
+ var onComplete = this.options.onComplete || Prototype.emptyFunction;
1004
+ this.options.onComplete = (function(transport, param) {
1005
+ this.updateContent();
1006
+ onComplete(transport, param);
1007
+ }).bind(this);
1008
+
1009
+ this.request(url);
1010
+ },
1011
+
1012
+ updateContent: function() {
1013
+ var receiver = this.container[this.success() ? 'success' : 'failure'];
1014
+ var response = this.transport.responseText;
1015
+
1016
+ if (!this.options.evalScripts) response = response.stripScripts();
1017
+
1018
+ if (receiver = $(receiver)) {
1019
+ if (this.options.insertion)
1020
+ new this.options.insertion(receiver, response);
1021
+ else
1022
+ receiver.update(response);
1023
+ }
1024
+
1025
+ if (this.success()) {
1026
+ if (this.onComplete)
1027
+ setTimeout(this.onComplete.bind(this), 10);
1028
+ }
1029
+ }
1030
+ });
1031
+
1032
+ Ajax.PeriodicalUpdater = Class.create();
1033
+ Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
1034
+ initialize: function(container, url, options) {
1035
+ this.setOptions(options);
1036
+ this.onComplete = this.options.onComplete;
1037
+
1038
+ this.frequency = (this.options.frequency || 2);
1039
+ this.decay = (this.options.decay || 1);
1040
+
1041
+ this.updater = {};
1042
+ this.container = container;
1043
+ this.url = url;
1044
+
1045
+ this.start();
1046
+ },
1047
+
1048
+ start: function() {
1049
+ this.options.onComplete = this.updateComplete.bind(this);
1050
+ this.onTimerEvent();
1051
+ },
1052
+
1053
+ stop: function() {
1054
+ this.updater.options.onComplete = undefined;
1055
+ clearTimeout(this.timer);
1056
+ (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
1057
+ },
1058
+
1059
+ updateComplete: function(request) {
1060
+ if (this.options.decay) {
1061
+ this.decay = (request.responseText == this.lastText ?
1062
+ this.decay * this.options.decay : 1);
1063
+
1064
+ this.lastText = request.responseText;
1065
+ }
1066
+ this.timer = setTimeout(this.onTimerEvent.bind(this),
1067
+ this.decay * this.frequency * 1000);
1068
+ },
1069
+
1070
+ onTimerEvent: function() {
1071
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
1072
+ }
1073
+ });
1074
+ function $(element) {
1075
+ if (arguments.length > 1) {
1076
+ for (var i = 0, elements = [], length = arguments.length; i < length; i++)
1077
+ elements.push($(arguments[i]));
1078
+ return elements;
1079
+ }
1080
+ if (typeof element == 'string')
1081
+ element = document.getElementById(element);
1082
+ return Element.extend(element);
1083
+ }
1084
+
1085
+ if (Prototype.BrowserFeatures.XPath) {
1086
+ document._getElementsByXPath = function(expression, parentElement) {
1087
+ var results = [];
1088
+ var query = document.evaluate(expression, $(parentElement) || document,
1089
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
1090
+ for (var i = 0, length = query.snapshotLength; i < length; i++)
1091
+ results.push(query.snapshotItem(i));
1092
+ return results;
1093
+ };
1094
+ }
1095
+
1096
+ document.getElementsByClassName = function(className, parentElement) {
1097
+ if (Prototype.BrowserFeatures.XPath) {
1098
+ var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
1099
+ return document._getElementsByXPath(q, parentElement);
1100
+ } else {
1101
+ var children = ($(parentElement) || document.body).getElementsByTagName('*');
1102
+ var elements = [], child;
1103
+ for (var i = 0, length = children.length; i < length; i++) {
1104
+ child = children[i];
1105
+ if (Element.hasClassName(child, className))
1106
+ elements.push(Element.extend(child));
1107
+ }
1108
+ return elements;
1109
+ }
1110
+ };
1111
+
1112
+ /*--------------------------------------------------------------------------*/
1113
+
1114
+ if (!window.Element)
1115
+ var Element = new Object();
1116
+
1117
+ Element.extend = function(element) {
1118
+ if (!element || _nativeExtensions || element.nodeType == 3) return element;
1119
+
1120
+ if (!element._extended && element.tagName && element != window) {
1121
+ var methods = Object.clone(Element.Methods), cache = Element.extend.cache;
1122
+
1123
+ if (element.tagName == 'FORM')
1124
+ Object.extend(methods, Form.Methods);
1125
+ if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName))
1126
+ Object.extend(methods, Form.Element.Methods);
1127
+
1128
+ Object.extend(methods, Element.Methods.Simulated);
1129
+
1130
+ for (var property in methods) {
1131
+ var value = methods[property];
1132
+ if (typeof value == 'function' && !(property in element))
1133
+ element[property] = cache.findOrStore(value);
1134
+ }
1135
+ }
1136
+
1137
+ element._extended = true;
1138
+ return element;
1139
+ };
1140
+
1141
+ Element.extend.cache = {
1142
+ findOrStore: function(value) {
1143
+ return this[value] = this[value] || function() {
1144
+ return value.apply(null, [this].concat($A(arguments)));
1145
+ }
1146
+ }
1147
+ };
1148
+
1149
+ Element.Methods = {
1150
+ visible: function(element) {
1151
+ return $(element).style.display != 'none';
1152
+ },
1153
+
1154
+ toggle: function(element) {
1155
+ element = $(element);
1156
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
1157
+ return element;
1158
+ },
1159
+
1160
+ hide: function(element) {
1161
+ $(element).style.display = 'none';
1162
+ return element;
1163
+ },
1164
+
1165
+ show: function(element) {
1166
+ $(element).style.display = '';
1167
+ return element;
1168
+ },
1169
+
1170
+ remove: function(element) {
1171
+ element = $(element);
1172
+ element.parentNode.removeChild(element);
1173
+ return element;
1174
+ },
1175
+
1176
+ update: function(element, html) {
1177
+ html = typeof html == 'undefined' ? '' : html.toString();
1178
+ $(element).innerHTML = html.stripScripts();
1179
+ setTimeout(function() {html.evalScripts()}, 10);
1180
+ return element;
1181
+ },
1182
+
1183
+ replace: function(element, html) {
1184
+ element = $(element);
1185
+ html = typeof html == 'undefined' ? '' : html.toString();
1186
+ if (element.outerHTML) {
1187
+ element.outerHTML = html.stripScripts();
1188
+ } else {
1189
+ var range = element.ownerDocument.createRange();
1190
+ range.selectNodeContents(element);
1191
+ element.parentNode.replaceChild(
1192
+ range.createContextualFragment(html.stripScripts()), element);
1193
+ }
1194
+ setTimeout(function() {html.evalScripts()}, 10);
1195
+ return element;
1196
+ },
1197
+
1198
+ inspect: function(element) {
1199
+ element = $(element);
1200
+ var result = '<' + element.tagName.toLowerCase();
1201
+ $H({'id': 'id', 'className': 'class'}).each(function(pair) {
1202
+ var property = pair.first(), attribute = pair.last();
1203
+ var value = (element[property] || '').toString();
1204
+ if (value) result += ' ' + attribute + '=' + value.inspect(true);
1205
+ });
1206
+ return result + '>';
1207
+ },
1208
+
1209
+ recursivelyCollect: function(element, property) {
1210
+ element = $(element);
1211
+ var elements = [];
1212
+ while (element = element[property])
1213
+ if (element.nodeType == 1)
1214
+ elements.push(Element.extend(element));
1215
+ return elements;
1216
+ },
1217
+
1218
+ ancestors: function(element) {
1219
+ return $(element).recursivelyCollect('parentNode');
1220
+ },
1221
+
1222
+ descendants: function(element) {
1223
+ return $A($(element).getElementsByTagName('*'));
1224
+ },
1225
+
1226
+ immediateDescendants: function(element) {
1227
+ if (!(element = $(element).firstChild)) return [];
1228
+ while (element && element.nodeType != 1) element = element.nextSibling;
1229
+ if (element) return [element].concat($(element).nextSiblings());
1230
+ return [];
1231
+ },
1232
+
1233
+ previousSiblings: function(element) {
1234
+ return $(element).recursivelyCollect('previousSibling');
1235
+ },
1236
+
1237
+ nextSiblings: function(element) {
1238
+ return $(element).recursivelyCollect('nextSibling');
1239
+ },
1240
+
1241
+ siblings: function(element) {
1242
+ element = $(element);
1243
+ return element.previousSiblings().reverse().concat(element.nextSiblings());
1244
+ },
1245
+
1246
+ match: function(element, selector) {
1247
+ if (typeof selector == 'string')
1248
+ selector = new Selector(selector);
1249
+ return selector.match($(element));
1250
+ },
1251
+
1252
+ up: function(element, expression, index) {
1253
+ return Selector.findElement($(element).ancestors(), expression, index);
1254
+ },
1255
+
1256
+ down: function(element, expression, index) {
1257
+ return Selector.findElement($(element).descendants(), expression, index);
1258
+ },
1259
+
1260
+ previous: function(element, expression, index) {
1261
+ return Selector.findElement($(element).previousSiblings(), expression, index);
1262
+ },
1263
+
1264
+ next: function(element, expression, index) {
1265
+ return Selector.findElement($(element).nextSiblings(), expression, index);
1266
+ },
1267
+
1268
+ getElementsBySelector: function() {
1269
+ var args = $A(arguments), element = $(args.shift());
1270
+ return Selector.findChildElements(element, args);
1271
+ },
1272
+
1273
+ getElementsByClassName: function(element, className) {
1274
+ return document.getElementsByClassName(className, element);
1275
+ },
1276
+
1277
+ readAttribute: function(element, name) {
1278
+ element = $(element);
1279
+ if (document.all && !window.opera) {
1280
+ var t = Element._attributeTranslations;
1281
+ if (t.values[name]) return t.values[name](element, name);
1282
+ if (t.names[name]) name = t.names[name];
1283
+ var attribute = element.attributes[name];
1284
+ if(attribute) return attribute.nodeValue;
1285
+ }
1286
+ return element.getAttribute(name);
1287
+ },
1288
+
1289
+ getHeight: function(element) {
1290
+ return $(element).getDimensions().height;
1291
+ },
1292
+
1293
+ getWidth: function(element) {
1294
+ return $(element).getDimensions().width;
1295
+ },
1296
+
1297
+ classNames: function(element) {
1298
+ return new Element.ClassNames(element);
1299
+ },
1300
+
1301
+ hasClassName: function(element, className) {
1302
+ if (!(element = $(element))) return;
1303
+ var elementClassName = element.className;
1304
+ if (elementClassName.length == 0) return false;
1305
+ if (elementClassName == className ||
1306
+ elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
1307
+ return true;
1308
+ return false;
1309
+ },
1310
+
1311
+ addClassName: function(element, className) {
1312
+ if (!(element = $(element))) return;
1313
+ Element.classNames(element).add(className);
1314
+ return element;
1315
+ },
1316
+
1317
+ removeClassName: function(element, className) {
1318
+ if (!(element = $(element))) return;
1319
+ Element.classNames(element).remove(className);
1320
+ return element;
1321
+ },
1322
+
1323
+ toggleClassName: function(element, className) {
1324
+ if (!(element = $(element))) return;
1325
+ Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
1326
+ return element;
1327
+ },
1328
+
1329
+ observe: function() {
1330
+ Event.observe.apply(Event, arguments);
1331
+ return $A(arguments).first();
1332
+ },
1333
+
1334
+ stopObserving: function() {
1335
+ Event.stopObserving.apply(Event, arguments);
1336
+ return $A(arguments).first();
1337
+ },
1338
+
1339
+ // removes whitespace-only text node children
1340
+ cleanWhitespace: function(element) {
1341
+ element = $(element);
1342
+ var node = element.firstChild;
1343
+ while (node) {
1344
+ var nextNode = node.nextSibling;
1345
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
1346
+ element.removeChild(node);
1347
+ node = nextNode;
1348
+ }
1349
+ return element;
1350
+ },
1351
+
1352
+ empty: function(element) {
1353
+ return $(element).innerHTML.match(/^\s*$/);
1354
+ },
1355
+
1356
+ descendantOf: function(element, ancestor) {
1357
+ element = $(element), ancestor = $(ancestor);
1358
+ while (element = element.parentNode)
1359
+ if (element == ancestor) return true;
1360
+ return false;
1361
+ },
1362
+
1363
+ scrollTo: function(element) {
1364
+ element = $(element);
1365
+ var pos = Position.cumulativeOffset(element);
1366
+ window.scrollTo(pos[0], pos[1]);
1367
+ return element;
1368
+ },
1369
+
1370
+ getStyle: function(element, style) {
1371
+ element = $(element);
1372
+ if (['float','cssFloat'].include(style))
1373
+ style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
1374
+ style = style.camelize();
1375
+ var value = element.style[style];
1376
+ if (!value) {
1377
+ if (document.defaultView && document.defaultView.getComputedStyle) {
1378
+ var css = document.defaultView.getComputedStyle(element, null);
1379
+ value = css ? css[style] : null;
1380
+ } else if (element.currentStyle) {
1381
+ value = element.currentStyle[style];
1382
+ }
1383
+ }
1384
+
1385
+ if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
1386
+ value = element['offset'+style.capitalize()] + 'px';
1387
+
1388
+ if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
1389
+ if (Element.getStyle(element, 'position') == 'static') value = 'auto';
1390
+ if(style == 'opacity') {
1391
+ if(value) return parseFloat(value);
1392
+ if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
1393
+ if(value[1]) return parseFloat(value[1]) / 100;
1394
+ return 1.0;
1395
+ }
1396
+ return value == 'auto' ? null : value;
1397
+ },
1398
+
1399
+ setStyle: function(element, style) {
1400
+ element = $(element);
1401
+ for (var name in style) {
1402
+ var value = style[name];
1403
+ if(name == 'opacity') {
1404
+ if (value == 1) {
1405
+ value = (/Gecko/.test(navigator.userAgent) &&
1406
+ !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
1407
+ if(/MSIE/.test(navigator.userAgent) && !window.opera)
1408
+ element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
1409
+ } else if(value === '') {
1410
+ if(/MSIE/.test(navigator.userAgent) && !window.opera)
1411
+ element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
1412
+ } else {
1413
+ if(value < 0.00001) value = 0;
1414
+ if(/MSIE/.test(navigator.userAgent) && !window.opera)
1415
+ element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
1416
+ 'alpha(opacity='+value*100+')';
1417
+ }
1418
+ } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
1419
+ element.style[name.camelize()] = value;
1420
+ }
1421
+ return element;
1422
+ },
1423
+
1424
+ getDimensions: function(element) {
1425
+ element = $(element);
1426
+ var display = $(element).getStyle('display');
1427
+ if (display != 'none' && display != null) // Safari bug
1428
+ return {width: element.offsetWidth, height: element.offsetHeight};
1429
+
1430
+ // All *Width and *Height properties give 0 on elements with display none,
1431
+ // so enable the element temporarily
1432
+ var els = element.style;
1433
+ var originalVisibility = els.visibility;
1434
+ var originalPosition = els.position;
1435
+ var originalDisplay = els.display;
1436
+ els.visibility = 'hidden';
1437
+ els.position = 'absolute';
1438
+ els.display = 'block';
1439
+ var originalWidth = element.clientWidth;
1440
+ var originalHeight = element.clientHeight;
1441
+ els.display = originalDisplay;
1442
+ els.position = originalPosition;
1443
+ els.visibility = originalVisibility;
1444
+ return {width: originalWidth, height: originalHeight};
1445
+ },
1446
+
1447
+ makePositioned: function(element) {
1448
+ element = $(element);
1449
+ var pos = Element.getStyle(element, 'position');
1450
+ if (pos == 'static' || !pos) {
1451
+ element._madePositioned = true;
1452
+ element.style.position = 'relative';
1453
+ // Opera returns the offset relative to the positioning context, when an
1454
+ // element is position relative but top and left have not been defined
1455
+ if (window.opera) {
1456
+ element.style.top = 0;
1457
+ element.style.left = 0;
1458
+ }
1459
+ }
1460
+ return element;
1461
+ },
1462
+
1463
+ undoPositioned: function(element) {
1464
+ element = $(element);
1465
+ if (element._madePositioned) {
1466
+ element._madePositioned = undefined;
1467
+ element.style.position =
1468
+ element.style.top =
1469
+ element.style.left =
1470
+ element.style.bottom =
1471
+ element.style.right = '';
1472
+ }
1473
+ return element;
1474
+ },
1475
+
1476
+ makeClipping: function(element) {
1477
+ element = $(element);
1478
+ if (element._overflow) return element;
1479
+ element._overflow = element.style.overflow || 'auto';
1480
+ if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
1481
+ element.style.overflow = 'hidden';
1482
+ return element;
1483
+ },
1484
+
1485
+ undoClipping: function(element) {
1486
+ element = $(element);
1487
+ if (!element._overflow) return element;
1488
+ element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
1489
+ element._overflow = null;
1490
+ return element;
1491
+ }
1492
+ };
1493
+
1494
+ Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf});
1495
+
1496
+ Element._attributeTranslations = {};
1497
+
1498
+ Element._attributeTranslations.names = {
1499
+ colspan: "colSpan",
1500
+ rowspan: "rowSpan",
1501
+ valign: "vAlign",
1502
+ datetime: "dateTime",
1503
+ accesskey: "accessKey",
1504
+ tabindex: "tabIndex",
1505
+ enctype: "encType",
1506
+ maxlength: "maxLength",
1507
+ readonly: "readOnly",
1508
+ longdesc: "longDesc"
1509
+ };
1510
+
1511
+ Element._attributeTranslations.values = {
1512
+ _getAttr: function(element, attribute) {
1513
+ return element.getAttribute(attribute, 2);
1514
+ },
1515
+
1516
+ _flag: function(element, attribute) {
1517
+ return $(element).hasAttribute(attribute) ? attribute : null;
1518
+ },
1519
+
1520
+ style: function(element) {
1521
+ return element.style.cssText.toLowerCase();
1522
+ },
1523
+
1524
+ title: function(element) {
1525
+ var node = element.getAttributeNode('title');
1526
+ return node.specified ? node.nodeValue : null;
1527
+ }
1528
+ };
1529
+
1530
+ Object.extend(Element._attributeTranslations.values, {
1531
+ href: Element._attributeTranslations.values._getAttr,
1532
+ src: Element._attributeTranslations.values._getAttr,
1533
+ disabled: Element._attributeTranslations.values._flag,
1534
+ checked: Element._attributeTranslations.values._flag,
1535
+ readonly: Element._attributeTranslations.values._flag,
1536
+ multiple: Element._attributeTranslations.values._flag
1537
+ });
1538
+
1539
+ Element.Methods.Simulated = {
1540
+ hasAttribute: function(element, attribute) {
1541
+ var t = Element._attributeTranslations;
1542
+ attribute = t.names[attribute] || attribute;
1543
+ return $(element).getAttributeNode(attribute).specified;
1544
+ }
1545
+ };
1546
+
1547
+ // IE is missing .innerHTML support for TABLE-related elements
1548
+ if (document.all && !window.opera){
1549
+ Element.Methods.update = function(element, html) {
1550
+ element = $(element);
1551
+ html = typeof html == 'undefined' ? '' : html.toString();
1552
+ var tagName = element.tagName.toUpperCase();
1553
+ if (['THEAD','TBODY','TR','TD'].include(tagName)) {
1554
+ var div = document.createElement('div');
1555
+ switch (tagName) {
1556
+ case 'THEAD':
1557
+ case 'TBODY':
1558
+ div.innerHTML = '<table><tbody>' + html.stripScripts() + '</tbody></table>';
1559
+ depth = 2;
1560
+ break;
1561
+ case 'TR':
1562
+ div.innerHTML = '<table><tbody><tr>' + html.stripScripts() + '</tr></tbody></table>';
1563
+ depth = 3;
1564
+ break;
1565
+ case 'TD':
1566
+ div.innerHTML = '<table><tbody><tr><td>' + html.stripScripts() + '</td></tr></tbody></table>';
1567
+ depth = 4;
1568
+ }
1569
+ $A(element.childNodes).each(function(node){
1570
+ element.removeChild(node)
1571
+ });
1572
+ depth.times(function(){ div = div.firstChild });
1573
+
1574
+ $A(div.childNodes).each(
1575
+ function(node){ element.appendChild(node) });
1576
+ } else {
1577
+ element.innerHTML = html.stripScripts();
1578
+ }
1579
+ setTimeout(function() {html.evalScripts()}, 10);
1580
+ return element;
1581
+ }
1582
+ };
1583
+
1584
+ Object.extend(Element, Element.Methods);
1585
+
1586
+ var _nativeExtensions = false;
1587
+
1588
+ if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
1589
+ ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
1590
+ var className = 'HTML' + tag + 'Element';
1591
+ if(window[className]) return;
1592
+ var klass = window[className] = {};
1593
+ klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
1594
+ });
1595
+
1596
+ Element.addMethods = function(methods) {
1597
+ Object.extend(Element.Methods, methods || {});
1598
+
1599
+ function copy(methods, destination, onlyIfAbsent) {
1600
+ onlyIfAbsent = onlyIfAbsent || false;
1601
+ var cache = Element.extend.cache;
1602
+ for (var property in methods) {
1603
+ var value = methods[property];
1604
+ if (!onlyIfAbsent || !(property in destination))
1605
+ destination[property] = cache.findOrStore(value);
1606
+ }
1607
+ }
1608
+
1609
+ if (typeof HTMLElement != 'undefined') {
1610
+ copy(Element.Methods, HTMLElement.prototype);
1611
+ copy(Element.Methods.Simulated, HTMLElement.prototype, true);
1612
+ copy(Form.Methods, HTMLFormElement.prototype);
1613
+ [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
1614
+ copy(Form.Element.Methods, klass.prototype);
1615
+ });
1616
+ _nativeExtensions = true;
1617
+ }
1618
+ }
1619
+
1620
+ var Toggle = new Object();
1621
+ Toggle.display = Element.toggle;
1622
+
1623
+ /*--------------------------------------------------------------------------*/
1624
+
1625
+ Abstract.Insertion = function(adjacency) {
1626
+ this.adjacency = adjacency;
1627
+ }
1628
+
1629
+ Abstract.Insertion.prototype = {
1630
+ initialize: function(element, content) {
1631
+ this.element = $(element);
1632
+ this.content = content.stripScripts();
1633
+
1634
+ if (this.adjacency && this.element.insertAdjacentHTML) {
1635
+ try {
1636
+ this.element.insertAdjacentHTML(this.adjacency, this.content);
1637
+ } catch (e) {
1638
+ var tagName = this.element.tagName.toUpperCase();
1639
+ if (['TBODY', 'TR'].include(tagName)) {
1640
+ this.insertContent(this.contentFromAnonymousTable());
1641
+ } else {
1642
+ throw e;
1643
+ }
1644
+ }
1645
+ } else {
1646
+ this.range = this.element.ownerDocument.createRange();
1647
+ if (this.initializeRange) this.initializeRange();
1648
+ this.insertContent([this.range.createContextualFragment(this.content)]);
1649
+ }
1650
+
1651
+ setTimeout(function() {content.evalScripts()}, 10);
1652
+ },
1653
+
1654
+ contentFromAnonymousTable: function() {
1655
+ var div = document.createElement('div');
1656
+ div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
1657
+ return $A(div.childNodes[0].childNodes[0].childNodes);
1658
+ }
1659
+ }
1660
+
1661
+ var Insertion = new Object();
1662
+
1663
+ Insertion.Before = Class.create();
1664
+ Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
1665
+ initializeRange: function() {
1666
+ this.range.setStartBefore(this.element);
1667
+ },
1668
+
1669
+ insertContent: function(fragments) {
1670
+ fragments.each((function(fragment) {
1671
+ this.element.parentNode.insertBefore(fragment, this.element);
1672
+ }).bind(this));
1673
+ }
1674
+ });
1675
+
1676
+ Insertion.Top = Class.create();
1677
+ Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
1678
+ initializeRange: function() {
1679
+ this.range.selectNodeContents(this.element);
1680
+ this.range.collapse(true);
1681
+ },
1682
+
1683
+ insertContent: function(fragments) {
1684
+ fragments.reverse(false).each((function(fragment) {
1685
+ this.element.insertBefore(fragment, this.element.firstChild);
1686
+ }).bind(this));
1687
+ }
1688
+ });
1689
+
1690
+ Insertion.Bottom = Class.create();
1691
+ Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
1692
+ initializeRange: function() {
1693
+ this.range.selectNodeContents(this.element);
1694
+ this.range.collapse(this.element);
1695
+ },
1696
+
1697
+ insertContent: function(fragments) {
1698
+ fragments.each((function(fragment) {
1699
+ this.element.appendChild(fragment);
1700
+ }).bind(this));
1701
+ }
1702
+ });
1703
+
1704
+ Insertion.After = Class.create();
1705
+ Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
1706
+ initializeRange: function() {
1707
+ this.range.setStartAfter(this.element);
1708
+ },
1709
+
1710
+ insertContent: function(fragments) {
1711
+ fragments.each((function(fragment) {
1712
+ this.element.parentNode.insertBefore(fragment,
1713
+ this.element.nextSibling);
1714
+ }).bind(this));
1715
+ }
1716
+ });
1717
+
1718
+ /*--------------------------------------------------------------------------*/
1719
+
1720
+ Element.ClassNames = Class.create();
1721
+ Element.ClassNames.prototype = {
1722
+ initialize: function(element) {
1723
+ this.element = $(element);
1724
+ },
1725
+
1726
+ _each: function(iterator) {
1727
+ this.element.className.split(/\s+/).select(function(name) {
1728
+ return name.length > 0;
1729
+ })._each(iterator);
1730
+ },
1731
+
1732
+ set: function(className) {
1733
+ this.element.className = className;
1734
+ },
1735
+
1736
+ add: function(classNameToAdd) {
1737
+ if (this.include(classNameToAdd)) return;
1738
+ this.set($A(this).concat(classNameToAdd).join(' '));
1739
+ },
1740
+
1741
+ remove: function(classNameToRemove) {
1742
+ if (!this.include(classNameToRemove)) return;
1743
+ this.set($A(this).without(classNameToRemove).join(' '));
1744
+ },
1745
+
1746
+ toString: function() {
1747
+ return $A(this).join(' ');
1748
+ }
1749
+ };
1750
+
1751
+ Object.extend(Element.ClassNames.prototype, Enumerable);
1752
+ var Selector = Class.create();
1753
+ Selector.prototype = {
1754
+ initialize: function(expression) {
1755
+ this.params = {classNames: []};
1756
+ this.expression = expression.toString().strip();
1757
+ this.parseExpression();
1758
+ this.compileMatcher();
1759
+ },
1760
+
1761
+ parseExpression: function() {
1762
+ function abort(message) { throw 'Parse error in selector: ' + message; }
1763
+
1764
+ if (this.expression == '') abort('empty expression');
1765
+
1766
+ var params = this.params, expr = this.expression, match, modifier, clause, rest;
1767
+ while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
1768
+ params.attributes = params.attributes || [];
1769
+ params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
1770
+ expr = match[1];
1771
+ }
1772
+
1773
+ if (expr == '*') return this.params.wildcard = true;
1774
+
1775
+ while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
1776
+ modifier = match[1], clause = match[2], rest = match[3];
1777
+ switch (modifier) {
1778
+ case '#': params.id = clause; break;
1779
+ case '.': params.classNames.push(clause); break;
1780
+ case '':
1781
+ case undefined: params.tagName = clause.toUpperCase(); break;
1782
+ default: abort(expr.inspect());
1783
+ }
1784
+ expr = rest;
1785
+ }
1786
+
1787
+ if (expr.length > 0) abort(expr.inspect());
1788
+ },
1789
+
1790
+ buildMatchExpression: function() {
1791
+ var params = this.params, conditions = [], clause;
1792
+
1793
+ if (params.wildcard)
1794
+ conditions.push('true');
1795
+ if (clause = params.id)
1796
+ conditions.push('element.readAttribute("id") == ' + clause.inspect());
1797
+ if (clause = params.tagName)
1798
+ conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
1799
+ if ((clause = params.classNames).length > 0)
1800
+ for (var i = 0, length = clause.length; i < length; i++)
1801
+ conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
1802
+ if (clause = params.attributes) {
1803
+ clause.each(function(attribute) {
1804
+ var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
1805
+ var splitValueBy = function(delimiter) {
1806
+ return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
1807
+ }
1808
+
1809
+ switch (attribute.operator) {
1810
+ case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
1811
+ case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
1812
+ case '|=': conditions.push(
1813
+ splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
1814
+ ); break;
1815
+ case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
1816
+ case '':
1817
+ case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
1818
+ default: throw 'Unknown operator ' + attribute.operator + ' in selector';
1819
+ }
1820
+ });
1821
+ }
1822
+
1823
+ return conditions.join(' && ');
1824
+ },
1825
+
1826
+ compileMatcher: function() {
1827
+ this.match = new Function('element', 'if (!element.tagName) return false; \
1828
+ element = $(element); \
1829
+ return ' + this.buildMatchExpression());
1830
+ },
1831
+
1832
+ findElements: function(scope) {
1833
+ var element;
1834
+
1835
+ if (element = $(this.params.id))
1836
+ if (this.match(element))
1837
+ if (!scope || Element.childOf(element, scope))
1838
+ return [element];
1839
+
1840
+ scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
1841
+
1842
+ var results = [];
1843
+ for (var i = 0, length = scope.length; i < length; i++)
1844
+ if (this.match(element = scope[i]))
1845
+ results.push(Element.extend(element));
1846
+
1847
+ return results;
1848
+ },
1849
+
1850
+ toString: function() {
1851
+ return this.expression;
1852
+ }
1853
+ }
1854
+
1855
+ Object.extend(Selector, {
1856
+ matchElements: function(elements, expression) {
1857
+ var selector = new Selector(expression);
1858
+ return elements.select(selector.match.bind(selector)).map(Element.extend);
1859
+ },
1860
+
1861
+ findElement: function(elements, expression, index) {
1862
+ if (typeof expression == 'number') index = expression, expression = false;
1863
+ return Selector.matchElements(elements, expression || '*')[index || 0];
1864
+ },
1865
+
1866
+ findChildElements: function(element, expressions) {
1867
+ return expressions.map(function(expression) {
1868
+ return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
1869
+ var selector = new Selector(expr);
1870
+ return results.inject([], function(elements, result) {
1871
+ return elements.concat(selector.findElements(result || element));
1872
+ });
1873
+ });
1874
+ }).flatten();
1875
+ }
1876
+ });
1877
+
1878
+ function $$() {
1879
+ return Selector.findChildElements(document, $A(arguments));
1880
+ }
1881
+ var Form = {
1882
+ reset: function(form) {
1883
+ $(form).reset();
1884
+ return form;
1885
+ },
1886
+
1887
+ serializeElements: function(elements, getHash) {
1888
+ var data = elements.inject({}, function(result, element) {
1889
+ if (!element.disabled && element.name) {
1890
+ var key = element.name, value = $(element).getValue();
1891
+ if (value != undefined) {
1892
+ if (result[key]) {
1893
+ if (result[key].constructor != Array) result[key] = [result[key]];
1894
+ result[key].push(value);
1895
+ }
1896
+ else result[key] = value;
1897
+ }
1898
+ }
1899
+ return result;
1900
+ });
1901
+
1902
+ return getHash ? data : Hash.toQueryString(data);
1903
+ }
1904
+ };
1905
+
1906
+ Form.Methods = {
1907
+ serialize: function(form, getHash) {
1908
+ return Form.serializeElements(Form.getElements(form), getHash);
1909
+ },
1910
+
1911
+ getElements: function(form) {
1912
+ return $A($(form).getElementsByTagName('*')).inject([],
1913
+ function(elements, child) {
1914
+ if (Form.Element.Serializers[child.tagName.toLowerCase()])
1915
+ elements.push(Element.extend(child));
1916
+ return elements;
1917
+ }
1918
+ );
1919
+ },
1920
+
1921
+ getInputs: function(form, typeName, name) {
1922
+ form = $(form);
1923
+ var inputs = form.getElementsByTagName('input');
1924
+
1925
+ if (!typeName && !name) return $A(inputs).map(Element.extend);
1926
+
1927
+ for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
1928
+ var input = inputs[i];
1929
+ if ((typeName && input.type != typeName) || (name && input.name != name))
1930
+ continue;
1931
+ matchingInputs.push(Element.extend(input));
1932
+ }
1933
+
1934
+ return matchingInputs;
1935
+ },
1936
+
1937
+ disable: function(form) {
1938
+ form = $(form);
1939
+ form.getElements().each(function(element) {
1940
+ element.blur();
1941
+ element.disabled = 'true';
1942
+ });
1943
+ return form;
1944
+ },
1945
+
1946
+ enable: function(form) {
1947
+ form = $(form);
1948
+ form.getElements().each(function(element) {
1949
+ element.disabled = '';
1950
+ });
1951
+ return form;
1952
+ },
1953
+
1954
+ findFirstElement: function(form) {
1955
+ return $(form).getElements().find(function(element) {
1956
+ return element.type != 'hidden' && !element.disabled &&
1957
+ ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
1958
+ });
1959
+ },
1960
+
1961
+ focusFirstElement: function(form) {
1962
+ form = $(form);
1963
+ form.findFirstElement().activate();
1964
+ return form;
1965
+ }
1966
+ }
1967
+
1968
+ Object.extend(Form, Form.Methods);
1969
+
1970
+ /*--------------------------------------------------------------------------*/
1971
+
1972
+ Form.Element = {
1973
+ focus: function(element) {
1974
+ $(element).focus();
1975
+ return element;
1976
+ },
1977
+
1978
+ select: function(element) {
1979
+ $(element).select();
1980
+ return element;
1981
+ }
1982
+ }
1983
+
1984
+ Form.Element.Methods = {
1985
+ serialize: function(element) {
1986
+ element = $(element);
1987
+ if (!element.disabled && element.name) {
1988
+ var value = element.getValue();
1989
+ if (value != undefined) {
1990
+ var pair = {};
1991
+ pair[element.name] = value;
1992
+ return Hash.toQueryString(pair);
1993
+ }
1994
+ }
1995
+ return '';
1996
+ },
1997
+
1998
+ getValue: function(element) {
1999
+ element = $(element);
2000
+ var method = element.tagName.toLowerCase();
2001
+ return Form.Element.Serializers[method](element);
2002
+ },
2003
+
2004
+ clear: function(element) {
2005
+ $(element).value = '';
2006
+ return element;
2007
+ },
2008
+
2009
+ present: function(element) {
2010
+ return $(element).value != '';
2011
+ },
2012
+
2013
+ activate: function(element) {
2014
+ element = $(element);
2015
+ element.focus();
2016
+ if (element.select && ( element.tagName.toLowerCase() != 'input' ||
2017
+ !['button', 'reset', 'submit'].include(element.type) ) )
2018
+ element.select();
2019
+ return element;
2020
+ },
2021
+
2022
+ disable: function(element) {
2023
+ element = $(element);
2024
+ element.disabled = true;
2025
+ return element;
2026
+ },
2027
+
2028
+ enable: function(element) {
2029
+ element = $(element);
2030
+ element.blur();
2031
+ element.disabled = false;
2032
+ return element;
2033
+ }
2034
+ }
2035
+
2036
+ Object.extend(Form.Element, Form.Element.Methods);
2037
+ var Field = Form.Element;
2038
+ var $F = Form.Element.getValue;
2039
+
2040
+ /*--------------------------------------------------------------------------*/
2041
+
2042
+ Form.Element.Serializers = {
2043
+ input: function(element) {
2044
+ switch (element.type.toLowerCase()) {
2045
+ case 'checkbox':
2046
+ case 'radio':
2047
+ return Form.Element.Serializers.inputSelector(element);
2048
+ default:
2049
+ return Form.Element.Serializers.textarea(element);
2050
+ }
2051
+ },
2052
+
2053
+ inputSelector: function(element) {
2054
+ return element.checked ? element.value : null;
2055
+ },
2056
+
2057
+ textarea: function(element) {
2058
+ return element.value;
2059
+ },
2060
+
2061
+ select: function(element) {
2062
+ return this[element.type == 'select-one' ?
2063
+ 'selectOne' : 'selectMany'](element);
2064
+ },
2065
+
2066
+ selectOne: function(element) {
2067
+ var index = element.selectedIndex;
2068
+ return index >= 0 ? this.optionValue(element.options[index]) : null;
2069
+ },
2070
+
2071
+ selectMany: function(element) {
2072
+ var values, length = element.length;
2073
+ if (!length) return null;
2074
+
2075
+ for (var i = 0, values = []; i < length; i++) {
2076
+ var opt = element.options[i];
2077
+ if (opt.selected) values.push(this.optionValue(opt));
2078
+ }
2079
+ return values;
2080
+ },
2081
+
2082
+ optionValue: function(opt) {
2083
+ // extend element because hasAttribute may not be native
2084
+ return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
2085
+ }
2086
+ }
2087
+
2088
+ /*--------------------------------------------------------------------------*/
2089
+
2090
+ Abstract.TimedObserver = function() {}
2091
+ Abstract.TimedObserver.prototype = {
2092
+ initialize: function(element, frequency, callback) {
2093
+ this.frequency = frequency;
2094
+ this.element = $(element);
2095
+ this.callback = callback;
2096
+
2097
+ this.lastValue = this.getValue();
2098
+ this.registerCallback();
2099
+ },
2100
+
2101
+ registerCallback: function() {
2102
+ setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
2103
+ },
2104
+
2105
+ onTimerEvent: function() {
2106
+ var value = this.getValue();
2107
+ var changed = ('string' == typeof this.lastValue && 'string' == typeof value
2108
+ ? this.lastValue != value : String(this.lastValue) != String(value));
2109
+ if (changed) {
2110
+ this.callback(this.element, value);
2111
+ this.lastValue = value;
2112
+ }
2113
+ }
2114
+ }
2115
+
2116
+ Form.Element.Observer = Class.create();
2117
+ Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
2118
+ getValue: function() {
2119
+ return Form.Element.getValue(this.element);
2120
+ }
2121
+ });
2122
+
2123
+ Form.Observer = Class.create();
2124
+ Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
2125
+ getValue: function() {
2126
+ return Form.serialize(this.element);
2127
+ }
2128
+ });
2129
+
2130
+ /*--------------------------------------------------------------------------*/
2131
+
2132
+ Abstract.EventObserver = function() {}
2133
+ Abstract.EventObserver.prototype = {
2134
+ initialize: function(element, callback) {
2135
+ this.element = $(element);
2136
+ this.callback = callback;
2137
+
2138
+ this.lastValue = this.getValue();
2139
+ if (this.element.tagName.toLowerCase() == 'form')
2140
+ this.registerFormCallbacks();
2141
+ else
2142
+ this.registerCallback(this.element);
2143
+ },
2144
+
2145
+ onElementEvent: function() {
2146
+ var value = this.getValue();
2147
+ if (this.lastValue != value) {
2148
+ this.callback(this.element, value);
2149
+ this.lastValue = value;
2150
+ }
2151
+ },
2152
+
2153
+ registerFormCallbacks: function() {
2154
+ Form.getElements(this.element).each(this.registerCallback.bind(this));
2155
+ },
2156
+
2157
+ registerCallback: function(element) {
2158
+ if (element.type) {
2159
+ switch (element.type.toLowerCase()) {
2160
+ case 'checkbox':
2161
+ case 'radio':
2162
+ Event.observe(element, 'click', this.onElementEvent.bind(this));
2163
+ break;
2164
+ default:
2165
+ Event.observe(element, 'change', this.onElementEvent.bind(this));
2166
+ break;
2167
+ }
2168
+ }
2169
+ }
2170
+ }
2171
+
2172
+ Form.Element.EventObserver = Class.create();
2173
+ Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
2174
+ getValue: function() {
2175
+ return Form.Element.getValue(this.element);
2176
+ }
2177
+ });
2178
+
2179
+ Form.EventObserver = Class.create();
2180
+ Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
2181
+ getValue: function() {
2182
+ return Form.serialize(this.element);
2183
+ }
2184
+ });
2185
+ if (!window.Event) {
2186
+ var Event = new Object();
2187
+ }
2188
+
2189
+ Object.extend(Event, {
2190
+ KEY_BACKSPACE: 8,
2191
+ KEY_TAB: 9,
2192
+ KEY_RETURN: 13,
2193
+ KEY_ESC: 27,
2194
+ KEY_LEFT: 37,
2195
+ KEY_UP: 38,
2196
+ KEY_RIGHT: 39,
2197
+ KEY_DOWN: 40,
2198
+ KEY_DELETE: 46,
2199
+ KEY_HOME: 36,
2200
+ KEY_END: 35,
2201
+ KEY_PAGEUP: 33,
2202
+ KEY_PAGEDOWN: 34,
2203
+
2204
+ element: function(event) {
2205
+ return event.target || event.srcElement;
2206
+ },
2207
+
2208
+ isLeftClick: function(event) {
2209
+ return (((event.which) && (event.which == 1)) ||
2210
+ ((event.button) && (event.button == 1)));
2211
+ },
2212
+
2213
+ pointerX: function(event) {
2214
+ return event.pageX || (event.clientX +
2215
+ (document.documentElement.scrollLeft || document.body.scrollLeft));
2216
+ },
2217
+
2218
+ pointerY: function(event) {
2219
+ return event.pageY || (event.clientY +
2220
+ (document.documentElement.scrollTop || document.body.scrollTop));
2221
+ },
2222
+
2223
+ stop: function(event) {
2224
+ if (event.preventDefault) {
2225
+ event.preventDefault();
2226
+ event.stopPropagation();
2227
+ } else {
2228
+ event.returnValue = false;
2229
+ event.cancelBubble = true;
2230
+ }
2231
+ },
2232
+
2233
+ // find the first node with the given tagName, starting from the
2234
+ // node the event was triggered on; traverses the DOM upwards
2235
+ findElement: function(event, tagName) {
2236
+ var element = Event.element(event);
2237
+ while (element.parentNode && (!element.tagName ||
2238
+ (element.tagName.toUpperCase() != tagName.toUpperCase())))
2239
+ element = element.parentNode;
2240
+ return element;
2241
+ },
2242
+
2243
+ observers: false,
2244
+
2245
+ _observeAndCache: function(element, name, observer, useCapture) {
2246
+ if (!this.observers) this.observers = [];
2247
+ if (element.addEventListener) {
2248
+ this.observers.push([element, name, observer, useCapture]);
2249
+ element.addEventListener(name, observer, useCapture);
2250
+ } else if (element.attachEvent) {
2251
+ this.observers.push([element, name, observer, useCapture]);
2252
+ element.attachEvent('on' + name, observer);
2253
+ }
2254
+ },
2255
+
2256
+ unloadCache: function() {
2257
+ if (!Event.observers) return;
2258
+ for (var i = 0, length = Event.observers.length; i < length; i++) {
2259
+ Event.stopObserving.apply(this, Event.observers[i]);
2260
+ Event.observers[i][0] = null;
2261
+ }
2262
+ Event.observers = false;
2263
+ },
2264
+
2265
+ observe: function(element, name, observer, useCapture) {
2266
+ element = $(element);
2267
+ useCapture = useCapture || false;
2268
+
2269
+ if (name == 'keypress' &&
2270
+ (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
2271
+ || element.attachEvent))
2272
+ name = 'keydown';
2273
+
2274
+ Event._observeAndCache(element, name, observer, useCapture);
2275
+ },
2276
+
2277
+ stopObserving: function(element, name, observer, useCapture) {
2278
+ element = $(element);
2279
+ useCapture = useCapture || false;
2280
+
2281
+ if (name == 'keypress' &&
2282
+ (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
2283
+ || element.detachEvent))
2284
+ name = 'keydown';
2285
+
2286
+ if (element.removeEventListener) {
2287
+ element.removeEventListener(name, observer, useCapture);
2288
+ } else if (element.detachEvent) {
2289
+ try {
2290
+ element.detachEvent('on' + name, observer);
2291
+ } catch (e) {}
2292
+ }
2293
+ }
2294
+ });
2295
+
2296
+ /* prevent memory leaks in IE */
2297
+ if (navigator.appVersion.match(/\bMSIE\b/))
2298
+ Event.observe(window, 'unload', Event.unloadCache, false);
2299
+ var Position = {
2300
+ // set to true if needed, warning: firefox performance problems
2301
+ // NOT neeeded for page scrolling, only if draggable contained in
2302
+ // scrollable elements
2303
+ includeScrollOffsets: false,
2304
+
2305
+ // must be called before calling withinIncludingScrolloffset, every time the
2306
+ // page is scrolled
2307
+ prepare: function() {
2308
+ this.deltaX = window.pageXOffset
2309
+ || document.documentElement.scrollLeft
2310
+ || document.body.scrollLeft
2311
+ || 0;
2312
+ this.deltaY = window.pageYOffset
2313
+ || document.documentElement.scrollTop
2314
+ || document.body.scrollTop
2315
+ || 0;
2316
+ },
2317
+
2318
+ realOffset: function(element) {
2319
+ var valueT = 0, valueL = 0;
2320
+ do {
2321
+ valueT += element.scrollTop || 0;
2322
+ valueL += element.scrollLeft || 0;
2323
+ element = element.parentNode;
2324
+ } while (element);
2325
+ return [valueL, valueT];
2326
+ },
2327
+
2328
+ cumulativeOffset: function(element) {
2329
+ var valueT = 0, valueL = 0;
2330
+ do {
2331
+ valueT += element.offsetTop || 0;
2332
+ valueL += element.offsetLeft || 0;
2333
+ element = element.offsetParent;
2334
+ } while (element);
2335
+ return [valueL, valueT];
2336
+ },
2337
+
2338
+ positionedOffset: function(element) {
2339
+ var valueT = 0, valueL = 0;
2340
+ do {
2341
+ valueT += element.offsetTop || 0;
2342
+ valueL += element.offsetLeft || 0;
2343
+ element = element.offsetParent;
2344
+ if (element) {
2345
+ if(element.tagName=='BODY') break;
2346
+ var p = Element.getStyle(element, 'position');
2347
+ if (p == 'relative' || p == 'absolute') break;
2348
+ }
2349
+ } while (element);
2350
+ return [valueL, valueT];
2351
+ },
2352
+
2353
+ offsetParent: function(element) {
2354
+ if (element.offsetParent) return element.offsetParent;
2355
+ if (element == document.body) return element;
2356
+
2357
+ while ((element = element.parentNode) && element != document.body)
2358
+ if (Element.getStyle(element, 'position') != 'static')
2359
+ return element;
2360
+
2361
+ return document.body;
2362
+ },
2363
+
2364
+ // caches x/y coordinate pair to use with overlap
2365
+ within: function(element, x, y) {
2366
+ if (this.includeScrollOffsets)
2367
+ return this.withinIncludingScrolloffsets(element, x, y);
2368
+ this.xcomp = x;
2369
+ this.ycomp = y;
2370
+ this.offset = this.cumulativeOffset(element);
2371
+
2372
+ return (y >= this.offset[1] &&
2373
+ y < this.offset[1] + element.offsetHeight &&
2374
+ x >= this.offset[0] &&
2375
+ x < this.offset[0] + element.offsetWidth);
2376
+ },
2377
+
2378
+ withinIncludingScrolloffsets: function(element, x, y) {
2379
+ var offsetcache = this.realOffset(element);
2380
+
2381
+ this.xcomp = x + offsetcache[0] - this.deltaX;
2382
+ this.ycomp = y + offsetcache[1] - this.deltaY;
2383
+ this.offset = this.cumulativeOffset(element);
2384
+
2385
+ return (this.ycomp >= this.offset[1] &&
2386
+ this.ycomp < this.offset[1] + element.offsetHeight &&
2387
+ this.xcomp >= this.offset[0] &&
2388
+ this.xcomp < this.offset[0] + element.offsetWidth);
2389
+ },
2390
+
2391
+ // within must be called directly before
2392
+ overlap: function(mode, element) {
2393
+ if (!mode) return 0;
2394
+ if (mode == 'vertical')
2395
+ return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
2396
+ element.offsetHeight;
2397
+ if (mode == 'horizontal')
2398
+ return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
2399
+ element.offsetWidth;
2400
+ },
2401
+
2402
+ page: function(forElement) {
2403
+ var valueT = 0, valueL = 0;
2404
+
2405
+ var element = forElement;
2406
+ do {
2407
+ valueT += element.offsetTop || 0;
2408
+ valueL += element.offsetLeft || 0;
2409
+
2410
+ // Safari fix
2411
+ if (element.offsetParent==document.body)
2412
+ if (Element.getStyle(element,'position')=='absolute') break;
2413
+
2414
+ } while (element = element.offsetParent);
2415
+
2416
+ element = forElement;
2417
+ do {
2418
+ if (!window.opera || element.tagName=='BODY') {
2419
+ valueT -= element.scrollTop || 0;
2420
+ valueL -= element.scrollLeft || 0;
2421
+ }
2422
+ } while (element = element.parentNode);
2423
+
2424
+ return [valueL, valueT];
2425
+ },
2426
+
2427
+ clone: function(source, target) {
2428
+ var options = Object.extend({
2429
+ setLeft: true,
2430
+ setTop: true,
2431
+ setWidth: true,
2432
+ setHeight: true,
2433
+ offsetTop: 0,
2434
+ offsetLeft: 0
2435
+ }, arguments[2] || {})
2436
+
2437
+ // find page position of source
2438
+ source = $(source);
2439
+ var p = Position.page(source);
2440
+
2441
+ // find coordinate system to use
2442
+ target = $(target);
2443
+ var delta = [0, 0];
2444
+ var parent = null;
2445
+ // delta [0,0] will do fine with position: fixed elements,
2446
+ // position:absolute needs offsetParent deltas
2447
+ if (Element.getStyle(target,'position') == 'absolute') {
2448
+ parent = Position.offsetParent(target);
2449
+ delta = Position.page(parent);
2450
+ }
2451
+
2452
+ // correct by body offsets (fixes Safari)
2453
+ if (parent == document.body) {
2454
+ delta[0] -= document.body.offsetLeft;
2455
+ delta[1] -= document.body.offsetTop;
2456
+ }
2457
+
2458
+ // set position
2459
+ if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
2460
+ if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
2461
+ if(options.setWidth) target.style.width = source.offsetWidth + 'px';
2462
+ if(options.setHeight) target.style.height = source.offsetHeight + 'px';
2463
+ },
2464
+
2465
+ absolutize: function(element) {
2466
+ element = $(element);
2467
+ if (element.style.position == 'absolute') return;
2468
+ Position.prepare();
2469
+
2470
+ var offsets = Position.positionedOffset(element);
2471
+ var top = offsets[1];
2472
+ var left = offsets[0];
2473
+ var width = element.clientWidth;
2474
+ var height = element.clientHeight;
2475
+
2476
+ element._originalLeft = left - parseFloat(element.style.left || 0);
2477
+ element._originalTop = top - parseFloat(element.style.top || 0);
2478
+ element._originalWidth = element.style.width;
2479
+ element._originalHeight = element.style.height;
2480
+
2481
+ element.style.position = 'absolute';
2482
+ element.style.top = top + 'px';
2483
+ element.style.left = left + 'px';
2484
+ element.style.width = width + 'px';
2485
+ element.style.height = height + 'px';
2486
+ },
2487
+
2488
+ relativize: function(element) {
2489
+ element = $(element);
2490
+ if (element.style.position == 'relative') return;
2491
+ Position.prepare();
2492
+
2493
+ element.style.position = 'relative';
2494
+ var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
2495
+ var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
2496
+
2497
+ element.style.top = top + 'px';
2498
+ element.style.left = left + 'px';
2499
+ element.style.height = element._originalHeight;
2500
+ element.style.width = element._originalWidth;
2501
+ }
2502
+ }
2503
+
2504
+ // Safari returns margins on body which is incorrect if the child is absolutely
2505
+ // positioned. For performance reasons, redefine Position.cumulativeOffset for
2506
+ // KHTML/WebKit only.
2507
+ if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
2508
+ Position.cumulativeOffset = function(element) {
2509
+ var valueT = 0, valueL = 0;
2510
+ do {
2511
+ valueT += element.offsetTop || 0;
2512
+ valueL += element.offsetLeft || 0;
2513
+ if (element.offsetParent == document.body)
2514
+ if (Element.getStyle(element, 'position') == 'absolute') break;
2515
+
2516
+ element = element.offsetParent;
2517
+ } while (element);
2518
+
2519
+ return [valueL, valueT];
2520
+ }
2521
+ }
2522
+
2523
+ Element.addMethods();