Greasy Fork is available in English.

YouTube Skip 15 Seconds Rewind Buttons Forward/Backward

Adds Rewind buttons to the YouTube player forward and backward 15 seconds buttons

// ==UserScript==
// @name         YouTube Skip 15 Seconds Rewind Buttons Forward/Backward 
// @namespace    https://greasyfork.org/
// @version      1.2
// @description  Adds Rewind buttons to the YouTube player forward and backward 15 seconds buttons
// @author       ezzdev
// @license      MIT
// @match        *://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?domain=youtube.com
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function addSkipButtons() {
        if (document.querySelector("#skip-backward") && document.querySelector("#skip-forward")) return;

        const controlBar = document.querySelector(".ytp-volume-area");
        if (!controlBar) return;

        const backwardButton = document.createElement("button");
        backwardButton.id = "skip-backward";
        backwardButton.className = "ytp-button";
        backwardButton.appendChild(document.createTextNode("⏪"));
        backwardButton.style.fontSize = "23px";
        backwardButton.style.textAlign = "center";
        backwardButton.style.fontWeight = "bold";
        backwardButton.style.filter = "grayscale(100%) brightness(100%)";
        backwardButton.title = "Skip backward 15 seconds";
        backwardButton.style.marginTop = "1px";
        backwardButton.onclick = () => {
            const video = document.querySelector("video");
            if (video) video.currentTime = Math.max(0, video.currentTime - 15);
        };

        const forwardButton = document.createElement("button");
        forwardButton.id = "skip-forward";
        forwardButton.className = "ytp-button";
        forwardButton.appendChild(document.createTextNode("⏩"));
        forwardButton.style.fontSize = "23px";
        forwardButton.style.textAlign = "center";
        forwardButton.style.fontWeight = "bold";
        forwardButton.style.filter = "grayscale(100%) brightness(100%)";
        forwardButton.title = "Skip forward 15 seconds";
        forwardButton.style.marginTop = "1px";
        forwardButton.onclick = () => {
            const video = document.querySelector("video");
            if (video) video.currentTime = Math.min(video.duration, video.currentTime + 15);
        };


        controlBar.insertBefore(forwardButton, controlBar.firstChild);
        controlBar.insertBefore(backwardButton, controlBar.firstChild);
    }

    const observer = new MutationObserver(addSkipButtons);
    observer.observe(document, { childList: true, subtree: true });
})();