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