Greasy Fork is available in English.
支持哔哩哔哩、腾讯视频、优酷视频、爱奇艺、芒果TV、搜狐视频、AcFun弹幕网播放页自动网页全屏
当前为
// ==UserScript==
// @license MIT
// @author Feny
// @version 0.9.5
// @name 视频网站自动网页全屏
// @namespace http://tampermonkey.net/
// @description 支持哔哩哔哩、腾讯视频、优酷视频、爱奇艺、芒果TV、搜狐视频、AcFun弹幕网播放页自动网页全屏
// @include https://tv.sohu.com/v/*
// @include https://www.acfun.cn/v/*
// @include https://www.mgtv.com/b/*
// @include https://www.iqiyi.com/v_*
// @include https://v.pptv.com/show/*
// @include https://v.qq.com/x/page/*
// @include https://v.qq.com/x/cover/*
// @include https://haokan.baidu.com/v*
// @include https://v.youku.com/v_show/*
// @include https://live.acfun.cn/live/*
// @include https://live.bilibili.com/\d+*
// @include https://www.acfun.cn/bangumi/*
// @include https://www.bilibili.com/list/*
// @include https://www.bilibili.com/video/*
// @include https://v.qq.com/live/p/newtopic/*
// @include https://www.bilibili.com/festival/*
// @include /https:\/\/live.bilibili.com\/\d+.*$/
// @include https://www.bilibili.com/cheese/play/*
// @include https://www.bilibili.com/bangumi/play/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAqdJREFUWEftl91LFFEYxp/3jB9ESZjtSl51F1RUSgRCF/kHlF1IhiFhF65dqEQkBUErdJMStBukGwQre2NZUiCRqUiURkW65mIfqGUFsW6Ii0jY7p4Tc3Rqd5zaGVldAudynve8z28e3jMzh5Dmi1R/V0vQyRRWxgWG6x22SrcnOAhQcQIbwVtXba8y1EANSpS1xzJin5c/Dz+jRDPvGWoErwRw35zuh8ChpcXXFjbwi9k/WADA9viGgovGnxtFs6EmcApMvCdBA3oIIirl4N8NNQngmRYJiwTOE7EHHLERAmXFawQ6AdCQkRbjsZIMUvIFoV0HMSsEDjCgSK8tJqAHAEDAMWLKLOexx8tiVVDEhLLVQAtzRPcwKOUANSWCw1/rsBe6PcFz8dpfAdTFgtF+EmIvBG7pID7mZNl2zkVCFQbahzqHfYerddpNhFpdsnfqauzl8ZoEuO4JXdIKOefynnZlimxXhBbqjTZL/el8pzrAVjTGmKh12Bq1ddJs974abQDXfFMuAhQ6EodwDTHWAf6/BAoK8nD0cDEKtuVhyD+OzvvLXnyWJshyApedJ1F65M9n4tlAAF5fL168fGfJWCu2DDA61GpodLvjCdp8vfjyNWQJJGUAquvMzBzafD0yEc65KZCUAmiOo4FPEqS753VSiFUB0FxbPF244en6J8SqAoTD8zhYcjZ9AP6RCVRWNacHYPD5GJqudmBi8tvaAkxNBeUuuNv5NOkAqgUpm4FIJCrfA+r0z4bnTZmvCKCv+wrsts0JBg8fvZLGY28NfoqToFhOoOJ4CS40lMu2I28mpXFP37DpJ9YXWgZQG+Tm5mBL7qakA2aGakUAZhqbrVkH0BLoB34fzcyml5K6pd/yaicRlQlgV0q6mmwitMOpyfpVKfsFya4w73cz9xQAAAAASUVORK5CYII=
// ==/UserScript==
(function () {
"use strict";
// 重写pushState方法
const orig = history.pushState;
history.pushState = function () {
orig.apply(this, arguments);
window.dispatchEvent(new Event('pushstate'));
};
// 重写replaceState方法
const original = history.replaceState;
history.replaceState = function () {
original.apply(this, arguments);
window.dispatchEvent(new Event('replaceState'));
};
const selector = {
"v.pptv.com": ".w-expandIn",
"www.acfun.cn": ".fullscreen-web",
"live.acfun.cn": ".fullscreen-web",
"v.youku.com": "#webfullscreen-icon",
"www.mgtv.com": ".webfullscreenBtn i",
"www.iqiyi.com": ".iqp-btn-webscreen",
"v.qq.com": 'div[aria-label="网页全屏"]',
"tv.sohu.com": 'button[data-title="网页全屏"',
"www.bilibili.com": 'div[aria-label="网页全屏"]',
"live.bilibili.com": "#businessContainerElement",
"haokan.baidu.com": 'div[aria-label="网页全屏"]',
}
const webfullscreen = {
init(win) {
let i = 0
const time = 30000, delay = 300, interval = setInterval(() => {
const element = this.getElement()
if (++i * delay >= time) clearInterval(interval);
if (element) this.fullScreen(element, win) && clearInterval(interval);
}, delay);
},
getElement: () => document.querySelector(selector[location.host]),
fullScreen(elem, win) {
// B站直播
if (Object.is(location.host, "live.bilibili.com")) {
const e = new MouseEvent("dblclick", {
view: win,
bubbles: true,
cancelable: true,
});
elem.dispatchEvent(e);
localStorage.setItem("FULLSCREEN-GIFT-PANEL-SHOW", 0);
document.body.classList.add("hide-asida-area", "hide-aside-area")
return true
}
const video = document.querySelector("video")
const offsetWidth = video.offsetWidth
if (Object.is(0, offsetWidth)) return false
if (Object.is(window.innerWidth, offsetWidth)) return true
elem.click ? elem.click() : elem.dispatchEvent(new Event("click"));
return true
},
};
webfullscreen.init();
window.addEventListener('pushstate', () => webfullscreen.init(window));
window.addEventListener('replaceState', () => webfullscreen.init(window));
})();