Greasy Fork

Greasy Fork is available in English.

直播平台自动网页全屏

直播平台进入直播间厚自动网页全屏

当前为 2019-02-08 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         直播平台自动网页全屏
// @namespace    http://tampermonkey.net/
// @homeurl      http://greasyfork.icu/zh-CN/scripts/377547
// @version      0.2
// @description  直播平台进入直播间厚自动网页全屏
// @author       denghaha
// @match        https://www.douyu.com/*
// @match        https://www.panda.tv/*
// @match        https://www.huya.com/*
// @grant        none
// ==/UserScript==

(function () {
    var intervalTime = 500;
    var complete = false;
    var executeTime = 0;

    var interval = setInterval(applyLivePlatform, intervalTime);

    function clickLivePlatform(isClassName, danmu, fullscreen) {
        if (isClassName) {
            if (document.getElementsByClassName(danmu).length > 0
                && document.getElementsByClassName(fullscreen).length > 0) {
                document.getElementsByClassName(danmu)[0].click();
                document.getElementsByClassName(fullscreen)[0].click();
                complete = true
            }
        } else {
            if (document.getElementById(danmu) != null
                && document.getElementById(fullscreen) != null) {
                document.getElementById(danmu).click();
                document.getElementById(fullscreen).click();
                complete = true
            }
        }
    }

    function applyLivePlatform() {
        console.log("已经执行" + executeTime + "ms,当前状态:" + complete)
        if (executeTime >= 5000 || complete) {
            clearInterval(interval);
            console.log("已经执行" + executeTime + "ms,当前状态:" + complete+ ",任务已清除")
            return
        }
        executeTime += 500;
        
        let url = window.location.host
        if (url.indexOf("douyu.com") != -1) {
            clickLivePlatform(true, "showdanmu-42b0ac", "wfs-2a8e83")
        } else if (url.indexOf("panda.tv") != -1) {
            clickLivePlatform(true, "h5player-control-circlebar-btn h5player-control-circlebar-danmu", "h5player-control-bar-btn h5player-control-bar-fullscreen")
        } else if (url.indexOf("huya.com") != -1) {
            clickLivePlatform(false, "player-danmu-btn", "player-fullpage-btn")
        }
    }

})();