Greasy Fork

来自缓存

Greasy Fork is available in English.

Olevod Video Auto Next

Automates actions on Olevod video player

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Olevod Video Auto Next
// @namespace    http://your.domain.com
// @version      1.1
// @description  Automates actions on Olevod video player
// @author       Your Name
// @match        https://www.olevod.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    console.log("silent checking");

    // Function to get the video element
    const getVideoElement = () => {
        return document.querySelector("video");
    };

    // Function to enter fullscreen mode
    const enterFullScreen = (video) => {
        if (video) {
            if (!document.fullscreenElement) {
                console.log("enter full screen")
                video.requestFullscreen();
            }
        }
    };

    // Function to check if the video time equals max time and click next episode
    const checkAndClickNextEpisode = () => {
        const video = getVideoElement();
        if (video) {
            const currentTime = video.currentTime;
            const duration = video.duration;
            const maxTimeThreshold = 0.95; // Adjust this threshold as needed

            // If current time reaches 95% of the duration, simulate clicking the next episode button
            if (currentTime >= maxTimeThreshold * duration) {
                console.log("time is up, next");
                const nextEpisodeButton = parent.$(".next-t");;
                if (nextEpisodeButton) {
                    console.log("i got the next button");
                    nextEpisodeButton.click();
                }
            }

            // Enter fullscreen mode only when the current time is close to the beginning of the duration
            if (currentTime < 5) { // Adjust the threshold as needed
                enterFullScreen(video);
            }
        }
    };

    // Check and click next episode every second
    setInterval(checkAndClickNextEpisode, 1000);

})();