From e15695a0d91fba1fc356941a23bae84c15feb6d8 Mon Sep 17 00:00:00 2001 From: Ashley Date: Wed, 8 Nov 2023 18:25:32 +0000 Subject: [PATCH] add mouse thingy lol --- html/poketube.ejs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/html/poketube.ejs b/html/poketube.ejs index 86d3760a..cb763daf 100644 --- a/html/poketube.ejs +++ b/html/poketube.ejs @@ -1805,6 +1805,32 @@ const urlParams = new URLSearchParams(window.location.search); if (!urlParams.has('hl') && !urlParams.has('region') && languageCode && regionCode) { location.href = currentURL + `®ion=${regionCode}&hl=${languageCode}`; } +let isMiddleButtonPressed = false; + +// Function to change video speed +function changeVideoSpeed() { + if (isMiddleButtonPressed) { + video.playbackRate = 2; // Set the video speed to 2x + } else { + video.playbackRate = 1; // Set the video speed to 1x + } +} + +// Event listener for mouse button press +document.addEventListener('mousedown', function (event) { + if (event.button === 1) { + isMiddleButtonPressed = true; + changeVideoSpeed(); + } +}); + +// Event listener for mouse button release +document.addEventListener('mouseup', function (event) { + if (event.button === 1) { + isMiddleButtonPressed = false; + changeVideoSpeed(); + } +}); var anchor = document.getElementById("sub");