Vegeta Ultra Ego Anti Lag Sem Tela Preta

Fullscreen, sem borda preta, sem lag, sem travamento. Press P pra trocar

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Vegeta Ultra Ego Anti Lag Sem Tela Preta
// @namespace    http://tampermonkey.net/
// @version      8.1
// @description  Fullscreen, sem borda preta, sem lag, sem travamento. Press P pra trocar
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const videoURLs = [
        "https://files.catbox.moe/pdoowu.mp4",
        "https://files.catbox.moe/8rghdx.mp4",
        "https://files.catbox.moe/3q0sj1.mp4",
        "https://files.catbox.moe/0ecjn5.mp4",
        "https://files.catbox.moe/rwc0em.mp4",
        "https://files.catbox.moe/uww9y2.mp4",
        "https://files.catbox.moe/da9j9t.mp4",
        "https://files.catbox.moe/9eeurq.mp4",
        "https://files.catbox.moe/v6a5t2.mp4",
        "https://files.catbox.moe/qdrmsf.mp4",
        "https://files.catbox.moe/j9rb4i.mp4"
    ];

    let currentIndex = 0;
    let videoElement = null;
    let preloadElement = null;

    window.addEventListener('load', () => {
        if (!document.body.className.includes("g-home")) return;

        document.body.style.margin = '0';
        document.body.style.padding = '0';
        document.body.innerHTML = "";

        document.documentElement.style.cssText = `
            margin: 0;
            padding: 0;
            overflow: hidden;
            height: 100%;
            width: 100%;
            background: black;
        `;

        const container = document.createElement("div");
        container.style.cssText = `
            position: fixed;
            top: 0; left: 0;
            width: 100vw; height: 100vh;
            background: black;
            z-index: 999999;
            overflow: hidden;
        `;
        document.body.appendChild(container);

        const preloadNextVideo = (nextIndex) => {
            if (preloadElement) preloadElement.remove();

            preloadElement = document.createElement("video");
            preloadElement.src = videoURLs[nextIndex];
            preloadElement.preload = "auto";
            preloadElement.muted = true;
            preloadElement.style.display = "none";
            document.body.appendChild(preloadElement);
        };

        function createAndPlayVideo(index) {
            if (videoElement) {
                videoElement.pause();
                videoElement.remove();
            }

            const vid = document.createElement("video");
            vid.src = videoURLs[index];
            vid.muted = true;
            vid.playsInline = true;
            vid.loop = false;
            vid.preload = "auto";
            vid.autoplay = true;

            vid.setAttribute("playsinline", "");
            vid.setAttribute("muted", "");
            vid.setAttribute("autoplay", "");
            vid.setAttribute("disableRemotePlayback", "true");

            vid.style.cssText = `
                width: 100vw;
                height: 100vh;
                object-fit: cover;
                background-color: black;
                position: fixed;
                top: 0;
                left: 0;
            `;

            container.appendChild(vid);
            videoElement = vid;

            const fallbackTimeout = setTimeout(() => {
                if (vid.readyState < 2) {
                    console.warn("Vídeo lento, pulando...");
                    currentIndex = (currentIndex + 1) % videoURLs.length;
                    createAndPlayVideo(currentIndex);
                }
            }, 3000);

            vid.addEventListener("canplay", () => {
                clearTimeout(fallbackTimeout);
                vid.play().catch(() => {});
            });

            vid.onerror = () => {
                console.warn("Erro no vídeo, trocando...");
                currentIndex = (currentIndex + 1) % videoURLs.length;
                createAndPlayVideo(currentIndex);
            };

            const next = (index + 1) % videoURLs.length;
            preloadNextVideo(next);
        }

        createAndPlayVideo(currentIndex);

        document.addEventListener("keydown", (e) => {
            if (e.key.toLowerCase() === "p") {
                currentIndex = (currentIndex + 1) % videoURLs.length;
                createAndPlayVideo(currentIndex);
            }
        });

        if ('wakeLock' in navigator) {
            navigator.wakeLock.request('screen').catch(() => {});
        }
    });
})();