init: mep

This commit is contained in:
phga
2026-04-17 11:39:29 +02:00
commit 961fd6b37d
6 changed files with 117 additions and 0 deletions

29
yt-default-speed.js Normal file
View File

@@ -0,0 +1,29 @@
// ==UserScript==
// @name Default Speed for YT Videos
// @version 1.0.0
// @description Speed up YouTube Videos
// @author phga
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
const speed = 1.5;
const timeout = 100;
const waitAndRunSpeed = () => {
setTimeout(setVideoSpeed, timeout);
}
const setVideoSpeed = () => {
const ad = [...document.querySelectorAll('.ad-showing')][0];
const video = document.querySelector('video');
// If no ad is playing and the video has really started
if (!ad && video.currentTime >= 1) {
video.playbackRate = speed;
console.log(`Set video speed to ${speed}`);
} else {
console.log("Ad is running. Retrying to set video speed...");
setTimeout(setVideoSpeed, timeout);
}
}
// So we do not have to constantly run the function with setInterval
window.navigation.addEventListener("navigate", waitAndRunSpeed);
waitAndRunSpeed();