Youtube Embed Skip Buttons Mod

Skip buttons for embeded youtube iframes.

Από την 30/10/2022. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name            Youtube Embed Skip Buttons Mod
// @namespace       userscript
// @include         *.youtube.com/embed/*
// @include         *.youtube-nocookie.com/embed/*
// @version         2017.8.22
// @description     Skip buttons for embeded youtube iframes.
// @author          copypastetada ttbbzz
// @homepageURL     https://greatest.deepsurf.us/en/users/2617
// @grant       none
// ==/UserScript==

document.addEventListener("DOMContentLoaded",function(){
	function seekVDO(interval){
		interval += Math.floor(vdo_player.getCurrentTime());
		vdo_player.seekTo(interval);
	}
	var vdo_player = document.querySelector(".html5-video-player"),
		skip_buttons = [{text:"-5s",interval:-5},
						{text:"+5s",interval:5},
						{text:"+15s",interval:15}];
	var timer0 = setInterval(function(){
		if(vdo_player) {
			skip_container = document.querySelector('.ytp-left-controls');
			check_existing_skipbtn = document.querySelector('.skip');
			if (!check_existing_skipbtn && skip_container) {
				skip_buttons.forEach(function(b){ 
					sb = document.createElement('button');
					sb.setAttribute('class', 'ytp-button skip');
					sb.addEventListener('click',function(){seekVDO(b.interval)});
					sb.innerHTML = '<span>'+b.text+'</span>';
					sb.style.verticalAlign = "top";
					sb.style.textAlign = "center";
					skip_container.appendChild(sb);
				});
			} else { console.log("%cplayer control div.ytp-left-controls not found","color:maroon;"); }
			clearInterval(timer0);
		} else {
			console.log("%clooking for div.html5-video-player","color:teal;");
			vdo_player = document.querySelector(".html5-video-player");
		}
	},100);
},false);