Created
November 7, 2019 18:15
-
-
Save kutu/9116669853448893d7907eee2c83e6a6 to your computer and use it in GitHub Desktop.
twitch player cursor hide
This file contains 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 twitch player cursor hide | |
// @version 0.1 | |
// @author kutu | |
// @match https://www.twitch.tv/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var playerControls, videoEl; | |
setInterval(function() { | |
var newPlayerControls = document.querySelector('.player-controls'); | |
if (!newPlayerControls || playerControls === newPlayerControls) return; | |
playerControls = newPlayerControls; | |
observer.disconnect(); | |
observer.observe(playerControls, {attributes: true}); | |
videoEl = document.querySelector('video').parentElement; | |
}, 1000); | |
var observer = new MutationObserver(function(list) { | |
videoEl.style.cursor = list[0].target.dataset.aVisible === 'false' ? 'none' : 'inherit'; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment