Version Description
This version is stable
=
Download this release
Release Info
Developer | Florent73 |
Plugin | WP Maintenance |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- classes/wp-maintenance.php +4 -4
- css/custom-editor-style.css +1 -5
- css/wpm-admin.css +1 -192
- css/wpm-responsiveslides.css +1 -132
- css/wpm-slideshow.css +1 -134
- includes/functions.php +2 -2
- js/fontselect/jquery.fontselect.js +0 -404
- js/fontselect/jquery.fontselect.min.js +1 -1
- js/jquery-ui-timepicker-addon.js +2 -2263
- js/jquery.sticky.js +1 -297
- js/jquery.ui.datepicker-fr.js +1 -26
- js/lib/picker.date.js +1 -1354
- js/lib/picker.js +1 -1163
- js/lib/picker.time.js +1 -1013
- js/wpm-color-options.js +1 -18
- js/wpm-cpt-script.js +1 -89
- js/wpm-footer-scripts.js +1 -27
- js/wpm-script.js +1 -146
- languages/wp-maintenance-fr_FR.mo +0 -0
- languages/wp-maintenance-fr_FR.po +5 -5
- readme.txt +10 -5
- views/wp-maintenance-colors.php +37 -25
- views/wp-maintenance-countdown.php +1 -1
- views/wp-maintenance-dashboard.php +0 -2
- wp-maintenance.php +4 -4
classes/wp-maintenance.php
CHANGED
@@ -351,7 +351,7 @@ a.wpmadashicons:hover { text-decoration:none;color: '.$colors[2].'!important; }
|
|
351 |
wp_enqueue_script('media-upload');
|
352 |
wp_enqueue_script('thickbox');
|
353 |
|
354 |
-
wp_register_script('wpm-my-upload',
|
355 |
wp_enqueue_script('wpm-my-upload');
|
356 |
|
357 |
wp_enqueue_style('jquery-defaut-style', WPM_PLUGIN_URL.'js/lib/themes/default.css');
|
@@ -399,11 +399,11 @@ a.wpmadashicons:hover { text-decoration:none;color: '.$colors[2].'!important; }
|
|
399 |
|
400 |
wp_register_script('wpm-admin-fontselect', WPM_PLUGIN_URL.'js/fontselect/jquery.fontselect.min.js' );
|
401 |
wp_enqueue_script('wpm-admin-fontselect');
|
402 |
-
|
403 |
-
|
404 |
-
wp_enqueue_script('wpm-admin-settings');*/
|
405 |
|
406 |
}
|
|
|
407 |
}
|
408 |
|
409 |
function wpm_dashboard_page() {
|
351 |
wp_enqueue_script('media-upload');
|
352 |
wp_enqueue_script('thickbox');
|
353 |
|
354 |
+
wp_register_script('wpm-my-upload', WPM_PLUGIN_URL.'js/wpm-script.js', array('jquery','media-upload','thickbox'));
|
355 |
wp_enqueue_script('wpm-my-upload');
|
356 |
|
357 |
wp_enqueue_style('jquery-defaut-style', WPM_PLUGIN_URL.'js/lib/themes/default.css');
|
399 |
|
400 |
wp_register_script('wpm-admin-fontselect', WPM_PLUGIN_URL.'js/fontselect/jquery.fontselect.min.js' );
|
401 |
wp_enqueue_script('wpm-admin-fontselect');
|
402 |
+
|
403 |
+
|
|
|
404 |
|
405 |
}
|
406 |
+
|
407 |
}
|
408 |
|
409 |
function wpm_dashboard_page() {
|
css/custom-editor-style.css
CHANGED
@@ -1,5 +1 @@
|
|
1 |
-
body#tinymce.wp-editor
|
2 |
-
font-size: 0.9rem;
|
3 |
-
margin: 10px;
|
4 |
-
max-width: 100%;
|
5 |
-
}
|
1 |
+
body#tinymce.wp-editor{font-size:.9rem;margin:10px;max-width:100%}
|
|
|
|
|
|
|
|
css/wpm-admin.css
CHANGED
@@ -1,192 +1 @@
|
|
1 |
-
body#tinymce.wp-editor {
|
2 |
-
font-size: 0.9rem;
|
3 |
-
margin: 10px;
|
4 |
-
max-width: 100%;
|
5 |
-
}
|
6 |
-
|
7 |
-
.switch-field {
|
8 |
-
font-family: "Lucida Grande", Tahoma, Verdana, sans-serif;
|
9 |
-
padding-top: 5px;
|
10 |
-
padding-bottom: 10px;
|
11 |
-
overflow: hidden;
|
12 |
-
width: 180px;
|
13 |
-
margin-left: auto;
|
14 |
-
}
|
15 |
-
|
16 |
-
.switch-title {
|
17 |
-
margin-bottom: 6px;
|
18 |
-
}
|
19 |
-
|
20 |
-
.switch-field input {
|
21 |
-
position: absolute !important;
|
22 |
-
clip: rect(0, 0, 0, 0);
|
23 |
-
height: 1px;
|
24 |
-
width: 1px;
|
25 |
-
border: 0;
|
26 |
-
overflow: hidden;
|
27 |
-
}
|
28 |
-
|
29 |
-
.switch-field label {
|
30 |
-
float: left;
|
31 |
-
}
|
32 |
-
|
33 |
-
.switch-field label {
|
34 |
-
display: inline-block;
|
35 |
-
width: 60px;
|
36 |
-
background-color: #e4e4e4;
|
37 |
-
color: #333333;
|
38 |
-
font-size: 14px;
|
39 |
-
font-weight: normal;
|
40 |
-
text-align: center;
|
41 |
-
text-shadow: none;
|
42 |
-
padding: 6px 14px;
|
43 |
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
44 |
-
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
|
45 |
-
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
|
46 |
-
-webkit-transition: all 0.1s ease-in-out;
|
47 |
-
-moz-transition: all 0.1s ease-in-out;
|
48 |
-
-ms-transition: all 0.1s ease-in-out;
|
49 |
-
-o-transition: all 0.1s ease-in-out;
|
50 |
-
transition: all 0.1s ease-in-out;
|
51 |
-
}
|
52 |
-
|
53 |
-
.switch-field label:hover {
|
54 |
-
cursor: pointer;
|
55 |
-
}
|
56 |
-
|
57 |
-
.switch-field input:checked + label {
|
58 |
-
-webkit-box-shadow: none;
|
59 |
-
box-shadow: none;
|
60 |
-
color: #e4e4e4;
|
61 |
-
}
|
62 |
-
|
63 |
-
.switch-field label:first-of-type {
|
64 |
-
border-radius: 4px 0 0 4px;
|
65 |
-
}
|
66 |
-
|
67 |
-
.switch-field label:last-of-type {
|
68 |
-
border-radius: 0 4px 4px 0;
|
69 |
-
}
|
70 |
-
|
71 |
-
#wpadminbar .wpmbackground {
|
72 |
-
background-color: #333;
|
73 |
-
-webkit-animation-name: blinker;
|
74 |
-
-webkit-animation-duration: 5s;
|
75 |
-
-webkit-animation-timing-function: linear;
|
76 |
-
-webkit-animation-iteration-count: infinite;
|
77 |
-
|
78 |
-
-moz-animation-name: blinker;
|
79 |
-
-moz-animation-duration: 5s;
|
80 |
-
-moz-animation-timing-function: linear;
|
81 |
-
-moz-animation-iteration-count: infinite;
|
82 |
-
|
83 |
-
animation-name: blinker;
|
84 |
-
animation-duration: 5s;
|
85 |
-
animation-timing-function: linear;
|
86 |
-
animation-iteration-count: infinite;
|
87 |
-
}
|
88 |
-
@-moz-keyframes blinker {
|
89 |
-
0% { opacity: 1.0; }
|
90 |
-
50% { opacity: 0.0; }
|
91 |
-
100% { opacity: 1.0; }
|
92 |
-
}
|
93 |
-
|
94 |
-
@-webkit-keyframes blinker {
|
95 |
-
0% { opacity: 1.0; }
|
96 |
-
50% { opacity: 0.0; }
|
97 |
-
100% { opacity: 1.0; }
|
98 |
-
}
|
99 |
-
|
100 |
-
@keyframes blinker {
|
101 |
-
0% { opacity: 1.0; }
|
102 |
-
50% { opacity: 0.0; }
|
103 |
-
100% { opacity: 1.0; }
|
104 |
-
}
|
105 |
-
.wpmclassname {
|
106 |
-
background-color:#848838;
|
107 |
-
-webkit-border-top-left-radius:10px;
|
108 |
-
-moz-border-radius-topleft:10px;
|
109 |
-
border-top-left-radius:10px;
|
110 |
-
-webkit-border-top-right-radius:10px;
|
111 |
-
-moz-border-radius-topright:10px;
|
112 |
-
border-top-right-radius:10px;
|
113 |
-
-webkit-border-bottom-right-radius:10px;
|
114 |
-
-moz-border-radius-bottomright:10px;
|
115 |
-
border-bottom-right-radius:10px;
|
116 |
-
-webkit-border-bottom-left-radius:10px;
|
117 |
-
-moz-border-radius-bottomleft:10px;
|
118 |
-
border-bottom-left-radius:10px;
|
119 |
-
text-indent:0;
|
120 |
-
border:3px solid #656830;
|
121 |
-
display:inline-block;
|
122 |
-
color:#ffffff;
|
123 |
-
/*font-family:Arial;*/
|
124 |
-
font-size:15px;
|
125 |
-
font-weight:bold;
|
126 |
-
font-style:normal;
|
127 |
-
height:50px;
|
128 |
-
line-height:45px;
|
129 |
-
width:215px;
|
130 |
-
text-decoration:none;
|
131 |
-
text-align:center;
|
132 |
-
}.wpmclassname:hover {
|
133 |
-
background-color:#656830;
|
134 |
-
color:#ffffff;
|
135 |
-
}.wpmclassname:active {
|
136 |
-
position:relative;
|
137 |
-
top:1px;
|
138 |
-
color:#ffffff;
|
139 |
-
}
|
140 |
-
#wpmcontainer-sticky-wrapper { height: 0px!important; }
|
141 |
-
#wpmcontainer {
|
142 |
-
left: 0;
|
143 |
-
padding-left: 160px;
|
144 |
-
position: fixed;
|
145 |
-
top: 32px;
|
146 |
-
width: 100%;
|
147 |
-
z-index: 9980;
|
148 |
-
background-color: #f1f1f1;
|
149 |
-
}
|
150 |
-
#wpmNotifications {
|
151 |
-
color:#ffffff;
|
152 |
-
background-color: #a3b745;
|
153 |
-
margin-left: auto;
|
154 |
-
margin-right: auto;
|
155 |
-
width:60%;
|
156 |
-
padding: 14px 25px 14px 25px;
|
157 |
-
-webkit-border-top-left-radius:10px;
|
158 |
-
-moz-border-radius-topleft:10px;
|
159 |
-
border-top-left-radius:10px;
|
160 |
-
-webkit-border-top-right-radius:10px;
|
161 |
-
-moz-border-radius-topright:10px;
|
162 |
-
border-top-right-radius:10px;
|
163 |
-
-webkit-border-bottom-right-radius:10px;
|
164 |
-
-moz-border-radius-bottomright:10px;
|
165 |
-
border-bottom-right-radius:10px;
|
166 |
-
-webkit-border-bottom-left-radius:10px;
|
167 |
-
-moz-border-radius-bottomleft:10px;
|
168 |
-
border-bottom-left-radius:10px;
|
169 |
-
}
|
170 |
-
.postbox, .bottom-notices {
|
171 |
-
width: 75%;
|
172 |
-
box-shadow: none;
|
173 |
-
-webkit-box-shadow: none;
|
174 |
-
}
|
175 |
-
.postbox .hndle {
|
176 |
-
padding: 5px 5px 15px 5px;
|
177 |
-
}
|
178 |
-
.postbox .hndle span {
|
179 |
-
font-size: 25px;
|
180 |
-
}
|
181 |
-
.postbox .hndle .postbox-title-action {
|
182 |
-
font-size:12px;
|
183 |
-
font-style:italic;
|
184 |
-
padding-left:5px;
|
185 |
-
}
|
186 |
-
.inside {
|
187 |
-
display: none;
|
188 |
-
}
|
189 |
-
.inside.openinside {
|
190 |
-
display: block;
|
191 |
-
}
|
192 |
-
|
1 |
+
.switch-field label,.wpmclassname{display:inline-block;text-align:center}body#tinymce.wp-editor{font-size:.9rem;margin:10px;max-width:100%}.switch-field{font-family:"Lucida Grande",Tahoma,Verdana,sans-serif;padding-top:5px;padding-bottom:10px;overflow:hidden;width:180px;margin-left:auto}.switch-title{margin-bottom:6px}.switch-field input{position:absolute!important;clip:rect(0,0,0,0);height:1px;width:1px;border:0;overflow:hidden}.switch-field label{float:left;width:60px;background-color:#e4e4e4;color:#333;font-size:14px;font-weight:400;text-shadow:none;padding:6px 14px;border:1px solid rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.3),0 1px rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.3),0 1px rgba(255,255,255,.1);-webkit-transition:all .1s ease-in-out;-moz-transition:all .1s ease-in-out;-ms-transition:all .1s ease-in-out;-o-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.switch-field label:hover{cursor:pointer}.switch-field input:checked+label{-webkit-box-shadow:none;box-shadow:none;color:#e4e4e4}.switch-field label:first-of-type{border-radius:4px 0 0 4px}.switch-field label:last-of-type{border-radius:0 4px 4px 0}#wpadminbar .wpmbackground{background-color:#333;-webkit-animation-name:blinker;-webkit-animation-duration:5s;-webkit-animation-timing-function:linear;-webkit-animation-iteration-count:infinite;-moz-animation-name:blinker;-moz-animation-duration:5s;-moz-animation-timing-function:linear;-moz-animation-iteration-count:infinite;animation-name:blinker;animation-duration:5s;animation-timing-function:linear;animation-iteration-count:infinite}@-moz-keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}@-webkit-keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}@keyframes blinker{0%,100%{opacity:1}50%{opacity:0}}.wpmclassname{background-color:#848838;-moz-border-radius-topleft:10px;-moz-border-radius-topright:10px;-moz-border-radius-bottomright:10px;-moz-border-radius-bottomleft:10px;text-indent:0;border:3px solid #656830;color:#fff;font-size:15px;font-weight:700;font-style:normal;height:50px;line-height:45px;width:215px;text-decoration:none;-webkit-border-radius:10px;border-radius:10px}.wpmclassname:hover{background-color:#656830;color:#fff}.wpmclassname:active{position:relative;top:1px;color:#fff}#wpmcontainer-sticky-wrapper{height:0!important}#wpmcontainer{left:0;padding-left:160px;position:fixed;top:32px;width:100%;z-index:9980;background-color:#f1f1f1}#wpmNotifications{color:#fff;background-color:#a3b745;margin-left:auto;margin-right:auto;width:60%;padding:14px 25px;-moz-border-radius-topleft:10px;-moz-border-radius-topright:10px;-moz-border-radius-bottomright:10px;-moz-border-radius-bottomleft:10px;-webkit-border-radius:10px;border-radius:10px}.bottom-notices,.postbox{width:75%;box-shadow:none;-webkit-box-shadow:none}.postbox .hndle{padding:5px 5px 15px}.postbox .hndle span{font-size:25px}.postbox .hndle .postbox-title-action{font-size:12px;font-style:italic;padding-left:5px}.inside{display:none}.inside.openinside{display:block}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/wpm-responsiveslides.css
CHANGED
@@ -1,132 +1 @@
|
|
1 |
-
.events {
|
2 |
-
list-style: none;
|
3 |
-
}
|
4 |
-
|
5 |
-
.callbacks_container {
|
6 |
-
margin-bottom: 50px;
|
7 |
-
position: relative;
|
8 |
-
margin: 0 auto;
|
9 |
-
}
|
10 |
-
|
11 |
-
.callbacks {
|
12 |
-
position: relative;
|
13 |
-
list-style: none;
|
14 |
-
overflow: hidden;
|
15 |
-
width: 100%;
|
16 |
-
padding: 0;
|
17 |
-
margin: 0;
|
18 |
-
}
|
19 |
-
|
20 |
-
.callbacks li {
|
21 |
-
position: absolute;
|
22 |
-
width: 100%;
|
23 |
-
left: 0;
|
24 |
-
top: 0;
|
25 |
-
}
|
26 |
-
|
27 |
-
.callbacks img {
|
28 |
-
display: block;
|
29 |
-
position: relative;
|
30 |
-
z-index: 1;
|
31 |
-
height: auto;
|
32 |
-
width: 100%;
|
33 |
-
border: 0;
|
34 |
-
}
|
35 |
-
|
36 |
-
.callbacks .caption {
|
37 |
-
display: block;
|
38 |
-
position: absolute;
|
39 |
-
z-index: 2;
|
40 |
-
font-size: 20px;
|
41 |
-
text-shadow: none;
|
42 |
-
color: #fff;
|
43 |
-
background: #000;
|
44 |
-
background: rgba(0,0,0, .8);
|
45 |
-
left: 0;
|
46 |
-
right: 0;
|
47 |
-
bottom: 0;
|
48 |
-
padding: 10px 20px;
|
49 |
-
margin: 0;
|
50 |
-
max-width: none;
|
51 |
-
}
|
52 |
-
|
53 |
-
.callbacks_nav {
|
54 |
-
position: absolute;
|
55 |
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
56 |
-
top: 52%;
|
57 |
-
left: 0;
|
58 |
-
opacity: 0.7;
|
59 |
-
z-index: 3;
|
60 |
-
text-indent: -9999px;
|
61 |
-
overflow: hidden;
|
62 |
-
text-decoration: none;
|
63 |
-
height: 61px;
|
64 |
-
width: 38px;
|
65 |
-
margin-top: -45px;
|
66 |
-
}
|
67 |
-
|
68 |
-
.callbacks_nav:active {
|
69 |
-
opacity: 1.0;
|
70 |
-
}
|
71 |
-
|
72 |
-
.callbacks_nav.next {
|
73 |
-
left: auto;
|
74 |
-
background-position: right top;
|
75 |
-
right: 0;
|
76 |
-
}
|
77 |
-
|
78 |
-
#slider3-pager a {
|
79 |
-
display: inline-block;
|
80 |
-
}
|
81 |
-
|
82 |
-
#slider3-pager img {
|
83 |
-
float: left;
|
84 |
-
}
|
85 |
-
|
86 |
-
#slider3-pager .rslides_here a {
|
87 |
-
background: transparent;
|
88 |
-
box-shadow: 0 0 0 2px #666;
|
89 |
-
}
|
90 |
-
|
91 |
-
#slider3-pager a {
|
92 |
-
padding: 0;
|
93 |
-
}
|
94 |
-
|
95 |
-
@media screen and (max-width: 600px) {
|
96 |
-
|
97 |
-
.callbacks_nav {
|
98 |
-
top: 47%;
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
.rslides {
|
103 |
-
position: relative;
|
104 |
-
list-style: none;
|
105 |
-
overflow: hidden;
|
106 |
-
width: 100%;
|
107 |
-
padding: 0;
|
108 |
-
margin: 0;
|
109 |
-
}
|
110 |
-
|
111 |
-
.rslides li {
|
112 |
-
-webkit-backface-visibility: hidden;
|
113 |
-
position: absolute;
|
114 |
-
display: none;
|
115 |
-
width: 100%;
|
116 |
-
left: 0;
|
117 |
-
top: 0;
|
118 |
-
}
|
119 |
-
|
120 |
-
.rslides li:first-child {
|
121 |
-
position: relative;
|
122 |
-
display: block;
|
123 |
-
float: left;
|
124 |
-
}
|
125 |
-
|
126 |
-
.rslides img {
|
127 |
-
display: block;
|
128 |
-
height: auto;
|
129 |
-
float: left;
|
130 |
-
width: 100%;
|
131 |
-
border: 0;
|
132 |
-
}
|
1 |
+
.callbacks,.events,.rslides{list-style:none}.callbacks_container{position:relative;margin:0 auto}.callbacks{position:relative;overflow:hidden;width:100%;padding:0;margin:0}.callbacks li{position:absolute;width:100%;left:0;top:0}.callbacks img{display:block;position:relative;z-index:1;height:auto;width:100%;border:0}.callbacks .caption{display:block;position:absolute;z-index:2;font-size:20px;text-shadow:none;color:#fff;background:#000;background:rgba(0,0,0,.8);left:0;right:0;bottom:0;padding:10px 20px;margin:0;max-width:none}.callbacks_nav{position:absolute;-webkit-tap-highlight-color:transparent;top:52%;left:0;opacity:.7;z-index:3;text-indent:-9999px;overflow:hidden;text-decoration:none;height:61px;width:38px;margin-top:-45px}.callbacks_nav:active{opacity:1}.callbacks_nav.next{left:auto;background-position:right top;right:0}#slider3-pager a{display:inline-block;padding:0}#slider3-pager img{float:left}#slider3-pager .rslides_here a{background:0 0;box-shadow:0 0 0 2px #666}@media screen and (max-width:600px){.callbacks_nav{top:47%}}.rslides{position:relative;overflow:hidden;width:100%;padding:0;margin:0}.rslides li{-webkit-backface-visibility:hidden;position:absolute;display:none;width:100%;left:0;top:0}.rslides li:first-child{position:relative;display:block;float:left}.rslides img{display:block;height:auto;float:left;width:100%;border:0}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/wpm-slideshow.css
CHANGED
@@ -1,134 +1 @@
|
|
1 |
-
* {
|
2 |
-
margin: 0;
|
3 |
-
padding: 0;
|
4 |
-
}
|
5 |
-
|
6 |
-
.rslides {
|
7 |
-
margin: 0 auto;
|
8 |
-
}
|
9 |
-
|
10 |
-
.rslides_container {
|
11 |
-
margin-bottom: 50px;
|
12 |
-
position: relative;
|
13 |
-
float: left;
|
14 |
-
width: 100%;
|
15 |
-
}
|
16 |
-
|
17 |
-
.centered-btns_nav {
|
18 |
-
z-index: 3;
|
19 |
-
position: absolute;
|
20 |
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
21 |
-
top: 50%;
|
22 |
-
left: 0;
|
23 |
-
opacity: 0.7;
|
24 |
-
text-indent: -9999px;
|
25 |
-
overflow: hidden;
|
26 |
-
text-decoration: none;
|
27 |
-
height: 61px;
|
28 |
-
width: 38px;
|
29 |
-
margin-top: -45px;
|
30 |
-
}
|
31 |
-
|
32 |
-
.centered-btns_nav:active {
|
33 |
-
opacity: 1.0;
|
34 |
-
}
|
35 |
-
|
36 |
-
.centered-btns_nav.next {
|
37 |
-
left: auto;
|
38 |
-
background-position: right top;
|
39 |
-
right: 0;
|
40 |
-
}
|
41 |
-
|
42 |
-
.transparent-btns_nav {
|
43 |
-
z-index: 3;
|
44 |
-
position: absolute;
|
45 |
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
46 |
-
top: 0;
|
47 |
-
left: 0;
|
48 |
-
display: block;
|
49 |
-
background: #fff; /* Fix for IE6-9 */
|
50 |
-
opacity: 0;
|
51 |
-
filter: alpha(opacity=1);
|
52 |
-
width: 48%;
|
53 |
-
text-indent: -9999px;
|
54 |
-
overflow: hidden;
|
55 |
-
height: 91%;
|
56 |
-
}
|
57 |
-
|
58 |
-
.transparent-btns_nav.next {
|
59 |
-
left: auto;
|
60 |
-
right: 0;
|
61 |
-
}
|
62 |
-
|
63 |
-
.large-btns_nav {
|
64 |
-
z-index: 3;
|
65 |
-
position: absolute;
|
66 |
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
67 |
-
opacity: 0.6;
|
68 |
-
text-indent: -9999px;
|
69 |
-
overflow: hidden;
|
70 |
-
top: 0;
|
71 |
-
bottom: 0;
|
72 |
-
left: 0;
|
73 |
-
width: 38px;
|
74 |
-
}
|
75 |
-
|
76 |
-
.large-btns_nav:active {
|
77 |
-
opacity: 1.0;
|
78 |
-
}
|
79 |
-
|
80 |
-
.large-btns_nav.next {
|
81 |
-
left: auto;
|
82 |
-
background-position: right 50%;
|
83 |
-
right: 0;
|
84 |
-
}
|
85 |
-
|
86 |
-
.centered-btns_nav:focus,
|
87 |
-
.transparent-btns_nav:focus,
|
88 |
-
.large-btns_nav:focus {
|
89 |
-
outline: none;
|
90 |
-
}
|
91 |
-
|
92 |
-
.centered-btns_tabs,
|
93 |
-
.transparent-btns_tabs,
|
94 |
-
.large-btns_tabs {
|
95 |
-
margin-top: 10px;
|
96 |
-
text-align: center;
|
97 |
-
}
|
98 |
-
|
99 |
-
.centered-btns_tabs li,
|
100 |
-
.transparent-btns_tabs li,
|
101 |
-
.large-btns_tabs li {
|
102 |
-
display: inline;
|
103 |
-
float: none;
|
104 |
-
_float: left;
|
105 |
-
*float: left;
|
106 |
-
margin-right: 5px;
|
107 |
-
}
|
108 |
-
|
109 |
-
.centered-btns_tabs a,
|
110 |
-
.transparent-btns_tabs a,
|
111 |
-
.large-btns_tabs a {
|
112 |
-
text-indent: -9999px;
|
113 |
-
overflow: hidden;
|
114 |
-
-webkit-border-radius: 15px;
|
115 |
-
-moz-border-radius: 15px;
|
116 |
-
border-radius: 15px;
|
117 |
-
background: #ccc;
|
118 |
-
background: rgba(0,0,0, .2);
|
119 |
-
display: inline-block;
|
120 |
-
_display: block;
|
121 |
-
*display: block;
|
122 |
-
-webkit-box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);
|
123 |
-
-moz-box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);
|
124 |
-
box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);
|
125 |
-
width: 9px;
|
126 |
-
height: 9px;
|
127 |
-
}
|
128 |
-
|
129 |
-
.centered-btns_here a,
|
130 |
-
.transparent-btns_here a,
|
131 |
-
.large-btns_here a {
|
132 |
-
background: #222;
|
133 |
-
background: rgba(0,0,0, .8);
|
134 |
-
}
|
1 |
+
*{margin:0;padding:0}.rslides{margin:0 auto}.rslides_container{margin-bottom:50px;position:relative;float:left;width:100%}.centered-btns_nav{z-index:3;position:absolute;-webkit-tap-highlight-color:transparent;top:50%;left:0;opacity:.7;text-indent:-9999px;overflow:hidden;text-decoration:none;height:61px;width:38px;margin-top:-45px}.large-btns_nav,.transparent-btns_nav{z-index:3;position:absolute;-webkit-tap-highlight-color:transparent;top:0;text-indent:-9999px;overflow:hidden}.centered-btns_nav:active{opacity:1}.centered-btns_nav.next{left:auto;background-position:right top;right:0}.transparent-btns_nav{left:0;display:block;background:#fff;opacity:0;filter:alpha(opacity=1);width:48%;height:91%}.transparent-btns_nav.next{left:auto;right:0}.large-btns_nav{opacity:.6;bottom:0;left:0;width:38px}.large-btns_nav:active{opacity:1}.large-btns_nav.next{left:auto;background-position:right 50%;right:0}.centered-btns_nav:focus,.large-btns_nav:focus,.transparent-btns_nav:focus{outline:0}.centered-btns_tabs,.large-btns_tabs,.transparent-btns_tabs{margin-top:10px;text-align:center}.centered-btns_tabs li,.large-btns_tabs li,.transparent-btns_tabs li{display:inline;float:none;margin-right:5px}.centered-btns_tabs a,.large-btns_tabs a,.transparent-btns_tabs a{text-indent:-9999px;overflow:hidden;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;background:#ccc;background:rgba(0,0,0,.2);display:inline-block;-webkit-box-shadow:inset 0 0 2px 0 rgba(0,0,0,.3);-moz-box-shadow:inset 0 0 2px 0 rgba(0,0,0,.3);box-shadow:inset 0 0 2px 0 rgba(0,0,0,.3);width:9px;height:9px}.centered-btns_here a,.large-btns_here a,.transparent-btns_here a{background:#222;background:rgba(0,0,0,.8)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.php
CHANGED
@@ -141,7 +141,7 @@ function wpm_sidebar() {
|
|
141 |
$wpmSidebar .= ''.__('Support this extension and my other developments (French Paypal):', 'wp-maintenance').'<br /><br />
|
142 |
<div style="width:220px;margin-left:auto;margin-right:auto;padding:5px;">
|
143 |
<a href="https://paypal.me/RestezConnectes/10" target="_blank" class="wpmclassname">
|
144 |
-
<img src="'.
|
145 |
</a>
|
146 |
</div>
|
147 |
</div>';
|
@@ -157,7 +157,7 @@ function wpm_sidebar() {
|
|
157 |
);
|
158 |
|
159 |
foreach( $imagePub as $img=>$link ) {
|
160 |
-
$wpmSidebar .= '<a href="'.$link.'" target="_blank"><img src="'.WPM_PLUGIN_URL.'
|
161 |
}
|
162 |
/* END DISCOVER */
|
163 |
|
141 |
$wpmSidebar .= ''.__('Support this extension and my other developments (French Paypal):', 'wp-maintenance').'<br /><br />
|
142 |
<div style="width:220px;margin-left:auto;margin-right:auto;padding:5px;">
|
143 |
<a href="https://paypal.me/RestezConnectes/10" target="_blank" class="wpmclassname">
|
144 |
+
<img src="'.WPM_PLUGIN_URL.'images/donate.png" valign="bottom" width="64" /> Donate now!
|
145 |
</a>
|
146 |
</div>
|
147 |
</div>';
|
157 |
);
|
158 |
|
159 |
foreach( $imagePub as $img=>$link ) {
|
160 |
+
$wpmSidebar .= '<a href="'.$link.'" target="_blank"><img src="'.WPM_PLUGIN_URL.'images/'.$img.'" /></a>';
|
161 |
}
|
162 |
/* END DISCOVER */
|
163 |
|
js/fontselect/jquery.fontselect.js
DELETED
@@ -1,404 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery.fontselect - A font selector for the Google Web Fonts api
|
3 |
-
* Tom Moor, http://tommoor.com
|
4 |
-
* Copyright (c) 2011 Tom Moor
|
5 |
-
* MIT Licensed
|
6 |
-
* @version 0.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
(function($){
|
10 |
-
|
11 |
-
$.fn.fontselect = function(options) {
|
12 |
-
|
13 |
-
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
14 |
-
|
15 |
-
var fonts = [
|
16 |
-
"Aclonica",
|
17 |
-
"Allan",
|
18 |
-
"Annie+Use+Your+Telescope",
|
19 |
-
"Anonymous+Pro",
|
20 |
-
"Allerta+Stencil",
|
21 |
-
"Allerta",
|
22 |
-
"Amaranth",
|
23 |
-
"Anton",
|
24 |
-
"Architects+Daughter",
|
25 |
-
"Arimo",
|
26 |
-
"Artifika",
|
27 |
-
"Arvo",
|
28 |
-
"Asset",
|
29 |
-
"Astloch",
|
30 |
-
"Bangers",
|
31 |
-
"Bentham",
|
32 |
-
"Bevan",
|
33 |
-
"Bigshot+One",
|
34 |
-
"Bowlby+One",
|
35 |
-
"Bowlby+One+SC",
|
36 |
-
"Brawler",
|
37 |
-
"Buda:300",
|
38 |
-
"Cabin",
|
39 |
-
"Calligraffitti",
|
40 |
-
"Candal",
|
41 |
-
"Cantarell",
|
42 |
-
"Cardo",
|
43 |
-
"Carter One",
|
44 |
-
"Caudex",
|
45 |
-
"Cedarville+Cursive",
|
46 |
-
"Cherry+Cream+Soda",
|
47 |
-
"Chewy",
|
48 |
-
"Coda",
|
49 |
-
"Coming+Soon",
|
50 |
-
"Copse",
|
51 |
-
"Corben:700",
|
52 |
-
"Cousine",
|
53 |
-
"Covered+By+Your+Grace",
|
54 |
-
"Crafty+Girls",
|
55 |
-
"Crimson+Text",
|
56 |
-
"Crushed",
|
57 |
-
"Cuprum",
|
58 |
-
"Damion",
|
59 |
-
"Dancing+Script",
|
60 |
-
"Dawning+of+a+New+Day",
|
61 |
-
"Didact+Gothic",
|
62 |
-
"Droid+Sans",
|
63 |
-
"Droid+Sans+Mono",
|
64 |
-
"Droid+Serif",
|
65 |
-
"EB+Garamond",
|
66 |
-
"Expletus+Sans",
|
67 |
-
"Fontdiner+Swanky",
|
68 |
-
"Forum",
|
69 |
-
"Francois+One",
|
70 |
-
"Geo",
|
71 |
-
"Give+You+Glory",
|
72 |
-
"Goblin+One",
|
73 |
-
"Goudy+Bookletter+1911",
|
74 |
-
"Gravitas+One",
|
75 |
-
"Gruppo",
|
76 |
-
"Hammersmith+One",
|
77 |
-
"Holtwood+One+SC",
|
78 |
-
"Homemade+Apple",
|
79 |
-
"Inconsolata",
|
80 |
-
"Indie+Flower",
|
81 |
-
"IM+Fell+DW+Pica",
|
82 |
-
"IM+Fell+DW+Pica+SC",
|
83 |
-
"IM+Fell+Double+Pica",
|
84 |
-
"IM+Fell+Double+Pica+SC",
|
85 |
-
"IM+Fell+English",
|
86 |
-
"IM+Fell+English+SC",
|
87 |
-
"IM+Fell+French+Canon",
|
88 |
-
"IM+Fell+French+Canon+SC",
|
89 |
-
"IM+Fell+Great+Primer",
|
90 |
-
"IM+Fell+Great+Primer+SC",
|
91 |
-
"Irish+Grover",
|
92 |
-
"Irish+Growler",
|
93 |
-
"Istok+Web",
|
94 |
-
"Josefin+Sans",
|
95 |
-
"Josefin+Slab",
|
96 |
-
"Judson",
|
97 |
-
"Jura",
|
98 |
-
"Jura:500",
|
99 |
-
"Jura:600",
|
100 |
-
"Just+Another+Hand",
|
101 |
-
"Just+Me+Again+Down+Here",
|
102 |
-
"Kameron",
|
103 |
-
"Kenia",
|
104 |
-
"Kranky",
|
105 |
-
"Kreon",
|
106 |
-
"Kristi",
|
107 |
-
"La+Belle+Aurore",
|
108 |
-
"Lato:100",
|
109 |
-
"Lato:100italic",
|
110 |
-
"Lato:300",
|
111 |
-
"Lato",
|
112 |
-
"Lato:bold",
|
113 |
-
"Lato:900",
|
114 |
-
"League+Script",
|
115 |
-
"Lekton",
|
116 |
-
"Limelight",
|
117 |
-
"Lobster",
|
118 |
-
"Lobster Two",
|
119 |
-
"Lora",
|
120 |
-
"Love+Ya+Like+A+Sister",
|
121 |
-
"Loved+by+the+King",
|
122 |
-
"Luckiest+Guy",
|
123 |
-
"Maiden+Orange",
|
124 |
-
"Mako",
|
125 |
-
"Maven+Pro",
|
126 |
-
"Maven+Pro:500",
|
127 |
-
"Maven+Pro:700",
|
128 |
-
"Maven+Pro:900",
|
129 |
-
"Meddon",
|
130 |
-
"MedievalSharp",
|
131 |
-
"Megrim",
|
132 |
-
"Merriweather",
|
133 |
-
"Metrophobic",
|
134 |
-
"Michroma",
|
135 |
-
"Miltonian Tattoo",
|
136 |
-
"Miltonian",
|
137 |
-
"Modern Antiqua",
|
138 |
-
"Monofett",
|
139 |
-
"Molengo",
|
140 |
-
"Mountains of Christmas",
|
141 |
-
"Muli:300",
|
142 |
-
"Muli",
|
143 |
-
"Neucha",
|
144 |
-
"Neuton",
|
145 |
-
"News+Cycle",
|
146 |
-
"Nixie+One",
|
147 |
-
"Nobile",
|
148 |
-
"Nova+Cut",
|
149 |
-
"Nova+Flat",
|
150 |
-
"Nova+Mono",
|
151 |
-
"Nova+Oval",
|
152 |
-
"Nova+Round",
|
153 |
-
"Nova+Script",
|
154 |
-
"Nova+Slim",
|
155 |
-
"Nova+Square",
|
156 |
-
"Nunito:light",
|
157 |
-
"Nunito",
|
158 |
-
"OFL+Sorts+Mill+Goudy+TT",
|
159 |
-
"Old+Standard+TT",
|
160 |
-
"Open+Sans:300",
|
161 |
-
"Open+Sans",
|
162 |
-
"Open+Sans:600",
|
163 |
-
"Open+Sans:800",
|
164 |
-
"Open+Sans+Condensed:300",
|
165 |
-
"Orbitron",
|
166 |
-
"Orbitron:500",
|
167 |
-
"Orbitron:700",
|
168 |
-
"Orbitron:900",
|
169 |
-
"Oswald",
|
170 |
-
"Over+the+Rainbow",
|
171 |
-
"Reenie+Beanie",
|
172 |
-
"Pacifico",
|
173 |
-
"Patrick+Hand",
|
174 |
-
"Paytone+One",
|
175 |
-
"Permanent+Marker",
|
176 |
-
"Philosopher",
|
177 |
-
"Play",
|
178 |
-
"Playfair+Display",
|
179 |
-
"Podkova",
|
180 |
-
"PT+Sans",
|
181 |
-
"PT+Sans+Narrow",
|
182 |
-
"PT+Sans+Narrow:regular,bold",
|
183 |
-
"PT+Serif",
|
184 |
-
"PT+Serif Caption",
|
185 |
-
"Puritan",
|
186 |
-
"Quattrocento",
|
187 |
-
"Quattrocento+Sans",
|
188 |
-
"Radley",
|
189 |
-
"Raleway:100",
|
190 |
-
"Redressed",
|
191 |
-
"Rock+Salt",
|
192 |
-
"Rokkitt",
|
193 |
-
"Ruslan+Display",
|
194 |
-
"Schoolbell",
|
195 |
-
"Shadows+Into+Light",
|
196 |
-
"Shanti",
|
197 |
-
"Sigmar+One",
|
198 |
-
"Six+Caps",
|
199 |
-
"Slackey",
|
200 |
-
"Smythe",
|
201 |
-
"Sniglet:800",
|
202 |
-
"Special+Elite",
|
203 |
-
"Stardos+Stencil",
|
204 |
-
"Sue+Ellen+Francisco",
|
205 |
-
"Sunshiney",
|
206 |
-
"Swanky+and+Moo+Moo",
|
207 |
-
"Syncopate",
|
208 |
-
"Tangerine",
|
209 |
-
"Tenor+Sans",
|
210 |
-
"Terminal+Dosis+Light",
|
211 |
-
"The+Girl+Next+Door",
|
212 |
-
"Tinos",
|
213 |
-
"Ubuntu",
|
214 |
-
"Ultra",
|
215 |
-
"Unkempt",
|
216 |
-
"UnifrakturCook:bold",
|
217 |
-
"UnifrakturMaguntia",
|
218 |
-
"Varela",
|
219 |
-
"Varela Round",
|
220 |
-
"Vibur",
|
221 |
-
"Vollkorn",
|
222 |
-
"VT323",
|
223 |
-
"Waiting+for+the+Sunrise",
|
224 |
-
"Wallpoet",
|
225 |
-
"Walter+Turncoat",
|
226 |
-
"Wire+One",
|
227 |
-
"Yanone+Kaffeesatz",
|
228 |
-
"Yanone+Kaffeesatz:300",
|
229 |
-
"Yanone+Kaffeesatz:400",
|
230 |
-
"Yanone+Kaffeesatz:700",
|
231 |
-
"Yeseva+One",
|
232 |
-
"Zeyada"];
|
233 |
-
|
234 |
-
var settings = {
|
235 |
-
style: 'font-select',
|
236 |
-
placeholder: 'Select a font',
|
237 |
-
lookahead: 2,
|
238 |
-
api: 'https://fonts.googleapis.com/css?family='
|
239 |
-
};
|
240 |
-
|
241 |
-
var Fontselect = (function(){
|
242 |
-
|
243 |
-
function Fontselect(original, o){
|
244 |
-
this.$original = $(original);
|
245 |
-
this.options = o;
|
246 |
-
this.active = false;
|
247 |
-
this.setupHtml();
|
248 |
-
this.getVisibleFonts();
|
249 |
-
this.bindEvents();
|
250 |
-
|
251 |
-
var font = this.$original.val();
|
252 |
-
if (font) {
|
253 |
-
this.updateSelected();
|
254 |
-
this.addFontLink(font);
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
Fontselect.prototype.bindEvents = function(){
|
259 |
-
|
260 |
-
$('li', this.$results)
|
261 |
-
.click(__bind(this.selectFont, this))
|
262 |
-
.mouseenter(__bind(this.activateFont, this))
|
263 |
-
.mouseleave(__bind(this.deactivateFont, this));
|
264 |
-
|
265 |
-
$('span', this.$select).click(__bind(this.toggleDrop, this));
|
266 |
-
this.$arrow.click(__bind(this.toggleDrop, this));
|
267 |
-
};
|
268 |
-
|
269 |
-
Fontselect.prototype.toggleDrop = function(ev){
|
270 |
-
|
271 |
-
if(this.active){
|
272 |
-
this.$element.removeClass('font-select-active');
|
273 |
-
this.$drop.hide();
|
274 |
-
clearInterval(this.visibleInterval);
|
275 |
-
|
276 |
-
} else {
|
277 |
-
this.$element.addClass('font-select-active');
|
278 |
-
this.$drop.show();
|
279 |
-
this.moveToSelected();
|
280 |
-
this.visibleInterval = setInterval(__bind(this.getVisibleFonts, this), 500);
|
281 |
-
}
|
282 |
-
|
283 |
-
this.active = !this.active;
|
284 |
-
};
|
285 |
-
|
286 |
-
Fontselect.prototype.selectFont = function(){
|
287 |
-
|
288 |
-
var font = $('li.active', this.$results).data('value');
|
289 |
-
this.$original.val(font).change();
|
290 |
-
this.updateSelected();
|
291 |
-
this.toggleDrop();
|
292 |
-
};
|
293 |
-
|
294 |
-
Fontselect.prototype.moveToSelected = function(){
|
295 |
-
|
296 |
-
var $li, font = this.$original.val();
|
297 |
-
|
298 |
-
if (font){
|
299 |
-
$li = $("li[data-value='"+ font +"']", this.$results);
|
300 |
-
} else {
|
301 |
-
$li = $("li", this.$results).first();
|
302 |
-
}
|
303 |
-
|
304 |
-
this.$results.scrollTop($li.addClass('active').position().top);
|
305 |
-
};
|
306 |
-
|
307 |
-
Fontselect.prototype.activateFont = function(ev){
|
308 |
-
$('li.active', this.$results).removeClass('active');
|
309 |
-
$(ev.currentTarget).addClass('active');
|
310 |
-
};
|
311 |
-
|
312 |
-
Fontselect.prototype.deactivateFont = function(ev){
|
313 |
-
|
314 |
-
$(ev.currentTarget).removeClass('active');
|
315 |
-
};
|
316 |
-
|
317 |
-
Fontselect.prototype.updateSelected = function(){
|
318 |
-
|
319 |
-
var font = this.$original.val();
|
320 |
-
$('span', this.$element).text(this.toReadable(font)).css(this.toStyle(font));
|
321 |
-
};
|
322 |
-
|
323 |
-
Fontselect.prototype.setupHtml = function(){
|
324 |
-
|
325 |
-
this.$original.empty().hide();
|
326 |
-
this.$element = $('<div>', {'class': this.options.style});
|
327 |
-
this.$arrow = $('<div><b></b></div>');
|
328 |
-
this.$select = $('<a><span>'+ this.options.placeholder +'</span></a>');
|
329 |
-
this.$drop = $('<div>', {'class': 'fs-drop'});
|
330 |
-
this.$results = $('<ul>', {'class': 'fs-results'});
|
331 |
-
this.$original.after(this.$element.append(this.$select.append(this.$arrow)).append(this.$drop));
|
332 |
-
this.$drop.append(this.$results.append(this.fontsAsHtml())).hide();
|
333 |
-
};
|
334 |
-
|
335 |
-
Fontselect.prototype.fontsAsHtml = function(){
|
336 |
-
|
337 |
-
var l = fonts.length;
|
338 |
-
var r, s, h = '';
|
339 |
-
|
340 |
-
for(var i=0; i<l; i++){
|
341 |
-
r = this.toReadable(fonts[i]);
|
342 |
-
s = this.toStyle(fonts[i]);
|
343 |
-
h += '<li data-value="'+ fonts[i] +'" style="font-family: '+s['font-family'] +'; font-weight: '+s['font-weight'] +'">'+ r +'</li>';
|
344 |
-
}
|
345 |
-
|
346 |
-
return h;
|
347 |
-
};
|
348 |
-
|
349 |
-
Fontselect.prototype.toReadable = function(font){
|
350 |
-
return font.replace(/[\+|:]/g, ' ');
|
351 |
-
};
|
352 |
-
|
353 |
-
Fontselect.prototype.toStyle = function(font){
|
354 |
-
var t = font.split(':');
|
355 |
-
return {'font-family': this.toReadable(t[0]), 'font-weight': (t[1] || 400)};
|
356 |
-
};
|
357 |
-
|
358 |
-
Fontselect.prototype.getVisibleFonts = function(){
|
359 |
-
|
360 |
-
if(this.$results.is(':hidden')) return;
|
361 |
-
|
362 |
-
var fs = this;
|
363 |
-
var top = this.$results.scrollTop();
|
364 |
-
var bottom = top + this.$results.height();
|
365 |
-
|
366 |
-
if(this.options.lookahead){
|
367 |
-
var li = $('li', this.$results).first().height();
|
368 |
-
bottom += li*this.options.lookahead;
|
369 |
-
}
|
370 |
-
|
371 |
-
$('li', this.$results).each(function(){
|
372 |
-
|
373 |
-
var ft = $(this).position().top+top;
|
374 |
-
var fb = ft + $(this).height();
|
375 |
-
|
376 |
-
if ((fb >= top) && (ft <= bottom)){
|
377 |
-
var font = $(this).data('value');
|
378 |
-
fs.addFontLink(font);
|
379 |
-
}
|
380 |
-
|
381 |
-
});
|
382 |
-
};
|
383 |
-
|
384 |
-
Fontselect.prototype.addFontLink = function(font){
|
385 |
-
|
386 |
-
var link = this.options.api + font;
|
387 |
-
|
388 |
-
if ($("link[href*='" + font + "']").length === 0){
|
389 |
-
$('link:last').after('<link href="' + link + '" rel="stylesheet" type="text/css">');
|
390 |
-
}
|
391 |
-
};
|
392 |
-
|
393 |
-
return Fontselect;
|
394 |
-
})();
|
395 |
-
|
396 |
-
return this.each(function(options) {
|
397 |
-
// If options exist, lets merge them
|
398 |
-
if (options) $.extend( settings, options );
|
399 |
-
|
400 |
-
return new Fontselect(this, settings);
|
401 |
-
});
|
402 |
-
|
403 |
-
};
|
404 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/fontselect/jquery.fontselect.min.js
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
* Copyright (c) 2011 Tom Moor
|
5 |
* MIT Licensed
|
6 |
* @version 0.1
|
7 |
-
*/(function(a){a.fn.fontselect=function(b){var c=function(a,b){return function(){return a.apply(b,arguments)}},d=["Aclonica","Allan","Annie+Use+Your+Telescope","Anonymous+Pro","Allerta+Stencil","Allerta","Amaranth","Anton","Architects+Daughter","Arimo","Artifika","Arvo","Asset","Astloch","Bangers","Bentham","Bevan","Bigshot+One","Bowlby+One","Bowlby+One+SC","Brawler","Buda:300","Cabin","Calligraffitti","Candal","Cantarell","Cardo","Carter One","Caudex","Cedarville+Cursive","Cherry+Cream+Soda","Chewy","Coda","Coming+Soon","Copse","Corben:700","Cousine","Covered+By+Your+Grace","Crafty+Girls","Crimson+Text","Crushed","Cuprum","Damion","Dancing+Script","Dawning+of+a+New+Day","Didact+Gothic","Droid+Sans","Droid+Sans+Mono","Droid+Serif","EB+Garamond","Expletus+Sans","Fontdiner+Swanky","Forum","Francois+One","Geo","Give+You+Glory","Goblin+One","Goudy+Bookletter+1911","Gravitas+One","Gruppo","Hammersmith+One","Holtwood+One+SC","Homemade+Apple","Inconsolata","Indie+Flower","IM+Fell+DW+Pica","IM+Fell+DW+Pica+SC","IM+Fell+Double+Pica","IM+Fell+Double+Pica+SC","IM+Fell+English","IM+Fell+English+SC","IM+Fell+French+Canon","IM+Fell+French+Canon+SC","IM+Fell+Great+Primer","IM+Fell+Great+Primer+SC","Irish+Grover","Irish+Growler","Istok+Web","Josefin+Sans","Josefin+Slab","Judson","Jura","Jura:500","Jura:600","Just+Another+Hand","Just+Me+Again+Down+Here","Kameron","Kenia","Kranky","Kreon","Kristi","La+Belle+Aurore","Lato:100","Lato:100italic","Lato:300","Lato","Lato:bold","Lato:900","League+Script","Lekton","Limelight","Lobster","Lobster Two","Lora","Love+Ya+Like+A+Sister","Loved+by+the+King","Luckiest+Guy","Maiden+Orange","Mako","Maven+Pro","Maven+Pro:500","Maven+Pro:700","Maven+Pro:900","Meddon","MedievalSharp","Megrim","Merriweather","Metrophobic","Michroma","Miltonian Tattoo","Miltonian","Modern Antiqua","Monofett","Molengo","Mountains of Christmas","Muli:300","Muli","Neucha","Neuton","News+Cycle","Nixie+One","Nobile","Nova+Cut","Nova+Flat","Nova+Mono","Nova+Oval","Nova+Round","Nova+Script","Nova+Slim","Nova+Square","Nunito:light","Nunito","OFL+Sorts+Mill+Goudy+TT","Old+Standard+TT","Open+Sans:300","Open+Sans","Open+Sans:600","Open+Sans:800","Open+Sans+Condensed:300","Orbitron","Orbitron:500","Orbitron:700","Orbitron:900","Oswald","Over+the+Rainbow","Reenie+Beanie","Pacifico","Patrick+Hand","Paytone+One","Permanent+Marker","Philosopher","Play","Playfair+Display","Podkova","PT+Sans","PT+Sans+Narrow","PT+Sans+Narrow:regular,bold","PT+Serif","PT+Serif Caption","Puritan","Quattrocento","Quattrocento+Sans","Radley","Raleway:100","Redressed","Rock+Salt","Rokkitt","Ruslan+Display","Schoolbell","Shadows+Into+Light","Shanti","Sigmar+One","Six+Caps","Slackey","Smythe","Sniglet:800","Special+Elite","Stardos+Stencil","Sue+Ellen+Francisco","Sunshiney","Swanky+and+Moo+Moo","Syncopate","Tangerine","Tenor+Sans","Terminal+Dosis+Light","The+Girl+Next+Door","Tinos","Ubuntu","Ultra","Unkempt","UnifrakturCook:bold","UnifrakturMaguntia","Varela","Varela Round","Vibur","Vollkorn","VT323","Waiting+for+the+Sunrise","Wallpoet","Walter+Turncoat","Wire+One","Yanone+Kaffeesatz","Yanone+Kaffeesatz:300","Yanone+Kaffeesatz:400","Yanone+Kaffeesatz:700","Yeseva+One","Zeyada"],e={style:"font-select",placeholder:"Select a font",lookahead:2,api:"https://fonts.googleapis.com/css?family="},f=function(){function b(b,c){this.$original=a(b);this.options=c;this.active=!1;this.setupHtml();this.getVisibleFonts();this.bindEvents();var d=this.$original.val();if(d){this.updateSelected();this.addFontLink(d)}}b.prototype.bindEvents=function(){a("li",this.$results).click(c(this.selectFont,this)).mouseenter(c(this.activateFont,this)).mouseleave(c(this.deactivateFont,this));a("span",this.$select).click(c(this.toggleDrop,this));this.$arrow.click(c(this.toggleDrop,this))};b.prototype.toggleDrop=function(a){if(this.active){this.$element.removeClass("font-select-active");this.$drop.hide();clearInterval(this.visibleInterval)}else{this.$element.addClass("font-select-active");this.$drop.show();this.moveToSelected();this.visibleInterval=setInterval(c(this.getVisibleFonts,this),500)}this.active=!this.active};b.prototype.selectFont=function(){var b=a("li.active",this.$results).data("value");this.$original.val(b).change();this.updateSelected();this.toggleDrop()};b.prototype.moveToSelected=function(){var b,c=this.$original.val();c?b=a("li[data-value='"+c+"']",this.$results):b=a("li",this.$results).first();this.$results.scrollTop(b.addClass("active").position().top)};b.prototype.activateFont=function(b){a("li.active",this.$results).removeClass("active");a(b.currentTarget).addClass("active")};b.prototype.deactivateFont=function(b){a(b.currentTarget).removeClass("active")};b.prototype.updateSelected=function(){var b=this.$original.val();a("span",this.$element).text(this.toReadable(b)).css(this.toStyle(b))};b.prototype.setupHtml=function(){this.$original.empty().hide();this.$element=a("<div>",{"class":this.options.style});this.$arrow=a("<div><b></b></div>");this.$select=a("<a><span>"+this.options.placeholder+"</span></a>");this.$drop=a("<div>",{"class":"fs-drop"});this.$results=a("<ul>",{"class":"fs-results"});this.$original.after(this.$element.append(this.$select.append(this.$arrow)).append(this.$drop));this.$drop.append(this.$results.append(this.fontsAsHtml())).hide()};b.prototype.fontsAsHtml=function(){var a=d.length,b,c,e="";for(var f=0;f<a;f++){b=this.toReadable(d[f]);c=this.toStyle(d[f]);e+='<li data-value="'+d[f]+'" style="font-family: '+c["font-family"]+"; font-weight: "+c["font-weight"]+'">'+b+"</li>"}return e};b.prototype.toReadable=function(a){return a.replace(/[\+|:]/g," ")};b.prototype.toStyle=function(a){var b=a.split(":");return{"font-family":this.toReadable(b[0]),"font-weight":b[1]||400}};b.prototype.getVisibleFonts=function(){if(this.$results.is(":hidden"))return;var b=this,c=this.$results.scrollTop(),d=c+this.$results.height();if(this.options.lookahead){var e=a("li",this.$results).first().height();d+=e*this.options.lookahead}a("li",this.$results).each(function(){var e=a(this).position().top+c,f=e+a(this).height();if(f>=c&&e<=d){var g=a(this).data("value");b.addFontLink(g)}})};b.prototype.addFontLink=function(b){var c=this.options.api+b;a("link[href*='"+b+"']").length===0&&a("link:last").after('<link href="'+c+'" rel="stylesheet" type="text/css">')};return b}();return this.each(function(b){b&&a.extend(e,b);return new f(this,e)})}})(jQuery);
|
4 |
* Copyright (c) 2011 Tom Moor
|
5 |
* MIT Licensed
|
6 |
* @version 0.1
|
7 |
+
*/(function(a){a.fn.fontselect=function(b){var c=function(a,b){return function(){return a.apply(b,arguments)}},d=["Aclonica","Allan","Annie+Use+Your+Telescope","Anonymous+Pro","Allerta+Stencil","Allerta","Amaranth","Anton","Architects+Daughter","Arimo","Artifika","Arvo","Asset","Astloch","Bangers", "Barrio","Bentham","Bevan","Bigshot+One","Bowlby+One","Bowlby+One+SC","Brawler","Buda:300","Cabin","Calligraffitti","Candal","Cantarell","Cardo","Carter One","Caudex","Cedarville+Cursive","Cherry+Cream+Soda","Chewy","Coda","Coming+Soon","Copse","Corben:700","Cousine","Covered+By+Your+Grace","Crafty+Girls","Crimson+Text","Crushed","Cuprum","Damion","Dancing+Script","Dawning+of+a+New+Day","Didact+Gothic","Droid+Sans","Droid+Sans+Mono","Droid+Serif","EB+Garamond","Expletus+Sans","Fontdiner+Swanky","Forum","Francois+One","Geo","Give+You+Glory","Goblin+One","Goudy+Bookletter+1911","Gravitas+One","Gruppo","Hammersmith+One","Holtwood+One+SC","Homemade+Apple","Inconsolata","Indie+Flower","IM+Fell+DW+Pica","IM+Fell+DW+Pica+SC","IM+Fell+Double+Pica","IM+Fell+Double+Pica+SC","IM+Fell+English","IM+Fell+English+SC","IM+Fell+French+Canon","IM+Fell+French+Canon+SC","IM+Fell+Great+Primer","IM+Fell+Great+Primer+SC","Irish+Grover","Irish+Growler","Istok+Web","Josefin+Sans","Josefin+Slab","Judson","Jura","Jura:500","Jura:600","Just+Another+Hand","Just+Me+Again+Down+Here","Kameron","Kenia","Kranky","Kreon","Kristi","La+Belle+Aurore","Lato:100","Lato:100italic","Lato:300","Lato","Lato:bold","Lato:900","League+Script","Lekton", "Life+Savers","Limelight","Lobster","Lobster Two","Lora","Love+Ya+Like+A+Sister","Loved+by+the+King","Luckiest+Guy","Maiden+Orange","Mako","Maven+Pro","Maven+Pro:500","Maven+Pro:700","Maven+Pro:900","Meddon","MedievalSharp","Megrim","Merriweather","Metrophobic","Michroma","Miltonian Tattoo","Miltonian","Modern Antiqua","Monofett","Molengo","Mountains of Christmas","Muli:300","Muli","Neucha","Neuton","News+Cycle","Nixie+One","Nobile","Nova+Cut","Nova+Flat","Nova+Mono","Nova+Oval","Nova+Round","Nova+Script","Nova+Slim","Nova+Square","Nunito:light","Nunito","OFL+Sorts+Mill+Goudy+TT","Old+Standard+TT","Open+Sans:300","Open+Sans","Open+Sans:600","Open+Sans:800","Open+Sans+Condensed:300","Orbitron","Orbitron:500","Orbitron:700","Orbitron:900","Oswald","Over+the+Rainbow","Reenie+Beanie","Pacifico","Patrick+Hand","Paytone+One","Permanent+Marker","Philosopher","Play","Playfair+Display","Podkova","PT+Sans","PT+Sans+Narrow","PT+Sans+Narrow:regular,bold","PT+Serif","PT+Serif Caption","Puritan","Quattrocento","Quattrocento+Sans","Radley","Raleway:100", "Ravi+Prakash", "Redressed", "Roboto","Roboto+Condensed","Roboto+Mono","Roboto+Slab","Rock+Salt","Rokkitt","Ruslan+Display","Schoolbell","Shadows+Into+Light","Shanti","Sigmar+One","Six+Caps","Slackey","Smythe","Sniglet:800","Special+Elite","Stardos+Stencil","Sue+Ellen+Francisco","Sunshiney","Swanky+and+Moo+Moo","Syncopate","Tangerine","Tenor+Sans","Terminal+Dosis+Light","The+Girl+Next+Door","Tinos","Ubuntu","Ultra","Unkempt","UnifrakturCook:bold","UnifrakturMaguntia","Varela","Varela Round","Vibur","Vollkorn","VT323","Waiting+for+the+Sunrise","Wallpoet","Walter+Turncoat","Wire+One","Yanone+Kaffeesatz","Yanone+Kaffeesatz:300","Yanone+Kaffeesatz:400","Yanone+Kaffeesatz:700","Yeseva+One","Zeyada"],e={style:"font-select",placeholder:"Select a font",lookahead:2,api:"https://fonts.googleapis.com/css?family="},f=function(){function b(b,c){this.$original=a(b);this.options=c;this.active=!1;this.setupHtml();this.getVisibleFonts();this.bindEvents();var d=this.$original.val();if(d){this.updateSelected();this.addFontLink(d)}}b.prototype.bindEvents=function(){a("li",this.$results).click(c(this.selectFont,this)).mouseenter(c(this.activateFont,this)).mouseleave(c(this.deactivateFont,this));a("span",this.$select).click(c(this.toggleDrop,this));this.$arrow.click(c(this.toggleDrop,this))};b.prototype.toggleDrop=function(a){if(this.active){this.$element.removeClass("font-select-active");this.$drop.hide();clearInterval(this.visibleInterval)}else{this.$element.addClass("font-select-active");this.$drop.show();this.moveToSelected();this.visibleInterval=setInterval(c(this.getVisibleFonts,this),500)}this.active=!this.active};b.prototype.selectFont=function(){var b=a("li.active",this.$results).data("value");this.$original.val(b).change();this.updateSelected();this.toggleDrop()};b.prototype.moveToSelected=function(){var b,c=this.$original.val();c?b=a("li[data-value='"+c+"']",this.$results):b=a("li",this.$results).first();this.$results.scrollTop(b.addClass("active").position().top)};b.prototype.activateFont=function(b){a("li.active",this.$results).removeClass("active");a(b.currentTarget).addClass("active")};b.prototype.deactivateFont=function(b){a(b.currentTarget).removeClass("active")};b.prototype.updateSelected=function(){var b=this.$original.val();a("span",this.$element).text(this.toReadable(b)).css(this.toStyle(b))};b.prototype.setupHtml=function(){this.$original.empty().hide();this.$element=a("<div>",{"class":this.options.style});this.$arrow=a("<div><b></b></div>");this.$select=a("<a><span>"+this.options.placeholder+"</span></a>");this.$drop=a("<div>",{"class":"fs-drop"});this.$results=a("<ul>",{"class":"fs-results"});this.$original.after(this.$element.append(this.$select.append(this.$arrow)).append(this.$drop));this.$drop.append(this.$results.append(this.fontsAsHtml())).hide()};b.prototype.fontsAsHtml=function(){var a=d.length,b,c,e="";for(var f=0;f<a;f++){b=this.toReadable(d[f]);c=this.toStyle(d[f]);e+='<li data-value="'+d[f]+'" style="font-family: '+c["font-family"]+"; font-weight: "+c["font-weight"]+'">'+b+"</li>"}return e};b.prototype.toReadable=function(a){return a.replace(/[\+|:]/g," ")};b.prototype.toStyle=function(a){var b=a.split(":");return{"font-family":this.toReadable(b[0]),"font-weight":b[1]||400}};b.prototype.getVisibleFonts=function(){if(this.$results.is(":hidden"))return;var b=this,c=this.$results.scrollTop(),d=c+this.$results.height();if(this.options.lookahead){var e=a("li",this.$results).first().height();d+=e*this.options.lookahead}a("li",this.$results).each(function(){var e=a(this).position().top+c,f=e+a(this).height();if(f>=c&&e<=d){var g=a(this).data("value");b.addFontLink(g)}})};b.prototype.addFontLink=function(b){var c=this.options.api+b;a("link[href*='"+b+"']").length===0&&a("link:last").after('<link href="'+c+'" rel="stylesheet" type="text/css">')};return b}();return this.each(function(b){b&&a.extend(e,b);return new f(this,e)})}})(jQuery);
|
js/jquery-ui-timepicker-addon.js
CHANGED
@@ -1,2263 +1,2 @@
|
|
1 |
-
/*! jQuery Timepicker Addon - v1.6.1 - 2015-11-14
|
2 |
-
*
|
3 |
-
* Copyright (c) 2015 Trent Richardson; Licensed MIT */
|
4 |
-
(function (factory) {
|
5 |
-
if (typeof define === 'function' && define.amd) {
|
6 |
-
define(['jquery', 'jquery-ui'], factory);
|
7 |
-
} else {
|
8 |
-
//factory(jQuery);
|
9 |
-
}
|
10 |
-
}(jQuery(document).ready(function($){
|
11 |
-
|
12 |
-
/*
|
13 |
-
* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
|
14 |
-
*/
|
15 |
-
$.ui.timepicker = $.ui.timepicker || {};
|
16 |
-
if ($.ui.timepicker.version) {
|
17 |
-
return;
|
18 |
-
}
|
19 |
-
|
20 |
-
/*
|
21 |
-
* Extend jQueryUI, get it started with our version number
|
22 |
-
*/
|
23 |
-
$.extend($.ui, {
|
24 |
-
timepicker: {
|
25 |
-
version: "1.6.1"
|
26 |
-
}
|
27 |
-
});
|
28 |
-
|
29 |
-
/*
|
30 |
-
* Timepicker manager.
|
31 |
-
* Use the singleton instance of this class, $.timepicker, to interact with the time picker.
|
32 |
-
* Settings for (groups of) time pickers are maintained in an instance object,
|
33 |
-
* allowing multiple different settings on the same page.
|
34 |
-
*/
|
35 |
-
var Timepicker = function () {
|
36 |
-
this.regional = []; // Available regional settings, indexed by language code
|
37 |
-
this.regional[''] = { // Default regional settings
|
38 |
-
currentText: 'Auj.',
|
39 |
-
closeText: 'Valider',
|
40 |
-
amNames: ['AM', 'A'],
|
41 |
-
pmNames: ['PM', 'P'],
|
42 |
-
timeFormat: 'HH:mm',
|
43 |
-
timeSuffix: '',
|
44 |
-
timeOnlyTitle: 'Choisir heure',
|
45 |
-
timeText: 'Heure',
|
46 |
-
hourText: 'Hour',
|
47 |
-
minuteText: 'Minute',
|
48 |
-
secondText: 'Second',
|
49 |
-
millisecText: 'Millisecond',
|
50 |
-
microsecText: 'Microsecond',
|
51 |
-
timezoneText: 'Time Zone',
|
52 |
-
isRTL: false
|
53 |
-
};
|
54 |
-
this._defaults = { // Global defaults for all the datetime picker instances
|
55 |
-
showButtonPanel: true,
|
56 |
-
timeOnly: false,
|
57 |
-
timeOnlyShowDate: false,
|
58 |
-
showHour: null,
|
59 |
-
showMinute: null,
|
60 |
-
showSecond: null,
|
61 |
-
showMillisec: null,
|
62 |
-
showMicrosec: null,
|
63 |
-
showTimezone: null,
|
64 |
-
showTime: true,
|
65 |
-
stepHour: 1,
|
66 |
-
stepMinute: 1,
|
67 |
-
stepSecond: 1,
|
68 |
-
stepMillisec: 1,
|
69 |
-
stepMicrosec: 1,
|
70 |
-
hour: 0,
|
71 |
-
minute: 0,
|
72 |
-
second: 0,
|
73 |
-
millisec: 0,
|
74 |
-
microsec: 0,
|
75 |
-
timezone: null,
|
76 |
-
hourMin: 0,
|
77 |
-
minuteMin: 0,
|
78 |
-
secondMin: 0,
|
79 |
-
millisecMin: 0,
|
80 |
-
microsecMin: 0,
|
81 |
-
hourMax: 23,
|
82 |
-
minuteMax: 59,
|
83 |
-
secondMax: 59,
|
84 |
-
millisecMax: 999,
|
85 |
-
microsecMax: 999,
|
86 |
-
minDateTime: null,
|
87 |
-
maxDateTime: null,
|
88 |
-
maxTime: null,
|
89 |
-
minTime: null,
|
90 |
-
onSelect: null,
|
91 |
-
hourGrid: 0,
|
92 |
-
minuteGrid: 0,
|
93 |
-
secondGrid: 0,
|
94 |
-
millisecGrid: 0,
|
95 |
-
microsecGrid: 0,
|
96 |
-
alwaysSetTime: true,
|
97 |
-
separator: ' ',
|
98 |
-
altFieldTimeOnly: true,
|
99 |
-
altTimeFormat: null,
|
100 |
-
altSeparator: null,
|
101 |
-
altTimeSuffix: null,
|
102 |
-
altRedirectFocus: true,
|
103 |
-
pickerTimeFormat: null,
|
104 |
-
pickerTimeSuffix: null,
|
105 |
-
showTimepicker: true,
|
106 |
-
timezoneList: null,
|
107 |
-
addSliderAccess: false,
|
108 |
-
sliderAccessArgs: null,
|
109 |
-
controlType: 'slider',
|
110 |
-
oneLine: false,
|
111 |
-
defaultValue: null,
|
112 |
-
parse: 'strict',
|
113 |
-
afterInject: null
|
114 |
-
};
|
115 |
-
$.extend(this._defaults, this.regional['']);
|
116 |
-
};
|
117 |
-
|
118 |
-
$.extend(Timepicker.prototype, {
|
119 |
-
$input: null,
|
120 |
-
$altInput: null,
|
121 |
-
$timeObj: null,
|
122 |
-
inst: null,
|
123 |
-
hour_slider: null,
|
124 |
-
minute_slider: null,
|
125 |
-
second_slider: null,
|
126 |
-
millisec_slider: null,
|
127 |
-
microsec_slider: null,
|
128 |
-
timezone_select: null,
|
129 |
-
maxTime: null,
|
130 |
-
minTime: null,
|
131 |
-
hour: 0,
|
132 |
-
minute: 0,
|
133 |
-
second: 0,
|
134 |
-
millisec: 0,
|
135 |
-
microsec: 0,
|
136 |
-
timezone: null,
|
137 |
-
hourMinOriginal: null,
|
138 |
-
minuteMinOriginal: null,
|
139 |
-
secondMinOriginal: null,
|
140 |
-
millisecMinOriginal: null,
|
141 |
-
microsecMinOriginal: null,
|
142 |
-
hourMaxOriginal: null,
|
143 |
-
minuteMaxOriginal: null,
|
144 |
-
secondMaxOriginal: null,
|
145 |
-
millisecMaxOriginal: null,
|
146 |
-
microsecMaxOriginal: null,
|
147 |
-
ampm: '',
|
148 |
-
formattedDate: '',
|
149 |
-
formattedTime: '',
|
150 |
-
formattedDateTime: '',
|
151 |
-
timezoneList: null,
|
152 |
-
units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
|
153 |
-
support: {},
|
154 |
-
control: null,
|
155 |
-
|
156 |
-
/*
|
157 |
-
* Override the default settings for all instances of the time picker.
|
158 |
-
* @param {Object} settings object - the new settings to use as defaults (anonymous object)
|
159 |
-
* @return {Object} the manager object
|
160 |
-
*/
|
161 |
-
setDefaults: function (settings) {
|
162 |
-
extendRemove(this._defaults, settings || {});
|
163 |
-
return this;
|
164 |
-
},
|
165 |
-
|
166 |
-
/*
|
167 |
-
* Create a new Timepicker instance
|
168 |
-
*/
|
169 |
-
_newInst: function ($input, opts) {
|
170 |
-
var tp_inst = new Timepicker(),
|
171 |
-
inlineSettings = {},
|
172 |
-
fns = {},
|
173 |
-
overrides, i;
|
174 |
-
|
175 |
-
for (var attrName in this._defaults) {
|
176 |
-
if (this._defaults.hasOwnProperty(attrName)) {
|
177 |
-
var attrValue = $input.attr('time:' + attrName);
|
178 |
-
if (attrValue) {
|
179 |
-
try {
|
180 |
-
inlineSettings[attrName] = eval(attrValue);
|
181 |
-
} catch (err) {
|
182 |
-
inlineSettings[attrName] = attrValue;
|
183 |
-
}
|
184 |
-
}
|
185 |
-
}
|
186 |
-
}
|
187 |
-
|
188 |
-
overrides = {
|
189 |
-
beforeShow: function (input, dp_inst) {
|
190 |
-
if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
|
191 |
-
return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
|
192 |
-
}
|
193 |
-
},
|
194 |
-
onChangeMonthYear: function (year, month, dp_inst) {
|
195 |
-
// Update the time as well : this prevents the time from disappearing from the $input field.
|
196 |
-
// tp_inst._updateDateTime(dp_inst);
|
197 |
-
if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
|
198 |
-
tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
|
199 |
-
}
|
200 |
-
},
|
201 |
-
onClose: function (dateText, dp_inst) {
|
202 |
-
if (tp_inst.timeDefined === true && $input.val() !== '') {
|
203 |
-
tp_inst._updateDateTime(dp_inst);
|
204 |
-
}
|
205 |
-
if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
|
206 |
-
tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
|
207 |
-
}
|
208 |
-
}
|
209 |
-
};
|
210 |
-
for (i in overrides) {
|
211 |
-
if (overrides.hasOwnProperty(i)) {
|
212 |
-
fns[i] = opts[i] || this._defaults[i] || null;
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
|
217 |
-
evnts: fns,
|
218 |
-
timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
|
219 |
-
});
|
220 |
-
tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
|
221 |
-
return val.toUpperCase();
|
222 |
-
});
|
223 |
-
tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
|
224 |
-
return val.toUpperCase();
|
225 |
-
});
|
226 |
-
|
227 |
-
// detect which units are supported
|
228 |
-
tp_inst.support = detectSupport(
|
229 |
-
tp_inst._defaults.timeFormat +
|
230 |
-
(tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
|
231 |
-
(tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
|
232 |
-
|
233 |
-
// controlType is string - key to our this._controls
|
234 |
-
if (typeof(tp_inst._defaults.controlType) === 'string') {
|
235 |
-
if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
|
236 |
-
tp_inst._defaults.controlType = 'select';
|
237 |
-
}
|
238 |
-
tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
|
239 |
-
}
|
240 |
-
// controlType is an object and must implement create, options, value methods
|
241 |
-
else {
|
242 |
-
tp_inst.control = tp_inst._defaults.controlType;
|
243 |
-
}
|
244 |
-
|
245 |
-
// prep the timezone options
|
246 |
-
var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
|
247 |
-
0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
|
248 |
-
if (tp_inst._defaults.timezoneList !== null) {
|
249 |
-
timezoneList = tp_inst._defaults.timezoneList;
|
250 |
-
}
|
251 |
-
var tzl = timezoneList.length, tzi = 0, tzv = null;
|
252 |
-
if (tzl > 0 && typeof timezoneList[0] !== 'object') {
|
253 |
-
for (; tzi < tzl; tzi++) {
|
254 |
-
tzv = timezoneList[tzi];
|
255 |
-
timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
|
256 |
-
}
|
257 |
-
}
|
258 |
-
tp_inst._defaults.timezoneList = timezoneList;
|
259 |
-
|
260 |
-
// set the default units
|
261 |
-
tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
|
262 |
-
((new Date()).getTimezoneOffset() * -1);
|
263 |
-
tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
|
264 |
-
tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
|
265 |
-
tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
|
266 |
-
tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
|
267 |
-
tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
|
268 |
-
tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
|
269 |
-
tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
|
270 |
-
tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
|
271 |
-
tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
|
272 |
-
tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
|
273 |
-
tp_inst.ampm = '';
|
274 |
-
tp_inst.$input = $input;
|
275 |
-
|
276 |
-
if (tp_inst._defaults.altField) {
|
277 |
-
tp_inst.$altInput = $(tp_inst._defaults.altField);
|
278 |
-
if (tp_inst._defaults.altRedirectFocus === true) {
|
279 |
-
tp_inst.$altInput.css({
|
280 |
-
cursor: 'pointer'
|
281 |
-
}).focus(function () {
|
282 |
-
$input.trigger("focus");
|
283 |
-
});
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
|
288 |
-
tp_inst._defaults.minDate = new Date();
|
289 |
-
}
|
290 |
-
if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
|
291 |
-
tp_inst._defaults.maxDate = new Date();
|
292 |
-
}
|
293 |
-
|
294 |
-
// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
|
295 |
-
if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
|
296 |
-
tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
|
297 |
-
}
|
298 |
-
if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
|
299 |
-
tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
|
300 |
-
}
|
301 |
-
if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
|
302 |
-
tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
|
303 |
-
}
|
304 |
-
if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
|
305 |
-
tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
|
306 |
-
}
|
307 |
-
tp_inst.$input.bind('focus', function () {
|
308 |
-
tp_inst._onFocus();
|
309 |
-
});
|
310 |
-
|
311 |
-
return tp_inst;
|
312 |
-
},
|
313 |
-
|
314 |
-
/*
|
315 |
-
* add our sliders to the calendar
|
316 |
-
*/
|
317 |
-
_addTimePicker: function (dp_inst) {
|
318 |
-
var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
|
319 |
-
|
320 |
-
this.timeDefined = this._parseTime(currDT);
|
321 |
-
this._limitMinMaxDateTime(dp_inst, false);
|
322 |
-
this._injectTimePicker();
|
323 |
-
this._afterInject();
|
324 |
-
},
|
325 |
-
|
326 |
-
/*
|
327 |
-
* parse the time string from input value or _setTime
|
328 |
-
*/
|
329 |
-
_parseTime: function (timeString, withDate) {
|
330 |
-
if (!this.inst) {
|
331 |
-
this.inst = $.datepicker._getInst(this.$input[0]);
|
332 |
-
}
|
333 |
-
|
334 |
-
if (withDate || !this._defaults.timeOnly) {
|
335 |
-
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
|
336 |
-
try {
|
337 |
-
var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
|
338 |
-
if (!parseRes.timeObj) {
|
339 |
-
return false;
|
340 |
-
}
|
341 |
-
$.extend(this, parseRes.timeObj);
|
342 |
-
} catch (err) {
|
343 |
-
$.timepicker.log("Error parsing the date/time string: " + err +
|
344 |
-
"\ndate/time string = " + timeString +
|
345 |
-
"\ntimeFormat = " + this._defaults.timeFormat +
|
346 |
-
"\ndateFormat = " + dp_dateFormat);
|
347 |
-
return false;
|
348 |
-
}
|
349 |
-
return true;
|
350 |
-
} else {
|
351 |
-
var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
|
352 |
-
if (!timeObj) {
|
353 |
-
return false;
|
354 |
-
}
|
355 |
-
$.extend(this, timeObj);
|
356 |
-
return true;
|
357 |
-
}
|
358 |
-
},
|
359 |
-
|
360 |
-
/*
|
361 |
-
* Handle callback option after injecting timepicker
|
362 |
-
*/
|
363 |
-
_afterInject: function() {
|
364 |
-
var o = this.inst.settings;
|
365 |
-
if ($.isFunction(o.afterInject)) {
|
366 |
-
o.afterInject.call(this);
|
367 |
-
}
|
368 |
-
},
|
369 |
-
|
370 |
-
/*
|
371 |
-
* generate and inject html for timepicker into ui datepicker
|
372 |
-
*/
|
373 |
-
_injectTimePicker: function () {
|
374 |
-
var $dp = this.inst.dpDiv,
|
375 |
-
o = this.inst.settings,
|
376 |
-
tp_inst = this,
|
377 |
-
litem = '',
|
378 |
-
uitem = '',
|
379 |
-
show = null,
|
380 |
-
max = {},
|
381 |
-
gridSize = {},
|
382 |
-
size = null,
|
383 |
-
i = 0,
|
384 |
-
l = 0;
|
385 |
-
|
386 |
-
// Prevent displaying twice
|
387 |
-
if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
|
388 |
-
var noDisplay = ' ui_tpicker_unit_hide',
|
389 |
-
html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + (o.oneLine && o.controlType === 'select' ? ' ui-timepicker-oneLine' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label' + ((o.showTime) ? '' : noDisplay) + '">' + o.timeText + '</dt>' +
|
390 |
-
'<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"><input class="ui_tpicker_time_input" ' + (o.timeInput ? '' : 'disabled') + '/></dd>';
|
391 |
-
|
392 |
-
// Create the markup
|
393 |
-
for (i = 0, l = this.units.length; i < l; i++) {
|
394 |
-
litem = this.units[i];
|
395 |
-
uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
|
396 |
-
show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
|
397 |
-
|
398 |
-
// Added by Peter Medeiros:
|
399 |
-
// - Figure out what the hour/minute/second max should be based on the step values.
|
400 |
-
// - Example: if stepMinute is 15, then minMax is 45.
|
401 |
-
max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
|
402 |
-
gridSize[litem] = 0;
|
403 |
-
|
404 |
-
html += '<dt class="ui_tpicker_' + litem + '_label' + (show ? '' : noDisplay) + '">' + o[litem + 'Text'] + '</dt>' +
|
405 |
-
'<dd class="ui_tpicker_' + litem + (show ? '' : noDisplay) + '"><div class="ui_tpicker_' + litem + '_slider' + (show ? '' : noDisplay) + '"></div>';
|
406 |
-
|
407 |
-
if (show && o[litem + 'Grid'] > 0) {
|
408 |
-
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
|
409 |
-
|
410 |
-
if (litem === 'hour') {
|
411 |
-
for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
|
412 |
-
gridSize[litem]++;
|
413 |
-
var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
|
414 |
-
html += '<td data-for="' + litem + '">' + tmph + '</td>';
|
415 |
-
}
|
416 |
-
}
|
417 |
-
else {
|
418 |
-
for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
|
419 |
-
gridSize[litem]++;
|
420 |
-
html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
html += '</tr></table></div>';
|
425 |
-
}
|
426 |
-
html += '</dd>';
|
427 |
-
}
|
428 |
-
|
429 |
-
// Timezone
|
430 |
-
var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
|
431 |
-
html += '<dt class="ui_tpicker_timezone_label' + (showTz ? '' : noDisplay) + '">' + o.timezoneText + '</dt>';
|
432 |
-
html += '<dd class="ui_tpicker_timezone' + (showTz ? '' : noDisplay) + '"></dd>';
|
433 |
-
|
434 |
-
// Create the elements from string
|
435 |
-
html += '</dl></div>';
|
436 |
-
var $tp = $(html);
|
437 |
-
|
438 |
-
// if we only want time picker...
|
439 |
-
if (o.timeOnly === true) {
|
440 |
-
$tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
|
441 |
-
$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
|
442 |
-
}
|
443 |
-
|
444 |
-
// add sliders, adjust grids, add events
|
445 |
-
for (i = 0, l = tp_inst.units.length; i < l; i++) {
|
446 |
-
litem = tp_inst.units[i];
|
447 |
-
uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
|
448 |
-
show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
|
449 |
-
|
450 |
-
// add the slider
|
451 |
-
tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
|
452 |
-
|
453 |
-
// adjust the grid and add click event
|
454 |
-
if (show && o[litem + 'Grid'] > 0) {
|
455 |
-
size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
|
456 |
-
$tp.find('.ui_tpicker_' + litem + ' table').css({
|
457 |
-
width: size + "%",
|
458 |
-
marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
|
459 |
-
marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
|
460 |
-
borderCollapse: 'collapse'
|
461 |
-
}).find("td").click(function (e) {
|
462 |
-
var $t = $(this),
|
463 |
-
h = $t.html(),
|
464 |
-
n = parseInt(h.replace(/[^0-9]/g), 10),
|
465 |
-
ap = h.replace(/[^apm]/ig),
|
466 |
-
f = $t.data('for'); // loses scope, so we use data-for
|
467 |
-
|
468 |
-
if (f === 'hour') {
|
469 |
-
if (ap.indexOf('p') !== -1 && n < 12) {
|
470 |
-
n += 12;
|
471 |
-
}
|
472 |
-
else {
|
473 |
-
if (ap.indexOf('a') !== -1 && n === 12) {
|
474 |
-
n = 0;
|
475 |
-
}
|
476 |
-
}
|
477 |
-
}
|
478 |
-
|
479 |
-
tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
|
480 |
-
|
481 |
-
tp_inst._onTimeChange();
|
482 |
-
tp_inst._onSelectHandler();
|
483 |
-
}).css({
|
484 |
-
cursor: 'pointer',
|
485 |
-
width: (100 / gridSize[litem]) + '%',
|
486 |
-
textAlign: 'center',
|
487 |
-
overflow: 'hidden'
|
488 |
-
});
|
489 |
-
} // end if grid > 0
|
490 |
-
} // end for loop
|
491 |
-
|
492 |
-
// Add timezone options
|
493 |
-
this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
|
494 |
-
$.fn.append.apply(this.timezone_select,
|
495 |
-
$.map(o.timezoneList, function (val, idx) {
|
496 |
-
return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
|
497 |
-
}));
|
498 |
-
if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
|
499 |
-
var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
|
500 |
-
if (local_timezone === this.timezone) {
|
501 |
-
selectLocalTimezone(tp_inst);
|
502 |
-
} else {
|
503 |
-
this.timezone_select.val(this.timezone);
|
504 |
-
}
|
505 |
-
} else {
|
506 |
-
if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
|
507 |
-
this.timezone_select.val(o.timezone);
|
508 |
-
} else {
|
509 |
-
selectLocalTimezone(tp_inst);
|
510 |
-
}
|
511 |
-
}
|
512 |
-
this.timezone_select.change(function () {
|
513 |
-
tp_inst._onTimeChange();
|
514 |
-
tp_inst._onSelectHandler();
|
515 |
-
tp_inst._afterInject();
|
516 |
-
});
|
517 |
-
// End timezone options
|
518 |
-
|
519 |
-
// inject timepicker into datepicker
|
520 |
-
var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
|
521 |
-
if ($buttonPanel.length) {
|
522 |
-
$buttonPanel.before($tp);
|
523 |
-
} else {
|
524 |
-
$dp.append($tp);
|
525 |
-
}
|
526 |
-
|
527 |
-
this.$timeObj = $tp.find('.ui_tpicker_time_input');
|
528 |
-
this.$timeObj.change(function () {
|
529 |
-
var timeFormat = tp_inst.inst.settings.timeFormat;
|
530 |
-
var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
|
531 |
-
var update = new Date();
|
532 |
-
if (parsedTime) {
|
533 |
-
update.setHours(parsedTime.hour);
|
534 |
-
update.setMinutes(parsedTime.minute);
|
535 |
-
update.setSeconds(parsedTime.second);
|
536 |
-
$.datepicker._setTime(tp_inst.inst, update);
|
537 |
-
} else {
|
538 |
-
this.value = tp_inst.formattedTime;
|
539 |
-
this.blur();
|
540 |
-
}
|
541 |
-
});
|
542 |
-
|
543 |
-
if (this.inst !== null) {
|
544 |
-
var timeDefined = this.timeDefined;
|
545 |
-
this._onTimeChange();
|
546 |
-
this.timeDefined = timeDefined;
|
547 |
-
}
|
548 |
-
|
549 |
-
// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
|
550 |
-
if (this._defaults.addSliderAccess) {
|
551 |
-
var sliderAccessArgs = this._defaults.sliderAccessArgs,
|
552 |
-
rtl = this._defaults.isRTL;
|
553 |
-
sliderAccessArgs.isRTL = rtl;
|
554 |
-
|
555 |
-
setTimeout(function () { // fix for inline mode
|
556 |
-
if ($tp.find('.ui-slider-access').length === 0) {
|
557 |
-
$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
|
558 |
-
|
559 |
-
// fix any grids since sliders are shorter
|
560 |
-
var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
|
561 |
-
if (sliderAccessWidth) {
|
562 |
-
$tp.find('table:visible').each(function () {
|
563 |
-
var $g = $(this),
|
564 |
-
oldWidth = $g.outerWidth(),
|
565 |
-
oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
|
566 |
-
newWidth = oldWidth - sliderAccessWidth,
|
567 |
-
newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
|
568 |
-
css = { width: newWidth, marginRight: 0, marginLeft: 0 };
|
569 |
-
css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
|
570 |
-
$g.css(css);
|
571 |
-
});
|
572 |
-
}
|
573 |
-
}
|
574 |
-
}, 10);
|
575 |
-
}
|
576 |
-
// end slideAccess integration
|
577 |
-
|
578 |
-
tp_inst._limitMinMaxDateTime(this.inst, true);
|
579 |
-
}
|
580 |
-
},
|
581 |
-
|
582 |
-
/*
|
583 |
-
* This function tries to limit the ability to go outside the
|
584 |
-
* min/max date range
|
585 |
-
*/
|
586 |
-
_limitMinMaxDateTime: function (dp_inst, adjustSliders) {
|
587 |
-
var o = this._defaults,
|
588 |
-
dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
|
589 |
-
|
590 |
-
if (!this._defaults.showTimepicker) {
|
591 |
-
return;
|
592 |
-
} // No time so nothing to check here
|
593 |
-
|
594 |
-
if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
|
595 |
-
var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
|
596 |
-
minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
|
597 |
-
|
598 |
-
if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
|
599 |
-
this.hourMinOriginal = o.hourMin;
|
600 |
-
this.minuteMinOriginal = o.minuteMin;
|
601 |
-
this.secondMinOriginal = o.secondMin;
|
602 |
-
this.millisecMinOriginal = o.millisecMin;
|
603 |
-
this.microsecMinOriginal = o.microsecMin;
|
604 |
-
}
|
605 |
-
|
606 |
-
if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
|
607 |
-
this._defaults.hourMin = minDateTime.getHours();
|
608 |
-
if (this.hour <= this._defaults.hourMin) {
|
609 |
-
this.hour = this._defaults.hourMin;
|
610 |
-
this._defaults.minuteMin = minDateTime.getMinutes();
|
611 |
-
if (this.minute <= this._defaults.minuteMin) {
|
612 |
-
this.minute = this._defaults.minuteMin;
|
613 |
-
this._defaults.secondMin = minDateTime.getSeconds();
|
614 |
-
if (this.second <= this._defaults.secondMin) {
|
615 |
-
this.second = this._defaults.secondMin;
|
616 |
-
this._defaults.millisecMin = minDateTime.getMilliseconds();
|
617 |
-
if (this.millisec <= this._defaults.millisecMin) {
|
618 |
-
this.millisec = this._defaults.millisecMin;
|
619 |
-
this._defaults.microsecMin = minDateTime.getMicroseconds();
|
620 |
-
} else {
|
621 |
-
if (this.microsec < this._defaults.microsecMin) {
|
622 |
-
this.microsec = this._defaults.microsecMin;
|
623 |
-
}
|
624 |
-
this._defaults.microsecMin = this.microsecMinOriginal;
|
625 |
-
}
|
626 |
-
} else {
|
627 |
-
this._defaults.millisecMin = this.millisecMinOriginal;
|
628 |
-
this._defaults.microsecMin = this.microsecMinOriginal;
|
629 |
-
}
|
630 |
-
} else {
|
631 |
-
this._defaults.secondMin = this.secondMinOriginal;
|
632 |
-
this._defaults.millisecMin = this.millisecMinOriginal;
|
633 |
-
this._defaults.microsecMin = this.microsecMinOriginal;
|
634 |
-
}
|
635 |
-
} else {
|
636 |
-
this._defaults.minuteMin = this.minuteMinOriginal;
|
637 |
-
this._defaults.secondMin = this.secondMinOriginal;
|
638 |
-
this._defaults.millisecMin = this.millisecMinOriginal;
|
639 |
-
this._defaults.microsecMin = this.microsecMinOriginal;
|
640 |
-
}
|
641 |
-
} else {
|
642 |
-
this._defaults.hourMin = this.hourMinOriginal;
|
643 |
-
this._defaults.minuteMin = this.minuteMinOriginal;
|
644 |
-
this._defaults.secondMin = this.secondMinOriginal;
|
645 |
-
this._defaults.millisecMin = this.millisecMinOriginal;
|
646 |
-
this._defaults.microsecMin = this.microsecMinOriginal;
|
647 |
-
}
|
648 |
-
}
|
649 |
-
|
650 |
-
if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
|
651 |
-
var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
|
652 |
-
maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
|
653 |
-
|
654 |
-
if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
|
655 |
-
this.hourMaxOriginal = o.hourMax;
|
656 |
-
this.minuteMaxOriginal = o.minuteMax;
|
657 |
-
this.secondMaxOriginal = o.secondMax;
|
658 |
-
this.millisecMaxOriginal = o.millisecMax;
|
659 |
-
this.microsecMaxOriginal = o.microsecMax;
|
660 |
-
}
|
661 |
-
|
662 |
-
if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
|
663 |
-
this._defaults.hourMax = maxDateTime.getHours();
|
664 |
-
if (this.hour >= this._defaults.hourMax) {
|
665 |
-
this.hour = this._defaults.hourMax;
|
666 |
-
this._defaults.minuteMax = maxDateTime.getMinutes();
|
667 |
-
if (this.minute >= this._defaults.minuteMax) {
|
668 |
-
this.minute = this._defaults.minuteMax;
|
669 |
-
this._defaults.secondMax = maxDateTime.getSeconds();
|
670 |
-
if (this.second >= this._defaults.secondMax) {
|
671 |
-
this.second = this._defaults.secondMax;
|
672 |
-
this._defaults.millisecMax = maxDateTime.getMilliseconds();
|
673 |
-
if (this.millisec >= this._defaults.millisecMax) {
|
674 |
-
this.millisec = this._defaults.millisecMax;
|
675 |
-
this._defaults.microsecMax = maxDateTime.getMicroseconds();
|
676 |
-
} else {
|
677 |
-
if (this.microsec > this._defaults.microsecMax) {
|
678 |
-
this.microsec = this._defaults.microsecMax;
|
679 |
-
}
|
680 |
-
this._defaults.microsecMax = this.microsecMaxOriginal;
|
681 |
-
}
|
682 |
-
} else {
|
683 |
-
this._defaults.millisecMax = this.millisecMaxOriginal;
|
684 |
-
this._defaults.microsecMax = this.microsecMaxOriginal;
|
685 |
-
}
|
686 |
-
} else {
|
687 |
-
this._defaults.secondMax = this.secondMaxOriginal;
|
688 |
-
this._defaults.millisecMax = this.millisecMaxOriginal;
|
689 |
-
this._defaults.microsecMax = this.microsecMaxOriginal;
|
690 |
-
}
|
691 |
-
} else {
|
692 |
-
this._defaults.minuteMax = this.minuteMaxOriginal;
|
693 |
-
this._defaults.secondMax = this.secondMaxOriginal;
|
694 |
-
this._defaults.millisecMax = this.millisecMaxOriginal;
|
695 |
-
this._defaults.microsecMax = this.microsecMaxOriginal;
|
696 |
-
}
|
697 |
-
} else {
|
698 |
-
this._defaults.hourMax = this.hourMaxOriginal;
|
699 |
-
this._defaults.minuteMax = this.minuteMaxOriginal;
|
700 |
-
this._defaults.secondMax = this.secondMaxOriginal;
|
701 |
-
this._defaults.millisecMax = this.millisecMaxOriginal;
|
702 |
-
this._defaults.microsecMax = this.microsecMaxOriginal;
|
703 |
-
}
|
704 |
-
}
|
705 |
-
|
706 |
-
if (dp_inst.settings.minTime!==null) {
|
707 |
-
var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
|
708 |
-
if (this.hour<tempMinTime.getHours()) {
|
709 |
-
this.hour=this._defaults.hourMin=tempMinTime.getHours();
|
710 |
-
this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
|
711 |
-
} else if (this.hour===tempMinTime.getHours() && this.minute<tempMinTime.getMinutes()) {
|
712 |
-
this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
|
713 |
-
} else {
|
714 |
-
if (this._defaults.hourMin<tempMinTime.getHours()) {
|
715 |
-
this._defaults.hourMin=tempMinTime.getHours();
|
716 |
-
this._defaults.minuteMin=tempMinTime.getMinutes();
|
717 |
-
} else if (this._defaults.hourMin===tempMinTime.getHours()===this.hour && this._defaults.minuteMin<tempMinTime.getMinutes()) {
|
718 |
-
this._defaults.minuteMin=tempMinTime.getMinutes();
|
719 |
-
} else {
|
720 |
-
this._defaults.minuteMin=0;
|
721 |
-
}
|
722 |
-
}
|
723 |
-
}
|
724 |
-
|
725 |
-
if (dp_inst.settings.maxTime!==null) {
|
726 |
-
var tempMaxTime=new Date("01/01/1970 " + dp_inst.settings.maxTime);
|
727 |
-
if (this.hour>tempMaxTime.getHours()) {
|
728 |
-
this.hour=this._defaults.hourMax=tempMaxTime.getHours();
|
729 |
-
this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
|
730 |
-
} else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
|
731 |
-
this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
|
732 |
-
} else {
|
733 |
-
if (this._defaults.hourMax>tempMaxTime.getHours()) {
|
734 |
-
this._defaults.hourMax=tempMaxTime.getHours();
|
735 |
-
this._defaults.minuteMax=tempMaxTime.getMinutes();
|
736 |
-
} else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
|
737 |
-
this._defaults.minuteMax=tempMaxTime.getMinutes();
|
738 |
-
} else {
|
739 |
-
this._defaults.minuteMax=59;
|
740 |
-
}
|
741 |
-
}
|
742 |
-
}
|
743 |
-
|
744 |
-
if (adjustSliders !== undefined && adjustSliders === true) {
|
745 |
-
var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
|
746 |
-
minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
|
747 |
-
secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
|
748 |
-
millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
|
749 |
-
microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
|
750 |
-
|
751 |
-
if (this.hour_slider) {
|
752 |
-
this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
|
753 |
-
this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
|
754 |
-
}
|
755 |
-
if (this.minute_slider) {
|
756 |
-
this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
|
757 |
-
this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
|
758 |
-
}
|
759 |
-
if (this.second_slider) {
|
760 |
-
this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
|
761 |
-
this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
|
762 |
-
}
|
763 |
-
if (this.millisec_slider) {
|
764 |
-
this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
|
765 |
-
this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
|
766 |
-
}
|
767 |
-
if (this.microsec_slider) {
|
768 |
-
this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
|
769 |
-
this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
|
770 |
-
}
|
771 |
-
}
|
772 |
-
|
773 |
-
},
|
774 |
-
|
775 |
-
/*
|
776 |
-
* when a slider moves, set the internal time...
|
777 |
-
* on time change is also called when the time is updated in the text field
|
778 |
-
*/
|
779 |
-
_onTimeChange: function () {
|
780 |
-
if (!this._defaults.showTimepicker) {
|
781 |
-
return;
|
782 |
-
}
|
783 |
-
var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
|
784 |
-
minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
|
785 |
-
second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
|
786 |
-
millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
|
787 |
-
microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
|
788 |
-
timezone = (this.timezone_select) ? this.timezone_select.val() : false,
|
789 |
-
o = this._defaults,
|
790 |
-
pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
|
791 |
-
pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
|
792 |
-
|
793 |
-
if (typeof(hour) === 'object') {
|
794 |
-
hour = false;
|
795 |
-
}
|
796 |
-
if (typeof(minute) === 'object') {
|
797 |
-
minute = false;
|
798 |
-
}
|
799 |
-
if (typeof(second) === 'object') {
|
800 |
-
second = false;
|
801 |
-
}
|
802 |
-
if (typeof(millisec) === 'object') {
|
803 |
-
millisec = false;
|
804 |
-
}
|
805 |
-
if (typeof(microsec) === 'object') {
|
806 |
-
microsec = false;
|
807 |
-
}
|
808 |
-
if (typeof(timezone) === 'object') {
|
809 |
-
timezone = false;
|
810 |
-
}
|
811 |
-
|
812 |
-
if (hour !== false) {
|
813 |
-
hour = parseInt(hour, 10);
|
814 |
-
}
|
815 |
-
if (minute !== false) {
|
816 |
-
minute = parseInt(minute, 10);
|
817 |
-
}
|
818 |
-
if (second !== false) {
|
819 |
-
second = parseInt(second, 10);
|
820 |
-
}
|
821 |
-
if (millisec !== false) {
|
822 |
-
millisec = parseInt(millisec, 10);
|
823 |
-
}
|
824 |
-
if (microsec !== false) {
|
825 |
-
microsec = parseInt(microsec, 10);
|
826 |
-
}
|
827 |
-
if (timezone !== false) {
|
828 |
-
timezone = timezone.toString();
|
829 |
-
}
|
830 |
-
|
831 |
-
var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
|
832 |
-
|
833 |
-
// If the update was done in the input field, the input field should not be updated.
|
834 |
-
// If the update was done using the sliders, update the input field.
|
835 |
-
var hasChanged = (
|
836 |
-
hour !== parseInt(this.hour,10) || // sliders should all be numeric
|
837 |
-
minute !== parseInt(this.minute,10) ||
|
838 |
-
second !== parseInt(this.second,10) ||
|
839 |
-
millisec !== parseInt(this.millisec,10) ||
|
840 |
-
microsec !== parseInt(this.microsec,10) ||
|
841 |
-
(this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
|
842 |
-
(this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
|
843 |
-
);
|
844 |
-
|
845 |
-
if (hasChanged) {
|
846 |
-
|
847 |
-
if (hour !== false) {
|
848 |
-
this.hour = hour;
|
849 |
-
}
|
850 |
-
if (minute !== false) {
|
851 |
-
this.minute = minute;
|
852 |
-
}
|
853 |
-
if (second !== false) {
|
854 |
-
this.second = second;
|
855 |
-
}
|
856 |
-
if (millisec !== false) {
|
857 |
-
this.millisec = millisec;
|
858 |
-
}
|
859 |
-
if (microsec !== false) {
|
860 |
-
this.microsec = microsec;
|
861 |
-
}
|
862 |
-
if (timezone !== false) {
|
863 |
-
this.timezone = timezone;
|
864 |
-
}
|
865 |
-
|
866 |
-
if (!this.inst) {
|
867 |
-
this.inst = $.datepicker._getInst(this.$input[0]);
|
868 |
-
}
|
869 |
-
|
870 |
-
this._limitMinMaxDateTime(this.inst, true);
|
871 |
-
}
|
872 |
-
if (this.support.ampm) {
|
873 |
-
this.ampm = ampm;
|
874 |
-
}
|
875 |
-
|
876 |
-
// Updates the time within the timepicker
|
877 |
-
this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
|
878 |
-
if (this.$timeObj) {
|
879 |
-
var sPos = this.$timeObj[0].selectionStart;
|
880 |
-
var ePos = this.$timeObj[0].selectionEnd;
|
881 |
-
if (pickerTimeFormat === o.timeFormat) {
|
882 |
-
this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
|
883 |
-
}
|
884 |
-
else {
|
885 |
-
this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
|
886 |
-
}
|
887 |
-
this.$timeObj[0].setSelectionRange(sPos, ePos);
|
888 |
-
}
|
889 |
-
|
890 |
-
this.timeDefined = true;
|
891 |
-
if (hasChanged) {
|
892 |
-
this._updateDateTime();
|
893 |
-
//this.$input.focus(); // may automatically open the picker on setDate
|
894 |
-
}
|
895 |
-
},
|
896 |
-
|
897 |
-
/*
|
898 |
-
* call custom onSelect.
|
899 |
-
* bind to sliders slidestop, and grid click.
|
900 |
-
*/
|
901 |
-
_onSelectHandler: function () {
|
902 |
-
var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
|
903 |
-
var inputEl = this.$input ? this.$input[0] : null;
|
904 |
-
if (onSelect && inputEl) {
|
905 |
-
onSelect.apply(inputEl, [this.formattedDateTime, this]);
|
906 |
-
}
|
907 |
-
},
|
908 |
-
|
909 |
-
/*
|
910 |
-
* update our input with the new date time..
|
911 |
-
*/
|
912 |
-
_updateDateTime: function (dp_inst) {
|
913 |
-
dp_inst = this.inst || dp_inst;
|
914 |
-
var dtTmp = (dp_inst.currentYear > 0?
|
915 |
-
new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
|
916 |
-
new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
|
917 |
-
dt = $.datepicker._daylightSavingAdjust(dtTmp),
|
918 |
-
//dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
|
919 |
-
//dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
|
920 |
-
dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
|
921 |
-
formatCfg = $.datepicker._getFormatConfig(dp_inst),
|
922 |
-
timeAvailable = dt !== null && this.timeDefined;
|
923 |
-
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
|
924 |
-
var formattedDateTime = this.formattedDate;
|
925 |
-
|
926 |
-
// if a slider was changed but datepicker doesn't have a value yet, set it
|
927 |
-
if (dp_inst.lastVal === "") {
|
928 |
-
dp_inst.currentYear = dp_inst.selectedYear;
|
929 |
-
dp_inst.currentMonth = dp_inst.selectedMonth;
|
930 |
-
dp_inst.currentDay = dp_inst.selectedDay;
|
931 |
-
}
|
932 |
-
|
933 |
-
/*
|
934 |
-
* remove following lines to force every changes in date picker to change the input value
|
935 |
-
* Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
|
936 |
-
* If the user manually empty the value in the input field, the date picker will never change selected value.
|
937 |
-
*/
|
938 |
-
//if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
|
939 |
-
// return;
|
940 |
-
//}
|
941 |
-
|
942 |
-
if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
|
943 |
-
formattedDateTime = this.formattedTime;
|
944 |
-
} else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
|
945 |
-
formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
|
946 |
-
}
|
947 |
-
|
948 |
-
this.formattedDateTime = formattedDateTime;
|
949 |
-
|
950 |
-
if (!this._defaults.showTimepicker) {
|
951 |
-
this.$input.val(this.formattedDate);
|
952 |
-
} else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
|
953 |
-
this.$altInput.val(this.formattedTime);
|
954 |
-
this.$input.val(this.formattedDate);
|
955 |
-
} else if (this.$altInput) {
|
956 |
-
this.$input.val(formattedDateTime);
|
957 |
-
var altFormattedDateTime = '',
|
958 |
-
altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
|
959 |
-
altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
|
960 |
-
|
961 |
-
if (!this._defaults.timeOnly) {
|
962 |
-
if (this._defaults.altFormat) {
|
963 |
-
altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
|
964 |
-
}
|
965 |
-
else {
|
966 |
-
altFormattedDateTime = this.formattedDate;
|
967 |
-
}
|
968 |
-
|
969 |
-
if (altFormattedDateTime) {
|
970 |
-
altFormattedDateTime += altSeparator;
|
971 |
-
}
|
972 |
-
}
|
973 |
-
|
974 |
-
if (this._defaults.altTimeFormat !== null) {
|
975 |
-
altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
|
976 |
-
}
|
977 |
-
else {
|
978 |
-
altFormattedDateTime += this.formattedTime + altTimeSuffix;
|
979 |
-
}
|
980 |
-
this.$altInput.val(altFormattedDateTime);
|
981 |
-
} else {
|
982 |
-
this.$input.val(formattedDateTime);
|
983 |
-
}
|
984 |
-
|
985 |
-
this.$input.trigger("change");
|
986 |
-
},
|
987 |
-
|
988 |
-
_onFocus: function () {
|
989 |
-
if (!this.$input.val() && this._defaults.defaultValue) {
|
990 |
-
this.$input.val(this._defaults.defaultValue);
|
991 |
-
var inst = $.datepicker._getInst(this.$input.get(0)),
|
992 |
-
tp_inst = $.datepicker._get(inst, 'timepicker');
|
993 |
-
if (tp_inst) {
|
994 |
-
if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
|
995 |
-
try {
|
996 |
-
$.datepicker._updateDatepicker(inst);
|
997 |
-
} catch (err) {
|
998 |
-
$.timepicker.log(err);
|
999 |
-
}
|
1000 |
-
}
|
1001 |
-
}
|
1002 |
-
}
|
1003 |
-
},
|
1004 |
-
|
1005 |
-
/*
|
1006 |
-
* Small abstraction to control types
|
1007 |
-
* We can add more, just be sure to follow the pattern: create, options, value
|
1008 |
-
*/
|
1009 |
-
_controls: {
|
1010 |
-
// slider methods
|
1011 |
-
slider: {
|
1012 |
-
create: function (tp_inst, obj, unit, val, min, max, step) {
|
1013 |
-
var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
|
1014 |
-
return obj.prop('slide', null).slider({
|
1015 |
-
orientation: "horizontal",
|
1016 |
-
value: rtl ? val * -1 : val,
|
1017 |
-
min: rtl ? max * -1 : min,
|
1018 |
-
max: rtl ? min * -1 : max,
|
1019 |
-
step: step,
|
1020 |
-
slide: function (event, ui) {
|
1021 |
-
tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
|
1022 |
-
tp_inst._onTimeChange();
|
1023 |
-
},
|
1024 |
-
stop: function (event, ui) {
|
1025 |
-
tp_inst._onSelectHandler();
|
1026 |
-
}
|
1027 |
-
});
|
1028 |
-
},
|
1029 |
-
options: function (tp_inst, obj, unit, opts, val) {
|
1030 |
-
if (tp_inst._defaults.isRTL) {
|
1031 |
-
if (typeof(opts) === 'string') {
|
1032 |
-
if (opts === 'min' || opts === 'max') {
|
1033 |
-
if (val !== undefined) {
|
1034 |
-
return obj.slider(opts, val * -1);
|
1035 |
-
}
|
1036 |
-
return Math.abs(obj.slider(opts));
|
1037 |
-
}
|
1038 |
-
return obj.slider(opts);
|
1039 |
-
}
|
1040 |
-
var min = opts.min,
|
1041 |
-
max = opts.max;
|
1042 |
-
opts.min = opts.max = null;
|
1043 |
-
if (min !== undefined) {
|
1044 |
-
opts.max = min * -1;
|
1045 |
-
}
|
1046 |
-
if (max !== undefined) {
|
1047 |
-
opts.min = max * -1;
|
1048 |
-
}
|
1049 |
-
return obj.slider(opts);
|
1050 |
-
}
|
1051 |
-
if (typeof(opts) === 'string' && val !== undefined) {
|
1052 |
-
return obj.slider(opts, val);
|
1053 |
-
}
|
1054 |
-
return obj.slider(opts);
|
1055 |
-
},
|
1056 |
-
value: function (tp_inst, obj, unit, val) {
|
1057 |
-
if (tp_inst._defaults.isRTL) {
|
1058 |
-
if (val !== undefined) {
|
1059 |
-
return obj.slider('value', val * -1);
|
1060 |
-
}
|
1061 |
-
return Math.abs(obj.slider('value'));
|
1062 |
-
}
|
1063 |
-
if (val !== undefined) {
|
1064 |
-
return obj.slider('value', val);
|
1065 |
-
}
|
1066 |
-
return obj.slider('value');
|
1067 |
-
}
|
1068 |
-
},
|
1069 |
-
// select methods
|
1070 |
-
select: {
|
1071 |
-
create: function (tp_inst, obj, unit, val, min, max, step) {
|
1072 |
-
var sel = '<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">',
|
1073 |
-
format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
|
1074 |
-
|
1075 |
-
for (var i = min; i <= max; i += step) {
|
1076 |
-
sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>';
|
1077 |
-
if (unit === 'hour') {
|
1078 |
-
sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
|
1079 |
-
}
|
1080 |
-
else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
|
1081 |
-
else {sel += '0' + i.toString(); }
|
1082 |
-
sel += '</option>';
|
1083 |
-
}
|
1084 |
-
sel += '</select>';
|
1085 |
-
|
1086 |
-
obj.children('select').remove();
|
1087 |
-
|
1088 |
-
$(sel).appendTo(obj).change(function (e) {
|
1089 |
-
tp_inst._onTimeChange();
|
1090 |
-
tp_inst._onSelectHandler();
|
1091 |
-
tp_inst._afterInject();
|
1092 |
-
});
|
1093 |
-
|
1094 |
-
return obj;
|
1095 |
-
},
|
1096 |
-
options: function (tp_inst, obj, unit, opts, val) {
|
1097 |
-
var o = {},
|
1098 |
-
$t = obj.children('select');
|
1099 |
-
if (typeof(opts) === 'string') {
|
1100 |
-
if (val === undefined) {
|
1101 |
-
return $t.data(opts);
|
1102 |
-
}
|
1103 |
-
o[opts] = val;
|
1104 |
-
}
|
1105 |
-
else { o = opts; }
|
1106 |
-
return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
|
1107 |
-
},
|
1108 |
-
value: function (tp_inst, obj, unit, val) {
|
1109 |
-
var $t = obj.children('select');
|
1110 |
-
if (val !== undefined) {
|
1111 |
-
return $t.val(val);
|
1112 |
-
}
|
1113 |
-
return $t.val();
|
1114 |
-
}
|
1115 |
-
}
|
1116 |
-
} // end _controls
|
1117 |
-
|
1118 |
-
});
|
1119 |
-
|
1120 |
-
$.fn.extend({
|
1121 |
-
/*
|
1122 |
-
* shorthand just to use timepicker.
|
1123 |
-
*/
|
1124 |
-
timepicker: function (o) {
|
1125 |
-
o = o || {};
|
1126 |
-
var tmp_args = Array.prototype.slice.call(arguments);
|
1127 |
-
|
1128 |
-
if (typeof o === 'object') {
|
1129 |
-
tmp_args[0] = $.extend(o, {
|
1130 |
-
timeOnly: true
|
1131 |
-
});
|
1132 |
-
}
|
1133 |
-
|
1134 |
-
return $(this).each(function () {
|
1135 |
-
$.fn.datetimepicker.apply($(this), tmp_args);
|
1136 |
-
});
|
1137 |
-
},
|
1138 |
-
|
1139 |
-
/*
|
1140 |
-
* extend timepicker to datepicker
|
1141 |
-
*/
|
1142 |
-
datetimepicker: function (o) {
|
1143 |
-
o = o || {};
|
1144 |
-
var tmp_args = arguments;
|
1145 |
-
|
1146 |
-
if (typeof(o) === 'string') {
|
1147 |
-
if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
|
1148 |
-
return $.fn.datepicker.apply($(this[0]), tmp_args);
|
1149 |
-
} else {
|
1150 |
-
return this.each(function () {
|
1151 |
-
var $t = $(this);
|
1152 |
-
$t.datepicker.apply($t, tmp_args);
|
1153 |
-
});
|
1154 |
-
}
|
1155 |
-
} else {
|
1156 |
-
return this.each(function () {
|
1157 |
-
var $t = $(this);
|
1158 |
-
$t.datepicker($.timepicker._newInst($t, o)._defaults);
|
1159 |
-
});
|
1160 |
-
}
|
1161 |
-
}
|
1162 |
-
});
|
1163 |
-
|
1164 |
-
/*
|
1165 |
-
* Public Utility to parse date and time
|
1166 |
-
*/
|
1167 |
-
$.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
|
1168 |
-
var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
|
1169 |
-
if (parseRes.timeObj) {
|
1170 |
-
var t = parseRes.timeObj;
|
1171 |
-
parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
|
1172 |
-
parseRes.date.setMicroseconds(t.microsec);
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
return parseRes.date;
|
1176 |
-
};
|
1177 |
-
|
1178 |
-
/*
|
1179 |
-
* Public utility to parse time
|
1180 |
-
*/
|
1181 |
-
$.datepicker.parseTime = function (timeFormat, timeString, options) {
|
1182 |
-
var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
|
1183 |
-
iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
|
1184 |
-
|
1185 |
-
// Strict parse requires the timeString to match the timeFormat exactly
|
1186 |
-
var strictParse = function (f, s, o) {
|
1187 |
-
|
1188 |
-
// pattern for standard and localized AM/PM markers
|
1189 |
-
var getPatternAmpm = function (amNames, pmNames) {
|
1190 |
-
var markers = [];
|
1191 |
-
if (amNames) {
|
1192 |
-
$.merge(markers, amNames);
|
1193 |
-
}
|
1194 |
-
if (pmNames) {
|
1195 |
-
$.merge(markers, pmNames);
|
1196 |
-
}
|
1197 |
-
markers = $.map(markers, function (val) {
|
1198 |
-
return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
|
1199 |
-
});
|
1200 |
-
return '(' + markers.join('|') + ')?';
|
1201 |
-
};
|
1202 |
-
|
1203 |
-
// figure out position of time elements.. cause js cant do named captures
|
1204 |
-
var getFormatPositions = function (timeFormat) {
|
1205 |
-
var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
|
1206 |
-
orders = {
|
1207 |
-
h: -1,
|
1208 |
-
m: -1,
|
1209 |
-
s: -1,
|
1210 |
-
l: -1,
|
1211 |
-
c: -1,
|
1212 |
-
t: -1,
|
1213 |
-
z: -1
|
1214 |
-
};
|
1215 |
-
|
1216 |
-
if (finds) {
|
1217 |
-
for (var i = 0; i < finds.length; i++) {
|
1218 |
-
if (orders[finds[i].toString().charAt(0)] === -1) {
|
1219 |
-
orders[finds[i].toString().charAt(0)] = i + 1;
|
1220 |
-
}
|
1221 |
-
}
|
1222 |
-
}
|
1223 |
-
return orders;
|
1224 |
-
};
|
1225 |
-
|
1226 |
-
var regstr = '^' + f.toString()
|
1227 |
-
.replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
|
1228 |
-
var ml = match.length;
|
1229 |
-
switch (match.charAt(0).toLowerCase()) {
|
1230 |
-
case 'h':
|
1231 |
-
return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
|
1232 |
-
case 'm':
|
1233 |
-
return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
|
1234 |
-
case 's':
|
1235 |
-
return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
|
1236 |
-
case 'l':
|
1237 |
-
return '(\\d?\\d?\\d)';
|
1238 |
-
case 'c':
|
1239 |
-
return '(\\d?\\d?\\d)';
|
1240 |
-
case 'z':
|
1241 |
-
return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
|
1242 |
-
case 't':
|
1243 |
-
return getPatternAmpm(o.amNames, o.pmNames);
|
1244 |
-
default: // literal escaped in quotes
|
1245 |
-
return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
|
1246 |
-
}
|
1247 |
-
})
|
1248 |
-
.replace(/\s/g, '\\s?') +
|
1249 |
-
o.timeSuffix + '$',
|
1250 |
-
order = getFormatPositions(f),
|
1251 |
-
ampm = '',
|
1252 |
-
treg;
|
1253 |
-
|
1254 |
-
treg = s.match(new RegExp(regstr, 'i'));
|
1255 |
-
|
1256 |
-
var resTime = {
|
1257 |
-
hour: 0,
|
1258 |
-
minute: 0,
|
1259 |
-
second: 0,
|
1260 |
-
millisec: 0,
|
1261 |
-
microsec: 0
|
1262 |
-
};
|
1263 |
-
|
1264 |
-
if (treg) {
|
1265 |
-
if (order.t !== -1) {
|
1266 |
-
if (treg[order.t] === undefined || treg[order.t].length === 0) {
|
1267 |
-
ampm = '';
|
1268 |
-
resTime.ampm = '';
|
1269 |
-
} else {
|
1270 |
-
ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
|
1271 |
-
resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
|
1272 |
-
}
|
1273 |
-
}
|
1274 |
-
|
1275 |
-
if (order.h !== -1) {
|
1276 |
-
if (ampm === 'AM' && treg[order.h] === '12') {
|
1277 |
-
resTime.hour = 0; // 12am = 0 hour
|
1278 |
-
} else {
|
1279 |
-
if (ampm === 'PM' && treg[order.h] !== '12') {
|
1280 |
-
resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
|
1281 |
-
} else {
|
1282 |
-
resTime.hour = Number(treg[order.h]);
|
1283 |
-
}
|
1284 |
-
}
|
1285 |
-
}
|
1286 |
-
|
1287 |
-
if (order.m !== -1) {
|
1288 |
-
resTime.minute = Number(treg[order.m]);
|
1289 |
-
}
|
1290 |
-
if (order.s !== -1) {
|
1291 |
-
resTime.second = Number(treg[order.s]);
|
1292 |
-
}
|
1293 |
-
if (order.l !== -1) {
|
1294 |
-
resTime.millisec = Number(treg[order.l]);
|
1295 |
-
}
|
1296 |
-
if (order.c !== -1) {
|
1297 |
-
resTime.microsec = Number(treg[order.c]);
|
1298 |
-
}
|
1299 |
-
if (order.z !== -1 && treg[order.z] !== undefined) {
|
1300 |
-
resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
|
1301 |
-
}
|
1302 |
-
|
1303 |
-
|
1304 |
-
return resTime;
|
1305 |
-
}
|
1306 |
-
return false;
|
1307 |
-
};// end strictParse
|
1308 |
-
|
1309 |
-
// First try JS Date, if that fails, use strictParse
|
1310 |
-
var looseParse = function (f, s, o) {
|
1311 |
-
try {
|
1312 |
-
var d = new Date('2012-01-01 ' + s);
|
1313 |
-
if (isNaN(d.getTime())) {
|
1314 |
-
d = new Date('2012-01-01T' + s);
|
1315 |
-
if (isNaN(d.getTime())) {
|
1316 |
-
d = new Date('01/01/2012 ' + s);
|
1317 |
-
if (isNaN(d.getTime())) {
|
1318 |
-
throw "Unable to parse time with native Date: " + s;
|
1319 |
-
}
|
1320 |
-
}
|
1321 |
-
}
|
1322 |
-
|
1323 |
-
return {
|
1324 |
-
hour: d.getHours(),
|
1325 |
-
minute: d.getMinutes(),
|
1326 |
-
second: d.getSeconds(),
|
1327 |
-
millisec: d.getMilliseconds(),
|
1328 |
-
microsec: d.getMicroseconds(),
|
1329 |
-
timezone: d.getTimezoneOffset() * -1
|
1330 |
-
};
|
1331 |
-
}
|
1332 |
-
catch (err) {
|
1333 |
-
try {
|
1334 |
-
return strictParse(f, s, o);
|
1335 |
-
}
|
1336 |
-
catch (err2) {
|
1337 |
-
$.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
|
1338 |
-
}
|
1339 |
-
}
|
1340 |
-
return false;
|
1341 |
-
}; // end looseParse
|
1342 |
-
|
1343 |
-
if (typeof o.parse === "function") {
|
1344 |
-
return o.parse(timeFormat, timeString, o);
|
1345 |
-
}
|
1346 |
-
if (o.parse === 'loose') {
|
1347 |
-
return looseParse(timeFormat, timeString, o);
|
1348 |
-
}
|
1349 |
-
return strictParse(timeFormat, timeString, o);
|
1350 |
-
};
|
1351 |
-
|
1352 |
-
/**
|
1353 |
-
* Public utility to format the time
|
1354 |
-
* @param {string} format format of the time
|
1355 |
-
* @param {Object} time Object not a Date for timezones
|
1356 |
-
* @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
|
1357 |
-
* @returns {string} the formatted time
|
1358 |
-
*/
|
1359 |
-
$.datepicker.formatTime = function (format, time, options) {
|
1360 |
-
options = options || {};
|
1361 |
-
options = $.extend({}, $.timepicker._defaults, options);
|
1362 |
-
time = $.extend({
|
1363 |
-
hour: 0,
|
1364 |
-
minute: 0,
|
1365 |
-
second: 0,
|
1366 |
-
millisec: 0,
|
1367 |
-
microsec: 0,
|
1368 |
-
timezone: null
|
1369 |
-
}, time);
|
1370 |
-
|
1371 |
-
var tmptime = format,
|
1372 |
-
ampmName = options.amNames[0],
|
1373 |
-
hour = parseInt(time.hour, 10);
|
1374 |
-
|
1375 |
-
if (hour > 11) {
|
1376 |
-
ampmName = options.pmNames[0];
|
1377 |
-
}
|
1378 |
-
|
1379 |
-
tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
|
1380 |
-
switch (match) {
|
1381 |
-
case 'HH':
|
1382 |
-
return ('0' + hour).slice(-2);
|
1383 |
-
case 'H':
|
1384 |
-
return hour;
|
1385 |
-
case 'hh':
|
1386 |
-
return ('0' + convert24to12(hour)).slice(-2);
|
1387 |
-
case 'h':
|
1388 |
-
return convert24to12(hour);
|
1389 |
-
case 'mm':
|
1390 |
-
return ('0' + time.minute).slice(-2);
|
1391 |
-
case 'm':
|
1392 |
-
return time.minute;
|
1393 |
-
case 'ss':
|
1394 |
-
return ('0' + time.second).slice(-2);
|
1395 |
-
case 's':
|
1396 |
-
return time.second;
|
1397 |
-
case 'l':
|
1398 |
-
return ('00' + time.millisec).slice(-3);
|
1399 |
-
case 'c':
|
1400 |
-
return ('00' + time.microsec).slice(-3);
|
1401 |
-
case 'z':
|
1402 |
-
return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
|
1403 |
-
case 'Z':
|
1404 |
-
return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
|
1405 |
-
case 'T':
|
1406 |
-
return ampmName.charAt(0).toUpperCase();
|
1407 |
-
case 'TT':
|
1408 |
-
return ampmName.toUpperCase();
|
1409 |
-
case 't':
|
1410 |
-
return ampmName.charAt(0).toLowerCase();
|
1411 |
-
case 'tt':
|
1412 |
-
return ampmName.toLowerCase();
|
1413 |
-
default:
|
1414 |
-
return match.replace(/'/g, "");
|
1415 |
-
}
|
1416 |
-
});
|
1417 |
-
|
1418 |
-
return tmptime;
|
1419 |
-
};
|
1420 |
-
|
1421 |
-
/*
|
1422 |
-
* the bad hack :/ override datepicker so it doesn't close on select
|
1423 |
-
// inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
|
1424 |
-
*/
|
1425 |
-
$.datepicker._base_selectDate = $.datepicker._selectDate;
|
1426 |
-
$.datepicker._selectDate = function (id, dateStr) {
|
1427 |
-
var inst = this._getInst($(id)[0]),
|
1428 |
-
tp_inst = this._get(inst, 'timepicker'),
|
1429 |
-
was_inline;
|
1430 |
-
|
1431 |
-
if (tp_inst && inst.settings.showTimepicker) {
|
1432 |
-
tp_inst._limitMinMaxDateTime(inst, true);
|
1433 |
-
was_inline = inst.inline;
|
1434 |
-
inst.inline = inst.stay_open = true;
|
1435 |
-
//This way the onSelect handler called from calendarpicker get the full dateTime
|
1436 |
-
this._base_selectDate(id, dateStr);
|
1437 |
-
inst.inline = was_inline;
|
1438 |
-
inst.stay_open = false;
|
1439 |
-
this._notifyChange(inst);
|
1440 |
-
this._updateDatepicker(inst);
|
1441 |
-
} else {
|
1442 |
-
this._base_selectDate(id, dateStr);
|
1443 |
-
}
|
1444 |
-
};
|
1445 |
-
|
1446 |
-
/*
|
1447 |
-
* second bad hack :/ override datepicker so it triggers an event when changing the input field
|
1448 |
-
* and does not redraw the datepicker on every selectDate event
|
1449 |
-
*/
|
1450 |
-
$.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
|
1451 |
-
$.datepicker._updateDatepicker = function (inst) {
|
1452 |
-
|
1453 |
-
// don't popup the datepicker if there is another instance already opened
|
1454 |
-
var input = inst.input[0];
|
1455 |
-
if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
|
1456 |
-
return;
|
1457 |
-
}
|
1458 |
-
|
1459 |
-
if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
|
1460 |
-
|
1461 |
-
this._base_updateDatepicker(inst);
|
1462 |
-
|
1463 |
-
// Reload the time control when changing something in the input text field.
|
1464 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1465 |
-
if (tp_inst) {
|
1466 |
-
tp_inst._addTimePicker(inst);
|
1467 |
-
}
|
1468 |
-
}
|
1469 |
-
};
|
1470 |
-
|
1471 |
-
/*
|
1472 |
-
* third bad hack :/ override datepicker so it allows spaces and colon in the input field
|
1473 |
-
*/
|
1474 |
-
$.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
|
1475 |
-
$.datepicker._doKeyPress = function (event) {
|
1476 |
-
var inst = $.datepicker._getInst(event.target),
|
1477 |
-
tp_inst = $.datepicker._get(inst, 'timepicker');
|
1478 |
-
|
1479 |
-
if (tp_inst) {
|
1480 |
-
if ($.datepicker._get(inst, 'constrainInput')) {
|
1481 |
-
var ampm = tp_inst.support.ampm,
|
1482 |
-
tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
|
1483 |
-
dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
|
1484 |
-
datetimeChars = tp_inst._defaults.timeFormat.toString()
|
1485 |
-
.replace(/[hms]/g, '')
|
1486 |
-
.replace(/TT/g, ampm ? 'APM' : '')
|
1487 |
-
.replace(/Tt/g, ampm ? 'AaPpMm' : '')
|
1488 |
-
.replace(/tT/g, ampm ? 'AaPpMm' : '')
|
1489 |
-
.replace(/T/g, ampm ? 'AP' : '')
|
1490 |
-
.replace(/tt/g, ampm ? 'apm' : '')
|
1491 |
-
.replace(/t/g, ampm ? 'ap' : '') +
|
1492 |
-
" " + tp_inst._defaults.separator +
|
1493 |
-
tp_inst._defaults.timeSuffix +
|
1494 |
-
(tz ? tp_inst._defaults.timezoneList.join('') : '') +
|
1495 |
-
(tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
|
1496 |
-
dateChars,
|
1497 |
-
chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
|
1498 |
-
return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
|
1499 |
-
}
|
1500 |
-
}
|
1501 |
-
|
1502 |
-
return $.datepicker._base_doKeyPress(event);
|
1503 |
-
};
|
1504 |
-
|
1505 |
-
/*
|
1506 |
-
* Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
|
1507 |
-
* Update any alternate field to synchronise with the main field.
|
1508 |
-
*/
|
1509 |
-
$.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
|
1510 |
-
$.datepicker._updateAlternate = function (inst) {
|
1511 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1512 |
-
if (tp_inst) {
|
1513 |
-
var altField = tp_inst._defaults.altField;
|
1514 |
-
if (altField) { // update alternate field too
|
1515 |
-
var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
|
1516 |
-
date = this._getDate(inst),
|
1517 |
-
formatCfg = $.datepicker._getFormatConfig(inst),
|
1518 |
-
altFormattedDateTime = '',
|
1519 |
-
altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
|
1520 |
-
altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
|
1521 |
-
altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
|
1522 |
-
|
1523 |
-
altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
|
1524 |
-
if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
|
1525 |
-
if (tp_inst._defaults.altFormat) {
|
1526 |
-
altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
|
1527 |
-
}
|
1528 |
-
else {
|
1529 |
-
altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
|
1530 |
-
}
|
1531 |
-
}
|
1532 |
-
$(altField).val( inst.input.val() ? altFormattedDateTime : "");
|
1533 |
-
}
|
1534 |
-
}
|
1535 |
-
else {
|
1536 |
-
$.datepicker._base_updateAlternate(inst);
|
1537 |
-
}
|
1538 |
-
};
|
1539 |
-
|
1540 |
-
/*
|
1541 |
-
* Override key up event to sync manual input changes.
|
1542 |
-
*/
|
1543 |
-
$.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
|
1544 |
-
$.datepicker._doKeyUp = function (event) {
|
1545 |
-
var inst = $.datepicker._getInst(event.target),
|
1546 |
-
tp_inst = $.datepicker._get(inst, 'timepicker');
|
1547 |
-
|
1548 |
-
if (tp_inst) {
|
1549 |
-
if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
|
1550 |
-
try {
|
1551 |
-
$.datepicker._updateDatepicker(inst);
|
1552 |
-
} catch (err) {
|
1553 |
-
$.timepicker.log(err);
|
1554 |
-
}
|
1555 |
-
}
|
1556 |
-
}
|
1557 |
-
|
1558 |
-
return $.datepicker._base_doKeyUp(event);
|
1559 |
-
};
|
1560 |
-
|
1561 |
-
/*
|
1562 |
-
* override "Today" button to also grab the time and set it to input field.
|
1563 |
-
*/
|
1564 |
-
$.datepicker._base_gotoToday = $.datepicker._gotoToday;
|
1565 |
-
$.datepicker._gotoToday = function (id) {
|
1566 |
-
var inst = this._getInst($(id)[0]);
|
1567 |
-
this._base_gotoToday(id);
|
1568 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1569 |
-
var tzoffset = $.timepicker.timezoneOffsetNumber(tp_inst.timezone);
|
1570 |
-
var now = new Date();
|
1571 |
-
now.setMinutes(now.getMinutes() + now.getTimezoneOffset() + tzoffset);
|
1572 |
-
this._setTime(inst, now);
|
1573 |
-
this._setDate(inst, now);
|
1574 |
-
tp_inst._onSelectHandler();
|
1575 |
-
};
|
1576 |
-
|
1577 |
-
/*
|
1578 |
-
* Disable & enable the Time in the datetimepicker
|
1579 |
-
*/
|
1580 |
-
$.datepicker._disableTimepickerDatepicker = function (target) {
|
1581 |
-
var inst = this._getInst(target);
|
1582 |
-
if (!inst) {
|
1583 |
-
return;
|
1584 |
-
}
|
1585 |
-
|
1586 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1587 |
-
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
|
1588 |
-
if (tp_inst) {
|
1589 |
-
inst.settings.showTimepicker = false;
|
1590 |
-
tp_inst._defaults.showTimepicker = false;
|
1591 |
-
tp_inst._updateDateTime(inst);
|
1592 |
-
}
|
1593 |
-
};
|
1594 |
-
|
1595 |
-
$.datepicker._enableTimepickerDatepicker = function (target) {
|
1596 |
-
var inst = this._getInst(target);
|
1597 |
-
if (!inst) {
|
1598 |
-
return;
|
1599 |
-
}
|
1600 |
-
|
1601 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1602 |
-
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
|
1603 |
-
if (tp_inst) {
|
1604 |
-
inst.settings.showTimepicker = true;
|
1605 |
-
tp_inst._defaults.showTimepicker = true;
|
1606 |
-
tp_inst._addTimePicker(inst); // Could be disabled on page load
|
1607 |
-
tp_inst._updateDateTime(inst);
|
1608 |
-
}
|
1609 |
-
};
|
1610 |
-
|
1611 |
-
/*
|
1612 |
-
* Create our own set time function
|
1613 |
-
*/
|
1614 |
-
$.datepicker._setTime = function (inst, date) {
|
1615 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1616 |
-
if (tp_inst) {
|
1617 |
-
var defaults = tp_inst._defaults;
|
1618 |
-
|
1619 |
-
// calling _setTime with no date sets time to defaults
|
1620 |
-
tp_inst.hour = date ? date.getHours() : defaults.hour;
|
1621 |
-
tp_inst.minute = date ? date.getMinutes() : defaults.minute;
|
1622 |
-
tp_inst.second = date ? date.getSeconds() : defaults.second;
|
1623 |
-
tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
|
1624 |
-
tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
|
1625 |
-
|
1626 |
-
//check if within min/max times..
|
1627 |
-
tp_inst._limitMinMaxDateTime(inst, true);
|
1628 |
-
|
1629 |
-
tp_inst._onTimeChange();
|
1630 |
-
tp_inst._updateDateTime(inst);
|
1631 |
-
}
|
1632 |
-
};
|
1633 |
-
|
1634 |
-
/*
|
1635 |
-
* Create new public method to set only time, callable as $().datepicker('setTime', date)
|
1636 |
-
*/
|
1637 |
-
$.datepicker._setTimeDatepicker = function (target, date, withDate) {
|
1638 |
-
var inst = this._getInst(target);
|
1639 |
-
if (!inst) {
|
1640 |
-
return;
|
1641 |
-
}
|
1642 |
-
|
1643 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1644 |
-
|
1645 |
-
if (tp_inst) {
|
1646 |
-
this._setDateFromField(inst);
|
1647 |
-
var tp_date;
|
1648 |
-
if (date) {
|
1649 |
-
if (typeof date === "string") {
|
1650 |
-
tp_inst._parseTime(date, withDate);
|
1651 |
-
tp_date = new Date();
|
1652 |
-
tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
|
1653 |
-
tp_date.setMicroseconds(tp_inst.microsec);
|
1654 |
-
} else {
|
1655 |
-
tp_date = new Date(date.getTime());
|
1656 |
-
tp_date.setMicroseconds(date.getMicroseconds());
|
1657 |
-
}
|
1658 |
-
if (tp_date.toString() === 'Invalid Date') {
|
1659 |
-
tp_date = undefined;
|
1660 |
-
}
|
1661 |
-
this._setTime(inst, tp_date);
|
1662 |
-
}
|
1663 |
-
}
|
1664 |
-
|
1665 |
-
};
|
1666 |
-
|
1667 |
-
/*
|
1668 |
-
* override setDate() to allow setting time too within Date object
|
1669 |
-
*/
|
1670 |
-
$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
|
1671 |
-
$.datepicker._setDateDatepicker = function (target, _date) {
|
1672 |
-
var inst = this._getInst(target);
|
1673 |
-
var date = _date;
|
1674 |
-
if (!inst) {
|
1675 |
-
return;
|
1676 |
-
}
|
1677 |
-
|
1678 |
-
if (typeof(_date) === 'string') {
|
1679 |
-
date = new Date(_date);
|
1680 |
-
if (!date.getTime()) {
|
1681 |
-
this._base_setDateDatepicker.apply(this, arguments);
|
1682 |
-
date = $(target).datepicker('getDate');
|
1683 |
-
}
|
1684 |
-
}
|
1685 |
-
|
1686 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1687 |
-
var tp_date;
|
1688 |
-
if (date instanceof Date) {
|
1689 |
-
tp_date = new Date(date.getTime());
|
1690 |
-
tp_date.setMicroseconds(date.getMicroseconds());
|
1691 |
-
} else {
|
1692 |
-
tp_date = date;
|
1693 |
-
}
|
1694 |
-
|
1695 |
-
// This is important if you are using the timezone option, javascript's Date
|
1696 |
-
// object will only return the timezone offset for the current locale, so we
|
1697 |
-
// adjust it accordingly. If not using timezone option this won't matter..
|
1698 |
-
// If a timezone is different in tp, keep the timezone as is
|
1699 |
-
if (tp_inst && tp_date) {
|
1700 |
-
// look out for DST if tz wasn't specified
|
1701 |
-
if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
|
1702 |
-
tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
|
1703 |
-
}
|
1704 |
-
date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
|
1705 |
-
tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
|
1706 |
-
}
|
1707 |
-
|
1708 |
-
this._updateDatepicker(inst);
|
1709 |
-
this._base_setDateDatepicker.apply(this, arguments);
|
1710 |
-
this._setTimeDatepicker(target, tp_date, true);
|
1711 |
-
};
|
1712 |
-
|
1713 |
-
/*
|
1714 |
-
* override getDate() to allow getting time too within Date object
|
1715 |
-
*/
|
1716 |
-
$.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
|
1717 |
-
$.datepicker._getDateDatepicker = function (target, noDefault) {
|
1718 |
-
var inst = this._getInst(target);
|
1719 |
-
if (!inst) {
|
1720 |
-
return;
|
1721 |
-
}
|
1722 |
-
|
1723 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1724 |
-
|
1725 |
-
if (tp_inst) {
|
1726 |
-
// if it hasn't yet been defined, grab from field
|
1727 |
-
if (inst.lastVal === undefined) {
|
1728 |
-
this._setDateFromField(inst, noDefault);
|
1729 |
-
}
|
1730 |
-
|
1731 |
-
var date = this._getDate(inst);
|
1732 |
-
var currDT = $.trim((tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) ? tp_inst.$input.val() + ' ' + tp_inst.$altInput.val() : tp_inst.$input.val());
|
1733 |
-
if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
|
1734 |
-
date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
|
1735 |
-
date.setMicroseconds(tp_inst.microsec);
|
1736 |
-
|
1737 |
-
// This is important if you are using the timezone option, javascript's Date
|
1738 |
-
// object will only return the timezone offset for the current locale, so we
|
1739 |
-
// adjust it accordingly. If not using timezone option this won't matter..
|
1740 |
-
if (tp_inst.timezone != null) {
|
1741 |
-
// look out for DST if tz wasn't specified
|
1742 |
-
if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
|
1743 |
-
tp_inst.timezone = date.getTimezoneOffset() * -1;
|
1744 |
-
}
|
1745 |
-
date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
|
1746 |
-
}
|
1747 |
-
}
|
1748 |
-
return date;
|
1749 |
-
}
|
1750 |
-
return this._base_getDateDatepicker(target, noDefault);
|
1751 |
-
};
|
1752 |
-
|
1753 |
-
/*
|
1754 |
-
* override parseDate() because UI 1.8.14 throws an error about "Extra characters"
|
1755 |
-
* An option in datapicker to ignore extra format characters would be nicer.
|
1756 |
-
*/
|
1757 |
-
$.datepicker._base_parseDate = $.datepicker.parseDate;
|
1758 |
-
$.datepicker.parseDate = function (format, value, settings) {
|
1759 |
-
var date;
|
1760 |
-
try {
|
1761 |
-
date = this._base_parseDate(format, value, settings);
|
1762 |
-
} catch (err) {
|
1763 |
-
// Hack! The error message ends with a colon, a space, and
|
1764 |
-
// the "extra" characters. We rely on that instead of
|
1765 |
-
// attempting to perfectly reproduce the parsing algorithm.
|
1766 |
-
if (err.indexOf(":") >= 0) {
|
1767 |
-
date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
|
1768 |
-
$.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
|
1769 |
-
} else {
|
1770 |
-
throw err;
|
1771 |
-
}
|
1772 |
-
}
|
1773 |
-
return date;
|
1774 |
-
};
|
1775 |
-
|
1776 |
-
/*
|
1777 |
-
* override formatDate to set date with time to the input
|
1778 |
-
*/
|
1779 |
-
$.datepicker._base_formatDate = $.datepicker._formatDate;
|
1780 |
-
$.datepicker._formatDate = function (inst, day, month, year) {
|
1781 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1782 |
-
if (tp_inst) {
|
1783 |
-
tp_inst._updateDateTime(inst);
|
1784 |
-
return tp_inst.$input.val();
|
1785 |
-
}
|
1786 |
-
return this._base_formatDate(inst);
|
1787 |
-
};
|
1788 |
-
|
1789 |
-
/*
|
1790 |
-
* override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
|
1791 |
-
*/
|
1792 |
-
$.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
|
1793 |
-
$.datepicker._optionDatepicker = function (target, name, value) {
|
1794 |
-
var inst = this._getInst(target),
|
1795 |
-
name_clone;
|
1796 |
-
if (!inst) {
|
1797 |
-
return null;
|
1798 |
-
}
|
1799 |
-
|
1800 |
-
var tp_inst = this._get(inst, 'timepicker');
|
1801 |
-
if (tp_inst) {
|
1802 |
-
var min = null,
|
1803 |
-
max = null,
|
1804 |
-
onselect = null,
|
1805 |
-
overrides = tp_inst._defaults.evnts,
|
1806 |
-
fns = {},
|
1807 |
-
prop,
|
1808 |
-
ret,
|
1809 |
-
oldVal,
|
1810 |
-
$target;
|
1811 |
-
if (typeof name === 'string') { // if min/max was set with the string
|
1812 |
-
if (name === 'minDate' || name === 'minDateTime') {
|
1813 |
-
min = value;
|
1814 |
-
} else if (name === 'maxDate' || name === 'maxDateTime') {
|
1815 |
-
max = value;
|
1816 |
-
} else if (name === 'onSelect') {
|
1817 |
-
onselect = value;
|
1818 |
-
} else if (overrides.hasOwnProperty(name)) {
|
1819 |
-
if (typeof (value) === 'undefined') {
|
1820 |
-
return overrides[name];
|
1821 |
-
}
|
1822 |
-
fns[name] = value;
|
1823 |
-
name_clone = {}; //empty results in exiting function after overrides updated
|
1824 |
-
}
|
1825 |
-
} else if (typeof name === 'object') { //if min/max was set with the JSON
|
1826 |
-
if (name.minDate) {
|
1827 |
-
min = name.minDate;
|
1828 |
-
} else if (name.minDateTime) {
|
1829 |
-
min = name.minDateTime;
|
1830 |
-
} else if (name.maxDate) {
|
1831 |
-
max = name.maxDate;
|
1832 |
-
} else if (name.maxDateTime) {
|
1833 |
-
max = name.maxDateTime;
|
1834 |
-
}
|
1835 |
-
for (prop in overrides) {
|
1836 |
-
if (overrides.hasOwnProperty(prop) && name[prop]) {
|
1837 |
-
fns[prop] = name[prop];
|
1838 |
-
}
|
1839 |
-
}
|
1840 |
-
}
|
1841 |
-
for (prop in fns) {
|
1842 |
-
if (fns.hasOwnProperty(prop)) {
|
1843 |
-
overrides[prop] = fns[prop];
|
1844 |
-
if (!name_clone) { name_clone = $.extend({}, name); }
|
1845 |
-
delete name_clone[prop];
|
1846 |
-
}
|
1847 |
-
}
|
1848 |
-
if (name_clone && isEmptyObject(name_clone)) { return; }
|
1849 |
-
if (min) { //if min was set
|
1850 |
-
if (min === 0) {
|
1851 |
-
min = new Date();
|
1852 |
-
} else {
|
1853 |
-
min = new Date(min);
|
1854 |
-
}
|
1855 |
-
tp_inst._defaults.minDate = min;
|
1856 |
-
tp_inst._defaults.minDateTime = min;
|
1857 |
-
} else if (max) { //if max was set
|
1858 |
-
if (max === 0) {
|
1859 |
-
max = new Date();
|
1860 |
-
} else {
|
1861 |
-
max = new Date(max);
|
1862 |
-
}
|
1863 |
-
tp_inst._defaults.maxDate = max;
|
1864 |
-
tp_inst._defaults.maxDateTime = max;
|
1865 |
-
} else if (onselect) {
|
1866 |
-
tp_inst._defaults.onSelect = onselect;
|
1867 |
-
}
|
1868 |
-
|
1869 |
-
// Datepicker will override our date when we call _base_optionDatepicker when
|
1870 |
-
// calling minDate/maxDate, so we will first grab the value, call
|
1871 |
-
// _base_optionDatepicker, then set our value back.
|
1872 |
-
if(min || max){
|
1873 |
-
$target = $(target);
|
1874 |
-
oldVal = $target.datetimepicker('getDate');
|
1875 |
-
ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
|
1876 |
-
$target.datetimepicker('setDate', oldVal);
|
1877 |
-
return ret;
|
1878 |
-
}
|
1879 |
-
}
|
1880 |
-
if (value === undefined) {
|
1881 |
-
return this._base_optionDatepicker.call($.datepicker, target, name);
|
1882 |
-
}
|
1883 |
-
return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
|
1884 |
-
};
|
1885 |
-
|
1886 |
-
/*
|
1887 |
-
* jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
|
1888 |
-
* it will return false for all objects
|
1889 |
-
*/
|
1890 |
-
var isEmptyObject = function (obj) {
|
1891 |
-
var prop;
|
1892 |
-
for (prop in obj) {
|
1893 |
-
if (obj.hasOwnProperty(prop)) {
|
1894 |
-
return false;
|
1895 |
-
}
|
1896 |
-
}
|
1897 |
-
return true;
|
1898 |
-
};
|
1899 |
-
|
1900 |
-
/*
|
1901 |
-
* jQuery extend now ignores nulls!
|
1902 |
-
*/
|
1903 |
-
var extendRemove = function (target, props) {
|
1904 |
-
$.extend(target, props);
|
1905 |
-
for (var name in props) {
|
1906 |
-
if (props[name] === null || props[name] === undefined) {
|
1907 |
-
target[name] = props[name];
|
1908 |
-
}
|
1909 |
-
}
|
1910 |
-
return target;
|
1911 |
-
};
|
1912 |
-
|
1913 |
-
/*
|
1914 |
-
* Determine by the time format which units are supported
|
1915 |
-
* Returns an object of booleans for each unit
|
1916 |
-
*/
|
1917 |
-
var detectSupport = function (timeFormat) {
|
1918 |
-
var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
|
1919 |
-
isIn = function (f, t) { // does the format contain the token?
|
1920 |
-
return f.indexOf(t) !== -1 ? true : false;
|
1921 |
-
};
|
1922 |
-
return {
|
1923 |
-
hour: isIn(tf, 'h'),
|
1924 |
-
minute: isIn(tf, 'm'),
|
1925 |
-
second: isIn(tf, 's'),
|
1926 |
-
millisec: isIn(tf, 'l'),
|
1927 |
-
microsec: isIn(tf, 'c'),
|
1928 |
-
timezone: isIn(tf, 'z'),
|
1929 |
-
ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
|
1930 |
-
iso8601: isIn(timeFormat, 'Z')
|
1931 |
-
};
|
1932 |
-
};
|
1933 |
-
|
1934 |
-
/*
|
1935 |
-
* Converts 24 hour format into 12 hour
|
1936 |
-
* Returns 12 hour without leading 0
|
1937 |
-
*/
|
1938 |
-
var convert24to12 = function (hour) {
|
1939 |
-
hour %= 12;
|
1940 |
-
|
1941 |
-
if (hour === 0) {
|
1942 |
-
hour = 12;
|
1943 |
-
}
|
1944 |
-
|
1945 |
-
return String(hour);
|
1946 |
-
};
|
1947 |
-
|
1948 |
-
var computeEffectiveSetting = function (settings, property) {
|
1949 |
-
return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
|
1950 |
-
};
|
1951 |
-
|
1952 |
-
/*
|
1953 |
-
* Splits datetime string into date and time substrings.
|
1954 |
-
* Throws exception when date can't be parsed
|
1955 |
-
* Returns {dateString: dateString, timeString: timeString}
|
1956 |
-
*/
|
1957 |
-
var splitDateTime = function (dateTimeString, timeSettings) {
|
1958 |
-
// The idea is to get the number separator occurrences in datetime and the time format requested (since time has
|
1959 |
-
// fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
|
1960 |
-
var separator = computeEffectiveSetting(timeSettings, 'separator'),
|
1961 |
-
format = computeEffectiveSetting(timeSettings, 'timeFormat'),
|
1962 |
-
timeParts = format.split(separator), // how many occurrences of separator may be in our format?
|
1963 |
-
timePartsLen = timeParts.length,
|
1964 |
-
allParts = dateTimeString.split(separator),
|
1965 |
-
allPartsLen = allParts.length;
|
1966 |
-
|
1967 |
-
if (allPartsLen > 1) {
|
1968 |
-
return {
|
1969 |
-
dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
|
1970 |
-
timeString: allParts.splice(0, timePartsLen).join(separator)
|
1971 |
-
};
|
1972 |
-
}
|
1973 |
-
|
1974 |
-
return {
|
1975 |
-
dateString: dateTimeString,
|
1976 |
-
timeString: ''
|
1977 |
-
};
|
1978 |
-
};
|
1979 |
-
|
1980 |
-
/*
|
1981 |
-
* Internal function to parse datetime interval
|
1982 |
-
* Returns: {date: Date, timeObj: Object}, where
|
1983 |
-
* date - parsed date without time (type Date)
|
1984 |
-
* timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
|
1985 |
-
*/
|
1986 |
-
var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
|
1987 |
-
var date,
|
1988 |
-
parts,
|
1989 |
-
parsedTime;
|
1990 |
-
|
1991 |
-
parts = splitDateTime(dateTimeString, timeSettings);
|
1992 |
-
date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
|
1993 |
-
|
1994 |
-
if (parts.timeString === '') {
|
1995 |
-
return {
|
1996 |
-
date: date
|
1997 |
-
};
|
1998 |
-
}
|
1999 |
-
|
2000 |
-
parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
|
2001 |
-
|
2002 |
-
if (!parsedTime) {
|
2003 |
-
throw 'Wrong time format';
|
2004 |
-
}
|
2005 |
-
|
2006 |
-
return {
|
2007 |
-
date: date,
|
2008 |
-
timeObj: parsedTime
|
2009 |
-
};
|
2010 |
-
};
|
2011 |
-
|
2012 |
-
/*
|
2013 |
-
* Internal function to set timezone_select to the local timezone
|
2014 |
-
*/
|
2015 |
-
var selectLocalTimezone = function (tp_inst, date) {
|
2016 |
-
if (tp_inst && tp_inst.timezone_select) {
|
2017 |
-
var now = date || new Date();
|
2018 |
-
tp_inst.timezone_select.val(-now.getTimezoneOffset());
|
2019 |
-
}
|
2020 |
-
};
|
2021 |
-
|
2022 |
-
/*
|
2023 |
-
* Create a Singleton Instance
|
2024 |
-
*/
|
2025 |
-
$.timepicker = new Timepicker();
|
2026 |
-
|
2027 |
-
/**
|
2028 |
-
* Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
|
2029 |
-
* @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
|
2030 |
-
* @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
|
2031 |
-
* @return {string}
|
2032 |
-
*/
|
2033 |
-
$.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
|
2034 |
-
if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
|
2035 |
-
return tzMinutes;
|
2036 |
-
}
|
2037 |
-
|
2038 |
-
var off = tzMinutes,
|
2039 |
-
minutes = off % 60,
|
2040 |
-
hours = (off - minutes) / 60,
|
2041 |
-
iso = iso8601 ? ':' : '',
|
2042 |
-
tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
|
2043 |
-
|
2044 |
-
if (tz === '+00:00') {
|
2045 |
-
return 'Z';
|
2046 |
-
}
|
2047 |
-
return tz;
|
2048 |
-
};
|
2049 |
-
|
2050 |
-
/**
|
2051 |
-
* Get the number in minutes that represents a timezone string
|
2052 |
-
* @param {string} tzString formatted like "+0500", "-1245", "Z"
|
2053 |
-
* @return {number} the offset minutes or the original string if it doesn't match expectations
|
2054 |
-
*/
|
2055 |
-
$.timepicker.timezoneOffsetNumber = function (tzString) {
|
2056 |
-
var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
|
2057 |
-
|
2058 |
-
if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
|
2059 |
-
return 0;
|
2060 |
-
}
|
2061 |
-
|
2062 |
-
if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
|
2063 |
-
return tzString;
|
2064 |
-
}
|
2065 |
-
|
2066 |
-
return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
|
2067 |
-
((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
|
2068 |
-
parseInt(normalized.substr(3, 2), 10))); // minutes
|
2069 |
-
};
|
2070 |
-
|
2071 |
-
/**
|
2072 |
-
* No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
|
2073 |
-
* @param {Date} date
|
2074 |
-
* @param {string} toTimezone formatted like "+0500", "-1245"
|
2075 |
-
* @return {Date}
|
2076 |
-
*/
|
2077 |
-
$.timepicker.timezoneAdjust = function (date, toTimezone) {
|
2078 |
-
var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
|
2079 |
-
if (!isNaN(toTz)) {
|
2080 |
-
date.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz);
|
2081 |
-
}
|
2082 |
-
return date;
|
2083 |
-
};
|
2084 |
-
|
2085 |
-
/**
|
2086 |
-
* Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
|
2087 |
-
* enforce date range limits.
|
2088 |
-
* n.b. The input value must be correctly formatted (reformatting is not supported)
|
2089 |
-
* @param {Element} startTime
|
2090 |
-
* @param {Element} endTime
|
2091 |
-
* @param {Object} options Options for the timepicker() call
|
2092 |
-
* @return {jQuery}
|
2093 |
-
*/
|
2094 |
-
$.timepicker.timeRange = function (startTime, endTime, options) {
|
2095 |
-
return $.timepicker.handleRange('timepicker', startTime, endTime, options);
|
2096 |
-
};
|
2097 |
-
|
2098 |
-
/**
|
2099 |
-
* Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
|
2100 |
-
* enforce date range limits.
|
2101 |
-
* @param {Element} startTime
|
2102 |
-
* @param {Element} endTime
|
2103 |
-
* @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
|
2104 |
-
* a boolean value that can be used to reformat the input values to the `dateFormat`.
|
2105 |
-
* @param {string} method Can be used to specify the type of picker to be added
|
2106 |
-
* @return {jQuery}
|
2107 |
-
*/
|
2108 |
-
$.timepicker.datetimeRange = function (startTime, endTime, options) {
|
2109 |
-
$.timepicker.handleRange('datetimepicker', startTime, endTime, options);
|
2110 |
-
};
|
2111 |
-
|
2112 |
-
/**
|
2113 |
-
* Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
|
2114 |
-
* enforce date range limits.
|
2115 |
-
* @param {Element} startTime
|
2116 |
-
* @param {Element} endTime
|
2117 |
-
* @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
|
2118 |
-
* a boolean value that can be used to reformat the input values to the `dateFormat`.
|
2119 |
-
* @return {jQuery}
|
2120 |
-
*/
|
2121 |
-
$.timepicker.dateRange = function (startTime, endTime, options) {
|
2122 |
-
$.timepicker.handleRange('datepicker', startTime, endTime, options);
|
2123 |
-
};
|
2124 |
-
|
2125 |
-
/**
|
2126 |
-
* Calls `method` on the `startTime` and `endTime` elements, and configures them to
|
2127 |
-
* enforce date range limits.
|
2128 |
-
* @param {string} method Can be used to specify the type of picker to be added
|
2129 |
-
* @param {Element} startTime
|
2130 |
-
* @param {Element} endTime
|
2131 |
-
* @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
|
2132 |
-
* a boolean value that can be used to reformat the input values to the `dateFormat`.
|
2133 |
-
* @return {jQuery}
|
2134 |
-
*/
|
2135 |
-
$.timepicker.handleRange = function (method, startTime, endTime, options) {
|
2136 |
-
options = $.extend({}, {
|
2137 |
-
minInterval: 0, // min allowed interval in milliseconds
|
2138 |
-
maxInterval: 0, // max allowed interval in milliseconds
|
2139 |
-
start: {}, // options for start picker
|
2140 |
-
end: {} // options for end picker
|
2141 |
-
}, options);
|
2142 |
-
|
2143 |
-
// for the mean time this fixes an issue with calling getDate with timepicker()
|
2144 |
-
var timeOnly = false;
|
2145 |
-
if(method === 'timepicker'){
|
2146 |
-
timeOnly = true;
|
2147 |
-
method = 'datetimepicker';
|
2148 |
-
}
|
2149 |
-
|
2150 |
-
function checkDates(changed, other) {
|
2151 |
-
var startdt = startTime[method]('getDate'),
|
2152 |
-
enddt = endTime[method]('getDate'),
|
2153 |
-
changeddt = changed[method]('getDate');
|
2154 |
-
|
2155 |
-
if (startdt !== null) {
|
2156 |
-
var minDate = new Date(startdt.getTime()),
|
2157 |
-
maxDate = new Date(startdt.getTime());
|
2158 |
-
|
2159 |
-
minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
|
2160 |
-
maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
|
2161 |
-
|
2162 |
-
if (options.minInterval > 0 && minDate > enddt) { // minInterval check
|
2163 |
-
endTime[method]('setDate', minDate);
|
2164 |
-
}
|
2165 |
-
else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
|
2166 |
-
endTime[method]('setDate', maxDate);
|
2167 |
-
}
|
2168 |
-
else if (startdt > enddt) {
|
2169 |
-
other[method]('setDate', changeddt);
|
2170 |
-
}
|
2171 |
-
}
|
2172 |
-
}
|
2173 |
-
|
2174 |
-
function selected(changed, other, option) {
|
2175 |
-
if (!changed.val()) {
|
2176 |
-
return;
|
2177 |
-
}
|
2178 |
-
var date = changed[method].call(changed, 'getDate');
|
2179 |
-
if (date !== null && options.minInterval > 0) {
|
2180 |
-
if (option === 'minDate') {
|
2181 |
-
date.setMilliseconds(date.getMilliseconds() + options.minInterval);
|
2182 |
-
}
|
2183 |
-
if (option === 'maxDate') {
|
2184 |
-
date.setMilliseconds(date.getMilliseconds() - options.minInterval);
|
2185 |
-
}
|
2186 |
-
}
|
2187 |
-
|
2188 |
-
if (date.getTime) {
|
2189 |
-
other[method].call(other, 'option', option, date);
|
2190 |
-
}
|
2191 |
-
}
|
2192 |
-
|
2193 |
-
$.fn[method].call(startTime, $.extend({
|
2194 |
-
timeOnly: timeOnly,
|
2195 |
-
onClose: function (dateText, inst) {
|
2196 |
-
checkDates($(this), endTime);
|
2197 |
-
},
|
2198 |
-
onSelect: function (selectedDateTime) {
|
2199 |
-
selected($(this), endTime, 'minDate');
|
2200 |
-
}
|
2201 |
-
}, options, options.start));
|
2202 |
-
$.fn[method].call(endTime, $.extend({
|
2203 |
-
timeOnly: timeOnly,
|
2204 |
-
onClose: function (dateText, inst) {
|
2205 |
-
checkDates($(this), startTime);
|
2206 |
-
},
|
2207 |
-
onSelect: function (selectedDateTime) {
|
2208 |
-
selected($(this), startTime, 'maxDate');
|
2209 |
-
}
|
2210 |
-
}, options, options.end));
|
2211 |
-
|
2212 |
-
checkDates(startTime, endTime);
|
2213 |
-
|
2214 |
-
selected(startTime, endTime, 'minDate');
|
2215 |
-
selected(endTime, startTime, 'maxDate');
|
2216 |
-
|
2217 |
-
return $([startTime.get(0), endTime.get(0)]);
|
2218 |
-
};
|
2219 |
-
|
2220 |
-
/**
|
2221 |
-
* Log error or data to the console during error or debugging
|
2222 |
-
* @param {Object} err pass any type object to log to the console during error or debugging
|
2223 |
-
* @return {void}
|
2224 |
-
*/
|
2225 |
-
$.timepicker.log = function () {
|
2226 |
-
if (window.console) {
|
2227 |
-
window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
|
2228 |
-
}
|
2229 |
-
};
|
2230 |
-
|
2231 |
-
/*
|
2232 |
-
* Add util object to allow access to private methods for testability.
|
2233 |
-
*/
|
2234 |
-
$.timepicker._util = {
|
2235 |
-
_extendRemove: extendRemove,
|
2236 |
-
_isEmptyObject: isEmptyObject,
|
2237 |
-
_convert24to12: convert24to12,
|
2238 |
-
_detectSupport: detectSupport,
|
2239 |
-
_selectLocalTimezone: selectLocalTimezone,
|
2240 |
-
_computeEffectiveSetting: computeEffectiveSetting,
|
2241 |
-
_splitDateTime: splitDateTime,
|
2242 |
-
_parseDateTimeInternal: parseDateTimeInternal
|
2243 |
-
};
|
2244 |
-
|
2245 |
-
/*
|
2246 |
-
* Microsecond support
|
2247 |
-
*/
|
2248 |
-
if (!Date.prototype.getMicroseconds) {
|
2249 |
-
Date.prototype.microseconds = 0;
|
2250 |
-
Date.prototype.getMicroseconds = function () { return this.microseconds; };
|
2251 |
-
Date.prototype.setMicroseconds = function (m) {
|
2252 |
-
this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
|
2253 |
-
this.microseconds = m % 1000;
|
2254 |
-
return this;
|
2255 |
-
};
|
2256 |
-
}
|
2257 |
-
|
2258 |
-
/*
|
2259 |
-
* Keep up with the version
|
2260 |
-
*/
|
2261 |
-
$.timepicker.version = "1.6.1";
|
2262 |
-
|
2263 |
-
})));
|
1 |
+
!function(e){"function"==typeof define&&define.amd&&define(["jquery","jquery-ui"],e)}(jQuery(document).ready(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.6.1"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Auj.",closeText:"Valider",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choisir heure",timeText:"Heure",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(e,t){return $.isFunction(tp_inst._defaults.evnts.beforeShow)?tp_inst._defaults.evnts.beforeShow.call($input[0],e,t,tp_inst):void 0},onChangeMonthYear:function(e,t,i){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],e,t,i,tp_inst)},onClose:function(e,t){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(t),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],e,t,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||this._defaults[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(e){return e.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(e){return e.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&"undefined"==typeof $.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzl>tzi;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),tp_inst._defaults.altRedirectFocus===!0&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),(0===tp_inst._defaults.minDate||0===tp_inst._defaults.minDateTime)&&(tp_inst._defaults.minDate=new Date),(0===tp_inst._defaults.maxDate||0===tp_inst._defaults.maxDateTime)&&(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(e){var t=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(t),this._limitMinMaxDateTime(e,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(e,t){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),t||!this._defaults.timeOnly){var i=$.datepicker._get(this.inst,"dateFormat");try{var s=parseDateTimeInternal(i,this._defaults.timeFormat,e,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!s.timeObj)return!1;$.extend(this,s.timeObj)}catch(n){return $.timepicker.log("Error parsing the date/time string: "+n+"\ndate/time string = "+e+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+i),!1}return!0}var a=$.datepicker.parseTime(this._defaults.timeFormat,e,this._defaults);return a?($.extend(this,a),!0):!1},_afterInject:function(){var e=this.inst.settings;$.isFunction(e.afterInject)&&e.afterInject.call(this)},_injectTimePicker:function(){var e=this.inst.dpDiv,t=this.inst.settings,i=this,s="",n="",a=null,r={},l={},o=null,u=0,c=0;if(0===e.find("div.ui-timepicker-div").length&&t.showTimepicker){var m=" ui_tpicker_unit_hide",d='<div class="ui-timepicker-div'+(t.isRTL?" ui-timepicker-rtl":"")+(t.oneLine&&"select"===t.controlType?" ui-timepicker-oneLine":"")+'"><dl><dt class="ui_tpicker_time_label'+(t.showTime?"":m)+'">'+t.timeText+'</dt><dd class="ui_tpicker_time '+(t.showTime?"":m)+'"><input class="ui_tpicker_time_input" '+(t.timeInput?"":"disabled")+"/></dd>";for(u=0,c=this.units.length;c>u;u++){if(s=this.units[u],n=s.substr(0,1).toUpperCase()+s.substr(1),a=null!==t["show"+n]?t["show"+n]:this.support[s],r[s]=parseInt(t[s+"Max"]-(t[s+"Max"]-t[s+"Min"])%t["step"+n],10),l[s]=0,d+='<dt class="ui_tpicker_'+s+"_label"+(a?"":m)+'">'+t[s+"Text"]+'</dt><dd class="ui_tpicker_'+s+(a?"":m)+'"><div class="ui_tpicker_'+s+"_slider"+(a?"":m)+'"></div>',a&&t[s+"Grid"]>0){if(d+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===s)for(var h=t[s+"Min"];h<=r[s];h+=parseInt(t[s+"Grid"],10)){l[s]++;var p=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:h},t);d+='<td data-for="'+s+'">'+p+"</td>"}else for(var f=t[s+"Min"];f<=r[s];f+=parseInt(t[s+"Grid"],10))l[s]++,d+='<td data-for="'+s+'">'+(10>f?"0":"")+f+"</td>";d+="</tr></table></div>"}d+="</dd>"}var _=null!==t.showTimezone?t.showTimezone:this.support.timezone;d+='<dt class="ui_tpicker_timezone_label'+(_?"":m)+'">'+t.timezoneText+"</dt>",d+='<dd class="ui_tpicker_timezone'+(_?"":m)+'"></dd>',d+="</dl></div>";var g=$(d);for(t.timeOnly===!0&&(g.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+t.timeOnlyTitle+"</div></div>"),e.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),u=0,c=i.units.length;c>u;u++)s=i.units[u],n=s.substr(0,1).toUpperCase()+s.substr(1),a=null!==t["show"+n]?t["show"+n]:this.support[s],i[s+"_slider"]=i.control.create(i,g.find(".ui_tpicker_"+s+"_slider"),s,i[s],t[s+"Min"],r[s],t["step"+n]),a&&t[s+"Grid"]>0&&(o=100*l[s]*t[s+"Grid"]/(r[s]-t[s+"Min"]),g.find(".ui_tpicker_"+s+" table").css({width:o+"%",marginLeft:t.isRTL?"0":o/(-2*l[s])+"%",marginRight:t.isRTL?o/(-2*l[s])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(e){var t=$(this),n=t.html(),a=parseInt(n.replace(/[^0-9]/g),10),r=n.replace(/[^apm]/gi),l=t.data("for");"hour"===l&&(-1!==r.indexOf("p")&&12>a?a+=12:-1!==r.indexOf("a")&&12===a&&(a=0)),i.control.value(i,i[l+"_slider"],s,a),i._onTimeChange(),i._onSelectHandler()}).css({cursor:"pointer",width:100/l[s]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=g.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(t.timezoneList,function(e,t){return $("<option />").val("object"==typeof e?e.value:e).text("object"==typeof e?e.label:e)})),"undefined"!=typeof this.timezone&&null!==this.timezone&&""!==this.timezone){var M=-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset();M===this.timezone?selectLocalTimezone(i):this.timezone_select.val(this.timezone)}else"undefined"!=typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(t.timezone):selectLocalTimezone(i);this.timezone_select.change(function(){i._onTimeChange(),i._onSelectHandler(),i._afterInject()});var v=e.find(".ui-datepicker-buttonpane");if(v.length?v.before(g):e.append(g),this.$timeObj=g.find(".ui_tpicker_time_input"),this.$timeObj.change(function(){var e=i.inst.settings.timeFormat,t=$.datepicker.parseTime(e,this.value),s=new Date;t?(s.setHours(t.hour),s.setMinutes(t.minute),s.setSeconds(t.second),$.datepicker._setTime(i.inst,s)):(this.value=i.formattedTime,this.blur())}),null!==this.inst){var k=this.timeDefined;this._onTimeChange(),this.timeDefined=k}if(this._defaults.addSliderAccess){var T=this._defaults.sliderAccessArgs,D=this._defaults.isRTL;T.isRTL=D,setTimeout(function(){if(0===g.find(".ui-slider-access").length){g.find(".ui-slider:visible").sliderAccess(T);var e=g.find(".ui-slider-access:eq(0)").outerWidth(!0);e&&g.find("table:visible").each(function(){var t=$(this),i=t.outerWidth(),s=t.css(D?"marginRight":"marginLeft").toString().replace("%",""),n=i-e,a=s*n/i+"%",r={width:n,marginRight:0,marginLeft:0};r[D?"marginRight":"marginLeft"]=a,t.css(r)})}},10)}i._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(e,t){var i=this._defaults,s=new Date(e.selectedYear,e.selectedMonth,e.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(e,"minDateTime")&&void 0!==$.datepicker._get(e,"minDateTime")&&s){var n=$.datepicker._get(e,"minDateTime"),a=new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0);(null===this.hourMinOriginal||null===this.minuteMinOriginal||null===this.secondMinOriginal||null===this.millisecMinOriginal||null===this.microsecMinOriginal)&&(this.hourMinOriginal=i.hourMin,this.minuteMinOriginal=i.minuteMin,this.secondMinOriginal=i.secondMin,this.millisecMinOriginal=i.millisecMin,this.microsecMinOriginal=i.microsecMin),e.settings.timeOnly||a.getTime()===s.getTime()?(this._defaults.hourMin=n.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=n.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=n.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=n.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=n.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(e,"maxDateTime")&&void 0!==$.datepicker._get(e,"maxDateTime")&&s){var r=$.datepicker._get(e,"maxDateTime"),l=new Date(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0,0);(null===this.hourMaxOriginal||null===this.minuteMaxOriginal||null===this.secondMaxOriginal||null===this.millisecMaxOriginal)&&(this.hourMaxOriginal=i.hourMax,this.minuteMaxOriginal=i.minuteMax,this.secondMaxOriginal=i.secondMax,this.millisecMaxOriginal=i.millisecMax,this.microsecMaxOriginal=i.microsecMax),e.settings.timeOnly||l.getTime()===s.getTime()?(this._defaults.hourMax=r.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=r.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=r.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=r.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=r.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==e.settings.minTime){var o=new Date("01/01/1970 "+e.settings.minTime);this.hour<o.getHours()?(this.hour=this._defaults.hourMin=o.getHours(),this.minute=this._defaults.minuteMin=o.getMinutes()):this.hour===o.getHours()&&this.minute<o.getMinutes()?this.minute=this._defaults.minuteMin=o.getMinutes():this._defaults.hourMin<o.getHours()?(this._defaults.hourMin=o.getHours(),this._defaults.minuteMin=o.getMinutes()):this._defaults.hourMin===o.getHours()===this.hour&&this._defaults.minuteMin<o.getMinutes()?this._defaults.minuteMin=o.getMinutes():this._defaults.minuteMin=0}if(null!==e.settings.maxTime){var u=new Date("01/01/1970 "+e.settings.maxTime);this.hour>u.getHours()?(this.hour=this._defaults.hourMax=u.getHours(),this.minute=this._defaults.minuteMax=u.getMinutes()):this.hour===u.getHours()&&this.minute>u.getMinutes()?this.minute=this._defaults.minuteMax=u.getMinutes():this._defaults.hourMax>u.getHours()?(this._defaults.hourMax=u.getHours(),this._defaults.minuteMax=u.getMinutes()):this._defaults.hourMax===u.getHours()===this.hour&&this._defaults.minuteMax>u.getMinutes()?this._defaults.minuteMax=u.getMinutes():this._defaults.minuteMax=59}if(void 0!==t&&t===!0){var c=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),m=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),d=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),h=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),p=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:c,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:m,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:d,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:h,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:p,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var e=this.hour_slider?this.control.value(this,this.hour_slider,"hour"):!1,t=this.minute_slider?this.control.value(this,this.minute_slider,"minute"):!1,i=this.second_slider?this.control.value(this,this.second_slider,"second"):!1,s=this.millisec_slider?this.control.value(this,this.millisec_slider,"millisec"):!1,n=this.microsec_slider?this.control.value(this,this.microsec_slider,"microsec"):!1,a=this.timezone_select?this.timezone_select.val():!1,r=this._defaults,l=r.pickerTimeFormat||r.timeFormat,o=r.pickerTimeSuffix||r.timeSuffix;"object"==typeof e&&(e=!1),"object"==typeof t&&(t=!1),"object"==typeof i&&(i=!1),"object"==typeof s&&(s=!1),"object"==typeof n&&(n=!1),"object"==typeof a&&(a=!1),e!==!1&&(e=parseInt(e,10)),t!==!1&&(t=parseInt(t,10)),i!==!1&&(i=parseInt(i,10)),s!==!1&&(s=parseInt(s,10)),n!==!1&&(n=parseInt(n,10)),a!==!1&&(a=a.toString());var u=r[12>e?"amNames":"pmNames"][0],c=e!==parseInt(this.hour,10)||t!==parseInt(this.minute,10)||i!==parseInt(this.second,10)||s!==parseInt(this.millisec,10)||n!==parseInt(this.microsec,10)||this.ampm.length>0&&12>e!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&a!==this.timezone.toString();if(c&&(e!==!1&&(this.hour=e),t!==!1&&(this.minute=t),i!==!1&&(this.second=i),s!==!1&&(this.millisec=s),n!==!1&&(this.microsec=n),a!==!1&&(this.timezone=a),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=u),this.formattedTime=$.datepicker.formatTime(r.timeFormat,this,r),this.$timeObj){var m=this.$timeObj[0].selectionStart,d=this.$timeObj[0].selectionEnd;l===r.timeFormat?this.$timeObj.val(this.formattedTime+o):this.$timeObj.val($.datepicker.formatTime(l,this,r)+o),this.$timeObj[0].setSelectionRange(m,d)}this.timeDefined=!0,c&&this._updateDateTime()}},_onSelectHandler:function(){var e=this._defaults.onSelect||this.inst.settings.onSelect,t=this.$input?this.$input[0]:null;e&&t&&e.apply(t,[this.formattedDateTime,this])},_updateDateTime:function(e){e=this.inst||e;var t=e.currentYear>0?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(e.selectedYear,e.selectedMonth,e.selectedDay),i=$.datepicker._daylightSavingAdjust(t),s=$.datepicker._get(e,"dateFormat"),n=$.datepicker._getFormatConfig(e),a=null!==i&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(s,null===i?new Date:i,n);var r=this.formattedDate;if(""===e.lastVal&&(e.currentYear=e.selectedYear,e.currentMonth=e.selectedMonth,e.currentDay=e.selectedDay),this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!1?r=this.formattedTime:(this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||a)||this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!0)&&(r+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=r,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(r);var l="",o=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,u=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(l=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===i?new Date:i,n):this.formattedDate,l&&(l+=o)),l+=null!==this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+u:this.formattedTime+u,this.$altInput.val(l)}else this.$input.val(r);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var e=$.datepicker._getInst(this.$input.get(0)),t=$.datepicker._get(e,"timepicker");if(t&&t._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(i){$.timepicker.log(i)}}},_controls:{slider:{create:function(e,t,i,s,n,a,r){var l=e._defaults.isRTL;return t.prop("slide",null).slider({orientation:"horizontal",value:l?-1*s:s,min:l?-1*a:n,max:l?-1*n:a,step:r,slide:function(t,s){e.control.value(e,$(this),i,l?-1*s.value:s.value),e._onTimeChange()},stop:function(t,i){e._onSelectHandler()}})},options:function(e,t,i,s,n){if(e._defaults.isRTL){if("string"==typeof s)return"min"===s||"max"===s?void 0!==n?t.slider(s,-1*n):Math.abs(t.slider(s)):t.slider(s);var a=s.min,r=s.max;return s.min=s.max=null,void 0!==a&&(s.max=-1*a),void 0!==r&&(s.min=-1*r),t.slider(s)}return"string"==typeof s&&void 0!==n?t.slider(s,n):t.slider(s)},value:function(e,t,i,s){return e._defaults.isRTL?void 0!==s?t.slider("value",-1*s):Math.abs(t.slider("value")):void 0!==s?t.slider("value",s):t.slider("value")}},select:{create:function(e,t,i,s,n,a,r){for(var l='<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="'+i+'" data-min="'+n+'" data-max="'+a+'" data-step="'+r+'">',o=e._defaults.pickerTimeFormat||e._defaults.timeFormat,u=n;a>=u;u+=r)l+='<option value="'+u+'"'+(u===s?" selected":"")+">",l+="hour"===i?$.datepicker.formatTime($.trim(o.replace(/[^ht ]/gi,"")),{hour:u},e._defaults):"millisec"===i||"microsec"===i||u>=10?u:"0"+u.toString(),l+="</option>";return l+="</select>",t.children("select").remove(),$(l).appendTo(t).change(function(t){e._onTimeChange(),e._onSelectHandler(),e._afterInject()}),t},options:function(e,t,i,s,n){var a={},r=t.children("select");if("string"==typeof s){if(void 0===n)return r.data(s);a[s]=n}else a=s;return e.control.create(e,t,r.data("unit"),r.val(),a.min>=0?a.min:r.data("min"),a.max||r.data("max"),a.step||r.data("step"))},value:function(e,t,i,s){var n=t.children("select");return void 0!==s?n.val(s):n.val()}}}}),$.fn.extend({timepicker:function(e){e=e||{};var t=Array.prototype.slice.call(arguments);return"object"==typeof e&&(t[0]=$.extend(e,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),t)})},datetimepicker:function(e){e=e||{};var t=arguments;return"string"==typeof e?"getDate"===e||"option"===e&&2===t.length&&"string"==typeof t[1]?$.fn.datepicker.apply($(this[0]),t):this.each(function(){var e=$(this);e.datepicker.apply(e,t)}):this.each(function(){var t=$(this);t.datepicker($.timepicker._newInst(t,e)._defaults)})}}),$.datepicker.parseDateTime=function(e,t,i,s,n){var a=parseDateTimeInternal(e,t,i,s,n);if(a.timeObj){var r=a.timeObj;a.date.setHours(r.hour,r.minute,r.second,r.millisec),a.date.setMicroseconds(r.microsec)}return a.date},$.datepicker.parseTime=function(e,t,i){var s=extendRemove(extendRemove({},$.timepicker._defaults),i||{}),n=(-1!==e.replace(/\'.*?\'/g,"").indexOf("Z"),function(e,t,i){var s,n=function(e,t){var i=[];return e&&$.merge(i,e),t&&$.merge(i,t),i=$.map(i,function(e){return e.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+i.join("|")+")?"},a=function(e){var t=e.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),i={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(t)for(var s=0;s<t.length;s++)-1===i[t[s].toString().charAt(0)]&&(i[t[s].toString().charAt(0)]=s+1);return i},r="^"+e.toString().replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(e){var t=e.length;switch(e.charAt(0).toLowerCase()){case"h":return 1===t?"(\\d?\\d)":"(\\d{"+t+"})";case"m":return 1===t?"(\\d?\\d)":"(\\d{"+t+"})";case"s":return 1===t?"(\\d?\\d)":"(\\d{"+t+"})";case"l":return"(\\d?\\d?\\d)";case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return n(i.amNames,i.pmNames);default:return"("+e.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(e){return"\\"+e})+")?"}}).replace(/\s/g,"\\s?")+i.timeSuffix+"$",l=a(e),o="";s=t.match(new RegExp(r,"i"));var u={hour:0,minute:0,second:0,millisec:0,microsec:0};return s?(-1!==l.t&&(void 0===s[l.t]||0===s[l.t].length?(o="",u.ampm=""):(o=-1!==$.inArray(s[l.t].toUpperCase(),$.map(i.amNames,function(e,t){return e.toUpperCase()}))?"AM":"PM",u.ampm=i["AM"===o?"amNames":"pmNames"][0])),-1!==l.h&&("AM"===o&&"12"===s[l.h]?u.hour=0:"PM"===o&&"12"!==s[l.h]?u.hour=parseInt(s[l.h],10)+12:u.hour=Number(s[l.h])),-1!==l.m&&(u.minute=Number(s[l.m])),-1!==l.s&&(u.second=Number(s[l.s])),-1!==l.l&&(u.millisec=Number(s[l.l])),-1!==l.c&&(u.microsec=Number(s[l.c])),-1!==l.z&&void 0!==s[l.z]&&(u.timezone=$.timepicker.timezoneOffsetNumber(s[l.z])),u):!1}),a=function(e,t,i){try{var s=new Date("2012-01-01 "+t);if(isNaN(s.getTime())&&(s=new Date("2012-01-01T"+t),isNaN(s.getTime())&&(s=new Date("01/01/2012 "+t),isNaN(s.getTime()))))throw"Unable to parse time with native Date: "+t;return{hour:s.getHours(),minute:s.getMinutes(),second:s.getSeconds(),millisec:s.getMilliseconds(),microsec:s.getMicroseconds(),timezone:-1*s.getTimezoneOffset()}}catch(a){try{return n(e,t,i)}catch(r){$.timepicker.log("Unable to parse \ntimeString: "+t+"\ntimeFormat: "+e)}}return!1};return"function"==typeof s.parse?s.parse(e,t,s):"loose"===s.parse?a(e,t,s):n(e,t,s)},$.datepicker.formatTime=function(e,t,i){i=i||{},i=$.extend({},$.timepicker._defaults,i),t=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},t);var s=e,n=i.amNames[0],a=parseInt(t.hour,10);return a>11&&(n=i.pmNames[0]),s=s.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(e){switch(e){case"HH":return("0"+a).slice(-2);case"H":return a;case"hh":return("0"+convert24to12(a)).slice(-2);case"h":return convert24to12(a);case"mm":return("0"+t.minute).slice(-2);case"m":return t.minute;case"ss":return("0"+t.second).slice(-2);case"s":return t.second;case"l":return("00"+t.millisec).slice(-3);case"c":return("00"+t.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===t.timezone?i.timezone:t.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===t.timezone?i.timezone:t.timezone,!0);case"T":return n.charAt(0).toUpperCase();case"TT":return n.toUpperCase();case"t":return n.charAt(0).toLowerCase();case"tt":return n.toLowerCase();default:return e.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(e,t){var i,s=this._getInst($(e)[0]),n=this._get(s,"timepicker");n&&s.settings.showTimepicker?(n._limitMinMaxDateTime(s,!0),i=s.inline,s.inline=s.stay_open=!0,this._base_selectDate(e,t),s.inline=i,s.stay_open=!1,this._notifyChange(s),this._updateDatepicker(s)):this._base_selectDate(e,t)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(e){var t=e.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==e&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==t||"boolean"==typeof e.stay_open&&e.stay_open!==!1)){this._base_updateDatepicker(e);var i=this._get(e,"timepicker");i&&i._addTimePicker(e)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(e){var t=$.datepicker._getInst(e.target),i=$.datepicker._get(t,"timepicker");if(i&&$.datepicker._get(t,"constrainInput")){var s=i.support.ampm,n=null!==i._defaults.showTimezone?i._defaults.showTimezone:i.support.timezone,a=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),r=i._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,s?"APM":"").replace(/Tt/g,s?"AaPpMm":"").replace(/tT/g,s?"AaPpMm":"").replace(/T/g,s?"AP":"").replace(/tt/g,s?"apm":"").replace(/t/g,s?"ap":"")+" "+i._defaults.separator+i._defaults.timeSuffix+(n?i._defaults.timezoneList.join(""):"")+i._defaults.amNames.join("")+i._defaults.pmNames.join("")+a,l=String.fromCharCode(void 0===e.charCode?e.keyCode:e.charCode);return e.ctrlKey||" ">l||!a||r.indexOf(l)>-1}return $.datepicker._base_doKeyPress(e)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(e){var t=this._get(e,"timepicker");if(t){var i=t._defaults.altField;if(i){var s=(t._defaults.altFormat||t._defaults.dateFormat,this._getDate(e)),n=$.datepicker._getFormatConfig(e),a="",r=t._defaults.altSeparator?t._defaults.altSeparator:t._defaults.separator,l=t._defaults.altTimeSuffix?t._defaults.altTimeSuffix:t._defaults.timeSuffix,o=null!==t._defaults.altTimeFormat?t._defaults.altTimeFormat:t._defaults.timeFormat;a+=$.datepicker.formatTime(o,t,t._defaults)+l,t._defaults.timeOnly||t._defaults.altFieldTimeOnly||null===s||(a=t._defaults.altFormat?$.datepicker.formatDate(t._defaults.altFormat,s,n)+r+a:t.formattedDate+r+a),$(i).val(e.input.val()?a:"")}}else $.datepicker._base_updateAlternate(e)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(e){var t=$.datepicker._getInst(e.target),i=$.datepicker._get(t,"timepicker");
|
2 |
+
if(i&&i._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(s){$.timepicker.log(s)}return $.datepicker._base_doKeyUp(e)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(e){var t=this._getInst($(e)[0]);this._base_gotoToday(e);var i=this._get(t,"timepicker"),s=$.timepicker.timezoneOffsetNumber(i.timezone),n=new Date;n.setMinutes(n.getMinutes()+n.getTimezoneOffset()+s),this._setTime(t,n),this._setDate(t,n),i._onSelectHandler()},$.datepicker._disableTimepickerDatepicker=function(e){var t=this._getInst(e);if(t){var i=this._get(t,"timepicker");$(e).datepicker("getDate"),i&&(t.settings.showTimepicker=!1,i._defaults.showTimepicker=!1,i._updateDateTime(t))}},$.datepicker._enableTimepickerDatepicker=function(e){var t=this._getInst(e);if(t){var i=this._get(t,"timepicker");$(e).datepicker("getDate"),i&&(t.settings.showTimepicker=!0,i._defaults.showTimepicker=!0,i._addTimePicker(t),i._updateDateTime(t))}},$.datepicker._setTime=function(e,t){var i=this._get(e,"timepicker");if(i){var s=i._defaults;i.hour=t?t.getHours():s.hour,i.minute=t?t.getMinutes():s.minute,i.second=t?t.getSeconds():s.second,i.millisec=t?t.getMilliseconds():s.millisec,i.microsec=t?t.getMicroseconds():s.microsec,i._limitMinMaxDateTime(e,!0),i._onTimeChange(),i._updateDateTime(e)}},$.datepicker._setTimeDatepicker=function(e,t,i){var s=this._getInst(e);if(s){var n=this._get(s,"timepicker");if(n){this._setDateFromField(s);var a;t&&("string"==typeof t?(n._parseTime(t,i),a=new Date,a.setHours(n.hour,n.minute,n.second,n.millisec),a.setMicroseconds(n.microsec)):(a=new Date(t.getTime()),a.setMicroseconds(t.getMicroseconds())),"Invalid Date"===a.toString()&&(a=void 0),this._setTime(s,a))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(e,t){var i=this._getInst(e),s=t;if(i){"string"==typeof t&&(s=new Date(t),s.getTime()||(this._base_setDateDatepicker.apply(this,arguments),s=$(e).datepicker("getDate")));var n,a=this._get(i,"timepicker");s instanceof Date?(n=new Date(s.getTime()),n.setMicroseconds(s.getMicroseconds())):n=s,a&&n&&(a.support.timezone||null!==a._defaults.timezone||(a.timezone=-1*n.getTimezoneOffset()),s=$.timepicker.timezoneAdjust(s,a.timezone),n=$.timepicker.timezoneAdjust(n,a.timezone)),this._updateDatepicker(i),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(e,n,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(e,t){var i=this._getInst(e);if(i){var s=this._get(i,"timepicker");if(s){void 0===i.lastVal&&this._setDateFromField(i,t);var n=this._getDate(i),a=$.trim(s.$altInput&&s._defaults.altFieldTimeOnly?s.$input.val()+" "+s.$altInput.val():s.$input.val());return n&&s._parseTime(a,!i.settings.timeOnly)&&(n.setHours(s.hour,s.minute,s.second,s.millisec),n.setMicroseconds(s.microsec),null!=s.timezone&&(s.support.timezone||null!==s._defaults.timezone||(s.timezone=-1*n.getTimezoneOffset()),n=$.timepicker.timezoneAdjust(n,s.timezone))),n}return this._base_getDateDatepicker(e,t)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(e,t,i){var s;try{s=this._base_parseDate(e,t,i)}catch(n){if(!(n.indexOf(":")>=0))throw n;s=this._base_parseDate(e,t.substring(0,t.length-(n.length-n.indexOf(":")-2)),i),$.timepicker.log("Error parsing the date string: "+n+"\ndate string = "+t+"\ndate format = "+e)}return s},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(e,t,i,s){var n=this._get(e,"timepicker");return n?(n._updateDateTime(e),n.$input.val()):this._base_formatDate(e)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(e,t,i){var s,n=this._getInst(e);if(!n)return null;var a=this._get(n,"timepicker");if(a){var r,l,o,u,c=null,m=null,d=null,h=a._defaults.evnts,p={};if("string"==typeof t){if("minDate"===t||"minDateTime"===t)c=i;else if("maxDate"===t||"maxDateTime"===t)m=i;else if("onSelect"===t)d=i;else if(h.hasOwnProperty(t)){if("undefined"==typeof i)return h[t];p[t]=i,s={}}}else if("object"==typeof t){t.minDate?c=t.minDate:t.minDateTime?c=t.minDateTime:t.maxDate?m=t.maxDate:t.maxDateTime&&(m=t.maxDateTime);for(r in h)h.hasOwnProperty(r)&&t[r]&&(p[r]=t[r])}for(r in p)p.hasOwnProperty(r)&&(h[r]=p[r],s||(s=$.extend({},t)),delete s[r]);if(s&&isEmptyObject(s))return;if(c?(c=0===c?new Date:new Date(c),a._defaults.minDate=c,a._defaults.minDateTime=c):m?(m=0===m?new Date:new Date(m),a._defaults.maxDate=m,a._defaults.maxDateTime=m):d&&(a._defaults.onSelect=d),c||m)return u=$(e),o=u.datetimepicker("getDate"),l=this._base_optionDatepicker.call($.datepicker,e,s||t,i),u.datetimepicker("setDate",o),l}return void 0===i?this._base_optionDatepicker.call($.datepicker,e,t):this._base_optionDatepicker.call($.datepicker,e,s||t,i)};var isEmptyObject=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0},extendRemove=function(e,t){$.extend(e,t);for(var i in t)(null===t[i]||void 0===t[i])&&(e[i]=t[i]);return e},detectSupport=function(e){var t=e.replace(/'.*?'/g,"").toLowerCase(),i=function(e,t){return-1!==e.indexOf(t)?!0:!1};return{hour:i(t,"h"),minute:i(t,"m"),second:i(t,"s"),millisec:i(t,"l"),microsec:i(t,"c"),timezone:i(t,"z"),ampm:i(t,"t")&&i(e,"h"),iso8601:i(e,"Z")}},convert24to12=function(e){return e%=12,0===e&&(e=12),String(e)},computeEffectiveSetting=function(e,t){return e&&e[t]?e[t]:$.timepicker._defaults[t]},splitDateTime=function(e,t){var i=computeEffectiveSetting(t,"separator"),s=computeEffectiveSetting(t,"timeFormat"),n=s.split(i),a=n.length,r=e.split(i),l=r.length;return l>1?{dateString:r.splice(0,l-a).join(i),timeString:r.splice(0,a).join(i)}:{dateString:e,timeString:""}},parseDateTimeInternal=function(e,t,i,s,n){var a,r,l;if(r=splitDateTime(i,n),a=$.datepicker._base_parseDate(e,r.dateString,s),""===r.timeString)return{date:a};if(l=$.datepicker.parseTime(t,r.timeString,n),!l)throw"Wrong time format";return{date:a,timeObj:l}},selectLocalTimezone=function(e,t){if(e&&e.timezone_select){var i=t||new Date;e.timezone_select.val(-i.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(e,t){if(isNaN(e)||e>840||-720>e)return e;var i=e,s=i%60,n=(i-s)/60,a=t?":":"",r=(i>=0?"+":"-")+("0"+Math.abs(n)).slice(-2)+a+("0"+Math.abs(s)).slice(-2);return"+00:00"===r?"Z":r},$.timepicker.timezoneOffsetNumber=function(e){var t=e.toString().replace(":","");return"Z"===t.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(t)?("-"===t.substr(0,1)?-1:1)*(60*parseInt(t.substr(1,2),10)+parseInt(t.substr(3,2),10)):e},$.timepicker.timezoneAdjust=function(e,t){var i=$.timepicker.timezoneOffsetNumber(t);return isNaN(i)||e.setMinutes(e.getMinutes()+-e.getTimezoneOffset()-i),e},$.timepicker.timeRange=function(e,t,i){return $.timepicker.handleRange("timepicker",e,t,i)},$.timepicker.datetimeRange=function(e,t,i){$.timepicker.handleRange("datetimepicker",e,t,i)},$.timepicker.dateRange=function(e,t,i){$.timepicker.handleRange("datepicker",e,t,i)},$.timepicker.handleRange=function(e,t,i,s){function n(n,a){var r=t[e]("getDate"),l=i[e]("getDate"),o=n[e]("getDate");if(null!==r){var u=new Date(r.getTime()),c=new Date(r.getTime());u.setMilliseconds(u.getMilliseconds()+s.minInterval),c.setMilliseconds(c.getMilliseconds()+s.maxInterval),s.minInterval>0&&u>l?i[e]("setDate",u):s.maxInterval>0&&l>c?i[e]("setDate",c):r>l&&a[e]("setDate",o)}}function a(t,i,n){if(t.val()){var a=t[e].call(t,"getDate");null!==a&&s.minInterval>0&&("minDate"===n&&a.setMilliseconds(a.getMilliseconds()+s.minInterval),"maxDate"===n&&a.setMilliseconds(a.getMilliseconds()-s.minInterval)),a.getTime&&i[e].call(i,"option",n,a)}}s=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},s);var r=!1;return"timepicker"===e&&(r=!0,e="datetimepicker"),$.fn[e].call(t,$.extend({timeOnly:r,onClose:function(e,t){n($(this),i)},onSelect:function(e){a($(this),i,"minDate")}},s,s.start)),$.fn[e].call(i,$.extend({timeOnly:r,onClose:function(e,i){n($(this),t)},onSelect:function(e){a($(this),t,"maxDate")}},s,s.end)),n(t,i),a(t,i,"minDate"),a(i,t,"maxDate"),$([t.get(0),i.get(0)])},$.timepicker.log=function(){window.console&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(e){return this.setMilliseconds(this.getMilliseconds()+Math.floor(e/1e3)),this.microseconds=e%1e3,this}),$.timepicker.version="1.6.1"}}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/jquery.sticky.js
CHANGED
@@ -1,297 +1 @@
|
|
1 |
-
|
2 |
-
// =============
|
3 |
-
// Author: Anthony Garand
|
4 |
-
// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
|
5 |
-
// Improvements by Leonardo C. Daronco (daronco)
|
6 |
-
// Created: 02/14/2011
|
7 |
-
// Date: 07/20/2015
|
8 |
-
// Website: http://stickyjs.com/
|
9 |
-
// Description: Makes an element on the page stick on the screen as you scroll
|
10 |
-
// It will only set the 'top' and 'position' of your element, you
|
11 |
-
// might need to adjust the width in some cases.
|
12 |
-
|
13 |
-
(function (factory) {
|
14 |
-
if (typeof define === 'function' && define.amd) {
|
15 |
-
// AMD. Register as an anonymous module.
|
16 |
-
define(['jquery'], factory);
|
17 |
-
} else if (typeof module === 'object' && module.exports) {
|
18 |
-
// Node/CommonJS
|
19 |
-
module.exports = factory(require('jquery'));
|
20 |
-
} else {
|
21 |
-
// Browser globals
|
22 |
-
factory(jQuery);
|
23 |
-
}
|
24 |
-
}(function ($) {
|
25 |
-
var slice = Array.prototype.slice; // save ref to original slice()
|
26 |
-
var splice = Array.prototype.splice; // save ref to original slice()
|
27 |
-
|
28 |
-
var defaults = {
|
29 |
-
topSpacing: 0,
|
30 |
-
bottomSpacing: 0,
|
31 |
-
className: 'is-sticky',
|
32 |
-
wrapperClassName: 'sticky-wrapper',
|
33 |
-
center: false,
|
34 |
-
getWidthFrom: '',
|
35 |
-
widthFromWrapper: true, // works only when .getWidthFrom is empty
|
36 |
-
responsiveWidth: true,
|
37 |
-
zIndex: 'auto'
|
38 |
-
},
|
39 |
-
$window = $(window),
|
40 |
-
$document = $(document),
|
41 |
-
sticked = [],
|
42 |
-
windowHeight = $window.height(),
|
43 |
-
scroller = function() {
|
44 |
-
var scrollTop = $window.scrollTop(),
|
45 |
-
documentHeight = $document.height(),
|
46 |
-
dwh = documentHeight - windowHeight,
|
47 |
-
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
|
48 |
-
|
49 |
-
for (var i = 0, l = sticked.length; i < l; i++) {
|
50 |
-
var s = sticked[i],
|
51 |
-
elementTop = s.stickyWrapper.offset().top,
|
52 |
-
etse = elementTop - s.topSpacing - extra;
|
53 |
-
|
54 |
-
//update height in case of dynamic content
|
55 |
-
s.stickyWrapper.css('height', s.stickyElement.outerHeight());
|
56 |
-
|
57 |
-
if (scrollTop <= etse) {
|
58 |
-
if (s.currentTop !== null) {
|
59 |
-
s.stickyElement
|
60 |
-
.css({
|
61 |
-
'width': '',
|
62 |
-
'position': '',
|
63 |
-
'top': '',
|
64 |
-
'background-color': '',
|
65 |
-
'border-bottom': '',
|
66 |
-
'z-index': ''
|
67 |
-
});
|
68 |
-
s.stickyElement.parent().removeClass(s.className);
|
69 |
-
s.stickyElement.trigger('sticky-end', [s]);
|
70 |
-
s.currentTop = null;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
else {
|
74 |
-
var newTop = documentHeight - s.stickyElement.outerHeight()
|
75 |
-
- s.topSpacing - s.bottomSpacing - scrollTop - extra;
|
76 |
-
if (newTop < 0) {
|
77 |
-
newTop = newTop + s.topSpacing;
|
78 |
-
} else {
|
79 |
-
newTop = s.topSpacing;
|
80 |
-
}
|
81 |
-
if (s.currentTop !== newTop) {
|
82 |
-
var newWidth;
|
83 |
-
if (s.getWidthFrom) {
|
84 |
-
newWidth = $(s.getWidthFrom).width() || null;
|
85 |
-
} else if (s.widthFromWrapper) {
|
86 |
-
newWidth = s.stickyWrapper.width();
|
87 |
-
}
|
88 |
-
if (newWidth == null) {
|
89 |
-
newWidth = s.stickyElement.width();
|
90 |
-
}
|
91 |
-
s.stickyElement
|
92 |
-
.css('width', newWidth)
|
93 |
-
.css('position', 'fixed')
|
94 |
-
.css('top', newTop)
|
95 |
-
.css('left', '')
|
96 |
-
.css('background-color', '')
|
97 |
-
.css('border-bottom', 'none')
|
98 |
-
.css('z-index', s.zIndex);
|
99 |
-
|
100 |
-
s.stickyElement.parent().addClass(s.className);
|
101 |
-
|
102 |
-
if (s.currentTop === null) {
|
103 |
-
s.stickyElement.trigger('sticky-start', [s]);
|
104 |
-
} else {
|
105 |
-
// sticky is started but it have to be repositioned
|
106 |
-
s.stickyElement.trigger('sticky-update', [s]);
|
107 |
-
}
|
108 |
-
|
109 |
-
if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {
|
110 |
-
// just reached bottom || just started to stick but bottom is already reached
|
111 |
-
s.stickyElement.trigger('sticky-bottom-reached', [s]);
|
112 |
-
} else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {
|
113 |
-
// sticky is started && sticked at topSpacing && overflowing from top just finished
|
114 |
-
s.stickyElement.trigger('sticky-bottom-unreached', [s]);
|
115 |
-
}
|
116 |
-
|
117 |
-
s.currentTop = newTop;
|
118 |
-
}
|
119 |
-
|
120 |
-
// Check if sticky has reached end of container and stop sticking
|
121 |
-
var stickyWrapperContainer = s.stickyWrapper.parent();
|
122 |
-
var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing);
|
123 |
-
|
124 |
-
if( unstick ) {
|
125 |
-
s.stickyElement
|
126 |
-
.css('position', 'absolute')
|
127 |
-
.css('top', '')
|
128 |
-
.css('bottom', 0)
|
129 |
-
.css('background-color', '')
|
130 |
-
.css('z-index', '');
|
131 |
-
} else {
|
132 |
-
s.stickyElement
|
133 |
-
.css('position', 'fixed')
|
134 |
-
.css('top', newTop)
|
135 |
-
.css('bottom', '')
|
136 |
-
.css('background-color', '#fdfdfd')
|
137 |
-
.css('border-bottom', '3px solid #ddd')
|
138 |
-
.css('z-index', s.zIndex);
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
},
|
143 |
-
resizer = function() {
|
144 |
-
windowHeight = $window.height();
|
145 |
-
|
146 |
-
for (var i = 0, l = sticked.length; i < l; i++) {
|
147 |
-
var s = sticked[i];
|
148 |
-
var newWidth = null;
|
149 |
-
if (s.getWidthFrom) {
|
150 |
-
if (s.responsiveWidth) {
|
151 |
-
newWidth = $(s.getWidthFrom).width();
|
152 |
-
}
|
153 |
-
} else if(s.widthFromWrapper) {
|
154 |
-
newWidth = s.stickyWrapper.width();
|
155 |
-
}
|
156 |
-
if (newWidth != null) {
|
157 |
-
s.stickyElement.css('width', newWidth);
|
158 |
-
}
|
159 |
-
}
|
160 |
-
},
|
161 |
-
methods = {
|
162 |
-
init: function(options) {
|
163 |
-
return this.each(function() {
|
164 |
-
var o = $.extend({}, defaults, options);
|
165 |
-
var stickyElement = $(this);
|
166 |
-
|
167 |
-
var stickyId = stickyElement.attr('id');
|
168 |
-
var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName;
|
169 |
-
var wrapper = $('<div></div>')
|
170 |
-
.attr('id', wrapperId)
|
171 |
-
.addClass(o.wrapperClassName);
|
172 |
-
|
173 |
-
stickyElement.wrapAll(function() {
|
174 |
-
if ($(this).parent("#" + wrapperId).length == 0) {
|
175 |
-
return wrapper;
|
176 |
-
}
|
177 |
-
});
|
178 |
-
|
179 |
-
var stickyWrapper = stickyElement.parent();
|
180 |
-
|
181 |
-
if (o.center) {
|
182 |
-
stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
|
183 |
-
}
|
184 |
-
|
185 |
-
if (stickyElement.css("float") === "right") {
|
186 |
-
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
|
187 |
-
}
|
188 |
-
|
189 |
-
o.stickyElement = stickyElement;
|
190 |
-
o.stickyWrapper = stickyWrapper;
|
191 |
-
o.currentTop = null;
|
192 |
-
|
193 |
-
sticked.push(o);
|
194 |
-
|
195 |
-
methods.setWrapperHeight(this);
|
196 |
-
methods.setupChangeListeners(this);
|
197 |
-
});
|
198 |
-
},
|
199 |
-
|
200 |
-
setWrapperHeight: function(stickyElement) {
|
201 |
-
var element = $(stickyElement);
|
202 |
-
var stickyWrapper = element.parent();
|
203 |
-
if (stickyWrapper) {
|
204 |
-
stickyWrapper.css('height', element.outerHeight());
|
205 |
-
}
|
206 |
-
},
|
207 |
-
|
208 |
-
setupChangeListeners: function(stickyElement) {
|
209 |
-
if (window.MutationObserver) {
|
210 |
-
var mutationObserver = new window.MutationObserver(function(mutations) {
|
211 |
-
if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) {
|
212 |
-
methods.setWrapperHeight(stickyElement);
|
213 |
-
}
|
214 |
-
});
|
215 |
-
mutationObserver.observe(stickyElement, {subtree: true, childList: true});
|
216 |
-
} else {
|
217 |
-
if (window.addEventListener) {
|
218 |
-
stickyElement.addEventListener('DOMNodeInserted', function() {
|
219 |
-
methods.setWrapperHeight(stickyElement);
|
220 |
-
}, false);
|
221 |
-
stickyElement.addEventListener('DOMNodeRemoved', function() {
|
222 |
-
methods.setWrapperHeight(stickyElement);
|
223 |
-
}, false);
|
224 |
-
} else if (window.attachEvent) {
|
225 |
-
stickyElement.attachEvent('onDOMNodeInserted', function() {
|
226 |
-
methods.setWrapperHeight(stickyElement);
|
227 |
-
});
|
228 |
-
stickyElement.attachEvent('onDOMNodeRemoved', function() {
|
229 |
-
methods.setWrapperHeight(stickyElement);
|
230 |
-
});
|
231 |
-
}
|
232 |
-
}
|
233 |
-
},
|
234 |
-
update: scroller,
|
235 |
-
unstick: function(options) {
|
236 |
-
return this.each(function() {
|
237 |
-
var that = this;
|
238 |
-
var unstickyElement = $(that);
|
239 |
-
|
240 |
-
var removeIdx = -1;
|
241 |
-
var i = sticked.length;
|
242 |
-
while (i-- > 0) {
|
243 |
-
if (sticked[i].stickyElement.get(0) === that) {
|
244 |
-
splice.call(sticked,i,1);
|
245 |
-
removeIdx = i;
|
246 |
-
}
|
247 |
-
}
|
248 |
-
if(removeIdx !== -1) {
|
249 |
-
unstickyElement.unwrap();
|
250 |
-
unstickyElement
|
251 |
-
.css({
|
252 |
-
'width': '',
|
253 |
-
'position': '',
|
254 |
-
'top': '',
|
255 |
-
'float': '',
|
256 |
-
'background-color': '',
|
257 |
-
'border-bottom': '',
|
258 |
-
'z-index': ''
|
259 |
-
})
|
260 |
-
;
|
261 |
-
}
|
262 |
-
});
|
263 |
-
}
|
264 |
-
};
|
265 |
-
|
266 |
-
// should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
|
267 |
-
if (window.addEventListener) {
|
268 |
-
window.addEventListener('scroll', scroller, false);
|
269 |
-
window.addEventListener('resize', resizer, false);
|
270 |
-
} else if (window.attachEvent) {
|
271 |
-
window.attachEvent('onscroll', scroller);
|
272 |
-
window.attachEvent('onresize', resizer);
|
273 |
-
}
|
274 |
-
|
275 |
-
$.fn.sticky = function(method) {
|
276 |
-
if (methods[method]) {
|
277 |
-
return methods[method].apply(this, slice.call(arguments, 1));
|
278 |
-
} else if (typeof method === 'object' || !method ) {
|
279 |
-
return methods.init.apply( this, arguments );
|
280 |
-
} else {
|
281 |
-
$.error('Method ' + method + ' does not exist on jQuery.sticky');
|
282 |
-
}
|
283 |
-
};
|
284 |
-
|
285 |
-
$.fn.unstick = function(method) {
|
286 |
-
if (methods[method]) {
|
287 |
-
return methods[method].apply(this, slice.call(arguments, 1));
|
288 |
-
} else if (typeof method === 'object' || !method ) {
|
289 |
-
return methods.unstick.apply( this, arguments );
|
290 |
-
} else {
|
291 |
-
$.error('Method ' + method + ' does not exist on jQuery.sticky');
|
292 |
-
}
|
293 |
-
};
|
294 |
-
$(function() {
|
295 |
-
setTimeout(scroller, 0);
|
296 |
-
});
|
297 |
-
}));
|
1 |
+
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=Array.prototype.slice,n=Array.prototype.splice,r={topSpacing:0,bottomSpacing:0,className:"is-sticky",wrapperClassName:"sticky-wrapper",center:!1,getWidthFrom:"",widthFromWrapper:!0,responsiveWidth:!0,zIndex:"auto"},i=t(window),o=t(document),s=[],c=i.height(),a=function(){for(var e=i.scrollTop(),n=o.height(),r=n-c,a=e>r?r-e:0,p=0,d=s.length;d>p;p++){var l=s[p],u=l.stickyWrapper.offset().top,h=u-l.topSpacing-a;if(l.stickyWrapper.css("height",l.stickyElement.outerHeight()),h>=e)null!==l.currentTop&&(l.stickyElement.css({width:"",position:"",top:"","background-color":"","border-bottom":"","z-index":""}),l.stickyElement.parent().removeClass(l.className),l.stickyElement.trigger("sticky-end",[l]),l.currentTop=null);else{var g=n-l.stickyElement.outerHeight()-l.topSpacing-l.bottomSpacing-e-a;if(0>g?g+=l.topSpacing:g=l.topSpacing,l.currentTop!==g){var m;l.getWidthFrom?m=t(l.getWidthFrom).width()||null:l.widthFromWrapper&&(m=l.stickyWrapper.width()),null==m&&(m=l.stickyElement.width()),l.stickyElement.css("width",m).css("position","fixed").css("top",g).css("left","").css("background-color","").css("border-bottom","none").css("z-index",l.zIndex),l.stickyElement.parent().addClass(l.className),null===l.currentTop?l.stickyElement.trigger("sticky-start",[l]):l.stickyElement.trigger("sticky-update",[l]),l.currentTop===l.topSpacing&&l.currentTop>g||null===l.currentTop&&g<l.topSpacing?l.stickyElement.trigger("sticky-bottom-reached",[l]):null!==l.currentTop&&g===l.topSpacing&&l.currentTop<g&&l.stickyElement.trigger("sticky-bottom-unreached",[l]),l.currentTop=g}var f=l.stickyWrapper.parent(),y=l.stickyElement.offset().top+l.stickyElement.outerHeight()>=f.offset().top+f.outerHeight()&&l.stickyElement.offset().top<=l.topSpacing;y?l.stickyElement.css("position","absolute").css("top","").css("bottom",0).css("background-color","").css("z-index",""):l.stickyElement.css("position","fixed").css("top",g).css("bottom","").css("background-color","#fdfdfd").css("border-bottom","3px solid #ddd").css("z-index",l.zIndex)}}},p=function(){c=i.height();for(var e=0,n=s.length;n>e;e++){var r=s[e],o=null;r.getWidthFrom?r.responsiveWidth&&(o=t(r.getWidthFrom).width()):r.widthFromWrapper&&(o=r.stickyWrapper.width()),null!=o&&r.stickyElement.css("width",o)}},d={init:function(e){return this.each(function(){var n=t.extend({},r,e),i=t(this),o=i.attr("id"),c=o?o+"-"+r.wrapperClassName:r.wrapperClassName,a=t("<div></div>").attr("id",c).addClass(n.wrapperClassName);i.wrapAll(function(){return 0==t(this).parent("#"+c).length?a:void 0});var p=i.parent();n.center&&p.css({width:i.outerWidth(),marginLeft:"auto",marginRight:"auto"}),"right"===i.css("float")&&i.css({"float":"none"}).parent().css({"float":"right"}),n.stickyElement=i,n.stickyWrapper=p,n.currentTop=null,s.push(n),d.setWrapperHeight(this),d.setupChangeListeners(this)})},setWrapperHeight:function(e){var n=t(e),r=n.parent();r&&r.css("height",n.outerHeight())},setupChangeListeners:function(t){if(window.MutationObserver){var e=new window.MutationObserver(function(e){(e[0].addedNodes.length||e[0].removedNodes.length)&&d.setWrapperHeight(t)});e.observe(t,{subtree:!0,childList:!0})}else window.addEventListener?(t.addEventListener("DOMNodeInserted",function(){d.setWrapperHeight(t)},!1),t.addEventListener("DOMNodeRemoved",function(){d.setWrapperHeight(t)},!1)):window.attachEvent&&(t.attachEvent("onDOMNodeInserted",function(){d.setWrapperHeight(t)}),t.attachEvent("onDOMNodeRemoved",function(){d.setWrapperHeight(t)}))},update:a,unstick:function(e){return this.each(function(){for(var e=this,r=t(e),i=-1,o=s.length;o-->0;)s[o].stickyElement.get(0)===e&&(n.call(s,o,1),i=o);-1!==i&&(r.unwrap(),r.css({width:"",position:"",top:"","float":"","background-color":"","border-bottom":"","z-index":""}))})}};window.addEventListener?(window.addEventListener("scroll",a,!1),window.addEventListener("resize",p,!1)):window.attachEvent&&(window.attachEvent("onscroll",a),window.attachEvent("onresize",p)),t.fn.sticky=function(n){return d[n]?d[n].apply(this,e.call(arguments,1)):"object"!=typeof n&&n?void t.error("Method "+n+" does not exist on jQuery.sticky"):d.init.apply(this,arguments)},t.fn.unstick=function(n){return d[n]?d[n].apply(this,e.call(arguments,1)):"object"!=typeof n&&n?void t.error("Method "+n+" does not exist on jQuery.sticky"):d.unstick.apply(this,arguments)},t(function(){setTimeout(a,0)})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/jquery.ui.datepicker-fr.js
CHANGED
@@ -1,26 +1 @@
|
|
1 |
-
|
2 |
-
/* Written by Keith Wood (kbwood{at}iinet.com.au),
|
3 |
-
Stéphane Nahmani (sholby@sholby.net),
|
4 |
-
Stéphane Raimbault <stephane.raimbault@gmail.com> */
|
5 |
-
jQuery(function($){
|
6 |
-
$.datepicker.regional['fr'] = {
|
7 |
-
closeText: 'Fermer',
|
8 |
-
prevText: 'Précédent',
|
9 |
-
nextText: 'Suivant',
|
10 |
-
currentText: 'Aujourd\'hui',
|
11 |
-
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
|
12 |
-
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
|
13 |
-
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
|
14 |
-
'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
|
15 |
-
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
|
16 |
-
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
|
17 |
-
dayNamesMin: ['D','L','M','M','J','V','S'],
|
18 |
-
weekHeader: 'Sem.',
|
19 |
-
dateFormat: 'dd/mm/yy',
|
20 |
-
firstDay: 1,
|
21 |
-
isRTL: false,
|
22 |
-
showMonthAfterYear: false,
|
23 |
-
yearSuffix: ''
|
24 |
-
};
|
25 |
-
$.datepicker.setDefaults($.datepicker.regional['fr']);
|
26 |
-
});
|
1 |
+
jQuery(function(e){e.datepicker.regional.fr={closeText:"Fermer",prevText:"Précédent",nextText:"Suivant",currentText:"Aujourd'hui",monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthNamesShort:["Janv.","Févr.","Mars","Avril","Mai","Juin","Juil.","Août","Sept.","Oct.","Nov.","Déc."],dayNames:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],dayNamesShort:["Dim.","Lun.","Mar.","Mer.","Jeu.","Ven.","Sam."],dayNamesMin:["D","L","M","M","J","V","S"],weekHeader:"Sem.",dateFormat:"dd/mm/yy",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},e.datepicker.setDefaults(e.datepicker.regional.fr)});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/lib/picker.date.js
CHANGED
@@ -1,1354 +1 @@
|
|
1 |
-
/*!
|
2 |
-
* Date picker for pickadate.js v3.5.6
|
3 |
-
* http://amsul.github.io/pickadate.js/date.htm
|
4 |
-
*/
|
5 |
-
|
6 |
-
(function ( factory ) {
|
7 |
-
|
8 |
-
// AMD.
|
9 |
-
if ( typeof define == 'function' && define.amd )
|
10 |
-
define( ['picker', 'jquery'], factory )
|
11 |
-
|
12 |
-
// Node.js/browserify.
|
13 |
-
else if ( typeof exports == 'object' )
|
14 |
-
module.exports = factory( require('./picker.js'), require('jquery') )
|
15 |
-
|
16 |
-
// Browser globals.
|
17 |
-
else factory( Picker, jQuery )
|
18 |
-
|
19 |
-
}(function( Picker, $ ) {
|
20 |
-
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Globals and constants
|
24 |
-
*/
|
25 |
-
var DAYS_IN_WEEK = 7,
|
26 |
-
WEEKS_IN_CALENDAR = 6,
|
27 |
-
_ = Picker._
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
/**
|
32 |
-
* The date picker constructor
|
33 |
-
*/
|
34 |
-
function DatePicker( picker, settings ) {
|
35 |
-
|
36 |
-
var calendar = this,
|
37 |
-
element = picker.$node[ 0 ],
|
38 |
-
elementValue = element.value,
|
39 |
-
elementDataValue = picker.$node.data( 'value' ),
|
40 |
-
valueString = elementDataValue || elementValue,
|
41 |
-
formatString = elementDataValue ? settings.formatSubmit : settings.format,
|
42 |
-
isRTL = function() {
|
43 |
-
|
44 |
-
return element.currentStyle ?
|
45 |
-
|
46 |
-
// For IE.
|
47 |
-
element.currentStyle.direction == 'rtl' :
|
48 |
-
|
49 |
-
// For normal browsers.
|
50 |
-
getComputedStyle( picker.$root[0] ).direction == 'rtl'
|
51 |
-
}
|
52 |
-
|
53 |
-
calendar.settings = settings
|
54 |
-
calendar.$node = picker.$node
|
55 |
-
|
56 |
-
// The queue of methods that will be used to build item objects.
|
57 |
-
calendar.queue = {
|
58 |
-
min: 'measure create',
|
59 |
-
max: 'measure create',
|
60 |
-
now: 'now create',
|
61 |
-
select: 'parse create validate',
|
62 |
-
highlight: 'parse navigate create validate',
|
63 |
-
view: 'parse create validate viewset',
|
64 |
-
disable: 'deactivate',
|
65 |
-
enable: 'activate'
|
66 |
-
}
|
67 |
-
|
68 |
-
// The component's item object.
|
69 |
-
calendar.item = {}
|
70 |
-
|
71 |
-
calendar.item.clear = null
|
72 |
-
calendar.item.disable = ( settings.disable || [] ).slice( 0 )
|
73 |
-
calendar.item.enable = -(function( collectionDisabled ) {
|
74 |
-
return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
|
75 |
-
})( calendar.item.disable )
|
76 |
-
|
77 |
-
calendar.
|
78 |
-
set( 'min', settings.min ).
|
79 |
-
set( 'max', settings.max ).
|
80 |
-
set( 'now' )
|
81 |
-
|
82 |
-
// When there’s a value, set the `select`, which in turn
|
83 |
-
// also sets the `highlight` and `view`.
|
84 |
-
if ( valueString ) {
|
85 |
-
calendar.set( 'select', valueString, {
|
86 |
-
format: formatString,
|
87 |
-
defaultValue: true
|
88 |
-
})
|
89 |
-
}
|
90 |
-
|
91 |
-
// If there’s no value, default to highlighting “today”.
|
92 |
-
else {
|
93 |
-
calendar.
|
94 |
-
set( 'select', null ).
|
95 |
-
set( 'highlight', calendar.item.now )
|
96 |
-
}
|
97 |
-
|
98 |
-
|
99 |
-
// The keycode to movement mapping.
|
100 |
-
calendar.key = {
|
101 |
-
40: 7, // Down
|
102 |
-
38: -7, // Up
|
103 |
-
39: function() { return isRTL() ? -1 : 1 }, // Right
|
104 |
-
37: function() { return isRTL() ? 1 : -1 }, // Left
|
105 |
-
go: function( timeChange ) {
|
106 |
-
var highlightedObject = calendar.item.highlight,
|
107 |
-
targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )
|
108 |
-
calendar.set(
|
109 |
-
'highlight',
|
110 |
-
targetDate,
|
111 |
-
{ interval: timeChange }
|
112 |
-
)
|
113 |
-
this.render()
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
|
118 |
-
// Bind some picker events.
|
119 |
-
picker.
|
120 |
-
on( 'render', function() {
|
121 |
-
picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {
|
122 |
-
var value = this.value
|
123 |
-
if ( value ) {
|
124 |
-
picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )
|
125 |
-
picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )
|
126 |
-
}
|
127 |
-
})
|
128 |
-
picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {
|
129 |
-
var value = this.value
|
130 |
-
if ( value ) {
|
131 |
-
picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )
|
132 |
-
picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )
|
133 |
-
}
|
134 |
-
})
|
135 |
-
}, 1 ).
|
136 |
-
on( 'open', function() {
|
137 |
-
var includeToday = ''
|
138 |
-
if ( calendar.disabled( calendar.get('now') ) ) {
|
139 |
-
includeToday = ':not(.' + settings.klass.buttonToday + ')'
|
140 |
-
}
|
141 |
-
picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )
|
142 |
-
}, 1 ).
|
143 |
-
on( 'close', function() {
|
144 |
-
picker.$root.find( 'button, select' ).attr( 'disabled', true )
|
145 |
-
}, 1 )
|
146 |
-
|
147 |
-
} //DatePicker
|
148 |
-
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Set a datepicker item object.
|
152 |
-
*/
|
153 |
-
DatePicker.prototype.set = function( type, value, options ) {
|
154 |
-
|
155 |
-
var calendar = this,
|
156 |
-
calendarItem = calendar.item
|
157 |
-
|
158 |
-
// If the value is `null` just set it immediately.
|
159 |
-
if ( value === null ) {
|
160 |
-
if ( type == 'clear' ) type = 'select'
|
161 |
-
calendarItem[ type ] = value
|
162 |
-
return calendar
|
163 |
-
}
|
164 |
-
|
165 |
-
// Otherwise go through the queue of methods, and invoke the functions.
|
166 |
-
// Update this as the time unit, and set the final value as this item.
|
167 |
-
// * In the case of `enable`, keep the queue but set `disable` instead.
|
168 |
-
// And in the case of `flip`, keep the queue but set `enable` instead.
|
169 |
-
calendarItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = calendar.queue[ type ].split( ' ' ).map( function( method ) {
|
170 |
-
value = calendar[ method ]( type, value, options )
|
171 |
-
return value
|
172 |
-
}).pop()
|
173 |
-
|
174 |
-
// Check if we need to cascade through more updates.
|
175 |
-
if ( type == 'select' ) {
|
176 |
-
calendar.set( 'highlight', calendarItem.select, options )
|
177 |
-
}
|
178 |
-
else if ( type == 'highlight' ) {
|
179 |
-
calendar.set( 'view', calendarItem.highlight, options )
|
180 |
-
}
|
181 |
-
else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
|
182 |
-
if ( calendarItem.select && calendar.disabled( calendarItem.select ) ) {
|
183 |
-
calendar.set( 'select', calendarItem.select, options )
|
184 |
-
}
|
185 |
-
if ( calendarItem.highlight && calendar.disabled( calendarItem.highlight ) ) {
|
186 |
-
calendar.set( 'highlight', calendarItem.highlight, options )
|
187 |
-
}
|
188 |
-
}
|
189 |
-
|
190 |
-
return calendar
|
191 |
-
} //DatePicker.prototype.set
|
192 |
-
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Get a datepicker item object.
|
196 |
-
*/
|
197 |
-
DatePicker.prototype.get = function( type ) {
|
198 |
-
return this.item[ type ]
|
199 |
-
} //DatePicker.prototype.get
|
200 |
-
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Create a picker date object.
|
204 |
-
*/
|
205 |
-
DatePicker.prototype.create = function( type, value, options ) {
|
206 |
-
|
207 |
-
var isInfiniteValue,
|
208 |
-
calendar = this
|
209 |
-
|
210 |
-
// If there’s no value, use the type as the value.
|
211 |
-
value = value === undefined ? type : value
|
212 |
-
|
213 |
-
|
214 |
-
// If it’s infinity, update the value.
|
215 |
-
if ( value == -Infinity || value == Infinity ) {
|
216 |
-
isInfiniteValue = value
|
217 |
-
}
|
218 |
-
|
219 |
-
// If it’s an object, use the native date object.
|
220 |
-
else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
|
221 |
-
value = value.obj
|
222 |
-
}
|
223 |
-
|
224 |
-
// If it’s an array, convert it into a date and make sure
|
225 |
-
// that it’s a valid date – otherwise default to today.
|
226 |
-
else if ( $.isArray( value ) ) {
|
227 |
-
value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
|
228 |
-
value = _.isDate( value ) ? value : calendar.create().obj
|
229 |
-
}
|
230 |
-
|
231 |
-
// If it’s a number or date object, make a normalized date.
|
232 |
-
else if ( _.isInteger( value ) || _.isDate( value ) ) {
|
233 |
-
value = calendar.normalize( new Date( value ), options )
|
234 |
-
}
|
235 |
-
|
236 |
-
// If it’s a literal true or any other case, set it to now.
|
237 |
-
else /*if ( value === true )*/ {
|
238 |
-
value = calendar.now( type, value, options )
|
239 |
-
}
|
240 |
-
|
241 |
-
// Return the compiled object.
|
242 |
-
return {
|
243 |
-
year: isInfiniteValue || value.getFullYear(),
|
244 |
-
month: isInfiniteValue || value.getMonth(),
|
245 |
-
date: isInfiniteValue || value.getDate(),
|
246 |
-
day: isInfiniteValue || value.getDay(),
|
247 |
-
obj: isInfiniteValue || value,
|
248 |
-
pick: isInfiniteValue || value.getTime()
|
249 |
-
}
|
250 |
-
} //DatePicker.prototype.create
|
251 |
-
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Create a range limit object using an array, date object,
|
255 |
-
* literal “true”, or integer relative to another time.
|
256 |
-
*/
|
257 |
-
DatePicker.prototype.createRange = function( from, to ) {
|
258 |
-
|
259 |
-
var calendar = this,
|
260 |
-
createDate = function( date ) {
|
261 |
-
if ( date === true || $.isArray( date ) || _.isDate( date ) ) {
|
262 |
-
return calendar.create( date )
|
263 |
-
}
|
264 |
-
return date
|
265 |
-
}
|
266 |
-
|
267 |
-
// Create objects if possible.
|
268 |
-
if ( !_.isInteger( from ) ) {
|
269 |
-
from = createDate( from )
|
270 |
-
}
|
271 |
-
if ( !_.isInteger( to ) ) {
|
272 |
-
to = createDate( to )
|
273 |
-
}
|
274 |
-
|
275 |
-
// Create relative dates.
|
276 |
-
if ( _.isInteger( from ) && $.isPlainObject( to ) ) {
|
277 |
-
from = [ to.year, to.month, to.date + from ];
|
278 |
-
}
|
279 |
-
else if ( _.isInteger( to ) && $.isPlainObject( from ) ) {
|
280 |
-
to = [ from.year, from.month, from.date + to ];
|
281 |
-
}
|
282 |
-
|
283 |
-
return {
|
284 |
-
from: createDate( from ),
|
285 |
-
to: createDate( to )
|
286 |
-
}
|
287 |
-
} //DatePicker.prototype.createRange
|
288 |
-
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Check if a date unit falls within a date range object.
|
292 |
-
*/
|
293 |
-
DatePicker.prototype.withinRange = function( range, dateUnit ) {
|
294 |
-
range = this.createRange(range.from, range.to)
|
295 |
-
return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick
|
296 |
-
}
|
297 |
-
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Check if two date range objects overlap.
|
301 |
-
*/
|
302 |
-
DatePicker.prototype.overlapRanges = function( one, two ) {
|
303 |
-
|
304 |
-
var calendar = this
|
305 |
-
|
306 |
-
// Convert the ranges into comparable dates.
|
307 |
-
one = calendar.createRange( one.from, one.to )
|
308 |
-
two = calendar.createRange( two.from, two.to )
|
309 |
-
|
310 |
-
return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) ||
|
311 |
-
calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to )
|
312 |
-
}
|
313 |
-
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Get the date today.
|
317 |
-
*/
|
318 |
-
DatePicker.prototype.now = function( type, value, options ) {
|
319 |
-
value = new Date()
|
320 |
-
if ( options && options.rel ) {
|
321 |
-
value.setDate( value.getDate() + options.rel )
|
322 |
-
}
|
323 |
-
return this.normalize( value, options )
|
324 |
-
}
|
325 |
-
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Navigate to next/prev month.
|
329 |
-
*/
|
330 |
-
DatePicker.prototype.navigate = function( type, value, options ) {
|
331 |
-
|
332 |
-
var targetDateObject,
|
333 |
-
targetYear,
|
334 |
-
targetMonth,
|
335 |
-
targetDate,
|
336 |
-
isTargetArray = $.isArray( value ),
|
337 |
-
isTargetObject = $.isPlainObject( value ),
|
338 |
-
viewsetObject = this.item.view/*,
|
339 |
-
safety = 100*/
|
340 |
-
|
341 |
-
|
342 |
-
if ( isTargetArray || isTargetObject ) {
|
343 |
-
|
344 |
-
if ( isTargetObject ) {
|
345 |
-
targetYear = value.year
|
346 |
-
targetMonth = value.month
|
347 |
-
targetDate = value.date
|
348 |
-
}
|
349 |
-
else {
|
350 |
-
targetYear = +value[0]
|
351 |
-
targetMonth = +value[1]
|
352 |
-
targetDate = +value[2]
|
353 |
-
}
|
354 |
-
|
355 |
-
// If we’re navigating months but the view is in a different
|
356 |
-
// month, navigate to the view’s year and month.
|
357 |
-
if ( options && options.nav && viewsetObject && viewsetObject.month !== targetMonth ) {
|
358 |
-
targetYear = viewsetObject.year
|
359 |
-
targetMonth = viewsetObject.month
|
360 |
-
}
|
361 |
-
|
362 |
-
// Figure out the expected target year and month.
|
363 |
-
targetDateObject = new Date( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 )
|
364 |
-
targetYear = targetDateObject.getFullYear()
|
365 |
-
targetMonth = targetDateObject.getMonth()
|
366 |
-
|
367 |
-
// If the month we’re going to doesn’t have enough days,
|
368 |
-
// keep decreasing the date until we reach the month’s last date.
|
369 |
-
while ( /*safety &&*/ new Date( targetYear, targetMonth, targetDate ).getMonth() !== targetMonth ) {
|
370 |
-
targetDate -= 1
|
371 |
-
/*safety -= 1
|
372 |
-
if ( !safety ) {
|
373 |
-
throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
|
374 |
-
}*/
|
375 |
-
}
|
376 |
-
|
377 |
-
value = [ targetYear, targetMonth, targetDate ]
|
378 |
-
}
|
379 |
-
|
380 |
-
return value
|
381 |
-
} //DatePicker.prototype.navigate
|
382 |
-
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Normalize a date by setting the hours to midnight.
|
386 |
-
*/
|
387 |
-
DatePicker.prototype.normalize = function( value/*, options*/ ) {
|
388 |
-
value.setHours( 0, 0, 0, 0 )
|
389 |
-
return value
|
390 |
-
}
|
391 |
-
|
392 |
-
|
393 |
-
/**
|
394 |
-
* Measure the range of dates.
|
395 |
-
*/
|
396 |
-
DatePicker.prototype.measure = function( type, value/*, options*/ ) {
|
397 |
-
|
398 |
-
var calendar = this
|
399 |
-
|
400 |
-
// If it’s anything false-y, remove the limits.
|
401 |
-
if ( !value ) {
|
402 |
-
value = type == 'min' ? -Infinity : Infinity
|
403 |
-
}
|
404 |
-
|
405 |
-
// If it’s a string, parse it.
|
406 |
-
else if ( typeof value == 'string' ) {
|
407 |
-
value = calendar.parse( type, value )
|
408 |
-
}
|
409 |
-
|
410 |
-
// If it's an integer, get a date relative to today.
|
411 |
-
else if ( _.isInteger( value ) ) {
|
412 |
-
value = calendar.now( type, value, { rel: value } )
|
413 |
-
}
|
414 |
-
|
415 |
-
return value
|
416 |
-
} ///DatePicker.prototype.measure
|
417 |
-
|
418 |
-
|
419 |
-
/**
|
420 |
-
* Create a viewset object based on navigation.
|
421 |
-
*/
|
422 |
-
DatePicker.prototype.viewset = function( type, dateObject/*, options*/ ) {
|
423 |
-
return this.create([ dateObject.year, dateObject.month, 1 ])
|
424 |
-
}
|
425 |
-
|
426 |
-
|
427 |
-
/**
|
428 |
-
* Validate a date as enabled and shift if needed.
|
429 |
-
*/
|
430 |
-
DatePicker.prototype.validate = function( type, dateObject, options ) {
|
431 |
-
|
432 |
-
var calendar = this,
|
433 |
-
|
434 |
-
// Keep a reference to the original date.
|
435 |
-
originalDateObject = dateObject,
|
436 |
-
|
437 |
-
// Make sure we have an interval.
|
438 |
-
interval = options && options.interval ? options.interval : 1,
|
439 |
-
|
440 |
-
// Check if the calendar enabled dates are inverted.
|
441 |
-
isFlippedBase = calendar.item.enable === -1,
|
442 |
-
|
443 |
-
// Check if we have any enabled dates after/before now.
|
444 |
-
hasEnabledBeforeTarget, hasEnabledAfterTarget,
|
445 |
-
|
446 |
-
// The min & max limits.
|
447 |
-
minLimitObject = calendar.item.min,
|
448 |
-
maxLimitObject = calendar.item.max,
|
449 |
-
|
450 |
-
// Check if we’ve reached the limit during shifting.
|
451 |
-
reachedMin, reachedMax,
|
452 |
-
|
453 |
-
// Check if the calendar is inverted and at least one weekday is enabled.
|
454 |
-
hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter( function( value ) {
|
455 |
-
|
456 |
-
// If there’s a date, check where it is relative to the target.
|
457 |
-
if ( $.isArray( value ) ) {
|
458 |
-
var dateTime = calendar.create( value ).pick
|
459 |
-
if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true
|
460 |
-
else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true
|
461 |
-
}
|
462 |
-
|
463 |
-
// Return only integers for enabled weekdays.
|
464 |
-
return _.isInteger( value )
|
465 |
-
}).length/*,
|
466 |
-
|
467 |
-
safety = 100*/
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
// Cases to validate for:
|
472 |
-
// [1] Not inverted and date disabled.
|
473 |
-
// [2] Inverted and some dates enabled.
|
474 |
-
// [3] Not inverted and out of range.
|
475 |
-
//
|
476 |
-
// Cases to **not** validate for:
|
477 |
-
// • Navigating months.
|
478 |
-
// • Not inverted and date enabled.
|
479 |
-
// • Inverted and all dates disabled.
|
480 |
-
// • ..and anything else.
|
481 |
-
if ( !options || (!options.nav && !options.defaultValue) ) if (
|
482 |
-
/* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
|
483 |
-
/* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
|
484 |
-
/* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
|
485 |
-
) {
|
486 |
-
|
487 |
-
|
488 |
-
// When inverted, flip the direction if there aren’t any enabled weekdays
|
489 |
-
// and there are no enabled dates in the direction of the interval.
|
490 |
-
if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) {
|
491 |
-
interval *= -1
|
492 |
-
}
|
493 |
-
|
494 |
-
|
495 |
-
// Keep looping until we reach an enabled date.
|
496 |
-
while ( /*safety &&*/ calendar.disabled( dateObject ) ) {
|
497 |
-
|
498 |
-
/*safety -= 1
|
499 |
-
if ( !safety ) {
|
500 |
-
throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
|
501 |
-
}*/
|
502 |
-
|
503 |
-
|
504 |
-
// If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
|
505 |
-
if ( Math.abs( interval ) > 1 && ( dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month ) ) {
|
506 |
-
dateObject = originalDateObject
|
507 |
-
interval = interval > 0 ? 1 : -1
|
508 |
-
}
|
509 |
-
|
510 |
-
|
511 |
-
// If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
|
512 |
-
if ( dateObject.pick <= minLimitObject.pick ) {
|
513 |
-
reachedMin = true
|
514 |
-
interval = 1
|
515 |
-
dateObject = calendar.create([
|
516 |
-
minLimitObject.year,
|
517 |
-
minLimitObject.month,
|
518 |
-
minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
|
519 |
-
])
|
520 |
-
}
|
521 |
-
else if ( dateObject.pick >= maxLimitObject.pick ) {
|
522 |
-
reachedMax = true
|
523 |
-
interval = -1
|
524 |
-
dateObject = calendar.create([
|
525 |
-
maxLimitObject.year,
|
526 |
-
maxLimitObject.month,
|
527 |
-
maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
|
528 |
-
])
|
529 |
-
}
|
530 |
-
|
531 |
-
|
532 |
-
// If we’ve reached both limits, just break out of the loop.
|
533 |
-
if ( reachedMin && reachedMax ) {
|
534 |
-
break
|
535 |
-
}
|
536 |
-
|
537 |
-
|
538 |
-
// Finally, create the shifted date using the interval and keep looping.
|
539 |
-
dateObject = calendar.create([ dateObject.year, dateObject.month, dateObject.date + interval ])
|
540 |
-
}
|
541 |
-
|
542 |
-
} //endif
|
543 |
-
|
544 |
-
|
545 |
-
// Return the date object settled on.
|
546 |
-
return dateObject
|
547 |
-
} //DatePicker.prototype.validate
|
548 |
-
|
549 |
-
|
550 |
-
/**
|
551 |
-
* Check if a date is disabled.
|
552 |
-
*/
|
553 |
-
DatePicker.prototype.disabled = function( dateToVerify ) {
|
554 |
-
|
555 |
-
var
|
556 |
-
calendar = this,
|
557 |
-
|
558 |
-
// Filter through the disabled dates to check if this is one.
|
559 |
-
isDisabledMatch = calendar.item.disable.filter( function( dateToDisable ) {
|
560 |
-
|
561 |
-
// If the date is a number, match the weekday with 0index and `firstDay` check.
|
562 |
-
if ( _.isInteger( dateToDisable ) ) {
|
563 |
-
return dateToVerify.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7
|
564 |
-
}
|
565 |
-
|
566 |
-
// If it’s an array or a native JS date, create and match the exact date.
|
567 |
-
if ( $.isArray( dateToDisable ) || _.isDate( dateToDisable ) ) {
|
568 |
-
return dateToVerify.pick === calendar.create( dateToDisable ).pick
|
569 |
-
}
|
570 |
-
|
571 |
-
// If it’s an object, match a date within the “from” and “to” range.
|
572 |
-
if ( $.isPlainObject( dateToDisable ) ) {
|
573 |
-
return calendar.withinRange( dateToDisable, dateToVerify )
|
574 |
-
}
|
575 |
-
})
|
576 |
-
|
577 |
-
// If this date matches a disabled date, confirm it’s not inverted.
|
578 |
-
isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( dateToDisable ) {
|
579 |
-
return $.isArray( dateToDisable ) && dateToDisable[3] == 'inverted' ||
|
580 |
-
$.isPlainObject( dateToDisable ) && dateToDisable.inverted
|
581 |
-
}).length
|
582 |
-
|
583 |
-
// Check the calendar “enabled” flag and respectively flip the
|
584 |
-
// disabled state. Then also check if it’s beyond the min/max limits.
|
585 |
-
return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
|
586 |
-
dateToVerify.pick < calendar.item.min.pick ||
|
587 |
-
dateToVerify.pick > calendar.item.max.pick
|
588 |
-
|
589 |
-
} //DatePicker.prototype.disabled
|
590 |
-
|
591 |
-
|
592 |
-
/**
|
593 |
-
* Parse a string into a usable type.
|
594 |
-
*/
|
595 |
-
DatePicker.prototype.parse = function( type, value, options ) {
|
596 |
-
|
597 |
-
var calendar = this,
|
598 |
-
parsingObject = {}
|
599 |
-
|
600 |
-
// If it’s already parsed, we’re good.
|
601 |
-
if ( !value || typeof value != 'string' ) {
|
602 |
-
return value
|
603 |
-
}
|
604 |
-
|
605 |
-
// We need a `.format` to parse the value with.
|
606 |
-
if ( !( options && options.format ) ) {
|
607 |
-
options = options || {}
|
608 |
-
options.format = calendar.settings.format
|
609 |
-
}
|
610 |
-
|
611 |
-
// Convert the format into an array and then map through it.
|
612 |
-
calendar.formats.toArray( options.format ).map( function( label ) {
|
613 |
-
|
614 |
-
var
|
615 |
-
// Grab the formatting label.
|
616 |
-
formattingLabel = calendar.formats[ label ],
|
617 |
-
|
618 |
-
// The format length is from the formatting label function or the
|
619 |
-
// label length without the escaping exclamation (!) mark.
|
620 |
-
formatLength = formattingLabel ? _.trigger( formattingLabel, calendar, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length
|
621 |
-
|
622 |
-
// If there's a format label, split the value up to the format length.
|
623 |
-
// Then add it to the parsing object with appropriate label.
|
624 |
-
if ( formattingLabel ) {
|
625 |
-
parsingObject[ label ] = value.substr( 0, formatLength )
|
626 |
-
}
|
627 |
-
|
628 |
-
// Update the value as the substring from format length to end.
|
629 |
-
value = value.substr( formatLength )
|
630 |
-
})
|
631 |
-
|
632 |
-
// Compensate for month 0index.
|
633 |
-
return [
|
634 |
-
parsingObject.yyyy || parsingObject.yy,
|
635 |
-
+( parsingObject.mm || parsingObject.m ) - 1,
|
636 |
-
parsingObject.dd || parsingObject.d
|
637 |
-
]
|
638 |
-
} //DatePicker.prototype.parse
|
639 |
-
|
640 |
-
|
641 |
-
/**
|
642 |
-
* Various formats to display the object in.
|
643 |
-
*/
|
644 |
-
DatePicker.prototype.formats = (function() {
|
645 |
-
|
646 |
-
// Return the length of the first word in a collection.
|
647 |
-
function getWordLengthFromCollection( string, collection, dateObject ) {
|
648 |
-
|
649 |
-
// Grab the first word from the string.
|
650 |
-
// Regex pattern from http://stackoverflow.com/q/150033
|
651 |
-
var word = string.match( /[^\x00-\x7F]+|\w+/ )[ 0 ]
|
652 |
-
|
653 |
-
// If there's no month index, add it to the date object
|
654 |
-
if ( !dateObject.mm && !dateObject.m ) {
|
655 |
-
dateObject.m = collection.indexOf( word ) + 1
|
656 |
-
}
|
657 |
-
|
658 |
-
// Return the length of the word.
|
659 |
-
return word.length
|
660 |
-
}
|
661 |
-
|
662 |
-
// Get the length of the first word in a string.
|
663 |
-
function getFirstWordLength( string ) {
|
664 |
-
return string.match( /\w+/ )[ 0 ].length
|
665 |
-
}
|
666 |
-
|
667 |
-
return {
|
668 |
-
|
669 |
-
d: function( string, dateObject ) {
|
670 |
-
|
671 |
-
// If there's string, then get the digits length.
|
672 |
-
// Otherwise return the selected date.
|
673 |
-
return string ? _.digits( string ) : dateObject.date
|
674 |
-
},
|
675 |
-
dd: function( string, dateObject ) {
|
676 |
-
|
677 |
-
// If there's a string, then the length is always 2.
|
678 |
-
// Otherwise return the selected date with a leading zero.
|
679 |
-
return string ? 2 : _.lead( dateObject.date )
|
680 |
-
},
|
681 |
-
ddd: function( string, dateObject ) {
|
682 |
-
|
683 |
-
// If there's a string, then get the length of the first word.
|
684 |
-
// Otherwise return the short selected weekday.
|
685 |
-
return string ? getFirstWordLength( string ) : this.settings.weekdaysShort[ dateObject.day ]
|
686 |
-
},
|
687 |
-
dddd: function( string, dateObject ) {
|
688 |
-
|
689 |
-
// If there's a string, then get the length of the first word.
|
690 |
-
// Otherwise return the full selected weekday.
|
691 |
-
return string ? getFirstWordLength( string ) : this.settings.weekdaysFull[ dateObject.day ]
|
692 |
-
},
|
693 |
-
m: function( string, dateObject ) {
|
694 |
-
|
695 |
-
// If there's a string, then get the length of the digits
|
696 |
-
// Otherwise return the selected month with 0index compensation.
|
697 |
-
return string ? _.digits( string ) : dateObject.month + 1
|
698 |
-
},
|
699 |
-
mm: function( string, dateObject ) {
|
700 |
-
|
701 |
-
// If there's a string, then the length is always 2.
|
702 |
-
// Otherwise return the selected month with 0index and leading zero.
|
703 |
-
return string ? 2 : _.lead( dateObject.month + 1 )
|
704 |
-
},
|
705 |
-
mmm: function( string, dateObject ) {
|
706 |
-
|
707 |
-
var collection = this.settings.monthsShort
|
708 |
-
|
709 |
-
// If there's a string, get length of the relevant month from the short
|
710 |
-
// months collection. Otherwise return the selected month from that collection.
|
711 |
-
return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
|
712 |
-
},
|
713 |
-
mmmm: function( string, dateObject ) {
|
714 |
-
|
715 |
-
var collection = this.settings.monthsFull
|
716 |
-
|
717 |
-
// If there's a string, get length of the relevant month from the full
|
718 |
-
// months collection. Otherwise return the selected month from that collection.
|
719 |
-
return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
|
720 |
-
},
|
721 |
-
yy: function( string, dateObject ) {
|
722 |
-
|
723 |
-
// If there's a string, then the length is always 2.
|
724 |
-
// Otherwise return the selected year by slicing out the first 2 digits.
|
725 |
-
return string ? 2 : ( '' + dateObject.year ).slice( 2 )
|
726 |
-
},
|
727 |
-
yyyy: function( string, dateObject ) {
|
728 |
-
|
729 |
-
// If there's a string, then the length is always 4.
|
730 |
-
// Otherwise return the selected year.
|
731 |
-
return string ? 4 : dateObject.year
|
732 |
-
},
|
733 |
-
|
734 |
-
// Create an array by splitting the formatting string passed.
|
735 |
-
toArray: function( formatString ) { return formatString.split( /(d{1,4}|m{1,4}|y{4}|yy|!.)/g ) },
|
736 |
-
|
737 |
-
// Format an object into a string using the formatting options.
|
738 |
-
toString: function ( formatString, itemObject ) {
|
739 |
-
var calendar = this
|
740 |
-
return calendar.formats.toArray( formatString ).map( function( label ) {
|
741 |
-
return _.trigger( calendar.formats[ label ], calendar, [ 0, itemObject ] ) || label.replace( /^!/, '' )
|
742 |
-
}).join( '' )
|
743 |
-
}
|
744 |
-
}
|
745 |
-
})() //DatePicker.prototype.formats
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
/**
|
751 |
-
* Check if two date units are the exact.
|
752 |
-
*/
|
753 |
-
DatePicker.prototype.isDateExact = function( one, two ) {
|
754 |
-
|
755 |
-
var calendar = this
|
756 |
-
|
757 |
-
// When we’re working with weekdays, do a direct comparison.
|
758 |
-
if (
|
759 |
-
( _.isInteger( one ) && _.isInteger( two ) ) ||
|
760 |
-
( typeof one == 'boolean' && typeof two == 'boolean' )
|
761 |
-
) {
|
762 |
-
return one === two
|
763 |
-
}
|
764 |
-
|
765 |
-
// When we’re working with date representations, compare the “pick” value.
|
766 |
-
if (
|
767 |
-
( _.isDate( one ) || $.isArray( one ) ) &&
|
768 |
-
( _.isDate( two ) || $.isArray( two ) )
|
769 |
-
) {
|
770 |
-
return calendar.create( one ).pick === calendar.create( two ).pick
|
771 |
-
}
|
772 |
-
|
773 |
-
// When we’re working with range objects, compare the “from” and “to”.
|
774 |
-
if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
|
775 |
-
return calendar.isDateExact( one.from, two.from ) && calendar.isDateExact( one.to, two.to )
|
776 |
-
}
|
777 |
-
|
778 |
-
return false
|
779 |
-
}
|
780 |
-
|
781 |
-
|
782 |
-
/**
|
783 |
-
* Check if two date units overlap.
|
784 |
-
*/
|
785 |
-
DatePicker.prototype.isDateOverlap = function( one, two ) {
|
786 |
-
|
787 |
-
var calendar = this,
|
788 |
-
firstDay = calendar.settings.firstDay ? 1 : 0
|
789 |
-
|
790 |
-
// When we’re working with a weekday index, compare the days.
|
791 |
-
if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) {
|
792 |
-
one = one % 7 + firstDay
|
793 |
-
return one === calendar.create( two ).day + 1
|
794 |
-
}
|
795 |
-
if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) {
|
796 |
-
two = two % 7 + firstDay
|
797 |
-
return two === calendar.create( one ).day + 1
|
798 |
-
}
|
799 |
-
|
800 |
-
// When we’re working with range objects, check if the ranges overlap.
|
801 |
-
if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
|
802 |
-
return calendar.overlapRanges( one, two )
|
803 |
-
}
|
804 |
-
|
805 |
-
return false
|
806 |
-
}
|
807 |
-
|
808 |
-
|
809 |
-
/**
|
810 |
-
* Flip the “enabled” state.
|
811 |
-
*/
|
812 |
-
DatePicker.prototype.flipEnable = function(val) {
|
813 |
-
var itemObject = this.item
|
814 |
-
itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
|
815 |
-
}
|
816 |
-
|
817 |
-
|
818 |
-
/**
|
819 |
-
* Mark a collection of dates as “disabled”.
|
820 |
-
*/
|
821 |
-
DatePicker.prototype.deactivate = function( type, datesToDisable ) {
|
822 |
-
|
823 |
-
var calendar = this,
|
824 |
-
disabledItems = calendar.item.disable.slice(0)
|
825 |
-
|
826 |
-
|
827 |
-
// If we’re flipping, that’s all we need to do.
|
828 |
-
if ( datesToDisable == 'flip' ) {
|
829 |
-
calendar.flipEnable()
|
830 |
-
}
|
831 |
-
|
832 |
-
else if ( datesToDisable === false ) {
|
833 |
-
calendar.flipEnable(1)
|
834 |
-
disabledItems = []
|
835 |
-
}
|
836 |
-
|
837 |
-
else if ( datesToDisable === true ) {
|
838 |
-
calendar.flipEnable(-1)
|
839 |
-
disabledItems = []
|
840 |
-
}
|
841 |
-
|
842 |
-
// Otherwise go through the dates to disable.
|
843 |
-
else {
|
844 |
-
|
845 |
-
datesToDisable.map(function( unitToDisable ) {
|
846 |
-
|
847 |
-
var matchFound
|
848 |
-
|
849 |
-
// When we have disabled items, check for matches.
|
850 |
-
// If something is matched, immediately break out.
|
851 |
-
for ( var index = 0; index < disabledItems.length; index += 1 ) {
|
852 |
-
if ( calendar.isDateExact( unitToDisable, disabledItems[index] ) ) {
|
853 |
-
matchFound = true
|
854 |
-
break
|
855 |
-
}
|
856 |
-
}
|
857 |
-
|
858 |
-
// If nothing was found, add the validated unit to the collection.
|
859 |
-
if ( !matchFound ) {
|
860 |
-
if (
|
861 |
-
_.isInteger( unitToDisable ) ||
|
862 |
-
_.isDate( unitToDisable ) ||
|
863 |
-
$.isArray( unitToDisable ) ||
|
864 |
-
( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
|
865 |
-
) {
|
866 |
-
disabledItems.push( unitToDisable )
|
867 |
-
}
|
868 |
-
}
|
869 |
-
})
|
870 |
-
}
|
871 |
-
|
872 |
-
// Return the updated collection.
|
873 |
-
return disabledItems
|
874 |
-
} //DatePicker.prototype.deactivate
|
875 |
-
|
876 |
-
|
877 |
-
/**
|
878 |
-
* Mark a collection of dates as “enabled”.
|
879 |
-
*/
|
880 |
-
DatePicker.prototype.activate = function( type, datesToEnable ) {
|
881 |
-
|
882 |
-
var calendar = this,
|
883 |
-
disabledItems = calendar.item.disable,
|
884 |
-
disabledItemsCount = disabledItems.length
|
885 |
-
|
886 |
-
// If we’re flipping, that’s all we need to do.
|
887 |
-
if ( datesToEnable == 'flip' ) {
|
888 |
-
calendar.flipEnable()
|
889 |
-
}
|
890 |
-
|
891 |
-
else if ( datesToEnable === true ) {
|
892 |
-
calendar.flipEnable(1)
|
893 |
-
disabledItems = []
|
894 |
-
}
|
895 |
-
|
896 |
-
else if ( datesToEnable === false ) {
|
897 |
-
calendar.flipEnable(-1)
|
898 |
-
disabledItems = []
|
899 |
-
}
|
900 |
-
|
901 |
-
// Otherwise go through the disabled dates.
|
902 |
-
else {
|
903 |
-
|
904 |
-
datesToEnable.map(function( unitToEnable ) {
|
905 |
-
|
906 |
-
var matchFound,
|
907 |
-
disabledUnit,
|
908 |
-
index,
|
909 |
-
isExactRange
|
910 |
-
|
911 |
-
// Go through the disabled items and try to find a match.
|
912 |
-
for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
913 |
-
|
914 |
-
disabledUnit = disabledItems[index]
|
915 |
-
|
916 |
-
// When an exact match is found, remove it from the collection.
|
917 |
-
if ( calendar.isDateExact( disabledUnit, unitToEnable ) ) {
|
918 |
-
matchFound = disabledItems[index] = null
|
919 |
-
isExactRange = true
|
920 |
-
break
|
921 |
-
}
|
922 |
-
|
923 |
-
// When an overlapped match is found, add the “inverted” state to it.
|
924 |
-
else if ( calendar.isDateOverlap( disabledUnit, unitToEnable ) ) {
|
925 |
-
if ( $.isPlainObject( unitToEnable ) ) {
|
926 |
-
unitToEnable.inverted = true
|
927 |
-
matchFound = unitToEnable
|
928 |
-
}
|
929 |
-
else if ( $.isArray( unitToEnable ) ) {
|
930 |
-
matchFound = unitToEnable
|
931 |
-
if ( !matchFound[3] ) matchFound.push( 'inverted' )
|
932 |
-
}
|
933 |
-
else if ( _.isDate( unitToEnable ) ) {
|
934 |
-
matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
|
935 |
-
}
|
936 |
-
break
|
937 |
-
}
|
938 |
-
}
|
939 |
-
|
940 |
-
// If a match was found, remove a previous duplicate entry.
|
941 |
-
if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
942 |
-
if ( calendar.isDateExact( disabledItems[index], unitToEnable ) ) {
|
943 |
-
disabledItems[index] = null
|
944 |
-
break
|
945 |
-
}
|
946 |
-
}
|
947 |
-
|
948 |
-
// In the event that we’re dealing with an exact range of dates,
|
949 |
-
// make sure there are no “inverted” dates because of it.
|
950 |
-
if ( isExactRange ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
951 |
-
if ( calendar.isDateOverlap( disabledItems[index], unitToEnable ) ) {
|
952 |
-
disabledItems[index] = null
|
953 |
-
break
|
954 |
-
}
|
955 |
-
}
|
956 |
-
|
957 |
-
// If something is still matched, add it into the collection.
|
958 |
-
if ( matchFound ) {
|
959 |
-
disabledItems.push( matchFound )
|
960 |
-
}
|
961 |
-
})
|
962 |
-
}
|
963 |
-
|
964 |
-
// Return the updated collection.
|
965 |
-
return disabledItems.filter(function( val ) { return val != null })
|
966 |
-
} //DatePicker.prototype.activate
|
967 |
-
|
968 |
-
|
969 |
-
/**
|
970 |
-
* Create a string for the nodes in the picker.
|
971 |
-
*/
|
972 |
-
DatePicker.prototype.nodes = function( isOpen ) {
|
973 |
-
|
974 |
-
var
|
975 |
-
calendar = this,
|
976 |
-
settings = calendar.settings,
|
977 |
-
calendarItem = calendar.item,
|
978 |
-
nowObject = calendarItem.now,
|
979 |
-
selectedObject = calendarItem.select,
|
980 |
-
highlightedObject = calendarItem.highlight,
|
981 |
-
viewsetObject = calendarItem.view,
|
982 |
-
disabledCollection = calendarItem.disable,
|
983 |
-
minLimitObject = calendarItem.min,
|
984 |
-
maxLimitObject = calendarItem.max,
|
985 |
-
|
986 |
-
|
987 |
-
// Create the calendar table head using a copy of weekday labels collection.
|
988 |
-
// * We do a copy so we don't mutate the original array.
|
989 |
-
tableHead = (function( collection, fullCollection ) {
|
990 |
-
|
991 |
-
// If the first day should be Monday, move Sunday to the end.
|
992 |
-
if ( settings.firstDay ) {
|
993 |
-
collection.push( collection.shift() )
|
994 |
-
fullCollection.push( fullCollection.shift() )
|
995 |
-
}
|
996 |
-
|
997 |
-
// Create and return the table head group.
|
998 |
-
return _.node(
|
999 |
-
'thead',
|
1000 |
-
_.node(
|
1001 |
-
'tr',
|
1002 |
-
_.group({
|
1003 |
-
min: 0,
|
1004 |
-
max: DAYS_IN_WEEK - 1,
|
1005 |
-
i: 1,
|
1006 |
-
node: 'th',
|
1007 |
-
item: function( counter ) {
|
1008 |
-
return [
|
1009 |
-
collection[ counter ],
|
1010 |
-
settings.klass.weekdays,
|
1011 |
-
'scope=col title="' + fullCollection[ counter ] + '"'
|
1012 |
-
]
|
1013 |
-
}
|
1014 |
-
})
|
1015 |
-
)
|
1016 |
-
) //endreturn
|
1017 |
-
})( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead
|
1018 |
-
|
1019 |
-
|
1020 |
-
// Create the nav for next/prev month.
|
1021 |
-
createMonthNav = function( next ) {
|
1022 |
-
|
1023 |
-
// Otherwise, return the created month tag.
|
1024 |
-
return _.node(
|
1025 |
-
'div',
|
1026 |
-
' ',
|
1027 |
-
settings.klass[ 'nav' + ( next ? 'Next' : 'Prev' ) ] + (
|
1028 |
-
|
1029 |
-
// If the focused month is outside the range, disabled the button.
|
1030 |
-
( next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month ) ||
|
1031 |
-
( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ?
|
1032 |
-
' ' + settings.klass.navDisabled : ''
|
1033 |
-
),
|
1034 |
-
'data-nav=' + ( next || -1 ) + ' ' +
|
1035 |
-
_.ariaAttr({
|
1036 |
-
role: 'button',
|
1037 |
-
controls: calendar.$node[0].id + '_table'
|
1038 |
-
}) + ' ' +
|
1039 |
-
'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"'
|
1040 |
-
) //endreturn
|
1041 |
-
}, //createMonthNav
|
1042 |
-
|
1043 |
-
|
1044 |
-
// Create the month label.
|
1045 |
-
createMonthLabel = function() {
|
1046 |
-
|
1047 |
-
var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull
|
1048 |
-
|
1049 |
-
// If there are months to select, add a dropdown menu.
|
1050 |
-
if ( settings.selectMonths ) {
|
1051 |
-
|
1052 |
-
return _.node( 'select',
|
1053 |
-
_.group({
|
1054 |
-
min: 0,
|
1055 |
-
max: 11,
|
1056 |
-
i: 1,
|
1057 |
-
node: 'option',
|
1058 |
-
item: function( loopedMonth ) {
|
1059 |
-
|
1060 |
-
return [
|
1061 |
-
|
1062 |
-
// The looped month and no classes.
|
1063 |
-
monthsCollection[ loopedMonth ], 0,
|
1064 |
-
|
1065 |
-
// Set the value and selected index.
|
1066 |
-
'value=' + loopedMonth +
|
1067 |
-
( viewsetObject.month == loopedMonth ? ' selected' : '' ) +
|
1068 |
-
(
|
1069 |
-
(
|
1070 |
-
( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) ||
|
1071 |
-
( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month )
|
1072 |
-
) ?
|
1073 |
-
' disabled' : ''
|
1074 |
-
)
|
1075 |
-
]
|
1076 |
-
}
|
1077 |
-
}),
|
1078 |
-
settings.klass.selectMonth,
|
1079 |
-
( isOpen ? '' : 'disabled' ) + ' ' +
|
1080 |
-
_.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
|
1081 |
-
'title="' + settings.labelMonthSelect + '"'
|
1082 |
-
)
|
1083 |
-
}
|
1084 |
-
|
1085 |
-
// If there's a need for a month selector
|
1086 |
-
return _.node( 'div', monthsCollection[ viewsetObject.month ], settings.klass.month )
|
1087 |
-
}, //createMonthLabel
|
1088 |
-
|
1089 |
-
|
1090 |
-
// Create the year label.
|
1091 |
-
createYearLabel = function() {
|
1092 |
-
|
1093 |
-
var focusedYear = viewsetObject.year,
|
1094 |
-
|
1095 |
-
// If years selector is set to a literal "true", set it to 5. Otherwise
|
1096 |
-
// divide in half to get half before and half after focused year.
|
1097 |
-
numberYears = settings.selectYears === true ? 5 : ~~( settings.selectYears / 2 )
|
1098 |
-
|
1099 |
-
// If there are years to select, add a dropdown menu.
|
1100 |
-
if ( numberYears ) {
|
1101 |
-
|
1102 |
-
var
|
1103 |
-
minYear = minLimitObject.year,
|
1104 |
-
maxYear = maxLimitObject.year,
|
1105 |
-
lowestYear = focusedYear - numberYears,
|
1106 |
-
highestYear = focusedYear + numberYears
|
1107 |
-
|
1108 |
-
// If the min year is greater than the lowest year, increase the highest year
|
1109 |
-
// by the difference and set the lowest year to the min year.
|
1110 |
-
if ( minYear > lowestYear ) {
|
1111 |
-
highestYear += minYear - lowestYear
|
1112 |
-
lowestYear = minYear
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
// If the max year is less than the highest year, decrease the lowest year
|
1116 |
-
// by the lower of the two: available and needed years. Then set the
|
1117 |
-
// highest year to the max year.
|
1118 |
-
if ( maxYear < highestYear ) {
|
1119 |
-
|
1120 |
-
var availableYears = lowestYear - minYear,
|
1121 |
-
neededYears = highestYear - maxYear
|
1122 |
-
|
1123 |
-
lowestYear -= availableYears > neededYears ? neededYears : availableYears
|
1124 |
-
highestYear = maxYear
|
1125 |
-
}
|
1126 |
-
|
1127 |
-
return _.node( 'select',
|
1128 |
-
_.group({
|
1129 |
-
min: lowestYear,
|
1130 |
-
max: highestYear,
|
1131 |
-
i: 1,
|
1132 |
-
node: 'option',
|
1133 |
-
item: function( loopedYear ) {
|
1134 |
-
return [
|
1135 |
-
|
1136 |
-
// The looped year and no classes.
|
1137 |
-
loopedYear, 0,
|
1138 |
-
|
1139 |
-
// Set the value and selected index.
|
1140 |
-
'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' )
|
1141 |
-
]
|
1142 |
-
}
|
1143 |
-
}),
|
1144 |
-
settings.klass.selectYear,
|
1145 |
-
( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
|
1146 |
-
'title="' + settings.labelYearSelect + '"'
|
1147 |
-
)
|
1148 |
-
}
|
1149 |
-
|
1150 |
-
// Otherwise just return the year focused
|
1151 |
-
return _.node( 'div', focusedYear, settings.klass.year )
|
1152 |
-
} //createYearLabel
|
1153 |
-
|
1154 |
-
|
1155 |
-
// Create and return the entire calendar.
|
1156 |
-
return _.node(
|
1157 |
-
'div',
|
1158 |
-
( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ) +
|
1159 |
-
createMonthNav() + createMonthNav( 1 ),
|
1160 |
-
settings.klass.header
|
1161 |
-
) + _.node(
|
1162 |
-
'table',
|
1163 |
-
tableHead +
|
1164 |
-
_.node(
|
1165 |
-
'tbody',
|
1166 |
-
_.group({
|
1167 |
-
min: 0,
|
1168 |
-
max: WEEKS_IN_CALENDAR - 1,
|
1169 |
-
i: 1,
|
1170 |
-
node: 'tr',
|
1171 |
-
item: function( rowCounter ) {
|
1172 |
-
|
1173 |
-
// If Monday is the first day and the month starts on Sunday, shift the date back a week.
|
1174 |
-
var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0
|
1175 |
-
|
1176 |
-
return [
|
1177 |
-
_.group({
|
1178 |
-
min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
|
1179 |
-
max: function() {
|
1180 |
-
return this.min + DAYS_IN_WEEK - 1
|
1181 |
-
},
|
1182 |
-
i: 1,
|
1183 |
-
node: 'td',
|
1184 |
-
item: function( targetDate ) {
|
1185 |
-
|
1186 |
-
// Convert the time date from a relative date to a target date.
|
1187 |
-
targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ])
|
1188 |
-
|
1189 |
-
var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
|
1190 |
-
isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
|
1191 |
-
isDisabled = disabledCollection && calendar.disabled( targetDate ) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
|
1192 |
-
formattedDate = _.trigger( calendar.formats.toString, calendar, [ settings.format, targetDate ] )
|
1193 |
-
|
1194 |
-
return [
|
1195 |
-
_.node(
|
1196 |
-
'div',
|
1197 |
-
targetDate.date,
|
1198 |
-
(function( klasses ) {
|
1199 |
-
|
1200 |
-
// Add the `infocus` or `outfocus` classes based on month in view.
|
1201 |
-
klasses.push( viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus )
|
1202 |
-
|
1203 |
-
// Add the `today` class if needed.
|
1204 |
-
if ( nowObject.pick == targetDate.pick ) {
|
1205 |
-
klasses.push( settings.klass.now )
|
1206 |
-
}
|
1207 |
-
|
1208 |
-
// Add the `selected` class if something's selected and the time matches.
|
1209 |
-
if ( isSelected ) {
|
1210 |
-
klasses.push( settings.klass.selected )
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
// Add the `highlighted` class if something's highlighted and the time matches.
|
1214 |
-
if ( isHighlighted ) {
|
1215 |
-
klasses.push( settings.klass.highlighted )
|
1216 |
-
}
|
1217 |
-
|
1218 |
-
// Add the `disabled` class if something's disabled and the object matches.
|
1219 |
-
if ( isDisabled ) {
|
1220 |
-
klasses.push( settings.klass.disabled )
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
return klasses.join( ' ' )
|
1224 |
-
})([ settings.klass.day ]),
|
1225 |
-
'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
|
1226 |
-
role: 'gridcell',
|
1227 |
-
label: formattedDate,
|
1228 |
-
selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
|
1229 |
-
activedescendant: isHighlighted ? true : null,
|
1230 |
-
disabled: isDisabled ? true : null
|
1231 |
-
})
|
1232 |
-
),
|
1233 |
-
'',
|
1234 |
-
_.ariaAttr({ role: 'presentation' })
|
1235 |
-
] //endreturn
|
1236 |
-
}
|
1237 |
-
})
|
1238 |
-
] //endreturn
|
1239 |
-
}
|
1240 |
-
})
|
1241 |
-
),
|
1242 |
-
settings.klass.table,
|
1243 |
-
'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
|
1244 |
-
role: 'grid',
|
1245 |
-
controls: calendar.$node[0].id,
|
1246 |
-
readonly: true
|
1247 |
-
})
|
1248 |
-
) +
|
1249 |
-
|
1250 |
-
// * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
|
1251 |
-
_.node(
|
1252 |
-
'div',
|
1253 |
-
_.node( 'button', settings.today, settings.klass.buttonToday,
|
1254 |
-
'type=button data-pick=' + nowObject.pick +
|
1255 |
-
( isOpen && !calendar.disabled(nowObject) ? '' : ' disabled' ) + ' ' +
|
1256 |
-
_.ariaAttr({ controls: calendar.$node[0].id }) ) +
|
1257 |
-
_.node( 'button', settings.clear, settings.klass.buttonClear,
|
1258 |
-
'type=button data-clear=1' +
|
1259 |
-
( isOpen ? '' : ' disabled' ) + ' ' +
|
1260 |
-
_.ariaAttr({ controls: calendar.$node[0].id }) ) +
|
1261 |
-
_.node('button', settings.close, settings.klass.buttonClose,
|
1262 |
-
'type=button data-close=true ' +
|
1263 |
-
( isOpen ? '' : ' disabled' ) + ' ' +
|
1264 |
-
_.ariaAttr({ controls: calendar.$node[0].id }) ),
|
1265 |
-
settings.klass.footer
|
1266 |
-
) //endreturn
|
1267 |
-
} //DatePicker.prototype.nodes
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
/**
|
1273 |
-
* The date picker defaults.
|
1274 |
-
*/
|
1275 |
-
DatePicker.defaults = (function( prefix ) {
|
1276 |
-
|
1277 |
-
return {
|
1278 |
-
|
1279 |
-
// The title label to use for the month nav buttons
|
1280 |
-
labelMonthNext: 'Next month',
|
1281 |
-
labelMonthPrev: 'Previous month',
|
1282 |
-
|
1283 |
-
// The title label to use for the dropdown selectors
|
1284 |
-
labelMonthSelect: 'Select a month',
|
1285 |
-
labelYearSelect: 'Select a year',
|
1286 |
-
|
1287 |
-
// Months and weekdays
|
1288 |
-
monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
|
1289 |
-
monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
|
1290 |
-
weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
|
1291 |
-
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
|
1292 |
-
|
1293 |
-
// Today and clear
|
1294 |
-
today: 'Today',
|
1295 |
-
clear: 'Clear',
|
1296 |
-
close: 'Close',
|
1297 |
-
|
1298 |
-
// Picker close behavior
|
1299 |
-
closeOnSelect: true,
|
1300 |
-
closeOnClear: true,
|
1301 |
-
|
1302 |
-
// The format to show on the `input` element
|
1303 |
-
format: 'd mmmm, yyyy',
|
1304 |
-
|
1305 |
-
// Classes
|
1306 |
-
klass: {
|
1307 |
-
|
1308 |
-
table: prefix + 'table',
|
1309 |
-
|
1310 |
-
header: prefix + 'header',
|
1311 |
-
|
1312 |
-
navPrev: prefix + 'nav--prev',
|
1313 |
-
navNext: prefix + 'nav--next',
|
1314 |
-
navDisabled: prefix + 'nav--disabled',
|
1315 |
-
|
1316 |
-
month: prefix + 'month',
|
1317 |
-
year: prefix + 'year',
|
1318 |
-
|
1319 |
-
selectMonth: prefix + 'select--month',
|
1320 |
-
selectYear: prefix + 'select--year',
|
1321 |
-
|
1322 |
-
weekdays: prefix + 'weekday',
|
1323 |
-
|
1324 |
-
day: prefix + 'day',
|
1325 |
-
disabled: prefix + 'day--disabled',
|
1326 |
-
selected: prefix + 'day--selected',
|
1327 |
-
highlighted: prefix + 'day--highlighted',
|
1328 |
-
now: prefix + 'day--today',
|
1329 |
-
infocus: prefix + 'day--infocus',
|
1330 |
-
outfocus: prefix + 'day--outfocus',
|
1331 |
-
|
1332 |
-
footer: prefix + 'footer',
|
1333 |
-
|
1334 |
-
buttonClear: prefix + 'button--clear',
|
1335 |
-
buttonToday: prefix + 'button--today',
|
1336 |
-
buttonClose: prefix + 'button--close'
|
1337 |
-
}
|
1338 |
-
}
|
1339 |
-
})( Picker.klasses().picker + '__' )
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
/**
|
1346 |
-
* Extend the picker to add the date picker.
|
1347 |
-
*/
|
1348 |
-
Picker.extend( 'pickadate', DatePicker )
|
1349 |
-
|
1350 |
-
|
1351 |
-
}));
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1 |
+
!function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function n(e,t){var n=this,a=e.$node[0],i=a.value,r=e.$node.data("value"),o=r||i,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};n.settings=t,n.$node=e.$node,n.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},n.item={},n.item.clear=null,n.item.disable=(t.disable||[]).slice(0),n.item.enable=-function(e){return e[0]===!0?e.shift():-1}(n.item.disable),n.set("min",t.min).set("max",t.max).set("now"),o?n.set("select",o,{format:s,defaultValue:!0}):n.set("select",null).set("highlight",n.item.now),n.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=n.item.highlight,a=new Date(t.year,t.month,t.date+e);n.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var n=this.value;n&&(e.set("highlight",[e.get("view").year,n,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var n=this.value;n&&(e.set("highlight",[n,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";n.disabled(n.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,i=6,r=e._;n.prototype.set=function(e,t,n){var a=this,i=a.item;return null===t?("clear"==e&&(e="select"),i[e]=t,a):(i["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(i){return t=a[i](e,t,n)}).pop(),"select"==e?a.set("highlight",i.select,n):"highlight"==e?a.set("view",i.highlight,n):e.match(/^(flip|min|max|disable|enable)$/)&&(i.select&&a.disabled(i.select)&&a.set("select",i.select,n),i.highlight&&a.disabled(i.highlight)&&a.set("highlight",i.highlight,n)),a)},n.prototype.get=function(e){return this.item[e]},n.prototype.create=function(e,n,a){var i,o=this;return n=void 0===n?e:n,n==-(1/0)||n==1/0?i=n:t.isPlainObject(n)&&r.isInteger(n.pick)?n=n.obj:t.isArray(n)?(n=new Date(n[0],n[1],n[2]),n=r.isDate(n)?n:o.create().obj):n=r.isInteger(n)||r.isDate(n)?o.normalize(new Date(n),a):o.now(e,n,a),{year:i||n.getFullYear(),month:i||n.getMonth(),date:i||n.getDate(),day:i||n.getDay(),obj:i||n,pick:i||n.getTime()}},n.prototype.createRange=function(e,n){var a=this,i=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=i(e)),r.isInteger(n)||(n=i(n)),r.isInteger(e)&&t.isPlainObject(n)?e=[n.year,n.month,n.date+e]:r.isInteger(n)&&t.isPlainObject(e)&&(n=[e.year,e.month,e.date+n]),{from:i(e),to:i(n)}},n.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},n.prototype.overlapRanges=function(e,t){var n=this;return e=n.createRange(e.from,e.to),t=n.createRange(t.from,t.to),n.withinRange(e,t.from)||n.withinRange(e,t.to)||n.withinRange(t,e.from)||n.withinRange(t,e.to)},n.prototype.now=function(e,t,n){return t=new Date,n&&n.rel&&t.setDate(t.getDate()+n.rel),this.normalize(t,n)},n.prototype.navigate=function(e,n,a){var i,r,o,s,l=t.isArray(n),c=t.isPlainObject(n),d=this.item.view;if(l||c){for(c?(r=n.year,o=n.month,s=n.date):(r=+n[0],o=+n[1],s=+n[2]),a&&a.nav&&d&&d.month!==o&&(r=d.year,o=d.month),i=new Date(r,o+(a&&a.nav?a.nav:0),1),r=i.getFullYear(),o=i.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;n=[r,o,s]}return n},n.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},n.prototype.measure=function(e,t){var n=this;return t?"string"==typeof t?t=n.parse(e,t):r.isInteger(t)&&(t=n.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},n.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},n.prototype.validate=function(e,n,a){var i,o,s,l,c=this,d=n,u=a&&a.interval?a.interval:1,h=-1===c.item.enable,f=c.item.min,m=c.item.max,p=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<n.pick?i=!0:a>n.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(n)||h&&c.disabled(n)&&(p||i||o)||!h&&(n.pick<=f.pick||n.pick>=m.pick)))for(h&&!p&&(!o&&u>0||!i&&0>u)&&(u*=-1);c.disabled(n)&&(Math.abs(u)>1&&(n.month<d.month||n.month>d.month)&&(n=d,u=u>0?1:-1),n.pick<=f.pick?(s=!0,u=1,n=c.create([f.year,f.month,f.date+(n.pick===f.pick?0:-1)])):n.pick>=m.pick&&(l=!0,u=-1,n=c.create([m.year,m.month,m.date+(n.pick===m.pick?0:1)])),!s||!l);)n=c.create([n.year,n.month,n.date+u]);return n},n.prototype.disabled=function(e){var n=this,a=n.item.disable.filter(function(a){return r.isInteger(a)?e.day===(n.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===n.create(a).pick:t.isPlainObject(a)?n.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===n.item.enable?!a:a||e.pick<n.item.min.pick||e.pick>n.item.max.pick},n.prototype.parse=function(e,t,n){var a=this,i={};return t&&"string"==typeof t?(n&&n.format||(n=n||{},n.format=a.settings.format),a.formats.toArray(n.format).map(function(e){var n=a.formats[e],o=n?r.trigger(n,a,[t,i]):e.replace(/^!/,"").length;n&&(i[e]=t.substr(0,o)),t=t.substr(o)}),[i.yyyy||i.yy,+(i.mm||i.m)-1,i.dd||i.d]):t},n.prototype.formats=function(){function e(e,t,n){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return n.mm||n.m||(n.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,n){return e?t(e):this.settings.weekdaysShort[n.day]},dddd:function(e,n){return e?t(e):this.settings.weekdaysFull[n.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,n){var a=this.settings.monthsShort;return t?e(t,a,n):a[n.month]},mmmm:function(t,n){var a=this.settings.monthsFull;return t?e(t,a,n):a[n.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var n=this;return n.formats.toArray(e).map(function(e){return r.trigger(n.formats[e],n,[0,t])||e.replace(/^!/,"")}).join("")}}}(),n.prototype.isDateExact=function(e,n){var a=this;return r.isInteger(e)&&r.isInteger(n)||"boolean"==typeof e&&"boolean"==typeof n?e===n:(r.isDate(e)||t.isArray(e))&&(r.isDate(n)||t.isArray(n))?a.create(e).pick===a.create(n).pick:t.isPlainObject(e)&&t.isPlainObject(n)?a.isDateExact(e.from,n.from)&&a.isDateExact(e.to,n.to):!1},n.prototype.isDateOverlap=function(e,n){var a=this,i=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(n)||t.isArray(n))?(e=e%7+i,e===a.create(n).day+1):r.isInteger(n)&&(r.isDate(e)||t.isArray(e))?(n=n%7+i,n===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(n)?a.overlapRanges(e,n):!1},n.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},n.prototype.deactivate=function(e,n){var a=this,i=a.item.disable.slice(0);return"flip"==n?a.flipEnable():n===!1?(a.flipEnable(1),i=[]):n===!0?(a.flipEnable(-1),i=[]):n.map(function(e){for(var n,o=0;o<i.length;o+=1)if(a.isDateExact(e,i[o])){n=!0;break}n||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&i.push(e)}),i},n.prototype.activate=function(e,n){var a=this,i=a.item.disable,o=i.length;return"flip"==n?a.flipEnable():n===!0?(a.flipEnable(1),i=[]):n===!1?(a.flipEnable(-1),i=[]):n.map(function(e){var n,s,l,c;for(l=0;o>l;l+=1){if(s=i[l],a.isDateExact(s,e)){n=i[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,n=e):t.isArray(e)?(n=e,n[3]||n.push("inverted")):r.isDate(e)&&(n=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(n)for(l=0;o>l;l+=1)if(a.isDateExact(i[l],e)){i[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(i[l],e)){i[l]=null;break}n&&i.push(n)}),i.filter(function(e){return null!=e})},n.prototype.nodes=function(e){var t=this,n=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,d=o.view,u=o.disable,h=o.min,f=o.max,m=function(e,t){return n.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],n.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((n.showWeekdaysFull?n.weekdaysFull:n.weekdaysShort).slice(0),n.weekdaysFull.slice(0)),p=function(e){return r.node("div"," ",n.klass["nav"+(e?"Next":"Prev")]+(e&&d.year>=f.year&&d.month>=f.month||!e&&d.year<=h.year&&d.month<=h.month?" "+n.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?n.labelMonthNext:n.labelMonthPrev)+'"')},y=function(){var a=n.showMonthsShort?n.monthsShort:n.monthsFull;return n.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(d.month==e?" selected":"")+(d.year==h.year&&e<h.month||d.year==f.year&&e>f.month?" disabled":"")]}}),n.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+n.labelMonthSelect+'"'):r.node("div",a[d.month],n.klass.month)},g=function(){var a=d.year,i=n.selectYears===!0?5:~~(n.selectYears/2);if(i){var o=h.year,s=f.year,l=a-i,c=a+i;if(o>l&&(c+=o-l,l=o),c>s){var u=l-o,m=c-s;l-=u>m?m:u,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),n.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+n.labelYearSelect+'"')}return r.node("div",a,n.klass.year)};return r.node("div",(n.selectYears?g()+y():y()+g())+p()+p(1),n.klass.header)+r.node("table",m+r.node("tbody",r.group({min:0,max:i-1,i:1,node:"tr",item:function(e){var i=n.firstDay&&0===t.create([d.year,d.month,1]).day?-7:0;return[r.group({min:a*e-d.day+i+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([d.year,d.month,e+(n.firstDay?1:0)]);var a=l&&l.pick==e.pick,i=c&&c.pick==e.pick,o=u&&t.disabled(e)||e.pick<h.pick||e.pick>f.pick,m=r.trigger(t.formats.toString,t,[n.format,e]);return[r.node("div",e.date,function(t){return t.push(d.month==e.month?n.klass.infocus:n.klass.outfocus),s.pick==e.pick&&t.push(n.klass.now),a&&t.push(n.klass.selected),i&&t.push(n.klass.highlighted),o&&t.push(n.klass.disabled),t.join(" ")}([n.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:m,selected:a&&t.$node.val()===m?!0:null,activedescendant:i?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),n.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",n.today,n.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",n.clear,n.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",n.close,n.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),n.klass.footer)},n.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",n)});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/lib/picker.js
CHANGED
@@ -1,1163 +1 @@
|
|
1 |
-
|
2 |
-
* pickadate.js v3.5.6, 2015/04/20
|
3 |
-
* By Amsul, http://amsul.ca
|
4 |
-
* Hosted on http://amsul.github.io/pickadate.js
|
5 |
-
* Licensed under MIT
|
6 |
-
*/
|
7 |
-
|
8 |
-
(function ( factory ) {
|
9 |
-
|
10 |
-
// AMD.
|
11 |
-
if ( typeof define == 'function' && define.amd )
|
12 |
-
define( 'picker', ['jquery'], factory )
|
13 |
-
|
14 |
-
// Node.js/browserify.
|
15 |
-
else if ( typeof exports == 'object' )
|
16 |
-
module.exports = factory( require('jquery') )
|
17 |
-
|
18 |
-
// Browser globals.
|
19 |
-
else this.Picker = factory( jQuery )
|
20 |
-
|
21 |
-
}(function( $ ) {
|
22 |
-
|
23 |
-
var $window = $( window )
|
24 |
-
var $document = $( document )
|
25 |
-
var $html = $( document.documentElement )
|
26 |
-
var supportsTransitions = document.documentElement.style.transition != null
|
27 |
-
|
28 |
-
|
29 |
-
/**
|
30 |
-
* The picker constructor that creates a blank picker.
|
31 |
-
*/
|
32 |
-
function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
33 |
-
|
34 |
-
// If there’s no element, return the picker constructor.
|
35 |
-
if ( !ELEMENT ) return PickerConstructor
|
36 |
-
|
37 |
-
|
38 |
-
var
|
39 |
-
IS_DEFAULT_THEME = false,
|
40 |
-
|
41 |
-
|
42 |
-
// The state of the picker.
|
43 |
-
STATE = {
|
44 |
-
id: ELEMENT.id || 'P' + Math.abs( ~~(Math.random() * new Date()) )
|
45 |
-
},
|
46 |
-
|
47 |
-
|
48 |
-
// Merge the defaults and options passed.
|
49 |
-
SETTINGS = COMPONENT ? $.extend( true, {}, COMPONENT.defaults, OPTIONS ) : OPTIONS || {},
|
50 |
-
|
51 |
-
|
52 |
-
// Merge the default classes with the settings classes.
|
53 |
-
CLASSES = $.extend( {}, PickerConstructor.klasses(), SETTINGS.klass ),
|
54 |
-
|
55 |
-
|
56 |
-
// The element node wrapper into a jQuery object.
|
57 |
-
$ELEMENT = $( ELEMENT ),
|
58 |
-
|
59 |
-
|
60 |
-
// Pseudo picker constructor.
|
61 |
-
PickerInstance = function() {
|
62 |
-
return this.start()
|
63 |
-
},
|
64 |
-
|
65 |
-
|
66 |
-
// The picker prototype.
|
67 |
-
P = PickerInstance.prototype = {
|
68 |
-
|
69 |
-
constructor: PickerInstance,
|
70 |
-
|
71 |
-
$node: $ELEMENT,
|
72 |
-
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Initialize everything
|
76 |
-
*/
|
77 |
-
start: function() {
|
78 |
-
|
79 |
-
// If it’s already started, do nothing.
|
80 |
-
if ( STATE && STATE.start ) return P
|
81 |
-
|
82 |
-
|
83 |
-
// Update the picker states.
|
84 |
-
STATE.methods = {}
|
85 |
-
STATE.start = true
|
86 |
-
STATE.open = false
|
87 |
-
STATE.type = ELEMENT.type
|
88 |
-
|
89 |
-
|
90 |
-
// Confirm focus state, convert into text input to remove UA stylings,
|
91 |
-
// and set as readonly to prevent keyboard popup.
|
92 |
-
ELEMENT.autofocus = ELEMENT == getActiveElement()
|
93 |
-
ELEMENT.readOnly = !SETTINGS.editable
|
94 |
-
ELEMENT.id = ELEMENT.id || STATE.id
|
95 |
-
if ( ELEMENT.type != 'text' ) {
|
96 |
-
ELEMENT.type = 'text'
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
// Create a new picker component with the settings.
|
101 |
-
P.component = new COMPONENT(P, SETTINGS)
|
102 |
-
|
103 |
-
|
104 |
-
// Create the picker root and then prepare it.
|
105 |
-
P.$root = $( '<div class="' + CLASSES.picker + '" id="' + ELEMENT.id + '_root" />' )
|
106 |
-
prepareElementRoot()
|
107 |
-
|
108 |
-
|
109 |
-
// Create the picker holder and then prepare it.
|
110 |
-
P.$holder = $( createWrappedComponent() ).appendTo( P.$root )
|
111 |
-
prepareElementHolder()
|
112 |
-
|
113 |
-
|
114 |
-
// If there’s a format for the hidden input element, create the element.
|
115 |
-
if ( SETTINGS.formatSubmit ) {
|
116 |
-
prepareElementHidden()
|
117 |
-
}
|
118 |
-
|
119 |
-
|
120 |
-
// Prepare the input element.
|
121 |
-
prepareElement()
|
122 |
-
|
123 |
-
|
124 |
-
// Insert the hidden input as specified in the settings.
|
125 |
-
if ( SETTINGS.containerHidden ) $( SETTINGS.containerHidden ).append( P._hidden )
|
126 |
-
else $ELEMENT.after( P._hidden )
|
127 |
-
|
128 |
-
|
129 |
-
// Insert the root as specified in the settings.
|
130 |
-
if ( SETTINGS.container ) $( SETTINGS.container ).append( P.$root )
|
131 |
-
else $ELEMENT.after( P.$root )
|
132 |
-
|
133 |
-
|
134 |
-
// Bind the default component and settings events.
|
135 |
-
P.on({
|
136 |
-
start: P.component.onStart,
|
137 |
-
render: P.component.onRender,
|
138 |
-
stop: P.component.onStop,
|
139 |
-
open: P.component.onOpen,
|
140 |
-
close: P.component.onClose,
|
141 |
-
set: P.component.onSet
|
142 |
-
}).on({
|
143 |
-
start: SETTINGS.onStart,
|
144 |
-
render: SETTINGS.onRender,
|
145 |
-
stop: SETTINGS.onStop,
|
146 |
-
open: SETTINGS.onOpen,
|
147 |
-
close: SETTINGS.onClose,
|
148 |
-
set: SETTINGS.onSet
|
149 |
-
})
|
150 |
-
|
151 |
-
|
152 |
-
// Once we’re all set, check the theme in use.
|
153 |
-
IS_DEFAULT_THEME = isUsingDefaultTheme( P.$holder[0] )
|
154 |
-
|
155 |
-
|
156 |
-
// If the element has autofocus, open the picker.
|
157 |
-
if ( ELEMENT.autofocus ) {
|
158 |
-
P.open()
|
159 |
-
}
|
160 |
-
|
161 |
-
|
162 |
-
// Trigger queued the “start” and “render” events.
|
163 |
-
return P.trigger( 'start' ).trigger( 'render' )
|
164 |
-
}, //start
|
165 |
-
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Render a new picker
|
169 |
-
*/
|
170 |
-
render: function( entireComponent ) {
|
171 |
-
|
172 |
-
// Insert a new component holder in the root or box.
|
173 |
-
if ( entireComponent ) {
|
174 |
-
P.$holder = $( createWrappedComponent() )
|
175 |
-
prepareElementHolder()
|
176 |
-
P.$root.html( P.$holder )
|
177 |
-
}
|
178 |
-
else P.$root.find( '.' + CLASSES.box ).html( P.component.nodes( STATE.open ) )
|
179 |
-
|
180 |
-
// Trigger the queued “render” events.
|
181 |
-
return P.trigger( 'render' )
|
182 |
-
}, //render
|
183 |
-
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Destroy everything
|
187 |
-
*/
|
188 |
-
stop: function() {
|
189 |
-
|
190 |
-
// If it’s already stopped, do nothing.
|
191 |
-
if ( !STATE.start ) return P
|
192 |
-
|
193 |
-
// Then close the picker.
|
194 |
-
P.close()
|
195 |
-
|
196 |
-
// Remove the hidden field.
|
197 |
-
if ( P._hidden ) {
|
198 |
-
P._hidden.parentNode.removeChild( P._hidden )
|
199 |
-
}
|
200 |
-
|
201 |
-
// Remove the root.
|
202 |
-
P.$root.remove()
|
203 |
-
|
204 |
-
// Remove the input class, remove the stored data, and unbind
|
205 |
-
// the events (after a tick for IE - see `P.close`).
|
206 |
-
$ELEMENT.removeClass( CLASSES.input ).removeData( NAME )
|
207 |
-
setTimeout( function() {
|
208 |
-
$ELEMENT.off( '.' + STATE.id )
|
209 |
-
}, 0)
|
210 |
-
|
211 |
-
// Restore the element state
|
212 |
-
ELEMENT.type = STATE.type
|
213 |
-
ELEMENT.readOnly = false
|
214 |
-
|
215 |
-
// Trigger the queued “stop” events.
|
216 |
-
P.trigger( 'stop' )
|
217 |
-
|
218 |
-
// Reset the picker states.
|
219 |
-
STATE.methods = {}
|
220 |
-
STATE.start = false
|
221 |
-
|
222 |
-
return P
|
223 |
-
}, //stop
|
224 |
-
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Open up the picker
|
228 |
-
*/
|
229 |
-
open: function( dontGiveFocus ) {
|
230 |
-
|
231 |
-
// If it’s already open, do nothing.
|
232 |
-
if ( STATE.open ) return P
|
233 |
-
|
234 |
-
// Add the “active” class.
|
235 |
-
$ELEMENT.addClass( CLASSES.active )
|
236 |
-
aria( ELEMENT, 'expanded', true )
|
237 |
-
|
238 |
-
// * A Firefox bug, when `html` has `overflow:hidden`, results in
|
239 |
-
// killing transitions :(. So add the “opened” state on the next tick.
|
240 |
-
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
|
241 |
-
setTimeout( function() {
|
242 |
-
|
243 |
-
// Add the “opened” class to the picker root.
|
244 |
-
P.$root.addClass( CLASSES.opened )
|
245 |
-
aria( P.$root[0], 'hidden', false )
|
246 |
-
|
247 |
-
}, 0 )
|
248 |
-
|
249 |
-
// If we have to give focus, bind the element and doc events.
|
250 |
-
if ( dontGiveFocus !== false ) {
|
251 |
-
|
252 |
-
// Set it as open.
|
253 |
-
STATE.open = true
|
254 |
-
|
255 |
-
// Prevent the page from scrolling.
|
256 |
-
if ( IS_DEFAULT_THEME ) {
|
257 |
-
$html.
|
258 |
-
css( 'overflow', 'hidden' ).
|
259 |
-
css( 'padding-right', '+=' + getScrollbarWidth() )
|
260 |
-
}
|
261 |
-
|
262 |
-
// Pass focus to the root element’s jQuery object.
|
263 |
-
focusPickerOnceOpened()
|
264 |
-
|
265 |
-
// Bind the document events.
|
266 |
-
$document.on( 'click.' + STATE.id + ' focusin.' + STATE.id, function( event ) {
|
267 |
-
|
268 |
-
var target = event.target
|
269 |
-
|
270 |
-
// If the target of the event is not the element, close the picker picker.
|
271 |
-
// * Don’t worry about clicks or focusins on the root because those don’t bubble up.
|
272 |
-
// Also, for Firefox, a click on an `option` element bubbles up directly
|
273 |
-
// to the doc. So make sure the target wasn't the doc.
|
274 |
-
// * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
|
275 |
-
// which causes the picker to unexpectedly close when right-clicking it. So make
|
276 |
-
// sure the event wasn’t a right-click.
|
277 |
-
if ( target != ELEMENT && target != document && event.which != 3 ) {
|
278 |
-
|
279 |
-
// If the target was the holder that covers the screen,
|
280 |
-
// keep the element focused to maintain tabindex.
|
281 |
-
P.close( target === P.$holder[0] )
|
282 |
-
}
|
283 |
-
|
284 |
-
}).on( 'keydown.' + STATE.id, function( event ) {
|
285 |
-
|
286 |
-
var
|
287 |
-
// Get the keycode.
|
288 |
-
keycode = event.keyCode,
|
289 |
-
|
290 |
-
// Translate that to a selection change.
|
291 |
-
keycodeToMove = P.component.key[ keycode ],
|
292 |
-
|
293 |
-
// Grab the target.
|
294 |
-
target = event.target
|
295 |
-
|
296 |
-
|
297 |
-
// On escape, close the picker and give focus.
|
298 |
-
if ( keycode == 27 ) {
|
299 |
-
P.close( true )
|
300 |
-
}
|
301 |
-
|
302 |
-
|
303 |
-
// Check if there is a key movement or “enter” keypress on the element.
|
304 |
-
else if ( target == P.$holder[0] && ( keycodeToMove || keycode == 13 ) ) {
|
305 |
-
|
306 |
-
// Prevent the default action to stop page movement.
|
307 |
-
event.preventDefault()
|
308 |
-
|
309 |
-
// Trigger the key movement action.
|
310 |
-
if ( keycodeToMove ) {
|
311 |
-
PickerConstructor._.trigger( P.component.key.go, P, [ PickerConstructor._.trigger( keycodeToMove ) ] )
|
312 |
-
}
|
313 |
-
|
314 |
-
// On “enter”, if the highlighted item isn’t disabled, set the value and close.
|
315 |
-
else if ( !P.$root.find( '.' + CLASSES.highlighted ).hasClass( CLASSES.disabled ) ) {
|
316 |
-
P.set( 'select', P.component.item.highlight )
|
317 |
-
if ( SETTINGS.closeOnSelect ) {
|
318 |
-
P.close( true )
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
|
324 |
-
// If the target is within the root and “enter” is pressed,
|
325 |
-
// prevent the default action and trigger a click on the target instead.
|
326 |
-
else if ( $.contains( P.$root[0], target ) && keycode == 13 ) {
|
327 |
-
event.preventDefault()
|
328 |
-
target.click()
|
329 |
-
}
|
330 |
-
})
|
331 |
-
}
|
332 |
-
|
333 |
-
// Trigger the queued “open” events.
|
334 |
-
return P.trigger( 'open' )
|
335 |
-
}, //open
|
336 |
-
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Close the picker
|
340 |
-
*/
|
341 |
-
close: function( giveFocus ) {
|
342 |
-
|
343 |
-
// If we need to give focus, do it before changing states.
|
344 |
-
if ( giveFocus ) {
|
345 |
-
if ( SETTINGS.editable ) {
|
346 |
-
ELEMENT.focus()
|
347 |
-
}
|
348 |
-
else {
|
349 |
-
// ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
|
350 |
-
// The focus is triggered *after* the close has completed - causing it
|
351 |
-
// to open again. So unbind and rebind the event at the next tick.
|
352 |
-
P.$holder.off( 'focus.toOpen' ).focus()
|
353 |
-
setTimeout( function() {
|
354 |
-
P.$holder.on( 'focus.toOpen', handleFocusToOpenEvent )
|
355 |
-
}, 0 )
|
356 |
-
}
|
357 |
-
}
|
358 |
-
|
359 |
-
// Remove the “active” class.
|
360 |
-
$ELEMENT.removeClass( CLASSES.active )
|
361 |
-
aria( ELEMENT, 'expanded', false )
|
362 |
-
|
363 |
-
// * A Firefox bug, when `html` has `overflow:hidden`, results in
|
364 |
-
// killing transitions :(. So remove the “opened” state on the next tick.
|
365 |
-
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
|
366 |
-
setTimeout( function() {
|
367 |
-
|
368 |
-
// Remove the “opened” and “focused” class from the picker root.
|
369 |
-
P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused )
|
370 |
-
aria( P.$root[0], 'hidden', true )
|
371 |
-
|
372 |
-
}, 0 )
|
373 |
-
|
374 |
-
// If it’s already closed, do nothing more.
|
375 |
-
if ( !STATE.open ) return P
|
376 |
-
|
377 |
-
// Set it as closed.
|
378 |
-
STATE.open = false
|
379 |
-
|
380 |
-
// Allow the page to scroll.
|
381 |
-
if ( IS_DEFAULT_THEME ) {
|
382 |
-
$html.
|
383 |
-
css( 'overflow', '' ).
|
384 |
-
css( 'padding-right', '-=' + getScrollbarWidth() )
|
385 |
-
}
|
386 |
-
|
387 |
-
// Unbind the document events.
|
388 |
-
$document.off( '.' + STATE.id )
|
389 |
-
|
390 |
-
// Trigger the queued “close” events.
|
391 |
-
return P.trigger( 'close' )
|
392 |
-
}, //close
|
393 |
-
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Clear the values
|
397 |
-
*/
|
398 |
-
clear: function( options ) {
|
399 |
-
return P.set( 'clear', null, options )
|
400 |
-
}, //clear
|
401 |
-
|
402 |
-
|
403 |
-
/**
|
404 |
-
* Set something
|
405 |
-
*/
|
406 |
-
set: function( thing, value, options ) {
|
407 |
-
|
408 |
-
var thingItem, thingValue,
|
409 |
-
thingIsObject = $.isPlainObject( thing ),
|
410 |
-
thingObject = thingIsObject ? thing : {}
|
411 |
-
|
412 |
-
// Make sure we have usable options.
|
413 |
-
options = thingIsObject && $.isPlainObject( value ) ? value : options || {}
|
414 |
-
|
415 |
-
if ( thing ) {
|
416 |
-
|
417 |
-
// If the thing isn’t an object, make it one.
|
418 |
-
if ( !thingIsObject ) {
|
419 |
-
thingObject[ thing ] = value
|
420 |
-
}
|
421 |
-
|
422 |
-
// Go through the things of items to set.
|
423 |
-
for ( thingItem in thingObject ) {
|
424 |
-
|
425 |
-
// Grab the value of the thing.
|
426 |
-
thingValue = thingObject[ thingItem ]
|
427 |
-
|
428 |
-
// First, if the item exists and there’s a value, set it.
|
429 |
-
if ( thingItem in P.component.item ) {
|
430 |
-
if ( thingValue === undefined ) thingValue = null
|
431 |
-
P.component.set( thingItem, thingValue, options )
|
432 |
-
}
|
433 |
-
|
434 |
-
// Then, check to update the element value and broadcast a change.
|
435 |
-
if ( thingItem == 'select' || thingItem == 'clear' ) {
|
436 |
-
$ELEMENT.
|
437 |
-
val( thingItem == 'clear' ? '' : P.get( thingItem, SETTINGS.format ) ).
|
438 |
-
trigger( 'change' )
|
439 |
-
}
|
440 |
-
}
|
441 |
-
|
442 |
-
// Render a new picker.
|
443 |
-
P.render()
|
444 |
-
}
|
445 |
-
|
446 |
-
// When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
|
447 |
-
return options.muted ? P : P.trigger( 'set', thingObject )
|
448 |
-
}, //set
|
449 |
-
|
450 |
-
|
451 |
-
/**
|
452 |
-
* Get something
|
453 |
-
*/
|
454 |
-
get: function( thing, format ) {
|
455 |
-
|
456 |
-
// Make sure there’s something to get.
|
457 |
-
thing = thing || 'value'
|
458 |
-
|
459 |
-
// If a picker state exists, return that.
|
460 |
-
if ( STATE[ thing ] != null ) {
|
461 |
-
return STATE[ thing ]
|
462 |
-
}
|
463 |
-
|
464 |
-
// Return the submission value, if that.
|
465 |
-
if ( thing == 'valueSubmit' ) {
|
466 |
-
if ( P._hidden ) {
|
467 |
-
return P._hidden.value
|
468 |
-
}
|
469 |
-
thing = 'value'
|
470 |
-
}
|
471 |
-
|
472 |
-
// Return the value, if that.
|
473 |
-
if ( thing == 'value' ) {
|
474 |
-
return ELEMENT.value
|
475 |
-
}
|
476 |
-
|
477 |
-
// Check if a component item exists, return that.
|
478 |
-
if ( thing in P.component.item ) {
|
479 |
-
if ( typeof format == 'string' ) {
|
480 |
-
var thingValue = P.component.get( thing )
|
481 |
-
return thingValue ?
|
482 |
-
PickerConstructor._.trigger(
|
483 |
-
P.component.formats.toString,
|
484 |
-
P.component,
|
485 |
-
[ format, thingValue ]
|
486 |
-
) : ''
|
487 |
-
}
|
488 |
-
return P.component.get( thing )
|
489 |
-
}
|
490 |
-
}, //get
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
/**
|
495 |
-
* Bind events on the things.
|
496 |
-
*/
|
497 |
-
on: function( thing, method, internal ) {
|
498 |
-
|
499 |
-
var thingName, thingMethod,
|
500 |
-
thingIsObject = $.isPlainObject( thing ),
|
501 |
-
thingObject = thingIsObject ? thing : {}
|
502 |
-
|
503 |
-
if ( thing ) {
|
504 |
-
|
505 |
-
// If the thing isn’t an object, make it one.
|
506 |
-
if ( !thingIsObject ) {
|
507 |
-
thingObject[ thing ] = method
|
508 |
-
}
|
509 |
-
|
510 |
-
// Go through the things to bind to.
|
511 |
-
for ( thingName in thingObject ) {
|
512 |
-
|
513 |
-
// Grab the method of the thing.
|
514 |
-
thingMethod = thingObject[ thingName ]
|
515 |
-
|
516 |
-
// If it was an internal binding, prefix it.
|
517 |
-
if ( internal ) {
|
518 |
-
thingName = '_' + thingName
|
519 |
-
}
|
520 |
-
|
521 |
-
// Make sure the thing methods collection exists.
|
522 |
-
STATE.methods[ thingName ] = STATE.methods[ thingName ] || []
|
523 |
-
|
524 |
-
// Add the method to the relative method collection.
|
525 |
-
STATE.methods[ thingName ].push( thingMethod )
|
526 |
-
}
|
527 |
-
}
|
528 |
-
|
529 |
-
return P
|
530 |
-
}, //on
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
/**
|
535 |
-
* Unbind events on the things.
|
536 |
-
*/
|
537 |
-
off: function() {
|
538 |
-
var i, thingName,
|
539 |
-
names = arguments;
|
540 |
-
for ( i = 0, namesCount = names.length; i < namesCount; i += 1 ) {
|
541 |
-
thingName = names[i]
|
542 |
-
if ( thingName in STATE.methods ) {
|
543 |
-
delete STATE.methods[thingName]
|
544 |
-
}
|
545 |
-
}
|
546 |
-
return P
|
547 |
-
},
|
548 |
-
|
549 |
-
|
550 |
-
/**
|
551 |
-
* Fire off method events.
|
552 |
-
*/
|
553 |
-
trigger: function( name, data ) {
|
554 |
-
var _trigger = function( name ) {
|
555 |
-
var methodList = STATE.methods[ name ]
|
556 |
-
if ( methodList ) {
|
557 |
-
methodList.map( function( method ) {
|
558 |
-
PickerConstructor._.trigger( method, P, [ data ] )
|
559 |
-
})
|
560 |
-
}
|
561 |
-
}
|
562 |
-
_trigger( '_' + name )
|
563 |
-
_trigger( name )
|
564 |
-
return P
|
565 |
-
} //trigger
|
566 |
-
} //PickerInstance.prototype
|
567 |
-
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Wrap the picker holder components together.
|
571 |
-
*/
|
572 |
-
function createWrappedComponent() {
|
573 |
-
|
574 |
-
// Create a picker wrapper holder
|
575 |
-
return PickerConstructor._.node( 'div',
|
576 |
-
|
577 |
-
// Create a picker wrapper node
|
578 |
-
PickerConstructor._.node( 'div',
|
579 |
-
|
580 |
-
// Create a picker frame
|
581 |
-
PickerConstructor._.node( 'div',
|
582 |
-
|
583 |
-
// Create a picker box node
|
584 |
-
PickerConstructor._.node( 'div',
|
585 |
-
|
586 |
-
// Create the components nodes.
|
587 |
-
P.component.nodes( STATE.open ),
|
588 |
-
|
589 |
-
// The picker box class
|
590 |
-
CLASSES.box
|
591 |
-
),
|
592 |
-
|
593 |
-
// Picker wrap class
|
594 |
-
CLASSES.wrap
|
595 |
-
),
|
596 |
-
|
597 |
-
// Picker frame class
|
598 |
-
CLASSES.frame
|
599 |
-
),
|
600 |
-
|
601 |
-
// Picker holder class
|
602 |
-
CLASSES.holder,
|
603 |
-
|
604 |
-
'tabindex="-1"'
|
605 |
-
) //endreturn
|
606 |
-
} //createWrappedComponent
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
/**
|
611 |
-
* Prepare the input element with all bindings.
|
612 |
-
*/
|
613 |
-
function prepareElement() {
|
614 |
-
|
615 |
-
$ELEMENT.
|
616 |
-
|
617 |
-
// Store the picker data by component name.
|
618 |
-
data(NAME, P).
|
619 |
-
|
620 |
-
// Add the “input” class name.
|
621 |
-
addClass(CLASSES.input).
|
622 |
-
|
623 |
-
// If there’s a `data-value`, update the value of the element.
|
624 |
-
val( $ELEMENT.data('value') ?
|
625 |
-
P.get('select', SETTINGS.format) :
|
626 |
-
ELEMENT.value
|
627 |
-
)
|
628 |
-
|
629 |
-
|
630 |
-
// Only bind keydown events if the element isn’t editable.
|
631 |
-
if ( !SETTINGS.editable ) {
|
632 |
-
|
633 |
-
$ELEMENT.
|
634 |
-
|
635 |
-
// On focus/click, open the picker.
|
636 |
-
on( 'focus.' + STATE.id + ' click.' + STATE.id, function(event) {
|
637 |
-
event.preventDefault()
|
638 |
-
P.open()
|
639 |
-
}).
|
640 |
-
|
641 |
-
// Handle keyboard event based on the picker being opened or not.
|
642 |
-
on( 'keydown.' + STATE.id, handleKeydownEvent )
|
643 |
-
}
|
644 |
-
|
645 |
-
|
646 |
-
// Update the aria attributes.
|
647 |
-
aria(ELEMENT, {
|
648 |
-
haspopup: true,
|
649 |
-
expanded: false,
|
650 |
-
readonly: false,
|
651 |
-
owns: ELEMENT.id + '_root'
|
652 |
-
})
|
653 |
-
}
|
654 |
-
|
655 |
-
|
656 |
-
/**
|
657 |
-
* Prepare the root picker element with all bindings.
|
658 |
-
*/
|
659 |
-
function prepareElementRoot() {
|
660 |
-
aria( P.$root[0], 'hidden', true )
|
661 |
-
}
|
662 |
-
|
663 |
-
|
664 |
-
/**
|
665 |
-
* Prepare the holder picker element with all bindings.
|
666 |
-
*/
|
667 |
-
function prepareElementHolder() {
|
668 |
-
|
669 |
-
P.$holder.
|
670 |
-
|
671 |
-
on({
|
672 |
-
|
673 |
-
// For iOS8.
|
674 |
-
keydown: handleKeydownEvent,
|
675 |
-
|
676 |
-
'focus.toOpen': handleFocusToOpenEvent,
|
677 |
-
|
678 |
-
blur: function() {
|
679 |
-
// Remove the “target” class.
|
680 |
-
$ELEMENT.removeClass( CLASSES.target )
|
681 |
-
},
|
682 |
-
|
683 |
-
// When something within the holder is focused, stop from bubbling
|
684 |
-
// to the doc and remove the “focused” state from the root.
|
685 |
-
focusin: function( event ) {
|
686 |
-
P.$root.removeClass( CLASSES.focused )
|
687 |
-
event.stopPropagation()
|
688 |
-
},
|
689 |
-
|
690 |
-
// When something within the holder is clicked, stop it
|
691 |
-
// from bubbling to the doc.
|
692 |
-
'mousedown click': function( event ) {
|
693 |
-
|
694 |
-
var target = event.target
|
695 |
-
|
696 |
-
// Make sure the target isn’t the root holder so it can bubble up.
|
697 |
-
if ( target != P.$holder[0] ) {
|
698 |
-
|
699 |
-
event.stopPropagation()
|
700 |
-
|
701 |
-
// * For mousedown events, cancel the default action in order to
|
702 |
-
// prevent cases where focus is shifted onto external elements
|
703 |
-
// when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
|
704 |
-
// Also, for Firefox, don’t prevent action on the `option` element.
|
705 |
-
if ( event.type == 'mousedown' && !$( target ).is( 'input, select, textarea, button, option' )) {
|
706 |
-
|
707 |
-
event.preventDefault()
|
708 |
-
|
709 |
-
// Re-focus onto the holder so that users can click away
|
710 |
-
// from elements focused within the picker.
|
711 |
-
P.$holder[0].focus()
|
712 |
-
}
|
713 |
-
}
|
714 |
-
}
|
715 |
-
|
716 |
-
}).
|
717 |
-
|
718 |
-
// If there’s a click on an actionable element, carry out the actions.
|
719 |
-
on( 'click', '[data-pick], [data-nav], [data-clear], [data-close]', function() {
|
720 |
-
|
721 |
-
var $target = $( this ),
|
722 |
-
targetData = $target.data(),
|
723 |
-
targetDisabled = $target.hasClass( CLASSES.navDisabled ) || $target.hasClass( CLASSES.disabled ),
|
724 |
-
|
725 |
-
// * For IE, non-focusable elements can be active elements as well
|
726 |
-
// (http://stackoverflow.com/a/2684561).
|
727 |
-
activeElement = getActiveElement()
|
728 |
-
activeElement = activeElement && ( activeElement.type || activeElement.href )
|
729 |
-
|
730 |
-
// If it’s disabled or nothing inside is actively focused, re-focus the element.
|
731 |
-
if ( targetDisabled || activeElement && !$.contains( P.$root[0], activeElement ) ) {
|
732 |
-
P.$holder[0].focus()
|
733 |
-
}
|
734 |
-
|
735 |
-
// If something is superficially changed, update the `highlight` based on the `nav`.
|
736 |
-
if ( !targetDisabled && targetData.nav ) {
|
737 |
-
P.set( 'highlight', P.component.item.highlight, { nav: targetData.nav } )
|
738 |
-
}
|
739 |
-
|
740 |
-
// If something is picked, set `select` then close with focus.
|
741 |
-
else if ( !targetDisabled && 'pick' in targetData ) {
|
742 |
-
P.set( 'select', targetData.pick )
|
743 |
-
if ( SETTINGS.closeOnSelect ) {
|
744 |
-
P.close( true )
|
745 |
-
}
|
746 |
-
}
|
747 |
-
|
748 |
-
// If a “clear” button is pressed, empty the values and close with focus.
|
749 |
-
else if ( targetData.clear ) {
|
750 |
-
P.clear()
|
751 |
-
if ( SETTINGS.closeOnClear ) {
|
752 |
-
P.close( true )
|
753 |
-
}
|
754 |
-
}
|
755 |
-
|
756 |
-
else if ( targetData.close ) {
|
757 |
-
P.close( true )
|
758 |
-
}
|
759 |
-
|
760 |
-
}) //P.$holder
|
761 |
-
|
762 |
-
}
|
763 |
-
|
764 |
-
|
765 |
-
/**
|
766 |
-
* Prepare the hidden input element along with all bindings.
|
767 |
-
*/
|
768 |
-
function prepareElementHidden() {
|
769 |
-
|
770 |
-
var name
|
771 |
-
|
772 |
-
if ( SETTINGS.hiddenName === true ) {
|
773 |
-
name = ELEMENT.name
|
774 |
-
ELEMENT.name = ''
|
775 |
-
}
|
776 |
-
else {
|
777 |
-
name = [
|
778 |
-
typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '',
|
779 |
-
typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'
|
780 |
-
]
|
781 |
-
name = name[0] + ELEMENT.name + name[1]
|
782 |
-
}
|
783 |
-
|
784 |
-
P._hidden = $(
|
785 |
-
'<input ' +
|
786 |
-
'type=hidden ' +
|
787 |
-
|
788 |
-
// Create the name using the original input’s with a prefix and suffix.
|
789 |
-
'name="' + name + '"' +
|
790 |
-
|
791 |
-
// If the element has a value, set the hidden value as well.
|
792 |
-
(
|
793 |
-
$ELEMENT.data('value') || ELEMENT.value ?
|
794 |
-
' value="' + P.get('select', SETTINGS.formatSubmit) + '"' :
|
795 |
-
''
|
796 |
-
) +
|
797 |
-
'>'
|
798 |
-
)[0]
|
799 |
-
|
800 |
-
$ELEMENT.
|
801 |
-
|
802 |
-
// If the value changes, update the hidden input with the correct format.
|
803 |
-
on('change.' + STATE.id, function() {
|
804 |
-
P._hidden.value = ELEMENT.value ?
|
805 |
-
P.get('select', SETTINGS.formatSubmit) :
|
806 |
-
''
|
807 |
-
})
|
808 |
-
}
|
809 |
-
|
810 |
-
|
811 |
-
// Wait for transitions to end before focusing the holder. Otherwise, while
|
812 |
-
// using the `container` option, the view jumps to the container.
|
813 |
-
function focusPickerOnceOpened() {
|
814 |
-
|
815 |
-
if (IS_DEFAULT_THEME && supportsTransitions) {
|
816 |
-
P.$holder.find('.' + CLASSES.frame).one('transitionend', function() {
|
817 |
-
P.$holder[0].focus()
|
818 |
-
})
|
819 |
-
}
|
820 |
-
else {
|
821 |
-
P.$holder[0].focus()
|
822 |
-
}
|
823 |
-
}
|
824 |
-
|
825 |
-
|
826 |
-
function handleFocusToOpenEvent(event) {
|
827 |
-
|
828 |
-
// Stop the event from propagating to the doc.
|
829 |
-
event.stopPropagation()
|
830 |
-
|
831 |
-
// Add the “target” class.
|
832 |
-
$ELEMENT.addClass( CLASSES.target )
|
833 |
-
|
834 |
-
// Add the “focused” class to the root.
|
835 |
-
P.$root.addClass( CLASSES.focused )
|
836 |
-
|
837 |
-
// And then finally open the picker.
|
838 |
-
P.open()
|
839 |
-
}
|
840 |
-
|
841 |
-
|
842 |
-
// For iOS8.
|
843 |
-
function handleKeydownEvent( event ) {
|
844 |
-
|
845 |
-
var keycode = event.keyCode,
|
846 |
-
|
847 |
-
// Check if one of the delete keys was pressed.
|
848 |
-
isKeycodeDelete = /^(8|46)$/.test(keycode)
|
849 |
-
|
850 |
-
// For some reason IE clears the input value on “escape”.
|
851 |
-
if ( keycode == 27 ) {
|
852 |
-
P.close( true )
|
853 |
-
return false
|
854 |
-
}
|
855 |
-
|
856 |
-
// Check if `space` or `delete` was pressed or the picker is closed with a key movement.
|
857 |
-
if ( keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode] ) {
|
858 |
-
|
859 |
-
// Prevent it from moving the page and bubbling to doc.
|
860 |
-
event.preventDefault()
|
861 |
-
event.stopPropagation()
|
862 |
-
|
863 |
-
// If `delete` was pressed, clear the values and close the picker.
|
864 |
-
// Otherwise open the picker.
|
865 |
-
if ( isKeycodeDelete ) { P.clear().close() }
|
866 |
-
else { P.open() }
|
867 |
-
}
|
868 |
-
}
|
869 |
-
|
870 |
-
|
871 |
-
// Return a new picker instance.
|
872 |
-
return new PickerInstance()
|
873 |
-
} //PickerConstructor
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
/**
|
878 |
-
* The default classes and prefix to use for the HTML classes.
|
879 |
-
*/
|
880 |
-
PickerConstructor.klasses = function( prefix ) {
|
881 |
-
prefix = prefix || 'picker'
|
882 |
-
return {
|
883 |
-
|
884 |
-
picker: prefix,
|
885 |
-
opened: prefix + '--opened',
|
886 |
-
focused: prefix + '--focused',
|
887 |
-
|
888 |
-
input: prefix + '__input',
|
889 |
-
active: prefix + '__input--active',
|
890 |
-
target: prefix + '__input--target',
|
891 |
-
|
892 |
-
holder: prefix + '__holder',
|
893 |
-
|
894 |
-
frame: prefix + '__frame',
|
895 |
-
wrap: prefix + '__wrap',
|
896 |
-
|
897 |
-
box: prefix + '__box'
|
898 |
-
}
|
899 |
-
} //PickerConstructor.klasses
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
/**
|
904 |
-
* Check if the default theme is being used.
|
905 |
-
*/
|
906 |
-
function isUsingDefaultTheme( element ) {
|
907 |
-
|
908 |
-
var theme,
|
909 |
-
prop = 'position'
|
910 |
-
|
911 |
-
// For IE.
|
912 |
-
if ( element.currentStyle ) {
|
913 |
-
theme = element.currentStyle[prop]
|
914 |
-
}
|
915 |
-
|
916 |
-
// For normal browsers.
|
917 |
-
else if ( window.getComputedStyle ) {
|
918 |
-
theme = getComputedStyle( element )[prop]
|
919 |
-
}
|
920 |
-
|
921 |
-
return theme == 'fixed'
|
922 |
-
}
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
/**
|
927 |
-
* Get the width of the browser’s scrollbar.
|
928 |
-
* Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
|
929 |
-
*/
|
930 |
-
function getScrollbarWidth() {
|
931 |
-
|
932 |
-
if ( $html.height() <= $window.height() ) {
|
933 |
-
return 0
|
934 |
-
}
|
935 |
-
|
936 |
-
var $outer = $( '<div style="visibility:hidden;width:100px" />' ).
|
937 |
-
appendTo( 'body' )
|
938 |
-
|
939 |
-
// Get the width without scrollbars.
|
940 |
-
var widthWithoutScroll = $outer[0].offsetWidth
|
941 |
-
|
942 |
-
// Force adding scrollbars.
|
943 |
-
$outer.css( 'overflow', 'scroll' )
|
944 |
-
|
945 |
-
// Add the inner div.
|
946 |
-
var $inner = $( '<div style="width:100%" />' ).appendTo( $outer )
|
947 |
-
|
948 |
-
// Get the width with scrollbars.
|
949 |
-
var widthWithScroll = $inner[0].offsetWidth
|
950 |
-
|
951 |
-
// Remove the divs.
|
952 |
-
$outer.remove()
|
953 |
-
|
954 |
-
// Return the difference between the widths.
|
955 |
-
return widthWithoutScroll - widthWithScroll
|
956 |
-
}
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
/**
|
961 |
-
* PickerConstructor helper methods.
|
962 |
-
*/
|
963 |
-
PickerConstructor._ = {
|
964 |
-
|
965 |
-
/**
|
966 |
-
* Create a group of nodes. Expects:
|
967 |
-
* `
|
968 |
-
{
|
969 |
-
min: {Integer},
|
970 |
-
max: {Integer},
|
971 |
-
i: {Integer},
|
972 |
-
node: {String},
|
973 |
-
item: {Function}
|
974 |
-
}
|
975 |
-
* `
|
976 |
-
*/
|
977 |
-
group: function( groupObject ) {
|
978 |
-
|
979 |
-
var
|
980 |
-
// Scope for the looped object
|
981 |
-
loopObjectScope,
|
982 |
-
|
983 |
-
// Create the nodes list
|
984 |
-
nodesList = '',
|
985 |
-
|
986 |
-
// The counter starts from the `min`
|
987 |
-
counter = PickerConstructor._.trigger( groupObject.min, groupObject )
|
988 |
-
|
989 |
-
|
990 |
-
// Loop from the `min` to `max`, incrementing by `i`
|
991 |
-
for ( ; counter <= PickerConstructor._.trigger( groupObject.max, groupObject, [ counter ] ); counter += groupObject.i ) {
|
992 |
-
|
993 |
-
// Trigger the `item` function within scope of the object
|
994 |
-
loopObjectScope = PickerConstructor._.trigger( groupObject.item, groupObject, [ counter ] )
|
995 |
-
|
996 |
-
// Splice the subgroup and create nodes out of the sub nodes
|
997 |
-
nodesList += PickerConstructor._.node(
|
998 |
-
groupObject.node,
|
999 |
-
loopObjectScope[ 0 ], // the node
|
1000 |
-
loopObjectScope[ 1 ], // the classes
|
1001 |
-
loopObjectScope[ 2 ] // the attributes
|
1002 |
-
)
|
1003 |
-
}
|
1004 |
-
|
1005 |
-
// Return the list of nodes
|
1006 |
-
return nodesList
|
1007 |
-
}, //group
|
1008 |
-
|
1009 |
-
|
1010 |
-
/**
|
1011 |
-
* Create a dom node string
|
1012 |
-
*/
|
1013 |
-
node: function( wrapper, item, klass, attribute ) {
|
1014 |
-
|
1015 |
-
// If the item is false-y, just return an empty string
|
1016 |
-
if ( !item ) return ''
|
1017 |
-
|
1018 |
-
// If the item is an array, do a join
|
1019 |
-
item = $.isArray( item ) ? item.join( '' ) : item
|
1020 |
-
|
1021 |
-
// Check for the class
|
1022 |
-
klass = klass ? ' class="' + klass + '"' : ''
|
1023 |
-
|
1024 |
-
// Check for any attributes
|
1025 |
-
attribute = attribute ? ' ' + attribute : ''
|
1026 |
-
|
1027 |
-
// Return the wrapped item
|
1028 |
-
return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>'
|
1029 |
-
}, //node
|
1030 |
-
|
1031 |
-
|
1032 |
-
/**
|
1033 |
-
* Lead numbers below 10 with a zero.
|
1034 |
-
*/
|
1035 |
-
lead: function( number ) {
|
1036 |
-
return ( number < 10 ? '0': '' ) + number
|
1037 |
-
},
|
1038 |
-
|
1039 |
-
|
1040 |
-
/**
|
1041 |
-
* Trigger a function otherwise return the value.
|
1042 |
-
*/
|
1043 |
-
trigger: function( callback, scope, args ) {
|
1044 |
-
return typeof callback == 'function' ? callback.apply( scope, args || [] ) : callback
|
1045 |
-
},
|
1046 |
-
|
1047 |
-
|
1048 |
-
/**
|
1049 |
-
* If the second character is a digit, length is 2 otherwise 1.
|
1050 |
-
*/
|
1051 |
-
digits: function( string ) {
|
1052 |
-
return ( /\d/ ).test( string[ 1 ] ) ? 2 : 1
|
1053 |
-
},
|
1054 |
-
|
1055 |
-
|
1056 |
-
/**
|
1057 |
-
* Tell if something is a date object.
|
1058 |
-
*/
|
1059 |
-
isDate: function( value ) {
|
1060 |
-
return {}.toString.call( value ).indexOf( 'Date' ) > -1 && this.isInteger( value.getDate() )
|
1061 |
-
},
|
1062 |
-
|
1063 |
-
|
1064 |
-
/**
|
1065 |
-
* Tell if something is an integer.
|
1066 |
-
*/
|
1067 |
-
isInteger: function( value ) {
|
1068 |
-
return {}.toString.call( value ).indexOf( 'Number' ) > -1 && value % 1 === 0
|
1069 |
-
},
|
1070 |
-
|
1071 |
-
|
1072 |
-
/**
|
1073 |
-
* Create ARIA attribute strings.
|
1074 |
-
*/
|
1075 |
-
ariaAttr: ariaAttr
|
1076 |
-
} //PickerConstructor._
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
/**
|
1081 |
-
* Extend the picker with a component and defaults.
|
1082 |
-
*/
|
1083 |
-
PickerConstructor.extend = function( name, Component ) {
|
1084 |
-
|
1085 |
-
// Extend jQuery.
|
1086 |
-
$.fn[ name ] = function( options, action ) {
|
1087 |
-
|
1088 |
-
// Grab the component data.
|
1089 |
-
var componentData = this.data( name )
|
1090 |
-
|
1091 |
-
// If the picker is requested, return the data object.
|
1092 |
-
if ( options == 'picker' ) {
|
1093 |
-
return componentData
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
// If the component data exists and `options` is a string, carry out the action.
|
1097 |
-
if ( componentData && typeof options == 'string' ) {
|
1098 |
-
return PickerConstructor._.trigger( componentData[ options ], componentData, [ action ] )
|
1099 |
-
}
|
1100 |
-
|
1101 |
-
// Otherwise go through each matched element and if the component
|
1102 |
-
// doesn’t exist, create a new picker using `this` element
|
1103 |
-
// and merging the defaults and options with a deep copy.
|
1104 |
-
return this.each( function() {
|
1105 |
-
var $this = $( this )
|
1106 |
-
if ( !$this.data( name ) ) {
|
1107 |
-
new PickerConstructor( this, name, Component, options )
|
1108 |
-
}
|
1109 |
-
})
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
// Set the defaults.
|
1113 |
-
$.fn[ name ].defaults = Component.defaults
|
1114 |
-
} //PickerConstructor.extend
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
function aria(element, attribute, value) {
|
1119 |
-
if ( $.isPlainObject(attribute) ) {
|
1120 |
-
for ( var key in attribute ) {
|
1121 |
-
ariaSet(element, key, attribute[key])
|
1122 |
-
}
|
1123 |
-
}
|
1124 |
-
else {
|
1125 |
-
ariaSet(element, attribute, value)
|
1126 |
-
}
|
1127 |
-
}
|
1128 |
-
function ariaSet(element, attribute, value) {
|
1129 |
-
element.setAttribute(
|
1130 |
-
(attribute == 'role' ? '' : 'aria-') + attribute,
|
1131 |
-
value
|
1132 |
-
)
|
1133 |
-
}
|
1134 |
-
function ariaAttr(attribute, data) {
|
1135 |
-
if ( !$.isPlainObject(attribute) ) {
|
1136 |
-
attribute = { attribute: data }
|
1137 |
-
}
|
1138 |
-
data = ''
|
1139 |
-
for ( var key in attribute ) {
|
1140 |
-
var attr = (key == 'role' ? '' : 'aria-') + key,
|
1141 |
-
attrVal = attribute[key]
|
1142 |
-
data += attrVal == null ? '' : attr + '="' + attribute[key] + '"'
|
1143 |
-
}
|
1144 |
-
return data
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
// IE8 bug throws an error for activeElements within iframes.
|
1148 |
-
function getActiveElement() {
|
1149 |
-
try {
|
1150 |
-
return document.activeElement
|
1151 |
-
} catch ( err ) { }
|
1152 |
-
}
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
// Expose the picker constructor.
|
1157 |
-
return PickerConstructor
|
1158 |
-
|
1159 |
-
|
1160 |
-
}));
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1 |
+
!function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(i,a,s,f){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",O.component.nodes(k.open),w.box),w.wrap),w.frame),w.holder,'tabindex="-1"')}function h(){C.data(a,O).addClass(w.input).val(C.data("value")?O.get("select",x.format):i.value),x.editable||C.on("focus."+k.id+" click."+k.id,function(e){e.preventDefault(),O.open()}).on("keydown."+k.id,$),r(i,{haspopup:!0,expanded:!1,readonly:!1,owns:i.id+"_root"})}function m(){r(O.$root[0],"hidden",!0)}function g(){O.$holder.on({keydown:$,"focus.toOpen":_,blur:function(){C.removeClass(w.target)},focusin:function(e){O.$root.removeClass(w.focused),e.stopPropagation()},"mousedown click":function(t){var n=t.target;n!=O.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(n).is("input, select, textarea, button, option")||(t.preventDefault(),O.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),n=t.data(),o=t.hasClass(w.navDisabled)||t.hasClass(w.disabled),r=d();r=r&&(r.type||r.href),(o||r&&!e.contains(O.$root[0],r))&&O.$holder[0].focus(),!o&&n.nav?O.set("highlight",O.component.item.highlight,{nav:n.nav}):!o&&"pick"in n?(O.set("select",n.pick),x.closeOnSelect&&O.close(!0)):n.clear?(O.clear(),x.closeOnClear&&O.close(!0)):n.close&&O.close(!0)})}function v(){var t;x.hiddenName===!0?(t=i.name,i.name=""):(t=["string"==typeof x.hiddenPrefix?x.hiddenPrefix:"","string"==typeof x.hiddenSuffix?x.hiddenSuffix:"_submit"],t=t[0]+i.name+t[1]),O._hidden=e('<input type=hidden name="'+t+'"'+(C.data("value")||i.value?' value="'+O.get("select",x.formatSubmit)+'"':"")+">")[0],C.on("change."+k.id,function(){O._hidden.value=i.value?O.get("select",x.formatSubmit):""})}function y(){b&&l?O.$holder.find("."+w.frame).one("transitionend",function(){O.$holder[0].focus()}):O.$holder[0].focus()}function _(e){e.stopPropagation(),C.addClass(w.target),O.$root.addClass(w.focused),O.open()}function $(e){var t=e.keyCode,n=/^(8|46)$/.test(t);return 27==t?(O.close(!0),!1):void((32==t||n||!k.open&&O.component.key[t])&&(e.preventDefault(),e.stopPropagation(),n?O.clear().close():O.open()))}if(!i)return t;var b=!1,k={id:i.id||"P"+Math.abs(~~(Math.random()*new Date))},x=s?e.extend(!0,{},s.defaults,f):f||{},w=e.extend({},t.klasses(),x.klass),C=e(i),S=function(){return this.start()},O=S.prototype={constructor:S,$node:C,start:function(){return k&&k.start?O:(k.methods={},k.start=!0,k.open=!1,k.type=i.type,i.autofocus=i==d(),i.readOnly=!x.editable,i.id=i.id||k.id,"text"!=i.type&&(i.type="text"),O.component=new s(O,x),O.$root=e('<div class="'+w.picker+'" id="'+i.id+'_root" />'),m(),O.$holder=e(p()).appendTo(O.$root),g(),x.formatSubmit&&v(),h(),x.containerHidden?e(x.containerHidden).append(O._hidden):C.after(O._hidden),x.container?e(x.container).append(O.$root):C.after(O.$root),O.on({start:O.component.onStart,render:O.component.onRender,stop:O.component.onStop,open:O.component.onOpen,close:O.component.onClose,set:O.component.onSet}).on({start:x.onStart,render:x.onRender,stop:x.onStop,open:x.onOpen,close:x.onClose,set:x.onSet}),b=n(O.$holder[0]),i.autofocus&&O.open(),O.trigger("start").trigger("render"))},render:function(t){return t?(O.$holder=e(p()),g(),O.$root.html(O.$holder)):O.$root.find("."+w.box).html(O.component.nodes(k.open)),O.trigger("render")},stop:function(){return k.start?(O.close(),O._hidden&&O._hidden.parentNode.removeChild(O._hidden),O.$root.remove(),C.removeClass(w.input).removeData(a),setTimeout(function(){C.off("."+k.id)},0),i.type=k.type,i.readOnly=!1,O.trigger("stop"),k.methods={},k.start=!1,O):O},open:function(n){return k.open?O:(C.addClass(w.active),r(i,"expanded",!0),setTimeout(function(){O.$root.addClass(w.opened),r(O.$root[0],"hidden",!1)},0),n!==!1&&(k.open=!0,b&&u.css("overflow","hidden").css("padding-right","+="+o()),y(),c.on("click."+k.id+" focusin."+k.id,function(e){var t=e.target;t!=i&&t!=document&&3!=e.which&&O.close(t===O.$holder[0])}).on("keydown."+k.id,function(n){var o=n.keyCode,r=O.component.key[o],i=n.target;27==o?O.close(!0):i!=O.$holder[0]||!r&&13!=o?e.contains(O.$root[0],i)&&13==o&&(n.preventDefault(),i.click()):(n.preventDefault(),r?t._.trigger(O.component.key.go,O,[t._.trigger(r)]):O.$root.find("."+w.highlighted).hasClass(w.disabled)||(O.set("select",O.component.item.highlight),x.closeOnSelect&&O.close(!0)))})),O.trigger("open"))},close:function(e){return e&&(x.editable?i.focus():(O.$holder.off("focus.toOpen").focus(),setTimeout(function(){O.$holder.on("focus.toOpen",_)},0))),C.removeClass(w.active),r(i,"expanded",!1),setTimeout(function(){O.$root.removeClass(w.opened+" "+w.focused),r(O.$root[0],"hidden",!0)},0),k.open?(k.open=!1,b&&u.css("overflow","").css("padding-right","-="+o()),c.off("."+k.id),O.trigger("close")):O},clear:function(e){return O.set("clear",null,e)},set:function(t,n,o){var r,i,a=e.isPlainObject(t),d=a?t:{};if(o=a&&e.isPlainObject(n)?n:o||{},t){a||(d[t]=n);for(r in d)i=d[r],r in O.component.item&&(void 0===i&&(i=null),O.component.set(r,i,o)),("select"==r||"clear"==r)&&C.val("clear"==r?"":O.get(r,x.format)).trigger("change");O.render()}return o.muted?O:O.trigger("set",d)},get:function(e,n){if(e=e||"value",null!=k[e])return k[e];if("valueSubmit"==e){if(O._hidden)return O._hidden.value;e="value"}if("value"==e)return i.value;if(e in O.component.item){if("string"==typeof n){var o=O.component.get(e);return o?t._.trigger(O.component.formats.toString,O.component,[n,o]):""}return O.component.get(e)}},on:function(t,n,o){var r,i,a=e.isPlainObject(t),d=a?t:{};if(t){a||(d[t]=n);for(r in d)i=d[r],o&&(r="_"+r),k.methods[r]=k.methods[r]||[],k.methods[r].push(i)}return O},off:function(){var e,t,n=arguments;for(e=0,namesCount=n.length;e<namesCount;e+=1)t=n[e],t in k.methods&&delete k.methods[t];return O},trigger:function(e,n){var o=function(e){var o=k.methods[e];o&&o.map(function(e){t._.trigger(e,O,[n])})};return o("_"+e),o(e),O}};return new S}function n(e){var t,n="position";return e.currentStyle?t=e.currentStyle[n]:window.getComputedStyle&&(t=getComputedStyle(e)[n]),"fixed"==t}function o(){if(u.height()<=s.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),n=t[0].offsetWidth;t.css("overflow","scroll");var o=e('<div style="width:100%" />').appendTo(t),r=o[0].offsetWidth;return t.remove(),n-r}function r(t,n,o){if(e.isPlainObject(n))for(var r in n)i(t,r,n[r]);else i(t,n,o)}function i(e,t,n){e.setAttribute(("role"==t?"":"aria-")+t,n)}function a(t,n){e.isPlainObject(t)||(t={attribute:n}),n="";for(var o in t){var r=("role"==o?"":"aria-")+o,i=t[o];n+=null==i?"":r+'="'+t[o]+'"'}return n}function d(){try{return document.activeElement}catch(e){}}var s=e(window),c=e(document),u=e(document.documentElement),l=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var n,o="",r=t._.trigger(e.min,e);r<=t._.trigger(e.max,e,[r]);r+=e.i)n=t._.trigger(e.item,e,[r]),o+=t._.node(e.node,n[0],n[1],n[2]);return o},node:function(t,n,o,r){return n?(n=e.isArray(n)?n.join(""):n,o=o?' class="'+o+'"':"",r=r?" "+r:"","<"+t+o+r+">"+n+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,n){return"function"==typeof e?e.apply(t,n||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:a},t.extend=function(n,o){e.fn[n]=function(r,i){var a=this.data(n);return"picker"==r?a:a&&"string"==typeof r?t._.trigger(a[r],a,[i]):this.each(function(){var i=e(this);i.data(n)||new t(this,n,o,r)})},e.fn[n].defaults=o.defaults},t});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/lib/picker.time.js
CHANGED
@@ -1,1013 +1 @@
|
|
1 |
-
|
2 |
-
* Time picker for pickadate.js v3.5.6
|
3 |
-
* http://amsul.github.io/pickadate.js/time.htm
|
4 |
-
*/
|
5 |
-
|
6 |
-
(function ( factory ) {
|
7 |
-
|
8 |
-
// AMD.
|
9 |
-
if ( typeof define == 'function' && define.amd )
|
10 |
-
define( ['picker', 'jquery'], factory )
|
11 |
-
|
12 |
-
// Node.js/browserify.
|
13 |
-
else if ( typeof exports == 'object' )
|
14 |
-
module.exports = factory( require('./picker.js'), require('jquery') )
|
15 |
-
|
16 |
-
// Browser globals.
|
17 |
-
else factory( Picker, jQuery )
|
18 |
-
|
19 |
-
}(function( Picker, $ ) {
|
20 |
-
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Globals and constants
|
24 |
-
*/
|
25 |
-
var HOURS_IN_DAY = 24,
|
26 |
-
MINUTES_IN_HOUR = 60,
|
27 |
-
HOURS_TO_NOON = 12,
|
28 |
-
MINUTES_IN_DAY = HOURS_IN_DAY * MINUTES_IN_HOUR,
|
29 |
-
_ = Picker._
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
/**
|
34 |
-
* The time picker constructor
|
35 |
-
*/
|
36 |
-
function TimePicker( picker, settings ) {
|
37 |
-
|
38 |
-
var clock = this,
|
39 |
-
elementValue = picker.$node[ 0 ].value,
|
40 |
-
elementDataValue = picker.$node.data( 'value' ),
|
41 |
-
valueString = elementDataValue || elementValue,
|
42 |
-
formatString = elementDataValue ? settings.formatSubmit : settings.format
|
43 |
-
|
44 |
-
clock.settings = settings
|
45 |
-
clock.$node = picker.$node
|
46 |
-
|
47 |
-
// The queue of methods that will be used to build item objects.
|
48 |
-
clock.queue = {
|
49 |
-
interval: 'i',
|
50 |
-
min: 'measure create',
|
51 |
-
max: 'measure create',
|
52 |
-
now: 'now create',
|
53 |
-
select: 'parse create validate',
|
54 |
-
highlight: 'parse create validate',
|
55 |
-
view: 'parse create validate',
|
56 |
-
disable: 'deactivate',
|
57 |
-
enable: 'activate'
|
58 |
-
}
|
59 |
-
|
60 |
-
// The component's item object.
|
61 |
-
clock.item = {}
|
62 |
-
|
63 |
-
clock.item.clear = null
|
64 |
-
clock.item.interval = settings.interval || 30
|
65 |
-
clock.item.disable = ( settings.disable || [] ).slice( 0 )
|
66 |
-
clock.item.enable = -(function( collectionDisabled ) {
|
67 |
-
return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
|
68 |
-
})( clock.item.disable )
|
69 |
-
|
70 |
-
clock.
|
71 |
-
set( 'min', settings.min ).
|
72 |
-
set( 'max', settings.max ).
|
73 |
-
set( 'now' )
|
74 |
-
|
75 |
-
// When there’s a value, set the `select`, which in turn
|
76 |
-
// also sets the `highlight` and `view`.
|
77 |
-
if ( valueString ) {
|
78 |
-
clock.set( 'select', valueString, {
|
79 |
-
format: formatString
|
80 |
-
})
|
81 |
-
}
|
82 |
-
|
83 |
-
// If there’s no value, default to highlighting “today”.
|
84 |
-
else {
|
85 |
-
clock.
|
86 |
-
set( 'select', null ).
|
87 |
-
set( 'highlight', clock.item.now )
|
88 |
-
}
|
89 |
-
|
90 |
-
// The keycode to movement mapping.
|
91 |
-
clock.key = {
|
92 |
-
40: 1, // Down
|
93 |
-
38: -1, // Up
|
94 |
-
39: 1, // Right
|
95 |
-
37: -1, // Left
|
96 |
-
go: function( timeChange ) {
|
97 |
-
clock.set(
|
98 |
-
'highlight',
|
99 |
-
clock.item.highlight.pick + timeChange * clock.item.interval,
|
100 |
-
{ interval: timeChange * clock.item.interval }
|
101 |
-
)
|
102 |
-
this.render()
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
|
107 |
-
// Bind some picker events.
|
108 |
-
picker.
|
109 |
-
on( 'render', function() {
|
110 |
-
var $pickerHolder = picker.$root.children(),
|
111 |
-
$viewset = $pickerHolder.find( '.' + settings.klass.viewset ),
|
112 |
-
vendors = function( prop ) {
|
113 |
-
return ['webkit', 'moz', 'ms', 'o', ''].map(function( vendor ) {
|
114 |
-
return ( vendor ? '-' + vendor + '-' : '' ) + prop
|
115 |
-
})
|
116 |
-
},
|
117 |
-
animations = function( $el, state ) {
|
118 |
-
vendors( 'transform' ).map(function( prop ) {
|
119 |
-
$el.css( prop, state )
|
120 |
-
})
|
121 |
-
vendors( 'transition' ).map(function( prop ) {
|
122 |
-
$el.css( prop, state )
|
123 |
-
})
|
124 |
-
}
|
125 |
-
if ( $viewset.length ) {
|
126 |
-
animations( $pickerHolder, 'none' )
|
127 |
-
$pickerHolder[ 0 ].scrollTop = ~~$viewset.position().top - ( $viewset[ 0 ].clientHeight * 2 )
|
128 |
-
animations( $pickerHolder, '' )
|
129 |
-
}
|
130 |
-
}, 1 ).
|
131 |
-
on( 'open', function() {
|
132 |
-
picker.$root.find( 'button' ).attr( 'disabled', false )
|
133 |
-
}, 1 ).
|
134 |
-
on( 'close', function() {
|
135 |
-
picker.$root.find( 'button' ).attr( 'disabled', true )
|
136 |
-
}, 1 )
|
137 |
-
|
138 |
-
} //TimePicker
|
139 |
-
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Set a timepicker item object.
|
143 |
-
*/
|
144 |
-
TimePicker.prototype.set = function( type, value, options ) {
|
145 |
-
|
146 |
-
var clock = this,
|
147 |
-
clockItem = clock.item
|
148 |
-
|
149 |
-
// If the value is `null` just set it immediately.
|
150 |
-
if ( value === null ) {
|
151 |
-
if ( type == 'clear' ) type = 'select'
|
152 |
-
clockItem[ type ] = value
|
153 |
-
return clock
|
154 |
-
}
|
155 |
-
|
156 |
-
// Otherwise go through the queue of methods, and invoke the functions.
|
157 |
-
// Update this as the time unit, and set the final value as this item.
|
158 |
-
// * In the case of `enable`, keep the queue but set `disable` instead.
|
159 |
-
// And in the case of `flip`, keep the queue but set `enable` instead.
|
160 |
-
clockItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = clock.queue[ type ].split( ' ' ).map( function( method ) {
|
161 |
-
value = clock[ method ]( type, value, options )
|
162 |
-
return value
|
163 |
-
}).pop()
|
164 |
-
|
165 |
-
// Check if we need to cascade through more updates.
|
166 |
-
if ( type == 'select' ) {
|
167 |
-
clock.set( 'highlight', clockItem.select, options )
|
168 |
-
}
|
169 |
-
else if ( type == 'highlight' ) {
|
170 |
-
clock.set( 'view', clockItem.highlight, options )
|
171 |
-
}
|
172 |
-
else if ( type == 'interval' ) {
|
173 |
-
clock.
|
174 |
-
set( 'min', clockItem.min, options ).
|
175 |
-
set( 'max', clockItem.max, options )
|
176 |
-
}
|
177 |
-
else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
|
178 |
-
if ( clockItem.select && clock.disabled( clockItem.select ) ) {
|
179 |
-
clock.set( 'select', value, options )
|
180 |
-
}
|
181 |
-
if ( clockItem.highlight && clock.disabled( clockItem.highlight ) ) {
|
182 |
-
clock.set( 'highlight', value, options )
|
183 |
-
}
|
184 |
-
if ( type == 'min' ) {
|
185 |
-
clock.set( 'max', clockItem.max, options )
|
186 |
-
}
|
187 |
-
}
|
188 |
-
|
189 |
-
return clock
|
190 |
-
} //TimePicker.prototype.set
|
191 |
-
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Get a timepicker item object.
|
195 |
-
*/
|
196 |
-
TimePicker.prototype.get = function( type ) {
|
197 |
-
return this.item[ type ]
|
198 |
-
} //TimePicker.prototype.get
|
199 |
-
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Create a picker time object.
|
203 |
-
*/
|
204 |
-
TimePicker.prototype.create = function( type, value, options ) {
|
205 |
-
|
206 |
-
var clock = this
|
207 |
-
|
208 |
-
// If there’s no value, use the type as the value.
|
209 |
-
value = value === undefined ? type : value
|
210 |
-
|
211 |
-
// If it’s a date object, convert it into an array.
|
212 |
-
if ( _.isDate( value ) ) {
|
213 |
-
value = [ value.getHours(), value.getMinutes() ]
|
214 |
-
}
|
215 |
-
|
216 |
-
// If it’s an object, use the “pick” value.
|
217 |
-
if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
|
218 |
-
value = value.pick
|
219 |
-
}
|
220 |
-
|
221 |
-
// If it’s an array, convert it into minutes.
|
222 |
-
else if ( $.isArray( value ) ) {
|
223 |
-
value = +value[ 0 ] * MINUTES_IN_HOUR + (+value[ 1 ])
|
224 |
-
}
|
225 |
-
|
226 |
-
// If no valid value is passed, set it to “now”.
|
227 |
-
else if ( !_.isInteger( value ) ) {
|
228 |
-
value = clock.now( type, value, options )
|
229 |
-
}
|
230 |
-
|
231 |
-
// If we’re setting the max, make sure it’s greater than the min.
|
232 |
-
if ( type == 'max' && value < clock.item.min.pick ) {
|
233 |
-
value += MINUTES_IN_DAY
|
234 |
-
}
|
235 |
-
|
236 |
-
// If the value doesn’t fall directly on the interval,
|
237 |
-
// add one interval to indicate it as “passed”.
|
238 |
-
if ( type != 'min' && type != 'max' && (value - clock.item.min.pick) % clock.item.interval !== 0 ) {
|
239 |
-
value += clock.item.interval
|
240 |
-
}
|
241 |
-
|
242 |
-
// Normalize it into a “reachable” interval.
|
243 |
-
value = clock.normalize( type, value, options )
|
244 |
-
|
245 |
-
// Return the compiled object.
|
246 |
-
return {
|
247 |
-
|
248 |
-
// Divide to get hours from minutes.
|
249 |
-
hour: ~~( HOURS_IN_DAY + value / MINUTES_IN_HOUR ) % HOURS_IN_DAY,
|
250 |
-
|
251 |
-
// The remainder is the minutes.
|
252 |
-
mins: ( MINUTES_IN_HOUR + value % MINUTES_IN_HOUR ) % MINUTES_IN_HOUR,
|
253 |
-
|
254 |
-
// The time in total minutes.
|
255 |
-
time: ( MINUTES_IN_DAY + value ) % MINUTES_IN_DAY,
|
256 |
-
|
257 |
-
// Reference to the “relative” value to pick.
|
258 |
-
pick: value % MINUTES_IN_DAY
|
259 |
-
}
|
260 |
-
} //TimePicker.prototype.create
|
261 |
-
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Create a range limit object using an array, date object,
|
265 |
-
* literal “true”, or integer relative to another time.
|
266 |
-
*/
|
267 |
-
TimePicker.prototype.createRange = function( from, to ) {
|
268 |
-
|
269 |
-
var clock = this,
|
270 |
-
createTime = function( time ) {
|
271 |
-
if ( time === true || $.isArray( time ) || _.isDate( time ) ) {
|
272 |
-
return clock.create( time )
|
273 |
-
}
|
274 |
-
return time
|
275 |
-
}
|
276 |
-
|
277 |
-
// Create objects if possible.
|
278 |
-
if ( !_.isInteger( from ) ) {
|
279 |
-
from = createTime( from )
|
280 |
-
}
|
281 |
-
if ( !_.isInteger( to ) ) {
|
282 |
-
to = createTime( to )
|
283 |
-
}
|
284 |
-
|
285 |
-
// Create relative times.
|
286 |
-
if ( _.isInteger( from ) && $.isPlainObject( to ) ) {
|
287 |
-
from = [ to.hour, to.mins + ( from * clock.settings.interval ) ];
|
288 |
-
}
|
289 |
-
else if ( _.isInteger( to ) && $.isPlainObject( from ) ) {
|
290 |
-
to = [ from.hour, from.mins + ( to * clock.settings.interval ) ];
|
291 |
-
}
|
292 |
-
|
293 |
-
return {
|
294 |
-
from: createTime( from ),
|
295 |
-
to: createTime( to )
|
296 |
-
}
|
297 |
-
} //TimePicker.prototype.createRange
|
298 |
-
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Check if a time unit falls within a time range object.
|
302 |
-
*/
|
303 |
-
TimePicker.prototype.withinRange = function( range, timeUnit ) {
|
304 |
-
range = this.createRange(range.from, range.to)
|
305 |
-
return timeUnit.pick >= range.from.pick && timeUnit.pick <= range.to.pick
|
306 |
-
}
|
307 |
-
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Check if two time range objects overlap.
|
311 |
-
*/
|
312 |
-
TimePicker.prototype.overlapRanges = function( one, two ) {
|
313 |
-
|
314 |
-
var clock = this
|
315 |
-
|
316 |
-
// Convert the ranges into comparable times.
|
317 |
-
one = clock.createRange( one.from, one.to )
|
318 |
-
two = clock.createRange( two.from, two.to )
|
319 |
-
|
320 |
-
return clock.withinRange( one, two.from ) || clock.withinRange( one, two.to ) ||
|
321 |
-
clock.withinRange( two, one.from ) || clock.withinRange( two, one.to )
|
322 |
-
}
|
323 |
-
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Get the time relative to now.
|
327 |
-
*/
|
328 |
-
TimePicker.prototype.now = function( type, value/*, options*/ ) {
|
329 |
-
|
330 |
-
var interval = this.item.interval,
|
331 |
-
date = new Date(),
|
332 |
-
nowMinutes = date.getHours() * MINUTES_IN_HOUR + date.getMinutes(),
|
333 |
-
isValueInteger = _.isInteger( value ),
|
334 |
-
isBelowInterval
|
335 |
-
|
336 |
-
// Make sure “now” falls within the interval range.
|
337 |
-
nowMinutes -= nowMinutes % interval
|
338 |
-
|
339 |
-
// Check if the difference is less than the interval itself.
|
340 |
-
isBelowInterval = value < 0 && interval * value + nowMinutes <= -interval
|
341 |
-
|
342 |
-
// Add an interval because the time has “passed”.
|
343 |
-
nowMinutes += type == 'min' && isBelowInterval ? 0 : interval
|
344 |
-
|
345 |
-
// If the value is a number, adjust by that many intervals.
|
346 |
-
if ( isValueInteger ) {
|
347 |
-
nowMinutes += interval * (
|
348 |
-
isBelowInterval && type != 'max' ?
|
349 |
-
value + 1 :
|
350 |
-
value
|
351 |
-
)
|
352 |
-
}
|
353 |
-
|
354 |
-
// Return the final calculation.
|
355 |
-
return nowMinutes
|
356 |
-
} //TimePicker.prototype.now
|
357 |
-
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Normalize minutes to be “reachable” based on the min and interval.
|
361 |
-
*/
|
362 |
-
TimePicker.prototype.normalize = function( type, value/*, options*/ ) {
|
363 |
-
|
364 |
-
var interval = this.item.interval,
|
365 |
-
minTime = this.item.min && this.item.min.pick || 0
|
366 |
-
|
367 |
-
// If setting min time, don’t shift anything.
|
368 |
-
// Otherwise get the value and min difference and then
|
369 |
-
// normalize the difference with the interval.
|
370 |
-
value -= type == 'min' ? 0 : ( value - minTime ) % interval
|
371 |
-
|
372 |
-
// Return the adjusted value.
|
373 |
-
return value
|
374 |
-
} //TimePicker.prototype.normalize
|
375 |
-
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Measure the range of minutes.
|
379 |
-
*/
|
380 |
-
TimePicker.prototype.measure = function( type, value, options ) {
|
381 |
-
|
382 |
-
var clock = this
|
383 |
-
|
384 |
-
// If it’s anything false-y, set it to the default.
|
385 |
-
if ( !value ) {
|
386 |
-
value = type == 'min' ? [ 0, 0 ] : [ HOURS_IN_DAY - 1, MINUTES_IN_HOUR - 1 ]
|
387 |
-
}
|
388 |
-
|
389 |
-
// If it’s a string, parse it.
|
390 |
-
if ( typeof value == 'string' ) {
|
391 |
-
value = clock.parse( type, value )
|
392 |
-
}
|
393 |
-
|
394 |
-
// If it’s a literal true, or an integer, make it relative to now.
|
395 |
-
else if ( value === true || _.isInteger( value ) ) {
|
396 |
-
value = clock.now( type, value, options )
|
397 |
-
}
|
398 |
-
|
399 |
-
// If it’s an object already, just normalize it.
|
400 |
-
else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
|
401 |
-
value = clock.normalize( type, value.pick, options )
|
402 |
-
}
|
403 |
-
|
404 |
-
return value
|
405 |
-
} ///TimePicker.prototype.measure
|
406 |
-
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Validate an object as enabled.
|
410 |
-
*/
|
411 |
-
TimePicker.prototype.validate = function( type, timeObject, options ) {
|
412 |
-
|
413 |
-
var clock = this,
|
414 |
-
interval = options && options.interval ? options.interval : clock.item.interval
|
415 |
-
|
416 |
-
// Check if the object is disabled.
|
417 |
-
if ( clock.disabled( timeObject ) ) {
|
418 |
-
|
419 |
-
// Shift with the interval until we reach an enabled time.
|
420 |
-
timeObject = clock.shift( timeObject, interval )
|
421 |
-
}
|
422 |
-
|
423 |
-
// Scope the object into range.
|
424 |
-
timeObject = clock.scope( timeObject )
|
425 |
-
|
426 |
-
// Do a second check to see if we landed on a disabled min/max.
|
427 |
-
// In that case, shift using the opposite interval as before.
|
428 |
-
if ( clock.disabled( timeObject ) ) {
|
429 |
-
timeObject = clock.shift( timeObject, interval * -1 )
|
430 |
-
}
|
431 |
-
|
432 |
-
// Return the final object.
|
433 |
-
return timeObject
|
434 |
-
} //TimePicker.prototype.validate
|
435 |
-
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Check if an object is disabled.
|
439 |
-
*/
|
440 |
-
TimePicker.prototype.disabled = function( timeToVerify ) {
|
441 |
-
|
442 |
-
var clock = this,
|
443 |
-
|
444 |
-
// Filter through the disabled times to check if this is one.
|
445 |
-
isDisabledMatch = clock.item.disable.filter( function( timeToDisable ) {
|
446 |
-
|
447 |
-
// If the time is a number, match the hours.
|
448 |
-
if ( _.isInteger( timeToDisable ) ) {
|
449 |
-
return timeToVerify.hour == timeToDisable
|
450 |
-
}
|
451 |
-
|
452 |
-
// If it’s an array, create the object and match the times.
|
453 |
-
if ( $.isArray( timeToDisable ) || _.isDate( timeToDisable ) ) {
|
454 |
-
return timeToVerify.pick == clock.create( timeToDisable ).pick
|
455 |
-
}
|
456 |
-
|
457 |
-
// If it’s an object, match a time within the “from” and “to” range.
|
458 |
-
if ( $.isPlainObject( timeToDisable ) ) {
|
459 |
-
return clock.withinRange( timeToDisable, timeToVerify )
|
460 |
-
}
|
461 |
-
})
|
462 |
-
|
463 |
-
// If this time matches a disabled time, confirm it’s not inverted.
|
464 |
-
isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( timeToDisable ) {
|
465 |
-
return $.isArray( timeToDisable ) && timeToDisable[2] == 'inverted' ||
|
466 |
-
$.isPlainObject( timeToDisable ) && timeToDisable.inverted
|
467 |
-
}).length
|
468 |
-
|
469 |
-
// If the clock is "enabled" flag is flipped, flip the condition.
|
470 |
-
return clock.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
|
471 |
-
timeToVerify.pick < clock.item.min.pick ||
|
472 |
-
timeToVerify.pick > clock.item.max.pick
|
473 |
-
} //TimePicker.prototype.disabled
|
474 |
-
|
475 |
-
|
476 |
-
/**
|
477 |
-
* Shift an object by an interval until we reach an enabled object.
|
478 |
-
*/
|
479 |
-
TimePicker.prototype.shift = function( timeObject, interval ) {
|
480 |
-
|
481 |
-
var clock = this,
|
482 |
-
minLimit = clock.item.min.pick,
|
483 |
-
maxLimit = clock.item.max.pick/*,
|
484 |
-
safety = 1000*/
|
485 |
-
|
486 |
-
interval = interval || clock.item.interval
|
487 |
-
|
488 |
-
// Keep looping as long as the time is disabled.
|
489 |
-
while ( /*safety &&*/ clock.disabled( timeObject ) ) {
|
490 |
-
|
491 |
-
/*safety -= 1
|
492 |
-
if ( !safety ) {
|
493 |
-
throw 'Fell into an infinite loop while shifting to ' + timeObject.hour + ':' + timeObject.mins + '.'
|
494 |
-
}*/
|
495 |
-
|
496 |
-
// Increase/decrease the time by the interval and keep looping.
|
497 |
-
timeObject = clock.create( timeObject.pick += interval )
|
498 |
-
|
499 |
-
// If we've looped beyond the limits, break out of the loop.
|
500 |
-
if ( timeObject.pick <= minLimit || timeObject.pick >= maxLimit ) {
|
501 |
-
break
|
502 |
-
}
|
503 |
-
}
|
504 |
-
|
505 |
-
// Return the final object.
|
506 |
-
return timeObject
|
507 |
-
} //TimePicker.prototype.shift
|
508 |
-
|
509 |
-
|
510 |
-
/**
|
511 |
-
* Scope an object to be within range of min and max.
|
512 |
-
*/
|
513 |
-
TimePicker.prototype.scope = function( timeObject ) {
|
514 |
-
var minLimit = this.item.min.pick,
|
515 |
-
maxLimit = this.item.max.pick
|
516 |
-
return this.create( timeObject.pick > maxLimit ? maxLimit : timeObject.pick < minLimit ? minLimit : timeObject )
|
517 |
-
} //TimePicker.prototype.scope
|
518 |
-
|
519 |
-
|
520 |
-
/**
|
521 |
-
* Parse a string into a usable type.
|
522 |
-
*/
|
523 |
-
TimePicker.prototype.parse = function( type, value, options ) {
|
524 |
-
|
525 |
-
var hour, minutes, isPM, item, parseValue,
|
526 |
-
clock = this,
|
527 |
-
parsingObject = {}
|
528 |
-
|
529 |
-
// If it’s already parsed, we’re good.
|
530 |
-
if ( !value || typeof value != 'string' ) {
|
531 |
-
return value
|
532 |
-
}
|
533 |
-
|
534 |
-
// We need a `.format` to parse the value with.
|
535 |
-
if ( !( options && options.format ) ) {
|
536 |
-
options = options || {}
|
537 |
-
options.format = clock.settings.format
|
538 |
-
}
|
539 |
-
|
540 |
-
// Convert the format into an array and then map through it.
|
541 |
-
clock.formats.toArray( options.format ).map( function( label ) {
|
542 |
-
|
543 |
-
var
|
544 |
-
substring,
|
545 |
-
|
546 |
-
// Grab the formatting label.
|
547 |
-
formattingLabel = clock.formats[ label ],
|
548 |
-
|
549 |
-
// The format length is from the formatting label function or the
|
550 |
-
// label length without the escaping exclamation (!) mark.
|
551 |
-
formatLength = formattingLabel ?
|
552 |
-
_.trigger( formattingLabel, clock, [ value, parsingObject ] ) :
|
553 |
-
label.replace( /^!/, '' ).length
|
554 |
-
|
555 |
-
// If there's a format label, split the value up to the format length.
|
556 |
-
// Then add it to the parsing object with appropriate label.
|
557 |
-
if ( formattingLabel ) {
|
558 |
-
substring = value.substr( 0, formatLength )
|
559 |
-
parsingObject[ label ] = substring.match(/^\d+$/) ? +substring : substring
|
560 |
-
}
|
561 |
-
|
562 |
-
// Update the time value as the substring from format length to end.
|
563 |
-
value = value.substr( formatLength )
|
564 |
-
})
|
565 |
-
|
566 |
-
// Grab the hour and minutes from the parsing object.
|
567 |
-
for ( item in parsingObject ) {
|
568 |
-
parseValue = parsingObject[item]
|
569 |
-
if ( _.isInteger(parseValue) ) {
|
570 |
-
if ( item.match(/^(h|hh)$/i) ) {
|
571 |
-
hour = parseValue
|
572 |
-
if ( item == 'h' || item == 'hh' ) {
|
573 |
-
hour %= 12
|
574 |
-
}
|
575 |
-
}
|
576 |
-
else if ( item == 'i' ) {
|
577 |
-
minutes = parseValue
|
578 |
-
}
|
579 |
-
}
|
580 |
-
else if ( item.match(/^a$/i) && parseValue.match(/^p/i) && ('h' in parsingObject || 'hh' in parsingObject) ) {
|
581 |
-
isPM = true
|
582 |
-
}
|
583 |
-
}
|
584 |
-
|
585 |
-
// Calculate it in minutes and return.
|
586 |
-
return (isPM ? hour + 12 : hour) * MINUTES_IN_HOUR + minutes
|
587 |
-
} //TimePicker.prototype.parse
|
588 |
-
|
589 |
-
|
590 |
-
/**
|
591 |
-
* Various formats to display the object in.
|
592 |
-
*/
|
593 |
-
TimePicker.prototype.formats = {
|
594 |
-
|
595 |
-
h: function( string, timeObject ) {
|
596 |
-
|
597 |
-
// If there's string, then get the digits length.
|
598 |
-
// Otherwise return the selected hour in "standard" format.
|
599 |
-
return string ? _.digits( string ) : timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON
|
600 |
-
},
|
601 |
-
hh: function( string, timeObject ) {
|
602 |
-
|
603 |
-
// If there's a string, then the length is always 2.
|
604 |
-
// Otherwise return the selected hour in "standard" format with a leading zero.
|
605 |
-
return string ? 2 : _.lead( timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON )
|
606 |
-
},
|
607 |
-
H: function( string, timeObject ) {
|
608 |
-
|
609 |
-
// If there's string, then get the digits length.
|
610 |
-
// Otherwise return the selected hour in "military" format as a string.
|
611 |
-
return string ? _.digits( string ) : '' + ( timeObject.hour % 24 )
|
612 |
-
},
|
613 |
-
HH: function( string, timeObject ) {
|
614 |
-
|
615 |
-
// If there's string, then get the digits length.
|
616 |
-
// Otherwise return the selected hour in "military" format with a leading zero.
|
617 |
-
return string ? _.digits( string ) : _.lead( timeObject.hour % 24 )
|
618 |
-
},
|
619 |
-
i: function( string, timeObject ) {
|
620 |
-
|
621 |
-
// If there's a string, then the length is always 2.
|
622 |
-
// Otherwise return the selected minutes.
|
623 |
-
return string ? 2 : _.lead( timeObject.mins )
|
624 |
-
},
|
625 |
-
a: function( string, timeObject ) {
|
626 |
-
|
627 |
-
// If there's a string, then the length is always 4.
|
628 |
-
// Otherwise check if it's more than "noon" and return either am/pm.
|
629 |
-
return string ? 4 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'a.m.' : 'p.m.'
|
630 |
-
},
|
631 |
-
A: function( string, timeObject ) {
|
632 |
-
|
633 |
-
// If there's a string, then the length is always 2.
|
634 |
-
// Otherwise check if it's more than "noon" and return either am/pm.
|
635 |
-
return string ? 2 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'AM' : 'PM'
|
636 |
-
},
|
637 |
-
|
638 |
-
// Create an array by splitting the formatting string passed.
|
639 |
-
toArray: function( formatString ) { return formatString.split( /(h{1,2}|H{1,2}|i|a|A|!.)/g ) },
|
640 |
-
|
641 |
-
// Format an object into a string using the formatting options.
|
642 |
-
toString: function ( formatString, itemObject ) {
|
643 |
-
var clock = this
|
644 |
-
return clock.formats.toArray( formatString ).map( function( label ) {
|
645 |
-
return _.trigger( clock.formats[ label ], clock, [ 0, itemObject ] ) || label.replace( /^!/, '' )
|
646 |
-
}).join( '' )
|
647 |
-
}
|
648 |
-
} //TimePicker.prototype.formats
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
/**
|
654 |
-
* Check if two time units are the exact.
|
655 |
-
*/
|
656 |
-
TimePicker.prototype.isTimeExact = function( one, two ) {
|
657 |
-
|
658 |
-
var clock = this
|
659 |
-
|
660 |
-
// When we’re working with minutes, do a direct comparison.
|
661 |
-
if (
|
662 |
-
( _.isInteger( one ) && _.isInteger( two ) ) ||
|
663 |
-
( typeof one == 'boolean' && typeof two == 'boolean' )
|
664 |
-
) {
|
665 |
-
return one === two
|
666 |
-
}
|
667 |
-
|
668 |
-
// When we’re working with time representations, compare the “pick” value.
|
669 |
-
if (
|
670 |
-
( _.isDate( one ) || $.isArray( one ) ) &&
|
671 |
-
( _.isDate( two ) || $.isArray( two ) )
|
672 |
-
) {
|
673 |
-
return clock.create( one ).pick === clock.create( two ).pick
|
674 |
-
}
|
675 |
-
|
676 |
-
// When we’re working with range objects, compare the “from” and “to”.
|
677 |
-
if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
|
678 |
-
return clock.isTimeExact( one.from, two.from ) && clock.isTimeExact( one.to, two.to )
|
679 |
-
}
|
680 |
-
|
681 |
-
return false
|
682 |
-
}
|
683 |
-
|
684 |
-
|
685 |
-
/**
|
686 |
-
* Check if two time units overlap.
|
687 |
-
*/
|
688 |
-
TimePicker.prototype.isTimeOverlap = function( one, two ) {
|
689 |
-
|
690 |
-
var clock = this
|
691 |
-
|
692 |
-
// When we’re working with an integer, compare the hours.
|
693 |
-
if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) {
|
694 |
-
return one === clock.create( two ).hour
|
695 |
-
}
|
696 |
-
if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) {
|
697 |
-
return two === clock.create( one ).hour
|
698 |
-
}
|
699 |
-
|
700 |
-
// When we’re working with range objects, check if the ranges overlap.
|
701 |
-
if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
|
702 |
-
return clock.overlapRanges( one, two )
|
703 |
-
}
|
704 |
-
|
705 |
-
return false
|
706 |
-
}
|
707 |
-
|
708 |
-
|
709 |
-
/**
|
710 |
-
* Flip the “enabled” state.
|
711 |
-
*/
|
712 |
-
TimePicker.prototype.flipEnable = function(val) {
|
713 |
-
var itemObject = this.item
|
714 |
-
itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
|
715 |
-
}
|
716 |
-
|
717 |
-
|
718 |
-
/**
|
719 |
-
* Mark a collection of times as “disabled”.
|
720 |
-
*/
|
721 |
-
TimePicker.prototype.deactivate = function( type, timesToDisable ) {
|
722 |
-
|
723 |
-
var clock = this,
|
724 |
-
disabledItems = clock.item.disable.slice(0)
|
725 |
-
|
726 |
-
|
727 |
-
// If we’re flipping, that’s all we need to do.
|
728 |
-
if ( timesToDisable == 'flip' ) {
|
729 |
-
clock.flipEnable()
|
730 |
-
}
|
731 |
-
|
732 |
-
else if ( timesToDisable === false ) {
|
733 |
-
clock.flipEnable(1)
|
734 |
-
disabledItems = []
|
735 |
-
}
|
736 |
-
|
737 |
-
else if ( timesToDisable === true ) {
|
738 |
-
clock.flipEnable(-1)
|
739 |
-
disabledItems = []
|
740 |
-
}
|
741 |
-
|
742 |
-
// Otherwise go through the times to disable.
|
743 |
-
else {
|
744 |
-
|
745 |
-
timesToDisable.map(function( unitToDisable ) {
|
746 |
-
|
747 |
-
var matchFound
|
748 |
-
|
749 |
-
// When we have disabled items, check for matches.
|
750 |
-
// If something is matched, immediately break out.
|
751 |
-
for ( var index = 0; index < disabledItems.length; index += 1 ) {
|
752 |
-
if ( clock.isTimeExact( unitToDisable, disabledItems[index] ) ) {
|
753 |
-
matchFound = true
|
754 |
-
break
|
755 |
-
}
|
756 |
-
}
|
757 |
-
|
758 |
-
// If nothing was found, add the validated unit to the collection.
|
759 |
-
if ( !matchFound ) {
|
760 |
-
if (
|
761 |
-
_.isInteger( unitToDisable ) ||
|
762 |
-
_.isDate( unitToDisable ) ||
|
763 |
-
$.isArray( unitToDisable ) ||
|
764 |
-
( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
|
765 |
-
) {
|
766 |
-
disabledItems.push( unitToDisable )
|
767 |
-
}
|
768 |
-
}
|
769 |
-
})
|
770 |
-
}
|
771 |
-
|
772 |
-
// Return the updated collection.
|
773 |
-
return disabledItems
|
774 |
-
} //TimePicker.prototype.deactivate
|
775 |
-
|
776 |
-
|
777 |
-
/**
|
778 |
-
* Mark a collection of times as “enabled”.
|
779 |
-
*/
|
780 |
-
TimePicker.prototype.activate = function( type, timesToEnable ) {
|
781 |
-
|
782 |
-
var clock = this,
|
783 |
-
disabledItems = clock.item.disable,
|
784 |
-
disabledItemsCount = disabledItems.length
|
785 |
-
|
786 |
-
// If we’re flipping, that’s all we need to do.
|
787 |
-
if ( timesToEnable == 'flip' ) {
|
788 |
-
clock.flipEnable()
|
789 |
-
}
|
790 |
-
|
791 |
-
else if ( timesToEnable === true ) {
|
792 |
-
clock.flipEnable(1)
|
793 |
-
disabledItems = []
|
794 |
-
}
|
795 |
-
|
796 |
-
else if ( timesToEnable === false ) {
|
797 |
-
clock.flipEnable(-1)
|
798 |
-
disabledItems = []
|
799 |
-
}
|
800 |
-
|
801 |
-
// Otherwise go through the disabled times.
|
802 |
-
else {
|
803 |
-
|
804 |
-
timesToEnable.map(function( unitToEnable ) {
|
805 |
-
|
806 |
-
var matchFound,
|
807 |
-
disabledUnit,
|
808 |
-
index,
|
809 |
-
isRangeMatched
|
810 |
-
|
811 |
-
// Go through the disabled items and try to find a match.
|
812 |
-
for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
813 |
-
|
814 |
-
disabledUnit = disabledItems[index]
|
815 |
-
|
816 |
-
// When an exact match is found, remove it from the collection.
|
817 |
-
if ( clock.isTimeExact( disabledUnit, unitToEnable ) ) {
|
818 |
-
matchFound = disabledItems[index] = null
|
819 |
-
isRangeMatched = true
|
820 |
-
break
|
821 |
-
}
|
822 |
-
|
823 |
-
// When an overlapped match is found, add the “inverted” state to it.
|
824 |
-
else if ( clock.isTimeOverlap( disabledUnit, unitToEnable ) ) {
|
825 |
-
if ( $.isPlainObject( unitToEnable ) ) {
|
826 |
-
unitToEnable.inverted = true
|
827 |
-
matchFound = unitToEnable
|
828 |
-
}
|
829 |
-
else if ( $.isArray( unitToEnable ) ) {
|
830 |
-
matchFound = unitToEnable
|
831 |
-
if ( !matchFound[2] ) matchFound.push( 'inverted' )
|
832 |
-
}
|
833 |
-
else if ( _.isDate( unitToEnable ) ) {
|
834 |
-
matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
|
835 |
-
}
|
836 |
-
break
|
837 |
-
}
|
838 |
-
}
|
839 |
-
|
840 |
-
// If a match was found, remove a previous duplicate entry.
|
841 |
-
if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
842 |
-
if ( clock.isTimeExact( disabledItems[index], unitToEnable ) ) {
|
843 |
-
disabledItems[index] = null
|
844 |
-
break
|
845 |
-
}
|
846 |
-
}
|
847 |
-
|
848 |
-
// In the event that we’re dealing with an overlap of range times,
|
849 |
-
// make sure there are no “inverted” times because of it.
|
850 |
-
if ( isRangeMatched ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
851 |
-
if ( clock.isTimeOverlap( disabledItems[index], unitToEnable ) ) {
|
852 |
-
disabledItems[index] = null
|
853 |
-
break
|
854 |
-
}
|
855 |
-
}
|
856 |
-
|
857 |
-
// If something is still matched, add it into the collection.
|
858 |
-
if ( matchFound ) {
|
859 |
-
disabledItems.push( matchFound )
|
860 |
-
}
|
861 |
-
})
|
862 |
-
}
|
863 |
-
|
864 |
-
// Return the updated collection.
|
865 |
-
return disabledItems.filter(function( val ) { return val != null })
|
866 |
-
} //TimePicker.prototype.activate
|
867 |
-
|
868 |
-
|
869 |
-
/**
|
870 |
-
* The division to use for the range intervals.
|
871 |
-
*/
|
872 |
-
TimePicker.prototype.i = function( type, value/*, options*/ ) {
|
873 |
-
return _.isInteger( value ) && value > 0 ? value : this.item.interval
|
874 |
-
}
|
875 |
-
|
876 |
-
|
877 |
-
/**
|
878 |
-
* Create a string for the nodes in the picker.
|
879 |
-
*/
|
880 |
-
TimePicker.prototype.nodes = function( isOpen ) {
|
881 |
-
|
882 |
-
var
|
883 |
-
clock = this,
|
884 |
-
settings = clock.settings,
|
885 |
-
selectedObject = clock.item.select,
|
886 |
-
highlightedObject = clock.item.highlight,
|
887 |
-
viewsetObject = clock.item.view,
|
888 |
-
disabledCollection = clock.item.disable
|
889 |
-
|
890 |
-
return _.node(
|
891 |
-
'ul',
|
892 |
-
_.group({
|
893 |
-
min: clock.item.min.pick,
|
894 |
-
max: clock.item.max.pick,
|
895 |
-
i: clock.item.interval,
|
896 |
-
node: 'li',
|
897 |
-
item: function( loopedTime ) {
|
898 |
-
loopedTime = clock.create( loopedTime )
|
899 |
-
var timeMinutes = loopedTime.pick,
|
900 |
-
isSelected = selectedObject && selectedObject.pick == timeMinutes,
|
901 |
-
isHighlighted = highlightedObject && highlightedObject.pick == timeMinutes,
|
902 |
-
isDisabled = disabledCollection && clock.disabled( loopedTime ),
|
903 |
-
formattedTime = _.trigger( clock.formats.toString, clock, [ settings.format, loopedTime ] )
|
904 |
-
return [
|
905 |
-
_.trigger( clock.formats.toString, clock, [ _.trigger( settings.formatLabel, clock, [ loopedTime ] ) || settings.format, loopedTime ] ),
|
906 |
-
(function( klasses ) {
|
907 |
-
|
908 |
-
if ( isSelected ) {
|
909 |
-
klasses.push( settings.klass.selected )
|
910 |
-
}
|
911 |
-
|
912 |
-
if ( isHighlighted ) {
|
913 |
-
klasses.push( settings.klass.highlighted )
|
914 |
-
}
|
915 |
-
|
916 |
-
if ( viewsetObject && viewsetObject.pick == timeMinutes ) {
|
917 |
-
klasses.push( settings.klass.viewset )
|
918 |
-
}
|
919 |
-
|
920 |
-
if ( isDisabled ) {
|
921 |
-
klasses.push( settings.klass.disabled )
|
922 |
-
}
|
923 |
-
|
924 |
-
return klasses.join( ' ' )
|
925 |
-
})( [ settings.klass.listItem ] ),
|
926 |
-
'data-pick=' + loopedTime.pick + ' ' + _.ariaAttr({
|
927 |
-
role: 'option',
|
928 |
-
label: formattedTime,
|
929 |
-
selected: isSelected && clock.$node.val() === formattedTime ? true : null,
|
930 |
-
activedescendant: isHighlighted ? true : null,
|
931 |
-
disabled: isDisabled ? true : null
|
932 |
-
})
|
933 |
-
]
|
934 |
-
}
|
935 |
-
}) +
|
936 |
-
|
937 |
-
// * For Firefox forms to submit, make sure to set the button’s `type` attribute as “button”.
|
938 |
-
_.node(
|
939 |
-
'li',
|
940 |
-
_.node(
|
941 |
-
'button',
|
942 |
-
settings.clear,
|
943 |
-
settings.klass.buttonClear,
|
944 |
-
'type=button data-clear=1' + ( isOpen ? '' : ' disabled' ) + ' ' +
|
945 |
-
_.ariaAttr({ controls: clock.$node[0].id })
|
946 |
-
),
|
947 |
-
'', _.ariaAttr({ role: 'presentation' })
|
948 |
-
),
|
949 |
-
settings.klass.list,
|
950 |
-
_.ariaAttr({ role: 'listbox', controls: clock.$node[0].id })
|
951 |
-
)
|
952 |
-
} //TimePicker.prototype.nodes
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
/**
|
961 |
-
* Extend the picker to add the component with the defaults.
|
962 |
-
*/
|
963 |
-
TimePicker.defaults = (function( prefix ) {
|
964 |
-
|
965 |
-
return {
|
966 |
-
|
967 |
-
// Clear
|
968 |
-
clear: 'Clear',
|
969 |
-
|
970 |
-
// The format to show on the `input` element
|
971 |
-
format: 'h:i A',
|
972 |
-
|
973 |
-
// The interval between each time
|
974 |
-
interval: 30,
|
975 |
-
|
976 |
-
// Picker close behavior
|
977 |
-
closeOnSelect: true,
|
978 |
-
closeOnClear: true,
|
979 |
-
|
980 |
-
// Classes
|
981 |
-
klass: {
|
982 |
-
|
983 |
-
picker: prefix + ' ' + prefix + '--time',
|
984 |
-
holder: prefix + '__holder',
|
985 |
-
|
986 |
-
list: prefix + '__list',
|
987 |
-
listItem: prefix + '__list-item',
|
988 |
-
|
989 |
-
disabled: prefix + '__list-item--disabled',
|
990 |
-
selected: prefix + '__list-item--selected',
|
991 |
-
highlighted: prefix + '__list-item--highlighted',
|
992 |
-
viewset: prefix + '__list-item--viewset',
|
993 |
-
now: prefix + '__list-item--now',
|
994 |
-
|
995 |
-
buttonClear: prefix + '__button--clear'
|
996 |
-
}
|
997 |
-
}
|
998 |
-
})( Picker.klasses().picker )
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
/**
|
1005 |
-
* Extend the picker to add the time picker.
|
1006 |
-
*/
|
1007 |
-
Picker.extend( 'pickatime', TimePicker )
|
1008 |
-
|
1009 |
-
|
1010 |
-
}));
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1 |
+
!function(t){"function"==typeof define&&define.amd?define(["picker","jquery"],t):"object"==typeof exports?module.exports=t(require("./picker.js"),require("jquery")):t(Picker,jQuery)}(function(t,e){function i(t,e){var i=this,r=t.$node[0].value,n=t.$node.data("value"),a=n||r,s=n?e.formatSubmit:e.format;i.settings=e,i.$node=t.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=e.interval||30,i.item.disable=(e.disable||[]).slice(0),i.item.enable=-function(t){return t[0]===!0?t.shift():-1}(i.item.disable),i.set("min",e.min).set("max",e.max).set("now"),a?i.set("select",a,{format:s}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(t){i.set("highlight",i.item.highlight.pick+t*i.item.interval,{interval:t*i.item.interval}),this.render()}},t.on("render",function(){var i=t.$root.children(),r=i.find("."+e.klass.viewset),n=function(t){return["webkit","moz","ms","o",""].map(function(e){return(e?"-"+e+"-":"")+t})},a=function(t,e){n("transform").map(function(i){t.css(i,e)}),n("transition").map(function(i){t.css(i,e)})};r.length&&(a(i,"none"),i[0].scrollTop=~~r.position().top-2*r[0].clientHeight,a(i,""))},1).on("open",function(){t.$root.find("button").attr("disabled",!1)},1).on("close",function(){t.$root.find("button").attr("disabled",!0)},1)}var r=24,n=60,a=12,s=r*n,o=t._;i.prototype.set=function(t,e,i){var r=this,n=r.item;return null===e?("clear"==t&&(t="select"),n[t]=e,r):(n["enable"==t?"disable":"flip"==t?"enable":t]=r.queue[t].split(" ").map(function(n){return e=r[n](t,e,i)}).pop(),"select"==t?r.set("highlight",n.select,i):"highlight"==t?r.set("view",n.highlight,i):"interval"==t?r.set("min",n.min,i).set("max",n.max,i):t.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&r.disabled(n.select)&&r.set("select",e,i),n.highlight&&r.disabled(n.highlight)&&r.set("highlight",e,i),"min"==t&&r.set("max",n.max,i)),r)},i.prototype.get=function(t){return this.item[t]},i.prototype.create=function(t,i,a){var l=this;return i=void 0===i?t:i,o.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),e.isPlainObject(i)&&o.isInteger(i.pick)?i=i.pick:e.isArray(i)?i=+i[0]*n+ +i[1]:o.isInteger(i)||(i=l.now(t,i,a)),"max"==t&&i<l.item.min.pick&&(i+=s),"min"!=t&&"max"!=t&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(t,i,a),{hour:~~(r+i/n)%r,mins:(n+i%n)%n,time:(s+i)%s,pick:i%s}},i.prototype.createRange=function(t,i){var r=this,n=function(t){return t===!0||e.isArray(t)||o.isDate(t)?r.create(t):t};return o.isInteger(t)||(t=n(t)),o.isInteger(i)||(i=n(i)),o.isInteger(t)&&e.isPlainObject(i)?t=[i.hour,i.mins+t*r.settings.interval]:o.isInteger(i)&&e.isPlainObject(t)&&(i=[t.hour,t.mins+i*r.settings.interval]),{from:n(t),to:n(i)}},i.prototype.withinRange=function(t,e){return t=this.createRange(t.from,t.to),e.pick>=t.from.pick&&e.pick<=t.to.pick},i.prototype.overlapRanges=function(t,e){var i=this;return t=i.createRange(t.from,t.to),e=i.createRange(e.from,e.to),i.withinRange(t,e.from)||i.withinRange(t,e.to)||i.withinRange(e,t.from)||i.withinRange(e,t.to)},i.prototype.now=function(t,e){var i,r=this.item.interval,a=new Date,s=a.getHours()*n+a.getMinutes(),l=o.isInteger(e);return s-=s%r,i=0>e&&-r>=r*e+s,s+="min"==t&&i?0:r,l&&(s+=r*(i&&"max"!=t?e+1:e)),s},i.prototype.normalize=function(t,e){var i=this.item.interval,r=this.item.min&&this.item.min.pick||0;return e-="min"==t?0:(e-r)%i},i.prototype.measure=function(t,i,a){var s=this;return i||(i="min"==t?[0,0]:[r-1,n-1]),"string"==typeof i?i=s.parse(t,i):i===!0||o.isInteger(i)?i=s.now(t,i,a):e.isPlainObject(i)&&o.isInteger(i.pick)&&(i=s.normalize(t,i.pick,a)),i},i.prototype.validate=function(t,e,i){var r=this,n=i&&i.interval?i.interval:r.item.interval;return r.disabled(e)&&(e=r.shift(e,n)),e=r.scope(e),r.disabled(e)&&(e=r.shift(e,-1*n)),e},i.prototype.disabled=function(t){var i=this,r=i.item.disable.filter(function(r){return o.isInteger(r)?t.hour==r:e.isArray(r)||o.isDate(r)?t.pick==i.create(r).pick:e.isPlainObject(r)?i.withinRange(r,t):void 0});return r=r.length&&!r.filter(function(t){return e.isArray(t)&&"inverted"==t[2]||e.isPlainObject(t)&&t.inverted}).length,-1===i.item.enable?!r:r||t.pick<i.item.min.pick||t.pick>i.item.max.pick},i.prototype.shift=function(t,e){var i=this,r=i.item.min.pick,n=i.item.max.pick;for(e=e||i.item.interval;i.disabled(t)&&(t=i.create(t.pick+=e),!(t.pick<=r||t.pick>=n)););return t},i.prototype.scope=function(t){var e=this.item.min.pick,i=this.item.max.pick;return this.create(t.pick>i?i:t.pick<e?e:t)},i.prototype.parse=function(t,e,i){var r,a,s,l,c,m=this,u={};if(!e||"string"!=typeof e)return e;i&&i.format||(i=i||{},i.format=m.settings.format),m.formats.toArray(i.format).map(function(t){var i,r=m.formats[t],n=r?o.trigger(r,m,[e,u]):t.replace(/^!/,"").length;r&&(i=e.substr(0,n),u[t]=i.match(/^\d+$/)?+i:i),e=e.substr(n)});for(l in u)c=u[l],o.isInteger(c)?l.match(/^(h|hh)$/i)?(r=c,("h"==l||"hh"==l)&&(r%=12)):"i"==l&&(a=c):l.match(/^a$/i)&&c.match(/^p/i)&&("h"in u||"hh"in u)&&(s=!0);return(s?r+12:r)*n+a},i.prototype.formats={h:function(t,e){return t?o.digits(t):e.hour%a||a},hh:function(t,e){return t?2:o.lead(e.hour%a||a)},H:function(t,e){return t?o.digits(t):""+e.hour%24},HH:function(t,e){return t?o.digits(t):o.lead(e.hour%24)},i:function(t,e){return t?2:o.lead(e.mins)},a:function(t,e){return t?4:s/2>e.time%s?"a.m.":"p.m."},A:function(t,e){return t?2:s/2>e.time%s?"AM":"PM"},toArray:function(t){return t.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(t,e){var i=this;return i.formats.toArray(t).map(function(t){return o.trigger(i.formats[t],i,[0,e])||t.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(t,i){var r=this;return o.isInteger(t)&&o.isInteger(i)||"boolean"==typeof t&&"boolean"==typeof i?t===i:(o.isDate(t)||e.isArray(t))&&(o.isDate(i)||e.isArray(i))?r.create(t).pick===r.create(i).pick:e.isPlainObject(t)&&e.isPlainObject(i)?r.isTimeExact(t.from,i.from)&&r.isTimeExact(t.to,i.to):!1},i.prototype.isTimeOverlap=function(t,i){var r=this;return o.isInteger(t)&&(o.isDate(i)||e.isArray(i))?t===r.create(i).hour:o.isInteger(i)&&(o.isDate(t)||e.isArray(t))?i===r.create(t).hour:e.isPlainObject(t)&&e.isPlainObject(i)?r.overlapRanges(t,i):!1},i.prototype.flipEnable=function(t){var e=this.item;e.enable=t||(-1==e.enable?1:-1)},i.prototype.deactivate=function(t,i){var r=this,n=r.item.disable.slice(0);return"flip"==i?r.flipEnable():i===!1?(r.flipEnable(1),n=[]):i===!0?(r.flipEnable(-1),n=[]):i.map(function(t){for(var i,a=0;a<n.length;a+=1)if(r.isTimeExact(t,n[a])){i=!0;break}i||(o.isInteger(t)||o.isDate(t)||e.isArray(t)||e.isPlainObject(t)&&t.from&&t.to)&&n.push(t)}),n},i.prototype.activate=function(t,i){var r=this,n=r.item.disable,a=n.length;return"flip"==i?r.flipEnable():i===!0?(r.flipEnable(1),n=[]):i===!1?(r.flipEnable(-1),n=[]):i.map(function(t){var i,s,l,c;for(l=0;a>l;l+=1){if(s=n[l],r.isTimeExact(s,t)){i=n[l]=null,c=!0;break}if(r.isTimeOverlap(s,t)){e.isPlainObject(t)?(t.inverted=!0,i=t):e.isArray(t)?(i=t,i[2]||i.push("inverted")):o.isDate(t)&&(i=[t.getFullYear(),t.getMonth(),t.getDate(),"inverted"]);break}}if(i)for(l=0;a>l;l+=1)if(r.isTimeExact(n[l],t)){n[l]=null;break}if(c)for(l=0;a>l;l+=1)if(r.isTimeOverlap(n[l],t)){n[l]=null;break}i&&n.push(i)}),n.filter(function(t){return null!=t})},i.prototype.i=function(t,e){return o.isInteger(e)&&e>0?e:this.item.interval},i.prototype.nodes=function(t){var e=this,i=e.settings,r=e.item.select,n=e.item.highlight,a=e.item.view,s=e.item.disable;return o.node("ul",o.group({min:e.item.min.pick,max:e.item.max.pick,i:e.item.interval,node:"li",item:function(t){t=e.create(t);var l=t.pick,c=r&&r.pick==l,m=n&&n.pick==l,u=s&&e.disabled(t),p=o.trigger(e.formats.toString,e,[i.format,t]);return[o.trigger(e.formats.toString,e,[o.trigger(i.formatLabel,e,[t])||i.format,t]),function(t){return c&&t.push(i.klass.selected),m&&t.push(i.klass.highlighted),a&&a.pick==l&&t.push(i.klass.viewset),u&&t.push(i.klass.disabled),t.join(" ")}([i.klass.listItem]),"data-pick="+t.pick+" "+o.ariaAttr({role:"option",label:p,selected:c&&e.$node.val()===p?!0:null,activedescendant:m?!0:null,disabled:u?!0:null})]}})+o.node("li",o.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(t?"":" disabled")+" "+o.ariaAttr({controls:e.$node[0].id})),"",o.ariaAttr({role:"presentation"})),i.klass.list,o.ariaAttr({role:"listbox",controls:e.$node[0].id}))},i.defaults=function(t){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:t+" "+t+"--time",holder:t+"__holder",list:t+"__list",listItem:t+"__list-item",disabled:t+"__list-item--disabled",selected:t+"__list-item--selected",highlighted:t+"__list-item--highlighted",viewset:t+"__list-item--viewset",now:t+"__list-item--now",buttonClear:t+"__button--clear"}}}(t.klasses().picker),t.extend("pickatime",i)});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/wpm-color-options.js
CHANGED
@@ -1,18 +1 @@
|
|
1 |
-
var wpmOptions
|
2 |
-
// you can declare a default color here,
|
3 |
-
// or in the data-default-color attribute on the input
|
4 |
-
defaultColor: false,
|
5 |
-
// a callback to fire whenever the color changes to a valid color
|
6 |
-
change: function(event, ui){},
|
7 |
-
// a callback to fire when the input is emptied or an invalid color
|
8 |
-
clear: function() {},
|
9 |
-
// hide the color picker controls on load
|
10 |
-
hide: true,
|
11 |
-
// show a group of common colors beneath the square
|
12 |
-
// or, supply an array of colors to customize further
|
13 |
-
palettes: true
|
14 |
-
};
|
15 |
-
|
16 |
-
jQuery(document).ready(function($){
|
17 |
-
$('.wpm-color-field').wpColorPicker(wpmOptions);
|
18 |
-
});
|
1 |
+
var wpmOptions={defaultColor:!1,change:function(o,e){},clear:function(){},hide:!0,palettes:!0};jQuery(document).ready(function(o){o(".wpm-color-field").wpColorPicker(wpmOptions)});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/wpm-cpt-script.js
CHANGED
@@ -1,89 +1 @@
|
|
1 |
-
|
2 |
-
Author: Robert Hashemian
|
3 |
-
http://www.hashemian.com/
|
4 |
-
|
5 |
-
You can use this code in any manner so long as the author's
|
6 |
-
name, Web address and this disclaimer is kept intact.
|
7 |
-
********************************************************
|
8 |
-
Usage Sample:
|
9 |
-
|
10 |
-
<script language="JavaScript">
|
11 |
-
TargetDate = "12/31/2020 5:00 AM";
|
12 |
-
BackColor = "palegreen";
|
13 |
-
ForeColor = "navy";
|
14 |
-
CountActive = true;
|
15 |
-
CountStepper = -1;
|
16 |
-
LeadingZero = true;
|
17 |
-
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
|
18 |
-
FinishMessage = "It is finally here!";
|
19 |
-
</script>
|
20 |
-
<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>
|
21 |
-
*/
|
22 |
-
|
23 |
-
function calcage(secs, num1, num2) {
|
24 |
-
s = ((Math.floor(secs/num1))%num2).toString();
|
25 |
-
if (LeadingZero && s.length < 2)
|
26 |
-
s = "0" + s;
|
27 |
-
return "<b>" + s + "</b>";
|
28 |
-
}
|
29 |
-
|
30 |
-
function CountBack(secs) {
|
31 |
-
if (secs < 0) {
|
32 |
-
if(Disable==1) {
|
33 |
-
document.location.replace(UrlDisable);
|
34 |
-
} else {
|
35 |
-
document.getElementById("cntdwn").innerHTML = FinishMessage;
|
36 |
-
}
|
37 |
-
return;
|
38 |
-
}
|
39 |
-
DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
|
40 |
-
DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
|
41 |
-
DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
|
42 |
-
DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));
|
43 |
-
|
44 |
-
document.getElementById("cntdwn").innerHTML = DisplayStr;
|
45 |
-
if (CountActive)
|
46 |
-
setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
|
47 |
-
}
|
48 |
-
|
49 |
-
function putspan(BackColor, ForeColor) {
|
50 |
-
document.write("<div class='cptR-rec_countdown'><span id='cntdwn' style='font-family:" + FontFamily + ";background-color:" + BackColor + "; color:" + ForeColor + "; font-size:" + FontSize + "px;'></span></div>");
|
51 |
-
}
|
52 |
-
|
53 |
-
if (typeof(BackColor)=="undefined")
|
54 |
-
BackColor = "";
|
55 |
-
if (typeof(ForeColor)=="undefined")
|
56 |
-
ForeColor= "black";
|
57 |
-
if (typeof(FontSize)=="undefined")
|
58 |
-
FontSize= "78";
|
59 |
-
if (typeof(TargetDate)=="undefined")
|
60 |
-
TargetDate = "12/31/2020 5:00 AM";
|
61 |
-
if (typeof(DisplayFormat)=="undefined")
|
62 |
-
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
|
63 |
-
if (typeof(CountActive)=="undefined")
|
64 |
-
CountActive = true;
|
65 |
-
if (typeof(FinishMessage)=="undefined")
|
66 |
-
FinishMessage = "";
|
67 |
-
if (typeof(CountStepper)!="number")
|
68 |
-
CountStepper = -1;
|
69 |
-
if (typeof(LeadingZero)=="undefined")
|
70 |
-
LeadingZero = true;
|
71 |
-
if (typeof(Disable)=="undefined")
|
72 |
-
Disable = "";
|
73 |
-
if (typeof(FontFamily)=="undefined")
|
74 |
-
FontFamily = "Pacifico";
|
75 |
-
|
76 |
-
|
77 |
-
CountStepper = Math.ceil(CountStepper);
|
78 |
-
if (CountStepper == 0)
|
79 |
-
CountActive = false;
|
80 |
-
var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
|
81 |
-
putspan(BackColor, ForeColor, FontSize);
|
82 |
-
var dthen = new Date(TargetDate);
|
83 |
-
var dnow = new Date();
|
84 |
-
if(CountStepper>0)
|
85 |
-
ddiff = new Date(dnow-dthen);
|
86 |
-
else
|
87 |
-
ddiff = new Date(dthen-dnow);
|
88 |
-
gsecs = Math.floor(ddiff.valueOf()/1000);
|
89 |
-
CountBack(gsecs);
|
1 |
+
function calcage(e,t,n){return s=(Math.floor(e/t)%n).toString(),LeadingZero&&s.length<2&&(s="0"+s),"<b>"+s+"</b>"}function CountBack(e){return 0>e?void(1==Disable?document.location.replace(UrlDisable):document.getElementById("cntdwn").innerHTML=FinishMessage):(DisplayStr=DisplayFormat.replace(/%%D%%/g,calcage(e,86400,1e5)),DisplayStr=DisplayStr.replace(/%%H%%/g,calcage(e,3600,24)),DisplayStr=DisplayStr.replace(/%%M%%/g,calcage(e,60,60)),DisplayStr=DisplayStr.replace(/%%S%%/g,calcage(e,1,60)),document.getElementById("cntdwn").innerHTML=DisplayStr,void(CountActive&&setTimeout("CountBack("+(e+CountStepper)+")",SetTimeOutPeriod)))}function putspan(e,t){document.write("<div class='cptR-rec_countdown'><span id='cntdwn' style='font-family:"+FontFamily+";background-color:"+e+"; color:"+t+"; font-size:"+FontSize+"px;'></span></div>")}"undefined"==typeof BackColor&&(BackColor=""),"undefined"==typeof ForeColor&&(ForeColor="black"),"undefined"==typeof FontSize&&(FontSize="78"),"undefined"==typeof TargetDate&&(TargetDate="12/31/2020 5:00 AM"),"undefined"==typeof DisplayFormat&&(DisplayFormat="%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."),"undefined"==typeof CountActive&&(CountActive=!0),"undefined"==typeof FinishMessage&&(FinishMessage=""),"number"!=typeof CountStepper&&(CountStepper=-1),"undefined"==typeof LeadingZero&&(LeadingZero=!0),"undefined"==typeof Disable&&(Disable=""),"undefined"==typeof FontFamily&&(FontFamily="Pacifico"),CountStepper=Math.ceil(CountStepper),0==CountStepper&&(CountActive=!1);var SetTimeOutPeriod=1e3*(Math.abs(CountStepper)-1)+990;putspan(BackColor,ForeColor,FontSize);var dthen=new Date(TargetDate),dnow=new Date;CountStepper>0?ddiff=new Date(dnow-dthen):ddiff=new Date(dthen-dnow),gsecs=Math.floor(ddiff.valueOf()/1e3),CountBack(gsecs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/wpm-footer-scripts.js
CHANGED
@@ -1,27 +1 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
|
3 |
-
var $input = jQuery( '.datepicker' ).pickadate({
|
4 |
-
formatSubmit: 'dd/mm/yyyy',
|
5 |
-
// min: [2015, 7, 14],
|
6 |
-
container: '#container',
|
7 |
-
// editable: true,
|
8 |
-
closeOnSelect: false,
|
9 |
-
closeOnClear: false,
|
10 |
-
first_day: 1,
|
11 |
-
date_min: [ 2015, 12, 12 ],
|
12 |
-
})
|
13 |
-
|
14 |
-
var picker = $input.pickadate('picker')
|
15 |
-
|
16 |
-
// picker.set('select', '14 October, 2014')
|
17 |
-
// picker.open()
|
18 |
-
|
19 |
-
// $('button').on('click', function() {
|
20 |
-
// picker.set('disable', true);
|
21 |
-
// });
|
22 |
-
/*var $input = jQuery( '.datepicker' ).pickatime({
|
23 |
-
})
|
24 |
-
var picker = $input.pickatime('picker')
|
25 |
-
picker.open()*/
|
26 |
-
|
27 |
-
});
|
1 |
+
jQuery(document).ready(function(){var e=jQuery(".datepicker").pickadate({formatSubmit:"dd/mm/yyyy",container:"#container",closeOnSelect:!1,closeOnClear:!1,first_day:1,date_min:[2015,12,12]});e.pickadate("picker")});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/wpm-script.js
CHANGED
@@ -1,146 +1 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
|
3 |
-
var custom_uploader;
|
4 |
-
|
5 |
-
jQuery('#upload_image_button').click(function(e) {
|
6 |
-
|
7 |
-
e.preventDefault();
|
8 |
-
|
9 |
-
//If the uploader object has already been created, reopen the dialog
|
10 |
-
if (custom_uploader) {
|
11 |
-
custom_uploader.open();
|
12 |
-
return;
|
13 |
-
}
|
14 |
-
|
15 |
-
//Extend the wp.media object
|
16 |
-
custom_uploader = wp.media.frames.file_frame = wp.media({
|
17 |
-
title: Data.title,
|
18 |
-
button: {
|
19 |
-
text: Data.textebutton
|
20 |
-
},
|
21 |
-
multiple: false
|
22 |
-
});
|
23 |
-
|
24 |
-
//When a file is selected, grab the URL and set it as the text field's value
|
25 |
-
custom_uploader.on('select', function() {
|
26 |
-
attachment = custom_uploader.state().get('selection').first().toJSON();
|
27 |
-
jQuery('#upload_image').val(attachment.url);
|
28 |
-
});
|
29 |
-
|
30 |
-
//Open the uploader dialog
|
31 |
-
custom_uploader.open();
|
32 |
-
|
33 |
-
});
|
34 |
-
|
35 |
-
jQuery('#upload_b_image_button').click(function(e) {
|
36 |
-
|
37 |
-
e.preventDefault();
|
38 |
-
|
39 |
-
//If the uploader object has already been created, reopen the dialog
|
40 |
-
if (custom_uploader) {
|
41 |
-
custom_uploader.open();
|
42 |
-
return;
|
43 |
-
}
|
44 |
-
|
45 |
-
//Extend the wp.media object
|
46 |
-
custom_uploader = wp.media.frames.file_frame = wp.media({
|
47 |
-
title: Data.title,
|
48 |
-
button: {
|
49 |
-
text: Data.textebutton
|
50 |
-
},
|
51 |
-
multiple: false
|
52 |
-
});
|
53 |
-
|
54 |
-
//When a file is selected, grab the URL and set it as the text field's value
|
55 |
-
custom_uploader.on('select', function() {
|
56 |
-
attachment = custom_uploader.state().get('selection').first().toJSON();
|
57 |
-
jQuery('#upload_b_image').val(attachment.url);
|
58 |
-
});
|
59 |
-
|
60 |
-
//Open the uploader dialog
|
61 |
-
custom_uploader.open();
|
62 |
-
|
63 |
-
});
|
64 |
-
|
65 |
-
jQuery('#upload_slider_image_button').click(function(e) {
|
66 |
-
|
67 |
-
e.preventDefault();
|
68 |
-
|
69 |
-
//If the uploader object has already been created, reopen the dialog
|
70 |
-
if (custom_uploader) {
|
71 |
-
custom_uploader.open();
|
72 |
-
return;
|
73 |
-
}
|
74 |
-
|
75 |
-
//Extend the wp.media object
|
76 |
-
custom_uploader = wp.media.frames.file_frame = wp.media({
|
77 |
-
title: Data.title,
|
78 |
-
button: {
|
79 |
-
text: Data.textebutton
|
80 |
-
},
|
81 |
-
multiple: false
|
82 |
-
});
|
83 |
-
|
84 |
-
//When a file is selected, grab the URL and set it as the text field's value
|
85 |
-
custom_uploader.on('select', function() {
|
86 |
-
attachment = custom_uploader.state().get('selection').first().toJSON();
|
87 |
-
jQuery('#upload_slider_image').val(attachment.url);
|
88 |
-
});
|
89 |
-
|
90 |
-
//Open the uploader dialog
|
91 |
-
custom_uploader.open();
|
92 |
-
|
93 |
-
});
|
94 |
-
|
95 |
-
});
|
96 |
-
|
97 |
-
jQuery(window).load(function(){
|
98 |
-
jQuery("#wpmcontainer").sticky({ topSpacing: 32, zIndex:9980, left:0, getWidthFrom:'#divwpmcontainer' });
|
99 |
-
});
|
100 |
-
|
101 |
-
function AfficherTexte(texte) {
|
102 |
-
document.getElementById(texte).style.display = "block";
|
103 |
-
}
|
104 |
-
function CacherTexte(texte) {
|
105 |
-
document.getElementById(texte).style.display = "none";
|
106 |
-
}
|
107 |
-
|
108 |
-
function AfficherCacher(texte) {
|
109 |
-
var divid = document.getElementById(texte).style.display;
|
110 |
-
if (divid == "block")
|
111 |
-
{
|
112 |
-
document.getElementById(texte).style.display = "none";
|
113 |
-
}
|
114 |
-
else
|
115 |
-
{
|
116 |
-
document.getElementById(texte).style.display = "block";
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
/*jQuery(document).ready(function() {
|
121 |
-
var taille = document.getElementById('date_cpt_size').value;
|
122 |
-
var augmentation = 1;
|
123 |
-
var tailleMax = 90;
|
124 |
-
var tailleMin= 10;
|
125 |
-
|
126 |
-
jQuery('#agrandir').click(function() {
|
127 |
-
taille +=1;
|
128 |
-
if(taille >= tailleMax)
|
129 |
-
{
|
130 |
-
taille = tailleMax;
|
131 |
-
}
|
132 |
-
jQuery('#text').stop().animate({fontSize: taille+"px"},300);
|
133 |
-
jQuery('#date_cpt_size').val(taille);
|
134 |
-
});
|
135 |
-
|
136 |
-
jQuery('#diminuer').click(function() {
|
137 |
-
taille -=1;
|
138 |
-
if(taille <= tailleMin)
|
139 |
-
{
|
140 |
-
taille = tailleMin;
|
141 |
-
}
|
142 |
-
jQuery('#text').stop().animate({fontSize: taille+"px"},300);
|
143 |
-
jQuery('#date_cpt_size').val(taille);
|
144 |
-
});
|
145 |
-
});*/
|
146 |
-
|
1 |
+
function AfficherTexte(t){document.getElementById(t).style.display="block"}function CacherTexte(t){document.getElementById(t).style.display="none"}function AfficherCacher(t){var e=document.getElementById(t).style.display;"block"==e?document.getElementById(t).style.display="none":document.getElementById(t).style.display="block"}jQuery(document).ready(function(){var t;jQuery("#upload_image_button").click(function(e){return e.preventDefault(),t?void t.open():(t=wp.media.frames.file_frame=wp.media({title:Data.title,button:{text:Data.textebutton},multiple:!1}),t.on("select",function(){attachment=t.state().get("selection").first().toJSON(),jQuery("#upload_image").val(attachment.url)}),void t.open())}),jQuery("#upload_b_image_button").click(function(e){return e.preventDefault(),t?void t.open():(t=wp.media.frames.file_frame=wp.media({title:Data.title,button:{text:Data.textebutton},multiple:!1}),t.on("select",function(){attachment=t.state().get("selection").first().toJSON(),jQuery("#upload_b_image").val(attachment.url)}),void t.open())}),jQuery("#upload_slider_image_button").click(function(e){return e.preventDefault(),t?void t.open():(t=wp.media.frames.file_frame=wp.media({title:Data.title,button:{text:Data.textebutton},multiple:!1}),t.on("select",function(){attachment=t.state().get("selection").first().toJSON(),jQuery("#upload_slider_image").val(attachment.url)}),void t.open())})}),jQuery(window).load(function(){jQuery("#wpmcontainer").sticky({topSpacing:32,zIndex:9980,left:0,getWidthFrom:"#divwpmcontainer"})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/wp-maintenance-fr_FR.mo
CHANGED
Binary file
|
languages/wp-maintenance-fr_FR.po
CHANGED
@@ -2,14 +2,14 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WP Maintenance\n"
|
4 |
"POT-Creation-Date: 2017-04-18 12:27+0100\n"
|
5 |
-
"PO-Revision-Date: 2017-04-
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: fr_FR\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 2.0\n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
15 |
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
|
@@ -862,9 +862,9 @@ msgid ""
|
|
862 |
"for you to do maintenance or launch your website. Personalize this page with "
|
863 |
"picture, countdown..."
|
864 |
msgstr ""
|
865 |
-
"
|
866 |
-
"
|
867 |
-
"
|
868 |
|
869 |
#. Author of the plugin/theme
|
870 |
msgid "Florent Maillefaud"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WP Maintenance\n"
|
4 |
"POT-Creation-Date: 2017-04-18 12:27+0100\n"
|
5 |
+
"PO-Revision-Date: 2017-04-24 09:16+0100\n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: fr_FR\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 2.0.1\n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
15 |
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
|
862 |
"for you to do maintenance or launch your website. Personalize this page with "
|
863 |
"picture, countdown..."
|
864 |
msgstr ""
|
865 |
+
"L'extension WP Maintenance vous permet de mettre votre site Web en attente "
|
866 |
+
"pour la maintenance ou le lancement de votre site. Personnalisez cette page "
|
867 |
+
"avec photo, compte à rebours ..."
|
868 |
|
869 |
#. Author of the plugin/theme
|
870 |
msgid "Florent Maillefaud"
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Florent73
|
|
3 |
Donate link: https://wpmaintenance.info/a-propos/
|
4 |
Tags: Maintenance, Construction, Launch, Coming soon
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -57,14 +57,19 @@ You can translate WP Maintenance on [__translate.wordpress.org__](https://transl
|
|
57 |
|
58 |
== Upgrade Notice ==
|
59 |
|
60 |
-
= 3.0.
|
61 |
This version is stable
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
= 3.0.1 =
|
66 |
-
*
|
67 |
-
*
|
68 |
* Added export/import settings
|
69 |
|
70 |
= 3.0 =
|
3 |
Donate link: https://wpmaintenance.info/a-propos/
|
4 |
Tags: Maintenance, Construction, Launch, Coming soon
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.8.1
|
7 |
+
Stable tag: 3.0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
57 |
|
58 |
== Upgrade Notice ==
|
59 |
|
60 |
+
= 3.0.2 =
|
61 |
This version is stable
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 3.0.2 =
|
66 |
+
* Bugs fixed load scripts & CSS in HTTPS
|
67 |
+
* Bug fixed for Select Google Fonts
|
68 |
+
* Minify CSS & JS
|
69 |
+
|
70 |
= 3.0.1 =
|
71 |
+
* Bug fixed on desactivate/uninstall plugin
|
72 |
+
* Bug fatal error function is_rtl()
|
73 |
* Added export/import settings
|
74 |
|
75 |
= 3.0 =
|
views/wp-maintenance-colors.php
CHANGED
@@ -18,11 +18,18 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
18 |
?>
|
19 |
<script type="text/javascript">
|
20 |
jQuery(document).ready(function() {
|
21 |
-
jQuery('#
|
22 |
-
jQuery('#
|
23 |
-
jQuery('#
|
24 |
-
jQuery('#
|
25 |
-
jQuery('#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
});
|
27 |
</script>
|
28 |
<div class="wrap">
|
@@ -52,15 +59,8 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
52 |
<em><stong><?php _e('Title font settings', 'wp-maintenance'); ?></stong></em>
|
53 |
<table cellspacing="10">
|
54 |
<tr>
|
55 |
-
<td valign="top" align="left"
|
56 |
-
|
57 |
-
<div id="fontSelect" class="fontSelect">
|
58 |
-
<div class="arrow-down"></div>
|
59 |
-
</div>
|
60 |
-
|
61 |
-
<div id="fontSelect2" class="fontSelect">
|
62 |
-
<div class="arrow-down"></div>
|
63 |
-
</div>
|
64 |
</td>
|
65 |
<td>
|
66 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
@@ -82,7 +82,9 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
82 |
<br /><em><?php _e('Text font settings', 'wp-maintenance'); ?></em>
|
83 |
<table cellspacing="10">
|
84 |
<tr>
|
85 |
-
<td valign="top" align="left"
|
|
|
|
|
86 |
<td>
|
87 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
88 |
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[font_text_size]" value="<?php if( isset($paramMMode['font_text_size']) && $paramMMode['font_text_size']!='' ) { echo stripslashes($paramMMode['font_text_size']); } else { echo '14'; }?>" />px
|
@@ -105,19 +107,22 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
105 |
<div style="float:left; width:70%;"><h3><?php _e('Activate Frame', 'wp-maintenance'); ?></h3></div>
|
106 |
<div style="float:left; width:30%;text-align:right;padding-top: 5px;">
|
107 |
<div class="switch-field">
|
108 |
-
<input class="switch_left" type="radio" onclick="AfficherTexte('option-container');" id="switch_container" name="wp_maintenance_settings[container_active]" value="1" <?php if(
|
109 |
<label for="switch_container"><?php _e('Yes', 'wp-maintenance'); ?></label>
|
110 |
<input class="switch_right" type="radio" onclick="CacherTexte('option-container');" id="switch_container_no" name="wp_maintenance_settings[container_active]" value="0" <?php if( empty($paramMMode['container_active']) || isset($paramMMode['container_active']) && $paramMMode['container_active']==0) { echo ' checked'; } ?> />
|
111 |
<label for="switch_container_no"><?php _e('No', 'wp-maintenance'); ?></label>
|
112 |
</div>
|
113 |
</div>
|
114 |
-
<div class="clear"></div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
</div>
|
116 |
-
<?php _e('Color:', 'wp-maintenance'); ?><br /> <input type="text" value="<?php if( isset($paramMMode['container_color']) && $paramMMode['container_color']!='' ) { echo $paramMMode['container_color']; } else { echo '#ffffff'; }?>" name="wp_maintenance_settings[container_color]" class="wpm-color-field" data-default-color="#ffffff" /><br />
|
117 |
-
<?php _e('Opacity:', 'wp-maintenance'); ?>
|
118 |
-
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[container_opacity]" value="<?php if( isset($paramMMode['container_opacity']) && $paramMMode['container_opacity']!='' ) { echo $paramMMode['container_opacity']; } else { echo '0.5'; } ?>" />
|
119 |
-
<?php _e('Width:', 'wp-maintenance'); ?>
|
120 |
-
<input type="text" class="wpm-form-field" size="2" name="wp_maintenance_settings[container_width]" value="<?php if( isset($paramMMode['container_width']) && $paramMMode['container_width']!='' ) { echo $paramMMode['container_width']; } else { echo '80'; } ?>" />%
|
121 |
<!-- FIN CADRE -->
|
122 |
|
123 |
<div style="margin-top:15px;margin-bottom:15px;"><hr /></div>
|
@@ -126,11 +131,14 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
126 |
<h3><?php _e('Choice countdown fonts and colors:', 'wp-maintenance'); ?></h3>
|
127 |
<em><?php _e('Countdown text color:', 'wp-maintenance'); ?></em> <br /><input type="text" value="<?php if( isset($paramMMode['color_cpt']) && $paramMMode['color_cpt']!='' ) { echo $paramMMode['color_cpt']; } else { echo '#333333'; } ?>" name="wp_maintenance_settings[color_cpt]" class="wpm-color-field" data-default-color="#333333" /><br />
|
128 |
<em><?php _e('Countdown background color:', 'wp-maintenance'); ?></em> <br /><input type="text" value="<?php if( isset($paramMMode['color_cpt_bg']) && $paramMMode['color_cpt_bg']!='' ) { echo $paramMMode['color_cpt_bg']; } ?>" name="wp_maintenance_settings[color_cpt_bg]" class="wpm-color-field" data-default-color="#ffffff" /><br /><br />
|
|
|
129 |
<!-- POLICE DU COMPTEUR -->
|
130 |
<em><?php _e('Countdown font settings', 'wp-maintenance'); ?></em>
|
131 |
<table cellspacing="10">
|
132 |
<tr>
|
133 |
-
<td valign="top" align="left"
|
|
|
|
|
134 |
<td>
|
135 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
136 |
<input type="text" size="3" class="wpm-form-field" id="date_cpt_size" name="wp_maintenance_settings[date_cpt_size]" value="<?php if( isset($paramMMode['date_cpt_size']) && $paramMMode['date_cpt_size']!='' ) { echo trim($paramMMode['date_cpt_size']); } else { echo '16'; } ?>" />px
|
@@ -149,7 +157,9 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
149 |
<em><?php _e('Text font settings', 'wp-maintenance'); ?></em>
|
150 |
<table cellspacing="10">
|
151 |
<tr>
|
152 |
-
<td valign="top" align="left"
|
|
|
|
|
153 |
<td>
|
154 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
155 |
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[font_bottom_size]" value="<?php if( isset($paramMMode['font_bottom_size']) && $paramMMode['font_bottom_size']!='' ) { echo stripslashes($paramMMode['font_bottom_size']); } else { echo '12'; } ?>" />px
|
@@ -181,7 +191,9 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
181 |
<!-- COULEUR WYJIYA -->
|
182 |
<table cellspacing="10">
|
183 |
<tr>
|
184 |
-
<td valign="top" align="left"
|
|
|
|
|
185 |
<td>
|
186 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
187 |
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[newletter_size]" value="<?php if( isset($paramMMode['newletter_size']) && $paramMMode['newletter_size']!='') { echo stripslashes($paramMMode['newletter_size']); } else { echo '14'; } ?>" />px
|
18 |
?>
|
19 |
<script type="text/javascript">
|
20 |
jQuery(document).ready(function() {
|
21 |
+
jQuery('#select_font_title').fontselect();
|
22 |
+
jQuery('#select_font_text').fontselect();
|
23 |
+
jQuery('#select_font_text_cpt').fontselect();
|
24 |
+
jQuery('#select_font_text_bottom').fontselect();
|
25 |
+
jQuery('#select_font_text_newletter').fontselect();
|
26 |
+
});
|
27 |
+
jQuery(document).ready(function() {
|
28 |
+
|
29 |
+
jQuery('input.selectfont').fontselect({
|
30 |
+
placeholder: 'Select a font',
|
31 |
+
});
|
32 |
+
|
33 |
});
|
34 |
</script>
|
35 |
<div class="wrap">
|
59 |
<em><stong><?php _e('Title font settings', 'wp-maintenance'); ?></stong></em>
|
60 |
<table cellspacing="10">
|
61 |
<tr>
|
62 |
+
<td valign="top" align="left">
|
63 |
+
<input name="wp_maintenance_settings[font_title]" class="selectfont" type="text" value="<?php if( isset($paramMMode['font_title']) && $paramMMode['font_title']!='' ) { echo str_replace(' ', '+', $paramMMode['font_title']); } else { echo 'Anton'; } ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
</td>
|
65 |
<td>
|
66 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
82 |
<br /><em><?php _e('Text font settings', 'wp-maintenance'); ?></em>
|
83 |
<table cellspacing="10">
|
84 |
<tr>
|
85 |
+
<td valign="top" align="left">
|
86 |
+
<input name="wp_maintenance_settings[font_text]" class="selectfont" type="text" value="<?php if( isset($paramMMode['font_text']) && $paramMMode['font_text']!='' ) { echo str_replace(' ', '+', $paramMMode['font_text']); } else { echo 'PT+Sans'; } ?>" />
|
87 |
+
</td>
|
88 |
<td>
|
89 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
90 |
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[font_text_size]" value="<?php if( isset($paramMMode['font_text_size']) && $paramMMode['font_text_size']!='' ) { echo stripslashes($paramMMode['font_text_size']); } else { echo '14'; }?>" />px
|
107 |
<div style="float:left; width:70%;"><h3><?php _e('Activate Frame', 'wp-maintenance'); ?></h3></div>
|
108 |
<div style="float:left; width:30%;text-align:right;padding-top: 5px;">
|
109 |
<div class="switch-field">
|
110 |
+
<input class="switch_left" type="radio" onclick="AfficherTexte('option-container');" id="switch_container" name="wp_maintenance_settings[container_active]" value="1" <?php if( isset($paramMMode['container_active']) && $paramMMode['container_active']==1) { echo ' checked'; } ?>/>
|
111 |
<label for="switch_container"><?php _e('Yes', 'wp-maintenance'); ?></label>
|
112 |
<input class="switch_right" type="radio" onclick="CacherTexte('option-container');" id="switch_container_no" name="wp_maintenance_settings[container_active]" value="0" <?php if( empty($paramMMode['container_active']) || isset($paramMMode['container_active']) && $paramMMode['container_active']==0) { echo ' checked'; } ?> />
|
113 |
<label for="switch_container_no"><?php _e('No', 'wp-maintenance'); ?></label>
|
114 |
</div>
|
115 |
</div>
|
116 |
+
<div class="clear"></div>
|
117 |
+
<a name="countdown"></a>
|
118 |
+
</div>
|
119 |
+
<div id="option-container" style="<?php if( empty($paramMMode['container_active']) || isset($paramMMode['container_active']) && $paramMMode['container_active']==0) { echo ' display:none;'; } else { echo 'display:block'; } ?>">
|
120 |
+
<?php _e('Color:', 'wp-maintenance'); ?><br /> <input type="text" value="<?php if( isset($paramMMode['container_color']) && $paramMMode['container_color']!='' ) { echo $paramMMode['container_color']; } else { echo '#ffffff'; }?>" name="wp_maintenance_settings[container_color]" class="wpm-color-field" data-default-color="#ffffff" /><br />
|
121 |
+
<?php _e('Opacity:', 'wp-maintenance'); ?>
|
122 |
+
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[container_opacity]" value="<?php if( isset($paramMMode['container_opacity']) && $paramMMode['container_opacity']!='' ) { echo $paramMMode['container_opacity']; } else { echo '0.5'; } ?>" />
|
123 |
+
<?php _e('Width:', 'wp-maintenance'); ?>
|
124 |
+
<input type="text" class="wpm-form-field" size="2" name="wp_maintenance_settings[container_width]" value="<?php if( isset($paramMMode['container_width']) && $paramMMode['container_width']!='' ) { echo $paramMMode['container_width']; } else { echo '80'; } ?>" />%
|
125 |
</div>
|
|
|
|
|
|
|
|
|
|
|
126 |
<!-- FIN CADRE -->
|
127 |
|
128 |
<div style="margin-top:15px;margin-bottom:15px;"><hr /></div>
|
131 |
<h3><?php _e('Choice countdown fonts and colors:', 'wp-maintenance'); ?></h3>
|
132 |
<em><?php _e('Countdown text color:', 'wp-maintenance'); ?></em> <br /><input type="text" value="<?php if( isset($paramMMode['color_cpt']) && $paramMMode['color_cpt']!='' ) { echo $paramMMode['color_cpt']; } else { echo '#333333'; } ?>" name="wp_maintenance_settings[color_cpt]" class="wpm-color-field" data-default-color="#333333" /><br />
|
133 |
<em><?php _e('Countdown background color:', 'wp-maintenance'); ?></em> <br /><input type="text" value="<?php if( isset($paramMMode['color_cpt_bg']) && $paramMMode['color_cpt_bg']!='' ) { echo $paramMMode['color_cpt_bg']; } ?>" name="wp_maintenance_settings[color_cpt_bg]" class="wpm-color-field" data-default-color="#ffffff" /><br /><br />
|
134 |
+
|
135 |
<!-- POLICE DU COMPTEUR -->
|
136 |
<em><?php _e('Countdown font settings', 'wp-maintenance'); ?></em>
|
137 |
<table cellspacing="10">
|
138 |
<tr>
|
139 |
+
<td valign="top" align="left">
|
140 |
+
<input name="wp_maintenance_settings[font_cpt]" class="selectfont" type="text" value="<?php if( isset($paramMMode['font_cpt']) && $paramMMode['font_cpt']!='' ) { echo str_replace(' ', '+', $paramMMode['font_cpt']); } else { echo 'Pacifico'; } ?>" />
|
141 |
+
</td>
|
142 |
<td>
|
143 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
144 |
<input type="text" size="3" class="wpm-form-field" id="date_cpt_size" name="wp_maintenance_settings[date_cpt_size]" value="<?php if( isset($paramMMode['date_cpt_size']) && $paramMMode['date_cpt_size']!='' ) { echo trim($paramMMode['date_cpt_size']); } else { echo '16'; } ?>" />px
|
157 |
<em><?php _e('Text font settings', 'wp-maintenance'); ?></em>
|
158 |
<table cellspacing="10">
|
159 |
<tr>
|
160 |
+
<td valign="top" align="left">
|
161 |
+
<input name="wp_maintenance_settings[font_text_bottom]" class="selectfont" type="text" value="<?php if( isset($paramMMode['font_text_bottom']) && $paramMMode['font_text_bottom']!='' ) { echo str_replace(' ', '+', $paramMMode['font_text_bottom']); } else { echo 'PT+Sans'; } ?>" />
|
162 |
+
</td>
|
163 |
<td>
|
164 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
165 |
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[font_bottom_size]" value="<?php if( isset($paramMMode['font_bottom_size']) && $paramMMode['font_bottom_size']!='' ) { echo stripslashes($paramMMode['font_bottom_size']); } else { echo '12'; } ?>" />px
|
191 |
<!-- COULEUR WYJIYA -->
|
192 |
<table cellspacing="10">
|
193 |
<tr>
|
194 |
+
<td valign="top" align="left">
|
195 |
+
<input name="wp_maintenance_settings[newletter_font_text]" class="selectfont" type="text" value="<?php if( isset($paramMMode['newletter_font_text']) && $paramMMode['newletter_font_text']!='' ) { echo str_replace(' ', '+', $paramMMode['newletter_font_text']); } else { echo 'PT+Sans'; } ?>" />
|
196 |
+
</td>
|
197 |
<td>
|
198 |
<?php _e('Size:', 'wp-maintenance'); ?>
|
199 |
<input type="text" class="wpm-form-field" size="3" name="wp_maintenance_settings[newletter_size]" value="<?php if( isset($paramMMode['newletter_size']) && $paramMMode['newletter_size']!='') { echo stripslashes($paramMMode['newletter_size']); } else { echo '14'; } ?>" />px
|
views/wp-maintenance-countdown.php
CHANGED
@@ -86,7 +86,7 @@ $paramMMode = get_option('wp_maintenance_settings');
|
|
86 |
//$startHour = $newMin[0].':'.ceil($newMin[1]/5)*5;
|
87 |
}
|
88 |
?>
|
89 |
-
<small><?php _e('Select the launch date/time', 'wp-maintenance'); ?></small><br /><img src="<?php echo
|
90 |
<div id="wpmdatecontainer"></div>
|
91 |
<br /><br />
|
92 |
<div>
|
86 |
//$startHour = $newMin[0].':'.ceil($newMin[1]/5)*5;
|
87 |
}
|
88 |
?>
|
89 |
+
<small><?php _e('Select the launch date/time', 'wp-maintenance'); ?></small><br /><img src="<?php echo WPM_PLUGIN_URL.'images/schedule_clock.png'; ?>" class="datepicker" width="48" height="48" style="vertical-align: middle;margin-right:5px;"> <input id="cptdate" class="datepicker" name="wp_maintenance_settings[cptdate]" type="text" autofocuss data-value="<?php echo $startDate; ?>"> <?php _e('at', 'wp-maintenance'); ?> <input id="cpttime" class="timepicker" type="time" name="wp_maintenance_settings[cpttime]" value="<?php echo $startHour; ?>" size="4" autofocuss>
|
90 |
<div id="wpmdatecontainer"></div>
|
91 |
<br /><br />
|
92 |
<div>
|
views/wp-maintenance-dashboard.php
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
|
3 |
defined( 'ABSPATH' ) or die( 'Not allowed' );
|
4 |
|
5 |
-
|
6 |
$messageUpdate = 0;
|
7 |
/* Update des paramètres */
|
8 |
if( isset($_POST['action']) && $_POST['action'] == 'update_general' ) {
|
@@ -53,7 +52,6 @@ $paramSocialOption = get_option('wp_maintenance_social_options');
|
|
53 |
<!-- HEADER -->
|
54 |
<?php echo wpm_get_header( __('General', 'wp-maintenance'), 'dashicons-admin-settings', $messageUpdate ) ?>
|
55 |
<!-- END HEADER -->
|
56 |
-
|
57 |
<div style="margin-top: 80px;">
|
58 |
|
59 |
<div style="float:left;width:73%;margin-right:1%;border: 1px solid #ddd;background-color:#fff;padding:10px;">
|
2 |
|
3 |
defined( 'ABSPATH' ) or die( 'Not allowed' );
|
4 |
|
|
|
5 |
$messageUpdate = 0;
|
6 |
/* Update des paramètres */
|
7 |
if( isset($_POST['action']) && $_POST['action'] == 'update_general' ) {
|
52 |
<!-- HEADER -->
|
53 |
<?php echo wpm_get_header( __('General', 'wp-maintenance'), 'dashicons-admin-settings', $messageUpdate ) ?>
|
54 |
<!-- END HEADER -->
|
|
|
55 |
<div style="margin-top: 80px;">
|
56 |
|
57 |
<div style="float:left;width:73%;margin-right:1%;border: 1px solid #ddd;background-color:#fff;padding:10px;">
|
wp-maintenance.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: The WP Maintenance plugin allows you to put your website on the waiting time for you to do maintenance or launch your website. Personalize this page with picture, countdown...
|
6 |
* Author: Florent Maillefaud
|
7 |
* Author URI: https://wpmaintenance.info
|
8 |
-
* Version: 3.0.
|
9 |
* Text Domain: wp-maintenance
|
10 |
* Domain Path: /languages/
|
11 |
*/
|
@@ -33,10 +33,10 @@ defined( 'ABSPATH' )
|
|
33 |
define( 'WPM_DIR', plugin_dir_path( __FILE__ ) );
|
34 |
define( 'WPM_URL', plugin_dir_url( __FILE__ ) );
|
35 |
define( 'WPM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
36 |
-
define( 'WPM_PLUGIN_URL',
|
37 |
-
define( 'WPM_ICONS_URL',
|
38 |
|
39 |
-
if( !defined( 'WPM_VERSION' )) { define( 'WPM_VERSION', '3.0.
|
40 |
|
41 |
require WPM_DIR . 'classes/wp-maintenance.php';
|
42 |
require WPM_DIR . 'classes/slider.php';
|
5 |
* Description: The WP Maintenance plugin allows you to put your website on the waiting time for you to do maintenance or launch your website. Personalize this page with picture, countdown...
|
6 |
* Author: Florent Maillefaud
|
7 |
* Author URI: https://wpmaintenance.info
|
8 |
+
* Version: 3.0.2
|
9 |
* Text Domain: wp-maintenance
|
10 |
* Domain Path: /languages/
|
11 |
*/
|
33 |
define( 'WPM_DIR', plugin_dir_path( __FILE__ ) );
|
34 |
define( 'WPM_URL', plugin_dir_url( __FILE__ ) );
|
35 |
define( 'WPM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
36 |
+
define( 'WPM_PLUGIN_URL', plugins_url().'/'.strtolower('wp-maintenance').'/');
|
37 |
+
define( 'WPM_ICONS_URL', plugins_url().'/'.strtolower('wp-maintenance').'/socialicons/');
|
38 |
|
39 |
+
if( !defined( 'WPM_VERSION' )) { define( 'WPM_VERSION', '3.0.2' ); }
|
40 |
|
41 |
require WPM_DIR . 'classes/wp-maintenance.php';
|
42 |
require WPM_DIR . 'classes/slider.php';
|