WebM auto next

WebM autoplay next media tool

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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