以下是一种可能的猴油脚本,它会在页面中的视频播放结束后自动关闭当前页面:

// ==UserScript==
// @name         Close page after video ends
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically close the current page after the video finishes playing on the page
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    // find all video elements on the page
    var videos = document.getElementsByTagName('video');
    
    // add an event listener to each video element
    for (var i = 0; i < videos.length; i++) {
        videos[i].addEventListener('ended', function() {
            // when the video ends, close the current page
            window.close();
        });
    }
})();

请注意,此脚本可能会在许多网站上关闭页面,因此请谨慎使用。建议在需要自动关闭页面的特定网站上使用此脚本。


原文地址: https://www.cveoy.top/t/topic/oQoP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录