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