Greasy Fork is available in English.
极简虎牙界面,自动切换到最高清晰度画质,移除各种广告弹窗
当前为
// ==UserScript==
// @name 极简虎牙界面
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description 极简虎牙界面,自动切换到最高清晰度画质,移除各种广告弹窗
// @author You
// @match https://www.huya.com/*
// @icon https://www.google.com/s2/favicons?domain=huya.com
// @grant none
// @license MIT
// ==/UserScript==
// player-videotype-list
// player-box-stat3
(function() {
'use strict';
// 移除广告弹窗
const removeAds = () => {
const removeNodes = []
if (document.querySelectorAll('.room-gg-chat')[0]) {
removeNodes.push(document.querySelectorAll('.room-gg-chat')[0])
}
if (document.querySelectorAll('.room-mod-ggTop')[0]) {
removeNodes.push(document.querySelectorAll('.room-mod-ggTop')[0])
}
// 移除所有的iframe
document.querySelectorAll('iframe').forEach(iframe => iframe.remove())
for(const node of removeNodes) {
node.remove()
}
}
setInterval(() => {
removeAds()
}, 1000);
// 移除不必要的页面元素
const removeNodesFunc = (nodes) => {
nodes.forEach(node => {
document.querySelector(node)?.remove()
})
}
setTimeout(() => {
const ul = document.querySelector('.player-videotype-list')
const unuseTool = [
'.player-gift-right',
'#player-face',
'#week-star-btn',
'#diy-pet-icon',
'.room-footer',
'.mod-sidebar',
'#diy-activity-icon-13889',
'#front-4a0mhq51_web_video_com',
'#diy-activity-icon-9557',
'.player-arrow-down',
]
if (ul) {
const firstLi = ul.firstElementChild
// 切换到最高清画质
firstLi.click()
setTimeout(() => {
document.querySelector('.more-attivity-panel').setAttribute('style', 'left: -64px !important; width: 240px !important;')
removeNodesFunc(unuseTool)
}, 1000);
}
}, 1000);
})();