Greasy Fork is available in English.

JWPlayer Enhancer

Improves binge watch experiences on any JWPlayer videos online.

Installer dette scriptet?
Skaperens foreslåtte skript

Du vil kanskje også like Precise Time Converter on Google.

Installer dette scriptet
  1. // ==UserScript==
  2. // @name JWPlayer Enhancer
  3. // @namespace https://greatest.deepsurf.us/en/users/670188-hacker09?sort=daily_installs
  4. // @version 3
  5. // @description Improves binge watch experiences on any JWPlayer videos online.
  6. // @author hacker09
  7. // @include *
  8. // @icon https://www.jwplayer.com/hubfs/JW_Player_August2021/Images/favicon-152.png
  9. // @run-at document-end
  10. // @grant unsafeWindow
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. window.onload = setTimeout(function() { //When the page is loaded
  16. if (document.querySelector('.jw-media') !== null) //If the N key was pressed (skip end and next ep preview)
  17. { //Starts the if condition
  18. var next; //Creates a new global variable
  19. const Player = unsafeWindow.jwplayer(unsafeWindow.jwplayer().getContainer()); //Store the Player element to a variable
  20.  
  21. setTimeout(function() { //Starts the settimeout function
  22.  
  23. function Visibility() //Create a function to check the tab visibility status
  24. { //Starts the function
  25. if (document.visibilityState === 'visible') { //If the tab is unfocused
  26. Player.play(); //Plays the video
  27. Player.setFullscreen(true); //Auto full screen the video
  28. } //Finishes the if condition
  29. } //Finishes the if function
  30. Visibility(); //Calls the function
  31.  
  32. document.addEventListener("visibilitychange", function() { //When the tab is focused/unfocused
  33. setTimeout(function() { //Starts the settimeout function
  34. Visibility(); //Calls the function
  35. }, 1000); //Finishes the settimeout function
  36.  
  37. if (document.hidden) { //If the tab is unfocused
  38. Player.pause(); //Pause the video
  39. } //Finishes the if condition
  40.  
  41. }, false); //Finishes the visibilitychange event listener
  42. }, 500); //Finishes the settimeout function
  43.  
  44. Player.on('complete', function() { //When the video ends
  45. Player.setFullscreen(false); //Leave video full screen mode
  46. }); //Finishes the oncomplete event listener
  47.  
  48. Player.on('pause', function() { //When the video is pause
  49. Player.setFullscreen(false); //Leave video full screen mode
  50. }); //Finishes the oncomplete event listener
  51.  
  52. document.head.insertAdjacentHTML('beforeend', '<style>.jw-rightclick { display: none !important; }</style>'); //Hide the right click jwplayer video menu options
  53.  
  54. document.getElementById(unsafeWindow.jwplayer().id).addEventListener('click', function(e) { //When the video is clicked
  55. setTimeout(function() { //Starts the settimeout function
  56. if (Player.getState() === 'paused') //If the video is paused
  57. { //Starts the if condition
  58. Player.setFullscreen(false); //Leave video full screen mode
  59. } //Finishes the if condition
  60. else //If the video is playing
  61. { //Starts the else condition
  62. Player.setFullscreen(true); //Enters video full screen mode
  63. } //Finishes the else condition
  64. }, 500); //Finishes the settimeout function
  65. }); //Finishes the on click event listener
  66.  
  67. document.addEventListener("keydown", e => { //Listen for keypresses
  68. if (e.key === 'n') //If the N key was pressed (skip end and next ep preview)
  69. { //Starts the if condition
  70. Player.setFullscreen(false); //Leave video full screen mode
  71. if (location.href.match('mateus7g') !== null) //If the N key was pressed (skip end and next ep preview)
  72. { //Starts the if condition
  73. console.log("key N 2 pressed");
  74. //next.click();
  75. Player.next(); //Jump to next ep
  76. //window.querySelector(".collection-carousel-media-link-current").parentElement.nextElementSibling.querySelector("div > div > div > a").click(); //Jump to next ep
  77. } //Finishes the else condition
  78. } //Finishes the else condition
  79. if (e.key === 'l') //If the L key was pressed (skip the opening)
  80. { //Starts the if condition
  81. Player.seek(Player.getPosition() + 85); //Seek 1:25 secs foward
  82. } //Finishes the else condition
  83. }); //Finishes the keydown event listener
  84. } //Finishes the if condition
  85. }, 1500); //Finishes the onload event listener
  86. })();