Greasy Fork

Video Manipulator and Modal Remover

Manipulate video elements and remove modal on web pages

当前为 2024-07-24 提交的版本,查看 最新版本

// ==UserScript==
// @name         Video Manipulator and Modal Remover
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Manipulate video elements and remove modal on web pages
// @author       Alcex
// @match        *://*.zxx.edu.cn/*
// @match        *://*.smartedu.cn/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function manipulateVideo() {
        var v = document.querySelector("video");
        if (v) {
            v.dispatchEvent(new Event("ended"));
            v.muted = true;
            v.currentTime = Math.floor(v.duration);
            v.play();
        }
        
        // 1秒后再次调用自身
        setTimeout(manipulateVideo, 1000);
    }

    function removeModal() {
        var modal = document.querySelector(".fish-modal-root");
        if (modal) {
            modal.remove();
        }
    }

    // 开始循环
    manipulateVideo();
    // 移除模态框
    removeModal();
})();