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

  1. // ==UserScript==
  2. // @name Netflix - Hide skip buttons and post-play
  3. // @namespace https://zornco.com/
  4. // @version 1.0.0
  5. // @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
  6. // @author SystemDisc
  7. // @match http*://*.netflix.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. let headElem = document.querySelector('head');
  12. let styleElem = document.createElement('style');
  13. styleElem.type = 'text/css';
  14. styleElem.textContent = `
  15. .skip-credits,
  16. [aria-label="Watch credits"],
  17. [aria-label^="Next episode in"] {
  18. /*display: none !important;*/
  19. }
  20. .NFPlayer.postplay {
  21. top: 0 !important;
  22. left: 0 !important;
  23. right: 0 !important;
  24. bottom: 0 !important;
  25. width: 100% !important;
  26. height: 100% !important;
  27. border: none !important;
  28. outline: none !important;
  29. }
  30. `;
  31. headElem.appendChild(styleElem);
  32.  
  33. let playerElem;
  34. let getPlayer = function() {
  35. playerElem = document.querySelector('.NFPlayer');
  36. if (!playerElem) {
  37. requestAnimationFrame(getPlayer);
  38. }
  39. };
  40.  
  41. let controlsElem;
  42. let getControls = function() {
  43. controlsElem = document.querySelector('.controls');
  44. if (!controlsElem) {
  45. requestAnimationFrame(getControls);
  46. }
  47. };
  48.  
  49. let watchUntilEnd = function() {
  50. if (controlsElem) {
  51. let creditsButtonContainer = controlsElem.querySelector('.PlayerControls--container > .main-hitzone-element-container > .SeamlessControls--container');
  52. if (creditsButtonContainer) {
  53. let creditsButton = creditsButtonContainer.querySelector('[aria-label="Watch credits"]');
  54. if (creditsButton && creditsButtonContainer.classList.contains('SeamlessControls--container-visible')) {
  55. console.log('click');
  56. creditsButton.click();
  57. }
  58. }
  59. else if (playerElem.classList.contains('postplay')) {
  60. playerElem.click();
  61. }
  62. }
  63. setTimeout(getPlayer);
  64. setTimeout(getControls);
  65. setTimeout(watchUntilEnd, 1000);
  66. };
  67. watchUntilEnd();
  68.  
  69. let toggleControls = function() {
  70. controlsElem = document.querySelector('.controls');
  71. if (controlsElem) {
  72. if (controlsElem.style.display !== 'none') {
  73. controlsElem.style.display = 'none';
  74. }
  75. else if (controlsElem.style.display === 'none') {
  76. controlsElem.style.display = null;
  77. }
  78. }
  79. else {
  80. requestAnimationFrame(toggleControls);
  81. }
  82. };
  83.  
  84. document.addEventListener('keyup', function(e) {
  85. if (
  86. e.ctrlKey &&
  87. e.shiftKey &&
  88. e.altKey &&
  89. e.keyCode === 67
  90. ) {
  91. toggleControls();
  92. }
  93. }, false);