Stop Youtube Autoplay figuccio

Stop Youtube video +stop riproduzione automatica

当前为 2023-02-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         Stop Youtube Autoplay figuccio
// @namespace    https://gf.qytechs.cn/users/237458
// @match        https://www.youtube.com/*
// @noframes
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @description  Stop Youtube video +stop riproduzione automatica
// @version      0.1
// @license      MIT
// ==/UserScript==
//prima di continuare su youtube click su rifiuta cookie
var timerconsent;

timerconsent =setInterval(function(){document.querySelector("#content > div.body.style-scope.ytd-consent-bump-v2-lightbox > div.eom-buttons.style-scope.ytd-consent-bump-v2-lightbox > div:nth-child(1) > ytd-button-renderer:nth-child(1) > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__fill").click();}, 1000);

// Dopo 9 secondi, fermiamo il timer utilizzando la funzione clearInterval()
setTimeout(function() {
  clearInterval(timerconsent);
}, 9000);

/////////////////////////////////////////////////////////f7 illum cinema
document.cookie = "PREF=f6=40000400&f7=140;domain=youtube.com";//ok tema scuro illum cinem disattivata
if(!localStorage.reload) {
 setTimeout("document.location.reload()",2000);
 localStorage.reload = 1;
    }
///////////////////////////////////////////////////////////////////////////////////
function isPlayingPlaylist(){
  var params = new URLSearchParams(window.location.search);
  return params.has('list')
}

const pauseVideo = () => !isPlayingPlaylist() && document.querySelector('.html5-video-player').pauseVideo()

function stopAutoPlay(){
  const interval = setInterval(() => {
      ///////////////////////////////////////////////
      //riproduzione automatica disattivata  2023
        let autoplayButton = document.getElementsByClassName('ytp-autonav-toggle-button')[0];
        let autoplayEnabled = autoplayButton && autoplayButton.getAttribute('aria-checked') === 'true';
        if (autoplayEnabled) {
            console.log("proverà ora a disattivare la riproduzione automatica.");
            autoplayButton.click();
             }
/////////////////////////////////////////////////
    if(!document.querySelector('video') || !document.querySelector('.html5-video-player')) return
      pauseVideo()
  }, 200)

  document.addEventListener('mousedown', () => {
      if(interval){
        clearInterval(interval)
      }
    },
    {once: true}
  )
  document.addEventListener('keydown', e => {
      if(interval){
        clearInterval(interval)
      }
    },
    {once: true}
  )
}

stopAutoPlay()
window.addEventListener('yt-navigate-finish', stopAutoPlay)

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址