WebM auto next

WebM autoplay next media tool

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         WebM auto next
// @namespace    https://github.com/nyataraxis
// @version      0.1
// @description  WebM autoplay next media tool
// @author       [email protected]
// @match        https://*.2ch.hk/*
// @grant        none
// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// ==/UserScript==

(function() {
    'use strict';
    let keyUp = new KeyboardEvent('keyup', {keyCode: 39, which: 39, char: "'"});

let video;
let sleep = function(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
let counter = 0;
let listenToEvents = (elem) => {
    elem.loop = false;
    elem.addEventListener('ended', () => {
    console.log('twowo')});
    elem.onended = (elem) => {
        console.log('onended');
        window.dispatchEvent(keyUp);
        sleep(2000).then(()=>{getVideo()});
  }
}

let getVideo = () => {
  video = document.querySelector('video');
  if(video === null){
      sleep(2000).then(() => {getVideo()})} else {
      listenToEvents(video);
      };
};
window.addEventListener(
        "keyup",function(e){
    if (e.keyCode == 39 && e.which == 39) {
    sleep(2000).then(()=>{getVideo()});
    }
    })
    getVideo();  // Your code here...
})();