WebM auto next

WebM autoplay next media tool

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

Advertisement:

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.

(I already have a user style manager, let me install it!)

Advertisement:

// ==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...
})();