YouTube Disable Ambient Mode

Disables YouTube ambient mode if its turned on.

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        YouTube Disable Ambient Mode
// @namespace   natehak.com
// @match       *://*.youtube.com/*
// @exclude     *://*.youtube.com/embed/*
// @grant       none
// @version     1.0.1
// @license     GPLv3
// @author      @natehak
// @description Disables YouTube ambient mode if its turned on.
// ==/UserScript==

let id = setInterval(() => {
  document.querySelector('.ytp-settings-button').click();
  let ambientModeItem = document.querySelector('#ytp-id-18 .ytp-menuitem[tabindex="0"]');
  let itemIsAmbientMode = ambientModeItem !== null
    ? ambientModeItem.querySelector('.ytp-menuitem-label').innerText === 'Ambient mode'
    : false;
  let ambientModeEnabled = ambientModeItem !== null
    ? ambientModeItem.getAttribute('aria-checked') === 'true'
    : false;

  if (itemIsAmbientMode) {
    clearInterval(id);
    if (ambientModeEnabled) {
      ambientModeItem.click();
      console.info('YouTube Ambient Mode: Disabled');
    }
  }
  document.querySelector('.ytp-settings-button').click();
}, 2500);