AmazonVideo Speed

Saves the set playback speed on Netflix

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         AmazonVideo Speed
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Saves the set playback speed on Netflix
// @author       Bobocato
// @match        https://www.amazon.de/*
// @match        https://www.amazon.com/*
// @match        https://www.amazon.co.uk/*
// @grant        none
// ==/UserScript==

function setEvents(video){
    //Safe Playback Rate
    video.onratechange = function() {
        var speedup = video.playbackRate - localStorage.getItem("playrate");
        if((Math.round(speedup *10)/10) == 0.1 ||(Math.round(speedup *10)/10) == -0.1 ){
            localStorage.setItem("playrate", video.playbackRate);
        }
    };

    //Set volume and playbackrate as soon as video starts playing
    video.onplaying = function() {
        if (localStorage.getItem("playrate") !== null){
            video.playbackRate = localStorage.getItem("playrate");
        }
    };
}

function setSettings(video){
    if (localStorage.getItem("playrate") !== null){
        video.playbackRate = localStorage.getItem("playrate");
    }
}

(function() {
    'use strict';
    setInterval(function(){
        var video = document.getElementsByTagName("video");
        for(var i = 0; i < video.length; i++){
            if(typeof(video[i]) != "undefined"){
                setEvents(video[i]);
                setSettings(video[i]);
            }
        }
    }, 2500);
})();