summaryrefslogtreecommitdiffstats
path: root/dist/jquery-ui-timepicker-addon.js
diff options
context:
space:
mode:
authorTrent <trentdrichardson@gmail.com>2015-06-29 14:24:01 -0400
committerTrent <trentdrichardson@gmail.com>2015-06-29 14:24:01 -0400
commit650df7fd345340ade2c86f2f9aaed9e326dbcaa5 (patch)
treeaf92476310340b72f8d418b12e484803e6e2e845 /dist/jquery-ui-timepicker-addon.js
parent47dbb0f8adb6a1f77bb4806ffb651c4e96849914 (diff)
parent829ffa712beb23bbe9a5e562d84fbd49bffa60fc (diff)
downloadjQuery-Timepicker-Addon-650df7fd345340ade2c86f2f9aaed9e326dbcaa5.zip
jQuery-Timepicker-Addon-650df7fd345340ade2c86f2f9aaed9e326dbcaa5.tar.gz
jQuery-Timepicker-Addon-650df7fd345340ade2c86f2f9aaed9e326dbcaa5.tar.bz2
Merge branch 'insonifi-dev' into dev
Diffstat (limited to 'dist/jquery-ui-timepicker-addon.js')
-rw-r--r--dist/jquery-ui-timepicker-addon.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/dist/jquery-ui-timepicker-addon.js b/dist/jquery-ui-timepicker-addon.js
index 1bd022c..07e6592 100644
--- a/dist/jquery-ui-timepicker-addon.js
+++ b/dist/jquery-ui-timepicker-addon.js
@@ -387,7 +387,7 @@
if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
var noDisplay = ' ui_tpicker_unit_hide',
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>' +
- '<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"></dd>';
+ '<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"><input class="ui_tpicker_time_input" ' + (o.timeInput ? '' : 'disabled') + '/></dd>';
// Create the markup
for (i = 0, l = this.units.length; i < l; i++) {
@@ -524,7 +524,21 @@
$dp.append($tp);
}
- this.$timeObj = $tp.find('.ui_tpicker_time');
+ this.$timeObj = $tp.find('.ui_tpicker_time_input');
+ this.$timeObj.change(function () {
+ var timeFormat = tp_inst.inst.settings.timeFormat;
+ var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
+ var update = new Date();
+ if (parsedTime) {
+ update.setHours(parsedTime.hour);
+ update.setMinutes(parsedTime.minute);
+ update.setSeconds(parsedTime.second);
+ $.datepicker._setTime(tp_inst.inst, update);
+ } else {
+ this.value = tp_inst.formattedTime;
+ this.blur();
+ }
+ });
if (this.inst !== null) {
var timeDefined = this.timeDefined;
@@ -862,12 +876,15 @@
// Updates the time within the timepicker
this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
if (this.$timeObj) {
+ var sPos = this.$timeObj[0].selectionStart;
+ var ePos = this.$timeObj[0].selectionEnd;
if (pickerTimeFormat === o.timeFormat) {
- this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
+ this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
}
else {
- this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
+ this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
}
+ this.$timeObj[0].setSelectionRange(sPos, ePos);
}
this.timeDefined = true;