Skip to content

Instantly share code, notes, and snippets.

@heavyLobster2
Created December 9, 2018 22:08
Show Gist options
  • Save heavyLobster2/600fe1bc7ba49f924eb8298eab4aca06 to your computer and use it in GitHub Desktop.
Save heavyLobster2/600fe1bc7ba49f924eb8298eab4aca06 to your computer and use it in GitHub Desktop.
// ==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