Netflix: Click to Play/Pause

Play/Pause when clicking the video.

As of 2017-09-19. See the latest version.

// ==UserScript==
// @name         Netflix: Click to Play/Pause
// @description  Play/Pause when clicking the video.
// @author       Zren
// @icon         https://assets.nflxext.com/us/ffe/siteui/common/icons/nficon2015.ico
// @namespace    http://github.com/Zren
// @version      4
// @match        https://www.netflix.com/*
// @grant        none
// ==/UserScript==

window.addEventListener('click', function(e) {
    console.log('click', e.target)
	if (e.target.matches('.nf-player-container *')
        && !e.target.matches('.PlayerControls--main-controls *')
        && document.querySelector('video').offsetWidth >= window.innerWidth // Don't pause when when returning to credits at the postplay screen.
    ) {
        var button = document.querySelector('.button-nfplayerPause') || document.querySelector('.button-nfplayerPlay')
		button.click()
	}
})