Netflix - Hide skip buttons and post-play

This script removes interruptions from playback so that you can watch from beginning to end (including credits) without things like the "SKIP INTRO" button, the post-play screen, or the "WATCH CREDITS"/"NEXT EPISODE IN X" buttons

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Netflix - Hide skip buttons and post-play
// @namespace    https://zornco.com/
// @version      1.0.0
// @description  This script removes interruptions from playback so that you can watch from beginning to end (including credits) without things like the "SKIP INTRO" button, the post-play screen, or the "WATCH CREDITS"/"NEXT EPISODE IN X" buttons
// @author       SystemDisc
// @match        http*://*.netflix.com/*
// @grant        none
// ==/UserScript==

let headElem = document.querySelector('head');
let styleElem = document.createElement('style');
styleElem.type = 'text/css';
styleElem.textContent = `
	.skip-credits,
	[aria-label="Watch credits"],
	[aria-label^="Next episode in"] {
		/*display: none !important;*/
	}
	.NFPlayer.postplay {
		top: 0 !important;
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100% !important;
		height: 100% !important;
		border: none !important;
		outline: none !important;
	}
`;
headElem.appendChild(styleElem);

let playerElem;
let getPlayer = function() {
	playerElem = document.querySelector('.NFPlayer');
	if (!playerElem) {
		requestAnimationFrame(getPlayer);
	}
};

let controlsElem;
let getControls = function() {
	controlsElem = document.querySelector('.controls');
	if (!controlsElem) {
		requestAnimationFrame(getControls);
	}
};

let watchUntilEnd = function() {
	if (controlsElem) {
		let creditsButtonContainer = controlsElem.querySelector('.PlayerControls--container > .main-hitzone-element-container > .SeamlessControls--container');
		if (creditsButtonContainer) {
			let creditsButton = creditsButtonContainer.querySelector('[aria-label="Watch credits"]');
			if (creditsButton && creditsButtonContainer.classList.contains('SeamlessControls--container-visible')) {
				console.log('click');
				creditsButton.click();
			}
		}
		else if (playerElem.classList.contains('postplay')) {
			playerElem.click();
		}
	}
	setTimeout(getPlayer);
	setTimeout(getControls);
	setTimeout(watchUntilEnd, 1000);
};
watchUntilEnd();

let toggleControls = function() {
	controlsElem = document.querySelector('.controls');
	if (controlsElem) {
		if (controlsElem.style.display !== 'none') {
			controlsElem.style.display = 'none';
		}
		else if (controlsElem.style.display === 'none') {
			controlsElem.style.display = null;
		}
	}
	else {
		requestAnimationFrame(toggleControls);
	}
};

document.addEventListener('keyup', function(e) {
	if (
		e.ctrlKey &&
		e.shiftKey &&
		e.altKey &&
		e.keyCode === 67
	) {
		toggleControls();
	}
}, false);