m.YouTube.com seek buttons

Adds +-30sec +-1min +-5min buttons below the video

12.10.2023 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         m.YouTube.com seek buttons
// @namespace    m-youtube-com-seek-buttons
// @version      1.0
// @description  Adds +-30sec +-1min +-5min buttons below the video
// @author       hlorand.hu
// @match        https://m.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license      https://creativecommons.org/licenses/by-nc-sa/4.0/
// ==/UserScript==

(function() {
    //'use strict';

    function addbuttons(){
        document.getElementById("seekbuttons").innerHTML = "";

        const times = ["+300s", "+60s", "+30s", "-30s", "-60s", "-300s"];

        times.forEach((time)=>{
            let button = document.createElement('button');
            button.textContent = time;
            button.className = "speedbutton";

            button.style.margin = "5px";
            button.style.padding = "5px";
            button.style.backgroundColor = "purple";
            button.style.position = "relative";

            button.onclick = function() {
                let video = document.querySelector("video");

                if(video && video.readyState >= 2) {
                    video.currentTime += parseInt(this.textContent.replace("s",""));
                }
            };

            let target = document.getElementById("seekbuttons");
            target.insertBefore(button, target.firstChild);

        }); // end times foreach

    } // end addbuttons

    window.addEventListener('load', function () {
        setInterval(()=>{
            if( document.getElementById("seekbuttons") == undefined ){
                let parent = document.querySelector('.related-chips-slot-wrapper');
                let wrapper = document.createElement('div');
                wrapper.setAttribute("id","seekbuttons");
                parent.insertBefore(wrapper, parent.firstChild);
                addbuttons();
            }
        }, 1000);
    }); // end addEventListener


})();