Skip to content

Commit

Permalink
finished up speed up logic
Browse files Browse the repository at this point in the history
  • Loading branch information
boston2029 committed Jul 17, 2024
1 parent eff534f commit ab2c4ba
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions watch/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ let shouldSpeedUp = false

function startMouseDownTimer() {
mousedowntimer = setTimeout(function(){

},1000)
shouldSpeedUp=true
document.querySelector("video").playbackRate=2
},500)
}

document.querySelector("video").addEventListener("mousedown", (e) => {
Expand All @@ -50,10 +51,12 @@ document.querySelector("video").addEventListener("mousedown", (e) => {
document.querySelector("video").addEventListener("mouseup", (e) => {
if (shouldSpeedUp == true) {
document.querySelector("video").playbackRate=1
mousedowntimer=null
document.querySelector("video").play()
} else {
// timer hasn't gone off yet
document.querySelector("video").play()
clearTimeout(mousedowntimer)
}
mousedownonvideo = false
clearTimeout(mousedowntimer)
shouldSpeedUp=false
})

0 comments on commit ab2c4ba

Please sign in to comment.