Greasy Fork is available in English.

KissAnime player speed

Adds buttons to change the player speed on KissAnime

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ć!)

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ć!)

// ==UserScript==
// @name        KissAnime player speed
// @description   Adds buttons to change the player speed on KissAnime
// @match       *://*.kissanime.ru/Anime/*/*
// @grant       none
// @version     1.1
// @author      henrik9999
// @run-at      document-idle
// @namespace https://greasyfork.org/users/412318
// ==/UserScript==

var node = document.createElement('style');
node.innerHTML = '#speedchanger {float:left; margin-top:5px} #speedchanger > button.active {background-color:grey}'
document.body.appendChild(node);

document.querySelector("#divQuality").parentElement.parentElement.innerHTML += "<span id='speedchanger'><button class='speed'>0.25</button><button class='speed'>0.5</button><button class='speed active'>1</button><button class='speed'>1.5</button><button class='speed'>2</button></span>";

var buttons = document.querySelectorAll('#speedchanger > button.speed');
for (var i = 0; i < buttons.length; i++) {
    addBtnListener(buttons[i]);
}

function addBtnListener(self) {
    self.addEventListener('click', function (event) {
        setSpeed(self.textContent);
    }, false);
}

function setButtonActive(speed) {
    document.querySelector("span#speedchanger > button.active").classList.remove('active');
    var buttons = document.querySelectorAll("#speedchanger > button.speed");
    buttons.forEach(function(el) {
        if (el.textContent === speed) {
            el.classList.add('active')
        }
    });
}

function setSpeed(speed) {
    setButtonActive(speed);
    var player = document.querySelector("#divMyVideo").getElementsByTagName("video")[0];
    player.playbackRate = speed;
    console.log("set speed to " + player.playbackRate);
}