您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Pause stream/video in the channel and video-list page
// ==UserScript== // @name Twitch pause autoplay // @namespace https://github.com/etshy // @icon https://www.twitch.tv/favicon.ico // @version 1.0.4 // @description Pause stream/video in the channel and video-list page // @author Etshy // @exclude https://www.twitch.tv/videos/* // @match https://www.twitch.tv/* // @supportURL https://gist.github.com/etshy/325d00b7487cae4ad45569f4f6b1bdb8 // @grant none // @license MIT // ==/UserScript== /* jshint esversion:6 */ window.onload = function() { let active = 1; let interval = setInterval(function(){ if (active === 0) { return; } let liveVideo = document.querySelector('.channel-root--live') let liveVideoHome = document.querySelector('.channel-root--home') if (liveVideo && (!liveVideoHome || liveVideoHome === null)) { //we are on live page video let videoPlayer = document.querySelector('video') if (videoPlayer.paused) { videoPlayer.play() active = 0; } return; } if (!window.location.href.startsWith('https://www.twitch.tv/videos/') || (liveVideoHome && liveVideoHome !== null)) { let videoPlayer = document.querySelector('video') if (videoPlayer.paused === false) { videoUrlLoaded = videoPlayer.src videoPlayer.pause(); active = 0; } } if (window.location.href.startsWith('https://www.twitch.tv/videos/')) { let videoPlayer = document.querySelector('video') if (videoPlayer.paused) { videoPlayer.play() active = 0; } } }, 100); window.addEventListener('popstate', function (event) { active = 1; }); };