Faster Media

Set Youtube & Overcast PlaybackRate to 1.6 by default

Stan na 15-06-2017. Zobacz najnowsza wersja.

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         Faster Media
// @namespace    http://tampermonkey.net/
// @version      0.2.8
// @description  Set Youtube & Overcast PlaybackRate to 1.6 by default
// @author       Decradish
// @match        *www.youtube.com/watch?v=*
// @match        *overcast.fm/+*
// @match        *v.youku.com/v_show/id_*
// @grant        none
// ==/UserScript==

(function() {
	'use strict';

	var iPlaybackRate = 1.6, //rate
		tmVideo = document.getElementsByTagName("video")[0],
		tmAudio = document.getElementsByTagName("audio")[0],
		tmMedia = false;

	if(!!tmVideo){
		tmMedia = tmVideo;
		var youTubePlayBtn = document.getElementsByClassName('ytp-play-button')

		if(youTubePlayBtn.length > 0){
			document.getElementsByClassName('ytp-play-button')[0].focus()
		}
	}

	if(!!tmAudio){
		tmMedia = tmAudio;

		document.onkeydown = function(e) {
			var keyCode = e.keyCode || e.which || e.charCode;

			if(keyCode == 32) {
				tmMedia.paused ? tmMedia.play() : tmMedia.pause();
				e.preventDefault();
				return false;
			}
		}
	}

	if(!tmMedia){
		return false;
	}

	tmMedia.playbackRate = iPlaybackRate;

	tmMedia.onplay = function(){
		tmMedia.playbackRate = iPlaybackRate;
	};

	tmMedia.oncanplay = function(){
		tmMedia.playbackRate = iPlaybackRate;
	};
})();