add mouse thingy lol

This commit is contained in:
Ashley 2023-11-08 18:25:32 +00:00
parent 40d8fd4b60
commit e15695a0d9

View file

@ -1805,6 +1805,32 @@ const urlParams = new URLSearchParams(window.location.search);
if (!urlParams.has('hl') && !urlParams.has('region') && languageCode && regionCode) {
location.href = currentURL + `&region=${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");