Greasy Fork is available in English.
直播平台进入直播间厚自动网页全屏
当前为
// ==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")
}
}
})();