停用迷你播放器功能
当前为
// ==UserScript==
// @name Youtube關閉迷你播放器
// @namespace https://greasyfork.org/scripts/436314
// @version 1.0
// @description 停用迷你播放器功能
// @author fmnijk
// @match https://www.youtube.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
//document.querySelectorAll('ytd-player')[0].remove();
// 定时器
setInterval(() => {
// 判断是否運行迷你播放器
if (window.location.href == 'https://www.youtube.com/'){
if (document.getElementsByClassName('ytp-miniplayer-close-button ytp-button')[1]) {
// 模拟点击
document.getElementsByClassName('ytp-miniplayer-close-button ytp-button')[1].click();
}
}
}, 100)
// 屏蔽迷你播放器
var 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;
}
`
var styleSheet = document.createElement("style")
styleSheet.type = "text/css"
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
})();