Skip to content

Commit 602d526

Browse files
committed
Update
- minor script improvement on calling built-in functions like setValue, resetSelected, show, hide, etc.
1 parent 1368cd2 commit 602d526

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

mdtimepicker.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@
9999

100100
var formatted = _.getFormattedTime();
101101

102-
// _.input.trigger($.Event('timechanged', { time: formatted.time, value: formatted.value }))
103-
// .trigger('onchange') // for ASP.Net postback
104-
// .trigger('change');
105102
_.triggerChange({ time: formatted.time, value: formatted.value });
106103
_.hide();
107104
});
@@ -426,17 +423,22 @@
426423
}
427424
};
428425

429-
$.fn.mdtimepicker = function (config) {
426+
$.fn.mdtimepicker = function () {
427+
var mdtp_args = arguments,
428+
arg0 = mdtp_args[0];
429+
430430
return $(this).each(function (idx, el) {
431431
var that = this,
432432
$that = $(this),
433433
picker = $(this).data(MDTP_DATA);
434-
options = $.extend({}, $.fn.mdtimepicker.defaults, $that.data(), typeof config === 'object' && config);
434+
options = $.extend({}, $.fn.mdtimepicker.defaults, $that.data(), typeof arg0 === 'object' && arg0);
435435

436436
if (!picker) {
437437
$that.data(MDTP_DATA, (picker = new MDTimePicker(that, options)));
438438
}
439-
if(typeof config === 'string') picker[config]();
439+
440+
if(typeof arg0 === 'string')
441+
picker[arg0].apply(picker, Array.prototype.slice.call(mdtp_args).slice(1));
440442

441443
$(document).on('keydown', function (e) {
442444
if(e.keyCode !== 27) return;

mdtimepicker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)