Skip to content

Commit 1cfb160

Browse files
Condensed slider generation
1 parent 0e0ef06 commit 1cfb160

File tree

2 files changed

+5
-69
lines changed

2 files changed

+5
-69
lines changed

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ <h3>Localization Options</h3>
182182

183183
<dt>timezoneText</dt>
184184
<dd><em>Default: "Timezone", A Localization Setting</em> - Label used to identify the timezone slider.</dd>
185+
186+
<dt>isRTL</dt>
187+
<dd><em>Default: false, A Localization Setting</em> - Right to Left support.</dd>
185188
</dl>
186189

187190
<h3>Alt Field Options</h3>

jquery-ui-timepicker-addon.js

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -393,77 +393,11 @@
393393
$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
394394
}
395395

396-
// Updated by Peter Medeiros:
397-
// - Pass in Event and UI instance into slide function
398-
this.hour_slider = $tp.find('.ui_tpicker_hour_slider').prop('slide', null).slider({
399-
orientation: "horizontal",
400-
value: this.hour,
401-
min: o.hourMin,
402-
max: max.hour,
403-
step: o.stepHour,
404-
slide: function(event, ui) {
405-
tp_inst.hour_slider.slider("option", "value", ui.value);
406-
tp_inst._onTimeChange();
407-
},
408-
stop: function(event, ui) {
409-
tp_inst._onSelectHandler();
410-
}
411-
});
412-
413-
this.minute_slider = $tp.find('.ui_tpicker_minute_slider').prop('slide', null).slider({
414-
orientation: "horizontal",
415-
value: this.minute,
416-
min: o.minuteMin,
417-
max: max.minute,
418-
step: o.stepMinute,
419-
slide: function(event, ui) {
420-
tp_inst.minute_slider.slider("option", "value", ui.value);
421-
tp_inst._onTimeChange();
422-
},
423-
stop: function(event, ui) {
424-
tp_inst._onSelectHandler();
425-
}
426-
});
427-
428-
this.second_slider = $tp.find('.ui_tpicker_second_slider').prop('slide', null).slider({
429-
orientation: "horizontal",
430-
value: this.second,
431-
min: o.secondMin,
432-
max: max.second,
433-
step: o.stepSecond,
434-
slide: function(event, ui) {
435-
tp_inst.second_slider.slider("option", "value", ui.value);
436-
tp_inst._onTimeChange();
437-
},
438-
stop: function(event, ui) {
439-
tp_inst._onSelectHandler();
440-
}
441-
});
442-
443-
this.millisec_slider = $tp.find('.ui_tpicker_millisec_slider').prop('slide', null).slider({
444-
orientation: "horizontal",
445-
value: this.millisec,
446-
min: o.millisecMin,
447-
max: max.millisec,
448-
step: o.stepMillisec,
449-
slide: function(event, ui) {
450-
tp_inst.millisec_slider.slider("option", "value", ui.value);
451-
tp_inst._onTimeChange();
452-
},
453-
stop: function(event, ui) {
454-
tp_inst._onSelectHandler();
455-
}
456-
});
457-
458396
// add sliders, adjust grids, add events
459397
for(var i=0,l=tp_inst.units.length; i<l; i++){
460398
litem = tp_inst.units[i];
461399
uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
462400

463-
/*
464-
Something fishy happens when assigning to tp_inst['hour_slider'] instead of tp_inst.hour_slider, I think
465-
it is because it is assigned as a prototype. Clicking the slider will always change to the previous value
466-
not the new one clicked. Ideally this works and reduces the 80+ lines of code above
467401
// add the slider
468402
tp_inst[litem+'_slider'] = $tp.find('.ui_tpicker_'+litem+'_slider').prop('slide', null).slider({
469403
orientation: "horizontal",
@@ -472,15 +406,14 @@
472406
max: max[litem],
473407
step: o['step'+uitem],
474408
slide: function(event, ui) {
475-
tp_inst[litem+'_slider'].slider("option", "value", ui.value);
409+
$(this).slider("option", "value", ui.value);
476410
tp_inst._onTimeChange();
477411
},
478412
stop: function(event, ui) {
479413
//Emulate datepicker onSelect behavior. Call on slidestop.
480414
tp_inst._onSelectHandler();
481415
}
482-
});
483-
*/
416+
});
484417

485418
// adjust the grid and add click event
486419
if (o['show'+uitem] && o[litem+'Grid'] > 0) {

0 commit comments

Comments
 (0)