自动开启网页全屏

网页加载完4秒后,启动网页全屏

目前為 2023-09-22 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         自动开启网页全屏
// @namespace    https://github.com/idcpj
// @version      0.8
// @description  网页加载完4秒后,启动网页全屏
// @author       idcpj
// @match        *v.qq.com/x/cover/*
// @match        *live.bilibili.com/*
// @match        *www.bilibili.com/video*
// @match        *www.youtube.com/watch?v=*
// @match        *www.iqiyi.com/*
// @match        *pan.baidu.com/play/video*
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {

    var doubleClickEvent = new MouseEvent("dblclick", {
        bubbles: true,  // 如果希望事件冒泡,请设置为 true
        cancelable: true,  // 如果希望事件可取消,请设置为 true
        view: window  // 视图窗口,通常是 window
    });

     window.setTimeout(function(){
            document.querySelector('[aria-label="网页全屏"]')?.click(); //b站
            document.querySelector('#businessContainerElement').dispatchEvent(doubleClickEvent); // b站

            document.querySelector(".txp_btn_fake")?.click(); //腾讯
            document.querySelector(".ytp-size-button")?.click(); //youtube
            document.querySelector("a[data-player-hook='webfullscreen']")?.click(); //爱奇艺
    }, 4000);


})();