diff options
Diffstat (limited to 'dist/jquery-ui-timepicker-addon.js')
-rw-r--r-- | dist/jquery-ui-timepicker-addon.js | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/dist/jquery-ui-timepicker-addon.js b/dist/jquery-ui-timepicker-addon.js index 09eb92a..0247997 100644 --- a/dist/jquery-ui-timepicker-addon.js +++ b/dist/jquery-ui-timepicker-addon.js @@ -1,6 +1,6 @@ /*! jQuery Timepicker Addon - v1.5.1 - 2014-09-01 * http://trentrichardson.com/examples/timepicker -* Copyright (c) 2014 Trent Richardson; Licensed MIT */ +* Copyright (c) 2015 Trent Richardson; Licensed MIT */ (function ($) { /* @@ -101,8 +101,10 @@ addSliderAccess: false, sliderAccessArgs: null, controlType: 'slider', + oneLine: false, defaultValue: null, - parse: 'strict' + parse: 'strict', + afterInject: null }; $.extend(this._defaults, this.regional['']); }; @@ -312,6 +314,7 @@ this.timeDefined = this._parseTime(currDT); this._limitMinMaxDateTime(dp_inst, false); this._injectTimePicker(); + this._afterInject(); }, /* @@ -349,6 +352,16 @@ }, /* + * Handle callback option after injecting timepicker + */ + _afterInject: function() { + var o = this.inst.settings; + if ($.isFunction(o.afterInject)) { + o.afterInject.call(this); + } + }, + + /* * generate and inject html for timepicker into ui datepicker */ _injectTimePicker: function () { @@ -366,9 +379,9 @@ // Prevent displaying twice if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) { - var noDisplay = ' style="display:none;"', - html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' + - '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>'; + 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>'; // Create the markup for (i = 0, l = this.units.length; i < l; i++) { @@ -382,8 +395,8 @@ max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10); gridSize[litem] = 0; - html += '<dt class="ui_tpicker_' + litem + '_label"' + (show ? '' : noDisplay) + '>' + o[litem + 'Text'] + '</dt>' + - '<dd class="ui_tpicker_' + litem + '"><div class="ui_tpicker_' + litem + '_slider"' + (show ? '' : noDisplay) + '></div>'; + html += '<dt class="ui_tpicker_' + litem + '_label' + (show ? '' : noDisplay) + '">' + o[litem + 'Text'] + '</dt>' + + '<dd class="ui_tpicker_' + litem + (show ? '' : noDisplay) + '"><div class="ui_tpicker_' + litem + '_slider' + (show ? '' : noDisplay) + '"></div>'; if (show && o[litem + 'Grid'] > 0) { html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>'; @@ -409,8 +422,8 @@ // Timezone var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone; - html += '<dt class="ui_tpicker_timezone_label"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>'; - html += '<dd class="ui_tpicker_timezone" ' + (showTz ? '' : noDisplay) + '></dd>'; + html += '<dt class="ui_tpicker_timezone_label' + (showTz ? '' : noDisplay) + '">' + o.timezoneText + '</dt>'; + html += '<dd class="ui_tpicker_timezone' + (showTz ? '' : noDisplay) + '"></dd>'; // Create the elements from string html += '</dl></div>'; @@ -493,6 +506,7 @@ this.timezone_select.change(function () { tp_inst._onTimeChange(); tp_inst._onSelectHandler(); + tp_inst._afterInject(); }); // End timezone options @@ -1051,6 +1065,7 @@ $(sel).appendTo(obj).change(function (e) { tp_inst._onTimeChange(); tp_inst._onSelectHandler(); + tp_inst._afterInject(); }); return obj; @@ -1065,7 +1080,7 @@ o[opts] = val; } else { o = opts; } - return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step')); + return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step')); }, value: function (tp_inst, obj, unit, val) { var $t = obj.children('select'); @@ -1229,7 +1244,7 @@ ampm = ''; resTime.ampm = ''; } else { - ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM'; + ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM'; resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0]; } } |