Cleaing some whitespace

Fixing show/hide time for calendar use case
This commit is contained in:
root 2011-04-15 13:12:38 +02:00
parent 4bca74de36
commit c9be5b72e7

View file

@ -62,7 +62,7 @@ function Timepicker() {
minuteMax: 59, minuteMax: 59,
secondMax: 59, secondMax: 59,
minDateTime: null, minDateTime: null,
maxDateTime: null, maxDateTime: null,
hourGrid: 0, hourGrid: 0,
minuteGrid: 0, minuteGrid: 0,
secondGrid: 0, secondGrid: 0,
@ -132,7 +132,7 @@ $.extend(Timepicker.prototype, {
} }
} }
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, { tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
beforeShow: function(input, dp_inst) { beforeShow: function(input, dp_inst) {
if ($.isFunction(o.beforeShow)) if ($.isFunction(o.beforeShow))
o.beforeShow(input, dp_inst, tp_inst); o.beforeShow(input, dp_inst, tp_inst);
}, },
@ -502,9 +502,9 @@ $.extend(Timepicker.prototype, {
var onSelectDelegate = function() { var onSelectDelegate = function() {
tp_inst._onSelectHandler(); tp_inst._onSelectHandler();
} }
this.hour_slider.bind('slidestop',onSelectDelegate); this.hour_slider.bind('slidestop',onSelectDelegate);
this.minute_slider.bind('slidestop',onSelectDelegate); this.minute_slider.bind('slidestop',onSelectDelegate);
this.second_slider.bind('slidestop',onSelectDelegate); this.second_slider.bind('slidestop',onSelectDelegate);
} }
}, },
@ -516,6 +516,8 @@ $.extend(Timepicker.prototype, {
var o = this._defaults, var o = this._defaults,
dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay); dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
if(!this._defaults.showTimepicker) return; // No time so nothing to check here
if(this._defaults.minDateTime !== null && dp_date){ if(this._defaults.minDateTime !== null && dp_date){
var minDateTime = this._defaults.minDateTime, var minDateTime = this._defaults.minDateTime,
minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0); minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
@ -694,7 +696,7 @@ $.extend(Timepicker.prototype, {
if (this._defaults.timeOnly === true) { if (this._defaults.timeOnly === true) {
formattedDateTime = this.formattedTime; formattedDateTime = this.formattedTime;
} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) { } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
formattedDateTime += this._defaults.separator + this.formattedTime; formattedDateTime += this._defaults.separator + this.formattedTime;
} }
@ -859,9 +861,9 @@ $.datepicker._gotoToday = function(id) {
$.datepicker._disableTimepickerDatepicker = function(target, date, withDate) { $.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
var inst = this._getInst(target), var inst = this._getInst(target),
tp_inst = this._get(inst, 'timepicker'); tp_inst = this._get(inst, 'timepicker');
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
if (tp_inst) { if (tp_inst) {
tp_inst._defaults.showTimepicker = false; tp_inst._defaults.showTimepicker = false;
tp_inst._onTimeChange();
tp_inst._updateDateTime(inst); tp_inst._updateDateTime(inst);
} }
}; };
@ -869,9 +871,10 @@ $.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
$.datepicker._enableTimepickerDatepicker = function(target, date, withDate) { $.datepicker._enableTimepickerDatepicker = function(target, date, withDate) {
var inst = this._getInst(target), var inst = this._getInst(target),
tp_inst = this._get(inst, 'timepicker'); tp_inst = this._get(inst, 'timepicker');
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
if (tp_inst) { if (tp_inst) {
tp_inst._defaults.showTimepicker = true; tp_inst._defaults.showTimepicker = true;
tp_inst._onTimeChange(); tp_inst._addTimePicker(inst); // Could be disabled on page load
tp_inst._updateDateTime(inst); tp_inst._updateDateTime(inst);
} }
}; };