From 7a2cf46b9bad537e023c762f607864a43f37578e Mon Sep 17 00:00:00 2001 From: vhochstein Date: Thu, 16 Sep 2010 08:40:39 +0200 Subject: [PATCH 1/3] removed unused option --- jquery-ui-timepicker-addon.js | 1 - 1 file changed, 1 deletion(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 8e945031..3c746d0a 100755 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -29,7 +29,6 @@ secondText: 'Second' }; this.defaults = { // Global defaults for all the datetime picker instances - holdDatepickerOpen: true, showButtonPanel: true, timeOnly: false, showHour: true, From e59d034e79ee34b80ef32d0ee96eabc39cdd6d04 Mon Sep 17 00:00:00 2001 From: vhochstein Date: Thu, 16 Sep 2010 16:57:45 +0200 Subject: [PATCH 2/3] Bugfix: if nothing was selected by user do not update input field on close --- jquery-ui-timepicker-addon.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 3c746d0a..6be54185 100755 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -364,7 +364,9 @@ }; var onCloseFunc = function(dateText, inst) { - tp.updateDateTime(inst, tp); + if(tp.timeDefined === true) { + tp.updateDateTime(inst, tp); + } if ($.isFunction(opts.onClose)) { opts.onClose(dateText, inst); } From ff849fca3ccba5426004947ec8ee37b34ea566b9 Mon Sep 17 00:00:00 2001 From: vhochstein Date: Fri, 17 Sep 2010 16:48:03 +0200 Subject: [PATCH 3/3] use html attributes to offer input element specific configuration --- jquery-ui-timepicker-addon.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 6be54185..db42247b 100755 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -340,7 +340,21 @@ //######################################################################## jQuery.fn.datetimepicker = function(o) { var opts = (o === undefined ? {} : o); + var input = $(this); var tp = new Timepicker(); + var inlineSettings = {}; + + for (var attrName in tp.defaults) { + var attrValue = input.attr('time:' + attrName); + if (attrValue) { + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + tp.defaults = $.extend(tp.defaults, inlineSettings); var beforeShowFunc = function(input, inst) { tp.hour = tp.defaults.hour;