Skip to content

Commit 1c8fcaa

Browse files
Fixes trentrichardson#434 allows a getter method for options
1 parent 8daab65 commit 1c8fcaa

4 files changed

+15
-8
lines changed

dist/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ <h3>Alt Field Options</h3>
202202

203203
<dt>altTimeFormat</dt>
204204
<dd><em>Default: (timeFormat option)</em> - The time format to use with the altField.</dd>
205+
206+
<dt>altRedirectFocus</dt>
207+
<dd><em>Default: true</em> - Whether to immediately focus the main field whenever the altField receives focus. Effective at construction time only, changing it later has no effect.</dd>
205208
</dl>
206209

207210
<h3>Timezone Options</h3>

dist/jquery-ui-timepicker-addon.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
altTimeFormat: null,
9494
altSeparator: null,
9595
altTimeSuffix: null,
96+
altRedirectFocus: true,
9697
pickerTimeFormat: null,
9798
pickerTimeSuffix: null,
9899
showTimepicker: true,
@@ -265,11 +266,14 @@
265266
tp_inst.$input = $input;
266267

267268
if (tp_inst._defaults.altField) {
268-
tp_inst.$altInput = $(tp_inst._defaults.altField).css({
269-
cursor: 'pointer'
270-
}).focus(function () {
271-
$input.trigger("focus");
272-
});
269+
tp_inst.$altInput = $(tp_inst._defaults.altField);
270+
if (tp_inst._defaults.altRedirectFocus === true) {
271+
tp_inst.$altInput.css({
272+
cursor: 'pointer'
273+
}).focus(function () {
274+
$input.trigger("focus");
275+
});
276+
}
273277
}
274278

275279
if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
@@ -1102,7 +1106,7 @@
11021106
var tmp_args = arguments;
11031107

11041108
if (typeof(o) === 'string') {
1105-
if (o === 'getDate') {
1109+
if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
11061110
return $.fn.datepicker.apply($(this[0]), tmp_args);
11071111
} else {
11081112
return this.each(function () {

dist/jquery-ui-timepicker-addon.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery-ui-timepicker-addon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@
11121112
var tmp_args = arguments;
11131113

11141114
if (typeof(o) === 'string') {
1115-
if (o === 'getDate') {
1115+
if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
11161116
return $.fn.datepicker.apply($(this[0]), tmp_args);
11171117
} else {
11181118
return this.each(function () {

0 commit comments

Comments
 (0)