Netflix intro skip

This script automatically skips intro on Netflix. And it's jQuery free!

Устаревшая версия за 28.02.2022. Перейдите к последней версии.

// ==UserScript==
// @name        Netflix intro skip
// @namespace   https://giuseppe.eletto.org
// @description This script automatically skips intro on Netflix. And it's jQuery free!
// @version     1.0.0
// @license     MIT
// @run-at      document-end
// @include     https://www.netflix.com/*
// ==/UserScript==
(function() {
    'use strict';

	// Declare constants
	const observerTarget = window.document.querySelector('body');
	const observerCallback = mutations => Array.from(mutations)
		.filter(m => m.type === 'childList')
		.flatMap(m => Array.from(m.addedNodes))
		.flatMap(n => Array.from(n.childNodes))
		.filter(n => n.tagName === 'BUTTON')
		.filter(e => e.getAttribute('data-uia') === 'player-skip-intro')
		.forEach(e => e.click());

	// Start MutationObserver
	new MutationObserver(observerCallback)
		.observe(observerTarget, {
			childList: true,
			subtree: true
		});
})();