Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/scripts/ext
File: jquery-ui-timepicker-addon.js
/*! jQuery Timepicker Addon - v1.4.3 - 2013-11-30
[0] Fix | Delete
* http://trentrichardson.com/examples/timepicker
[1] Fix | Delete
* Copyright (c) 2013 Trent Richardson; Licensed MIT */
[2] Fix | Delete
(function ($) {
[3] Fix | Delete
[4] Fix | Delete
/*
[5] Fix | Delete
* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
[6] Fix | Delete
*/
[7] Fix | Delete
$.ui.timepicker = $.ui.timepicker || {};
[8] Fix | Delete
if ($.ui.timepicker.version) {
[9] Fix | Delete
return;
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
/*
[13] Fix | Delete
* Extend jQueryUI, get it started with our version number
[14] Fix | Delete
*/
[15] Fix | Delete
$.extend($.ui, {
[16] Fix | Delete
timepicker: {
[17] Fix | Delete
version: "1.4.3"
[18] Fix | Delete
}
[19] Fix | Delete
});
[20] Fix | Delete
[21] Fix | Delete
/*
[22] Fix | Delete
* Timepicker manager.
[23] Fix | Delete
* Use the singleton instance of this class, $.timepicker, to interact with the time picker.
[24] Fix | Delete
* Settings for (groups of) time pickers are maintained in an instance object,
[25] Fix | Delete
* allowing multiple different settings on the same page.
[26] Fix | Delete
*/
[27] Fix | Delete
var Timepicker = function () {
[28] Fix | Delete
this.regional = []; // Available regional settings, indexed by language code
[29] Fix | Delete
this.regional[''] = { // Default regional settings
[30] Fix | Delete
currentText: 'Now',
[31] Fix | Delete
closeText: 'Done',
[32] Fix | Delete
amNames: ['AM', 'A'],
[33] Fix | Delete
pmNames: ['PM', 'P'],
[34] Fix | Delete
timeFormat: 'HH:mm',
[35] Fix | Delete
timeSuffix: '',
[36] Fix | Delete
timeOnlyTitle: 'Choose Time',
[37] Fix | Delete
timeText: 'Time',
[38] Fix | Delete
hourText: 'Hour',
[39] Fix | Delete
minuteText: 'Minute',
[40] Fix | Delete
secondText: 'Second',
[41] Fix | Delete
millisecText: 'Millisecond',
[42] Fix | Delete
microsecText: 'Microsecond',
[43] Fix | Delete
timezoneText: 'Time Zone',
[44] Fix | Delete
isRTL: false
[45] Fix | Delete
};
[46] Fix | Delete
this._defaults = { // Global defaults for all the datetime picker instances
[47] Fix | Delete
showButtonPanel: true,
[48] Fix | Delete
timeOnly: false,
[49] Fix | Delete
showHour: null,
[50] Fix | Delete
showMinute: null,
[51] Fix | Delete
showSecond: null,
[52] Fix | Delete
showMillisec: null,
[53] Fix | Delete
showMicrosec: null,
[54] Fix | Delete
showTimezone: null,
[55] Fix | Delete
showTime: true,
[56] Fix | Delete
stepHour: 1,
[57] Fix | Delete
stepMinute: 1,
[58] Fix | Delete
stepSecond: 1,
[59] Fix | Delete
stepMillisec: 1,
[60] Fix | Delete
stepMicrosec: 1,
[61] Fix | Delete
hour: 0,
[62] Fix | Delete
minute: 0,
[63] Fix | Delete
second: 0,
[64] Fix | Delete
millisec: 0,
[65] Fix | Delete
microsec: 0,
[66] Fix | Delete
timezone: null,
[67] Fix | Delete
hourMin: 0,
[68] Fix | Delete
minuteMin: 0,
[69] Fix | Delete
secondMin: 0,
[70] Fix | Delete
millisecMin: 0,
[71] Fix | Delete
microsecMin: 0,
[72] Fix | Delete
hourMax: 23,
[73] Fix | Delete
minuteMax: 59,
[74] Fix | Delete
secondMax: 59,
[75] Fix | Delete
millisecMax: 999,
[76] Fix | Delete
microsecMax: 999,
[77] Fix | Delete
minDateTime: null,
[78] Fix | Delete
maxDateTime: null,
[79] Fix | Delete
onSelect: null,
[80] Fix | Delete
hourGrid: 0,
[81] Fix | Delete
minuteGrid: 0,
[82] Fix | Delete
secondGrid: 0,
[83] Fix | Delete
millisecGrid: 0,
[84] Fix | Delete
microsecGrid: 0,
[85] Fix | Delete
alwaysSetTime: true,
[86] Fix | Delete
separator: ' ',
[87] Fix | Delete
altFieldTimeOnly: true,
[88] Fix | Delete
altTimeFormat: null,
[89] Fix | Delete
altSeparator: null,
[90] Fix | Delete
altTimeSuffix: null,
[91] Fix | Delete
pickerTimeFormat: null,
[92] Fix | Delete
pickerTimeSuffix: null,
[93] Fix | Delete
showTimepicker: true,
[94] Fix | Delete
timezoneList: null,
[95] Fix | Delete
addSliderAccess: false,
[96] Fix | Delete
sliderAccessArgs: null,
[97] Fix | Delete
controlType: 'slider',
[98] Fix | Delete
defaultValue: null,
[99] Fix | Delete
parse: 'strict'
[100] Fix | Delete
};
[101] Fix | Delete
$.extend(this._defaults, this.regional['']);
[102] Fix | Delete
};
[103] Fix | Delete
[104] Fix | Delete
$.extend(Timepicker.prototype, {
[105] Fix | Delete
$input: null,
[106] Fix | Delete
$altInput: null,
[107] Fix | Delete
$timeObj: null,
[108] Fix | Delete
inst: null,
[109] Fix | Delete
hour_slider: null,
[110] Fix | Delete
minute_slider: null,
[111] Fix | Delete
second_slider: null,
[112] Fix | Delete
millisec_slider: null,
[113] Fix | Delete
microsec_slider: null,
[114] Fix | Delete
timezone_select: null,
[115] Fix | Delete
hour: 0,
[116] Fix | Delete
minute: 0,
[117] Fix | Delete
second: 0,
[118] Fix | Delete
millisec: 0,
[119] Fix | Delete
microsec: 0,
[120] Fix | Delete
timezone: null,
[121] Fix | Delete
hourMinOriginal: null,
[122] Fix | Delete
minuteMinOriginal: null,
[123] Fix | Delete
secondMinOriginal: null,
[124] Fix | Delete
millisecMinOriginal: null,
[125] Fix | Delete
microsecMinOriginal: null,
[126] Fix | Delete
hourMaxOriginal: null,
[127] Fix | Delete
minuteMaxOriginal: null,
[128] Fix | Delete
secondMaxOriginal: null,
[129] Fix | Delete
millisecMaxOriginal: null,
[130] Fix | Delete
microsecMaxOriginal: null,
[131] Fix | Delete
ampm: '',
[132] Fix | Delete
formattedDate: '',
[133] Fix | Delete
formattedTime: '',
[134] Fix | Delete
formattedDateTime: '',
[135] Fix | Delete
timezoneList: null,
[136] Fix | Delete
units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
[137] Fix | Delete
support: {},
[138] Fix | Delete
control: null,
[139] Fix | Delete
[140] Fix | Delete
/*
[141] Fix | Delete
* Override the default settings for all instances of the time picker.
[142] Fix | Delete
* @param {Object} settings object - the new settings to use as defaults (anonymous object)
[143] Fix | Delete
* @return {Object} the manager object
[144] Fix | Delete
*/
[145] Fix | Delete
setDefaults: function (settings) {
[146] Fix | Delete
extendRemove(this._defaults, settings || {});
[147] Fix | Delete
return this;
[148] Fix | Delete
},
[149] Fix | Delete
[150] Fix | Delete
/*
[151] Fix | Delete
* Create a new Timepicker instance
[152] Fix | Delete
*/
[153] Fix | Delete
_newInst: function ($input, opts) {
[154] Fix | Delete
var tp_inst = new Timepicker(),
[155] Fix | Delete
inlineSettings = {},
[156] Fix | Delete
fns = {},
[157] Fix | Delete
overrides, i;
[158] Fix | Delete
[159] Fix | Delete
for (var attrName in this._defaults) {
[160] Fix | Delete
if (this._defaults.hasOwnProperty(attrName)) {
[161] Fix | Delete
var attrValue = $input.attr('time:' + attrName);
[162] Fix | Delete
if (attrValue) {
[163] Fix | Delete
try {
[164] Fix | Delete
inlineSettings[attrName] = eval(attrValue);
[165] Fix | Delete
} catch (err) {
[166] Fix | Delete
inlineSettings[attrName] = attrValue;
[167] Fix | Delete
}
[168] Fix | Delete
}
[169] Fix | Delete
}
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
overrides = {
[173] Fix | Delete
beforeShow: function (input, dp_inst) {
[174] Fix | Delete
if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
[175] Fix | Delete
return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
[176] Fix | Delete
}
[177] Fix | Delete
},
[178] Fix | Delete
onChangeMonthYear: function (year, month, dp_inst) {
[179] Fix | Delete
// Update the time as well : this prevents the time from disappearing from the $input field.
[180] Fix | Delete
tp_inst._updateDateTime(dp_inst);
[181] Fix | Delete
if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
[182] Fix | Delete
tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
[183] Fix | Delete
}
[184] Fix | Delete
},
[185] Fix | Delete
onClose: function (dateText, dp_inst) {
[186] Fix | Delete
if (tp_inst.timeDefined === true && $input.val() !== '') {
[187] Fix | Delete
tp_inst._updateDateTime(dp_inst);
[188] Fix | Delete
}
[189] Fix | Delete
if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
[190] Fix | Delete
tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
[191] Fix | Delete
}
[192] Fix | Delete
}
[193] Fix | Delete
};
[194] Fix | Delete
for (i in overrides) {
[195] Fix | Delete
if (overrides.hasOwnProperty(i)) {
[196] Fix | Delete
fns[i] = opts[i] || null;
[197] Fix | Delete
}
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
[201] Fix | Delete
evnts: fns,
[202] Fix | Delete
timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
[203] Fix | Delete
});
[204] Fix | Delete
tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
[205] Fix | Delete
return val.toUpperCase();
[206] Fix | Delete
});
[207] Fix | Delete
tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
[208] Fix | Delete
return val.toUpperCase();
[209] Fix | Delete
});
[210] Fix | Delete
[211] Fix | Delete
// detect which units are supported
[212] Fix | Delete
tp_inst.support = detectSupport(
[213] Fix | Delete
tp_inst._defaults.timeFormat +
[214] Fix | Delete
(tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
[215] Fix | Delete
(tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
[216] Fix | Delete
[217] Fix | Delete
// controlType is string - key to our this._controls
[218] Fix | Delete
if (typeof(tp_inst._defaults.controlType) === 'string') {
[219] Fix | Delete
if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
[220] Fix | Delete
tp_inst._defaults.controlType = 'select';
[221] Fix | Delete
}
[222] Fix | Delete
tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
[223] Fix | Delete
}
[224] Fix | Delete
// controlType is an object and must implement create, options, value methods
[225] Fix | Delete
else {
[226] Fix | Delete
tp_inst.control = tp_inst._defaults.controlType;
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
// prep the timezone options
[230] Fix | Delete
var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
[231] Fix | Delete
0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
[232] Fix | Delete
if (tp_inst._defaults.timezoneList !== null) {
[233] Fix | Delete
timezoneList = tp_inst._defaults.timezoneList;
[234] Fix | Delete
}
[235] Fix | Delete
var tzl = timezoneList.length, tzi = 0, tzv = null;
[236] Fix | Delete
if (tzl > 0 && typeof timezoneList[0] !== 'object') {
[237] Fix | Delete
for (; tzi < tzl; tzi++) {
[238] Fix | Delete
tzv = timezoneList[tzi];
[239] Fix | Delete
timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
[240] Fix | Delete
}
[241] Fix | Delete
}
[242] Fix | Delete
tp_inst._defaults.timezoneList = timezoneList;
[243] Fix | Delete
[244] Fix | Delete
// set the default units
[245] Fix | Delete
tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
[246] Fix | Delete
((new Date()).getTimezoneOffset() * -1);
[247] Fix | Delete
tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
[248] Fix | Delete
tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
[249] Fix | Delete
tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
[250] Fix | Delete
tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
[251] Fix | Delete
tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
[252] Fix | Delete
tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
[253] Fix | Delete
tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
[254] Fix | Delete
tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
[255] Fix | Delete
tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
[256] Fix | Delete
tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
[257] Fix | Delete
tp_inst.ampm = '';
[258] Fix | Delete
tp_inst.$input = $input;
[259] Fix | Delete
[260] Fix | Delete
if (tp_inst._defaults.altField) {
[261] Fix | Delete
tp_inst.$altInput = $(tp_inst._defaults.altField).css({
[262] Fix | Delete
cursor: 'pointer'
[263] Fix | Delete
}).focus(function () {
[264] Fix | Delete
$input.trigger("focus");
[265] Fix | Delete
});
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
[269] Fix | Delete
tp_inst._defaults.minDate = new Date();
[270] Fix | Delete
}
[271] Fix | Delete
if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
[272] Fix | Delete
tp_inst._defaults.maxDate = new Date();
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
[276] Fix | Delete
if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
[277] Fix | Delete
tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
[278] Fix | Delete
}
[279] Fix | Delete
if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
[280] Fix | Delete
tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
[281] Fix | Delete
}
[282] Fix | Delete
if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
[283] Fix | Delete
tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
[284] Fix | Delete
}
[285] Fix | Delete
if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
[286] Fix | Delete
tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
[287] Fix | Delete
}
[288] Fix | Delete
tp_inst.$input.bind('focus', function () {
[289] Fix | Delete
tp_inst._onFocus();
[290] Fix | Delete
});
[291] Fix | Delete
[292] Fix | Delete
return tp_inst;
[293] Fix | Delete
},
[294] Fix | Delete
[295] Fix | Delete
/*
[296] Fix | Delete
* add our sliders to the calendar
[297] Fix | Delete
*/
[298] Fix | Delete
_addTimePicker: function (dp_inst) {
[299] Fix | Delete
var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
[300] Fix | Delete
[301] Fix | Delete
this.timeDefined = this._parseTime(currDT);
[302] Fix | Delete
this._limitMinMaxDateTime(dp_inst, false);
[303] Fix | Delete
this._injectTimePicker();
[304] Fix | Delete
},
[305] Fix | Delete
[306] Fix | Delete
/*
[307] Fix | Delete
* parse the time string from input value or _setTime
[308] Fix | Delete
*/
[309] Fix | Delete
_parseTime: function (timeString, withDate) {
[310] Fix | Delete
if (!this.inst) {
[311] Fix | Delete
this.inst = $.datepicker._getInst(this.$input[0]);
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
if (withDate || !this._defaults.timeOnly) {
[315] Fix | Delete
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
[316] Fix | Delete
try {
[317] Fix | Delete
var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
[318] Fix | Delete
if (!parseRes.timeObj) {
[319] Fix | Delete
return false;
[320] Fix | Delete
}
[321] Fix | Delete
$.extend(this, parseRes.timeObj);
[322] Fix | Delete
} catch (err) {
[323] Fix | Delete
$.timepicker.log("Error parsing the date/time string: " + err +
[324] Fix | Delete
"\ndate/time string = " + timeString +
[325] Fix | Delete
"\ntimeFormat = " + this._defaults.timeFormat +
[326] Fix | Delete
"\ndateFormat = " + dp_dateFormat);
[327] Fix | Delete
return false;
[328] Fix | Delete
}
[329] Fix | Delete
return true;
[330] Fix | Delete
} else {
[331] Fix | Delete
var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
[332] Fix | Delete
if (!timeObj) {
[333] Fix | Delete
return false;
[334] Fix | Delete
}
[335] Fix | Delete
$.extend(this, timeObj);
[336] Fix | Delete
return true;
[337] Fix | Delete
}
[338] Fix | Delete
},
[339] Fix | Delete
[340] Fix | Delete
/*
[341] Fix | Delete
* generate and inject html for timepicker into ui datepicker
[342] Fix | Delete
*/
[343] Fix | Delete
_injectTimePicker: function () {
[344] Fix | Delete
var $dp = this.inst.dpDiv,
[345] Fix | Delete
o = this.inst.settings,
[346] Fix | Delete
tp_inst = this,
[347] Fix | Delete
litem = '',
[348] Fix | Delete
uitem = '',
[349] Fix | Delete
show = null,
[350] Fix | Delete
max = {},
[351] Fix | Delete
gridSize = {},
[352] Fix | Delete
size = null,
[353] Fix | Delete
i = 0,
[354] Fix | Delete
l = 0;
[355] Fix | Delete
[356] Fix | Delete
// Prevent displaying twice
[357] Fix | Delete
if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
[358] Fix | Delete
var noDisplay = ' style="display:none;"',
[359] Fix | Delete
html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
[360] Fix | Delete
'<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
[361] Fix | Delete
[362] Fix | Delete
// Create the markup
[363] Fix | Delete
for (i = 0, l = this.units.length; i < l; i++) {
[364] Fix | Delete
litem = this.units[i];
[365] Fix | Delete
uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
[366] Fix | Delete
show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
[367] Fix | Delete
[368] Fix | Delete
// Added by Peter Medeiros:
[369] Fix | Delete
// - Figure out what the hour/minute/second max should be based on the step values.
[370] Fix | Delete
// - Example: if stepMinute is 15, then minMax is 45.
[371] Fix | Delete
max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
[372] Fix | Delete
gridSize[litem] = 0;
[373] Fix | Delete
[374] Fix | Delete
html += '<dt class="ui_tpicker_' + litem + '_label"' + (show ? '' : noDisplay) + '>' + o[litem + 'Text'] + '</dt>' +
[375] Fix | Delete
'<dd class="ui_tpicker_' + litem + '"><div class="ui_tpicker_' + litem + '_slider"' + (show ? '' : noDisplay) + '></div>';
[376] Fix | Delete
[377] Fix | Delete
if (show && o[litem + 'Grid'] > 0) {
[378] Fix | Delete
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
[379] Fix | Delete
[380] Fix | Delete
if (litem === 'hour') {
[381] Fix | Delete
for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
[382] Fix | Delete
gridSize[litem]++;
[383] Fix | Delete
var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
[384] Fix | Delete
html += '<td data-for="' + litem + '">' + tmph + '</td>';
[385] Fix | Delete
}
[386] Fix | Delete
}
[387] Fix | Delete
else {
[388] Fix | Delete
for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
[389] Fix | Delete
gridSize[litem]++;
[390] Fix | Delete
html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
[391] Fix | Delete
}
[392] Fix | Delete
}
[393] Fix | Delete
[394] Fix | Delete
html += '</tr></table></div>';
[395] Fix | Delete
}
[396] Fix | Delete
html += '</dd>';
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
// Timezone
[400] Fix | Delete
var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
[401] Fix | Delete
html += '<dt class="ui_tpicker_timezone_label"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
[402] Fix | Delete
html += '<dd class="ui_tpicker_timezone" ' + (showTz ? '' : noDisplay) + '></dd>';
[403] Fix | Delete
[404] Fix | Delete
// Create the elements from string
[405] Fix | Delete
html += '</dl></div>';
[406] Fix | Delete
var $tp = $(html);
[407] Fix | Delete
[408] Fix | Delete
// if we only want time picker...
[409] Fix | Delete
if (o.timeOnly === true) {
[410] Fix | Delete
$tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
[411] Fix | Delete
$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
[412] Fix | Delete
}
[413] Fix | Delete
[414] Fix | Delete
// add sliders, adjust grids, add events
[415] Fix | Delete
for (i = 0, l = tp_inst.units.length; i < l; i++) {
[416] Fix | Delete
litem = tp_inst.units[i];
[417] Fix | Delete
uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
[418] Fix | Delete
show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
[419] Fix | Delete
[420] Fix | Delete
// add the slider
[421] Fix | Delete
tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
[422] Fix | Delete
[423] Fix | Delete
// adjust the grid and add click event
[424] Fix | Delete
if (show && o[litem + 'Grid'] > 0) {
[425] Fix | Delete
size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
[426] Fix | Delete
$tp.find('.ui_tpicker_' + litem + ' table').css({
[427] Fix | Delete
width: size + "%",
[428] Fix | Delete
marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
[429] Fix | Delete
marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
[430] Fix | Delete
borderCollapse: 'collapse'
[431] Fix | Delete
}).find("td").click(function (e) {
[432] Fix | Delete
var $t = $(this),
[433] Fix | Delete
h = $t.html(),
[434] Fix | Delete
n = parseInt(h.replace(/[^0-9]/g), 10),
[435] Fix | Delete
ap = h.replace(/[^apm]/ig),
[436] Fix | Delete
f = $t.data('for'); // loses scope, so we use data-for
[437] Fix | Delete
[438] Fix | Delete
if (f === 'hour') {
[439] Fix | Delete
if (ap.indexOf('p') !== -1 && n < 12) {
[440] Fix | Delete
n += 12;
[441] Fix | Delete
}
[442] Fix | Delete
else {
[443] Fix | Delete
if (ap.indexOf('a') !== -1 && n === 12) {
[444] Fix | Delete
n = 0;
[445] Fix | Delete
}
[446] Fix | Delete
}
[447] Fix | Delete
}
[448] Fix | Delete
[449] Fix | Delete
tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
[450] Fix | Delete
[451] Fix | Delete
tp_inst._onTimeChange();
[452] Fix | Delete
tp_inst._onSelectHandler();
[453] Fix | Delete
}).css({
[454] Fix | Delete
cursor: 'pointer',
[455] Fix | Delete
width: (100 / gridSize[litem]) + '%',
[456] Fix | Delete
textAlign: 'center',
[457] Fix | Delete
overflow: 'hidden'
[458] Fix | Delete
});
[459] Fix | Delete
} // end if grid > 0
[460] Fix | Delete
} // end for loop
[461] Fix | Delete
[462] Fix | Delete
// Add timezone options
[463] Fix | Delete
this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
[464] Fix | Delete
$.fn.append.apply(this.timezone_select,
[465] Fix | Delete
$.map(o.timezoneList, function (val, idx) {
[466] Fix | Delete
return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
[467] Fix | Delete
}));
[468] Fix | Delete
if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
[469] Fix | Delete
var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
[470] Fix | Delete
if (local_timezone === this.timezone) {
[471] Fix | Delete
selectLocalTimezone(tp_inst);
[472] Fix | Delete
} else {
[473] Fix | Delete
this.timezone_select.val(this.timezone);
[474] Fix | Delete
}
[475] Fix | Delete
} else {
[476] Fix | Delete
if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
[477] Fix | Delete
this.timezone_select.val(o.timezone);
[478] Fix | Delete
} else {
[479] Fix | Delete
selectLocalTimezone(tp_inst);
[480] Fix | Delete
}
[481] Fix | Delete
}
[482] Fix | Delete
this.timezone_select.change(function () {
[483] Fix | Delete
tp_inst._onTimeChange();
[484] Fix | Delete
tp_inst._onSelectHandler();
[485] Fix | Delete
});
[486] Fix | Delete
// End timezone options
[487] Fix | Delete
[488] Fix | Delete
// inject timepicker into datepicker
[489] Fix | Delete
var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
[490] Fix | Delete
if ($buttonPanel.length) {
[491] Fix | Delete
$buttonPanel.before($tp);
[492] Fix | Delete
} else {
[493] Fix | Delete
$dp.append($tp);
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
this.$timeObj = $tp.find('.ui_tpicker_time');
[497] Fix | Delete
[498] Fix | Delete
if (this.inst !== null) {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function