Youtube停用迷你播放器

停用Youtube迷你播放器功能

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Youtube停用迷你播放器
// @namespace   https://greasyfork.org/scripts/436314
// @version     1.5
// @description 停用Youtube迷你播放器功能
// @author      fmnijk
// @match       https://www.youtube.com/*
// @icon        https://www.google.com/s2/favicons?domain=youtube.com
// @grant       GM_addStyle
// @license     MIT
// ==/UserScript==

/*main function*/
(function() {
    'use strict';
	const $ = s => document.querySelector(s)
	const $$ = s => [...document.querySelectorAll(s)]
    function onDomChange(cb) {
		new MutationObserver(() => setTimeout(cb, 200)).observe(document.body, { childList: true });
	}
	function disableMiniplayer() {
        if($('.ytp-miniplayer-ui')?.style.display === ""){
            $('.ytp-miniplayer-close-button')?.click();
        }
	}
	onDomChange(disableMiniplayer);

    const styles = `
        /*屏蔽迷你播放器*/
        body > ytd-app > ytd-miniplayer{
	        display: none !important;
	        pointer-events:none !important;
        }
        /*屏蔽開啟迷你撥放器按鈕*/
        #movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-right-controls > button.ytp-miniplayer-button.ytp-button{
            display: none !important;
	        pointer-events:none !important;
        }
        /*屏蔽加入待播清單按鈕*/
		#hover-overlays > ytd-thumbnail-overlay-toggle-button-renderer:nth-child(2){
			display: none !important;
		}
        `
    GM_addStyle(styles);
})();