Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name netflix
// @namespace http://tampermonkey.net/
// @version 0.3
// @description try to take over the world!
// @author You
// @match *://www.netflix.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
'use strict';
const listeners = [];
const check = function() {
for (let listener of listeners) {
const elements = document.querySelectorAll(listener.selector);
for (let element of elements) {
if (!element.ready) {
element.ready = true;
listener.fn.call(element, element);
}
}
}
};
const observer = new MutationObserver(check);
observer.observe(document.documentElement, {
childList: true,
subtree: true
}
);
const watch = function(selector, fn) {
listeners.push({ selector, fn });
check();
return function() {
var idx = listeners.findIndex(function(listener) {
return listener.selector === selector
})
if (idx > -1) { listeners.splice(idx, 1) }
}
};
// skip intro
watch('.skip-credits', function(element) {
console.log(element)
var skip = element.children[0]
var unwatch = watch('.button-nfplayerPlay', function(play) {
console.log('play button found, clicking')
play.click()
})
skip.click()
setTimeout(unwatch, 1000)
})
// auto play next
//watch('.nf-flat-button-icon-play', element => element.parentElement.click())
watch('button[data-uia="next-episode-seamless-button"]', element => element.click())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.