jquery-timepicker-rails 1.3.4 → 1.3.5
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: 9fd1716bf9fb44052c53d2beb071f2ba87898996
|
4
|
+
data.tar.gz: b4876c48e96e8b41bf668ef6929f695d58d96096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b862ed1f469bf4b9da10d9393bf66f3af554847431276f829c6b86277e97bfc1f1c5adde3685852170776f471309edb99d77de2527f849d4c46cb7355ffee6d
|
7
|
+
data.tar.gz: 3cf0d50775de147f466954c0b804190499872f88d6a8e1d836e9931d15ab0183e0cd3f37ec62c717a0c51dc824079bd8b6ddb473ada5e89ddaa73d265fe716de
|
@@ -67,6 +67,8 @@ requires jQuery 1.7+
|
|
67
67
|
var startDate = settings.parseDate($startDateInput);
|
68
68
|
var endDate = settings.parseDate($endDateInput);
|
69
69
|
$self.data('datepair-datedelta', endDate.getTime() - startDate.getTime());
|
70
|
+
} else {
|
71
|
+
$self.data('datepair-datedelta', null);
|
70
72
|
}
|
71
73
|
|
72
74
|
// initialize datepair-timedelta
|
@@ -77,6 +79,8 @@ requires jQuery 1.7+
|
|
77
79
|
var startTime = settings.parseTime($startTimeInput);
|
78
80
|
var endTime = settings.parseTime($endTimeInput);
|
79
81
|
$self.data('datepair-timedelta', endTime.getTime() - startTime.getTime());
|
82
|
+
} else {
|
83
|
+
$self.data('datepair-timedelta', null);
|
80
84
|
}
|
81
85
|
|
82
86
|
_updateEndMintime($self);
|
@@ -107,9 +111,11 @@ requires jQuery 1.7+
|
|
107
111
|
|
108
112
|
remove: function()
|
109
113
|
{
|
110
|
-
var self = this;
|
111
|
-
self.removeData('datepair-settings');
|
112
|
-
self
|
114
|
+
var $self = this;
|
115
|
+
$self.removeData('datepair-settings');
|
116
|
+
_unbindChangeHandler($self)
|
117
|
+
|
118
|
+
return $self;
|
113
119
|
}
|
114
120
|
};
|
115
121
|
|
@@ -145,15 +151,23 @@ requires jQuery 1.7+
|
|
145
151
|
var settings = $self.data('datepair-settings');
|
146
152
|
var $target = $(e.target);
|
147
153
|
|
148
|
-
if ($target.
|
149
|
-
if ($target.
|
154
|
+
if ($target.hasClass(settings.dateClass)) {
|
155
|
+
if ($target.val() != '') {
|
150
156
|
_dateChanged($self, $target);
|
157
|
+
} else {
|
158
|
+
$self.data('datepair-datedelta', null);
|
159
|
+
}
|
151
160
|
|
152
|
-
|
161
|
+
} else if ($target.hasClass(settings.timeClass)) {
|
162
|
+
if ($target.val() != '') {
|
153
163
|
_timeChanged($self, $target);
|
164
|
+
} else {
|
165
|
+
$self.data('datepair-timedelta', null);
|
154
166
|
}
|
155
167
|
}
|
156
168
|
|
169
|
+
_validateRanges($self);
|
170
|
+
_updateEndMintime($self)
|
157
171
|
_bindChangeHandler($self);
|
158
172
|
}
|
159
173
|
|
@@ -196,7 +210,7 @@ requires jQuery 1.7+
|
|
196
210
|
settings.updateDate($endDateInput, newEnd);
|
197
211
|
} else if ($endDateInput.val()) {
|
198
212
|
var endDate = settings.parseDate($endDateInput);
|
199
|
-
var newStart = new Date(endDate.getTime()
|
213
|
+
var newStart = new Date(endDate.getTime() - settings.defaultDateDelta * _ONE_DAY);
|
200
214
|
settings.updateDate($startDateInput, newStart);
|
201
215
|
}
|
202
216
|
|
@@ -205,7 +219,6 @@ requires jQuery 1.7+
|
|
205
219
|
$self.data('datepair-datedelta', null);
|
206
220
|
}
|
207
221
|
|
208
|
-
_updateEndMintime($self);
|
209
222
|
return;
|
210
223
|
}
|
211
224
|
|
@@ -223,8 +236,6 @@ requires jQuery 1.7+
|
|
223
236
|
$self.data('datepair-datedelta', endDate.getTime() - startDate.getTime());
|
224
237
|
}
|
225
238
|
}
|
226
|
-
|
227
|
-
_updateEndMintime($self);
|
228
239
|
}
|
229
240
|
|
230
241
|
function _updateEndMintime($self)
|
@@ -257,7 +268,7 @@ requires jQuery 1.7+
|
|
257
268
|
settings.updateTime($endTimeInput, newEnd);
|
258
269
|
} else if ($endTimeInput.val()) {
|
259
270
|
var endTime = settings.parseTime($endTimeInput);
|
260
|
-
var newStart = new Date(
|
271
|
+
var newStart = new Date(endTime.getTime() - settings.defaultTimeDelta);
|
261
272
|
settings.updateTime($startTimeInput, newStart);
|
262
273
|
}
|
263
274
|
|
@@ -266,7 +277,6 @@ requires jQuery 1.7+
|
|
266
277
|
$self.data('datepair-timedelta', null);
|
267
278
|
}
|
268
279
|
|
269
|
-
_updateEndMintime($self);
|
270
280
|
return;
|
271
281
|
}
|
272
282
|
|
@@ -281,17 +291,39 @@ requires jQuery 1.7+
|
|
281
291
|
|
282
292
|
if ((endTime.getTime() - startTime.getTime()) * $self.data('datepair-timedelta') < 0) {
|
283
293
|
var $endDateInput = _getEndDateInput($self);
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
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
|
+
}
|
290
300
|
}
|
291
301
|
|
292
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
|
+
}
|
293
314
|
|
294
|
-
|
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
|
+
}
|
321
|
+
|
322
|
+
if ($self.data('datepair-datedelta') + $self.data('datepair-timedelta') >= 0) {
|
323
|
+
$self.trigger('rangeSelected');
|
324
|
+
} else {
|
325
|
+
$self.trigger('rangeError');
|
326
|
+
}
|
295
327
|
}
|
296
328
|
|
297
329
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/************************
|
2
|
-
jquery-timepicker v1.3.
|
2
|
+
jquery-timepicker v1.3.5
|
3
3
|
http://jonthornton.github.com/jquery-timepicker/
|
4
4
|
|
5
5
|
requires jQuery 1.7+
|
@@ -359,12 +359,18 @@ requires jQuery 1.7+
|
|
359
359
|
}
|
360
360
|
|
361
361
|
if (settings.noneOption) {
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
362
|
+
if (settings.noneOption === true) {
|
363
|
+
settings.noneOption = (settings.useSelect) ? 'Time...' : 'None';
|
364
|
+
}
|
365
|
+
|
366
|
+
if ($.isArray(settings.noneOption)) {
|
367
|
+
for (var i in settings.noneOption) {
|
368
|
+
var noneElement = _generateNoneElement(settings.noneOption[i], settings.useSelect);
|
369
|
+
list.append(noneElement);
|
370
|
+
}
|
366
371
|
} else {
|
367
|
-
|
372
|
+
var noneElement = _generateNoneElement(settings.noneOption, settings.useSelect);
|
373
|
+
list.append(noneElement);
|
368
374
|
}
|
369
375
|
}
|
370
376
|
|
@@ -493,6 +499,34 @@ requires jQuery 1.7+
|
|
493
499
|
}
|
494
500
|
}
|
495
501
|
|
502
|
+
function _generateNoneElement(optionValue, useSelect)
|
503
|
+
{
|
504
|
+
var label, className, value;
|
505
|
+
|
506
|
+
if (typeof optionValue == 'object') {
|
507
|
+
label = optionValue.label;
|
508
|
+
className = optionValue.className;
|
509
|
+
value = optionValue.value;
|
510
|
+
} else if (typeof optionValue == 'string') {
|
511
|
+
label = optionValue;
|
512
|
+
} else {
|
513
|
+
$.error('Invalid noneOption value');
|
514
|
+
}
|
515
|
+
|
516
|
+
if (useSelect) {
|
517
|
+
return $('<option />', {
|
518
|
+
'value': value,
|
519
|
+
'class': className,
|
520
|
+
'text': label
|
521
|
+
});
|
522
|
+
} else {
|
523
|
+
return $('<li />', {
|
524
|
+
'class': className,
|
525
|
+
'text': label
|
526
|
+
}).data('time', value);
|
527
|
+
}
|
528
|
+
}
|
529
|
+
|
496
530
|
function _roundTime(time, settings)
|
497
531
|
{
|
498
532
|
if (!$.isNumeric(time)) {
|
@@ -543,6 +577,9 @@ requires jQuery 1.7+
|
|
543
577
|
// loop through the menu items
|
544
578
|
list.find('li').each(function(i, obj) {
|
545
579
|
var jObj = $(obj);
|
580
|
+
if (typeof jObj.data('time') != 'number') {
|
581
|
+
return;
|
582
|
+
}
|
546
583
|
|
547
584
|
var offset = jObj.data('time') - value;
|
548
585
|
|
@@ -842,8 +879,12 @@ requires jQuery 1.7+
|
|
842
879
|
}
|
843
880
|
|
844
881
|
if (timeValue !== null) {
|
845
|
-
|
846
|
-
|
882
|
+
if (typeof timeValue == 'string') {
|
883
|
+
self.val(timeValue);
|
884
|
+
} else {
|
885
|
+
var timeString = _int2time(timeValue, settings.timeFormat);
|
886
|
+
_setTimeValue(self, timeString, 'select');
|
887
|
+
}
|
847
888
|
}
|
848
889
|
|
849
890
|
//self.trigger('change').trigger('selectTime');
|
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.5
|
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-02-
|
12
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|