From ab2c4ba4b58366d5d91097ca09a958227613c03c Mon Sep 17 00:00:00 2001 From: "Boston M." <69646049+boston2029@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:46:33 +0000 Subject: [PATCH] finished up speed up logic --- watch/script.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/watch/script.js b/watch/script.js index 9b4df02..a3addf6 100644 --- a/watch/script.js +++ b/watch/script.js @@ -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) => { @@ -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 }) \ No newline at end of file