Better Live UX

自动选择最高清晰度、禁止弹幕、禁止广告。

当前为 2020-06-02 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           Better Live UX
// @name:zh-CN     更好的直播体验(最高清晰度、禁弹幕、禁广告)
// @namespace      lhzbxx
// @version        2020.06.02
// @description    自动选择最高清晰度、禁止弹幕、禁止广告。
// @author         lhzbxx
// @run-at         document-idle
// @noframes
// @require        https://cdn.jsdelivr.net/npm/jquery
// @require        https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349
// @match          *://live.bilibili.com/*
// @match          *://www.douyu.com/*
// @match          *://www.huya.com/*
// @match          *://egame.qq.com/*
// ==/UserScript==

const config = {
    huya: {
        selectors: [
            '#player-danmu-btn',
            'ul.player-videotype-list > li:nth-child(1)',
            'div.ab-close-btn',
            // '#player-fullpage-btn',
        ],
        timeout: 1500,
    },
    douyu: {
        selectors: [
            `div[class^='showdanmu-']`,
            `div[class^='tip-'] > ul > li:nth-child(1)`,
            // `div[class^='wfs']:not([class^='wfs-exit'])`,
        ],
    },
    bilibili: {
        selectors: [
            'i.live-icon-danmaku-on',
            // 'button[data-title="网页全屏"]',
        ],
    },
    qq: {
        selectors: [
            'div.vcp-extended-barrage',
            'a.vcp-vertical-switcher-item-clarity:nth-child(1)',
            // 'div.vcp-extended-webfullscreen',
        ],
    },
}

const site = config[document.domain.split('.').reverse()[1]];

(function() {
    'use strict';

    if (!site) {
        return;
    }

    site.selectors.forEach(selector => {
        setTimeout(() => {
            waitForKeyElements(selector, (node) => {
                node.click();
            });
        }, site.timeout || 0);
    });
})();