|
|
@ -36,7 +36,7 @@ class Slider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
init (length) { |
|
|
|
init (length) { |
|
|
|
var slider = document.getElementById('slider') |
|
|
|
var slider = this.view.querySelector('#slider') |
|
|
|
slider.setAttribute('max', length - 1) |
|
|
|
slider.setAttribute('max', length - 1) |
|
|
|
this.max = length - 1 |
|
|
|
this.max = length - 1 |
|
|
|
this.updateDisabled(length === 0) |
|
|
|
this.updateDisabled(length === 0) |
|
|
@ -45,14 +45,14 @@ class Slider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onChange (event) { |
|
|
|
onChange (event) { |
|
|
|
var value = parseInt(document.getElementById('slider').value) |
|
|
|
var value = parseInt(this.view.querySelector('#slider').value) |
|
|
|
if (value === this.previousValue) return |
|
|
|
if (value === this.previousValue) return |
|
|
|
this.previousValue = value |
|
|
|
this.previousValue = value |
|
|
|
this.event.trigger('moved', [value]) |
|
|
|
this.event.trigger('moved', [value]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setValue (value) { |
|
|
|
setValue (value) { |
|
|
|
var slider = document.getElementById('slider') |
|
|
|
var slider = this.view.querySelector('#slider') |
|
|
|
var diff = value - slider.value |
|
|
|
var diff = value - slider.value |
|
|
|
if (diff > 0) { |
|
|
|
if (diff > 0) { |
|
|
|
slider.stepUp(diff) |
|
|
|
slider.stepUp(diff) |
|
|
@ -63,9 +63,9 @@ class Slider { |
|
|
|
|
|
|
|
|
|
|
|
updateDisabled (disabled) { |
|
|
|
updateDisabled (disabled) { |
|
|
|
if (disabled) { |
|
|
|
if (disabled) { |
|
|
|
document.getElementById('slider').setAttribute('disabled', true) |
|
|
|
this.view.querySelector('#slider').setAttribute('disabled', true) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
document.getElementById('slider').removeAttribute('disabled') |
|
|
|
this.view.querySelector('#slider').removeAttribute('disabled') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|