|
31 | 31 | }
|
32 | 32 | });
|
33 | 33 |
|
34 |
| - /* |
| 34 | + /* |
35 | 35 | * Timepicker manager.
|
36 | 36 | * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
|
37 | 37 | * Settings for (groups of) time pickers are maintained in an instance object,
|
|
139 | 139 | units: ['hour','minute','second','millisec'],
|
140 | 140 | control: null,
|
141 | 141 |
|
142 |
| - /* |
| 142 | + /* |
143 | 143 | * Override the default settings for all instances of the time picker.
|
144 | 144 | * @param settings object - the new settings to use as defaults (anonymous object)
|
145 | 145 | * @return the manager object
|
|
216 | 216 | tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
|
217 | 217 | }
|
218 | 218 | // controlType is an object and must implement create, options, value methods
|
219 |
| - else{ |
| 219 | + else{ |
220 | 220 | tp_inst.control = tp_inst._defaults.controlType;
|
221 | 221 | }
|
222 | 222 |
|
223 | 223 | if (tp_inst._defaults.timezoneList === null) {
|
224 |
| - var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000', |
225 |
| - '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930', |
| 224 | + var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000', |
| 225 | + '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930', |
226 | 226 | '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400'];
|
227 | 227 |
|
228 | 228 | if (tp_inst._defaults.timezoneIso8601) {
|
|
340 | 340 | // Prevent displaying twice
|
341 | 341 | if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
|
342 | 342 | var noDisplay = ' style="display:none;"',
|
343 |
| - html = '<div class="ui-timepicker-div'+ (o.isRTL? ' ui-timepicker-rtl' : '') +'"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' + |
| 343 | + html = '<div class="ui-timepicker-div'+ (o.isRTL? ' ui-timepicker-rtl' : '') +'"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' + |
344 | 344 | '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
|
345 | 345 |
|
346 | 346 | // Create the markup
|
|
353 | 353 | max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
|
354 | 354 | gridSize[litem] = 0;
|
355 | 355 |
|
356 |
| - html += '<dt class="ui_tpicker_'+ litem +'_label"' + ((o['show'+uitem]) ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' + |
| 356 | + html += '<dt class="ui_tpicker_'+ litem +'_label"' + ((o['show'+uitem]) ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' + |
357 | 357 | '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + ((o['show'+uitem]) ? '' : noDisplay) + '></div>';
|
358 | 358 |
|
359 | 359 | if (o['show'+uitem] && o[litem+'Grid'] > 0) {
|
|
391 | 391 | }
|
392 | 392 | html += '</dd>';
|
393 | 393 | }
|
394 |
| - |
| 394 | + |
395 | 395 | // Timezone
|
396 | 396 | html += '<dt class="ui_tpicker_timezone_label"' + ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
|
397 | 397 | html += '<dd class="ui_tpicker_timezone" ' + ((o.showTimezone) ? '' : noDisplay) + '></dd>';
|
|
405 | 405 | $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
|
406 | 406 | $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
|
407 | 407 | }
|
408 |
| - |
| 408 | + |
409 | 409 | // add sliders, adjust grids, add events
|
410 | 410 | for(var i=0,l=tp_inst.units.length; i<l; i++){
|
411 | 411 | litem = tp_inst.units[i];
|
412 | 412 | uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
|
413 |
| - |
| 413 | + |
414 | 414 | // add the slider
|
415 | 415 | 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]);
|
416 | 416 |
|
|
482 | 482 | tp_inst._onTimeChange();
|
483 | 483 | });
|
484 | 484 | // End timezone options
|
485 |
| - |
| 485 | + |
486 | 486 | // inject timepicker into datepicker
|
487 | 487 | var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
|
488 | 488 | if ($buttonPanel.length) {
|
|
504 | 504 | var sliderAccessArgs = this._defaults.sliderAccessArgs,
|
505 | 505 | rtl = this._defaults.isRTL;
|
506 | 506 | sliderAccessArgs.isRTL = rtl;
|
507 |
| - |
| 507 | + |
508 | 508 | setTimeout(function() { // fix for inline mode
|
509 | 509 | if ($tp.find('.ui-slider-access').length === 0) {
|
510 | 510 | $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
|
|
700 | 700 |
|
701 | 701 | // If the update was done in the input field, the input field should not be updated.
|
702 | 702 | // If the update was done using the sliders, update the input field.
|
703 |
| - var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec |
704 |
| - || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) |
| 703 | + var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec |
| 704 | + || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) |
705 | 705 | || ((this.timezone === null && timezone != this.defaultTimezone) || (this.timezone !== null && timezone != this.timezone)));
|
706 | 706 |
|
707 | 707 | if (hasChanged) {
|
|
845 | 845 | stop: function(event, ui) {
|
846 | 846 | tp_inst._onSelectHandler();
|
847 | 847 | }
|
848 |
| - }); |
| 848 | + }); |
849 | 849 | },
|
850 | 850 | options: function(tp_inst, obj, opts, val){
|
851 | 851 | if(tp_inst._defaults.isRTL){
|
|
857 | 857 | }
|
858 | 858 | return obj.slider(opts);
|
859 | 859 | }
|
860 |
| - var min = opts.min, |
| 860 | + var min = opts.min, |
861 | 861 | max = opts.max;
|
862 | 862 | opts.min = opts.max = null;
|
863 | 863 | if(min !== undefined)
|
|
888 | 888 | ul = tp_inst._defaults.timeFormat.indexOf('t') !== -1? 'toLowerCase':'toUpperCase',
|
889 | 889 | m = 0;
|
890 | 890 |
|
891 |
| - for(var i=min; i<=max; i+=step){ |
| 891 | + for(var i=min; i<=max; i+=step){ |
892 | 892 | sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
|
893 | 893 | if(unit == 'hour' && tp_inst._defaults.ampm){
|
894 | 894 | m = i%12;
|
|
918 | 918 | if(typeof(opts) == 'string'){
|
919 | 919 | if(val === undefined)
|
920 | 920 | return $t.data(opts);
|
921 |
| - o[opts] = val; |
| 921 | + o[opts] = val; |
922 | 922 | }
|
923 | 923 | else o = opts;
|
924 | 924 | 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'));
|
|
995 | 995 | * Public utility to parse time
|
996 | 996 | */
|
997 | 997 | $.datepicker.parseTime = function(timeFormat, timeString, options) {
|
998 |
| - |
| 998 | + |
999 | 999 | // pattern for standard and localized AM/PM markers
|
1000 | 1000 | var getPatternAmpm = function(amNames, pmNames) {
|
1001 | 1001 | var markers = [];
|
|
1269 | 1269 | .replace(/tT/g, ampm ? 'AaPpMm' : '')
|
1270 | 1270 | .replace(/T/g, ampm ? 'AP' : '')
|
1271 | 1271 | .replace(/tt/g, ampm ? 'apm' : '')
|
1272 |
| - .replace(/t/g, ampm ? 'ap' : '') + |
1273 |
| - " " + tp_inst._defaults.separator + |
1274 |
| - tp_inst._defaults.timeSuffix + |
1275 |
| - (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') + |
1276 |
| - (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) + |
| 1272 | + .replace(/t/g, ampm ? 'ap' : '') + |
| 1273 | + " " + tp_inst._defaults.separator + |
| 1274 | + tp_inst._defaults.timeSuffix + |
| 1275 | + (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') + |
| 1276 | + (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) + |
1277 | 1277 | dateChars,
|
1278 | 1278 | chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
|
1279 | 1279 | return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
|
|
1296 | 1296 | var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
|
1297 | 1297 | date = this._getDate(inst),
|
1298 | 1298 | formatCfg = $.datepicker._getFormatConfig(inst),
|
1299 |
| - altFormattedDateTime = '', |
1300 |
| - altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator, |
| 1299 | + altFormattedDateTime = '', |
| 1300 | + altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator, |
1301 | 1301 | altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
|
1302 | 1302 | altTimeFormat = tp_inst._defaults.altTimeFormat !== undefined ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
|
1303 |
| - |
| 1303 | + |
1304 | 1304 | altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
|
1305 | 1305 | if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly){
|
1306 | 1306 | if(tp_inst._defaults.altFormat)
|
|
1397 | 1397 | tp_inst.second = date ? date.getSeconds() : defaults.second;
|
1398 | 1398 | tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
|
1399 | 1399 |
|
1400 |
| - //check if within min/max times.. |
| 1400 | + //check if within min/max times.. |
1401 | 1401 | tp_inst._limitMinMaxDateTime(inst, true);
|
1402 | 1402 |
|
1403 | 1403 | tp_inst._onTimeChange();
|
|
1623 | 1623 | }
|
1624 | 1624 |
|
1625 | 1625 | /*
|
1626 |
| - * Splits datetime string into date and time substrings. |
| 1626 | + * Splits datetime string into date ans time substrings. |
1627 | 1627 | * Throws exception when date can't be parsed
|
1628 | 1628 | * Returns [dateString, timeString]
|
1629 | 1629 | */
|
|
1809 | 1809 | selected(this, startTime, 'maxDate');
|
1810 | 1810 | }
|
1811 | 1811 | }, options, options.end));
|
1812 |
| - // timepicker doesn't provide access to its 'timeFormat' option, |
| 1812 | + // timepicker doesn't provide access to its 'timeFormat' option, |
1813 | 1813 | // nor could I get datepicker.formatTime() to behave with times, so I
|
1814 | 1814 | // have disabled reformatting for timepicker
|
1815 | 1815 | if (method != 'timepicker' && options.reformat) {
|
|
0 commit comments