您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically mutes the Twitch player when an advertisement started and unmute it once finished.
当前为
// ==UserScript== // @name Twitch - Mute ads // @namespace TWITCHADS // @description Automatically mutes the Twitch player when an advertisement started and unmute it once finished. // @include https://www.twitch.tv/* // @include https://twitch.tv/* // @version 1.02 // @license MIT // @author Harest // @grant none // ==/UserScript== var _tmuteVars = { "timerCheck": 1000, // Checking rate of ad in progress "playerMuted": false, // Player muted or not "adsDisplayed": 0 // Number of ads displayed; }; // Check if there's an ad function checkAd() { var advert = document.getElementsByClassName('player-ad-notice'); // class "twitch-stitched-ad" doesn't seem to appear if ((advert.length >= 1 && _tmuteVars.playerMuted === false) || (_tmuteVars.playerMuted === true && advert.length === 0)) { console.log(advert); mutePlayer(); } } // (un)Mute Player function mutePlayer() { if (document.getElementsByClassName("player-button--volume").length >= 1) { document.getElementsByClassName("player-button--volume")[0].click(); _tmuteVars.playerMuted = !(_tmuteVars.playerMuted); if (_tmuteVars.playerMuted === true) { _tmuteVars.adsDisplayed++; console.log("Ad #" + _tmuteVars.adsDisplayed + " detected. Player muted."); } else { console.log("Ad #" + _tmuteVars.adsDisplayed + " finished. Player unmuted."); } } else { console.log("No volume button found (class changed ?)."); } } _tmuteVars.autoCheck = setInterval(checkAd, _tmuteVars.timerCheck);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址