Created
September 20, 2017 11:54
-
-
Save LazyMammal/1c60c45e9df26602f688d025f3b20f0c to your computer and use it in GitHub Desktop.
Hide live chat by default on YouTube live streams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YouTube - Hide Live Chat | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide live chat by default on live streams | |
// @author LM | |
// @match https://www.youtube.com/watch* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
function AddClass() { | |
var el = document.getElementById("live-chat-iframe"); | |
if(el) { | |
el.parentElement.classList.add("yt-uix-expander-collapsed"); | |
console.log('Hide Live Chat'); | |
return true; | |
} | |
return false; | |
} | |
function KeepTrying(func, attempts, delay) { | |
console.log('Keep Trying ' + attempts); | |
if( !func() && attempts-1 > 0 ) { | |
window.setTimeout( function() { | |
KeepTrying(func, attempts-1, delay); | |
}); | |
} | |
} | |
(function() { | |
'use strict'; | |
KeepTrying( AddClass, 5, 10 ); | |
})(); |
I'd love to see this as a repo so updates can be automatically received via a userscript manager.
Continuing this in https://gist.github.com/lbmaian/94824cef728917a53d3c6e6ea885469c
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based off @milroneth's version with following improvements: