Skip to content

Instantly share code, notes, and snippets.

@khlam
Last active January 29, 2022 10:09
Show Gist options
  • Select an option

  • Save khlam/0071bb0e2eaf1c85c22291c9def548b3 to your computer and use it in GitHub Desktop.

Select an option

Save khlam/0071bb0e2eaf1c85c22291c9def548b3 to your computer and use it in GitHub Desktop.
userscript / greasemonkey / violentmonkey script for twitch.tv frontpage autoplay block, twitch_front_carousel_block twitch autplay block
// ==UserScript==
// @name twitch_front_carousel_block
// @version 0.0
// @description Blocks twitch frontpage autoplaying stream by setting its source to null.
// @author khlam
// @match http://www.twitch.tv/
// @match https://www.twitch.tv/
// @grant none
// @run-at document-end
// ==/UserScript==
if (window.location.href === "https://www.twitch.tv/" || window.location.href === "http://www.twitch.tv/" ) {
let i = 0
let interval = setInterval(() => {
let video = document.querySelector("video")
console.log(i)
if (video.getAttribute('src') != null) {
console.log("setting video src to null...")
video.setAttribute('src', null)
clearInterval(interval)
}
i += 1
if (i === 100) {
clearInterval(interval)
}
}, 100)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment