compass-jquery-plugin 0.3.2.8 → 0.3.3.0

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 (542) hide show
  1. data/README.md +24 -6
  2. data/VERSION.yml +3 -3
  3. data/lib/jquery/gridify/grid_column.rb +6 -6
  4. data/lib/jquery/gridify/grid_options.rb +4 -4
  5. data/lib/jquery/mark_it_up.rb +2 -0
  6. data/lib/jquery/mobile.rb +0 -1
  7. data/templates/dynatree/jquery.dynatree.js +2896 -2880
  8. data/templates/dynatree/jquery.dynatree.min.js +55 -54
  9. data/templates/dynatree/jquery/dynatree/aero.scss +4 -2
  10. data/templates/dynatree/jquery/dynatree/aqua.scss +4 -2
  11. data/templates/dynatree/jquery/dynatree/crystal.scss +4 -2
  12. data/templates/dynatree/jquery/dynatree/xp.scss +5 -3
  13. data/templates/emulators/emulators/bb.playbook.landscape.png +0 -0
  14. data/templates/emulators/emulators/bb.playbook.landscape.scss +18 -0
  15. data/templates/emulators/emulators/bb.playbook.portrait.png +0 -0
  16. data/templates/emulators/emulators/bb.playbook.portrait.scss +18 -0
  17. data/templates/emulators/emulators/{blackberry.torch.landscape.png → bb.torch.landscape.png} +0 -0
  18. data/templates/emulators/emulators/{blackberry.torch.landscape.scss → bb.torch.landscape.scss} +1 -3
  19. data/templates/emulators/emulators/{blackberry.torch.portrait.png → bb.torch.portrait.png} +0 -0
  20. data/templates/emulators/emulators/{blackberry.torch.portrait.scss → bb.torch.portrait.scss} +1 -3
  21. data/templates/emulators/emulators/galaxy.ace.landscape.png +0 -0
  22. data/templates/emulators/emulators/galaxy.ace.landscape.scss +18 -0
  23. data/templates/emulators/emulators/galaxy.ace.portrait.png +0 -0
  24. data/templates/emulators/emulators/galaxy.ace.portrait.scss +18 -0
  25. data/templates/emulators/emulators/galaxy.s.landscape.scss +0 -2
  26. data/templates/emulators/emulators/galaxy.s.portrait.scss +0 -2
  27. data/templates/emulators/emulators/galaxy.s2.landscape.scss +0 -2
  28. data/templates/emulators/emulators/galaxy.s2.portrait.scss +0 -2
  29. data/templates/emulators/emulators/galaxy.tab.10.1.landscape.scss +0 -2
  30. data/templates/emulators/emulators/galaxy.tab.10.1.portrait.scss +0 -2
  31. data/templates/emulators/emulators/galaxy.tab.7.landscape.scss +0 -2
  32. data/templates/emulators/emulators/galaxy.tab.7.portrait.scss +0 -2
  33. data/templates/emulators/emulators/galaxy.tab.8.9.landscape.scss +0 -2
  34. data/templates/emulators/emulators/galaxy.tab.8.9.portrait.scss +0 -2
  35. data/templates/emulators/emulators/htc.sensation.landscape.png +0 -0
  36. data/templates/emulators/emulators/htc.sensation.landscape.scss +18 -0
  37. data/templates/emulators/emulators/htc.sensation.portrait.png +0 -0
  38. data/templates/emulators/emulators/htc.sensation.portrait.scss +18 -0
  39. data/templates/emulators/emulators/ipad.landscape.scss +0 -2
  40. data/templates/emulators/emulators/ipad.portrait.scss +0 -2
  41. data/templates/emulators/emulators/iphone.3.landscape.scss +0 -2
  42. data/templates/emulators/emulators/iphone.3.portrait.scss +0 -2
  43. data/templates/emulators/emulators/{iphone.4.landscape .scss → iphone.4.landscape.scss} +0 -2
  44. data/templates/emulators/emulators/iphone.4.portrait.scss +0 -2
  45. data/templates/emulators/emulators/palm.pre.2.landscape.scss +0 -2
  46. data/templates/emulators/emulators/palm.pre.2.portrait.scss +0 -2
  47. data/templates/emulators/manifest.rb +17 -5
  48. data/templates/graphics/highcharts/dark-blue.js +159 -159
  49. data/templates/graphics/highcharts/dark-green.js +159 -159
  50. data/templates/graphics/highcharts/gray.js +154 -154
  51. data/templates/graphics/highcharts/grid.js +84 -84
  52. data/templates/graphics/highcharts/highslide-config.js +2 -2
  53. data/templates/graphics/highcharts/highslide-full.js +3310 -3310
  54. data/templates/graphics/highcharts/skies.js +72 -72
  55. data/templates/graphics/jquery.ganttView.js +1550 -1550
  56. data/templates/graphics/jquery.highcharts.js +11277 -11285
  57. data/templates/graphics/jquery.sparkline.js +1072 -1072
  58. data/templates/ical/jquery.ical.js +7637 -7637
  59. data/templates/ical/jquery/ical.print.scss +3 -3
  60. data/templates/jqgrid/i18n/jqgrid/locale-ar.js +127 -127
  61. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +131 -131
  62. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +131 -131
  63. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -128
  64. data/templates/jqgrid/i18n/jqgrid/locale-cn.js +132 -132
  65. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +129 -129
  66. data/templates/jqgrid/i18n/jqgrid/locale-da.js +128 -128
  67. data/templates/jqgrid/i18n/jqgrid/locale-de.js +134 -134
  68. data/templates/jqgrid/i18n/jqgrid/locale-el.js +127 -127
  69. data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -128
  70. data/templates/jqgrid/i18n/jqgrid/locale-es.js +129 -129
  71. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +141 -141
  72. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +128 -128
  73. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +127 -127
  74. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +127 -127
  75. data/templates/jqgrid/i18n/jqgrid/locale-he.js +128 -128
  76. data/templates/jqgrid/i18n/jqgrid/locale-hu.js +128 -128
  77. data/templates/jqgrid/i18n/jqgrid/locale-is.js +127 -127
  78. data/templates/jqgrid/i18n/jqgrid/locale-it.js +6 -6
  79. data/templates/jqgrid/i18n/jqgrid/locale-ja.js +153 -153
  80. data/templates/jqgrid/i18n/jqgrid/locale-lt.js +128 -128
  81. data/templates/jqgrid/i18n/jqgrid/locale-mne.js +134 -0
  82. data/templates/jqgrid/i18n/jqgrid/locale-mne.min.js +7 -0
  83. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +145 -145
  84. data/templates/jqgrid/i18n/jqgrid/locale-no.js +12 -12
  85. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +128 -128
  86. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +128 -128
  87. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +126 -126
  88. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +140 -140
  89. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +128 -128
  90. data/templates/jqgrid/i18n/jqgrid/locale-sk.js +128 -128
  91. data/templates/jqgrid/i18n/jqgrid/locale-sr.js +128 -128
  92. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +128 -128
  93. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +127 -127
  94. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +128 -128
  95. data/templates/jqgrid/jquery.jqGrid.js +13477 -13443
  96. data/templates/jqgrid/jquery.jqGrid.min.js +292 -287
  97. data/templates/jqgrid/jquery/jqGrid.scss +13 -12
  98. data/templates/jqgrid/manifest.rb +2 -0
  99. data/templates/jqtouch/jquery.jqtouch.js +9601 -9556
  100. data/templates/jqtouch/jquery.jqtouch.min.js +3 -3
  101. data/templates/jqtouch/jquery/touch/default.scss +2 -2
  102. data/templates/jqtouch/jquery/touch/jqt.scss +2 -2
  103. data/templates/jqtouch/jquery/touch/jqtouch.scss +26 -5
  104. data/templates/jquery/amplify.store.js +211 -211
  105. data/templates/jquery/config/initializers/jquery.rb +2 -0
  106. data/templates/jquery/history.adapter.jquery.js +42 -36
  107. data/templates/jquery/history.html4.js +563 -563
  108. data/templates/jquery/history.html4.min.js +5 -5
  109. data/templates/jquery/history.js +1721 -1694
  110. data/templates/jquery/history.min.js +28 -27
  111. data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
  112. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +18 -18
  113. data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
  114. data/templates/jquery/i18n/jquery.ui/datepicker-az.js +20 -20
  115. data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +21 -21
  116. data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
  117. data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +19 -19
  118. data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
  119. data/templates/jquery/i18n/jquery.ui/datepicker-da.js +20 -20
  120. data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
  121. data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
  122. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +19 -19
  123. data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
  124. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +19 -19
  125. data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
  126. data/templates/jquery/i18n/jquery.ui/datepicker-es.js +19 -19
  127. data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
  128. data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
  129. data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +19 -19
  130. data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +19 -19
  131. data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
  132. data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
  133. data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +20 -20
  134. data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +19 -19
  135. data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
  136. data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
  137. data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +19 -19
  138. data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +19 -19
  139. data/templates/jquery/i18n/jquery.ui/datepicker-id.js +19 -19
  140. data/templates/jquery/i18n/jquery.ui/datepicker-is.js +19 -19
  141. data/templates/jquery/i18n/jquery.ui/datepicker-it.js +19 -19
  142. data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
  143. data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +19 -19
  144. data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +19 -19
  145. data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +19 -19
  146. data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +19 -19
  147. data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
  148. data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +19 -19
  149. data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
  150. data/templates/jquery/i18n/jquery.ui/datepicker-nl.min.js +1 -1
  151. data/templates/jquery/i18n/jquery.ui/datepicker-no.js +18 -18
  152. data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +19 -19
  153. data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +19 -19
  154. data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +19 -19
  155. data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +17 -17
  156. data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
  157. data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +19 -19
  158. data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +19 -19
  159. data/templates/jquery/i18n/jquery.ui/datepicker-sk.min.js +1 -1
  160. data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +19 -19
  161. data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
  162. data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
  163. data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
  164. data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +20 -20
  165. data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
  166. data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
  167. data/templates/jquery/i18n/jquery.ui/datepicker-tj.js +19 -19
  168. data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +19 -19
  169. data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +19 -19
  170. data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
  171. data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +19 -19
  172. data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +19 -19
  173. data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
  174. data/templates/jquery/jquery-ui.js +11913 -11882
  175. data/templates/jquery/jquery-ui.min.js +340 -339
  176. data/templates/jquery/jquery.bgiframe.js +27 -27
  177. data/templates/jquery/jquery.contextMenu.js +202 -202
  178. data/templates/jquery/jquery.cookie.js +26 -26
  179. data/templates/jquery/jquery.dotimeout.js +227 -227
  180. data/templates/jquery/jquery.dst.js +89 -89
  181. data/templates/jquery/jquery.easing.js +226 -0
  182. data/templates/jquery/jquery.easing.min.js +8 -0
  183. data/templates/jquery/jquery.farbtastic.js +294 -294
  184. data/templates/jquery/jquery.flashMessages.js +14 -14
  185. data/templates/jquery/jquery.form.js +761 -761
  186. data/templates/jquery/jquery.haml.js +247 -247
  187. data/templates/jquery/jquery.hotkeys.js +79 -79
  188. data/templates/jquery/jquery.js +1490 -928
  189. data/templates/jquery/jquery.layout.js +2454 -2454
  190. data/templates/jquery/jquery.mediahelpers.js +216 -0
  191. data/templates/jquery/jquery.mediahelpers.min.js +3 -0
  192. data/templates/jquery/jquery.min.js +177 -166
  193. data/templates/jquery/jquery.mousewheel.js +57 -57
  194. data/templates/jquery/jquery.offline.js +171 -171
  195. data/templates/jquery/jquery.pngFix.js +72 -72
  196. data/templates/jquery/jquery.rails.js +145 -145
  197. data/templates/jquery/jquery.replacetext.js +80 -80
  198. data/templates/jquery/jquery.themeswitchertool.js +195 -195
  199. data/templates/jquery/jquery.tmpl.js +460 -460
  200. data/templates/jquery/jquery.tmplPlus.js +78 -78
  201. data/templates/jquery/jquery.tokeninput.js +480 -475
  202. data/templates/jquery/jquery/ui/_theme.scss +14 -14
  203. data/templates/jquery/jquery/ui/black-tie/ui-icons_4ca300_256x240.png +0 -0
  204. data/templates/jquery/jquery/ui/black-tie/ui-icons_bbbbbb_256x240.png +0 -0
  205. data/templates/jquery/jquery/ui/black-tie/ui-icons_ededed_256x240.png +0 -0
  206. data/templates/jquery/jquery/ui/black-tie/ui-icons_ffcf29_256x240.png +0 -0
  207. data/templates/jquery/jquery/ui/vader/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  208. data/templates/jquery/jquery/ui/vader/ui-icons_bbbbbb_256x240.png +0 -0
  209. data/templates/jquery/jquery/ui/vader/ui-icons_c98000_256x240.png +0 -0
  210. data/templates/jquery/jquery/ui/vader/ui-icons_f29a00_256x240.png +0 -0
  211. data/templates/jquery/json.js +66 -66
  212. data/templates/jquery/json2.js +177 -177
  213. data/templates/jquery/manifest.rb +4 -0
  214. data/templates/jstree/jquery.jstree.js +5918 -5918
  215. data/templates/markitup/app/views/shared/_mark_it_up.parsed.preview.blue.html.haml +9 -0
  216. data/templates/markitup/app/views/shared/_mark_it_up.parsed.preview.html.haml +9 -0
  217. data/templates/markitup/app/views/shared/_mark_it_up.preview.blue.html.haml +8 -0
  218. data/templates/markitup/app/views/shared/_mark_it_up.preview.html.haml +8 -0
  219. data/templates/markitup/config/initializers/mark_it_up.rb +40 -0
  220. data/templates/markitup/jquery.markitup.js +586 -0
  221. data/templates/markitup/jquery.markitup.min.js +1 -0
  222. data/templates/markitup/jquery/markitup/preview/body.blue.png +0 -0
  223. data/templates/markitup/jquery/markitup/preview/bullet.blue.png +0 -0
  224. data/templates/markitup/jquery/markitup/preview/preview.blue.scss +58 -0
  225. data/templates/markitup/jquery/markitup/preview/preview.scss +7 -0
  226. data/templates/markitup/jquery/markitup/sets/bbcode.scss +34 -0
  227. data/templates/markitup/jquery/markitup/sets/bbcode/bold.png +0 -0
  228. data/templates/markitup/jquery/markitup/sets/bbcode/clean.png +0 -0
  229. data/templates/markitup/jquery/markitup/sets/bbcode/code.png +0 -0
  230. data/templates/markitup/jquery/markitup/sets/bbcode/fonts.png +0 -0
  231. data/templates/markitup/jquery/markitup/sets/bbcode/italic.png +0 -0
  232. data/templates/markitup/jquery/markitup/sets/bbcode/link.png +0 -0
  233. data/templates/markitup/jquery/markitup/sets/bbcode/list-bullet.png +0 -0
  234. data/templates/markitup/jquery/markitup/sets/bbcode/list-item.png +0 -0
  235. data/templates/markitup/jquery/markitup/sets/bbcode/list-numeric.png +0 -0
  236. data/templates/markitup/jquery/markitup/sets/bbcode/picture.png +0 -0
  237. data/templates/markitup/jquery/markitup/sets/bbcode/preview.png +0 -0
  238. data/templates/markitup/jquery/markitup/sets/bbcode/quotes.png +0 -0
  239. data/templates/markitup/jquery/markitup/sets/bbcode/stroke.png +0 -0
  240. data/templates/markitup/jquery/markitup/sets/bbcode/underline.png +0 -0
  241. data/templates/markitup/jquery/markitup/sets/css.scss +54 -0
  242. data/templates/markitup/jquery/markitup/sets/css/bold.png +0 -0
  243. data/templates/markitup/jquery/markitup/sets/css/css.png +0 -0
  244. data/templates/markitup/jquery/markitup/sets/css/italic.png +0 -0
  245. data/templates/markitup/jquery/markitup/sets/css/picture.png +0 -0
  246. data/templates/markitup/jquery/markitup/sets/css/stroke.png +0 -0
  247. data/templates/markitup/jquery/markitup/sets/css/tag.png +0 -0
  248. data/templates/markitup/jquery/markitup/sets/css/text_align_center.png +0 -0
  249. data/templates/markitup/jquery/markitup/sets/css/text_align_justify.png +0 -0
  250. data/templates/markitup/jquery/markitup/sets/css/text_align_left.png +0 -0
  251. data/templates/markitup/jquery/markitup/sets/css/text_align_right.png +0 -0
  252. data/templates/markitup/jquery/markitup/sets/css/text_indent.png +0 -0
  253. data/templates/markitup/jquery/markitup/sets/css/text_letterspacing.png +0 -0
  254. data/templates/markitup/jquery/markitup/sets/css/text_linespacing.png +0 -0
  255. data/templates/markitup/jquery/markitup/sets/css/text_lowercase.png +0 -0
  256. data/templates/markitup/jquery/markitup/sets/css/text_padding_bottom.png +0 -0
  257. data/templates/markitup/jquery/markitup/sets/css/text_padding_left.png +0 -0
  258. data/templates/markitup/jquery/markitup/sets/css/text_padding_right.png +0 -0
  259. data/templates/markitup/jquery/markitup/sets/css/text_padding_top.png +0 -0
  260. data/templates/markitup/jquery/markitup/sets/css/text_uppercase.png +0 -0
  261. data/templates/markitup/jquery/markitup/sets/default.scss +22 -0
  262. data/templates/markitup/jquery/markitup/sets/default/bold.png +0 -0
  263. data/templates/markitup/jquery/markitup/sets/default/clean.png +0 -0
  264. data/templates/markitup/jquery/markitup/sets/default/image.png +0 -0
  265. data/templates/markitup/jquery/markitup/sets/default/italic.png +0 -0
  266. data/templates/markitup/jquery/markitup/sets/default/link.png +0 -0
  267. data/templates/markitup/jquery/markitup/sets/default/picture.png +0 -0
  268. data/templates/markitup/jquery/markitup/sets/default/preview.png +0 -0
  269. data/templates/markitup/jquery/markitup/sets/default/stroke.png +0 -0
  270. data/templates/markitup/jquery/markitup/sets/dotclear.scss +38 -0
  271. data/templates/markitup/jquery/markitup/sets/dotclear/bold.png +0 -0
  272. data/templates/markitup/jquery/markitup/sets/dotclear/code.png +0 -0
  273. data/templates/markitup/jquery/markitup/sets/dotclear/h1.png +0 -0
  274. data/templates/markitup/jquery/markitup/sets/dotclear/h2.png +0 -0
  275. data/templates/markitup/jquery/markitup/sets/dotclear/h3.png +0 -0
  276. data/templates/markitup/jquery/markitup/sets/dotclear/h4.png +0 -0
  277. data/templates/markitup/jquery/markitup/sets/dotclear/h5.png +0 -0
  278. data/templates/markitup/jquery/markitup/sets/dotclear/h6.png +0 -0
  279. data/templates/markitup/jquery/markitup/sets/dotclear/italic.png +0 -0
  280. data/templates/markitup/jquery/markitup/sets/dotclear/link.png +0 -0
  281. data/templates/markitup/jquery/markitup/sets/dotclear/list-bullet.png +0 -0
  282. data/templates/markitup/jquery/markitup/sets/dotclear/list-numeric.png +0 -0
  283. data/templates/markitup/jquery/markitup/sets/dotclear/picture.png +0 -0
  284. data/templates/markitup/jquery/markitup/sets/dotclear/preview.png +0 -0
  285. data/templates/markitup/jquery/markitup/sets/dotclear/quotes.png +0 -0
  286. data/templates/markitup/jquery/markitup/sets/dotclear/stroke.png +0 -0
  287. data/templates/markitup/jquery/markitup/sets/dotclear/url.png +0 -0
  288. data/templates/markitup/jquery/markitup/sets/html.scss +42 -0
  289. data/templates/markitup/jquery/markitup/sets/html/bold.png +0 -0
  290. data/templates/markitup/jquery/markitup/sets/html/clean.png +0 -0
  291. data/templates/markitup/jquery/markitup/sets/html/h1.png +0 -0
  292. data/templates/markitup/jquery/markitup/sets/html/h2.png +0 -0
  293. data/templates/markitup/jquery/markitup/sets/html/h3.png +0 -0
  294. data/templates/markitup/jquery/markitup/sets/html/h4.png +0 -0
  295. data/templates/markitup/jquery/markitup/sets/html/h5.png +0 -0
  296. data/templates/markitup/jquery/markitup/sets/html/h6.png +0 -0
  297. data/templates/markitup/jquery/markitup/sets/html/image.png +0 -0
  298. data/templates/markitup/jquery/markitup/sets/html/italic.png +0 -0
  299. data/templates/markitup/jquery/markitup/sets/html/link.png +0 -0
  300. data/templates/markitup/jquery/markitup/sets/html/list-bullet.png +0 -0
  301. data/templates/markitup/jquery/markitup/sets/html/list-item.png +0 -0
  302. data/templates/markitup/jquery/markitup/sets/html/list-numeric.png +0 -0
  303. data/templates/markitup/jquery/markitup/sets/html/paragraph.png +0 -0
  304. data/templates/markitup/jquery/markitup/sets/html/picture.png +0 -0
  305. data/templates/markitup/jquery/markitup/sets/html/preview.png +0 -0
  306. data/templates/markitup/jquery/markitup/sets/html/stroke.png +0 -0
  307. data/templates/markitup/jquery/markitup/sets/markdown.scss +38 -0
  308. data/templates/markitup/jquery/markitup/sets/markdown/bold.png +0 -0
  309. data/templates/markitup/jquery/markitup/sets/markdown/code.png +0 -0
  310. data/templates/markitup/jquery/markitup/sets/markdown/h1.png +0 -0
  311. data/templates/markitup/jquery/markitup/sets/markdown/h2.png +0 -0
  312. data/templates/markitup/jquery/markitup/sets/markdown/h3.png +0 -0
  313. data/templates/markitup/jquery/markitup/sets/markdown/h4.png +0 -0
  314. data/templates/markitup/jquery/markitup/sets/markdown/h5.png +0 -0
  315. data/templates/markitup/jquery/markitup/sets/markdown/h6.png +0 -0
  316. data/templates/markitup/jquery/markitup/sets/markdown/italic.png +0 -0
  317. data/templates/markitup/jquery/markitup/sets/markdown/link.png +0 -0
  318. data/templates/markitup/jquery/markitup/sets/markdown/list-bullet.png +0 -0
  319. data/templates/markitup/jquery/markitup/sets/markdown/list-numeric.png +0 -0
  320. data/templates/markitup/jquery/markitup/sets/markdown/picture.png +0 -0
  321. data/templates/markitup/jquery/markitup/sets/markdown/preview.png +0 -0
  322. data/templates/markitup/jquery/markitup/sets/markdown/quotes.png +0 -0
  323. data/templates/markitup/jquery/markitup/sets/markmin.scss +38 -0
  324. data/templates/markitup/jquery/markitup/sets/markmin/bold.png +0 -0
  325. data/templates/markitup/jquery/markitup/sets/markmin/code.png +0 -0
  326. data/templates/markitup/jquery/markitup/sets/markmin/h1.png +0 -0
  327. data/templates/markitup/jquery/markitup/sets/markmin/h2.png +0 -0
  328. data/templates/markitup/jquery/markitup/sets/markmin/h3.png +0 -0
  329. data/templates/markitup/jquery/markitup/sets/markmin/h4.png +0 -0
  330. data/templates/markitup/jquery/markitup/sets/markmin/h5.png +0 -0
  331. data/templates/markitup/jquery/markitup/sets/markmin/h6.png +0 -0
  332. data/templates/markitup/jquery/markitup/sets/markmin/italic.png +0 -0
  333. data/templates/markitup/jquery/markitup/sets/markmin/link.png +0 -0
  334. data/templates/markitup/jquery/markitup/sets/markmin/list-bullet.png +0 -0
  335. data/templates/markitup/jquery/markitup/sets/markmin/list-numeric.png +0 -0
  336. data/templates/markitup/jquery/markitup/sets/markmin/picture.png +0 -0
  337. data/templates/markitup/jquery/markitup/sets/markmin/preview.png +0 -0
  338. data/templates/markitup/jquery/markitup/sets/markmin/quotes.png +0 -0
  339. data/templates/markitup/jquery/markitup/sets/rest.scss +38 -0
  340. data/templates/markitup/jquery/markitup/sets/rest/bold.png +0 -0
  341. data/templates/markitup/jquery/markitup/sets/rest/code.png +0 -0
  342. data/templates/markitup/jquery/markitup/sets/rest/h1.png +0 -0
  343. data/templates/markitup/jquery/markitup/sets/rest/h2.png +0 -0
  344. data/templates/markitup/jquery/markitup/sets/rest/h3.png +0 -0
  345. data/templates/markitup/jquery/markitup/sets/rest/h4.png +0 -0
  346. data/templates/markitup/jquery/markitup/sets/rest/h5.png +0 -0
  347. data/templates/markitup/jquery/markitup/sets/rest/italic.png +0 -0
  348. data/templates/markitup/jquery/markitup/sets/rest/link.png +0 -0
  349. data/templates/markitup/jquery/markitup/sets/rest/list-bullet.png +0 -0
  350. data/templates/markitup/jquery/markitup/sets/rest/list-numeric.png +0 -0
  351. data/templates/markitup/jquery/markitup/sets/rest/picture.png +0 -0
  352. data/templates/markitup/jquery/markitup/sets/rest/preview.png +0 -0
  353. data/templates/markitup/jquery/markitup/sets/rest/quotes.png +0 -0
  354. data/templates/markitup/jquery/markitup/sets/textile.scss +44 -0
  355. data/templates/markitup/jquery/markitup/sets/textile/bold.png +0 -0
  356. data/templates/markitup/jquery/markitup/sets/textile/code.png +0 -0
  357. data/templates/markitup/jquery/markitup/sets/textile/h1.png +0 -0
  358. data/templates/markitup/jquery/markitup/sets/textile/h2.png +0 -0
  359. data/templates/markitup/jquery/markitup/sets/textile/h3.png +0 -0
  360. data/templates/markitup/jquery/markitup/sets/textile/h4.png +0 -0
  361. data/templates/markitup/jquery/markitup/sets/textile/h5.png +0 -0
  362. data/templates/markitup/jquery/markitup/sets/textile/h6.png +0 -0
  363. data/templates/markitup/jquery/markitup/sets/textile/italic.png +0 -0
  364. data/templates/markitup/jquery/markitup/sets/textile/link.png +0 -0
  365. data/templates/markitup/jquery/markitup/sets/textile/list-bullet.png +0 -0
  366. data/templates/markitup/jquery/markitup/sets/textile/list-numeric.png +0 -0
  367. data/templates/markitup/jquery/markitup/sets/textile/paragraph.png +0 -0
  368. data/templates/markitup/jquery/markitup/sets/textile/picture.png +0 -0
  369. data/templates/markitup/jquery/markitup/sets/textile/preview.png +0 -0
  370. data/templates/markitup/jquery/markitup/sets/textile/quotes.png +0 -0
  371. data/templates/markitup/jquery/markitup/sets/textile/stroke.png +0 -0
  372. data/templates/markitup/jquery/markitup/sets/textile/table.png +0 -0
  373. data/templates/markitup/jquery/markitup/sets/texy.scss +40 -0
  374. data/templates/markitup/jquery/markitup/sets/texy/bold.png +0 -0
  375. data/templates/markitup/jquery/markitup/sets/texy/code.png +0 -0
  376. data/templates/markitup/jquery/markitup/sets/texy/disconnect.png +0 -0
  377. data/templates/markitup/jquery/markitup/sets/texy/h1.png +0 -0
  378. data/templates/markitup/jquery/markitup/sets/texy/h2.png +0 -0
  379. data/templates/markitup/jquery/markitup/sets/texy/h3.png +0 -0
  380. data/templates/markitup/jquery/markitup/sets/texy/h4.png +0 -0
  381. data/templates/markitup/jquery/markitup/sets/texy/h5.png +0 -0
  382. data/templates/markitup/jquery/markitup/sets/texy/h6.png +0 -0
  383. data/templates/markitup/jquery/markitup/sets/texy/italic.png +0 -0
  384. data/templates/markitup/jquery/markitup/sets/texy/link.png +0 -0
  385. data/templates/markitup/jquery/markitup/sets/texy/list-bullet.png +0 -0
  386. data/templates/markitup/jquery/markitup/sets/texy/list-numeric.png +0 -0
  387. data/templates/markitup/jquery/markitup/sets/texy/page_white_code.png +0 -0
  388. data/templates/markitup/jquery/markitup/sets/texy/picture.png +0 -0
  389. data/templates/markitup/jquery/markitup/sets/texy/preview.png +0 -0
  390. data/templates/markitup/jquery/markitup/sets/texy/quotes.png +0 -0
  391. data/templates/markitup/jquery/markitup/sets/texy/stroke.png +0 -0
  392. data/templates/markitup/jquery/markitup/sets/txt2tags.scss +44 -0
  393. data/templates/markitup/jquery/markitup/sets/txt2tags/bold.png +0 -0
  394. data/templates/markitup/jquery/markitup/sets/txt2tags/code.png +0 -0
  395. data/templates/markitup/jquery/markitup/sets/txt2tags/disconnect.png +0 -0
  396. data/templates/markitup/jquery/markitup/sets/txt2tags/h1.png +0 -0
  397. data/templates/markitup/jquery/markitup/sets/txt2tags/h2.png +0 -0
  398. data/templates/markitup/jquery/markitup/sets/txt2tags/h3.png +0 -0
  399. data/templates/markitup/jquery/markitup/sets/txt2tags/h4.png +0 -0
  400. data/templates/markitup/jquery/markitup/sets/txt2tags/h5.png +0 -0
  401. data/templates/markitup/jquery/markitup/sets/txt2tags/italic.png +0 -0
  402. data/templates/markitup/jquery/markitup/sets/txt2tags/link.png +0 -0
  403. data/templates/markitup/jquery/markitup/sets/txt2tags/list-bullet.png +0 -0
  404. data/templates/markitup/jquery/markitup/sets/txt2tags/list-numeric.png +0 -0
  405. data/templates/markitup/jquery/markitup/sets/txt2tags/picture.png +0 -0
  406. data/templates/markitup/jquery/markitup/sets/txt2tags/preview.png +0 -0
  407. data/templates/markitup/jquery/markitup/sets/txt2tags/quotes.png +0 -0
  408. data/templates/markitup/jquery/markitup/sets/txt2tags/stroke.png +0 -0
  409. data/templates/markitup/jquery/markitup/sets/txt2tags/underline.png +0 -0
  410. data/templates/markitup/jquery/markitup/sets/wiki.scss +42 -0
  411. data/templates/markitup/jquery/markitup/sets/wiki/bold.png +0 -0
  412. data/templates/markitup/jquery/markitup/sets/wiki/code.png +0 -0
  413. data/templates/markitup/jquery/markitup/sets/wiki/h1.png +0 -0
  414. data/templates/markitup/jquery/markitup/sets/wiki/h2.png +0 -0
  415. data/templates/markitup/jquery/markitup/sets/wiki/h3.png +0 -0
  416. data/templates/markitup/jquery/markitup/sets/wiki/h4.png +0 -0
  417. data/templates/markitup/jquery/markitup/sets/wiki/h5.png +0 -0
  418. data/templates/markitup/jquery/markitup/sets/wiki/h6.png +0 -0
  419. data/templates/markitup/jquery/markitup/sets/wiki/italic.png +0 -0
  420. data/templates/markitup/jquery/markitup/sets/wiki/link.png +0 -0
  421. data/templates/markitup/jquery/markitup/sets/wiki/list-bullet.png +0 -0
  422. data/templates/markitup/jquery/markitup/sets/wiki/list-numeric.png +0 -0
  423. data/templates/markitup/jquery/markitup/sets/wiki/picture.png +0 -0
  424. data/templates/markitup/jquery/markitup/sets/wiki/preview.png +0 -0
  425. data/templates/markitup/jquery/markitup/sets/wiki/quotes.png +0 -0
  426. data/templates/markitup/jquery/markitup/sets/wiki/stroke.png +0 -0
  427. data/templates/markitup/jquery/markitup/sets/wiki/table.png +0 -0
  428. data/templates/markitup/jquery/markitup/sets/wiki/url.png +0 -0
  429. data/templates/markitup/jquery/markitup/sets/xbbcode.scss +42 -0
  430. data/templates/markitup/jquery/markitup/sets/xbbcode/bold.png +0 -0
  431. data/templates/markitup/jquery/markitup/sets/xbbcode/clean.png +0 -0
  432. data/templates/markitup/jquery/markitup/sets/xbbcode/h1.png +0 -0
  433. data/templates/markitup/jquery/markitup/sets/xbbcode/h2.png +0 -0
  434. data/templates/markitup/jquery/markitup/sets/xbbcode/h3.png +0 -0
  435. data/templates/markitup/jquery/markitup/sets/xbbcode/h4.png +0 -0
  436. data/templates/markitup/jquery/markitup/sets/xbbcode/h5.png +0 -0
  437. data/templates/markitup/jquery/markitup/sets/xbbcode/h6.png +0 -0
  438. data/templates/markitup/jquery/markitup/sets/xbbcode/image.png +0 -0
  439. data/templates/markitup/jquery/markitup/sets/xbbcode/italic.png +0 -0
  440. data/templates/markitup/jquery/markitup/sets/xbbcode/link.png +0 -0
  441. data/templates/markitup/jquery/markitup/sets/xbbcode/list-bullet.png +0 -0
  442. data/templates/markitup/jquery/markitup/sets/xbbcode/list-item.png +0 -0
  443. data/templates/markitup/jquery/markitup/sets/xbbcode/list-numeric.png +0 -0
  444. data/templates/markitup/jquery/markitup/sets/xbbcode/paragraph.png +0 -0
  445. data/templates/markitup/jquery/markitup/sets/xbbcode/picture.png +0 -0
  446. data/templates/markitup/jquery/markitup/sets/xbbcode/preview.png +0 -0
  447. data/templates/markitup/jquery/markitup/sets/xbbcode/stroke.png +0 -0
  448. data/templates/markitup/jquery/markitup/skins/aqua.scss +136 -0
  449. data/templates/markitup/jquery/markitup/skins/aqua/bg-container-white.png +0 -0
  450. data/templates/markitup/jquery/markitup/skins/aqua/bg-container.png +0 -0
  451. data/templates/markitup/jquery/markitup/skins/aqua/bg-footer-white.png +0 -0
  452. data/templates/markitup/jquery/markitup/skins/aqua/bg-footer.png +0 -0
  453. data/templates/markitup/jquery/markitup/skins/aqua/bg-header-white.png +0 -0
  454. data/templates/markitup/jquery/markitup/skins/aqua/bg-header.png +0 -0
  455. data/templates/markitup/jquery/markitup/skins/aqua/handle.png +0 -0
  456. data/templates/markitup/jquery/markitup/skins/aqua/menu.png +0 -0
  457. data/templates/markitup/jquery/markitup/skins/aqua/spacer.gif +0 -0
  458. data/templates/markitup/jquery/markitup/skins/aqua/submenu.png +0 -0
  459. data/templates/markitup/jquery/markitup/skins/jtageditor.scss +141 -0
  460. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-container.png +0 -0
  461. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-bbcode.png +0 -0
  462. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-dotclear.png +0 -0
  463. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-html.png +0 -0
  464. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-markdown.png +0 -0
  465. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-textile.png +0 -0
  466. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-wiki.png +0 -0
  467. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor.png +0 -0
  468. data/templates/markitup/jquery/markitup/skins/jtageditor/handle.png +0 -0
  469. data/templates/markitup/jquery/markitup/skins/jtageditor/menu.png +0 -0
  470. data/templates/markitup/jquery/markitup/skins/jtageditor/submenu.png +0 -0
  471. data/templates/markitup/jquery/markitup/skins/live.scss +135 -0
  472. data/templates/markitup/jquery/markitup/skins/live/bg-container.png +0 -0
  473. data/templates/markitup/jquery/markitup/skins/live/bg-footer.png +0 -0
  474. data/templates/markitup/jquery/markitup/skins/live/bg-header.png +0 -0
  475. data/templates/markitup/jquery/markitup/skins/live/editor.png +0 -0
  476. data/templates/markitup/jquery/markitup/skins/live/handle.png +0 -0
  477. data/templates/markitup/jquery/markitup/skins/live/menu.png +0 -0
  478. data/templates/markitup/jquery/markitup/skins/live/submenu.png +0 -0
  479. data/templates/markitup/jquery/markitup/skins/markitup.scss +150 -0
  480. data/templates/markitup/jquery/markitup/skins/markitup/bg-container.png +0 -0
  481. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-bbcode.png +0 -0
  482. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-dotclear.png +0 -0
  483. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-html.png +0 -0
  484. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-json.png +0 -0
  485. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-markdown.png +0 -0
  486. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-textile.png +0 -0
  487. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-wiki.png +0 -0
  488. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-xml.png +0 -0
  489. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor.png +0 -0
  490. data/templates/markitup/jquery/markitup/skins/markitup/handle.png +0 -0
  491. data/templates/markitup/jquery/markitup/skins/markitup/menu.png +0 -0
  492. data/templates/markitup/jquery/markitup/skins/markitup/submenu.png +0 -0
  493. data/templates/markitup/jquery/markitup/skins/simple.scss +117 -0
  494. data/templates/markitup/jquery/markitup/skins/simple/handle.png +0 -0
  495. data/templates/markitup/jquery/markitup/skins/simple/menu.png +0 -0
  496. data/templates/markitup/jquery/markitup/skins/simple/submenu.png +0 -0
  497. data/templates/markitup/manifest.rb +311 -0
  498. data/templates/markitup/markitup/jquery.markitup.set.bbcode.js +40 -0
  499. data/templates/markitup/markitup/jquery.markitup.set.bbcode.min.js +3 -0
  500. data/templates/markitup/markitup/jquery.markitup.set.css.js +53 -0
  501. data/templates/markitup/markitup/jquery.markitup.set.css.min.js +5 -0
  502. data/templates/markitup/markitup/jquery.markitup.set.default.js +30 -0
  503. data/templates/markitup/markitup/jquery.markitup.set.default.min.js +2 -0
  504. data/templates/markitup/markitup/jquery.markitup.set.dotclear.js +38 -0
  505. data/templates/markitup/markitup/jquery.markitup.set.dotclear.min.js +3 -0
  506. data/templates/markitup/markitup/jquery.markitup.set.html.js +40 -0
  507. data/templates/markitup/markitup/jquery.markitup.set.html.min.js +4 -0
  508. data/templates/markitup/markitup/jquery.markitup.set.markdown.js +53 -0
  509. data/templates/markitup/markitup/jquery.markitup.set.markdown.min.js +3 -0
  510. data/templates/markitup/markitup/jquery.markitup.set.markmin.js +50 -0
  511. data/templates/markitup/markitup/jquery.markitup.set.markmin.min.js +3 -0
  512. data/templates/markitup/markitup/jquery.markitup.set.rest.js +52 -0
  513. data/templates/markitup/markitup/jquery.markitup.set.rest.min.js +3 -0
  514. data/templates/markitup/markitup/jquery.markitup.set.textile.js +58 -0
  515. data/templates/markitup/markitup/jquery.markitup.set.textile.min.js +4 -0
  516. data/templates/markitup/markitup/jquery.markitup.set.texy.js +52 -0
  517. data/templates/markitup/markitup/jquery.markitup.set.texy.min.js +4 -0
  518. data/templates/markitup/markitup/jquery.markitup.set.txt2tags.js +42 -0
  519. data/templates/markitup/markitup/jquery.markitup.set.txt2tags.min.js +3 -0
  520. data/templates/markitup/markitup/jquery.markitup.set.wiki.js +61 -0
  521. data/templates/markitup/markitup/jquery.markitup.set.wiki.min.js +4 -0
  522. data/templates/markitup/markitup/jquery.markitup.set.xbbcode.js +36 -0
  523. data/templates/markitup/markitup/jquery.markitup.set.xbbcode.min.js +4 -0
  524. data/templates/mobile/config/initializers/mobile.rb +2 -0
  525. data/templates/mobile/jquery.mobile.js +4545 -4454
  526. data/templates/mobile/jquery.mobile.min.js +16 -7
  527. data/templates/mobile/jquery/mobile/960.fluid.scss +191 -0
  528. data/templates/mobile/jquery/mobile/960.scss +213 -0
  529. data/templates/mobile/jquery/mobile/_base.scss +37 -20
  530. data/templates/mobile/jquery/mobile/default.scss +48 -56
  531. data/templates/mobile/jquery/mobile/valencia.scss +43 -44
  532. data/templates/mobile/manifest.rb +2 -0
  533. data/templates/ribbon/jquery.ribbon.js +195 -195
  534. data/templates/ribbon/jquery.ribbon.min.js +1 -1
  535. data/templates/ribbon/jquery/ribbon/office.scss +12 -12
  536. data/templates/ribbon/jquery/ribbon/windows7.scss +12 -12
  537. data/templates/secret_sauce/secret_sauce.js +8 -8
  538. data/templates/tools/flowplayer.js +897 -897
  539. data/templates/tools/jquery.tools.js +3647 -3647
  540. data/templates/tools/jquery.tools.min.js +47 -47
  541. data/templates/tools/swfobject.js +760 -760
  542. metadata +350 -22
@@ -7,20 +7,20 @@
7
7
 
8
8
  (function($) {
9
9
 
10
- // Parameters are:
11
- // time for fadeIn
12
- // time the message is shown
13
- // time for fadeOut
10
+ // Parameters are:
11
+ // time for fadeIn
12
+ // time the message is shown
13
+ // time for fadeOut
14
14
 
15
- $.fn.flashMessages = function(timeIn, timeStay, timeOut) {
15
+ $.fn.flashMessages = function(timeIn, timeStay, timeOut) {
16
16
 
17
- var el = $(this.selector + " .success, " + this.selector + " .notice, " + this.selector + " .warning, " + this.selector + " .error");
18
- el.fadeIn(timeIn);
19
- el.queue(function() {
20
- setTimeout(function() {
21
- el.dequeue();
22
- }, timeStay);
23
- });
24
- el.fadeOut(timeOut);
25
- };
17
+ var el = $(this.selector + " .success, " + this.selector + " .notice, " + this.selector + " .warning, " + this.selector + " .error");
18
+ el.fadeIn(timeIn);
19
+ el.queue(function() {
20
+ setTimeout(function() {
21
+ el.dequeue();
22
+ }, timeStay);
23
+ });
24
+ el.fadeOut(timeOut);
25
+ };
26
26
  })(jQuery);
@@ -11,820 +11,820 @@
11
11
  ;
12
12
  (function($) {
13
13
 
14
- /*
15
- Usage Note:
16
- -----------
17
- Do not use both ajaxSubmit and ajaxForm on the same form. These
18
- functions are intended to be exclusive. Use ajaxSubmit if you want
19
- to bind your own submit handler to the form. For example,
20
-
21
- $(document).ready(function() {
22
- $('#myForm').bind('submit', function(e) {
23
- e.preventDefault(); // <-- important
24
- $(this).ajaxSubmit({
25
- target: '#output'
26
- });
27
- });
28
- });
29
-
30
- Use ajaxForm when you want the plugin to manage all the event binding
31
- for you. For example,
32
-
33
- $(document).ready(function() {
34
- $('#myForm').ajaxForm({
35
- target: '#output'
36
- });
37
- });
38
-
39
- When using ajaxForm, the ajaxSubmit function will be invoked for you
40
- at the appropriate time.
41
- */
42
-
43
- /**
44
- * ajaxSubmit() provides a mechanism for immediately submitting
45
- * an HTML form using AJAX.
46
- */
47
- $.fn.ajaxSubmit = function(options) {
48
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
49
- if (!this.length) {
50
- log('ajaxSubmit: skipping submit process - no element selected');
51
- return this;
52
- }
14
+ /*
15
+ Usage Note:
16
+ -----------
17
+ Do not use both ajaxSubmit and ajaxForm on the same form. These
18
+ functions are intended to be exclusive. Use ajaxSubmit if you want
19
+ to bind your own submit handler to the form. For example,
20
+
21
+ $(document).ready(function() {
22
+ $('#myForm').bind('submit', function(e) {
23
+ e.preventDefault(); // <-- important
24
+ $(this).ajaxSubmit({
25
+ target: '#output'
26
+ });
27
+ });
28
+ });
29
+
30
+ Use ajaxForm when you want the plugin to manage all the event binding
31
+ for you. For example,
32
+
33
+ $(document).ready(function() {
34
+ $('#myForm').ajaxForm({
35
+ target: '#output'
36
+ });
37
+ });
38
+
39
+ When using ajaxForm, the ajaxSubmit function will be invoked for you
40
+ at the appropriate time.
41
+ */
42
+
43
+ /**
44
+ * ajaxSubmit() provides a mechanism for immediately submitting
45
+ * an HTML form using AJAX.
46
+ */
47
+ $.fn.ajaxSubmit = function(options) {
48
+ // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
49
+ if (!this.length) {
50
+ log('ajaxSubmit: skipping submit process - no element selected');
51
+ return this;
52
+ }
53
53
 
54
- if (typeof options == 'function') {
55
- options = { success: options };
56
- }
54
+ if (typeof options == 'function') {
55
+ options = { success: options };
56
+ }
57
+
58
+ var action = this.attr('action');
59
+ var url = (typeof action === 'string') ? $.trim(action) : '';
60
+ if (url) {
61
+ // clean url (don't include hash vaue)
62
+ url = (url.match(/^([^#]+)/) || [])[1];
63
+ }
64
+ url = url || window.location.href || '';
65
+
66
+ options = $.extend(true, {
67
+ url: url,
68
+ type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
69
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
70
+ }, options);
71
+
72
+ // hook for manipulating the form data before it is extracted;
73
+ // convenient for use with rich editors like tinyMCE or FCKEditor
74
+ var veto = {};
75
+ this.trigger('form-pre-serialize', [this, options, veto]);
76
+ if (veto.veto) {
77
+ log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
78
+ return this;
79
+ }
80
+
81
+ // provide opportunity to alter form data before it is serialized
82
+ if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
83
+ log('ajaxSubmit: submit aborted via beforeSerialize callback');
84
+ return this;
85
+ }
57
86
 
58
- var action = this.attr('action');
59
- var url = (typeof action === 'string') ? $.trim(action) : '';
60
- if (url) {
61
- // clean url (don't include hash vaue)
62
- url = (url.match(/^([^#]+)/) || [])[1];
87
+ var n,v,a = this.formToArray(options.semantic);
88
+ if (options.data) {
89
+ options.extraData = options.data;
90
+ for (n in options.data) {
91
+ if (options.data[n] instanceof Array) {
92
+ for (var k in options.data[n]) {
93
+ a.push({ name: n, value: options.data[n][k] });
94
+ }
63
95
  }
64
- url = url || window.location.href || '';
65
-
66
- options = $.extend(true, {
67
- url: url,
68
- type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
69
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
70
- }, options);
71
-
72
- // hook for manipulating the form data before it is extracted;
73
- // convenient for use with rich editors like tinyMCE or FCKEditor
74
- var veto = {};
75
- this.trigger('form-pre-serialize', [this, options, veto]);
76
- if (veto.veto) {
77
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
78
- return this;
96
+ else {
97
+ v = options.data[n];
98
+ v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
99
+ a.push({ name: n, value: v });
79
100
  }
101
+ }
102
+ }
80
103
 
81
- // provide opportunity to alter form data before it is serialized
82
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
83
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
84
- return this;
85
- }
104
+ // give pre-submit callback an opportunity to abort the submit
105
+ if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
106
+ log('ajaxSubmit: submit aborted via beforeSubmit callback');
107
+ return this;
108
+ }
86
109
 
87
- var n,v,a = this.formToArray(options.semantic);
88
- if (options.data) {
89
- options.extraData = options.data;
90
- for (n in options.data) {
91
- if (options.data[n] instanceof Array) {
92
- for (var k in options.data[n]) {
93
- a.push({ name: n, value: options.data[n][k] });
94
- }
95
- }
96
- else {
97
- v = options.data[n];
98
- v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
99
- a.push({ name: n, value: v });
100
- }
101
- }
102
- }
110
+ // fire vetoable 'validate' event
111
+ this.trigger('form-submit-validate', [a, this, options, veto]);
112
+ if (veto.veto) {
113
+ log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
114
+ return this;
115
+ }
103
116
 
104
- // give pre-submit callback an opportunity to abort the submit
105
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
106
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
107
- return this;
108
- }
117
+ var q = $.param(a);
109
118
 
110
- // fire vetoable 'validate' event
111
- this.trigger('form-submit-validate', [a, this, options, veto]);
112
- if (veto.veto) {
113
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
114
- return this;
115
- }
119
+ if (options.type.toUpperCase() == 'GET') {
120
+ options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
121
+ options.data = null; // data is null for 'get'
122
+ }
123
+ else {
124
+ options.data = q; // data is the query string for 'post'
125
+ }
126
+
127
+ var $form = this, callbacks = [];
128
+ if (options.resetForm) {
129
+ callbacks.push(function() {
130
+ $form.resetForm();
131
+ });
132
+ }
133
+ if (options.clearForm) {
134
+ callbacks.push(function() {
135
+ $form.clearForm();
136
+ });
137
+ }
138
+
139
+ // perform a load on the target only if dataType is not provided
140
+ if (!options.dataType && options.target) {
141
+ var oldSuccess = options.success || function() {
142
+ };
143
+ callbacks.push(function(data) {
144
+ var fn = options.replaceTarget ? 'replaceWith' : 'html';
145
+ $(options.target)[fn](data).each(oldSuccess, arguments);
146
+ });
147
+ }
148
+ else if (options.success) {
149
+ callbacks.push(options.success);
150
+ }
151
+
152
+ options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
153
+ var context = options.context || options; // jQuery 1.4+ supports scope context
154
+ for (var i = 0, max = callbacks.length; i < max; i++) {
155
+ callbacks[i].apply(context, [data, status, xhr || $form, $form]);
156
+ }
157
+ };
116
158
 
117
- var q = $.param(a);
159
+ // are there files to upload?
160
+ var fileInputs = $('input:file', this).length > 0;
161
+ var mp = 'multipart/form-data';
162
+ var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
163
+
164
+ // options.iframe allows user to force iframe mode
165
+ // 06-NOV-09: now defaulting to iframe mode if file input is detected
166
+ if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
167
+ // hack to fix Safari hang (thanks to Tim Molendijk for this)
168
+ // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
169
+ if (options.closeKeepAlive) {
170
+ $.get(options.closeKeepAlive, fileUpload);
171
+ }
172
+ else {
173
+ fileUpload();
174
+ }
175
+ }
176
+ else {
177
+ $.ajax(options);
178
+ }
118
179
 
119
- if (options.type.toUpperCase() == 'GET') {
120
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
121
- options.data = null; // data is null for 'get'
180
+ // fire 'notify' event
181
+ this.trigger('form-submit-notify', [this, options]);
182
+ return this;
183
+
184
+
185
+ // private function for handling file uploads (hat tip to YAHOO!)
186
+ function fileUpload() {
187
+ var form = $form[0];
188
+
189
+ if ($(':input[name=submit],:input[id=submit]', form).length) {
190
+ // if there is an input with a name or id of 'submit' then we won't be
191
+ // able to invoke the submit fn on the form (at least not x-browser)
192
+ alert('Error: Form elements must not have name or id of "submit".');
193
+ return;
194
+ }
195
+
196
+ var s = $.extend(true, {}, $.ajaxSettings, options);
197
+ s.context = s.context || s;
198
+ var id = 'jqFormIO' + (new Date().getTime()), fn = '_' + id;
199
+ var $io = $('<iframe id="' + id + '" name="' + id + '" src="' + s.iframeSrc + '" />');
200
+ var io = $io[0];
201
+
202
+ $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
203
+
204
+ var xhr = { // mock object
205
+ aborted: 0,
206
+ responseText: null,
207
+ responseXML: null,
208
+ status: 0,
209
+ statusText: 'n/a',
210
+ getAllResponseHeaders: function() {
211
+ },
212
+ getResponseHeader: function() {
213
+ },
214
+ setRequestHeader: function() {
215
+ },
216
+ abort: function() {
217
+ log('aborting upload...');
218
+ var e = 'aborted';
219
+ this.aborted = 1;
220
+ $io.attr('src', s.iframeSrc); // abort op in progress
221
+ xhr.error = e;
222
+ s.error && s.error.call(s.context, xhr, 'error', e);
223
+ g && $.event.trigger("ajaxError", [xhr, s, e]);
224
+ s.complete && s.complete.call(s.context, xhr, 'error');
122
225
  }
123
- else {
124
- options.data = q; // data is the query string for 'post'
226
+ };
227
+
228
+ var g = s.global;
229
+ // trigger ajax global events so that activity/block indicators work like normal
230
+ if (g && ! $.active++) {
231
+ $.event.trigger("ajaxStart");
232
+ }
233
+ if (g) {
234
+ $.event.trigger("ajaxSend", [xhr, s]);
235
+ }
236
+
237
+ if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
238
+ if (s.global) {
239
+ $.active--;
125
240
  }
241
+ return;
242
+ }
243
+ if (xhr.aborted) {
244
+ return;
245
+ }
246
+
247
+ var timedOut = 0;
248
+
249
+ // add submitting element to data if we know it
250
+ var sub = form.clk;
251
+ if (sub) {
252
+ var n = sub.name;
253
+ if (n && !sub.disabled) {
254
+ s.extraData = s.extraData || {};
255
+ s.extraData[n] = sub.value;
256
+ if (sub.type == "image") {
257
+ s.extraData[n + '.x'] = form.clk_x;
258
+ s.extraData[n + '.y'] = form.clk_y;
259
+ }
260
+ }
261
+ }
262
+
263
+ // take a breath so that pending repaints get some cpu time before the upload starts
264
+ function doSubmit() {
265
+ // make sure form attrs are set
266
+ var t = $form.attr('target'), a = $form.attr('action');
126
267
 
127
- var $form = this, callbacks = [];
128
- if (options.resetForm) {
129
- callbacks.push(function() {
130
- $form.resetForm();
131
- });
268
+ // update form attrs in IE friendly way
269
+ form.setAttribute('target', id);
270
+ if (form.getAttribute('method') != 'POST') {
271
+ form.setAttribute('method', 'POST');
132
272
  }
133
- if (options.clearForm) {
134
- callbacks.push(function() {
135
- $form.clearForm();
136
- });
273
+ if (form.getAttribute('action') != s.url) {
274
+ form.setAttribute('action', s.url);
137
275
  }
138
276
 
139
- // perform a load on the target only if dataType is not provided
140
- if (!options.dataType && options.target) {
141
- var oldSuccess = options.success || function() {
142
- };
143
- callbacks.push(function(data) {
144
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
145
- $(options.target)[fn](data).each(oldSuccess, arguments);
146
- });
277
+ // ie borks in some cases when setting encoding
278
+ if (! s.skipEncodingOverride) {
279
+ $form.attr({
280
+ encoding: 'multipart/form-data',
281
+ enctype: 'multipart/form-data'
282
+ });
147
283
  }
148
- else if (options.success) {
149
- callbacks.push(options.success);
284
+
285
+ // support timout
286
+ if (s.timeout) {
287
+ setTimeout(function() {
288
+ timedOut = true;
289
+ cb();
290
+ }, s.timeout);
150
291
  }
151
292
 
152
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
153
- var context = options.context || options; // jQuery 1.4+ supports scope context
154
- for (var i = 0, max = callbacks.length; i < max; i++) {
155
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
156
- }
157
- };
158
-
159
- // are there files to upload?
160
- var fileInputs = $('input:file', this).length > 0;
161
- var mp = 'multipart/form-data';
162
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
163
-
164
- // options.iframe allows user to force iframe mode
165
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
166
- if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
167
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
168
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
169
- if (options.closeKeepAlive) {
170
- $.get(options.closeKeepAlive, fileUpload);
171
- }
172
- else {
173
- fileUpload();
174
- }
293
+ // add "extra" data to form if provided in options
294
+ var extraInputs = [];
295
+ try {
296
+ if (s.extraData) {
297
+ for (var n in s.extraData) {
298
+ extraInputs.push(
299
+ $('<input type="hidden" name="' + n + '" value="' + s.extraData[n] + '" />')
300
+ .appendTo(form)[0]);
301
+ }
302
+ }
303
+
304
+ // add iframe to doc and submit the form
305
+ $io.appendTo('body');
306
+ io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
307
+ form.submit();
175
308
  }
176
- else {
177
- $.ajax(options);
309
+ finally {
310
+ // reset attrs and remove "extra" input elements
311
+ form.setAttribute('action', a);
312
+ if (t) {
313
+ form.setAttribute('target', t);
314
+ } else {
315
+ $form.removeAttr('target');
316
+ }
317
+ $(extraInputs).remove();
178
318
  }
319
+ }
179
320
 
180
- // fire 'notify' event
181
- this.trigger('form-submit-notify', [this, options]);
182
- return this;
183
-
321
+ if (s.forceSync) {
322
+ doSubmit();
323
+ }
324
+ else {
325
+ setTimeout(doSubmit, 10); // this lets dom updates render
326
+ }
184
327
 
185
- // private function for handling file uploads (hat tip to YAHOO!)
186
- function fileUpload() {
187
- var form = $form[0];
188
-
189
- if ($(':input[name=submit],:input[id=submit]', form).length) {
190
- // if there is an input with a name or id of 'submit' then we won't be
191
- // able to invoke the submit fn on the form (at least not x-browser)
192
- alert('Error: Form elements must not have name or id of "submit".');
193
- return;
194
- }
195
-
196
- var s = $.extend(true, {}, $.ajaxSettings, options);
197
- s.context = s.context || s;
198
- var id = 'jqFormIO' + (new Date().getTime()), fn = '_' + id;
199
- var $io = $('<iframe id="' + id + '" name="' + id + '" src="' + s.iframeSrc + '" />');
200
- var io = $io[0];
201
-
202
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
203
-
204
- var xhr = { // mock object
205
- aborted: 0,
206
- responseText: null,
207
- responseXML: null,
208
- status: 0,
209
- statusText: 'n/a',
210
- getAllResponseHeaders: function() {
211
- },
212
- getResponseHeader: function() {
213
- },
214
- setRequestHeader: function() {
215
- },
216
- abort: function() {
217
- log('aborting upload...');
218
- var e = 'aborted';
219
- this.aborted = 1;
220
- $io.attr('src', s.iframeSrc); // abort op in progress
221
- xhr.error = e;
222
- s.error && s.error.call(s.context, xhr, 'error', e);
223
- g && $.event.trigger("ajaxError", [xhr, s, e]);
224
- s.complete && s.complete.call(s.context, xhr, 'error');
225
- }
226
- };
227
-
228
- var g = s.global;
229
- // trigger ajax global events so that activity/block indicators work like normal
230
- if (g && ! $.active++) {
231
- $.event.trigger("ajaxStart");
232
- }
233
- if (g) {
234
- $.event.trigger("ajaxSend", [xhr, s]);
235
- }
236
-
237
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
238
- if (s.global) {
239
- $.active--;
240
- }
241
- return;
242
- }
243
- if (xhr.aborted) {
244
- return;
245
- }
246
-
247
- var timedOut = 0;
248
-
249
- // add submitting element to data if we know it
250
- var sub = form.clk;
251
- if (sub) {
252
- var n = sub.name;
253
- if (n && !sub.disabled) {
254
- s.extraData = s.extraData || {};
255
- s.extraData[n] = sub.value;
256
- if (sub.type == "image") {
257
- s.extraData[n + '.x'] = form.clk_x;
258
- s.extraData[n + '.y'] = form.clk_y;
259
- }
260
- }
261
- }
328
+ var data, doc, domCheckCount = 50;
262
329
 
263
- // take a breath so that pending repaints get some cpu time before the upload starts
264
- function doSubmit() {
265
- // make sure form attrs are set
266
- var t = $form.attr('target'), a = $form.attr('action');
267
-
268
- // update form attrs in IE friendly way
269
- form.setAttribute('target', id);
270
- if (form.getAttribute('method') != 'POST') {
271
- form.setAttribute('method', 'POST');
272
- }
273
- if (form.getAttribute('action') != s.url) {
274
- form.setAttribute('action', s.url);
275
- }
276
-
277
- // ie borks in some cases when setting encoding
278
- if (! s.skipEncodingOverride) {
279
- $form.attr({
280
- encoding: 'multipart/form-data',
281
- enctype: 'multipart/form-data'
282
- });
283
- }
284
-
285
- // support timout
286
- if (s.timeout) {
287
- setTimeout(function() {
288
- timedOut = true;
289
- cb();
290
- }, s.timeout);
291
- }
292
-
293
- // add "extra" data to form if provided in options
294
- var extraInputs = [];
295
- try {
296
- if (s.extraData) {
297
- for (var n in s.extraData) {
298
- extraInputs.push(
299
- $('<input type="hidden" name="' + n + '" value="' + s.extraData[n] + '" />')
300
- .appendTo(form)[0]);
301
- }
302
- }
303
-
304
- // add iframe to doc and submit the form
305
- $io.appendTo('body');
306
- io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
307
- form.submit();
308
- }
309
- finally {
310
- // reset attrs and remove "extra" input elements
311
- form.setAttribute('action', a);
312
- if (t) {
313
- form.setAttribute('target', t);
314
- } else {
315
- $form.removeAttr('target');
316
- }
317
- $(extraInputs).remove();
318
- }
319
- }
320
-
321
- if (s.forceSync) {
322
- doSubmit();
323
- }
324
- else {
325
- setTimeout(doSubmit, 10); // this lets dom updates render
326
- }
327
-
328
- var data, doc, domCheckCount = 50;
329
-
330
- function cb() {
331
- if (xhr.aborted) {
332
- return;
333
- }
334
-
335
- var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
336
- if (!doc || doc.location.href == s.iframeSrc) {
337
- // response not received yet
338
- return;
339
- }
340
- io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
341
-
342
- var ok = true;
343
- try {
344
- if (timedOut) {
345
- throw 'timeout';
346
- }
347
-
348
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
349
- log('isXml=' + isXml);
350
- if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
351
- if (--domCheckCount) {
352
- // in some browsers (Opera) the iframe DOM is not always traversable when
353
- // the onload callback fires, so we loop a bit to accommodate
354
- log('requeing onLoad callback, DOM not available');
355
- setTimeout(cb, 250);
356
- return;
357
- }
358
- // let this fall through because server response could be an empty document
359
- //log('Could not access iframe DOM after mutiple tries.');
360
- //throw 'DOMException: not available';
361
- }
362
-
363
- //log('response detected');
364
- xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
365
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
366
- xhr.getResponseHeader = function(header) {
367
- var headers = {'content-type': s.dataType};
368
- return headers[header];
369
- };
370
-
371
- var scr = /(json|script)/.test(s.dataType);
372
- if (scr || s.textarea) {
373
- // see if user embedded response in textarea
374
- var ta = doc.getElementsByTagName('textarea')[0];
375
- if (ta) {
376
- xhr.responseText = ta.value;
377
- }
378
- else if (scr) {
379
- // account for browsers injecting pre around json response
380
- var pre = doc.getElementsByTagName('pre')[0];
381
- var b = doc.getElementsByTagName('body')[0];
382
- if (pre) {
383
- xhr.responseText = pre.textContent;
384
- }
385
- else if (b) {
386
- xhr.responseText = b.innerHTML;
387
- }
388
- }
389
- }
390
- else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
391
- xhr.responseXML = toXml(xhr.responseText);
392
- }
393
-
394
- data = httpData(xhr, s.dataType, s);
395
- }
396
- catch(e) {
397
- log('error caught:', e);
398
- ok = false;
399
- xhr.error = e;
400
- s.error && s.error.call(s.context, xhr, 'error', e);
401
- g && $.event.trigger("ajaxError", [xhr, s, e]);
402
- }
403
-
404
- if (xhr.aborted) {
405
- log('upload aborted');
406
- ok = false;
407
- }
408
-
409
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
410
- if (ok) {
411
- s.success && s.success.call(s.context, data, 'success', xhr);
412
- g && $.event.trigger("ajaxSuccess", [xhr, s]);
413
- }
414
-
415
- g && $.event.trigger("ajaxComplete", [xhr, s]);
416
-
417
- if (g && ! --$.active) {
418
- $.event.trigger("ajaxStop");
419
- }
420
-
421
- s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
422
-
423
- // clean up
424
- setTimeout(function() {
425
- $io.removeData('form-plugin-onload');
426
- $io.remove();
427
- xhr.responseXML = null;
428
- }, 100);
429
- }
430
-
431
- var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
432
- if (window.ActiveXObject) {
433
- doc = new ActiveXObject('Microsoft.XMLDOM');
434
- doc.async = 'false';
435
- doc.loadXML(s);
436
- }
437
- else {
438
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
439
- }
440
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
441
- };
442
- var parseJSON = $.parseJSON || function(s) {
443
- return window['eval']('(' + s + ')');
444
- };
445
-
446
- var httpData = function(xhr, type, s) { // mostly lifted from jq1.4.4
447
- var ct = xhr.getResponseHeader('content-type') || '',
448
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
449
- data = xml ? xhr.responseXML : xhr.responseText;
450
-
451
- if (xml && data.documentElement.nodeName === 'parsererror') {
452
- $.error && $.error('parsererror');
453
- }
454
- if (s && s.dataFilter) {
455
- data = s.dataFilter(data, type);
456
- }
457
- if (typeof data === 'string') {
458
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
459
- data = parseJSON(data);
460
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
461
- $.globalEval(data);
462
- }
463
- }
464
- return data;
465
- };
330
+ function cb() {
331
+ if (xhr.aborted) {
332
+ return;
466
333
  }
467
- };
468
334
 
469
- /**
470
- * ajaxForm() provides a mechanism for fully automating form submission.
471
- *
472
- * The advantages of using this method instead of ajaxSubmit() are:
473
- *
474
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
475
- * is used to submit the form).
476
- * 2. This method will include the submit element's name/value data (for the element that was
477
- * used to submit the form).
478
- * 3. This method binds the submit() method to the form for you.
479
- *
480
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
481
- * passes the options argument along after properly binding events for submit elements and
482
- * the form itself.
483
- */
484
- $.fn.ajaxForm = function(options) {
485
- // in jQuery 1.3+ we can fix mistakes with the ready state
486
- if (this.length === 0) {
487
- var o = { s: this.selector, c: this.context };
488
- if (!$.isReady && o.s) {
489
- log('DOM not ready, queuing ajaxForm');
490
- $(function() {
491
- $(o.s, o.c).ajaxForm(options);
492
- });
493
- return this;
494
- }
495
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
496
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
497
- return this;
335
+ var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
336
+ if (!doc || doc.location.href == s.iframeSrc) {
337
+ // response not received yet
338
+ return;
339
+ }
340
+ io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
341
+
342
+ var ok = true;
343
+ try {
344
+ if (timedOut) {
345
+ throw 'timeout';
346
+ }
347
+
348
+ var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
349
+ log('isXml=' + isXml);
350
+ if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
351
+ if (--domCheckCount) {
352
+ // in some browsers (Opera) the iframe DOM is not always traversable when
353
+ // the onload callback fires, so we loop a bit to accommodate
354
+ log('requeing onLoad callback, DOM not available');
355
+ setTimeout(cb, 250);
356
+ return;
357
+ }
358
+ // let this fall through because server response could be an empty document
359
+ //log('Could not access iframe DOM after mutiple tries.');
360
+ //throw 'DOMException: not available';
361
+ }
362
+
363
+ //log('response detected');
364
+ xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
365
+ xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
366
+ xhr.getResponseHeader = function(header) {
367
+ var headers = {'content-type': s.dataType};
368
+ return headers[header];
369
+ };
370
+
371
+ var scr = /(json|script)/.test(s.dataType);
372
+ if (scr || s.textarea) {
373
+ // see if user embedded response in textarea
374
+ var ta = doc.getElementsByTagName('textarea')[0];
375
+ if (ta) {
376
+ xhr.responseText = ta.value;
377
+ }
378
+ else if (scr) {
379
+ // account for browsers injecting pre around json response
380
+ var pre = doc.getElementsByTagName('pre')[0];
381
+ var b = doc.getElementsByTagName('body')[0];
382
+ if (pre) {
383
+ xhr.responseText = pre.textContent;
384
+ }
385
+ else if (b) {
386
+ xhr.responseText = b.innerHTML;
387
+ }
388
+ }
389
+ }
390
+ else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
391
+ xhr.responseXML = toXml(xhr.responseText);
392
+ }
393
+
394
+ data = httpData(xhr, s.dataType, s);
395
+ }
396
+ catch(e) {
397
+ log('error caught:', e);
398
+ ok = false;
399
+ xhr.error = e;
400
+ s.error && s.error.call(s.context, xhr, 'error', e);
401
+ g && $.event.trigger("ajaxError", [xhr, s, e]);
498
402
  }
499
403
 
500
- return this.ajaxFormUnbind().bind('submit.form-plugin',
501
- function(e) {
502
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
503
- e.preventDefault();
504
- $(this).ajaxSubmit(options);
505
- }
506
- }).bind('click.form-plugin', function(e) {
507
- var target = e.target;
508
- var $el = $(target);
509
- if (!($el.is(":submit,input:image"))) {
510
- // is this a child element of the submit el? (ex: a span within a button)
511
- var t = $el.closest(':submit');
512
- if (t.length == 0) {
513
- return;
514
- }
515
- target = t[0];
516
- }
517
- var form = this;
518
- form.clk = target;
519
- if (target.type == 'image') {
520
- if (e.offsetX != undefined) {
521
- form.clk_x = e.offsetX;
522
- form.clk_y = e.offsetY;
523
- } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
524
- var offset = $el.offset();
525
- form.clk_x = e.pageX - offset.left;
526
- form.clk_y = e.pageY - offset.top;
527
- } else {
528
- form.clk_x = e.pageX - target.offsetLeft;
529
- form.clk_y = e.pageY - target.offsetTop;
530
- }
531
- }
532
- // clear form vars
533
- setTimeout(function() {
534
- form.clk = form.clk_x = form.clk_y = null;
535
- }, 100);
536
- });
537
- };
538
-
539
- // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
540
- $.fn.ajaxFormUnbind = function() {
541
- return this.unbind('submit.form-plugin click.form-plugin');
542
- };
543
-
544
- /**
545
- * formToArray() gathers form element data into an array of objects that can
546
- * be passed to any of the following ajax functions: $.get, $.post, or load.
547
- * Each object in the array has both a 'name' and 'value' property. An example of
548
- * an array for a simple login form might be:
549
- *
550
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
551
- *
552
- * It is this array that is passed to pre-submit callback functions provided to the
553
- * ajaxSubmit() and ajaxForm() methods.
554
- */
555
- $.fn.formToArray = function(semantic) {
556
- var a = [];
557
- if (this.length === 0) {
558
- return a;
404
+ if (xhr.aborted) {
405
+ log('upload aborted');
406
+ ok = false;
559
407
  }
560
408
 
561
- var form = this[0];
562
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
563
- if (!els) {
564
- return a;
409
+ // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
410
+ if (ok) {
411
+ s.success && s.success.call(s.context, data, 'success', xhr);
412
+ g && $.event.trigger("ajaxSuccess", [xhr, s]);
565
413
  }
566
414
 
567
- var i,j,n,v,el,max,jmax;
568
- for (i = 0,max = els.length; i < max; i++) {
569
- el = els[i];
570
- n = el.name;
571
- if (!n) {
572
- continue;
573
- }
415
+ g && $.event.trigger("ajaxComplete", [xhr, s]);
574
416
 
575
- if (semantic && form.clk && el.type == "image") {
576
- // handle image inputs on the fly when semantic == true
577
- if (!el.disabled && form.clk == el) {
578
- a.push({name: n, value: $(el).val()});
579
- a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
580
- }
581
- continue;
582
- }
583
-
584
- v = $.fieldValue(el, true);
585
- if (v && v.constructor == Array) {
586
- for (j = 0,jmax = v.length; j < jmax; j++) {
587
- a.push({name: n, value: v[j]});
588
- }
589
- }
590
- else if (v !== null && typeof v != 'undefined') {
591
- a.push({name: n, value: v});
592
- }
417
+ if (g && ! --$.active) {
418
+ $.event.trigger("ajaxStop");
593
419
  }
594
420
 
595
- if (!semantic && form.clk) {
596
- // input type=='image' are not found in elements array! handle it here
597
- var $input = $(form.clk), input = $input[0];
598
- n = input.name;
599
- if (n && !input.disabled && input.type == 'image') {
600
- a.push({name: n, value: $input.val()});
601
- a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
602
- }
421
+ s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
422
+
423
+ // clean up
424
+ setTimeout(function() {
425
+ $io.removeData('form-plugin-onload');
426
+ $io.remove();
427
+ xhr.responseXML = null;
428
+ }, 100);
429
+ }
430
+
431
+ var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
432
+ if (window.ActiveXObject) {
433
+ doc = new ActiveXObject('Microsoft.XMLDOM');
434
+ doc.async = 'false';
435
+ doc.loadXML(s);
603
436
  }
604
- return a;
605
- };
606
-
607
- /**
608
- * Serializes form data into a 'submittable' string. This method will return a string
609
- * in the format: name1=value1&amp;name2=value2
610
- */
611
- $.fn.formSerialize = function(semantic) {
612
- //hand off to jQuery.param for proper encoding
613
- return $.param(this.formToArray(semantic));
614
- };
615
-
616
- /**
617
- * Serializes all field elements in the jQuery object into a query string.
618
- * This method will return a string in the format: name1=value1&amp;name2=value2
619
- */
620
- $.fn.fieldSerialize = function(successful) {
621
- var a = [];
622
- this.each(function() {
623
- var n = this.name;
624
- if (!n) {
625
- return;
626
- }
627
- var v = $.fieldValue(this, successful);
628
- if (v && v.constructor == Array) {
629
- for (var i = 0,max = v.length; i < max; i++) {
630
- a.push({name: n, value: v[i]});
631
- }
632
- }
633
- else if (v !== null && typeof v != 'undefined') {
634
- a.push({name: this.name, value: v});
635
- }
437
+ else {
438
+ doc = (new DOMParser()).parseFromString(s, 'text/xml');
439
+ }
440
+ return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
441
+ };
442
+ var parseJSON = $.parseJSON || function(s) {
443
+ return window['eval']('(' + s + ')');
444
+ };
445
+
446
+ var httpData = function(xhr, type, s) { // mostly lifted from jq1.4.4
447
+ var ct = xhr.getResponseHeader('content-type') || '',
448
+ xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
449
+ data = xml ? xhr.responseXML : xhr.responseText;
450
+
451
+ if (xml && data.documentElement.nodeName === 'parsererror') {
452
+ $.error && $.error('parsererror');
453
+ }
454
+ if (s && s.dataFilter) {
455
+ data = s.dataFilter(data, type);
456
+ }
457
+ if (typeof data === 'string') {
458
+ if (type === 'json' || !type && ct.indexOf('json') >= 0) {
459
+ data = parseJSON(data);
460
+ } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
461
+ $.globalEval(data);
462
+ }
463
+ }
464
+ return data;
465
+ };
466
+ }
467
+ };
468
+
469
+ /**
470
+ * ajaxForm() provides a mechanism for fully automating form submission.
471
+ *
472
+ * The advantages of using this method instead of ajaxSubmit() are:
473
+ *
474
+ * 1: This method will include coordinates for <input type="image" /> elements (if the element
475
+ * is used to submit the form).
476
+ * 2. This method will include the submit element's name/value data (for the element that was
477
+ * used to submit the form).
478
+ * 3. This method binds the submit() method to the form for you.
479
+ *
480
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
481
+ * passes the options argument along after properly binding events for submit elements and
482
+ * the form itself.
483
+ */
484
+ $.fn.ajaxForm = function(options) {
485
+ // in jQuery 1.3+ we can fix mistakes with the ready state
486
+ if (this.length === 0) {
487
+ var o = { s: this.selector, c: this.context };
488
+ if (!$.isReady && o.s) {
489
+ log('DOM not ready, queuing ajaxForm');
490
+ $(function() {
491
+ $(o.s, o.c).ajaxForm(options);
636
492
  });
637
- //hand off to jQuery.param for proper encoding
638
- return $.param(a);
639
- };
493
+ return this;
494
+ }
495
+ // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
496
+ log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
497
+ return this;
498
+ }
640
499
 
641
- /**
642
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
643
- *
644
- * <form><fieldset>
645
- * <input name="A" type="text" />
646
- * <input name="A" type="text" />
647
- * <input name="B" type="checkbox" value="B1" />
648
- * <input name="B" type="checkbox" value="B2"/>
649
- * <input name="C" type="radio" value="C1" />
650
- * <input name="C" type="radio" value="C2" />
651
- * </fieldset></form>
652
- *
653
- * var v = $(':text').fieldValue();
654
- * // if no values are entered into the text inputs
655
- * v == ['','']
656
- * // if values entered into the text inputs are 'foo' and 'bar'
657
- * v == ['foo','bar']
658
- *
659
- * var v = $(':checkbox').fieldValue();
660
- * // if neither checkbox is checked
661
- * v === undefined
662
- * // if both checkboxes are checked
663
- * v == ['B1', 'B2']
664
- *
665
- * var v = $(':radio').fieldValue();
666
- * // if neither radio is checked
667
- * v === undefined
668
- * // if first radio is checked
669
- * v == ['C1']
670
- *
671
- * The successful argument controls whether or not the field element must be 'successful'
672
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
673
- * The default value of the successful argument is true. If this value is false the value(s)
674
- * for each element is returned.
675
- *
676
- * Note: This method *always* returns an array. If no valid value can be determined the
677
- * array will be empty, otherwise it will contain one or more values.
678
- */
679
- $.fn.fieldValue = function(successful) {
680
- for (var val = [], i = 0, max = this.length; i < max; i++) {
681
- var el = this[i];
682
- var v = $.fieldValue(el, successful);
683
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
684
- continue;
685
- }
686
- v.constructor == Array ? $.merge(val, v) : val.push(v);
500
+ return this.ajaxFormUnbind().bind('submit.form-plugin',
501
+ function(e) {
502
+ if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
503
+ e.preventDefault();
504
+ $(this).ajaxSubmit(options);
505
+ }
506
+ }).bind('click.form-plugin', function(e) {
507
+ var target = e.target;
508
+ var $el = $(target);
509
+ if (!($el.is(":submit,input:image"))) {
510
+ // is this a child element of the submit el? (ex: a span within a button)
511
+ var t = $el.closest(':submit');
512
+ if (t.length == 0) {
513
+ return;
687
514
  }
688
- return val;
689
- };
690
-
691
- /**
692
- * Returns the value of the field element.
693
- */
694
- $.fieldValue = function(el, successful) {
695
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
696
- if (successful === undefined) {
697
- successful = true;
515
+ target = t[0];
516
+ }
517
+ var form = this;
518
+ form.clk = target;
519
+ if (target.type == 'image') {
520
+ if (e.offsetX != undefined) {
521
+ form.clk_x = e.offsetX;
522
+ form.clk_y = e.offsetY;
523
+ } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
524
+ var offset = $el.offset();
525
+ form.clk_x = e.pageX - offset.left;
526
+ form.clk_y = e.pageY - offset.top;
527
+ } else {
528
+ form.clk_x = e.pageX - target.offsetLeft;
529
+ form.clk_y = e.pageY - target.offsetTop;
698
530
  }
531
+ }
532
+ // clear form vars
533
+ setTimeout(function() {
534
+ form.clk = form.clk_x = form.clk_y = null;
535
+ }, 100);
536
+ });
537
+ };
699
538
 
700
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
701
- (t == 'checkbox' || t == 'radio') && !el.checked ||
702
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
703
- tag == 'select' && el.selectedIndex == -1)) {
704
- return null;
705
- }
539
+ // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
540
+ $.fn.ajaxFormUnbind = function() {
541
+ return this.unbind('submit.form-plugin click.form-plugin');
542
+ };
543
+
544
+ /**
545
+ * formToArray() gathers form element data into an array of objects that can
546
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
547
+ * Each object in the array has both a 'name' and 'value' property. An example of
548
+ * an array for a simple login form might be:
549
+ *
550
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
551
+ *
552
+ * It is this array that is passed to pre-submit callback functions provided to the
553
+ * ajaxSubmit() and ajaxForm() methods.
554
+ */
555
+ $.fn.formToArray = function(semantic) {
556
+ var a = [];
557
+ if (this.length === 0) {
558
+ return a;
559
+ }
706
560
 
707
- if (tag == 'select') {
708
- var index = el.selectedIndex;
709
- if (index < 0) {
710
- return null;
711
- }
712
- var a = [], ops = el.options;
713
- var one = (t == 'select-one');
714
- var max = (one ? index + 1 : ops.length);
715
- for (var i = (one ? index : 0); i < max; i++) {
716
- var op = ops[i];
717
- if (op.selected) {
718
- var v = op.value;
719
- if (!v) { // extra pain for IE...
720
- v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
721
- }
722
- if (one) {
723
- return v;
724
- }
725
- a.push(v);
726
- }
727
- }
728
- return a;
561
+ var form = this[0];
562
+ var els = semantic ? form.getElementsByTagName('*') : form.elements;
563
+ if (!els) {
564
+ return a;
565
+ }
566
+
567
+ var i,j,n,v,el,max,jmax;
568
+ for (i = 0,max = els.length; i < max; i++) {
569
+ el = els[i];
570
+ n = el.name;
571
+ if (!n) {
572
+ continue;
573
+ }
574
+
575
+ if (semantic && form.clk && el.type == "image") {
576
+ // handle image inputs on the fly when semantic == true
577
+ if (!el.disabled && form.clk == el) {
578
+ a.push({name: n, value: $(el).val()});
579
+ a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
729
580
  }
730
- return $(el).val();
731
- };
581
+ continue;
582
+ }
732
583
 
733
- /**
734
- * Clears the form data. Takes the following actions on the form's input fields:
735
- * - input text fields will have their 'value' property set to the empty string
736
- * - select elements will have their 'selectedIndex' property set to -1
737
- * - checkbox and radio inputs will have their 'checked' property set to false
738
- * - inputs of type submit, button, reset, and hidden will *not* be effected
739
- * - button elements will *not* be effected
740
- */
741
- $.fn.clearForm = function() {
742
- return this.each(function() {
743
- $('input,select,textarea', this).clearFields();
744
- });
745
- };
584
+ v = $.fieldValue(el, true);
585
+ if (v && v.constructor == Array) {
586
+ for (j = 0,jmax = v.length; j < jmax; j++) {
587
+ a.push({name: n, value: v[j]});
588
+ }
589
+ }
590
+ else if (v !== null && typeof v != 'undefined') {
591
+ a.push({name: n, value: v});
592
+ }
593
+ }
746
594
 
747
- /**
748
- * Clears the selected form elements.
749
- */
750
- $.fn.clearFields = $.fn.clearInputs = function() {
751
- return this.each(function() {
752
- var t = this.type, tag = this.tagName.toLowerCase();
753
- if (t == 'text' || t == 'password' || tag == 'textarea') {
754
- this.value = '';
755
- }
756
- else if (t == 'checkbox' || t == 'radio') {
757
- this.checked = false;
758
- }
759
- else if (tag == 'select') {
760
- this.selectedIndex = -1;
761
- }
762
- });
763
- };
595
+ if (!semantic && form.clk) {
596
+ // input type=='image' are not found in elements array! handle it here
597
+ var $input = $(form.clk), input = $input[0];
598
+ n = input.name;
599
+ if (n && !input.disabled && input.type == 'image') {
600
+ a.push({name: n, value: $input.val()});
601
+ a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
602
+ }
603
+ }
604
+ return a;
605
+ };
606
+
607
+ /**
608
+ * Serializes form data into a 'submittable' string. This method will return a string
609
+ * in the format: name1=value1&amp;name2=value2
610
+ */
611
+ $.fn.formSerialize = function(semantic) {
612
+ //hand off to jQuery.param for proper encoding
613
+ return $.param(this.formToArray(semantic));
614
+ };
615
+
616
+ /**
617
+ * Serializes all field elements in the jQuery object into a query string.
618
+ * This method will return a string in the format: name1=value1&amp;name2=value2
619
+ */
620
+ $.fn.fieldSerialize = function(successful) {
621
+ var a = [];
622
+ this.each(function() {
623
+ var n = this.name;
624
+ if (!n) {
625
+ return;
626
+ }
627
+ var v = $.fieldValue(this, successful);
628
+ if (v && v.constructor == Array) {
629
+ for (var i = 0,max = v.length; i < max; i++) {
630
+ a.push({name: n, value: v[i]});
631
+ }
632
+ }
633
+ else if (v !== null && typeof v != 'undefined') {
634
+ a.push({name: this.name, value: v});
635
+ }
636
+ });
637
+ //hand off to jQuery.param for proper encoding
638
+ return $.param(a);
639
+ };
640
+
641
+ /**
642
+ * Returns the value(s) of the element in the matched set. For example, consider the following form:
643
+ *
644
+ * <form><fieldset>
645
+ * <input name="A" type="text" />
646
+ * <input name="A" type="text" />
647
+ * <input name="B" type="checkbox" value="B1" />
648
+ * <input name="B" type="checkbox" value="B2"/>
649
+ * <input name="C" type="radio" value="C1" />
650
+ * <input name="C" type="radio" value="C2" />
651
+ * </fieldset></form>
652
+ *
653
+ * var v = $(':text').fieldValue();
654
+ * // if no values are entered into the text inputs
655
+ * v == ['','']
656
+ * // if values entered into the text inputs are 'foo' and 'bar'
657
+ * v == ['foo','bar']
658
+ *
659
+ * var v = $(':checkbox').fieldValue();
660
+ * // if neither checkbox is checked
661
+ * v === undefined
662
+ * // if both checkboxes are checked
663
+ * v == ['B1', 'B2']
664
+ *
665
+ * var v = $(':radio').fieldValue();
666
+ * // if neither radio is checked
667
+ * v === undefined
668
+ * // if first radio is checked
669
+ * v == ['C1']
670
+ *
671
+ * The successful argument controls whether or not the field element must be 'successful'
672
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
673
+ * The default value of the successful argument is true. If this value is false the value(s)
674
+ * for each element is returned.
675
+ *
676
+ * Note: This method *always* returns an array. If no valid value can be determined the
677
+ * array will be empty, otherwise it will contain one or more values.
678
+ */
679
+ $.fn.fieldValue = function(successful) {
680
+ for (var val = [], i = 0, max = this.length; i < max; i++) {
681
+ var el = this[i];
682
+ var v = $.fieldValue(el, successful);
683
+ if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
684
+ continue;
685
+ }
686
+ v.constructor == Array ? $.merge(val, v) : val.push(v);
687
+ }
688
+ return val;
689
+ };
690
+
691
+ /**
692
+ * Returns the value of the field element.
693
+ */
694
+ $.fieldValue = function(el, successful) {
695
+ var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
696
+ if (successful === undefined) {
697
+ successful = true;
698
+ }
764
699
 
765
- /**
766
- * Resets the form data. Causes all form elements to be reset to their original value.
767
- */
768
- $.fn.resetForm = function() {
769
- return this.each(function() {
770
- // guard against an input with the name of 'reset'
771
- // note that IE reports the reset function as an 'object'
772
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
773
- this.reset();
774
- }
775
- });
776
- };
700
+ if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
701
+ (t == 'checkbox' || t == 'radio') && !el.checked ||
702
+ (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
703
+ tag == 'select' && el.selectedIndex == -1)) {
704
+ return null;
705
+ }
777
706
 
778
- /**
779
- * Enables or disables any matching elements.
780
- */
781
- $.fn.enable = function(b) {
782
- if (b === undefined) {
783
- b = true;
707
+ if (tag == 'select') {
708
+ var index = el.selectedIndex;
709
+ if (index < 0) {
710
+ return null;
711
+ }
712
+ var a = [], ops = el.options;
713
+ var one = (t == 'select-one');
714
+ var max = (one ? index + 1 : ops.length);
715
+ for (var i = (one ? index : 0); i < max; i++) {
716
+ var op = ops[i];
717
+ if (op.selected) {
718
+ var v = op.value;
719
+ if (!v) { // extra pain for IE...
720
+ v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
721
+ }
722
+ if (one) {
723
+ return v;
724
+ }
725
+ a.push(v);
784
726
  }
785
- return this.each(function() {
786
- this.disabled = !b;
787
- });
788
- };
789
-
790
- /**
791
- * Checks/unchecks any matching checkboxes or radio buttons and
792
- * selects/deselects and matching option elements.
793
- */
794
- $.fn.selected = function(select) {
795
- if (select === undefined) {
796
- select = true;
727
+ }
728
+ return a;
729
+ }
730
+ return $(el).val();
731
+ };
732
+
733
+ /**
734
+ * Clears the form data. Takes the following actions on the form's input fields:
735
+ * - input text fields will have their 'value' property set to the empty string
736
+ * - select elements will have their 'selectedIndex' property set to -1
737
+ * - checkbox and radio inputs will have their 'checked' property set to false
738
+ * - inputs of type submit, button, reset, and hidden will *not* be effected
739
+ * - button elements will *not* be effected
740
+ */
741
+ $.fn.clearForm = function() {
742
+ return this.each(function() {
743
+ $('input,select,textarea', this).clearFields();
744
+ });
745
+ };
746
+
747
+ /**
748
+ * Clears the selected form elements.
749
+ */
750
+ $.fn.clearFields = $.fn.clearInputs = function() {
751
+ return this.each(function() {
752
+ var t = this.type, tag = this.tagName.toLowerCase();
753
+ if (t == 'text' || t == 'password' || tag == 'textarea') {
754
+ this.value = '';
755
+ }
756
+ else if (t == 'checkbox' || t == 'radio') {
757
+ this.checked = false;
758
+ }
759
+ else if (tag == 'select') {
760
+ this.selectedIndex = -1;
761
+ }
762
+ });
763
+ };
764
+
765
+ /**
766
+ * Resets the form data. Causes all form elements to be reset to their original value.
767
+ */
768
+ $.fn.resetForm = function() {
769
+ return this.each(function() {
770
+ // guard against an input with the name of 'reset'
771
+ // note that IE reports the reset function as an 'object'
772
+ if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
773
+ this.reset();
774
+ }
775
+ });
776
+ };
777
+
778
+ /**
779
+ * Enables or disables any matching elements.
780
+ */
781
+ $.fn.enable = function(b) {
782
+ if (b === undefined) {
783
+ b = true;
784
+ }
785
+ return this.each(function() {
786
+ this.disabled = !b;
787
+ });
788
+ };
789
+
790
+ /**
791
+ * Checks/unchecks any matching checkboxes or radio buttons and
792
+ * selects/deselects and matching option elements.
793
+ */
794
+ $.fn.selected = function(select) {
795
+ if (select === undefined) {
796
+ select = true;
797
+ }
798
+ return this.each(function() {
799
+ var t = this.type;
800
+ if (t == 'checkbox' || t == 'radio') {
801
+ this.checked = select;
802
+ }
803
+ else if (this.tagName.toLowerCase() == 'option') {
804
+ var $sel = $(this).parent('select');
805
+ if (select && $sel[0] && $sel[0].type == 'select-one') {
806
+ // deselect all other options
807
+ $sel.find('option').selected(false);
797
808
  }
798
- return this.each(function() {
799
- var t = this.type;
800
- if (t == 'checkbox' || t == 'radio') {
801
- this.checked = select;
802
- }
803
- else if (this.tagName.toLowerCase() == 'option') {
804
- var $sel = $(this).parent('select');
805
- if (select && $sel[0] && $sel[0].type == 'select-one') {
806
- // deselect all other options
807
- $sel.find('option').selected(false);
808
- }
809
- this.selected = select;
810
- }
811
- });
812
- };
809
+ this.selected = select;
810
+ }
811
+ });
812
+ };
813
813
 
814
814
  // helper fn for console logging
815
815
  // set $.fn.ajaxSubmit.debug to true to enable debug logging
816
- function log() {
817
- if ($.fn.ajaxSubmit.debug) {
818
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, '');
819
- if (window.console && window.console.log) {
820
- window.console.log(msg);
821
- }
822
- else if (window.opera && window.opera.postError) {
823
- window.opera.postError(msg);
824
- }
825
- }
816
+ function log() {
817
+ if ($.fn.ajaxSubmit.debug) {
818
+ var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, '');
819
+ if (window.console && window.console.log) {
820
+ window.console.log(msg);
821
+ }
822
+ else if (window.opera && window.opera.postError) {
823
+ window.opera.postError(msg);
824
+ }
826
825
  }
826
+ }
827
827
 
828
- ;
828
+ ;
829
829
 
830
830
  })(jQuery);