mirror of
https://github.com/syssecfsu/witty.git
synced 2024-11-01 09:39:26 +01:00
update slider to use oninput, instead of onchange, but rate-limit it to twice per second
This commit is contained in:
parent
dee8cbb034
commit
a82e90499b
@ -40,7 +40,8 @@
|
|||||||
<button type="button" class="btn btn-primary btn-sm" style="margin-right: 3px;" onclick="playbtn()">
|
<button type="button" class="btn btn-primary btn-sm" style="margin-right: 3px;" onclick="playbtn()">
|
||||||
<img src="/assets/img/play.svg" id="play-btn" height="18px">
|
<img src="/assets/img/play.svg" id="play-btn" height="18px">
|
||||||
</button>
|
</button>
|
||||||
<input type="range" class="form-range" min="0" max="100" id="replay-control" onchange="seek(this.value)">
|
<input type="range" class="form-range" min="0" max="100" id="replay-control" step="1"
|
||||||
|
oninput="seek(this.value)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -84,7 +85,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// limit the rate of refresh to twice per second. Otherwise
|
||||||
|
// the screen flicks like crazy
|
||||||
|
var lastFired = new Date().getTime()
|
||||||
|
|
||||||
function seek(end) {
|
function seek(end) {
|
||||||
|
var now = new Date().getTime()
|
||||||
|
var elapsed = now - lastFired
|
||||||
|
|
||||||
|
if (elapsed <= 500) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
lastFired = now
|
||||||
|
|
||||||
// pause the play if it is currently playing
|
// pause the play if it is currently playing
|
||||||
if (!icon.src.includes("play")) {
|
if (!icon.src.includes("play")) {
|
||||||
playbtn()
|
playbtn()
|
||||||
|
Loading…
Reference in New Issue
Block a user