Skip to content

Instantly share code, notes, and snippets.

@prashantpalikhe
Created July 31, 2018 21:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prashantpalikhe/96baea99374a314b64b786e6a772b2e9 to your computer and use it in GitHub Desktop.
Save prashantpalikhe/96baea99374a314b64b786e6a772b2e9 to your computer and use it in GitHub Desktop.
Auto skip Netflix intro
// ==UserScript==
// @name Auto skip Netflix intro
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Automatically clicks on the "Skip intro" button in Netflix
// @author Prashant Palikhe
// @match https://www.netflix.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const callback = (mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type == 'childList' && mutation.addedNodes.length) {
const skipCredit = Array.from(mutation.addedNodes).find((node) => {
return node.classList && node.classList.contains('skip-credits');
});
if (skipCredit) {
skipCredit.querySelector('a').click();
return;
}
}
}
};
const observer = new MutationObserver(callback);
observer.observe(document.body, {
childList: true,
subtree: true
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment