Created
December 9, 2018 22:08
-
-
Save heavyLobster2/600fe1bc7ba49f924eb8298eab4aca06 to your computer and use it in GitHub Desktop.
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 Mute Netflix Previews | |
// @description Mutes Netflix auto-play previews | |
// @version 1.0.0 | |
// @author heavyLobster2 | |
// @namespace github.com/heavyLobster2 | |
// @downloadURL https://gist.github.com/heavyLobster2/600fe1bc7ba49f924eb8298eab4aca06/raw/MuteNetflixPreviews.user.js | |
// @match *://www.netflix.com/* | |
// @grant none | |
// @noframes | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
function mutePreviews() { | |
var toggle = document.querySelector("div.global-supplemental-audio-toggle a"); | |
var icon = toggle.querySelector("svg.svg-icon"); | |
if (toggle && icon) { | |
if (icon.classList.contains("svg-icon-audio-on")) { | |
toggle.click(); | |
} | |
return true; | |
} | |
return false; | |
} | |
(new MutationObserver(function (mutations, observer) { | |
if (mutePreviews()) { | |
observer.disconnect(); | |
} | |
})).observe(document, { subtree: true, childList: true}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment