Skip to content

Commit fc06b3f

Browse files
Update Version
2 parents fae432b + 8c86270 commit fc06b3f

9 files changed

+168
-69
lines changed

jquery-ui-timepicker-addon.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
22
.ui-timepicker-div dl { text-align: left; }
3-
.ui-timepicker-div dl dt { height: 25px; }
4-
.ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; }
3+
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
4+
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
55
.ui-timepicker-div td { font-size: 90%; }
66
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }

jquery-ui-timepicker-addon.js

Lines changed: 78 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* jQuery timepicker addon
33
* By: Trent Richardson [http://trentrichardson.com]
4-
* Version 0.9.7
5-
* Last Modified: 10/02/2011
4+
* Version 0.9.8
5+
* Last Modified: 12/03/2011
66
*
77
* Copyright 2011 Trent Richardson
88
* Dual licensed under the MIT and GPL licenses.
@@ -12,15 +12,15 @@
1212
* HERES THE CSS:
1313
* .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
1414
* .ui-timepicker-div dl { text-align: left; }
15-
* .ui-timepicker-div dl dt { height: 25px; }
16-
* .ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; }
15+
* .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
16+
* .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
1717
* .ui-timepicker-div td { font-size: 90%; }
1818
* .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
1919
*/
2020

2121
(function($) {
2222

23-
$.extend($.ui, { timepicker: { version: "0.9.7" } });
23+
$.extend($.ui, { timepicker: { version: "0.9.8" } });
2424

2525
/* Time picker manager.
2626
Use the singleton instance of this class, $.timepicker, to interact with the time picker.
@@ -54,10 +54,10 @@ function Timepicker() {
5454
showMillisec: false,
5555
showTimezone: false,
5656
showTime: true,
57-
stepHour: 0.05,
58-
stepMinute: 0.05,
59-
stepSecond: 0.05,
60-
stepMillisec: 0.5,
57+
stepHour: 1,
58+
stepMinute: 1,
59+
stepSecond: 1,
60+
stepMillisec: 1,
6161
hour: 0,
6262
minute: 0,
6363
second: 0,
@@ -83,7 +83,9 @@ function Timepicker() {
8383
altFieldTimeOnly: true,
8484
showTimepicker: true,
8585
timezoneIso8609: false,
86-
timezoneList: null
86+
timezoneList: null,
87+
addSliderAccess: false,
88+
sliderAccessArgs: null
8789
};
8890
$.extend(this._defaults, this.regional['']);
8991
}
@@ -341,10 +343,10 @@ $.extend(Timepicker.prototype, {
341343
// Added by Peter Medeiros:
342344
// - Figure out what the hour/minute/second max should be based on the step values.
343345
// - Example: if stepMinute is 15, then minMax is 45.
344-
hourMax = (o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)).toFixed(0),
345-
minMax = (o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)).toFixed(0),
346-
secMax = (o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)).toFixed(0),
347-
millisecMax = (o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)).toFixed(0),
346+
hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
347+
minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
348+
secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
349+
millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10),
348350
dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
349351

350352
// Prevent displaying twice
@@ -365,10 +367,10 @@ $.extend(Timepicker.prototype, {
365367
size;
366368

367369
// Hours
370+
html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
371+
((o.showHour) ? '' : noDisplay) + '></div>';
368372
if (o.showHour && o.hourGrid > 0) {
369-
html += '<dd class="ui_tpicker_hour">' +
370-
'<div id="ui_tpicker_hour_' + dp_id + '"' + ((o.showHour) ? '' : noDisplay) + '></div>' +
371-
'<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
373+
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
372374

373375
for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
374376
hourGridSize++;
@@ -382,70 +384,63 @@ $.extend(Timepicker.prototype, {
382384
html += '<td>' + tmph + '</td>';
383385
}
384386

385-
html += '</tr></table></div>' +
386-
'</dd>';
387-
} else html += '<dd class="ui_tpicker_hour" id="ui_tpicker_hour_' + dp_id + '"' +
388-
((o.showHour) ? '' : noDisplay) + '></dd>';
387+
html += '</tr></table></div>';
388+
}
389+
html += '</dd>';
389390

391+
// Minutes
390392
html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
391-
((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>';
393+
((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
394+
'<dd class="ui_tpicker_minute"><div id="ui_tpicker_minute_' + dp_id + '"' +
395+
((o.showMinute) ? '' : noDisplay) + '></div>';
392396

393-
// Minutes
394397
if (o.showMinute && o.minuteGrid > 0) {
395-
html += '<dd class="ui_tpicker_minute ui_tpicker_minute_' + o.minuteGrid + '">' +
396-
'<div id="ui_tpicker_minute_' + dp_id + '"' +
397-
((o.showMinute) ? '' : noDisplay) + '></div>' +
398-
'<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
398+
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
399399

400400
for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
401401
minuteGridSize++;
402402
html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
403403
}
404404

405-
html += '</tr></table></div>' +
406-
'</dd>';
407-
} else html += '<dd class="ui_tpicker_minute" id="ui_tpicker_minute_' + dp_id + '"' +
408-
((o.showMinute) ? '' : noDisplay) + '></dd>';
405+
html += '</tr></table></div>';
406+
}
407+
html += '</dd>';
409408

410409
// Seconds
411410
html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
412-
((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>';
411+
((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
412+
'<dd class="ui_tpicker_second"><div id="ui_tpicker_second_' + dp_id + '"'+
413+
((o.showSecond) ? '' : noDisplay) + '></div>';
413414

414415
if (o.showSecond && o.secondGrid > 0) {
415-
html += '<dd class="ui_tpicker_second ui_tpicker_second_' + o.secondGrid + '">' +
416-
'<div id="ui_tpicker_second_' + dp_id + '"' +
417-
((o.showSecond) ? '' : noDisplay) + '></div>' +
418-
'<div style="padding-left: 1px"><table><tr>';
416+
html += '<div style="padding-left: 1px"><table><tr>';
419417

420418
for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
421419
secondGridSize++;
422420
html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
423421
}
424422

425-
html += '</tr></table></div>' +
426-
'</dd>';
427-
} else html += '<dd class="ui_tpicker_second" id="ui_tpicker_second_' + dp_id + '"' +
428-
((o.showSecond) ? '' : noDisplay) + '></dd>';
423+
html += '</tr></table></div>';
424+
}
425+
html += '</dd>';
429426

430427
// Milliseconds
431428
html += '<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_' + dp_id + '"' +
432-
((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>';
429+
((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>'+
430+
'<dd class="ui_tpicker_millisec"><div id="ui_tpicker_millisec_' + dp_id + '"'+
431+
((o.showMillisec) ? '' : noDisplay) + '></div>';
433432

434433
if (o.showMillisec && o.millisecGrid > 0) {
435-
html += '<dd class="ui_tpicker_millisec ui_tpicker_millisec_' + o.millisecGrid + '">' +
436-
'<div id="ui_tpicker_millisec_' + dp_id + '"' +
437-
((o.showMillisec) ? '' : noDisplay) + '></div>' +
438-
'<div style="padding-left: 1px"><table><tr>';
434+
html += '<div style="padding-left: 1px"><table><tr>';
439435

440436
for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
441437
millisecGridSize++;
442-
html += '<td>' + ((l < 10) ? '0' : '') + s + '</td>';
438+
html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
443439
}
444440

445-
html += '</tr></table></div>' +
446-
'</dd>';
447-
} else html += '<dd class="ui_tpicker_millisec" id="ui_tpicker_millisec_' + dp_id + '"' +
448-
((o.showMillisec) ? '' : noDisplay) + '></dd>';
441+
html += '</tr></table></div>';
442+
}
443+
html += '</dd>';
449444

450445
// Timezone
451446
html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' +
@@ -477,6 +472,7 @@ $.extend(Timepicker.prototype, {
477472
}
478473
});
479474

475+
480476
// Updated by Peter Medeiros:
481477
// - Pass in Event and UI instance into slide function
482478
this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
@@ -486,7 +482,6 @@ $.extend(Timepicker.prototype, {
486482
max: minMax,
487483
step: o.stepMinute,
488484
slide: function(event, ui) {
489-
// update the global minute slider instance value with the current slider value
490485
tp_inst.minute_slider.slider( "option", "value", ui.value);
491486
tp_inst._onTimeChange();
492487
}
@@ -639,6 +634,30 @@ $.extend(Timepicker.prototype, {
639634
this.minute_slider.bind('slidestop',onSelectDelegate);
640635
this.second_slider.bind('slidestop',onSelectDelegate);
641636
this.millisec_slider.bind('slidestop',onSelectDelegate);
637+
638+
// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
639+
if (this._defaults.addSliderAccess){
640+
var sliderAccessArgs = this._defaults.sliderAccessArgs;
641+
setTimeout(function(){ // fix for inline mode
642+
$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
643+
644+
// fix any grids since sliders are shorter
645+
var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
646+
if(sliderAccessWidth){
647+
$tp.find('table:visible').each(function(){
648+
var $g = $(this),
649+
oldWidth = $g.outerWidth(),
650+
oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
651+
newWidth = oldWidth - sliderAccessWidth,
652+
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
653+
654+
$g.css({ width: newWidth, marginLeft: newMarginLeft });
655+
});
656+
}
657+
},0);
658+
}
659+
// end slideAccess integration
660+
642661
}
643662
},
644663

@@ -732,10 +751,10 @@ $.extend(Timepicker.prototype, {
732751
}
733752

734753
if(adjustSliders !== undefined && adjustSliders === true){
735-
var hourMax = (this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)).toFixed(0),
736-
minMax = (this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)).toFixed(0),
737-
secMax = (this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)).toFixed(0),
738-
millisecMax = (this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)).toFixed(0);
754+
var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)) ,10),
755+
minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
756+
secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
757+
millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)) ,10);
739758

740759
if(this.hour_slider)
741760
this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
@@ -859,8 +878,8 @@ $.extend(Timepicker.prototype, {
859878
// update our input with the new date time..
860879
//########################################################################
861880
_updateDateTime: function(dp_inst) {
862-
dp_inst = this.inst || dp_inst,
863-
dt = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay),
881+
dp_inst = this.inst || dp_inst;
882+
var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
864883
dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
865884
formatCfg = $.datepicker._getFormatConfig(dp_inst),
866885
timeAvailable = dt !== null && this.timeDefined;
@@ -1204,7 +1223,7 @@ $.datepicker._formatDate = function(inst, day, month, year){
12041223
{
12051224
if(day)
12061225
var b = this._base_formatDate(inst, day, month, year);
1207-
tp_inst._updateDateTime();
1226+
tp_inst._updateDateTime(inst);
12081227
return tp_inst.$input.val();
12091228
}
12101229
return this._base_formatDate(inst);
@@ -1270,7 +1289,7 @@ function extendRemove(target, props) {
12701289
}
12711290

12721291
$.timepicker = new Timepicker(); // singleton instance
1273-
$.timepicker.version = "0.9.7";
1292+
$.timepicker.version = "0.9.8";
12741293

12751294
})(jQuery);
12761295

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* Galician translation for the jQuery Timepicker Addon */
2+
/* Written by David Barral */
3+
(function($) {
4+
$.timepicker.regional['gl'] = {
5+
timeOnlyTitle: 'Elixir unha hora',
6+
timeText: 'Hora',
7+
hourText: 'Horas',
8+
minuteText: 'Minutos',
9+
secondText: 'Segundos',
10+
millisecText: 'Milisegundos',
11+
timezoneText: 'Fuso horario',
12+
currentText: 'Agora',
13+
closeText: 'Pechar',
14+
timeFormat: 'hh:mm',
15+
amNames: ['a.m.', 'AM', 'A'],
16+
pmNames: ['p.m.', 'PM', 'P'],
17+
ampm: false
18+
};
19+
$.timepicker.setDefaults($.timepicker.regional['gl']);
20+
})(jQuery);

localization/jquery-ui-timepicker-pt-BR.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
minuteText: 'Minutos',
99
secondText: 'Segundos',
1010
millisecText: 'Milissegundos',
11-
timezoneText: 'Fuso hor&aacute;rio',
11+
timezoneText: 'Fuso horário',
1212
currentText: 'Agora',
1313
closeText: 'Fechar',
1414
timeFormat: 'hh:mm',

localization/jquery-ui-timepicker-sk.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
timeOnlyTitle: 'Zvoľte čas',
66
timeText: 'Čas',
77
hourText: 'Hodiny',
8-
minuteText: 'Minuty',
8+
minuteText: 'Minúty',
99
secondText: 'Sekundy',
1010
millisecText: 'Milisekundy',
1111
timezoneText: 'Časové pásmo',
1212
currentText: 'Teraz',
13-
closeText: 'Zavřít',
13+
closeText: 'Zavrieť',
1414
timeFormat: 'h:m',
1515
amNames: ['dop.', 'AM', 'A'],
16-
pmNames: ['odp.', 'PM', 'P'],
16+
pmNames: ['pop.', 'PM', 'P'],
1717
ampm: false
1818
};
1919
$.timepicker.setDefaults($.timepicker.regional['sk']);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* Swedish translation for the jQuery Timepicker Addon */
2+
/* Written by Nevon */
3+
(function($) {
4+
$.timepicker.regional['sv'] = {
5+
timeOnlyTitle: 'Välj en tid',
6+
timeText: 'Timme',
7+
hourText: 'Timmar',
8+
minuteText: 'Minuter',
9+
secondText: 'Sekunder',
10+
millisecText: 'Millisekunder',
11+
timezoneText: 'Tidszon',
12+
currentText: 'Nu',
13+
closeText: 'Stäng',
14+
timeFormat: 'hh:mm',
15+
amNames: ['AM', 'A'],
16+
pmNames: ['PM', 'P'],
17+
ampm: false
18+
};
19+
$.timepicker.setDefaults($.timepicker.regional['sv']);
20+
})(jQuery);

localization/jquery-ui-timepicker-tr.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/* Turkish translation for the jQuery Timepicker Addon */
2-
/* Written by Fehmi Can Saglam */
2+
/* Written by Fehmi Can Saglam, Edited by Goktug Ozturk */
33
(function($) {
44
$.timepicker.regional['tr'] = {
55
timeOnlyTitle: 'Zaman Seçiniz',
66
timeText: 'Zaman',
77
hourText: 'Saat',
88
minuteText: 'Dakika',
99
secondText: 'Saniye',
10-
millisecText: 'Milisaniyelik',
10+
millisecText: 'Milisaniye',
1111
timezoneText: 'Zaman Dilimi',
1212
currentText: 'Şu an',
1313
closeText: 'Tamam',
1414
timeFormat: 'hh:mm',
15-
amNames: ['AM', 'A'],
16-
pmNames: ['PM', 'P'],
15+
amNames: ['ÖÖ', 'Ö'],
16+
pmNames: ['ÖS', 'S'],
1717
ampm: false
1818
};
1919
$.timepicker.setDefaults($.timepicker.regional['tr']);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* Simplified Chinese translation for the jQuery Timepicker Addon /
2+
/ Written by Will Lu */
3+
(function($) {
4+
$.timepicker.regional['zh-CN'] = {
5+
timeOnlyTitle: '选择时间',
6+
timeText: '时间',
7+
hourText: '小时',
8+
minuteText: '分钟',
9+
secondText: '秒钟',
10+
millisecText: '微秒',
11+
timezoneText: '时区',
12+
currentText: '现在时间',
13+
closeText: '关闭',
14+
timeFormat: 'hh:mm',
15+
amNames: ['AM', 'A'],
16+
pmNames: ['PM', 'P'],
17+
ampm: false
18+
};
19+
$.timepicker.setDefaults($.timepicker.regional['zh-CN']);
20+
})(jQuery);

0 commit comments

Comments
 (0)