Turn Off Youtube Annotations

Script to deactivate annotations toggle from youtube video settings

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         Turn Off Youtube Annotations
// @version      1.0
// @description  Script to deactivate annotations toggle from youtube video settings
// @author       Hephaistoz
// @match        https://youtube.com/*
// @match        https://www.youtube.com/*
// @match        http://youtube.com/*
// @match        http://www.youtube.com/*
// @grant        none
// @namespace https://greasyfork.org/users/725305
// ==/UserScript==

(function () {
    'use strict';

    (function TurnOFF(){
        try {
            var ytplayer = document.getElementById("movie_player");

            if(ytplayer.getCurrentTime() <= 0.5)// check if has passed 0.5 seconds since video started // useful to not block the user from changing quality etc.
            {
                var settings_button = document.querySelector(".ytp-settings-button");
                settings_button.click(); settings_button.click(); // open and close settings, so annotations label is created

                var all_labels = document.getElementsByClassName("ytp-menuitem-label");
                for (var i = 0; i < all_labels.length; i++) {
                    if ((all_labels[i].innerHTML == "Annotations") || (all_labels[i].innerHTML == "Anotações") && (all_labels[i].parentNode.getAttribute("aria-checked") == "true")) { // find the correct label and see if it is active
                        all_labels[i].click(); // and in that case, click it
                    }
                }
            }
        } catch (e) {}
        setTimeout(TurnOFF,800);
    })();
})();