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,2243 @@
1
+ //= require jquery-ui/version
2
+ //= require jquery-ui/keycode
3
+
4
+ /* eslint-disable max-len, camelcase */
5
+ /*!
6
+ * jQuery UI Datepicker 1.13.0
7
+ * http://jqueryui.com
8
+ *
9
+ * Copyright jQuery Foundation and other contributors
10
+ * Released under the MIT license.
11
+ * http://jquery.org/license
12
+ */
13
+
14
+ //>>label: Datepicker
15
+ //>>group: Widgets
16
+ //>>description: Displays a calendar from an input or inline for selecting dates.
17
+ //>>docs: http://api.jqueryui.com/datepicker/
18
+ //>>demos: http://jqueryui.com/datepicker/
19
+ //>>css.structure: ../../themes/base/core.css
20
+ //>>css.structure: ../../themes/base/datepicker.css
21
+ //>>css.theme: ../../themes/base/theme.css
22
+
23
+ ( function( factory ) {
24
+ "use strict";
25
+
26
+ if ( typeof define === "function" && define.amd ) {
27
+
28
+ // AMD. Register as an anonymous module.
29
+ define( [
30
+ "jquery",
31
+ "../version",
32
+ "../keycode"
33
+ ], factory );
34
+ } else {
35
+
36
+ // Browser globals
37
+ factory( jQuery );
38
+ }
39
+ } )( function( $ ) {
40
+ "use strict";
41
+
42
+ $.extend( $.ui, { datepicker: { version: "1.13.0" } } );
43
+
44
+ var datepicker_instActive;
45
+
46
+ function datepicker_getZindex( elem ) {
47
+ var position, value;
48
+ while ( elem.length && elem[ 0 ] !== document ) {
49
+
50
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
51
+ // This makes behavior of this function consistent across browsers
52
+ // WebKit always returns auto if the element is positioned
53
+ position = elem.css( "position" );
54
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
55
+
56
+ // IE returns 0 when zIndex is not specified
57
+ // other browsers return a string
58
+ // we ignore the case of nested elements with an explicit value of 0
59
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
60
+ value = parseInt( elem.css( "zIndex" ), 10 );
61
+ if ( !isNaN( value ) && value !== 0 ) {
62
+ return value;
63
+ }
64
+ }
65
+ elem = elem.parent();
66
+ }
67
+
68
+ return 0;
69
+ }
70
+
71
+ /* Date picker manager.
72
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
73
+ Settings for (groups of) date pickers are maintained in an instance object,
74
+ allowing multiple different settings on the same page. */
75
+
76
+ function Datepicker() {
77
+ this._curInst = null; // The current instance in use
78
+ this._keyEvent = false; // If the last event was a key event
79
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
80
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
81
+ this._inDialog = false; // True if showing within a "dialog", false if not
82
+ this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
83
+ this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
84
+ this._appendClass = "ui-datepicker-append"; // The name of the append marker class
85
+ this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
86
+ this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
87
+ this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
88
+ this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
89
+ this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
90
+ this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
91
+ this.regional = []; // Available regional settings, indexed by language code
92
+ this.regional[ "" ] = { // Default regional settings
93
+ closeText: "Done", // Display text for close link
94
+ prevText: "Prev", // Display text for previous month link
95
+ nextText: "Next", // Display text for next month link
96
+ currentText: "Today", // Display text for current month link
97
+ monthNames: [ "January", "February", "March", "April", "May", "June",
98
+ "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting
99
+ monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
100
+ dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
101
+ dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
102
+ dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday
103
+ weekHeader: "Wk", // Column header for week of the year
104
+ dateFormat: "mm/dd/yy", // See format options on parseDate
105
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
106
+ isRTL: false, // True if right-to-left language, false if left-to-right
107
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
108
+ yearSuffix: "", // Additional text to append to the year in the month headers,
109
+ selectMonthLabel: "Select month", // Invisible label for month selector
110
+ selectYearLabel: "Select year" // Invisible label for year selector
111
+ };
112
+ this._defaults = { // Global defaults for all the date picker instances
113
+ showOn: "focus", // "focus" for popup on focus,
114
+ // "button" for trigger button, or "both" for either
115
+ showAnim: "fadeIn", // Name of jQuery animation for popup
116
+ showOptions: {}, // Options for enhanced animations
117
+ defaultDate: null, // Used when field is blank: actual date,
118
+ // +/-number for offset from today, null for today
119
+ appendText: "", // Display text following the input box, e.g. showing the format
120
+ buttonText: "...", // Text for trigger button
121
+ buttonImage: "", // URL for trigger button image
122
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
123
+ hideIfNoPrevNext: false, // True to hide next/previous month links
124
+ // if not applicable, false to just disable them
125
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
126
+ gotoCurrent: false, // True if today link goes back to current selection instead
127
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
128
+ changeYear: false, // True if year can be selected directly, false if only prev/next
129
+ yearRange: "c-10:c+10", // Range of years to display in drop-down,
130
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
131
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
132
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
133
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
134
+ showWeek: false, // True to show week of the year, false to not show it
135
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
136
+ // takes a Date and returns the number of the week for it
137
+ shortYearCutoff: "+10", // Short year values < this are in the current century,
138
+ // > this are in the previous century,
139
+ // string value starting with "+" for current year + value
140
+ minDate: null, // The earliest selectable date, or null for no limit
141
+ maxDate: null, // The latest selectable date, or null for no limit
142
+ duration: "fast", // Duration of display/closure
143
+ beforeShowDay: null, // Function that takes a date and returns an array with
144
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
145
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
146
+ beforeShow: null, // Function that takes an input field and
147
+ // returns a set of custom settings for the date picker
148
+ onSelect: null, // Define a callback function when a date is selected
149
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
150
+ onClose: null, // Define a callback function when the datepicker is closed
151
+ onUpdateDatepicker: null, // Define a callback function when the datepicker is updated
152
+ numberOfMonths: 1, // Number of months to show at a time
153
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
154
+ stepMonths: 1, // Number of months to step back/forward
155
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
156
+ altField: "", // Selector for an alternate field to store selected dates into
157
+ altFormat: "", // The date format to use for the alternate field
158
+ constrainInput: true, // The input is constrained by the current date format
159
+ showButtonPanel: false, // True to show button panel, false to not show it
160
+ autoSize: false, // True to size the input for the date format, false to leave as is
161
+ disabled: false // The initial disabled state
162
+ };
163
+ $.extend( this._defaults, this.regional[ "" ] );
164
+ this.regional.en = $.extend( true, {}, this.regional[ "" ] );
165
+ this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
166
+ this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
167
+ }
168
+
169
+ $.extend( Datepicker.prototype, {
170
+
171
+ /* Class name added to elements to indicate already configured with a date picker. */
172
+ markerClassName: "hasDatepicker",
173
+
174
+ //Keep track of the maximum number of rows displayed (see #7043)
175
+ maxRows: 4,
176
+
177
+ // TODO rename to "widget" when switching to widget factory
178
+ _widgetDatepicker: function() {
179
+ return this.dpDiv;
180
+ },
181
+
182
+ /* Override the default settings for all instances of the date picker.
183
+ * @param settings object - the new settings to use as defaults (anonymous object)
184
+ * @return the manager object
185
+ */
186
+ setDefaults: function( settings ) {
187
+ datepicker_extendRemove( this._defaults, settings || {} );
188
+ return this;
189
+ },
190
+
191
+ /* Attach the date picker to a jQuery selection.
192
+ * @param target element - the target input field or division or span
193
+ * @param settings object - the new settings to use for this date picker instance (anonymous)
194
+ */
195
+ _attachDatepicker: function( target, settings ) {
196
+ var nodeName, inline, inst;
197
+ nodeName = target.nodeName.toLowerCase();
198
+ inline = ( nodeName === "div" || nodeName === "span" );
199
+ if ( !target.id ) {
200
+ this.uuid += 1;
201
+ target.id = "dp" + this.uuid;
202
+ }
203
+ inst = this._newInst( $( target ), inline );
204
+ inst.settings = $.extend( {}, settings || {} );
205
+ if ( nodeName === "input" ) {
206
+ this._connectDatepicker( target, inst );
207
+ } else if ( inline ) {
208
+ this._inlineDatepicker( target, inst );
209
+ }
210
+ },
211
+
212
+ /* Create a new instance object. */
213
+ _newInst: function( target, inline ) {
214
+ var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
215
+ return { id: id, input: target, // associated target
216
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
217
+ drawMonth: 0, drawYear: 0, // month being drawn
218
+ inline: inline, // is datepicker inline or not
219
+ dpDiv: ( !inline ? this.dpDiv : // presentation div
220
+ datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
221
+ },
222
+
223
+ /* Attach the date picker to an input field. */
224
+ _connectDatepicker: function( target, inst ) {
225
+ var input = $( target );
226
+ inst.append = $( [] );
227
+ inst.trigger = $( [] );
228
+ if ( input.hasClass( this.markerClassName ) ) {
229
+ return;
230
+ }
231
+ this._attachments( input, inst );
232
+ input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
233
+ on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
234
+ this._autoSize( inst );
235
+ $.data( target, "datepicker", inst );
236
+
237
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
238
+ if ( inst.settings.disabled ) {
239
+ this._disableDatepicker( target );
240
+ }
241
+ },
242
+
243
+ /* Make attachments based on settings. */
244
+ _attachments: function( input, inst ) {
245
+ var showOn, buttonText, buttonImage,
246
+ appendText = this._get( inst, "appendText" ),
247
+ isRTL = this._get( inst, "isRTL" );
248
+
249
+ if ( inst.append ) {
250
+ inst.append.remove();
251
+ }
252
+ if ( appendText ) {
253
+ inst.append = $( "<span>" )
254
+ .addClass( this._appendClass )
255
+ .text( appendText );
256
+ input[ isRTL ? "before" : "after" ]( inst.append );
257
+ }
258
+
259
+ input.off( "focus", this._showDatepicker );
260
+
261
+ if ( inst.trigger ) {
262
+ inst.trigger.remove();
263
+ }
264
+
265
+ showOn = this._get( inst, "showOn" );
266
+ if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
267
+ input.on( "focus", this._showDatepicker );
268
+ }
269
+ if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
270
+ buttonText = this._get( inst, "buttonText" );
271
+ buttonImage = this._get( inst, "buttonImage" );
272
+
273
+ if ( this._get( inst, "buttonImageOnly" ) ) {
274
+ inst.trigger = $( "<img>" )
275
+ .addClass( this._triggerClass )
276
+ .attr( {
277
+ src: buttonImage,
278
+ alt: buttonText,
279
+ title: buttonText
280
+ } );
281
+ } else {
282
+ inst.trigger = $( "<button type='button'>" )
283
+ .addClass( this._triggerClass );
284
+ if ( buttonImage ) {
285
+ inst.trigger.html(
286
+ $( "<img>" )
287
+ .attr( {
288
+ src: buttonImage,
289
+ alt: buttonText,
290
+ title: buttonText
291
+ } )
292
+ );
293
+ } else {
294
+ inst.trigger.text( buttonText );
295
+ }
296
+ }
297
+
298
+ input[ isRTL ? "before" : "after" ]( inst.trigger );
299
+ inst.trigger.on( "click", function() {
300
+ if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
301
+ $.datepicker._hideDatepicker();
302
+ } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
303
+ $.datepicker._hideDatepicker();
304
+ $.datepicker._showDatepicker( input[ 0 ] );
305
+ } else {
306
+ $.datepicker._showDatepicker( input[ 0 ] );
307
+ }
308
+ return false;
309
+ } );
310
+ }
311
+ },
312
+
313
+ /* Apply the maximum length for the date format. */
314
+ _autoSize: function( inst ) {
315
+ if ( this._get( inst, "autoSize" ) && !inst.inline ) {
316
+ var findMax, max, maxI, i,
317
+ date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
318
+ dateFormat = this._get( inst, "dateFormat" );
319
+
320
+ if ( dateFormat.match( /[DM]/ ) ) {
321
+ findMax = function( names ) {
322
+ max = 0;
323
+ maxI = 0;
324
+ for ( i = 0; i < names.length; i++ ) {
325
+ if ( names[ i ].length > max ) {
326
+ max = names[ i ].length;
327
+ maxI = i;
328
+ }
329
+ }
330
+ return maxI;
331
+ };
332
+ date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
333
+ "monthNames" : "monthNamesShort" ) ) ) );
334
+ date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
335
+ "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
336
+ }
337
+ inst.input.attr( "size", this._formatDate( inst, date ).length );
338
+ }
339
+ },
340
+
341
+ /* Attach an inline date picker to a div. */
342
+ _inlineDatepicker: function( target, inst ) {
343
+ var divSpan = $( target );
344
+ if ( divSpan.hasClass( this.markerClassName ) ) {
345
+ return;
346
+ }
347
+ divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
348
+ $.data( target, "datepicker", inst );
349
+ this._setDate( inst, this._getDefaultDate( inst ), true );
350
+ this._updateDatepicker( inst );
351
+ this._updateAlternate( inst );
352
+
353
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
354
+ if ( inst.settings.disabled ) {
355
+ this._disableDatepicker( target );
356
+ }
357
+
358
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
359
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
360
+ inst.dpDiv.css( "display", "block" );
361
+ },
362
+
363
+ /* Pop-up the date picker in a "dialog" box.
364
+ * @param input element - ignored
365
+ * @param date string or Date - the initial date to display
366
+ * @param onSelect function - the function to call when a date is selected
367
+ * @param settings object - update the dialog date picker instance's settings (anonymous object)
368
+ * @param pos int[2] - coordinates for the dialog's position within the screen or
369
+ * event - with x/y coordinates or
370
+ * leave empty for default (screen centre)
371
+ * @return the manager object
372
+ */
373
+ _dialogDatepicker: function( input, date, onSelect, settings, pos ) {
374
+ var id, browserWidth, browserHeight, scrollX, scrollY,
375
+ inst = this._dialogInst; // internal instance
376
+
377
+ if ( !inst ) {
378
+ this.uuid += 1;
379
+ id = "dp" + this.uuid;
380
+ this._dialogInput = $( "<input type='text' id='" + id +
381
+ "' style='position: absolute; top: -100px; width: 0px;'/>" );
382
+ this._dialogInput.on( "keydown", this._doKeyDown );
383
+ $( "body" ).append( this._dialogInput );
384
+ inst = this._dialogInst = this._newInst( this._dialogInput, false );
385
+ inst.settings = {};
386
+ $.data( this._dialogInput[ 0 ], "datepicker", inst );
387
+ }
388
+ datepicker_extendRemove( inst.settings, settings || {} );
389
+ date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
390
+ this._dialogInput.val( date );
391
+
392
+ this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
393
+ if ( !this._pos ) {
394
+ browserWidth = document.documentElement.clientWidth;
395
+ browserHeight = document.documentElement.clientHeight;
396
+ scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
397
+ scrollY = document.documentElement.scrollTop || document.body.scrollTop;
398
+ this._pos = // should use actual width/height below
399
+ [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
400
+ }
401
+
402
+ // Move input on screen for focus, but hidden behind dialog
403
+ this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
404
+ inst.settings.onSelect = onSelect;
405
+ this._inDialog = true;
406
+ this.dpDiv.addClass( this._dialogClass );
407
+ this._showDatepicker( this._dialogInput[ 0 ] );
408
+ if ( $.blockUI ) {
409
+ $.blockUI( this.dpDiv );
410
+ }
411
+ $.data( this._dialogInput[ 0 ], "datepicker", inst );
412
+ return this;
413
+ },
414
+
415
+ /* Detach a datepicker from its control.
416
+ * @param target element - the target input field or division or span
417
+ */
418
+ _destroyDatepicker: function( target ) {
419
+ var nodeName,
420
+ $target = $( target ),
421
+ inst = $.data( target, "datepicker" );
422
+
423
+ if ( !$target.hasClass( this.markerClassName ) ) {
424
+ return;
425
+ }
426
+
427
+ nodeName = target.nodeName.toLowerCase();
428
+ $.removeData( target, "datepicker" );
429
+ if ( nodeName === "input" ) {
430
+ inst.append.remove();
431
+ inst.trigger.remove();
432
+ $target.removeClass( this.markerClassName ).
433
+ off( "focus", this._showDatepicker ).
434
+ off( "keydown", this._doKeyDown ).
435
+ off( "keypress", this._doKeyPress ).
436
+ off( "keyup", this._doKeyUp );
437
+ } else if ( nodeName === "div" || nodeName === "span" ) {
438
+ $target.removeClass( this.markerClassName ).empty();
439
+ }
440
+
441
+ if ( datepicker_instActive === inst ) {
442
+ datepicker_instActive = null;
443
+ this._curInst = null;
444
+ }
445
+ },
446
+
447
+ /* Enable the date picker to a jQuery selection.
448
+ * @param target element - the target input field or division or span
449
+ */
450
+ _enableDatepicker: function( target ) {
451
+ var nodeName, inline,
452
+ $target = $( target ),
453
+ inst = $.data( target, "datepicker" );
454
+
455
+ if ( !$target.hasClass( this.markerClassName ) ) {
456
+ return;
457
+ }
458
+
459
+ nodeName = target.nodeName.toLowerCase();
460
+ if ( nodeName === "input" ) {
461
+ target.disabled = false;
462
+ inst.trigger.filter( "button" ).
463
+ each( function() {
464
+ this.disabled = false;
465
+ } ).end().
466
+ filter( "img" ).css( { opacity: "1.0", cursor: "" } );
467
+ } else if ( nodeName === "div" || nodeName === "span" ) {
468
+ inline = $target.children( "." + this._inlineClass );
469
+ inline.children().removeClass( "ui-state-disabled" );
470
+ inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
471
+ prop( "disabled", false );
472
+ }
473
+ this._disabledInputs = $.map( this._disabledInputs,
474
+
475
+ // Delete entry
476
+ function( value ) {
477
+ return ( value === target ? null : value );
478
+ } );
479
+ },
480
+
481
+ /* Disable the date picker to a jQuery selection.
482
+ * @param target element - the target input field or division or span
483
+ */
484
+ _disableDatepicker: function( target ) {
485
+ var nodeName, inline,
486
+ $target = $( target ),
487
+ inst = $.data( target, "datepicker" );
488
+
489
+ if ( !$target.hasClass( this.markerClassName ) ) {
490
+ return;
491
+ }
492
+
493
+ nodeName = target.nodeName.toLowerCase();
494
+ if ( nodeName === "input" ) {
495
+ target.disabled = true;
496
+ inst.trigger.filter( "button" ).
497
+ each( function() {
498
+ this.disabled = true;
499
+ } ).end().
500
+ filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
501
+ } else if ( nodeName === "div" || nodeName === "span" ) {
502
+ inline = $target.children( "." + this._inlineClass );
503
+ inline.children().addClass( "ui-state-disabled" );
504
+ inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
505
+ prop( "disabled", true );
506
+ }
507
+ this._disabledInputs = $.map( this._disabledInputs,
508
+
509
+ // Delete entry
510
+ function( value ) {
511
+ return ( value === target ? null : value );
512
+ } );
513
+ this._disabledInputs[ this._disabledInputs.length ] = target;
514
+ },
515
+
516
+ /* Is the first field in a jQuery collection disabled as a datepicker?
517
+ * @param target element - the target input field or division or span
518
+ * @return boolean - true if disabled, false if enabled
519
+ */
520
+ _isDisabledDatepicker: function( target ) {
521
+ if ( !target ) {
522
+ return false;
523
+ }
524
+ for ( var i = 0; i < this._disabledInputs.length; i++ ) {
525
+ if ( this._disabledInputs[ i ] === target ) {
526
+ return true;
527
+ }
528
+ }
529
+ return false;
530
+ },
531
+
532
+ /* Retrieve the instance data for the target control.
533
+ * @param target element - the target input field or division or span
534
+ * @return object - the associated instance data
535
+ * @throws error if a jQuery problem getting data
536
+ */
537
+ _getInst: function( target ) {
538
+ try {
539
+ return $.data( target, "datepicker" );
540
+ } catch ( err ) {
541
+ throw "Missing instance data for this datepicker";
542
+ }
543
+ },
544
+
545
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
546
+ * @param target element - the target input field or division or span
547
+ * @param name object - the new settings to update or
548
+ * string - the name of the setting to change or retrieve,
549
+ * when retrieving also "all" for all instance settings or
550
+ * "defaults" for all global defaults
551
+ * @param value any - the new value for the setting
552
+ * (omit if above is an object or to retrieve a value)
553
+ */
554
+ _optionDatepicker: function( target, name, value ) {
555
+ var settings, date, minDate, maxDate,
556
+ inst = this._getInst( target );
557
+
558
+ if ( arguments.length === 2 && typeof name === "string" ) {
559
+ return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
560
+ ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
561
+ this._get( inst, name ) ) : null ) );
562
+ }
563
+
564
+ settings = name || {};
565
+ if ( typeof name === "string" ) {
566
+ settings = {};
567
+ settings[ name ] = value;
568
+ }
569
+
570
+ if ( inst ) {
571
+ if ( this._curInst === inst ) {
572
+ this._hideDatepicker();
573
+ }
574
+
575
+ date = this._getDateDatepicker( target, true );
576
+ minDate = this._getMinMaxDate( inst, "min" );
577
+ maxDate = this._getMinMaxDate( inst, "max" );
578
+ datepicker_extendRemove( inst.settings, settings );
579
+
580
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
581
+ if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
582
+ inst.settings.minDate = this._formatDate( inst, minDate );
583
+ }
584
+ if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
585
+ inst.settings.maxDate = this._formatDate( inst, maxDate );
586
+ }
587
+ if ( "disabled" in settings ) {
588
+ if ( settings.disabled ) {
589
+ this._disableDatepicker( target );
590
+ } else {
591
+ this._enableDatepicker( target );
592
+ }
593
+ }
594
+ this._attachments( $( target ), inst );
595
+ this._autoSize( inst );
596
+ this._setDate( inst, date );
597
+ this._updateAlternate( inst );
598
+ this._updateDatepicker( inst );
599
+ }
600
+ },
601
+
602
+ // Change method deprecated
603
+ _changeDatepicker: function( target, name, value ) {
604
+ this._optionDatepicker( target, name, value );
605
+ },
606
+
607
+ /* Redraw the date picker attached to an input field or division.
608
+ * @param target element - the target input field or division or span
609
+ */
610
+ _refreshDatepicker: function( target ) {
611
+ var inst = this._getInst( target );
612
+ if ( inst ) {
613
+ this._updateDatepicker( inst );
614
+ }
615
+ },
616
+
617
+ /* Set the dates for a jQuery selection.
618
+ * @param target element - the target input field or division or span
619
+ * @param date Date - the new date
620
+ */
621
+ _setDateDatepicker: function( target, date ) {
622
+ var inst = this._getInst( target );
623
+ if ( inst ) {
624
+ this._setDate( inst, date );
625
+ this._updateDatepicker( inst );
626
+ this._updateAlternate( inst );
627
+ }
628
+ },
629
+
630
+ /* Get the date(s) for the first entry in a jQuery selection.
631
+ * @param target element - the target input field or division or span
632
+ * @param noDefault boolean - true if no default date is to be used
633
+ * @return Date - the current date
634
+ */
635
+ _getDateDatepicker: function( target, noDefault ) {
636
+ var inst = this._getInst( target );
637
+ if ( inst && !inst.inline ) {
638
+ this._setDateFromField( inst, noDefault );
639
+ }
640
+ return ( inst ? this._getDate( inst ) : null );
641
+ },
642
+
643
+ /* Handle keystrokes. */
644
+ _doKeyDown: function( event ) {
645
+ var onSelect, dateStr, sel,
646
+ inst = $.datepicker._getInst( event.target ),
647
+ handled = true,
648
+ isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
649
+
650
+ inst._keyEvent = true;
651
+ if ( $.datepicker._datepickerShowing ) {
652
+ switch ( event.keyCode ) {
653
+ case 9: $.datepicker._hideDatepicker();
654
+ handled = false;
655
+ break; // hide on tab out
656
+ case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
657
+ $.datepicker._currentClass + ")", inst.dpDiv );
658
+ if ( sel[ 0 ] ) {
659
+ $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
660
+ }
661
+
662
+ onSelect = $.datepicker._get( inst, "onSelect" );
663
+ if ( onSelect ) {
664
+ dateStr = $.datepicker._formatDate( inst );
665
+
666
+ // Trigger custom callback
667
+ onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
668
+ } else {
669
+ $.datepicker._hideDatepicker();
670
+ }
671
+
672
+ return false; // don't submit the form
673
+ case 27: $.datepicker._hideDatepicker();
674
+ break; // hide on escape
675
+ case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
676
+ -$.datepicker._get( inst, "stepBigMonths" ) :
677
+ -$.datepicker._get( inst, "stepMonths" ) ), "M" );
678
+ break; // previous month/year on page up/+ ctrl
679
+ case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
680
+ +$.datepicker._get( inst, "stepBigMonths" ) :
681
+ +$.datepicker._get( inst, "stepMonths" ) ), "M" );
682
+ break; // next month/year on page down/+ ctrl
683
+ case 35: if ( event.ctrlKey || event.metaKey ) {
684
+ $.datepicker._clearDate( event.target );
685
+ }
686
+ handled = event.ctrlKey || event.metaKey;
687
+ break; // clear on ctrl or command +end
688
+ case 36: if ( event.ctrlKey || event.metaKey ) {
689
+ $.datepicker._gotoToday( event.target );
690
+ }
691
+ handled = event.ctrlKey || event.metaKey;
692
+ break; // current on ctrl or command +home
693
+ case 37: if ( event.ctrlKey || event.metaKey ) {
694
+ $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
695
+ }
696
+ handled = event.ctrlKey || event.metaKey;
697
+
698
+ // -1 day on ctrl or command +left
699
+ if ( event.originalEvent.altKey ) {
700
+ $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
701
+ -$.datepicker._get( inst, "stepBigMonths" ) :
702
+ -$.datepicker._get( inst, "stepMonths" ) ), "M" );
703
+ }
704
+
705
+ // next month/year on alt +left on Mac
706
+ break;
707
+ case 38: if ( event.ctrlKey || event.metaKey ) {
708
+ $.datepicker._adjustDate( event.target, -7, "D" );
709
+ }
710
+ handled = event.ctrlKey || event.metaKey;
711
+ break; // -1 week on ctrl or command +up
712
+ case 39: if ( event.ctrlKey || event.metaKey ) {
713
+ $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
714
+ }
715
+ handled = event.ctrlKey || event.metaKey;
716
+
717
+ // +1 day on ctrl or command +right
718
+ if ( event.originalEvent.altKey ) {
719
+ $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
720
+ +$.datepicker._get( inst, "stepBigMonths" ) :
721
+ +$.datepicker._get( inst, "stepMonths" ) ), "M" );
722
+ }
723
+
724
+ // next month/year on alt +right
725
+ break;
726
+ case 40: if ( event.ctrlKey || event.metaKey ) {
727
+ $.datepicker._adjustDate( event.target, +7, "D" );
728
+ }
729
+ handled = event.ctrlKey || event.metaKey;
730
+ break; // +1 week on ctrl or command +down
731
+ default: handled = false;
732
+ }
733
+ } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
734
+ $.datepicker._showDatepicker( this );
735
+ } else {
736
+ handled = false;
737
+ }
738
+
739
+ if ( handled ) {
740
+ event.preventDefault();
741
+ event.stopPropagation();
742
+ }
743
+ },
744
+
745
+ /* Filter entered characters - based on date format. */
746
+ _doKeyPress: function( event ) {
747
+ var chars, chr,
748
+ inst = $.datepicker._getInst( event.target );
749
+
750
+ if ( $.datepicker._get( inst, "constrainInput" ) ) {
751
+ chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
752
+ chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
753
+ return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
754
+ }
755
+ },
756
+
757
+ /* Synchronise manual entry and field/alternate field. */
758
+ _doKeyUp: function( event ) {
759
+ var date,
760
+ inst = $.datepicker._getInst( event.target );
761
+
762
+ if ( inst.input.val() !== inst.lastVal ) {
763
+ try {
764
+ date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
765
+ ( inst.input ? inst.input.val() : null ),
766
+ $.datepicker._getFormatConfig( inst ) );
767
+
768
+ if ( date ) { // only if valid
769
+ $.datepicker._setDateFromField( inst );
770
+ $.datepicker._updateAlternate( inst );
771
+ $.datepicker._updateDatepicker( inst );
772
+ }
773
+ } catch ( err ) {
774
+ }
775
+ }
776
+ return true;
777
+ },
778
+
779
+ /* Pop-up the date picker for a given input field.
780
+ * If false returned from beforeShow event handler do not show.
781
+ * @param input element - the input field attached to the date picker or
782
+ * event - if triggered by focus
783
+ */
784
+ _showDatepicker: function( input ) {
785
+ input = input.target || input;
786
+ if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
787
+ input = $( "input", input.parentNode )[ 0 ];
788
+ }
789
+
790
+ if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
791
+ return;
792
+ }
793
+
794
+ var inst, beforeShow, beforeShowSettings, isFixed,
795
+ offset, showAnim, duration;
796
+
797
+ inst = $.datepicker._getInst( input );
798
+ if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
799
+ $.datepicker._curInst.dpDiv.stop( true, true );
800
+ if ( inst && $.datepicker._datepickerShowing ) {
801
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
802
+ }
803
+ }
804
+
805
+ beforeShow = $.datepicker._get( inst, "beforeShow" );
806
+ beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
807
+ if ( beforeShowSettings === false ) {
808
+ return;
809
+ }
810
+ datepicker_extendRemove( inst.settings, beforeShowSettings );
811
+
812
+ inst.lastVal = null;
813
+ $.datepicker._lastInput = input;
814
+ $.datepicker._setDateFromField( inst );
815
+
816
+ if ( $.datepicker._inDialog ) { // hide cursor
817
+ input.value = "";
818
+ }
819
+ if ( !$.datepicker._pos ) { // position below input
820
+ $.datepicker._pos = $.datepicker._findPos( input );
821
+ $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
822
+ }
823
+
824
+ isFixed = false;
825
+ $( input ).parents().each( function() {
826
+ isFixed |= $( this ).css( "position" ) === "fixed";
827
+ return !isFixed;
828
+ } );
829
+
830
+ offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
831
+ $.datepicker._pos = null;
832
+
833
+ //to avoid flashes on Firefox
834
+ inst.dpDiv.empty();
835
+
836
+ // determine sizing offscreen
837
+ inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
838
+ $.datepicker._updateDatepicker( inst );
839
+
840
+ // fix width for dynamic number of date pickers
841
+ // and adjust position before showing
842
+ offset = $.datepicker._checkOffset( inst, offset, isFixed );
843
+ inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
844
+ "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
845
+ left: offset.left + "px", top: offset.top + "px" } );
846
+
847
+ if ( !inst.inline ) {
848
+ showAnim = $.datepicker._get( inst, "showAnim" );
849
+ duration = $.datepicker._get( inst, "duration" );
850
+ inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
851
+ $.datepicker._datepickerShowing = true;
852
+
853
+ if ( $.effects && $.effects.effect[ showAnim ] ) {
854
+ inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
855
+ } else {
856
+ inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
857
+ }
858
+
859
+ if ( $.datepicker._shouldFocusInput( inst ) ) {
860
+ inst.input.trigger( "focus" );
861
+ }
862
+
863
+ $.datepicker._curInst = inst;
864
+ }
865
+ },
866
+
867
+ /* Generate the date picker content. */
868
+ _updateDatepicker: function( inst ) {
869
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
870
+ datepicker_instActive = inst; // for delegate hover events
871
+ inst.dpDiv.empty().append( this._generateHTML( inst ) );
872
+ this._attachHandlers( inst );
873
+
874
+ var origyearshtml,
875
+ numMonths = this._getNumberOfMonths( inst ),
876
+ cols = numMonths[ 1 ],
877
+ width = 17,
878
+ activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ),
879
+ onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" );
880
+
881
+ if ( activeCell.length > 0 ) {
882
+ datepicker_handleMouseover.apply( activeCell.get( 0 ) );
883
+ }
884
+
885
+ inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
886
+ if ( cols > 1 ) {
887
+ inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
888
+ }
889
+ inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
890
+ "Class" ]( "ui-datepicker-multi" );
891
+ inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
892
+ "Class" ]( "ui-datepicker-rtl" );
893
+
894
+ if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
895
+ inst.input.trigger( "focus" );
896
+ }
897
+
898
+ // Deffered render of the years select (to avoid flashes on Firefox)
899
+ if ( inst.yearshtml ) {
900
+ origyearshtml = inst.yearshtml;
901
+ setTimeout( function() {
902
+
903
+ //assure that inst.yearshtml didn't change.
904
+ if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
905
+ inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml );
906
+ }
907
+ origyearshtml = inst.yearshtml = null;
908
+ }, 0 );
909
+ }
910
+
911
+ if ( onUpdateDatepicker ) {
912
+ onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] );
913
+ }
914
+ },
915
+
916
+ // #6694 - don't focus the input if it's already focused
917
+ // this breaks the change event in IE
918
+ // Support: IE and jQuery <1.9
919
+ _shouldFocusInput: function( inst ) {
920
+ return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
921
+ },
922
+
923
+ /* Check positioning to remain on screen. */
924
+ _checkOffset: function( inst, offset, isFixed ) {
925
+ var dpWidth = inst.dpDiv.outerWidth(),
926
+ dpHeight = inst.dpDiv.outerHeight(),
927
+ inputWidth = inst.input ? inst.input.outerWidth() : 0,
928
+ inputHeight = inst.input ? inst.input.outerHeight() : 0,
929
+ viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
930
+ viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
931
+
932
+ offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
933
+ offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
934
+ offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
935
+
936
+ // Now check if datepicker is showing outside window viewport - move to a better place if so.
937
+ offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
938
+ Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
939
+ offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
940
+ Math.abs( dpHeight + inputHeight ) : 0 );
941
+
942
+ return offset;
943
+ },
944
+
945
+ /* Find an object's position on the screen. */
946
+ _findPos: function( obj ) {
947
+ var position,
948
+ inst = this._getInst( obj ),
949
+ isRTL = this._get( inst, "isRTL" );
950
+
951
+ while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) {
952
+ obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
953
+ }
954
+
955
+ position = $( obj ).offset();
956
+ return [ position.left, position.top ];
957
+ },
958
+
959
+ /* Hide the date picker from view.
960
+ * @param input element - the input field attached to the date picker
961
+ */
962
+ _hideDatepicker: function( input ) {
963
+ var showAnim, duration, postProcess, onClose,
964
+ inst = this._curInst;
965
+
966
+ if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
967
+ return;
968
+ }
969
+
970
+ if ( this._datepickerShowing ) {
971
+ showAnim = this._get( inst, "showAnim" );
972
+ duration = this._get( inst, "duration" );
973
+ postProcess = function() {
974
+ $.datepicker._tidyDialog( inst );
975
+ };
976
+
977
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
978
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
979
+ inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
980
+ } else {
981
+ inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
982
+ ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
983
+ }
984
+
985
+ if ( !showAnim ) {
986
+ postProcess();
987
+ }
988
+ this._datepickerShowing = false;
989
+
990
+ onClose = this._get( inst, "onClose" );
991
+ if ( onClose ) {
992
+ onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
993
+ }
994
+
995
+ this._lastInput = null;
996
+ if ( this._inDialog ) {
997
+ this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
998
+ if ( $.blockUI ) {
999
+ $.unblockUI();
1000
+ $( "body" ).append( this.dpDiv );
1001
+ }
1002
+ }
1003
+ this._inDialog = false;
1004
+ }
1005
+ },
1006
+
1007
+ /* Tidy up after a dialog display. */
1008
+ _tidyDialog: function( inst ) {
1009
+ inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
1010
+ },
1011
+
1012
+ /* Close date picker if clicked elsewhere. */
1013
+ _checkExternalClick: function( event ) {
1014
+ if ( !$.datepicker._curInst ) {
1015
+ return;
1016
+ }
1017
+
1018
+ var $target = $( event.target ),
1019
+ inst = $.datepicker._getInst( $target[ 0 ] );
1020
+
1021
+ if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
1022
+ $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
1023
+ !$target.hasClass( $.datepicker.markerClassName ) &&
1024
+ !$target.closest( "." + $.datepicker._triggerClass ).length &&
1025
+ $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
1026
+ ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
1027
+ $.datepicker._hideDatepicker();
1028
+ }
1029
+ },
1030
+
1031
+ /* Adjust one of the date sub-fields. */
1032
+ _adjustDate: function( id, offset, period ) {
1033
+ var target = $( id ),
1034
+ inst = this._getInst( target[ 0 ] );
1035
+
1036
+ if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
1037
+ return;
1038
+ }
1039
+ this._adjustInstDate( inst, offset, period );
1040
+ this._updateDatepicker( inst );
1041
+ },
1042
+
1043
+ /* Action for current link. */
1044
+ _gotoToday: function( id ) {
1045
+ var date,
1046
+ target = $( id ),
1047
+ inst = this._getInst( target[ 0 ] );
1048
+
1049
+ if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
1050
+ inst.selectedDay = inst.currentDay;
1051
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
1052
+ inst.drawYear = inst.selectedYear = inst.currentYear;
1053
+ } else {
1054
+ date = new Date();
1055
+ inst.selectedDay = date.getDate();
1056
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
1057
+ inst.drawYear = inst.selectedYear = date.getFullYear();
1058
+ }
1059
+ this._notifyChange( inst );
1060
+ this._adjustDate( target );
1061
+ },
1062
+
1063
+ /* Action for selecting a new month/year. */
1064
+ _selectMonthYear: function( id, select, period ) {
1065
+ var target = $( id ),
1066
+ inst = this._getInst( target[ 0 ] );
1067
+
1068
+ inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
1069
+ inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
1070
+ parseInt( select.options[ select.selectedIndex ].value, 10 );
1071
+
1072
+ this._notifyChange( inst );
1073
+ this._adjustDate( target );
1074
+ },
1075
+
1076
+ /* Action for selecting a day. */
1077
+ _selectDay: function( id, month, year, td ) {
1078
+ var inst,
1079
+ target = $( id );
1080
+
1081
+ if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
1082
+ return;
1083
+ }
1084
+
1085
+ inst = this._getInst( target[ 0 ] );
1086
+ inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );
1087
+ inst.selectedMonth = inst.currentMonth = month;
1088
+ inst.selectedYear = inst.currentYear = year;
1089
+ this._selectDate( id, this._formatDate( inst,
1090
+ inst.currentDay, inst.currentMonth, inst.currentYear ) );
1091
+ },
1092
+
1093
+ /* Erase the input field and hide the date picker. */
1094
+ _clearDate: function( id ) {
1095
+ var target = $( id );
1096
+ this._selectDate( target, "" );
1097
+ },
1098
+
1099
+ /* Update the input field with the selected date. */
1100
+ _selectDate: function( id, dateStr ) {
1101
+ var onSelect,
1102
+ target = $( id ),
1103
+ inst = this._getInst( target[ 0 ] );
1104
+
1105
+ dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
1106
+ if ( inst.input ) {
1107
+ inst.input.val( dateStr );
1108
+ }
1109
+ this._updateAlternate( inst );
1110
+
1111
+ onSelect = this._get( inst, "onSelect" );
1112
+ if ( onSelect ) {
1113
+ onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback
1114
+ } else if ( inst.input ) {
1115
+ inst.input.trigger( "change" ); // fire the change event
1116
+ }
1117
+
1118
+ if ( inst.inline ) {
1119
+ this._updateDatepicker( inst );
1120
+ } else {
1121
+ this._hideDatepicker();
1122
+ this._lastInput = inst.input[ 0 ];
1123
+ if ( typeof( inst.input[ 0 ] ) !== "object" ) {
1124
+ inst.input.trigger( "focus" ); // restore focus
1125
+ }
1126
+ this._lastInput = null;
1127
+ }
1128
+ },
1129
+
1130
+ /* Update any alternate field to synchronise with the main field. */
1131
+ _updateAlternate: function( inst ) {
1132
+ var altFormat, date, dateStr,
1133
+ altField = this._get( inst, "altField" );
1134
+
1135
+ if ( altField ) { // update alternate field too
1136
+ altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
1137
+ date = this._getDate( inst );
1138
+ dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
1139
+ $( document ).find( altField ).val( dateStr );
1140
+ }
1141
+ },
1142
+
1143
+ /* Set as beforeShowDay function to prevent selection of weekends.
1144
+ * @param date Date - the date to customise
1145
+ * @return [boolean, string] - is this date selectable?, what is its CSS class?
1146
+ */
1147
+ noWeekends: function( date ) {
1148
+ var day = date.getDay();
1149
+ return [ ( day > 0 && day < 6 ), "" ];
1150
+ },
1151
+
1152
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
1153
+ * @param date Date - the date to get the week for
1154
+ * @return number - the number of the week within the year that contains this date
1155
+ */
1156
+ iso8601Week: function( date ) {
1157
+ var time,
1158
+ checkDate = new Date( date.getTime() );
1159
+
1160
+ // Find Thursday of this week starting on Monday
1161
+ checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
1162
+
1163
+ time = checkDate.getTime();
1164
+ checkDate.setMonth( 0 ); // Compare with Jan 1
1165
+ checkDate.setDate( 1 );
1166
+ return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
1167
+ },
1168
+
1169
+ /* Parse a string value into a date object.
1170
+ * See formatDate below for the possible formats.
1171
+ *
1172
+ * @param format string - the expected format of the date
1173
+ * @param value string - the date in the above format
1174
+ * @param settings Object - attributes include:
1175
+ * shortYearCutoff number - the cutoff year for determining the century (optional)
1176
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1177
+ * dayNames string[7] - names of the days from Sunday (optional)
1178
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
1179
+ * monthNames string[12] - names of the months (optional)
1180
+ * @return Date - the extracted date value or null if value is blank
1181
+ */
1182
+ parseDate: function( format, value, settings ) {
1183
+ if ( format == null || value == null ) {
1184
+ throw "Invalid arguments";
1185
+ }
1186
+
1187
+ value = ( typeof value === "object" ? value.toString() : value + "" );
1188
+ if ( value === "" ) {
1189
+ return null;
1190
+ }
1191
+
1192
+ var iFormat, dim, extra,
1193
+ iValue = 0,
1194
+ shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
1195
+ shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
1196
+ new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
1197
+ dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
1198
+ dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
1199
+ monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
1200
+ monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
1201
+ year = -1,
1202
+ month = -1,
1203
+ day = -1,
1204
+ doy = -1,
1205
+ literal = false,
1206
+ date,
1207
+
1208
+ // Check whether a format character is doubled
1209
+ lookAhead = function( match ) {
1210
+ var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
1211
+ if ( matches ) {
1212
+ iFormat++;
1213
+ }
1214
+ return matches;
1215
+ },
1216
+
1217
+ // Extract a number from the string value
1218
+ getNumber = function( match ) {
1219
+ var isDoubled = lookAhead( match ),
1220
+ size = ( match === "@" ? 14 : ( match === "!" ? 20 :
1221
+ ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
1222
+ minSize = ( match === "y" ? size : 1 ),
1223
+ digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
1224
+ num = value.substring( iValue ).match( digits );
1225
+ if ( !num ) {
1226
+ throw "Missing number at position " + iValue;
1227
+ }
1228
+ iValue += num[ 0 ].length;
1229
+ return parseInt( num[ 0 ], 10 );
1230
+ },
1231
+
1232
+ // Extract a name from the string value and convert to an index
1233
+ getName = function( match, shortNames, longNames ) {
1234
+ var index = -1,
1235
+ names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
1236
+ return [ [ k, v ] ];
1237
+ } ).sort( function( a, b ) {
1238
+ return -( a[ 1 ].length - b[ 1 ].length );
1239
+ } );
1240
+
1241
+ $.each( names, function( i, pair ) {
1242
+ var name = pair[ 1 ];
1243
+ if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
1244
+ index = pair[ 0 ];
1245
+ iValue += name.length;
1246
+ return false;
1247
+ }
1248
+ } );
1249
+ if ( index !== -1 ) {
1250
+ return index + 1;
1251
+ } else {
1252
+ throw "Unknown name at position " + iValue;
1253
+ }
1254
+ },
1255
+
1256
+ // Confirm that a literal character matches the string value
1257
+ checkLiteral = function() {
1258
+ if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
1259
+ throw "Unexpected literal at position " + iValue;
1260
+ }
1261
+ iValue++;
1262
+ };
1263
+
1264
+ for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
1265
+ if ( literal ) {
1266
+ if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
1267
+ literal = false;
1268
+ } else {
1269
+ checkLiteral();
1270
+ }
1271
+ } else {
1272
+ switch ( format.charAt( iFormat ) ) {
1273
+ case "d":
1274
+ day = getNumber( "d" );
1275
+ break;
1276
+ case "D":
1277
+ getName( "D", dayNamesShort, dayNames );
1278
+ break;
1279
+ case "o":
1280
+ doy = getNumber( "o" );
1281
+ break;
1282
+ case "m":
1283
+ month = getNumber( "m" );
1284
+ break;
1285
+ case "M":
1286
+ month = getName( "M", monthNamesShort, monthNames );
1287
+ break;
1288
+ case "y":
1289
+ year = getNumber( "y" );
1290
+ break;
1291
+ case "@":
1292
+ date = new Date( getNumber( "@" ) );
1293
+ year = date.getFullYear();
1294
+ month = date.getMonth() + 1;
1295
+ day = date.getDate();
1296
+ break;
1297
+ case "!":
1298
+ date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
1299
+ year = date.getFullYear();
1300
+ month = date.getMonth() + 1;
1301
+ day = date.getDate();
1302
+ break;
1303
+ case "'":
1304
+ if ( lookAhead( "'" ) ) {
1305
+ checkLiteral();
1306
+ } else {
1307
+ literal = true;
1308
+ }
1309
+ break;
1310
+ default:
1311
+ checkLiteral();
1312
+ }
1313
+ }
1314
+ }
1315
+
1316
+ if ( iValue < value.length ) {
1317
+ extra = value.substr( iValue );
1318
+ if ( !/^\s+/.test( extra ) ) {
1319
+ throw "Extra/unparsed characters found in date: " + extra;
1320
+ }
1321
+ }
1322
+
1323
+ if ( year === -1 ) {
1324
+ year = new Date().getFullYear();
1325
+ } else if ( year < 100 ) {
1326
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
1327
+ ( year <= shortYearCutoff ? 0 : -100 );
1328
+ }
1329
+
1330
+ if ( doy > -1 ) {
1331
+ month = 1;
1332
+ day = doy;
1333
+ do {
1334
+ dim = this._getDaysInMonth( year, month - 1 );
1335
+ if ( day <= dim ) {
1336
+ break;
1337
+ }
1338
+ month++;
1339
+ day -= dim;
1340
+ } while ( true );
1341
+ }
1342
+
1343
+ date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
1344
+ if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
1345
+ throw "Invalid date"; // E.g. 31/02/00
1346
+ }
1347
+ return date;
1348
+ },
1349
+
1350
+ /* Standard date formats. */
1351
+ ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
1352
+ COOKIE: "D, dd M yy",
1353
+ ISO_8601: "yy-mm-dd",
1354
+ RFC_822: "D, d M y",
1355
+ RFC_850: "DD, dd-M-y",
1356
+ RFC_1036: "D, d M y",
1357
+ RFC_1123: "D, d M yy",
1358
+ RFC_2822: "D, d M yy",
1359
+ RSS: "D, d M y", // RFC 822
1360
+ TICKS: "!",
1361
+ TIMESTAMP: "@",
1362
+ W3C: "yy-mm-dd", // ISO 8601
1363
+
1364
+ _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
1365
+ Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
1366
+
1367
+ /* Format a date object into a string value.
1368
+ * The format can be combinations of the following:
1369
+ * d - day of month (no leading zero)
1370
+ * dd - day of month (two digit)
1371
+ * o - day of year (no leading zeros)
1372
+ * oo - day of year (three digit)
1373
+ * D - day name short
1374
+ * DD - day name long
1375
+ * m - month of year (no leading zero)
1376
+ * mm - month of year (two digit)
1377
+ * M - month name short
1378
+ * MM - month name long
1379
+ * y - year (two digit)
1380
+ * yy - year (four digit)
1381
+ * @ - Unix timestamp (ms since 01/01/1970)
1382
+ * ! - Windows ticks (100ns since 01/01/0001)
1383
+ * "..." - literal text
1384
+ * '' - single quote
1385
+ *
1386
+ * @param format string - the desired format of the date
1387
+ * @param date Date - the date value to format
1388
+ * @param settings Object - attributes include:
1389
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1390
+ * dayNames string[7] - names of the days from Sunday (optional)
1391
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
1392
+ * monthNames string[12] - names of the months (optional)
1393
+ * @return string - the date in the above format
1394
+ */
1395
+ formatDate: function( format, date, settings ) {
1396
+ if ( !date ) {
1397
+ return "";
1398
+ }
1399
+
1400
+ var iFormat,
1401
+ dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
1402
+ dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
1403
+ monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
1404
+ monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
1405
+
1406
+ // Check whether a format character is doubled
1407
+ lookAhead = function( match ) {
1408
+ var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
1409
+ if ( matches ) {
1410
+ iFormat++;
1411
+ }
1412
+ return matches;
1413
+ },
1414
+
1415
+ // Format a number, with leading zero if necessary
1416
+ formatNumber = function( match, value, len ) {
1417
+ var num = "" + value;
1418
+ if ( lookAhead( match ) ) {
1419
+ while ( num.length < len ) {
1420
+ num = "0" + num;
1421
+ }
1422
+ }
1423
+ return num;
1424
+ },
1425
+
1426
+ // Format a name, short or long as requested
1427
+ formatName = function( match, value, shortNames, longNames ) {
1428
+ return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
1429
+ },
1430
+ output = "",
1431
+ literal = false;
1432
+
1433
+ if ( date ) {
1434
+ for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
1435
+ if ( literal ) {
1436
+ if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
1437
+ literal = false;
1438
+ } else {
1439
+ output += format.charAt( iFormat );
1440
+ }
1441
+ } else {
1442
+ switch ( format.charAt( iFormat ) ) {
1443
+ case "d":
1444
+ output += formatNumber( "d", date.getDate(), 2 );
1445
+ break;
1446
+ case "D":
1447
+ output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
1448
+ break;
1449
+ case "o":
1450
+ output += formatNumber( "o",
1451
+ Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
1452
+ break;
1453
+ case "m":
1454
+ output += formatNumber( "m", date.getMonth() + 1, 2 );
1455
+ break;
1456
+ case "M":
1457
+ output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
1458
+ break;
1459
+ case "y":
1460
+ output += ( lookAhead( "y" ) ? date.getFullYear() :
1461
+ ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
1462
+ break;
1463
+ case "@":
1464
+ output += date.getTime();
1465
+ break;
1466
+ case "!":
1467
+ output += date.getTime() * 10000 + this._ticksTo1970;
1468
+ break;
1469
+ case "'":
1470
+ if ( lookAhead( "'" ) ) {
1471
+ output += "'";
1472
+ } else {
1473
+ literal = true;
1474
+ }
1475
+ break;
1476
+ default:
1477
+ output += format.charAt( iFormat );
1478
+ }
1479
+ }
1480
+ }
1481
+ }
1482
+ return output;
1483
+ },
1484
+
1485
+ /* Extract all possible characters from the date format. */
1486
+ _possibleChars: function( format ) {
1487
+ var iFormat,
1488
+ chars = "",
1489
+ literal = false,
1490
+
1491
+ // Check whether a format character is doubled
1492
+ lookAhead = function( match ) {
1493
+ var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
1494
+ if ( matches ) {
1495
+ iFormat++;
1496
+ }
1497
+ return matches;
1498
+ };
1499
+
1500
+ for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
1501
+ if ( literal ) {
1502
+ if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
1503
+ literal = false;
1504
+ } else {
1505
+ chars += format.charAt( iFormat );
1506
+ }
1507
+ } else {
1508
+ switch ( format.charAt( iFormat ) ) {
1509
+ case "d": case "m": case "y": case "@":
1510
+ chars += "0123456789";
1511
+ break;
1512
+ case "D": case "M":
1513
+ return null; // Accept anything
1514
+ case "'":
1515
+ if ( lookAhead( "'" ) ) {
1516
+ chars += "'";
1517
+ } else {
1518
+ literal = true;
1519
+ }
1520
+ break;
1521
+ default:
1522
+ chars += format.charAt( iFormat );
1523
+ }
1524
+ }
1525
+ }
1526
+ return chars;
1527
+ },
1528
+
1529
+ /* Get a setting value, defaulting if necessary. */
1530
+ _get: function( inst, name ) {
1531
+ return inst.settings[ name ] !== undefined ?
1532
+ inst.settings[ name ] : this._defaults[ name ];
1533
+ },
1534
+
1535
+ /* Parse existing date and initialise date picker. */
1536
+ _setDateFromField: function( inst, noDefault ) {
1537
+ if ( inst.input.val() === inst.lastVal ) {
1538
+ return;
1539
+ }
1540
+
1541
+ var dateFormat = this._get( inst, "dateFormat" ),
1542
+ dates = inst.lastVal = inst.input ? inst.input.val() : null,
1543
+ defaultDate = this._getDefaultDate( inst ),
1544
+ date = defaultDate,
1545
+ settings = this._getFormatConfig( inst );
1546
+
1547
+ try {
1548
+ date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
1549
+ } catch ( event ) {
1550
+ dates = ( noDefault ? "" : dates );
1551
+ }
1552
+ inst.selectedDay = date.getDate();
1553
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
1554
+ inst.drawYear = inst.selectedYear = date.getFullYear();
1555
+ inst.currentDay = ( dates ? date.getDate() : 0 );
1556
+ inst.currentMonth = ( dates ? date.getMonth() : 0 );
1557
+ inst.currentYear = ( dates ? date.getFullYear() : 0 );
1558
+ this._adjustInstDate( inst );
1559
+ },
1560
+
1561
+ /* Retrieve the default date shown on opening. */
1562
+ _getDefaultDate: function( inst ) {
1563
+ return this._restrictMinMax( inst,
1564
+ this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
1565
+ },
1566
+
1567
+ /* A date may be specified as an exact value or a relative one. */
1568
+ _determineDate: function( inst, date, defaultDate ) {
1569
+ var offsetNumeric = function( offset ) {
1570
+ var date = new Date();
1571
+ date.setDate( date.getDate() + offset );
1572
+ return date;
1573
+ },
1574
+ offsetString = function( offset ) {
1575
+ try {
1576
+ return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
1577
+ offset, $.datepicker._getFormatConfig( inst ) );
1578
+ } catch ( e ) {
1579
+
1580
+ // Ignore
1581
+ }
1582
+
1583
+ var date = ( offset.toLowerCase().match( /^c/ ) ?
1584
+ $.datepicker._getDate( inst ) : null ) || new Date(),
1585
+ year = date.getFullYear(),
1586
+ month = date.getMonth(),
1587
+ day = date.getDate(),
1588
+ pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
1589
+ matches = pattern.exec( offset );
1590
+
1591
+ while ( matches ) {
1592
+ switch ( matches[ 2 ] || "d" ) {
1593
+ case "d" : case "D" :
1594
+ day += parseInt( matches[ 1 ], 10 ); break;
1595
+ case "w" : case "W" :
1596
+ day += parseInt( matches[ 1 ], 10 ) * 7; break;
1597
+ case "m" : case "M" :
1598
+ month += parseInt( matches[ 1 ], 10 );
1599
+ day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
1600
+ break;
1601
+ case "y": case "Y" :
1602
+ year += parseInt( matches[ 1 ], 10 );
1603
+ day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
1604
+ break;
1605
+ }
1606
+ matches = pattern.exec( offset );
1607
+ }
1608
+ return new Date( year, month, day );
1609
+ },
1610
+ newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
1611
+ ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
1612
+
1613
+ newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
1614
+ if ( newDate ) {
1615
+ newDate.setHours( 0 );
1616
+ newDate.setMinutes( 0 );
1617
+ newDate.setSeconds( 0 );
1618
+ newDate.setMilliseconds( 0 );
1619
+ }
1620
+ return this._daylightSavingAdjust( newDate );
1621
+ },
1622
+
1623
+ /* Handle switch to/from daylight saving.
1624
+ * Hours may be non-zero on daylight saving cut-over:
1625
+ * > 12 when midnight changeover, but then cannot generate
1626
+ * midnight datetime, so jump to 1AM, otherwise reset.
1627
+ * @param date (Date) the date to check
1628
+ * @return (Date) the corrected date
1629
+ */
1630
+ _daylightSavingAdjust: function( date ) {
1631
+ if ( !date ) {
1632
+ return null;
1633
+ }
1634
+ date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
1635
+ return date;
1636
+ },
1637
+
1638
+ /* Set the date(s) directly. */
1639
+ _setDate: function( inst, date, noChange ) {
1640
+ var clear = !date,
1641
+ origMonth = inst.selectedMonth,
1642
+ origYear = inst.selectedYear,
1643
+ newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
1644
+
1645
+ inst.selectedDay = inst.currentDay = newDate.getDate();
1646
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
1647
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
1648
+ if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
1649
+ this._notifyChange( inst );
1650
+ }
1651
+ this._adjustInstDate( inst );
1652
+ if ( inst.input ) {
1653
+ inst.input.val( clear ? "" : this._formatDate( inst ) );
1654
+ }
1655
+ },
1656
+
1657
+ /* Retrieve the date(s) directly. */
1658
+ _getDate: function( inst ) {
1659
+ var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
1660
+ this._daylightSavingAdjust( new Date(
1661
+ inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
1662
+ return startDate;
1663
+ },
1664
+
1665
+ /* Attach the onxxx handlers. These are declared statically so
1666
+ * they work with static code transformers like Caja.
1667
+ */
1668
+ _attachHandlers: function( inst ) {
1669
+ var stepMonths = this._get( inst, "stepMonths" ),
1670
+ id = "#" + inst.id.replace( /\\\\/g, "\\" );
1671
+ inst.dpDiv.find( "[data-handler]" ).map( function() {
1672
+ var handler = {
1673
+ prev: function() {
1674
+ $.datepicker._adjustDate( id, -stepMonths, "M" );
1675
+ },
1676
+ next: function() {
1677
+ $.datepicker._adjustDate( id, +stepMonths, "M" );
1678
+ },
1679
+ hide: function() {
1680
+ $.datepicker._hideDatepicker();
1681
+ },
1682
+ today: function() {
1683
+ $.datepicker._gotoToday( id );
1684
+ },
1685
+ selectDay: function() {
1686
+ $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
1687
+ return false;
1688
+ },
1689
+ selectMonth: function() {
1690
+ $.datepicker._selectMonthYear( id, this, "M" );
1691
+ return false;
1692
+ },
1693
+ selectYear: function() {
1694
+ $.datepicker._selectMonthYear( id, this, "Y" );
1695
+ return false;
1696
+ }
1697
+ };
1698
+ $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
1699
+ } );
1700
+ },
1701
+
1702
+ /* Generate the HTML for the current state of the date picker. */
1703
+ _generateHTML: function( inst ) {
1704
+ var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
1705
+ controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
1706
+ monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
1707
+ selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
1708
+ cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
1709
+ printDate, dRow, tbody, daySettings, otherMonth, unselectable,
1710
+ tempDate = new Date(),
1711
+ today = this._daylightSavingAdjust(
1712
+ new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
1713
+ isRTL = this._get( inst, "isRTL" ),
1714
+ showButtonPanel = this._get( inst, "showButtonPanel" ),
1715
+ hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
1716
+ navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
1717
+ numMonths = this._getNumberOfMonths( inst ),
1718
+ showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
1719
+ stepMonths = this._get( inst, "stepMonths" ),
1720
+ isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
1721
+ currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
1722
+ new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
1723
+ minDate = this._getMinMaxDate( inst, "min" ),
1724
+ maxDate = this._getMinMaxDate( inst, "max" ),
1725
+ drawMonth = inst.drawMonth - showCurrentAtPos,
1726
+ drawYear = inst.drawYear;
1727
+
1728
+ if ( drawMonth < 0 ) {
1729
+ drawMonth += 12;
1730
+ drawYear--;
1731
+ }
1732
+ if ( maxDate ) {
1733
+ maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
1734
+ maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
1735
+ maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
1736
+ while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
1737
+ drawMonth--;
1738
+ if ( drawMonth < 0 ) {
1739
+ drawMonth = 11;
1740
+ drawYear--;
1741
+ }
1742
+ }
1743
+ }
1744
+ inst.drawMonth = drawMonth;
1745
+ inst.drawYear = drawYear;
1746
+
1747
+ prevText = this._get( inst, "prevText" );
1748
+ prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
1749
+ this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
1750
+ this._getFormatConfig( inst ) ) );
1751
+
1752
+ if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {
1753
+ prev = $( "<a>" )
1754
+ .attr( {
1755
+ "class": "ui-datepicker-prev ui-corner-all",
1756
+ "data-handler": "prev",
1757
+ "data-event": "click",
1758
+ title: prevText
1759
+ } )
1760
+ .append(
1761
+ $( "<span>" )
1762
+ .addClass( "ui-icon ui-icon-circle-triangle-" +
1763
+ ( isRTL ? "e" : "w" ) )
1764
+ .text( prevText )
1765
+ )[ 0 ].outerHTML;
1766
+ } else if ( hideIfNoPrevNext ) {
1767
+ prev = "";
1768
+ } else {
1769
+ prev = $( "<a>" )
1770
+ .attr( {
1771
+ "class": "ui-datepicker-prev ui-corner-all ui-state-disabled",
1772
+ title: prevText
1773
+ } )
1774
+ .append(
1775
+ $( "<span>" )
1776
+ .addClass( "ui-icon ui-icon-circle-triangle-" +
1777
+ ( isRTL ? "e" : "w" ) )
1778
+ .text( prevText )
1779
+ )[ 0 ].outerHTML;
1780
+ }
1781
+
1782
+ nextText = this._get( inst, "nextText" );
1783
+ nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
1784
+ this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
1785
+ this._getFormatConfig( inst ) ) );
1786
+
1787
+ if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {
1788
+ next = $( "<a>" )
1789
+ .attr( {
1790
+ "class": "ui-datepicker-next ui-corner-all",
1791
+ "data-handler": "next",
1792
+ "data-event": "click",
1793
+ title: nextText
1794
+ } )
1795
+ .append(
1796
+ $( "<span>" )
1797
+ .addClass( "ui-icon ui-icon-circle-triangle-" +
1798
+ ( isRTL ? "w" : "e" ) )
1799
+ .text( nextText )
1800
+ )[ 0 ].outerHTML;
1801
+ } else if ( hideIfNoPrevNext ) {
1802
+ next = "";
1803
+ } else {
1804
+ next = $( "<a>" )
1805
+ .attr( {
1806
+ "class": "ui-datepicker-next ui-corner-all ui-state-disabled",
1807
+ title: nextText
1808
+ } )
1809
+ .append(
1810
+ $( "<span>" )
1811
+ .attr( "class", "ui-icon ui-icon-circle-triangle-" +
1812
+ ( isRTL ? "w" : "e" ) )
1813
+ .text( nextText )
1814
+ )[ 0 ].outerHTML;
1815
+ }
1816
+
1817
+ currentText = this._get( inst, "currentText" );
1818
+ gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
1819
+ currentText = ( !navigationAsDateFormat ? currentText :
1820
+ this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
1821
+
1822
+ controls = "";
1823
+ if ( !inst.inline ) {
1824
+ controls = $( "<button>" )
1825
+ .attr( {
1826
+ type: "button",
1827
+ "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all",
1828
+ "data-handler": "hide",
1829
+ "data-event": "click"
1830
+ } )
1831
+ .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML;
1832
+ }
1833
+
1834
+ buttonPanel = "";
1835
+ if ( showButtonPanel ) {
1836
+ buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" )
1837
+ .append( isRTL ? controls : "" )
1838
+ .append( this._isInRange( inst, gotoDate ) ?
1839
+ $( "<button>" )
1840
+ .attr( {
1841
+ type: "button",
1842
+ "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all",
1843
+ "data-handler": "today",
1844
+ "data-event": "click"
1845
+ } )
1846
+ .text( currentText ) :
1847
+ "" )
1848
+ .append( isRTL ? "" : controls )[ 0 ].outerHTML;
1849
+ }
1850
+
1851
+ firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
1852
+ firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
1853
+
1854
+ showWeek = this._get( inst, "showWeek" );
1855
+ dayNames = this._get( inst, "dayNames" );
1856
+ dayNamesMin = this._get( inst, "dayNamesMin" );
1857
+ monthNames = this._get( inst, "monthNames" );
1858
+ monthNamesShort = this._get( inst, "monthNamesShort" );
1859
+ beforeShowDay = this._get( inst, "beforeShowDay" );
1860
+ showOtherMonths = this._get( inst, "showOtherMonths" );
1861
+ selectOtherMonths = this._get( inst, "selectOtherMonths" );
1862
+ defaultDate = this._getDefaultDate( inst );
1863
+ html = "";
1864
+
1865
+ for ( row = 0; row < numMonths[ 0 ]; row++ ) {
1866
+ group = "";
1867
+ this.maxRows = 4;
1868
+ for ( col = 0; col < numMonths[ 1 ]; col++ ) {
1869
+ selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
1870
+ cornerClass = " ui-corner-all";
1871
+ calender = "";
1872
+ if ( isMultiMonth ) {
1873
+ calender += "<div class='ui-datepicker-group";
1874
+ if ( numMonths[ 1 ] > 1 ) {
1875
+ switch ( col ) {
1876
+ case 0: calender += " ui-datepicker-group-first";
1877
+ cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
1878
+ case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
1879
+ cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
1880
+ default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
1881
+ }
1882
+ }
1883
+ calender += "'>";
1884
+ }
1885
+ calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
1886
+ ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
1887
+ ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
1888
+ this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
1889
+ row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
1890
+ "</div><table class='ui-datepicker-calendar'><thead>" +
1891
+ "<tr>";
1892
+ thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
1893
+ for ( dow = 0; dow < 7; dow++ ) { // days of the week
1894
+ day = ( dow + firstDay ) % 7;
1895
+ thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
1896
+ "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
1897
+ }
1898
+ calender += thead + "</tr></thead><tbody>";
1899
+ daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
1900
+ if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
1901
+ inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
1902
+ }
1903
+ leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
1904
+ curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
1905
+ numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
1906
+ this.maxRows = numRows;
1907
+ printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
1908
+ for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
1909
+ calender += "<tr>";
1910
+ tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
1911
+ this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
1912
+ for ( dow = 0; dow < 7; dow++ ) { // create date picker days
1913
+ daySettings = ( beforeShowDay ?
1914
+ beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
1915
+ otherMonth = ( printDate.getMonth() !== drawMonth );
1916
+ unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
1917
+ ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
1918
+ tbody += "<td class='" +
1919
+ ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
1920
+ ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
1921
+ ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
1922
+ ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?
1923
+
1924
+ // or defaultDate is current printedDate and defaultDate is selectedDate
1925
+ " " + this._dayOverClass : "" ) + // highlight selected day
1926
+ ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days
1927
+ ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
1928
+ ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
1929
+ ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
1930
+ ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title
1931
+ ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
1932
+ ( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
1933
+ ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
1934
+ ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
1935
+ ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
1936
+ ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
1937
+ "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
1938
+ "' data-date='" + printDate.getDate() + // store date as data
1939
+ "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
1940
+ printDate.setDate( printDate.getDate() + 1 );
1941
+ printDate = this._daylightSavingAdjust( printDate );
1942
+ }
1943
+ calender += tbody + "</tr>";
1944
+ }
1945
+ drawMonth++;
1946
+ if ( drawMonth > 11 ) {
1947
+ drawMonth = 0;
1948
+ drawYear++;
1949
+ }
1950
+ calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
1951
+ ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
1952
+ group += calender;
1953
+ }
1954
+ html += group;
1955
+ }
1956
+ html += buttonPanel;
1957
+ inst._keyEvent = false;
1958
+ return html;
1959
+ },
1960
+
1961
+ /* Generate the month and year header. */
1962
+ _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
1963
+ secondary, monthNames, monthNamesShort ) {
1964
+
1965
+ var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
1966
+ changeMonth = this._get( inst, "changeMonth" ),
1967
+ changeYear = this._get( inst, "changeYear" ),
1968
+ showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
1969
+ selectMonthLabel = this._get( inst, "selectMonthLabel" ),
1970
+ selectYearLabel = this._get( inst, "selectYearLabel" ),
1971
+ html = "<div class='ui-datepicker-title'>",
1972
+ monthHtml = "";
1973
+
1974
+ // Month selection
1975
+ if ( secondary || !changeMonth ) {
1976
+ monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
1977
+ } else {
1978
+ inMinYear = ( minDate && minDate.getFullYear() === drawYear );
1979
+ inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
1980
+ monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";
1981
+ for ( month = 0; month < 12; month++ ) {
1982
+ if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
1983
+ monthHtml += "<option value='" + month + "'" +
1984
+ ( month === drawMonth ? " selected='selected'" : "" ) +
1985
+ ">" + monthNamesShort[ month ] + "</option>";
1986
+ }
1987
+ }
1988
+ monthHtml += "</select>";
1989
+ }
1990
+
1991
+ if ( !showMonthAfterYear ) {
1992
+ html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" );
1993
+ }
1994
+
1995
+ // Year selection
1996
+ if ( !inst.yearshtml ) {
1997
+ inst.yearshtml = "";
1998
+ if ( secondary || !changeYear ) {
1999
+ html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
2000
+ } else {
2001
+
2002
+ // determine range of years to display
2003
+ years = this._get( inst, "yearRange" ).split( ":" );
2004
+ thisYear = new Date().getFullYear();
2005
+ determineYear = function( value ) {
2006
+ var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
2007
+ ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
2008
+ parseInt( value, 10 ) ) );
2009
+ return ( isNaN( year ) ? thisYear : year );
2010
+ };
2011
+ year = determineYear( years[ 0 ] );
2012
+ endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
2013
+ year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
2014
+ endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
2015
+ inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";
2016
+ for ( ; year <= endYear; year++ ) {
2017
+ inst.yearshtml += "<option value='" + year + "'" +
2018
+ ( year === drawYear ? " selected='selected'" : "" ) +
2019
+ ">" + year + "</option>";
2020
+ }
2021
+ inst.yearshtml += "</select>";
2022
+
2023
+ html += inst.yearshtml;
2024
+ inst.yearshtml = null;
2025
+ }
2026
+ }
2027
+
2028
+ html += this._get( inst, "yearSuffix" );
2029
+ if ( showMonthAfterYear ) {
2030
+ html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml;
2031
+ }
2032
+ html += "</div>"; // Close datepicker_header
2033
+ return html;
2034
+ },
2035
+
2036
+ /* Adjust one of the date sub-fields. */
2037
+ _adjustInstDate: function( inst, offset, period ) {
2038
+ var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
2039
+ month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
2040
+ day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
2041
+ date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );
2042
+
2043
+ inst.selectedDay = date.getDate();
2044
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
2045
+ inst.drawYear = inst.selectedYear = date.getFullYear();
2046
+ if ( period === "M" || period === "Y" ) {
2047
+ this._notifyChange( inst );
2048
+ }
2049
+ },
2050
+
2051
+ /* Ensure a date is within any min/max bounds. */
2052
+ _restrictMinMax: function( inst, date ) {
2053
+ var minDate = this._getMinMaxDate( inst, "min" ),
2054
+ maxDate = this._getMinMaxDate( inst, "max" ),
2055
+ newDate = ( minDate && date < minDate ? minDate : date );
2056
+ return ( maxDate && newDate > maxDate ? maxDate : newDate );
2057
+ },
2058
+
2059
+ /* Notify change of month/year. */
2060
+ _notifyChange: function( inst ) {
2061
+ var onChange = this._get( inst, "onChangeMonthYear" );
2062
+ if ( onChange ) {
2063
+ onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
2064
+ [ inst.selectedYear, inst.selectedMonth + 1, inst ] );
2065
+ }
2066
+ },
2067
+
2068
+ /* Determine the number of months to show. */
2069
+ _getNumberOfMonths: function( inst ) {
2070
+ var numMonths = this._get( inst, "numberOfMonths" );
2071
+ return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
2072
+ },
2073
+
2074
+ /* Determine the current maximum date - ensure no time components are set. */
2075
+ _getMinMaxDate: function( inst, minMax ) {
2076
+ return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
2077
+ },
2078
+
2079
+ /* Find the number of days in a given month. */
2080
+ _getDaysInMonth: function( year, month ) {
2081
+ return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
2082
+ },
2083
+
2084
+ /* Find the day of the week of the first of a month. */
2085
+ _getFirstDayOfMonth: function( year, month ) {
2086
+ return new Date( year, month, 1 ).getDay();
2087
+ },
2088
+
2089
+ /* Determines if we should allow a "next/prev" month display change. */
2090
+ _canAdjustMonth: function( inst, offset, curYear, curMonth ) {
2091
+ var numMonths = this._getNumberOfMonths( inst ),
2092
+ date = this._daylightSavingAdjust( new Date( curYear,
2093
+ curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );
2094
+
2095
+ if ( offset < 0 ) {
2096
+ date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
2097
+ }
2098
+ return this._isInRange( inst, date );
2099
+ },
2100
+
2101
+ /* Is the given date in the accepted range? */
2102
+ _isInRange: function( inst, date ) {
2103
+ var yearSplit, currentYear,
2104
+ minDate = this._getMinMaxDate( inst, "min" ),
2105
+ maxDate = this._getMinMaxDate( inst, "max" ),
2106
+ minYear = null,
2107
+ maxYear = null,
2108
+ years = this._get( inst, "yearRange" );
2109
+ if ( years ) {
2110
+ yearSplit = years.split( ":" );
2111
+ currentYear = new Date().getFullYear();
2112
+ minYear = parseInt( yearSplit[ 0 ], 10 );
2113
+ maxYear = parseInt( yearSplit[ 1 ], 10 );
2114
+ if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
2115
+ minYear += currentYear;
2116
+ }
2117
+ if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
2118
+ maxYear += currentYear;
2119
+ }
2120
+ }
2121
+
2122
+ return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
2123
+ ( !maxDate || date.getTime() <= maxDate.getTime() ) &&
2124
+ ( !minYear || date.getFullYear() >= minYear ) &&
2125
+ ( !maxYear || date.getFullYear() <= maxYear ) );
2126
+ },
2127
+
2128
+ /* Provide the configuration settings for formatting/parsing. */
2129
+ _getFormatConfig: function( inst ) {
2130
+ var shortYearCutoff = this._get( inst, "shortYearCutoff" );
2131
+ shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
2132
+ new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
2133
+ return { shortYearCutoff: shortYearCutoff,
2134
+ dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
2135
+ monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
2136
+ },
2137
+
2138
+ /* Format the given date for display. */
2139
+ _formatDate: function( inst, day, month, year ) {
2140
+ if ( !day ) {
2141
+ inst.currentDay = inst.selectedDay;
2142
+ inst.currentMonth = inst.selectedMonth;
2143
+ inst.currentYear = inst.selectedYear;
2144
+ }
2145
+ var date = ( day ? ( typeof day === "object" ? day :
2146
+ this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
2147
+ this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
2148
+ return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
2149
+ }
2150
+ } );
2151
+
2152
+ /*
2153
+ * Bind hover events for datepicker elements.
2154
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
2155
+ * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
2156
+ */
2157
+ function datepicker_bindHover( dpDiv ) {
2158
+ var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
2159
+ return dpDiv.on( "mouseout", selector, function() {
2160
+ $( this ).removeClass( "ui-state-hover" );
2161
+ if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
2162
+ $( this ).removeClass( "ui-datepicker-prev-hover" );
2163
+ }
2164
+ if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
2165
+ $( this ).removeClass( "ui-datepicker-next-hover" );
2166
+ }
2167
+ } )
2168
+ .on( "mouseover", selector, datepicker_handleMouseover );
2169
+ }
2170
+
2171
+ function datepicker_handleMouseover() {
2172
+ if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
2173
+ $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
2174
+ $( this ).addClass( "ui-state-hover" );
2175
+ if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
2176
+ $( this ).addClass( "ui-datepicker-prev-hover" );
2177
+ }
2178
+ if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
2179
+ $( this ).addClass( "ui-datepicker-next-hover" );
2180
+ }
2181
+ }
2182
+ }
2183
+
2184
+ /* jQuery extend now ignores nulls! */
2185
+ function datepicker_extendRemove( target, props ) {
2186
+ $.extend( target, props );
2187
+ for ( var name in props ) {
2188
+ if ( props[ name ] == null ) {
2189
+ target[ name ] = props[ name ];
2190
+ }
2191
+ }
2192
+ return target;
2193
+ }
2194
+
2195
+ /* Invoke the datepicker functionality.
2196
+ @param options string - a command, optionally followed by additional parameters or
2197
+ Object - settings for attaching new datepicker functionality
2198
+ @return jQuery object */
2199
+ $.fn.datepicker = function( options ) {
2200
+
2201
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
2202
+ if ( !this.length ) {
2203
+ return this;
2204
+ }
2205
+
2206
+ /* Initialise the date picker. */
2207
+ if ( !$.datepicker.initialized ) {
2208
+ $( document ).on( "mousedown", $.datepicker._checkExternalClick );
2209
+ $.datepicker.initialized = true;
2210
+ }
2211
+
2212
+ /* Append datepicker main container to body if not exist. */
2213
+ if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
2214
+ $( "body" ).append( $.datepicker.dpDiv );
2215
+ }
2216
+
2217
+ var otherArgs = Array.prototype.slice.call( arguments, 1 );
2218
+ if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
2219
+ return $.datepicker[ "_" + options + "Datepicker" ].
2220
+ apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
2221
+ }
2222
+ if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
2223
+ return $.datepicker[ "_" + options + "Datepicker" ].
2224
+ apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
2225
+ }
2226
+ return this.each( function() {
2227
+ if ( typeof options === "string" ) {
2228
+ $.datepicker[ "_" + options + "Datepicker" ]
2229
+ .apply( $.datepicker, [ this ].concat( otherArgs ) );
2230
+ } else {
2231
+ $.datepicker._attachDatepicker( this, options );
2232
+ }
2233
+ } );
2234
+ };
2235
+
2236
+ $.datepicker = new Datepicker(); // singleton instance
2237
+ $.datepicker.initialized = false;
2238
+ $.datepicker.uuid = new Date().getTime();
2239
+ $.datepicker.version = "1.13.0";
2240
+
2241
+ return $.datepicker;
2242
+
2243
+ } );