您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Prevent webbrowser from automatically playing/downloading HTML5 videos
// ==UserScript== // @name Disable HTML5 Videos autoplay/autopreload // @namespace default // @include * // @version 2.0 // @grant none // @description Prevent webbrowser from automatically playing/downloading HTML5 videos // ==/UserScript== document.addEventListener("DOMContentLoaded", function(e) { var disable_videos = function() { var videos = document.getElementsByTagName("video"); if (document.readyState !== "interactive") { Array.forEach(videos, function(video) { if (!video.getAttribute("gm_processed")) return; //Now that document has completed loading, bring back video's original url video.setAttribute("src", video.getAttribute("gm_src")); video.pause(); video.removeAttribute("gm_processed"); }); return; } setTimeout(disable_videos, 1000); Array.forEach(videos, function(video) { if (video.getAttribute("gm_processed")) return; var old_url = video.currentSrc; //Only process a video if it has "src" but not one starting with mediasource: if (old_url && (!old_url.startsWith("mediasource:"))) { console.log("GMoneky: disabling autoplay for ", video); video.removeAttribute("autoplay"); video.removeAttribute("autobuffer"); video.setAttribute("preload", "metadata"); video.setAttribute("src", "about:blank"); video.setAttribute("gm_src", old_url); video.setAttribute("gm_processed", true); } }); }; disable_videos(); });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址