|
393 | 393 | $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
|
394 | 394 | }
|
395 | 395 |
|
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 |
| - |
458 | 396 | // add sliders, adjust grids, add events
|
459 | 397 | for(var i=0,l=tp_inst.units.length; i<l; i++){
|
460 | 398 | litem = tp_inst.units[i];
|
461 | 399 | uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
|
462 | 400 |
|
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 |
467 | 401 | // add the slider
|
468 | 402 | tp_inst[litem+'_slider'] = $tp.find('.ui_tpicker_'+litem+'_slider').prop('slide', null).slider({
|
469 | 403 | orientation: "horizontal",
|
|
472 | 406 | max: max[litem],
|
473 | 407 | step: o['step'+uitem],
|
474 | 408 | slide: function(event, ui) {
|
475 |
| - tp_inst[litem+'_slider'].slider("option", "value", ui.value); |
| 409 | + $(this).slider("option", "value", ui.value); |
476 | 410 | tp_inst._onTimeChange();
|
477 | 411 | },
|
478 | 412 | stop: function(event, ui) {
|
479 | 413 | //Emulate datepicker onSelect behavior. Call on slidestop.
|
480 | 414 | tp_inst._onSelectHandler();
|
481 | 415 | }
|
482 |
| - }); |
483 |
| - */ |
| 416 | + }); |
484 | 417 |
|
485 | 418 | // adjust the grid and add click event
|
486 | 419 | if (o['show'+uitem] && o[litem+'Grid'] > 0) {
|
|
0 commit comments