ElektroSpeedUp

try to take over the world!

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         ElektroSpeedUp
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       You
// @include        https://elearning.uni-obuda.hu/main/mod/eduplayer/*
// @include        https://elearning.uni-obuda.hu/main/mod/resource/view.php*
// @grant        none
// ==/UserScript==



(function() {
    'use strict';

    window.addEventListener('load', function() {

        function getElements(attrib) {
            return document.querySelectorAll('[' + attrib + ']')[0];
        }

        function round(value, precision) {
            var multiplier = Math.pow(10, precision || 0);
            return Math.round(value * multiplier) / multiplier;
        }

        var myInstOfPlayer = getElements('role="main"');

        var spdUpBtn = document.createElement("BUTTON");
        spdUpBtn.innerHTML = 'Elalszom';
        var spdDownBtn = document.createElement("BUTTON");
        spdDownBtn.innerHTML = 'Hóó Hóó';

        var dipsTxt = document.createElement("P");

        spdUpBtn.addEventListener("click", function(){
             document.querySelector('video').playbackRate += 0.2;
             dipsTxt.innerHTML =  round(document.querySelector('video').playbackRate,2);
        });

        spdDownBtn.addEventListener("click", function(){
             document.querySelector('video').playbackRate -= 0.2;
             dipsTxt.innerHTML = round(document.querySelector('video').playbackRate,2);
        });

        myInstOfPlayer.parentNode.insertBefore(spdUpBtn, myInstOfPlayer.nextSibling);
        myInstOfPlayer.parentNode.insertBefore(spdDownBtn, myInstOfPlayer.nextSibling);
        myInstOfPlayer.parentNode.insertBefore(dipsTxt, myInstOfPlayer.nextSibling);
        dipsTxt.innerHTML = "1";


    }, false);

})();