Netflix: Click to Play/Pause

Play/Pause when clicking the video.

  1. // ==UserScript==
  2. // @name Netflix: Click to Play/Pause
  3. // @description Play/Pause when clicking the video.
  4. // @author Zren
  5. // @icon https://assets.nflxext.com/us/ffe/siteui/common/icons/nficon2015.ico
  6. // @namespace http://github.com/Zren
  7. // @version 5
  8. // @match https://www.netflix.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. window.addEventListener('click', function(e) {
  13. console.log('click', e.target)
  14. if (e.target.matches('.nf-player-container *')
  15. && !e.target.matches('.PlayerControls--main-controls *')
  16. && !e.target.matches('.skip-credits *')
  17. && document.querySelector('video').offsetWidth >= window.innerWidth // Don't pause when when returning to credits at the postplay screen.
  18. ) {
  19. var button = document.querySelector('.button-nfplayerPause') || document.querySelector('.button-nfplayerPlay')
  20. button.click()
  21. }
  22. })