Youtube Embed Skip Buttons Mod

Skip buttons for embeded youtube iframes.

Stan na 30-10-2022. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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);