Disable HTML5 Video Autoplay

Stops HTML5 video autoplay on most websites

当前为 2025-07-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         Disable HTML5 Video Autoplay
// @namespace    RGlzYWJsZSBIVE1MNSBWaWRlbyBBdXRvcGxheQ
// @version      1.0
// @description  Stops HTML5 video autoplay on most websites
// @author       smed79
// @license      GPLv3
// @icon         https://i25.servimg.com/u/f25/11/94/21/24/noplay10.png
// @homepage     https://github.com/smed79
// @include      http://*
// @include      https://*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Disable autoplay for all HTML5 videos
    const stopAutoplay = () => {
        const videos = document.querySelectorAll('video');
        videos.forEach(video => {
            video.pause();
            video.autoplay = false;
            // Optional: Uncomment to fully disable buffering
            // video.src = "";
        });
    };

    // Run on page load and DOM content loaded
    stopAutoplay();
    window.addEventListener('load', stopAutoplay);
    document.addEventListener('DOMContentLoaded', stopAutoplay);
})();