Greasy Fork is available in English.

JWPlayer Enhancer

Auto plays JWPlayer Enhancer

Versión del día 30/4/2022. Echa un vistazo a la versión más reciente.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         JWPlayer Enhancer
// @namespace    JWPlayerEnhancer
// @version      2
// @description  Auto plays JWPlayer Enhancer
// @author       hacker09
// @include      *
// @icon         https://www.jwplayer.com/hubfs/JW_Player_August2021/Images/favicon-152.png
// @run-at       document-end
// @grant        unsafeWindow
// ==/UserScript==

(function() {
  'use strict';
  window.onload = function() //When the page is loaded
  { //Starts the onload event listener
    var Container = unsafeWindow.jwplayer().getContainer(); //Store the jwplayer element container to a variable
    var Player = unsafeWindow.jwplayer(Container); //Store the Player element to a variable

    setTimeout(function() { //Starts the settimeout function

      function Visibility() //Create a function to check the tab visibility status
      { //Starts the function
        if (document.visibilityState === 'visible') { //If the tab is unfocused
          Player.play() //playerfullhdbeta //Plays the hd video
          Player.setFullscreen(); //Auto full screen the video
        } //Finishes the if condition
      } //Finishes the if function
      Visibility(); //Calls the function

      document.addEventListener("visibilitychange", function() { //When the tab is focused/unfocused
        //document.hasFocus = function(){return true};
        setTimeout(function() { //Starts the settimeout function
          Visibility(); //Calls the function
        }, 1000); //Finishes the settimeout function

        if (document.hidden) { //If the tab is unfocused
          Player.pause(); //Pause the video
        } //Finishes the if condition

      }, false); //Finishes the visibilitychange event listener
    }, 1500); //Finishes the settimeout function

    Player.on('complete', function() { //When the video ends
      Player.setFullscreen(false); //Leave video full screen mode
    }); //Finishes the oncomplete event listener

    Player.on('play', function() { //When the video is playing
      Player.setFullscreen(true); //Enter video full screen mode
    }); //Finishes the oncomplete event listener

    document.head.insertAdjacentHTML('beforeend', '<style>.jw-rightclick { display: none !important; }</style>'); //Hide the right click jwplayer video menu options

    document.getElementById(unsafeWindow.jwplayer().id).addEventListener('click', function(e) { //When the video is clicked
      setTimeout(function() { //Starts the settimeout function
        if (Player.getState() === 'paused') //If the video is paused
        { //Starts the if condition
          Player.setFullscreen(false); //Leave video full screen mode
        } //Finishes the if condition
      }, 500); //Finishes the settimeout function
    }); //Finishes the on click event listener

    document.getElementById(unsafeWindow.jwplayer().id).addEventListener('contextmenu', function(e) { //When the video is right clicked
      if (Player.getPosition() > 1080) //If 18 or more minutes was watched. (skip ending and next episode preview)
      { //Starts the if condition
        Player.setFullscreen(false); //Leave video full screen mode
      } //Finishes the else condition
      else //If less than 18 minutes was watched (skip the oppening)
      { //Starts the if condition
        Player.seek(Player.getPosition() + 85); //Seek 1:25 secs foward
      } //Finishes the else condition
    }); //Finishes the context menu event listener
  } //Finishes the onload event listener

})();