Created
July 31, 2018 21:23
-
-
Save prashantpalikhe/96baea99374a314b64b786e6a772b2e9 to your computer and use it in GitHub Desktop.
Auto skip Netflix intro
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 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