jquery-ui-rails 4.2.1 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (293) hide show
  1. checksums.yaml +7 -0
  2. data/.gitmodules +1 -1
  3. data/.travis.yml +1 -1
  4. data/History.md +41 -2
  5. data/README.md +100 -83
  6. data/Rakefile +82 -49
  7. data/VERSIONS.md +9 -0
  8. data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  9. data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
  10. data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
  11. data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
  12. data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
  13. data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
  14. data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  15. data/app/assets/javascripts/jquery-ui/core.js +15 -0
  16. data/app/assets/javascripts/jquery-ui/data.js +45 -0
  17. data/app/assets/javascripts/jquery-ui/disable-selection.js +51 -0
  18. data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
  19. data/app/assets/javascripts/jquery-ui/effect.js +975 -0
  20. data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +76 -0
  21. data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +116 -0
  22. data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +71 -0
  23. data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +75 -0
  24. data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +117 -0
  25. data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +53 -0
  26. data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +95 -0
  27. data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +63 -0
  28. data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +49 -0
  29. data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +70 -0
  30. data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +63 -0
  31. data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +80 -0
  32. data/app/assets/javascripts/jquery-ui/effects/effect-size.js +199 -0
  33. data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +82 -0
  34. data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +46 -0
  35. data/app/assets/javascripts/jquery-ui/focusable.js +89 -0
  36. data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +83 -0
  37. data/app/assets/javascripts/jquery-ui/form.js +25 -0
  38. data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +40 -0
  39. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +42 -0
  40. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +42 -0
  41. data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +40 -0
  42. data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +40 -0
  43. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +41 -0
  44. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +40 -0
  45. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +40 -0
  46. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +40 -0
  47. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +48 -0
  48. data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +40 -0
  49. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
  50. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +40 -0
  51. data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +40 -0
  52. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +40 -0
  53. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +40 -0
  54. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +40 -0
  55. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +40 -0
  56. data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +40 -0
  57. data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +48 -0
  58. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +39 -0
  59. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +76 -0
  60. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +40 -0
  61. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +48 -0
  62. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +40 -0
  63. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +40 -0
  64. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +42 -0
  65. data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +40 -0
  66. data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +40 -0
  67. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +40 -0
  68. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +40 -0
  69. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +39 -0
  70. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +40 -0
  71. data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +40 -0
  72. data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +48 -0
  73. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +40 -0
  74. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +40 -0
  75. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +40 -0
  76. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +51 -0
  77. data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +40 -0
  78. data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +40 -0
  79. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +40 -0
  80. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +41 -0
  81. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +48 -0
  82. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +48 -0
  83. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +48 -0
  84. data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +40 -0
  85. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +40 -0
  86. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +40 -0
  87. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +52 -0
  88. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +40 -0
  89. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +40 -0
  90. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +52 -0
  91. data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +53 -0
  92. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +40 -0
  93. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +48 -0
  94. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +47 -0
  95. data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +64 -0
  96. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +43 -0
  97. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +40 -0
  98. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +40 -0
  99. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +41 -0
  100. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +40 -0
  101. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +40 -0
  102. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +40 -0
  103. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +40 -0
  104. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +56 -0
  105. data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +40 -0
  106. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +40 -0
  107. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +40 -0
  108. data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +41 -0
  109. data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +40 -0
  110. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +40 -0
  111. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +40 -0
  112. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +40 -0
  113. data/app/assets/javascripts/jquery-ui/ie.js +20 -0
  114. data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
  115. data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
  116. data/app/assets/javascripts/jquery-ui/keycode.js +51 -0
  117. data/app/assets/javascripts/jquery-ui/labels.js +71 -0
  118. data/app/assets/javascripts/jquery-ui/plugin.js +49 -0
  119. data/app/assets/javascripts/{jquery.ui.position.js → jquery-ui/position.js} +120 -108
  120. data/app/assets/javascripts/jquery-ui/safe-active-element.js +46 -0
  121. data/app/assets/javascripts/jquery-ui/safe-blur.js +27 -0
  122. data/app/assets/javascripts/jquery-ui/scroll-parent.js +50 -0
  123. data/app/assets/javascripts/jquery-ui/tabbable.js +41 -0
  124. data/app/assets/javascripts/jquery-ui/unique-id.js +54 -0
  125. data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
  126. data/app/assets/javascripts/jquery-ui/version.js +20 -0
  127. data/app/assets/javascripts/jquery-ui/widget.js +754 -0
  128. data/app/assets/javascripts/{jquery.ui.accordion.js → jquery-ui/widgets/accordion.js} +257 -203
  129. data/app/assets/javascripts/{jquery.ui.autocomplete.js → jquery-ui/widgets/autocomplete.js} +202 -133
  130. data/app/assets/javascripts/jquery-ui/widgets/button.js +454 -0
  131. data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +289 -0
  132. data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +304 -0
  133. data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2243 -0
  134. data/app/assets/javascripts/jquery-ui/widgets/dialog.js +968 -0
  135. data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1268 -0
  136. data/app/assets/javascripts/jquery-ui/widgets/droppable.js +508 -0
  137. data/app/assets/javascripts/{jquery.ui.menu.js → jquery-ui/widgets/menu.js} +276 -187
  138. data/app/assets/javascripts/jquery-ui/widgets/mouse.js +241 -0
  139. data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +184 -0
  140. data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1225 -0
  141. data/app/assets/javascripts/jquery-ui/widgets/selectable.js +321 -0
  142. data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +702 -0
  143. data/app/assets/javascripts/{jquery.ui.slider.js → jquery-ui/widgets/slider.js} +254 -174
  144. data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1623 -0
  145. data/app/assets/javascripts/{jquery.ui.spinner.js → jquery-ui/widgets/spinner.js} +206 -119
  146. data/app/assets/javascripts/{jquery.ui.tabs.js → jquery-ui/widgets/tabs.js} +334 -255
  147. data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +530 -0
  148. data/app/assets/javascripts/jquery-ui.js +57 -0
  149. data/app/assets/stylesheets/jquery-ui/accordion.css +26 -0
  150. data/app/assets/stylesheets/{jquery.ui.all.css.erb → jquery-ui/all.css} +4 -4
  151. data/app/assets/stylesheets/{jquery.ui.autocomplete.css.erb → jquery-ui/autocomplete.css} +3 -5
  152. data/app/assets/stylesheets/jquery-ui/base.css +32 -0
  153. data/app/assets/stylesheets/jquery-ui/button.css +85 -0
  154. data/app/assets/stylesheets/jquery-ui/checkboxradio.css +37 -0
  155. data/app/assets/stylesheets/jquery-ui/controlgroup.css +68 -0
  156. data/app/assets/stylesheets/{jquery.ui.core.css.erb → jquery-ui/core.css} +16 -9
  157. data/app/assets/stylesheets/{jquery.ui.datepicker.css.erb → jquery-ui/datepicker.css} +14 -5
  158. data/app/assets/stylesheets/{jquery.ui.dialog.css.erb → jquery-ui/dialog.css} +40 -12
  159. data/app/assets/stylesheets/jquery-ui/draggable.css +15 -0
  160. data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
  161. data/app/assets/stylesheets/jquery-ui/progressbar.css +31 -0
  162. data/app/assets/stylesheets/{jquery.ui.resizable.css.erb → jquery-ui/resizable.css} +5 -4
  163. data/app/assets/stylesheets/{jquery.ui.selectable.css.erb → jquery-ui/selectable.css} +7 -4
  164. data/app/assets/stylesheets/jquery-ui/selectmenu.css +53 -0
  165. data/app/assets/stylesheets/{jquery.ui.slider.css.erb → jquery-ui/slider.css} +7 -6
  166. data/app/assets/stylesheets/jquery-ui/sortable.css +15 -0
  167. data/app/assets/stylesheets/{jquery.ui.spinner.css.erb → jquery-ui/spinner.css} +9 -24
  168. data/app/assets/stylesheets/{jquery.ui.tabs.css.erb → jquery-ui/tabs.css} +3 -4
  169. data/app/assets/stylesheets/{jquery.ui.theme.css.erb → jquery-ui/theme.css.erb} +122 -96
  170. data/app/assets/stylesheets/{jquery.ui.tooltip.css.erb → jquery-ui/tooltip.css} +3 -6
  171. data/app/assets/stylesheets/jquery-ui.css +1 -0
  172. data/lib/jquery/ui/rails/version.rb +2 -2
  173. metadata +180 -166
  174. data/app/assets/images/jquery-ui/animated-overlay.gif +0 -0
  175. data/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  176. data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  177. data/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  178. data/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  179. data/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  180. data/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  181. data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  182. data/app/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  183. data/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  184. data/app/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  185. data/app/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  186. data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  187. data/app/assets/javascripts/jquery.ui.all.js +0 -34
  188. data/app/assets/javascripts/jquery.ui.button.js +0 -398
  189. data/app/assets/javascripts/jquery.ui.core.js +0 -320
  190. data/app/assets/javascripts/jquery.ui.datepicker-af.js +0 -23
  191. data/app/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +0 -23
  192. data/app/assets/javascripts/jquery.ui.datepicker-ar.js +0 -23
  193. data/app/assets/javascripts/jquery.ui.datepicker-az.js +0 -23
  194. data/app/assets/javascripts/jquery.ui.datepicker-be.js +0 -23
  195. data/app/assets/javascripts/jquery.ui.datepicker-bg.js +0 -24
  196. data/app/assets/javascripts/jquery.ui.datepicker-bs.js +0 -23
  197. data/app/assets/javascripts/jquery.ui.datepicker-ca.js +0 -23
  198. data/app/assets/javascripts/jquery.ui.datepicker-cs.js +0 -23
  199. data/app/assets/javascripts/jquery.ui.datepicker-cy-GB.js +0 -23
  200. data/app/assets/javascripts/jquery.ui.datepicker-da.js +0 -23
  201. data/app/assets/javascripts/jquery.ui.datepicker-de.js +0 -23
  202. data/app/assets/javascripts/jquery.ui.datepicker-el.js +0 -23
  203. data/app/assets/javascripts/jquery.ui.datepicker-en-AU.js +0 -23
  204. data/app/assets/javascripts/jquery.ui.datepicker-en-GB.js +0 -23
  205. data/app/assets/javascripts/jquery.ui.datepicker-en-NZ.js +0 -23
  206. data/app/assets/javascripts/jquery.ui.datepicker-eo.js +0 -23
  207. data/app/assets/javascripts/jquery.ui.datepicker-es.js +0 -23
  208. data/app/assets/javascripts/jquery.ui.datepicker-et.js +0 -23
  209. data/app/assets/javascripts/jquery.ui.datepicker-eu.js +0 -23
  210. data/app/assets/javascripts/jquery.ui.datepicker-fa.js +0 -59
  211. data/app/assets/javascripts/jquery.ui.datepicker-fi.js +0 -23
  212. data/app/assets/javascripts/jquery.ui.datepicker-fo.js +0 -23
  213. data/app/assets/javascripts/jquery.ui.datepicker-fr-CA.js +0 -23
  214. data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +0 -23
  215. data/app/assets/javascripts/jquery.ui.datepicker-fr.js +0 -25
  216. data/app/assets/javascripts/jquery.ui.datepicker-gl.js +0 -23
  217. data/app/assets/javascripts/jquery.ui.datepicker-he.js +0 -23
  218. data/app/assets/javascripts/jquery.ui.datepicker-hi.js +0 -23
  219. data/app/assets/javascripts/jquery.ui.datepicker-hr.js +0 -23
  220. data/app/assets/javascripts/jquery.ui.datepicker-hu.js +0 -23
  221. data/app/assets/javascripts/jquery.ui.datepicker-hy.js +0 -23
  222. data/app/assets/javascripts/jquery.ui.datepicker-id.js +0 -23
  223. data/app/assets/javascripts/jquery.ui.datepicker-is.js +0 -23
  224. data/app/assets/javascripts/jquery.ui.datepicker-it.js +0 -23
  225. data/app/assets/javascripts/jquery.ui.datepicker-ja.js +0 -23
  226. data/app/assets/javascripts/jquery.ui.datepicker-ka.js +0 -21
  227. data/app/assets/javascripts/jquery.ui.datepicker-kk.js +0 -23
  228. data/app/assets/javascripts/jquery.ui.datepicker-km.js +0 -23
  229. data/app/assets/javascripts/jquery.ui.datepicker-ko.js +0 -23
  230. data/app/assets/javascripts/jquery.ui.datepicker-ky.js +0 -24
  231. data/app/assets/javascripts/jquery.ui.datepicker-lb.js +0 -23
  232. data/app/assets/javascripts/jquery.ui.datepicker-lt.js +0 -23
  233. data/app/assets/javascripts/jquery.ui.datepicker-lv.js +0 -23
  234. data/app/assets/javascripts/jquery.ui.datepicker-mk.js +0 -23
  235. data/app/assets/javascripts/jquery.ui.datepicker-ml.js +0 -23
  236. data/app/assets/javascripts/jquery.ui.datepicker-ms.js +0 -23
  237. data/app/assets/javascripts/jquery.ui.datepicker-nb.js +0 -22
  238. data/app/assets/javascripts/jquery.ui.datepicker-nl-BE.js +0 -23
  239. data/app/assets/javascripts/jquery.ui.datepicker-nl.js +0 -23
  240. data/app/assets/javascripts/jquery.ui.datepicker-nn.js +0 -22
  241. data/app/assets/javascripts/jquery.ui.datepicker-no.js +0 -23
  242. data/app/assets/javascripts/jquery.ui.datepicker-pl.js +0 -23
  243. data/app/assets/javascripts/jquery.ui.datepicker-pt-BR.js +0 -23
  244. data/app/assets/javascripts/jquery.ui.datepicker-pt.js +0 -22
  245. data/app/assets/javascripts/jquery.ui.datepicker-rm.js +0 -21
  246. data/app/assets/javascripts/jquery.ui.datepicker-ro.js +0 -26
  247. data/app/assets/javascripts/jquery.ui.datepicker-ru.js +0 -23
  248. data/app/assets/javascripts/jquery.ui.datepicker-sk.js +0 -23
  249. data/app/assets/javascripts/jquery.ui.datepicker-sl.js +0 -24
  250. data/app/assets/javascripts/jquery.ui.datepicker-sq.js +0 -23
  251. data/app/assets/javascripts/jquery.ui.datepicker-sr-SR.js +0 -23
  252. data/app/assets/javascripts/jquery.ui.datepicker-sr.js +0 -23
  253. data/app/assets/javascripts/jquery.ui.datepicker-sv.js +0 -23
  254. data/app/assets/javascripts/jquery.ui.datepicker-ta.js +0 -23
  255. data/app/assets/javascripts/jquery.ui.datepicker-th.js +0 -23
  256. data/app/assets/javascripts/jquery.ui.datepicker-tj.js +0 -23
  257. data/app/assets/javascripts/jquery.ui.datepicker-tr.js +0 -23
  258. data/app/assets/javascripts/jquery.ui.datepicker-uk.js +0 -24
  259. data/app/assets/javascripts/jquery.ui.datepicker-vi.js +0 -23
  260. data/app/assets/javascripts/jquery.ui.datepicker-zh-CN.js +0 -23
  261. data/app/assets/javascripts/jquery.ui.datepicker-zh-HK.js +0 -23
  262. data/app/assets/javascripts/jquery.ui.datepicker-zh-TW.js +0 -23
  263. data/app/assets/javascripts/jquery.ui.datepicker.js +0 -2040
  264. data/app/assets/javascripts/jquery.ui.dialog.js +0 -830
  265. data/app/assets/javascripts/jquery.ui.draggable.js +0 -962
  266. data/app/assets/javascripts/jquery.ui.droppable.js +0 -394
  267. data/app/assets/javascripts/jquery.ui.effect-blind.js +0 -84
  268. data/app/assets/javascripts/jquery.ui.effect-bounce.js +0 -115
  269. data/app/assets/javascripts/jquery.ui.effect-clip.js +0 -69
  270. data/app/assets/javascripts/jquery.ui.effect-drop.js +0 -67
  271. data/app/assets/javascripts/jquery.ui.effect-explode.js +0 -99
  272. data/app/assets/javascripts/jquery.ui.effect-fade.js +0 -32
  273. data/app/assets/javascripts/jquery.ui.effect-fold.js +0 -78
  274. data/app/assets/javascripts/jquery.ui.effect-highlight.js +0 -52
  275. data/app/assets/javascripts/jquery.ui.effect-pulsate.js +0 -65
  276. data/app/assets/javascripts/jquery.ui.effect-scale.js +0 -320
  277. data/app/assets/javascripts/jquery.ui.effect-shake.js +0 -76
  278. data/app/assets/javascripts/jquery.ui.effect-slide.js +0 -66
  279. data/app/assets/javascripts/jquery.ui.effect-transfer.js +0 -49
  280. data/app/assets/javascripts/jquery.ui.effect.all.js +0 -14
  281. data/app/assets/javascripts/jquery.ui.effect.js +0 -1289
  282. data/app/assets/javascripts/jquery.ui.mouse.js +0 -172
  283. data/app/assets/javascripts/jquery.ui.progressbar.js +0 -148
  284. data/app/assets/javascripts/jquery.ui.resizable.js +0 -982
  285. data/app/assets/javascripts/jquery.ui.selectable.js +0 -281
  286. data/app/assets/javascripts/jquery.ui.sortable.js +0 -1293
  287. data/app/assets/javascripts/jquery.ui.tooltip.js +0 -406
  288. data/app/assets/javascripts/jquery.ui.widget.js +0 -521
  289. data/app/assets/stylesheets/jquery.ui.accordion.css.erb +0 -42
  290. data/app/assets/stylesheets/jquery.ui.base.css.erb +0 -27
  291. data/app/assets/stylesheets/jquery.ui.button.css.erb +0 -118
  292. data/app/assets/stylesheets/jquery.ui.menu.css.erb +0 -83
  293. data/app/assets/stylesheets/jquery.ui.progressbar.css.erb +0 -37
@@ -0,0 +1,1623 @@
1
+ //= require jquery-ui/widgets/mouse
2
+ //= require jquery-ui/data
3
+ //= require jquery-ui/ie
4
+ //= require jquery-ui/scroll-parent
5
+ //= require jquery-ui/version
6
+ //= require jquery-ui/widget
7
+
8
+ /*!
9
+ * jQuery UI Sortable 1.13.0
10
+ * http://jqueryui.com
11
+ *
12
+ * Copyright jQuery Foundation and other contributors
13
+ * Released under the MIT license.
14
+ * http://jquery.org/license
15
+ */
16
+
17
+ //>>label: Sortable
18
+ //>>group: Interactions
19
+ //>>description: Enables items in a list to be sorted using the mouse.
20
+ //>>docs: http://api.jqueryui.com/sortable/
21
+ //>>demos: http://jqueryui.com/sortable/
22
+ //>>css.structure: ../../themes/base/sortable.css
23
+
24
+ ( function( factory ) {
25
+ "use strict";
26
+
27
+ if ( typeof define === "function" && define.amd ) {
28
+
29
+ // AMD. Register as an anonymous module.
30
+ define( [
31
+ "jquery",
32
+ "./mouse",
33
+ "../data",
34
+ "../ie",
35
+ "../scroll-parent",
36
+ "../version",
37
+ "../widget"
38
+ ], factory );
39
+ } else {
40
+
41
+ // Browser globals
42
+ factory( jQuery );
43
+ }
44
+ } )( function( $ ) {
45
+ "use strict";
46
+
47
+ return $.widget( "ui.sortable", $.ui.mouse, {
48
+ version: "1.13.0",
49
+ widgetEventPrefix: "sort",
50
+ ready: false,
51
+ options: {
52
+ appendTo: "parent",
53
+ axis: false,
54
+ connectWith: false,
55
+ containment: false,
56
+ cursor: "auto",
57
+ cursorAt: false,
58
+ dropOnEmpty: true,
59
+ forcePlaceholderSize: false,
60
+ forceHelperSize: false,
61
+ grid: false,
62
+ handle: false,
63
+ helper: "original",
64
+ items: "> *",
65
+ opacity: false,
66
+ placeholder: false,
67
+ revert: false,
68
+ scroll: true,
69
+ scrollSensitivity: 20,
70
+ scrollSpeed: 20,
71
+ scope: "default",
72
+ tolerance: "intersect",
73
+ zIndex: 1000,
74
+
75
+ // Callbacks
76
+ activate: null,
77
+ beforeStop: null,
78
+ change: null,
79
+ deactivate: null,
80
+ out: null,
81
+ over: null,
82
+ receive: null,
83
+ remove: null,
84
+ sort: null,
85
+ start: null,
86
+ stop: null,
87
+ update: null
88
+ },
89
+
90
+ _isOverAxis: function( x, reference, size ) {
91
+ return ( x >= reference ) && ( x < ( reference + size ) );
92
+ },
93
+
94
+ _isFloating: function( item ) {
95
+ return ( /left|right/ ).test( item.css( "float" ) ) ||
96
+ ( /inline|table-cell/ ).test( item.css( "display" ) );
97
+ },
98
+
99
+ _create: function() {
100
+ this.containerCache = {};
101
+ this._addClass( "ui-sortable" );
102
+
103
+ //Get the items
104
+ this.refresh();
105
+
106
+ //Let's determine the parent's offset
107
+ this.offset = this.element.offset();
108
+
109
+ //Initialize mouse events for interaction
110
+ this._mouseInit();
111
+
112
+ this._setHandleClassName();
113
+
114
+ //We're ready to go
115
+ this.ready = true;
116
+
117
+ },
118
+
119
+ _setOption: function( key, value ) {
120
+ this._super( key, value );
121
+
122
+ if ( key === "handle" ) {
123
+ this._setHandleClassName();
124
+ }
125
+ },
126
+
127
+ _setHandleClassName: function() {
128
+ var that = this;
129
+ this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
130
+ $.each( this.items, function() {
131
+ that._addClass(
132
+ this.instance.options.handle ?
133
+ this.item.find( this.instance.options.handle ) :
134
+ this.item,
135
+ "ui-sortable-handle"
136
+ );
137
+ } );
138
+ },
139
+
140
+ _destroy: function() {
141
+ this._mouseDestroy();
142
+
143
+ for ( var i = this.items.length - 1; i >= 0; i-- ) {
144
+ this.items[ i ].item.removeData( this.widgetName + "-item" );
145
+ }
146
+
147
+ return this;
148
+ },
149
+
150
+ _mouseCapture: function( event, overrideHandle ) {
151
+ var currentItem = null,
152
+ validHandle = false,
153
+ that = this;
154
+
155
+ if ( this.reverting ) {
156
+ return false;
157
+ }
158
+
159
+ if ( this.options.disabled || this.options.type === "static" ) {
160
+ return false;
161
+ }
162
+
163
+ //We have to refresh the items data once first
164
+ this._refreshItems( event );
165
+
166
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
167
+ $( event.target ).parents().each( function() {
168
+ if ( $.data( this, that.widgetName + "-item" ) === that ) {
169
+ currentItem = $( this );
170
+ return false;
171
+ }
172
+ } );
173
+ if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
174
+ currentItem = $( event.target );
175
+ }
176
+
177
+ if ( !currentItem ) {
178
+ return false;
179
+ }
180
+ if ( this.options.handle && !overrideHandle ) {
181
+ $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
182
+ if ( this === event.target ) {
183
+ validHandle = true;
184
+ }
185
+ } );
186
+ if ( !validHandle ) {
187
+ return false;
188
+ }
189
+ }
190
+
191
+ this.currentItem = currentItem;
192
+ this._removeCurrentsFromItems();
193
+ return true;
194
+
195
+ },
196
+
197
+ _mouseStart: function( event, overrideHandle, noActivation ) {
198
+
199
+ var i, body,
200
+ o = this.options;
201
+
202
+ this.currentContainer = this;
203
+
204
+ //We only need to call refreshPositions, because the refreshItems call has been moved to
205
+ // mouseCapture
206
+ this.refreshPositions();
207
+
208
+ //Prepare the dragged items parent
209
+ this.appendTo = $( o.appendTo !== "parent" ?
210
+ o.appendTo :
211
+ this.currentItem.parent() );
212
+
213
+ //Create and append the visible helper
214
+ this.helper = this._createHelper( event );
215
+
216
+ //Cache the helper size
217
+ this._cacheHelperProportions();
218
+
219
+ /*
220
+ * - Position generation -
221
+ * This block generates everything position related - it's the core of draggables.
222
+ */
223
+
224
+ //Cache the margins of the original element
225
+ this._cacheMargins();
226
+
227
+ //The element's absolute position on the page minus margins
228
+ this.offset = this.currentItem.offset();
229
+ this.offset = {
230
+ top: this.offset.top - this.margins.top,
231
+ left: this.offset.left - this.margins.left
232
+ };
233
+
234
+ $.extend( this.offset, {
235
+ click: { //Where the click happened, relative to the element
236
+ left: event.pageX - this.offset.left,
237
+ top: event.pageY - this.offset.top
238
+ },
239
+
240
+ // This is a relative to absolute position minus the actual position calculation -
241
+ // only used for relative positioned helper
242
+ relative: this._getRelativeOffset()
243
+ } );
244
+
245
+ // After we get the helper offset, but before we get the parent offset we can
246
+ // change the helper's position to absolute
247
+ // TODO: Still need to figure out a way to make relative sorting possible
248
+ this.helper.css( "position", "absolute" );
249
+ this.cssPosition = this.helper.css( "position" );
250
+
251
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
252
+ if ( o.cursorAt ) {
253
+ this._adjustOffsetFromHelper( o.cursorAt );
254
+ }
255
+
256
+ //Cache the former DOM position
257
+ this.domPosition = {
258
+ prev: this.currentItem.prev()[ 0 ],
259
+ parent: this.currentItem.parent()[ 0 ]
260
+ };
261
+
262
+ // If the helper is not the original, hide the original so it's not playing any role during
263
+ // the drag, won't cause anything bad this way
264
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
265
+ this.currentItem.hide();
266
+ }
267
+
268
+ //Create the placeholder
269
+ this._createPlaceholder();
270
+
271
+ //Get the next scrolling parent
272
+ this.scrollParent = this.placeholder.scrollParent();
273
+
274
+ $.extend( this.offset, {
275
+ parent: this._getParentOffset()
276
+ } );
277
+
278
+ //Set a containment if given in the options
279
+ if ( o.containment ) {
280
+ this._setContainment();
281
+ }
282
+
283
+ if ( o.cursor && o.cursor !== "auto" ) { // cursor option
284
+ body = this.document.find( "body" );
285
+
286
+ // Support: IE
287
+ this.storedCursor = body.css( "cursor" );
288
+ body.css( "cursor", o.cursor );
289
+
290
+ this.storedStylesheet =
291
+ $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
292
+ }
293
+
294
+ // We need to make sure to grab the zIndex before setting the
295
+ // opacity, because setting the opacity to anything lower than 1
296
+ // causes the zIndex to change from "auto" to 0.
297
+ if ( o.zIndex ) { // zIndex option
298
+ if ( this.helper.css( "zIndex" ) ) {
299
+ this._storedZIndex = this.helper.css( "zIndex" );
300
+ }
301
+ this.helper.css( "zIndex", o.zIndex );
302
+ }
303
+
304
+ if ( o.opacity ) { // opacity option
305
+ if ( this.helper.css( "opacity" ) ) {
306
+ this._storedOpacity = this.helper.css( "opacity" );
307
+ }
308
+ this.helper.css( "opacity", o.opacity );
309
+ }
310
+
311
+ //Prepare scrolling
312
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
313
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
314
+ this.overflowOffset = this.scrollParent.offset();
315
+ }
316
+
317
+ //Call callbacks
318
+ this._trigger( "start", event, this._uiHash() );
319
+
320
+ //Recache the helper size
321
+ if ( !this._preserveHelperProportions ) {
322
+ this._cacheHelperProportions();
323
+ }
324
+
325
+ //Post "activate" events to possible containers
326
+ if ( !noActivation ) {
327
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
328
+ this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
329
+ }
330
+ }
331
+
332
+ //Prepare possible droppables
333
+ if ( $.ui.ddmanager ) {
334
+ $.ui.ddmanager.current = this;
335
+ }
336
+
337
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {
338
+ $.ui.ddmanager.prepareOffsets( this, event );
339
+ }
340
+
341
+ this.dragging = true;
342
+
343
+ this._addClass( this.helper, "ui-sortable-helper" );
344
+
345
+ //Move the helper, if needed
346
+ if ( !this.helper.parent().is( this.appendTo ) ) {
347
+ this.helper.detach().appendTo( this.appendTo );
348
+
349
+ //Update position
350
+ this.offset.parent = this._getParentOffset();
351
+ }
352
+
353
+ //Generate the original position
354
+ this.position = this.originalPosition = this._generatePosition( event );
355
+ this.originalPageX = event.pageX;
356
+ this.originalPageY = event.pageY;
357
+ this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
358
+
359
+ this._mouseDrag( event );
360
+
361
+ return true;
362
+
363
+ },
364
+
365
+ _scroll: function( event ) {
366
+ var o = this.options,
367
+ scrolled = false;
368
+
369
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
370
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
371
+
372
+ if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
373
+ event.pageY < o.scrollSensitivity ) {
374
+ this.scrollParent[ 0 ].scrollTop =
375
+ scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
376
+ } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
377
+ this.scrollParent[ 0 ].scrollTop =
378
+ scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
379
+ }
380
+
381
+ if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
382
+ event.pageX < o.scrollSensitivity ) {
383
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
384
+ this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
385
+ } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
386
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
387
+ this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
388
+ }
389
+
390
+ } else {
391
+
392
+ if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
393
+ scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
394
+ } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
395
+ o.scrollSensitivity ) {
396
+ scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
397
+ }
398
+
399
+ if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
400
+ scrolled = this.document.scrollLeft(
401
+ this.document.scrollLeft() - o.scrollSpeed
402
+ );
403
+ } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
404
+ o.scrollSensitivity ) {
405
+ scrolled = this.document.scrollLeft(
406
+ this.document.scrollLeft() + o.scrollSpeed
407
+ );
408
+ }
409
+
410
+ }
411
+
412
+ return scrolled;
413
+ },
414
+
415
+ _mouseDrag: function( event ) {
416
+ var i, item, itemElement, intersection,
417
+ o = this.options;
418
+
419
+ //Compute the helpers position
420
+ this.position = this._generatePosition( event );
421
+ this.positionAbs = this._convertPositionTo( "absolute" );
422
+
423
+ //Set the helper position
424
+ if ( !this.options.axis || this.options.axis !== "y" ) {
425
+ this.helper[ 0 ].style.left = this.position.left + "px";
426
+ }
427
+ if ( !this.options.axis || this.options.axis !== "x" ) {
428
+ this.helper[ 0 ].style.top = this.position.top + "px";
429
+ }
430
+
431
+ //Post events to containers
432
+ this._contactContainers( event );
433
+
434
+ if ( this.innermostContainer !== null ) {
435
+
436
+ //Do scrolling
437
+ if ( o.scroll ) {
438
+ if ( this._scroll( event ) !== false ) {
439
+
440
+ //Update item positions used in position checks
441
+ this._refreshItemPositions( true );
442
+
443
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {
444
+ $.ui.ddmanager.prepareOffsets( this, event );
445
+ }
446
+ }
447
+ }
448
+
449
+ this.dragDirection = {
450
+ vertical: this._getDragVerticalDirection(),
451
+ horizontal: this._getDragHorizontalDirection()
452
+ };
453
+
454
+ //Rearrange
455
+ for ( i = this.items.length - 1; i >= 0; i-- ) {
456
+
457
+ //Cache variables and intersection, continue if no intersection
458
+ item = this.items[ i ];
459
+ itemElement = item.item[ 0 ];
460
+ intersection = this._intersectsWithPointer( item );
461
+ if ( !intersection ) {
462
+ continue;
463
+ }
464
+
465
+ // Only put the placeholder inside the current Container, skip all
466
+ // items from other containers. This works because when moving
467
+ // an item from one container to another the
468
+ // currentContainer is switched before the placeholder is moved.
469
+ //
470
+ // Without this, moving items in "sub-sortables" can cause
471
+ // the placeholder to jitter between the outer and inner container.
472
+ if ( item.instance !== this.currentContainer ) {
473
+ continue;
474
+ }
475
+
476
+ // Cannot intersect with itself
477
+ // no useless actions that have been done before
478
+ // no action if the item moved is the parent of the item checked
479
+ if ( itemElement !== this.currentItem[ 0 ] &&
480
+ this.placeholder[ intersection === 1 ?
481
+ "next" : "prev" ]()[ 0 ] !== itemElement &&
482
+ !$.contains( this.placeholder[ 0 ], itemElement ) &&
483
+ ( this.options.type === "semi-dynamic" ?
484
+ !$.contains( this.element[ 0 ], itemElement ) :
485
+ true
486
+ )
487
+ ) {
488
+
489
+ this.direction = intersection === 1 ? "down" : "up";
490
+
491
+ if ( this.options.tolerance === "pointer" ||
492
+ this._intersectsWithSides( item ) ) {
493
+ this._rearrange( event, item );
494
+ } else {
495
+ break;
496
+ }
497
+
498
+ this._trigger( "change", event, this._uiHash() );
499
+ break;
500
+ }
501
+ }
502
+ }
503
+
504
+ //Interconnect with droppables
505
+ if ( $.ui.ddmanager ) {
506
+ $.ui.ddmanager.drag( this, event );
507
+ }
508
+
509
+ //Call callbacks
510
+ this._trigger( "sort", event, this._uiHash() );
511
+
512
+ this.lastPositionAbs = this.positionAbs;
513
+ return false;
514
+
515
+ },
516
+
517
+ _mouseStop: function( event, noPropagation ) {
518
+
519
+ if ( !event ) {
520
+ return;
521
+ }
522
+
523
+ //If we are using droppables, inform the manager about the drop
524
+ if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
525
+ $.ui.ddmanager.drop( this, event );
526
+ }
527
+
528
+ if ( this.options.revert ) {
529
+ var that = this,
530
+ cur = this.placeholder.offset(),
531
+ axis = this.options.axis,
532
+ animation = {};
533
+
534
+ if ( !axis || axis === "x" ) {
535
+ animation.left = cur.left - this.offset.parent.left - this.margins.left +
536
+ ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
537
+ 0 :
538
+ this.offsetParent[ 0 ].scrollLeft
539
+ );
540
+ }
541
+ if ( !axis || axis === "y" ) {
542
+ animation.top = cur.top - this.offset.parent.top - this.margins.top +
543
+ ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
544
+ 0 :
545
+ this.offsetParent[ 0 ].scrollTop
546
+ );
547
+ }
548
+ this.reverting = true;
549
+ $( this.helper ).animate(
550
+ animation,
551
+ parseInt( this.options.revert, 10 ) || 500,
552
+ function() {
553
+ that._clear( event );
554
+ }
555
+ );
556
+ } else {
557
+ this._clear( event, noPropagation );
558
+ }
559
+
560
+ return false;
561
+
562
+ },
563
+
564
+ cancel: function() {
565
+
566
+ if ( this.dragging ) {
567
+
568
+ this._mouseUp( new $.Event( "mouseup", { target: null } ) );
569
+
570
+ if ( this.options.helper === "original" ) {
571
+ this.currentItem.css( this._storedCSS );
572
+ this._removeClass( this.currentItem, "ui-sortable-helper" );
573
+ } else {
574
+ this.currentItem.show();
575
+ }
576
+
577
+ //Post deactivating events to containers
578
+ for ( var i = this.containers.length - 1; i >= 0; i-- ) {
579
+ this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
580
+ if ( this.containers[ i ].containerCache.over ) {
581
+ this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
582
+ this.containers[ i ].containerCache.over = 0;
583
+ }
584
+ }
585
+
586
+ }
587
+
588
+ if ( this.placeholder ) {
589
+
590
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
591
+ // it unbinds ALL events from the original node!
592
+ if ( this.placeholder[ 0 ].parentNode ) {
593
+ this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
594
+ }
595
+ if ( this.options.helper !== "original" && this.helper &&
596
+ this.helper[ 0 ].parentNode ) {
597
+ this.helper.remove();
598
+ }
599
+
600
+ $.extend( this, {
601
+ helper: null,
602
+ dragging: false,
603
+ reverting: false,
604
+ _noFinalSort: null
605
+ } );
606
+
607
+ if ( this.domPosition.prev ) {
608
+ $( this.domPosition.prev ).after( this.currentItem );
609
+ } else {
610
+ $( this.domPosition.parent ).prepend( this.currentItem );
611
+ }
612
+ }
613
+
614
+ return this;
615
+
616
+ },
617
+
618
+ serialize: function( o ) {
619
+
620
+ var items = this._getItemsAsjQuery( o && o.connected ),
621
+ str = [];
622
+ o = o || {};
623
+
624
+ $( items ).each( function() {
625
+ var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
626
+ .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
627
+ if ( res ) {
628
+ str.push(
629
+ ( o.key || res[ 1 ] + "[]" ) +
630
+ "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
631
+ }
632
+ } );
633
+
634
+ if ( !str.length && o.key ) {
635
+ str.push( o.key + "=" );
636
+ }
637
+
638
+ return str.join( "&" );
639
+
640
+ },
641
+
642
+ toArray: function( o ) {
643
+
644
+ var items = this._getItemsAsjQuery( o && o.connected ),
645
+ ret = [];
646
+
647
+ o = o || {};
648
+
649
+ items.each( function() {
650
+ ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
651
+ } );
652
+ return ret;
653
+
654
+ },
655
+
656
+ /* Be careful with the following core functions */
657
+ _intersectsWith: function( item ) {
658
+
659
+ var x1 = this.positionAbs.left,
660
+ x2 = x1 + this.helperProportions.width,
661
+ y1 = this.positionAbs.top,
662
+ y2 = y1 + this.helperProportions.height,
663
+ l = item.left,
664
+ r = l + item.width,
665
+ t = item.top,
666
+ b = t + item.height,
667
+ dyClick = this.offset.click.top,
668
+ dxClick = this.offset.click.left,
669
+ isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
670
+ ( y1 + dyClick ) < b ),
671
+ isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
672
+ ( x1 + dxClick ) < r ),
673
+ isOverElement = isOverElementHeight && isOverElementWidth;
674
+
675
+ if ( this.options.tolerance === "pointer" ||
676
+ this.options.forcePointerForContainers ||
677
+ ( this.options.tolerance !== "pointer" &&
678
+ this.helperProportions[ this.floating ? "width" : "height" ] >
679
+ item[ this.floating ? "width" : "height" ] )
680
+ ) {
681
+ return isOverElement;
682
+ } else {
683
+
684
+ return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
685
+ x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
686
+ t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
687
+ y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
688
+
689
+ }
690
+ },
691
+
692
+ _intersectsWithPointer: function( item ) {
693
+ var verticalDirection, horizontalDirection,
694
+ isOverElementHeight = ( this.options.axis === "x" ) ||
695
+ this._isOverAxis(
696
+ this.positionAbs.top + this.offset.click.top, item.top, item.height ),
697
+ isOverElementWidth = ( this.options.axis === "y" ) ||
698
+ this._isOverAxis(
699
+ this.positionAbs.left + this.offset.click.left, item.left, item.width ),
700
+ isOverElement = isOverElementHeight && isOverElementWidth;
701
+
702
+ if ( !isOverElement ) {
703
+ return false;
704
+ }
705
+
706
+ verticalDirection = this.dragDirection.vertical;
707
+ horizontalDirection = this.dragDirection.horizontal;
708
+
709
+ return this.floating ?
710
+ ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
711
+ ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
712
+
713
+ },
714
+
715
+ _intersectsWithSides: function( item ) {
716
+
717
+ var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
718
+ this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
719
+ isOverRightHalf = this._isOverAxis( this.positionAbs.left +
720
+ this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
721
+ verticalDirection = this.dragDirection.vertical,
722
+ horizontalDirection = this.dragDirection.horizontal;
723
+
724
+ if ( this.floating && horizontalDirection ) {
725
+ return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
726
+ ( horizontalDirection === "left" && !isOverRightHalf ) );
727
+ } else {
728
+ return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
729
+ ( verticalDirection === "up" && !isOverBottomHalf ) );
730
+ }
731
+
732
+ },
733
+
734
+ _getDragVerticalDirection: function() {
735
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
736
+ return delta !== 0 && ( delta > 0 ? "down" : "up" );
737
+ },
738
+
739
+ _getDragHorizontalDirection: function() {
740
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
741
+ return delta !== 0 && ( delta > 0 ? "right" : "left" );
742
+ },
743
+
744
+ refresh: function( event ) {
745
+ this._refreshItems( event );
746
+ this._setHandleClassName();
747
+ this.refreshPositions();
748
+ return this;
749
+ },
750
+
751
+ _connectWith: function() {
752
+ var options = this.options;
753
+ return options.connectWith.constructor === String ?
754
+ [ options.connectWith ] :
755
+ options.connectWith;
756
+ },
757
+
758
+ _getItemsAsjQuery: function( connected ) {
759
+
760
+ var i, j, cur, inst,
761
+ items = [],
762
+ queries = [],
763
+ connectWith = this._connectWith();
764
+
765
+ if ( connectWith && connected ) {
766
+ for ( i = connectWith.length - 1; i >= 0; i-- ) {
767
+ cur = $( connectWith[ i ], this.document[ 0 ] );
768
+ for ( j = cur.length - 1; j >= 0; j-- ) {
769
+ inst = $.data( cur[ j ], this.widgetFullName );
770
+ if ( inst && inst !== this && !inst.options.disabled ) {
771
+ queries.push( [ typeof inst.options.items === "function" ?
772
+ inst.options.items.call( inst.element ) :
773
+ $( inst.options.items, inst.element )
774
+ .not( ".ui-sortable-helper" )
775
+ .not( ".ui-sortable-placeholder" ), inst ] );
776
+ }
777
+ }
778
+ }
779
+ }
780
+
781
+ queries.push( [ typeof this.options.items === "function" ?
782
+ this.options.items
783
+ .call( this.element, null, { options: this.options, item: this.currentItem } ) :
784
+ $( this.options.items, this.element )
785
+ .not( ".ui-sortable-helper" )
786
+ .not( ".ui-sortable-placeholder" ), this ] );
787
+
788
+ function addItems() {
789
+ items.push( this );
790
+ }
791
+ for ( i = queries.length - 1; i >= 0; i-- ) {
792
+ queries[ i ][ 0 ].each( addItems );
793
+ }
794
+
795
+ return $( items );
796
+
797
+ },
798
+
799
+ _removeCurrentsFromItems: function() {
800
+
801
+ var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
802
+
803
+ this.items = $.grep( this.items, function( item ) {
804
+ for ( var j = 0; j < list.length; j++ ) {
805
+ if ( list[ j ] === item.item[ 0 ] ) {
806
+ return false;
807
+ }
808
+ }
809
+ return true;
810
+ } );
811
+
812
+ },
813
+
814
+ _refreshItems: function( event ) {
815
+
816
+ this.items = [];
817
+ this.containers = [ this ];
818
+
819
+ var i, j, cur, inst, targetData, _queries, item, queriesLength,
820
+ items = this.items,
821
+ queries = [ [ typeof this.options.items === "function" ?
822
+ this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
823
+ $( this.options.items, this.element ), this ] ],
824
+ connectWith = this._connectWith();
825
+
826
+ //Shouldn't be run the first time through due to massive slow-down
827
+ if ( connectWith && this.ready ) {
828
+ for ( i = connectWith.length - 1; i >= 0; i-- ) {
829
+ cur = $( connectWith[ i ], this.document[ 0 ] );
830
+ for ( j = cur.length - 1; j >= 0; j-- ) {
831
+ inst = $.data( cur[ j ], this.widgetFullName );
832
+ if ( inst && inst !== this && !inst.options.disabled ) {
833
+ queries.push( [ typeof inst.options.items === "function" ?
834
+ inst.options.items
835
+ .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
836
+ $( inst.options.items, inst.element ), inst ] );
837
+ this.containers.push( inst );
838
+ }
839
+ }
840
+ }
841
+ }
842
+
843
+ for ( i = queries.length - 1; i >= 0; i-- ) {
844
+ targetData = queries[ i ][ 1 ];
845
+ _queries = queries[ i ][ 0 ];
846
+
847
+ for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
848
+ item = $( _queries[ j ] );
849
+
850
+ // Data for target checking (mouse manager)
851
+ item.data( this.widgetName + "-item", targetData );
852
+
853
+ items.push( {
854
+ item: item,
855
+ instance: targetData,
856
+ width: 0, height: 0,
857
+ left: 0, top: 0
858
+ } );
859
+ }
860
+ }
861
+
862
+ },
863
+
864
+ _refreshItemPositions: function( fast ) {
865
+ var i, item, t, p;
866
+
867
+ for ( i = this.items.length - 1; i >= 0; i-- ) {
868
+ item = this.items[ i ];
869
+
870
+ //We ignore calculating positions of all connected containers when we're not over them
871
+ if ( this.currentContainer && item.instance !== this.currentContainer &&
872
+ item.item[ 0 ] !== this.currentItem[ 0 ] ) {
873
+ continue;
874
+ }
875
+
876
+ t = this.options.toleranceElement ?
877
+ $( this.options.toleranceElement, item.item ) :
878
+ item.item;
879
+
880
+ if ( !fast ) {
881
+ item.width = t.outerWidth();
882
+ item.height = t.outerHeight();
883
+ }
884
+
885
+ p = t.offset();
886
+ item.left = p.left;
887
+ item.top = p.top;
888
+ }
889
+ },
890
+
891
+ refreshPositions: function( fast ) {
892
+
893
+ // Determine whether items are being displayed horizontally
894
+ this.floating = this.items.length ?
895
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
896
+ false;
897
+
898
+ if ( this.innermostContainer !== null ) {
899
+ this._refreshItemPositions( fast );
900
+ }
901
+
902
+ var i, p;
903
+
904
+ if ( this.options.custom && this.options.custom.refreshContainers ) {
905
+ this.options.custom.refreshContainers.call( this );
906
+ } else {
907
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
908
+ p = this.containers[ i ].element.offset();
909
+ this.containers[ i ].containerCache.left = p.left;
910
+ this.containers[ i ].containerCache.top = p.top;
911
+ this.containers[ i ].containerCache.width =
912
+ this.containers[ i ].element.outerWidth();
913
+ this.containers[ i ].containerCache.height =
914
+ this.containers[ i ].element.outerHeight();
915
+ }
916
+ }
917
+
918
+ return this;
919
+ },
920
+
921
+ _createPlaceholder: function( that ) {
922
+ that = that || this;
923
+ var className, nodeName,
924
+ o = that.options;
925
+
926
+ if ( !o.placeholder || o.placeholder.constructor === String ) {
927
+ className = o.placeholder;
928
+ nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
929
+ o.placeholder = {
930
+ element: function() {
931
+
932
+ var element = $( "<" + nodeName + ">", that.document[ 0 ] );
933
+
934
+ that._addClass( element, "ui-sortable-placeholder",
935
+ className || that.currentItem[ 0 ].className )
936
+ ._removeClass( element, "ui-sortable-helper" );
937
+
938
+ if ( nodeName === "tbody" ) {
939
+ that._createTrPlaceholder(
940
+ that.currentItem.find( "tr" ).eq( 0 ),
941
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )
942
+ );
943
+ } else if ( nodeName === "tr" ) {
944
+ that._createTrPlaceholder( that.currentItem, element );
945
+ } else if ( nodeName === "img" ) {
946
+ element.attr( "src", that.currentItem.attr( "src" ) );
947
+ }
948
+
949
+ if ( !className ) {
950
+ element.css( "visibility", "hidden" );
951
+ }
952
+
953
+ return element;
954
+ },
955
+ update: function( container, p ) {
956
+
957
+ // 1. If a className is set as 'placeholder option, we don't force sizes -
958
+ // the class is responsible for that
959
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
960
+ // class name is specified
961
+ if ( className && !o.forcePlaceholderSize ) {
962
+ return;
963
+ }
964
+
965
+ // If the element doesn't have a actual height or width by itself (without
966
+ // styles coming from a stylesheet), it receives the inline height and width
967
+ // from the dragged item. Or, if it's a tbody or tr, it's going to have a height
968
+ // anyway since we're populating them with <td>s above, but they're unlikely to
969
+ // be the correct height on their own if the row heights are dynamic, so we'll
970
+ // always assign the height of the dragged item given forcePlaceholderSize
971
+ // is true.
972
+ if ( !p.height() || ( o.forcePlaceholderSize &&
973
+ ( nodeName === "tbody" || nodeName === "tr" ) ) ) {
974
+ p.height(
975
+ that.currentItem.innerHeight() -
976
+ parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
977
+ parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
978
+ }
979
+ if ( !p.width() ) {
980
+ p.width(
981
+ that.currentItem.innerWidth() -
982
+ parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
983
+ parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
984
+ }
985
+ }
986
+ };
987
+ }
988
+
989
+ //Create the placeholder
990
+ that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
991
+
992
+ //Append it after the actual current item
993
+ that.currentItem.after( that.placeholder );
994
+
995
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
996
+ o.placeholder.update( that, that.placeholder );
997
+
998
+ },
999
+
1000
+ _createTrPlaceholder: function( sourceTr, targetTr ) {
1001
+ var that = this;
1002
+
1003
+ sourceTr.children().each( function() {
1004
+ $( "<td>&#160;</td>", that.document[ 0 ] )
1005
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
1006
+ .appendTo( targetTr );
1007
+ } );
1008
+ },
1009
+
1010
+ _contactContainers: function( event ) {
1011
+ var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
1012
+ floating, axis,
1013
+ innermostContainer = null,
1014
+ innermostIndex = null;
1015
+
1016
+ // Get innermost container that intersects with item
1017
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
1018
+
1019
+ // Never consider a container that's located within the item itself
1020
+ if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
1021
+ continue;
1022
+ }
1023
+
1024
+ if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
1025
+
1026
+ // If we've already found a container and it's more "inner" than this, then continue
1027
+ if ( innermostContainer &&
1028
+ $.contains(
1029
+ this.containers[ i ].element[ 0 ],
1030
+ innermostContainer.element[ 0 ] ) ) {
1031
+ continue;
1032
+ }
1033
+
1034
+ innermostContainer = this.containers[ i ];
1035
+ innermostIndex = i;
1036
+
1037
+ } else {
1038
+
1039
+ // container doesn't intersect. trigger "out" event if necessary
1040
+ if ( this.containers[ i ].containerCache.over ) {
1041
+ this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
1042
+ this.containers[ i ].containerCache.over = 0;
1043
+ }
1044
+ }
1045
+
1046
+ }
1047
+
1048
+ this.innermostContainer = innermostContainer;
1049
+
1050
+ // If no intersecting containers found, return
1051
+ if ( !innermostContainer ) {
1052
+ return;
1053
+ }
1054
+
1055
+ // Move the item into the container if it's not there already
1056
+ if ( this.containers.length === 1 ) {
1057
+ if ( !this.containers[ innermostIndex ].containerCache.over ) {
1058
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
1059
+ this.containers[ innermostIndex ].containerCache.over = 1;
1060
+ }
1061
+ } else {
1062
+
1063
+ // When entering a new container, we will find the item with the least distance and
1064
+ // append our item near it
1065
+ dist = 10000;
1066
+ itemWithLeastDistance = null;
1067
+ floating = innermostContainer.floating || this._isFloating( this.currentItem );
1068
+ posProperty = floating ? "left" : "top";
1069
+ sizeProperty = floating ? "width" : "height";
1070
+ axis = floating ? "pageX" : "pageY";
1071
+
1072
+ for ( j = this.items.length - 1; j >= 0; j-- ) {
1073
+ if ( !$.contains(
1074
+ this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
1075
+ ) {
1076
+ continue;
1077
+ }
1078
+ if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
1079
+ continue;
1080
+ }
1081
+
1082
+ cur = this.items[ j ].item.offset()[ posProperty ];
1083
+ nearBottom = false;
1084
+ if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
1085
+ nearBottom = true;
1086
+ }
1087
+
1088
+ if ( Math.abs( event[ axis ] - cur ) < dist ) {
1089
+ dist = Math.abs( event[ axis ] - cur );
1090
+ itemWithLeastDistance = this.items[ j ];
1091
+ this.direction = nearBottom ? "up" : "down";
1092
+ }
1093
+ }
1094
+
1095
+ //Check if dropOnEmpty is enabled
1096
+ if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
1097
+ return;
1098
+ }
1099
+
1100
+ if ( this.currentContainer === this.containers[ innermostIndex ] ) {
1101
+ if ( !this.currentContainer.containerCache.over ) {
1102
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
1103
+ this.currentContainer.containerCache.over = 1;
1104
+ }
1105
+ return;
1106
+ }
1107
+
1108
+ if ( itemWithLeastDistance ) {
1109
+ this._rearrange( event, itemWithLeastDistance, null, true );
1110
+ } else {
1111
+ this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
1112
+ }
1113
+ this._trigger( "change", event, this._uiHash() );
1114
+ this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
1115
+ this.currentContainer = this.containers[ innermostIndex ];
1116
+
1117
+ //Update the placeholder
1118
+ this.options.placeholder.update( this.currentContainer, this.placeholder );
1119
+
1120
+ //Update scrollParent
1121
+ this.scrollParent = this.placeholder.scrollParent();
1122
+
1123
+ //Update overflowOffset
1124
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1125
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
1126
+ this.overflowOffset = this.scrollParent.offset();
1127
+ }
1128
+
1129
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
1130
+ this.containers[ innermostIndex ].containerCache.over = 1;
1131
+ }
1132
+
1133
+ },
1134
+
1135
+ _createHelper: function( event ) {
1136
+
1137
+ var o = this.options,
1138
+ helper = typeof o.helper === "function" ?
1139
+ $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
1140
+ ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
1141
+
1142
+ //Add the helper to the DOM if that didn't happen already
1143
+ if ( !helper.parents( "body" ).length ) {
1144
+ this.appendTo[ 0 ].appendChild( helper[ 0 ] );
1145
+ }
1146
+
1147
+ if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
1148
+ this._storedCSS = {
1149
+ width: this.currentItem[ 0 ].style.width,
1150
+ height: this.currentItem[ 0 ].style.height,
1151
+ position: this.currentItem.css( "position" ),
1152
+ top: this.currentItem.css( "top" ),
1153
+ left: this.currentItem.css( "left" )
1154
+ };
1155
+ }
1156
+
1157
+ if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
1158
+ helper.width( this.currentItem.width() );
1159
+ }
1160
+ if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
1161
+ helper.height( this.currentItem.height() );
1162
+ }
1163
+
1164
+ return helper;
1165
+
1166
+ },
1167
+
1168
+ _adjustOffsetFromHelper: function( obj ) {
1169
+ if ( typeof obj === "string" ) {
1170
+ obj = obj.split( " " );
1171
+ }
1172
+ if ( Array.isArray( obj ) ) {
1173
+ obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
1174
+ }
1175
+ if ( "left" in obj ) {
1176
+ this.offset.click.left = obj.left + this.margins.left;
1177
+ }
1178
+ if ( "right" in obj ) {
1179
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
1180
+ }
1181
+ if ( "top" in obj ) {
1182
+ this.offset.click.top = obj.top + this.margins.top;
1183
+ }
1184
+ if ( "bottom" in obj ) {
1185
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
1186
+ }
1187
+ },
1188
+
1189
+ _getParentOffset: function() {
1190
+
1191
+ //Get the offsetParent and cache its position
1192
+ this.offsetParent = this.helper.offsetParent();
1193
+ var po = this.offsetParent.offset();
1194
+
1195
+ // This is a special case where we need to modify a offset calculated on start, since the
1196
+ // following happened:
1197
+ // 1. The position of the helper is absolute, so it's position is calculated based on the
1198
+ // next positioned parent
1199
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
1200
+ // the document, which means that the scroll is included in the initial calculation of the
1201
+ // offset of the parent, and never recalculated upon drag
1202
+ if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1203
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
1204
+ po.left += this.scrollParent.scrollLeft();
1205
+ po.top += this.scrollParent.scrollTop();
1206
+ }
1207
+
1208
+ // This needs to be actually done for all browsers, since pageX/pageY includes this
1209
+ // information with an ugly IE fix
1210
+ if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
1211
+ ( this.offsetParent[ 0 ].tagName &&
1212
+ this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
1213
+ po = { top: 0, left: 0 };
1214
+ }
1215
+
1216
+ return {
1217
+ top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
1218
+ left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
1219
+ };
1220
+
1221
+ },
1222
+
1223
+ _getRelativeOffset: function() {
1224
+
1225
+ if ( this.cssPosition === "relative" ) {
1226
+ var p = this.currentItem.position();
1227
+ return {
1228
+ top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
1229
+ this.scrollParent.scrollTop(),
1230
+ left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
1231
+ this.scrollParent.scrollLeft()
1232
+ };
1233
+ } else {
1234
+ return { top: 0, left: 0 };
1235
+ }
1236
+
1237
+ },
1238
+
1239
+ _cacheMargins: function() {
1240
+ this.margins = {
1241
+ left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
1242
+ top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
1243
+ };
1244
+ },
1245
+
1246
+ _cacheHelperProportions: function() {
1247
+ this.helperProportions = {
1248
+ width: this.helper.outerWidth(),
1249
+ height: this.helper.outerHeight()
1250
+ };
1251
+ },
1252
+
1253
+ _setContainment: function() {
1254
+
1255
+ var ce, co, over,
1256
+ o = this.options;
1257
+ if ( o.containment === "parent" ) {
1258
+ o.containment = this.helper[ 0 ].parentNode;
1259
+ }
1260
+ if ( o.containment === "document" || o.containment === "window" ) {
1261
+ this.containment = [
1262
+ 0 - this.offset.relative.left - this.offset.parent.left,
1263
+ 0 - this.offset.relative.top - this.offset.parent.top,
1264
+ o.containment === "document" ?
1265
+ this.document.width() :
1266
+ this.window.width() - this.helperProportions.width - this.margins.left,
1267
+ ( o.containment === "document" ?
1268
+ ( this.document.height() || document.body.parentNode.scrollHeight ) :
1269
+ this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
1270
+ ) - this.helperProportions.height - this.margins.top
1271
+ ];
1272
+ }
1273
+
1274
+ if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
1275
+ ce = $( o.containment )[ 0 ];
1276
+ co = $( o.containment ).offset();
1277
+ over = ( $( ce ).css( "overflow" ) !== "hidden" );
1278
+
1279
+ this.containment = [
1280
+ co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
1281
+ ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
1282
+ co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
1283
+ ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
1284
+ co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
1285
+ ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
1286
+ ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
1287
+ this.helperProportions.width - this.margins.left,
1288
+ co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
1289
+ ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
1290
+ ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
1291
+ this.helperProportions.height - this.margins.top
1292
+ ];
1293
+ }
1294
+
1295
+ },
1296
+
1297
+ _convertPositionTo: function( d, pos ) {
1298
+
1299
+ if ( !pos ) {
1300
+ pos = this.position;
1301
+ }
1302
+ var mod = d === "absolute" ? 1 : -1,
1303
+ scroll = this.cssPosition === "absolute" &&
1304
+ !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1305
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
1306
+ this.offsetParent :
1307
+ this.scrollParent,
1308
+ scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
1309
+
1310
+ return {
1311
+ top: (
1312
+
1313
+ // The absolute mouse position
1314
+ pos.top +
1315
+
1316
+ // Only for relative positioned nodes: Relative offset from element to offset parent
1317
+ this.offset.relative.top * mod +
1318
+
1319
+ // The offsetParent's offset without borders (offset + border)
1320
+ this.offset.parent.top * mod -
1321
+ ( ( this.cssPosition === "fixed" ?
1322
+ -this.scrollParent.scrollTop() :
1323
+ ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
1324
+ ),
1325
+ left: (
1326
+
1327
+ // The absolute mouse position
1328
+ pos.left +
1329
+
1330
+ // Only for relative positioned nodes: Relative offset from element to offset parent
1331
+ this.offset.relative.left * mod +
1332
+
1333
+ // The offsetParent's offset without borders (offset + border)
1334
+ this.offset.parent.left * mod -
1335
+ ( ( this.cssPosition === "fixed" ?
1336
+ -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
1337
+ scroll.scrollLeft() ) * mod )
1338
+ )
1339
+ };
1340
+
1341
+ },
1342
+
1343
+ _generatePosition: function( event ) {
1344
+
1345
+ var top, left,
1346
+ o = this.options,
1347
+ pageX = event.pageX,
1348
+ pageY = event.pageY,
1349
+ scroll = this.cssPosition === "absolute" &&
1350
+ !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1351
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
1352
+ this.offsetParent :
1353
+ this.scrollParent,
1354
+ scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
1355
+
1356
+ // This is another very weird special case that only happens for relative elements:
1357
+ // 1. If the css position is relative
1358
+ // 2. and the scroll parent is the document or similar to the offset parent
1359
+ // we have to refresh the relative offset during the scroll so there are no jumps
1360
+ if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1361
+ this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
1362
+ this.offset.relative = this._getRelativeOffset();
1363
+ }
1364
+
1365
+ /*
1366
+ * - Position constraining -
1367
+ * Constrain the position to a mix of grid, containment.
1368
+ */
1369
+
1370
+ if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
1371
+
1372
+ if ( this.containment ) {
1373
+ if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
1374
+ pageX = this.containment[ 0 ] + this.offset.click.left;
1375
+ }
1376
+ if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
1377
+ pageY = this.containment[ 1 ] + this.offset.click.top;
1378
+ }
1379
+ if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
1380
+ pageX = this.containment[ 2 ] + this.offset.click.left;
1381
+ }
1382
+ if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
1383
+ pageY = this.containment[ 3 ] + this.offset.click.top;
1384
+ }
1385
+ }
1386
+
1387
+ if ( o.grid ) {
1388
+ top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
1389
+ o.grid[ 1 ] ) * o.grid[ 1 ];
1390
+ pageY = this.containment ?
1391
+ ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
1392
+ top - this.offset.click.top <= this.containment[ 3 ] ) ?
1393
+ top :
1394
+ ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
1395
+ top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
1396
+ top;
1397
+
1398
+ left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
1399
+ o.grid[ 0 ] ) * o.grid[ 0 ];
1400
+ pageX = this.containment ?
1401
+ ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
1402
+ left - this.offset.click.left <= this.containment[ 2 ] ) ?
1403
+ left :
1404
+ ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
1405
+ left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
1406
+ left;
1407
+ }
1408
+
1409
+ }
1410
+
1411
+ return {
1412
+ top: (
1413
+
1414
+ // The absolute mouse position
1415
+ pageY -
1416
+
1417
+ // Click offset (relative to the element)
1418
+ this.offset.click.top -
1419
+
1420
+ // Only for relative positioned nodes: Relative offset from element to offset parent
1421
+ this.offset.relative.top -
1422
+
1423
+ // The offsetParent's offset without borders (offset + border)
1424
+ this.offset.parent.top +
1425
+ ( ( this.cssPosition === "fixed" ?
1426
+ -this.scrollParent.scrollTop() :
1427
+ ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
1428
+ ),
1429
+ left: (
1430
+
1431
+ // The absolute mouse position
1432
+ pageX -
1433
+
1434
+ // Click offset (relative to the element)
1435
+ this.offset.click.left -
1436
+
1437
+ // Only for relative positioned nodes: Relative offset from element to offset parent
1438
+ this.offset.relative.left -
1439
+
1440
+ // The offsetParent's offset without borders (offset + border)
1441
+ this.offset.parent.left +
1442
+ ( ( this.cssPosition === "fixed" ?
1443
+ -this.scrollParent.scrollLeft() :
1444
+ scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
1445
+ )
1446
+ };
1447
+
1448
+ },
1449
+
1450
+ _rearrange: function( event, i, a, hardRefresh ) {
1451
+
1452
+ if ( a ) {
1453
+ a[ 0 ].appendChild( this.placeholder[ 0 ] );
1454
+ } else {
1455
+ i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
1456
+ ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
1457
+ }
1458
+
1459
+ //Various things done here to improve the performance:
1460
+ // 1. we create a setTimeout, that calls refreshPositions
1461
+ // 2. on the instance, we have a counter variable, that get's higher after every append
1462
+ // 3. on the local scope, we copy the counter variable, and check in the timeout,
1463
+ // if it's still the same
1464
+ // 4. this lets only the last addition to the timeout stack through
1465
+ this.counter = this.counter ? ++this.counter : 1;
1466
+ var counter = this.counter;
1467
+
1468
+ this._delay( function() {
1469
+ if ( counter === this.counter ) {
1470
+
1471
+ //Precompute after each DOM insertion, NOT on mousemove
1472
+ this.refreshPositions( !hardRefresh );
1473
+ }
1474
+ } );
1475
+
1476
+ },
1477
+
1478
+ _clear: function( event, noPropagation ) {
1479
+
1480
+ this.reverting = false;
1481
+
1482
+ // We delay all events that have to be triggered to after the point where the placeholder
1483
+ // has been removed and everything else normalized again
1484
+ var i,
1485
+ delayedTriggers = [];
1486
+
1487
+ // We first have to update the dom position of the actual currentItem
1488
+ // Note: don't do it if the current item is already removed (by a user), or it gets
1489
+ // reappended (see #4088)
1490
+ if ( !this._noFinalSort && this.currentItem.parent().length ) {
1491
+ this.placeholder.before( this.currentItem );
1492
+ }
1493
+ this._noFinalSort = null;
1494
+
1495
+ if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
1496
+ for ( i in this._storedCSS ) {
1497
+ if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
1498
+ this._storedCSS[ i ] = "";
1499
+ }
1500
+ }
1501
+ this.currentItem.css( this._storedCSS );
1502
+ this._removeClass( this.currentItem, "ui-sortable-helper" );
1503
+ } else {
1504
+ this.currentItem.show();
1505
+ }
1506
+
1507
+ if ( this.fromOutside && !noPropagation ) {
1508
+ delayedTriggers.push( function( event ) {
1509
+ this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
1510
+ } );
1511
+ }
1512
+ if ( ( this.fromOutside ||
1513
+ this.domPosition.prev !==
1514
+ this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
1515
+ this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
1516
+
1517
+ // Trigger update callback if the DOM position has changed
1518
+ delayedTriggers.push( function( event ) {
1519
+ this._trigger( "update", event, this._uiHash() );
1520
+ } );
1521
+ }
1522
+
1523
+ // Check if the items Container has Changed and trigger appropriate
1524
+ // events.
1525
+ if ( this !== this.currentContainer ) {
1526
+ if ( !noPropagation ) {
1527
+ delayedTriggers.push( function( event ) {
1528
+ this._trigger( "remove", event, this._uiHash() );
1529
+ } );
1530
+ delayedTriggers.push( ( function( c ) {
1531
+ return function( event ) {
1532
+ c._trigger( "receive", event, this._uiHash( this ) );
1533
+ };
1534
+ } ).call( this, this.currentContainer ) );
1535
+ delayedTriggers.push( ( function( c ) {
1536
+ return function( event ) {
1537
+ c._trigger( "update", event, this._uiHash( this ) );
1538
+ };
1539
+ } ).call( this, this.currentContainer ) );
1540
+ }
1541
+ }
1542
+
1543
+ //Post events to containers
1544
+ function delayEvent( type, instance, container ) {
1545
+ return function( event ) {
1546
+ container._trigger( type, event, instance._uiHash( instance ) );
1547
+ };
1548
+ }
1549
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
1550
+ if ( !noPropagation ) {
1551
+ delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
1552
+ }
1553
+ if ( this.containers[ i ].containerCache.over ) {
1554
+ delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
1555
+ this.containers[ i ].containerCache.over = 0;
1556
+ }
1557
+ }
1558
+
1559
+ //Do what was originally in plugins
1560
+ if ( this.storedCursor ) {
1561
+ this.document.find( "body" ).css( "cursor", this.storedCursor );
1562
+ this.storedStylesheet.remove();
1563
+ }
1564
+ if ( this._storedOpacity ) {
1565
+ this.helper.css( "opacity", this._storedOpacity );
1566
+ }
1567
+ if ( this._storedZIndex ) {
1568
+ this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
1569
+ }
1570
+
1571
+ this.dragging = false;
1572
+
1573
+ if ( !noPropagation ) {
1574
+ this._trigger( "beforeStop", event, this._uiHash() );
1575
+ }
1576
+
1577
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
1578
+ // it unbinds ALL events from the original node!
1579
+ this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
1580
+
1581
+ if ( !this.cancelHelperRemoval ) {
1582
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
1583
+ this.helper.remove();
1584
+ }
1585
+ this.helper = null;
1586
+ }
1587
+
1588
+ if ( !noPropagation ) {
1589
+ for ( i = 0; i < delayedTriggers.length; i++ ) {
1590
+
1591
+ // Trigger all delayed events
1592
+ delayedTriggers[ i ].call( this, event );
1593
+ }
1594
+ this._trigger( "stop", event, this._uiHash() );
1595
+ }
1596
+
1597
+ this.fromOutside = false;
1598
+ return !this.cancelHelperRemoval;
1599
+
1600
+ },
1601
+
1602
+ _trigger: function() {
1603
+ if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
1604
+ this.cancel();
1605
+ }
1606
+ },
1607
+
1608
+ _uiHash: function( _inst ) {
1609
+ var inst = _inst || this;
1610
+ return {
1611
+ helper: inst.helper,
1612
+ placeholder: inst.placeholder || $( [] ),
1613
+ position: inst.position,
1614
+ originalPosition: inst.originalPosition,
1615
+ offset: inst.positionAbs,
1616
+ item: inst.currentItem,
1617
+ sender: _inst ? _inst.element : null
1618
+ };
1619
+ }
1620
+
1621
+ } );
1622
+
1623
+ } );