IPLA Enhanced

Script adds seek buttons (-5 sec and +5 sec) to IPLA Player.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           IPLA Enhanced
// @name:pl        Ulepszenia dla odtwarzania wideo na stronie IPLA.pl
// @namespace      http://tampermonkey.net/
// @version        0.1
// @description    Script adds seek buttons (-5 sec and +5 sec) to IPLA Player.
// @description:pl Skrypt dodaje przyciski przesuwania (-5 sekund i +5 sekund) do odtwarzacza IPLA.
// @author         DaveIT
// @match          https://www.ipla.tv/wideo/*
// @grant          none
// ==/UserScript==

(function() {
    'use strict';
    
    var settings = {
        seekBackwardTime: -5,
        seekForwardTime: 5
    }

    var interval = setInterval(waitForThePlayer, 1000);
    var video = null;

    function rewind(value) {
        video.currentTime = video.currentTime + value;
    }

    function waitForThePlayer() {
        var player = document.querySelector('.cpp2-row.row--3VLMJ.cpp2-buttons-row.buttons-row--aC_iv.cpp2-secondary-buttons.secondary-buttons--2jm-H');
        video = document.querySelector('video');
        console.log('Testuję...');

        if(player != null && video != null) {
            clearInterval(interval);

            var backward = document.createElement('div');
            backward.className = "cpp2-button button--3M_f2 cpp2-round-button round-button--2322C cpp2-play-button play-button--H-iUJ";
            backward.onclick = function() { rewind(settings.seekBackwardTime) };
            backward.style = "transform: rotate(180deg)";

            var forward = document.createElement('div');
            forward.className = "cpp2-button button--3M_f2 cpp2-round-button round-button--2322C cpp2-play-button play-button--H-iUJ";
            forward.onclick = function() { rewind(settings.seekForwardTime) };

            var container = document.querySelector('.cpp2-row.row--3VLMJ.cpp2-buttons-row.buttons-row--aC_iv.cpp2-secondary-buttons.secondary-buttons--2jm-H');

            var soundButton = document.querySelector('.cpp2-button.button--3M_f2.cpp2-round-button.round-button--2322C.cpp2-sound-button.sound-button--9VX8M.cpp2-high.high--1SLE2');

            container.insertBefore(backward, soundButton);
            container.insertBefore(forward, soundButton);
        }
    }
})();