jquery-timepicker-rails 1.3.8.1 → 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 545fa00de0d6a98095473a70516e8ae9437cb9a4
|
4
|
+
data.tar.gz: 00b5995547dba2820adf60f2ae3467580c93af1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92fd90b8cb6d70dc849e77200a41705770731465dd2a5f5e7ec24096bdac4c7c1b5babce3e072b0946ed2f3f29e2a6507233ac32136cb8999af71ecfdf550f55
|
7
|
+
data.tar.gz: 40e0464a7e807e57eed19987dd259cf5947fbe848ba8897c5abef0741a20965d74ba7aa24940285fa30e0955fccc066c9c6b8c1d538e88ae1fac236aae55f864
|
@@ -1,337 +1,304 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
http://jonthornton.github.com/
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
1
|
+
/*!
|
2
|
+
* datepair.js v0.2.1 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
|
3
|
+
* Copyright (c) 2014 Jon Thornton - http://jonthornton.github.com/Datepair.js
|
4
|
+
* License: MIT
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function(window, document) {
|
8
|
+
|
9
|
+
'use strict';
|
10
|
+
|
11
|
+
var _ONE_DAY = 86400000;
|
12
|
+
var jq = window.Zepto || window.jQuery
|
13
|
+
|
14
|
+
function simpleExtend(obj1, obj2) {
|
15
|
+
var out = obj2 || {};
|
16
|
+
|
17
|
+
for (var i in obj1) {
|
18
|
+
if (!(i in out)) {
|
19
|
+
out[i] = obj1[i]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
return out;
|
24
|
+
}
|
25
|
+
|
26
|
+
// IE's custom event support is totally borked.
|
27
|
+
// Use jQuery if possible
|
28
|
+
function triggerSimpleCustomEvent(el, eventName) {
|
29
|
+
if (jq) {
|
30
|
+
jq(el).trigger(eventName);
|
31
|
+
} else {
|
32
|
+
var event = document.createEvent('CustomEvent');
|
33
|
+
event.initCustomEvent(eventName, true, true, {});
|
34
|
+
el.dispatchEvent(event);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
// el.classList not supported by < IE10
|
39
|
+
// use jQuery if available
|
40
|
+
function hasClass(el, className) {
|
41
|
+
if (jq) {
|
42
|
+
return jq(el).hasClass(className);
|
43
|
+
} else {
|
44
|
+
return el.classList.contains(className);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
function Datepair(container, options) {
|
49
|
+
this.dateDelta = null;
|
50
|
+
this.timeDelta = null;
|
51
|
+
this._defaults = {
|
52
|
+
startClass: 'start',
|
53
|
+
endClass: 'end',
|
54
|
+
timeClass: 'time',
|
55
|
+
dateClass: 'date',
|
56
|
+
defaultDateDelta: 0,
|
57
|
+
defaultTimeDelta: 3600000,
|
58
|
+
|
59
|
+
// defaults for jquery-timepicker; override when using other input widgets
|
60
|
+
parseTime: function(input){
|
61
|
+
return jq(input).timepicker('getTime');
|
62
|
+
},
|
63
|
+
updateTime: function(input, dateObj){
|
64
|
+
jq(input).timepicker('setTime', dateObj);
|
65
|
+
},
|
66
|
+
setMinTime: function(input, dateObj){
|
67
|
+
jq(input).timepicker('option', 'minTime', dateObj);
|
68
|
+
},
|
69
|
+
|
70
|
+
// defaults for bootstrap datepicker; override when using other input widgets
|
71
|
+
parseDate: function(input){
|
72
|
+
return jq(input).datepicker('getDate');
|
73
|
+
},
|
74
|
+
updateDate: function(input, dateObj){
|
75
|
+
jq(input).datepicker('update', dateObj);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
this.container = container;
|
80
|
+
this.settings = simpleExtend(this._defaults, options);
|
81
|
+
|
82
|
+
this.startDateInput = this.container.querySelector('.'+this.settings.startClass+'.'+this.settings.dateClass);
|
83
|
+
this.endDateInput = this.container.querySelector('.'+this.settings.endClass+'.'+this.settings.dateClass);
|
84
|
+
this.startTimeInput = this.container.querySelector('.'+this.settings.startClass+'.'+this.settings.timeClass);
|
85
|
+
this.endTimeInput = this.container.querySelector('.'+this.settings.endClass+'.'+this.settings.timeClass);
|
86
|
+
|
87
|
+
// init starts here
|
88
|
+
this._bindChangeHandler();
|
89
|
+
}
|
90
|
+
|
91
|
+
Datepair.prototype = {
|
92
|
+
constructor: Datepair,
|
93
|
+
|
94
|
+
_bindChangeHandler: function(){
|
95
|
+
// addEventListener doesn't work with synthetic "change" events
|
96
|
+
// fired by jQuery's trigger() functioin. If jQuery is present,
|
97
|
+
// use that for event binding
|
98
|
+
if (jq) {
|
99
|
+
jq(this.container).on('change.datepair', jq.proxy(this.handleEvent, this));
|
100
|
+
} else {
|
101
|
+
this.container.addEventListener('change', this, false);
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
_unbindChangeHandler: function(){
|
106
|
+
if (jq) {
|
107
|
+
jq(this.container).off('change.datepair');
|
108
|
+
} else {
|
109
|
+
this.container.removeEventListener('change', this, false);
|
110
|
+
}
|
111
|
+
},
|
112
|
+
|
113
|
+
// This function will be called when passing 'this' to addEventListener
|
114
|
+
handleEvent: function(e){
|
115
|
+
// temporarily unbind the change handler to prevent triggering this
|
116
|
+
// if we update other inputs
|
117
|
+
this._unbindChangeHandler();
|
118
|
+
|
119
|
+
if (hasClass(e.target, this.settings.dateClass)) {
|
120
|
+
if (e.target.value != '') {
|
121
|
+
this._dateChanged(e.target);
|
122
|
+
} else {
|
123
|
+
this.dateDelta = null;
|
124
|
+
}
|
125
|
+
|
126
|
+
} else if (hasClass(e.target, this.settings.timeClass)) {
|
127
|
+
if (e.target.value != '') {
|
128
|
+
this._timeChanged(e.target);
|
129
|
+
} else {
|
130
|
+
this.timeDelta = null;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
this._validateRanges();
|
135
|
+
this._updateEndMintime()
|
136
|
+
this._bindChangeHandler();
|
137
|
+
},
|
138
|
+
|
139
|
+
_dateChanged: function(target){
|
140
|
+
if (!this.startDateInput || !this.endDateInput) {
|
141
|
+
return
|
142
|
+
}
|
143
|
+
|
144
|
+
if (!this.startDateInput.value || !this.endDateInput.value) {
|
145
|
+
if (this.settings.defaultDateDelta !== null) {
|
146
|
+
if (this.startDateInput.value) {
|
147
|
+
var startDate = this.settings.parseDate(this.startDateInput);
|
148
|
+
var newEnd = new Date(startDate.getTime() + this.settings.defaultDateDelta * _ONE_DAY);
|
149
|
+
this.settings.updateDate(this.endDateInput, newEnd);
|
150
|
+
|
151
|
+
} else if (this.endDateInput.value) {
|
152
|
+
var endDate = this.settings.parseDate($endDateInput);
|
153
|
+
var newStart = new Date(endDate.getTime() - this.settings.defaultDateDelta * _ONE_DAY);
|
154
|
+
this.settings.updateDate(this.startDateInput, newStart);
|
155
|
+
}
|
156
|
+
|
157
|
+
this.dateDelta = this.settings.defaultDateDelta * _ONE_DAY;
|
158
|
+
} else {
|
159
|
+
this.dateDelta = null;
|
160
|
+
}
|
161
|
+
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
|
165
|
+
var startDate = this.settings.parseDate(this.startDateInput);
|
166
|
+
var endDate = this.settings.parseDate(this.endDateInput);
|
167
|
+
|
168
|
+
if (hasClass(target, this.settings.startClass)) {
|
169
|
+
var newEndDate = new Date(startDate.getTime() + this.dateDelta);
|
170
|
+
this.settings.updateDate(this.endDateInput, newEndDate);
|
171
|
+
} else if (hasClass(target, this.settings.endClass)) {
|
172
|
+
if (endDate < startDate) {
|
173
|
+
this.dateDelta = 0;
|
174
|
+
this.settings.updateDate(this.startDateInput, endDate);
|
175
|
+
} else {
|
176
|
+
this.dateDelta = endDate.getTime() - startDate.getTime();
|
177
|
+
}
|
178
|
+
}
|
179
|
+
},
|
180
|
+
|
181
|
+
_timeChanged: function(target){
|
182
|
+
if (!this.startTimeInput || !this.endTimeInput) {
|
183
|
+
return
|
184
|
+
}
|
185
|
+
|
186
|
+
if (!this.startTimeInput.value || !this.endTimeInput.value) {
|
187
|
+
if (this.settings.defaultTimeDelta !== null) {
|
188
|
+
if (this.startTimeInput.value) {
|
189
|
+
var startTime = this.settings.parseTime(this.startTimeInput);
|
190
|
+
var newEnd = new Date(startTime.getTime() + this.settings.defaultTimeDelta);
|
191
|
+
this.settings.updateTime(this.endTimeInput, newEnd);
|
192
|
+
} else if (this.endTimeInput.value) {
|
193
|
+
var endTime = this.settings.parseTime(this.endTimeInput);
|
194
|
+
var newStart = new Date(endTime.getTime() - this.settings.defaultTimeDelta);
|
195
|
+
this.settings.updateTime(this.startTimeInput, newStart);
|
196
|
+
}
|
197
|
+
|
198
|
+
this.timeDelta = this.settings.defaultTimeDelta;
|
199
|
+
} else {
|
200
|
+
this.timeDelta = null;
|
201
|
+
}
|
202
|
+
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
|
206
|
+
var startTime = this.settings.parseTime(this.startTimeInput);
|
207
|
+
var endTime = this.settings.parseTime(this.endTimeInput);
|
208
|
+
|
209
|
+
if (hasClass(target, this.settings.startClass)) {
|
210
|
+
var newEndTime = new Date(startTime.getTime() + this.timeDelta);
|
211
|
+
this.settings.updateTime(this.endTimeInput, newEndTime);
|
212
|
+
endTime = this.settings.parseTime(this.endTimeInput);
|
213
|
+
}
|
214
|
+
|
215
|
+
if (this.endDateInput && this.endDateInput.value && this.dateDelta + this.timeDelta < _ONE_DAY && (endTime.getTime() - startTime.getTime()) * this.timeDelta < 0) {
|
216
|
+
var offset = (endTime < startTime) ? _ONE_DAY : -1 * _ONE_DAY;
|
217
|
+
var endDate = this.settings.parseDate(this.endDateInput);
|
218
|
+
this.settings.updateDate(this.endDateInput, new Date(endDate.getTime() + offset));
|
219
|
+
this._dateChanged(this.endDateInput);
|
220
|
+
}
|
221
|
+
|
222
|
+
this.timeDelta = endTime.getTime() - startTime.getTime();
|
223
|
+
},
|
224
|
+
|
225
|
+
_updateEndMintime: function(){
|
226
|
+
if (typeof this.settings.setMinTime != 'function') return;
|
227
|
+
|
228
|
+
var startTime = null;
|
229
|
+
if (!this.dateDelta || this.dateDelta < _ONE_DAY || (this.timeDelta && this.dateDelta + this.timeDelta < _ONE_DAY)) {
|
230
|
+
startTime = this.settings.parseTime(this.startTimeInput);
|
231
|
+
}
|
232
|
+
|
233
|
+
this.settings.setMinTime(this.endTimeInput, startTime);
|
234
|
+
},
|
235
|
+
|
236
|
+
_validateRanges: function(){
|
237
|
+
if (this.startTimeInput && this.endTimeInput && this.timeDelta === null) {
|
238
|
+
triggerSimpleCustomEvent(this.container, 'rangeIncomplete');
|
239
|
+
return;
|
240
|
+
}
|
241
|
+
|
242
|
+
if (this.startDateInput && this.endDateInput && this.dateDelta === null) {
|
243
|
+
triggerSimpleCustomEvent(this.container, 'rangeIncomplete');
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
|
247
|
+
if (this.dateDelta + this.timeDelta >= 0) {
|
248
|
+
triggerSimpleCustomEvent(this.container, 'rangeSelected');
|
249
|
+
} else {
|
250
|
+
triggerSimpleCustomEvent(this.container, 'rangeError');
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
window.Datepair = Datepair;
|
256
|
+
|
257
|
+
}(window, document));
|
258
|
+
|
259
|
+
/*!
|
260
|
+
* datepair.js v0.2.1 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
|
261
|
+
* Copyright (c) 2014 Jon Thornton - http://jonthornton.github.com/Datepair.js
|
262
|
+
* License: MIT
|
263
|
+
*/
|
264
|
+
|
265
|
+
(function($) {
|
266
|
+
|
267
|
+
if(!$) {
|
268
|
+
return;
|
131
269
|
}
|
132
270
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
}
|
137
|
-
|
138
|
-
function _unbindChangeHandler($self)
|
139
|
-
{
|
140
|
-
$self.off('change.datepair');
|
141
|
-
}
|
142
|
-
|
143
|
-
function _inputChanged(e)
|
144
|
-
{
|
145
|
-
var $self = $(this);
|
146
|
-
|
147
|
-
// temporarily unbind the change handler to prevent triggering this
|
148
|
-
// if we update other inputs
|
149
|
-
_unbindChangeHandler($self);
|
271
|
+
////////////
|
272
|
+
// Plugin //
|
273
|
+
////////////
|
150
274
|
|
151
|
-
|
152
|
-
var
|
275
|
+
$.fn.datepair = function(option) {
|
276
|
+
var out;
|
277
|
+
this.each(function() {
|
278
|
+
var $this = $(this);
|
279
|
+
var data = $this.data('datepair');
|
280
|
+
var options = typeof option === 'object' && option;
|
153
281
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
} else {
|
158
|
-
$self.data('datepair-datedelta', null);
|
282
|
+
if (!data) {
|
283
|
+
data = new Datepair(this, options);
|
284
|
+
$this.data('datepair', data);
|
159
285
|
}
|
160
286
|
|
161
|
-
|
162
|
-
|
163
|
-
_timeChanged($self, $target);
|
164
|
-
} else {
|
165
|
-
$self.data('datepair-timedelta', null);
|
287
|
+
if (typeof option === 'string') {
|
288
|
+
out = data[option]();
|
166
289
|
}
|
167
|
-
}
|
168
|
-
|
169
|
-
_validateRanges($self);
|
170
|
-
_updateEndMintime($self)
|
171
|
-
_bindChangeHandler($self);
|
172
|
-
}
|
173
|
-
|
174
|
-
function _getStartDateInput($self)
|
175
|
-
{
|
176
|
-
var settings = $self.data('datepair-settings');
|
177
|
-
return $self.find('.'+settings.startClass+'.'+settings.dateClass);
|
178
|
-
}
|
290
|
+
});
|
179
291
|
|
180
|
-
|
181
|
-
|
182
|
-
var settings = $self.data('datepair-settings');
|
183
|
-
return $self.find('.'+settings.endClass+'.'+settings.dateClass);
|
184
|
-
}
|
185
|
-
|
186
|
-
function _getStartTimeInput($self)
|
187
|
-
{
|
188
|
-
var settings = $self.data('datepair-settings');
|
189
|
-
return $self.find('.'+settings.startClass+'.'+settings.timeClass);
|
190
|
-
}
|
191
|
-
|
192
|
-
function _getEndTimeInput($self)
|
193
|
-
{
|
194
|
-
var settings = $self.data('datepair-settings');
|
195
|
-
return $self.find('.'+settings.endClass+'.'+settings.timeClass);
|
196
|
-
}
|
197
|
-
|
198
|
-
function _dateChanged($self, $target)
|
199
|
-
{
|
200
|
-
var settings = $self.data('datepair-settings');
|
201
|
-
|
202
|
-
var $startDateInput = _getStartDateInput($self);
|
203
|
-
var $endDateInput = _getEndDateInput($self);
|
204
|
-
|
205
|
-
if (!$startDateInput.val() || !$endDateInput.val()) {
|
206
|
-
if (settings.defaultDateDelta !== null) {
|
207
|
-
if ($startDateInput.val()) {
|
208
|
-
var startDate = settings.parseDate($startDateInput);
|
209
|
-
var newEnd = new Date(startDate.getTime() + settings.defaultDateDelta * _ONE_DAY);
|
210
|
-
settings.updateDate($endDateInput, newEnd);
|
211
|
-
} else if ($endDateInput.val()) {
|
212
|
-
var endDate = settings.parseDate($endDateInput);
|
213
|
-
var newStart = new Date(endDate.getTime() - settings.defaultDateDelta * _ONE_DAY);
|
214
|
-
settings.updateDate($startDateInput, newStart);
|
215
|
-
}
|
216
|
-
|
217
|
-
$self.data('datepair-datedelta', settings.defaultDateDelta * _ONE_DAY);
|
218
|
-
} else {
|
219
|
-
$self.data('datepair-datedelta', null);
|
220
|
-
}
|
221
|
-
|
222
|
-
return;
|
223
|
-
}
|
224
|
-
|
225
|
-
var startDate = settings.parseDate($startDateInput);
|
226
|
-
var endDate = settings.parseDate($endDateInput);
|
227
|
-
|
228
|
-
if ($target.hasClass(settings.startClass)) {
|
229
|
-
var newEndDate = new Date(startDate.getTime()+$self.data('datepair-datedelta'));
|
230
|
-
settings.updateDate($endDateInput, newEndDate);
|
231
|
-
} else if ($target.hasClass(settings.endClass)) {
|
232
|
-
if (endDate < startDate) {
|
233
|
-
$self.data('datepair-datedelta', 0);
|
234
|
-
settings.updateDate($startDateInput, endDate);
|
235
|
-
} else {
|
236
|
-
$self.data('datepair-datedelta', endDate.getTime() - startDate.getTime());
|
237
|
-
}
|
238
|
-
}
|
239
|
-
}
|
240
|
-
|
241
|
-
function _updateEndMintime($self)
|
242
|
-
{
|
243
|
-
var settings = $self.data('datepair-settings');
|
244
|
-
if (typeof settings.setMinTime != 'function') return;
|
245
|
-
|
246
|
-
var startTime;
|
247
|
-
if ($self.data('datepair-datedelta') <= _ONE_DAY || !$self.data('datepair-datedelta')) {
|
248
|
-
var $startTimeInput = _getStartTimeInput($self);
|
249
|
-
var startTime = settings.parseTime($startTimeInput);
|
250
|
-
}
|
251
|
-
|
252
|
-
var $endTimeInput = _getEndTimeInput($self);
|
253
|
-
settings.setMinTime($endTimeInput, startTime);
|
254
|
-
}
|
255
|
-
|
256
|
-
function _timeChanged($self, $target)
|
257
|
-
{
|
258
|
-
var settings = $self.data('datepair-settings');
|
259
|
-
|
260
|
-
var $startTimeInput = _getStartTimeInput($self);
|
261
|
-
var $endTimeInput = _getEndTimeInput($self);
|
262
|
-
|
263
|
-
if (!$startTimeInput.val() || !$endTimeInput.val()) {
|
264
|
-
if (settings.defaultTimeDelta !== null) {
|
265
|
-
if ($startTimeInput.val()) {
|
266
|
-
var startTime = settings.parseTime($startTimeInput);
|
267
|
-
var newEnd = new Date(startTime.getTime() + settings.defaultTimeDelta);
|
268
|
-
settings.updateTime($endTimeInput, newEnd);
|
269
|
-
} else if ($endTimeInput.val()) {
|
270
|
-
var endTime = settings.parseTime($endTimeInput);
|
271
|
-
var newStart = new Date(endTime.getTime() - settings.defaultTimeDelta);
|
272
|
-
settings.updateTime($startTimeInput, newStart);
|
273
|
-
}
|
274
|
-
|
275
|
-
$self.data('datepair-timedelta', settings.defaultTimeDelta);
|
276
|
-
} else {
|
277
|
-
$self.data('datepair-timedelta', null);
|
278
|
-
}
|
279
|
-
|
280
|
-
return;
|
281
|
-
}
|
282
|
-
|
283
|
-
var startTime = settings.parseTime($startTimeInput);
|
284
|
-
var endTime = settings.parseTime($endTimeInput);
|
285
|
-
|
286
|
-
if ($target.hasClass(settings.startClass)) {
|
287
|
-
var newEndTime = new Date(startTime.getTime()+$self.data('datepair-timedelta'));
|
288
|
-
settings.updateTime($endTimeInput, newEndTime);
|
289
|
-
endTime = settings.parseTime($endTimeInput);
|
290
|
-
}
|
291
|
-
|
292
|
-
if ((endTime.getTime() - startTime.getTime()) * $self.data('datepair-timedelta') < 0) {
|
293
|
-
var $endDateInput = _getEndDateInput($self);
|
294
|
-
if ($endDateInput.val()) {
|
295
|
-
var offset = (endTime < startTime) ? _ONE_DAY : -1 * _ONE_DAY;
|
296
|
-
var endDate = settings.parseDate($endDateInput);
|
297
|
-
settings.updateDate($endDateInput, new Date(endDate.getTime() + offset));
|
298
|
-
_dateChanged($self, $endDateInput);
|
299
|
-
}
|
300
|
-
}
|
301
|
-
|
302
|
-
$self.data('datepair-timedelta', endTime.getTime() - startTime.getTime());
|
303
|
-
}
|
304
|
-
|
305
|
-
function _validateRanges($self)
|
306
|
-
{
|
307
|
-
var $startTimeInput = _getStartTimeInput($self);
|
308
|
-
var $endTimeInput = _getEndTimeInput($self);
|
309
|
-
|
310
|
-
if ($startTimeInput.length && $endTimeInput.length && $self.data('datepair-timedelta') === null) {
|
311
|
-
$self.trigger('rangeIncomplete');
|
312
|
-
return;
|
313
|
-
}
|
314
|
-
|
315
|
-
var $startDateInput = _getStartDateInput($self);
|
316
|
-
var $endDateInput = _getEndDateInput($self);
|
317
|
-
if ($startDateInput.length && $endDateInput.length && $self.data('datepair-datedelta') === null) {
|
318
|
-
$self.trigger('rangeIncomplete');
|
319
|
-
return;
|
320
|
-
}
|
292
|
+
return out;
|
293
|
+
};
|
321
294
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
$self.trigger('rangeError');
|
326
|
-
}
|
327
|
-
}
|
295
|
+
//////////////
|
296
|
+
// Data API //
|
297
|
+
//////////////
|
328
298
|
|
299
|
+
$('[data-datepair]').each(function() {
|
300
|
+
var $this = $(this);
|
301
|
+
$this.datepair($this.data());
|
302
|
+
});
|
329
303
|
|
330
|
-
|
331
|
-
$.fn.datepair = function(method)
|
332
|
-
{
|
333
|
-
if(methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); }
|
334
|
-
else if(typeof method === "object" || !method) { return methods.init.apply(this, arguments); }
|
335
|
-
else { $.error("Method "+ method + " does not exist on jQuery.datepair"); }
|
336
|
-
};
|
337
|
-
}));
|
304
|
+
}(window.Zepto || window.jQuery));
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/************************
|
2
|
-
jquery-timepicker v1.3.
|
2
|
+
jquery-timepicker v1.3.9
|
3
3
|
http://jonthornton.github.com/jquery-timepicker/
|
4
4
|
|
5
5
|
requires jQuery 1.7+
|
@@ -288,6 +288,7 @@ requires jQuery 1.7+
|
|
288
288
|
return;
|
289
289
|
}
|
290
290
|
|
291
|
+
var settings = self.data('timepicker-settings');
|
291
292
|
self.removeAttr('autocomplete', 'off');
|
292
293
|
self.removeClass('ui-timepicker-input');
|
293
294
|
self.removeData('timepicker-settings');
|
@@ -298,6 +299,10 @@ requires jQuery 1.7+
|
|
298
299
|
self.data('timepicker-list').remove();
|
299
300
|
}
|
300
301
|
|
302
|
+
if (settings.useSelect) {
|
303
|
+
self.show();
|
304
|
+
}
|
305
|
+
|
301
306
|
self.removeData('timepicker-list');
|
302
307
|
|
303
308
|
return this;
|
@@ -376,8 +381,10 @@ requires jQuery 1.7+
|
|
376
381
|
|
377
382
|
if ($.isArray(settings.noneOption)) {
|
378
383
|
for (var i in settings.noneOption) {
|
379
|
-
|
380
|
-
|
384
|
+
if (parseInt(i, 10) === i){
|
385
|
+
var noneElement = _generateNoneElement(settings.noneOption[i], settings.useSelect);
|
386
|
+
list.append(noneElement);
|
387
|
+
}
|
381
388
|
}
|
382
389
|
} else {
|
383
390
|
var noneElement = _generateNoneElement(settings.noneOption, settings.useSelect);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-timepicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanguy Krotoff (jQuery plugin by Jon Thornton)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|