您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes YouTube adblock detection popups and disables itself when user clicks video, reactivates on page navigation
// ==UserScript== // @name YouTube Remove Adblock detection // @namespace http://tampermonkey.net/ // @version 1.4 // @description Removes YouTube adblock detection popups and disables itself when user clicks video, reactivates on page navigation // @match https://www.youtube.com/watch* // @grant none // ==/UserScript== (function () { 'use strict'; let scriptDisabled = false; function waitForVideoElement(callback) { const checkInterval = setInterval(() => { const video = document.querySelector('video'); if (video) { clearInterval(checkInterval); callback(video); } }, 500); } function setupOverlayObserver(video) { const removeElementsAndPlay = () => { if (scriptDisabled) return; let removed = false; const overlayBackdrops = document.querySelectorAll('tp-yt-iron-overlay-backdrop'); if (overlayBackdrops.length > 0) { overlayBackdrops.forEach((e) => e.remove()); const popupContainers = document.querySelectorAll('ytd-popup-container'); popupContainers.forEach((e) => e.remove()); console.log('[Tampermonkey] Removed overlay backdrop'); removed = true; } if (video.paused) { console.log('[Tampermonkey] Overlay removed, resuming video...'); video.play(); } }; // Initial cleanup removeElementsAndPlay(); // DOM observer const observer = new MutationObserver(removeElementsAndPlay); observer.observe(document.body, { childList: true, subtree: true }); // Disable script on user click video.addEventListener('click', () => { scriptDisabled = true; console.log('[Tampermonkey] Script disabled after user clicked the video.'); }); window.addEventListener('yt-navigate-finish', () => { scriptDisabled = false; // Give the new page time to load }); } waitForVideoElement((video) => { setupOverlayObserver(video); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址