NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name YouTube Video Speed & Seek Mouse Control // @namespace YPSSMC // @version 1.1 // @description Dynamically adjust video playback speed & seeking instantly with your mousewheel, no more need to go through player menus every time. // @run-at document-start // @include http://www.youtube.com/* // @include https://www.youtube.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @require https://greasyfork.org/scripts/12284-jquery-mousewheel-3-1-13/code/jQuery%20Mousewheel%203113.js // @author drhouse // ==/UserScript== $(document).ready(function () { var speed = (1.00).toFixed(2); var isShift = false; var isAlt = false; var ytplayer = document.getElementById("movie_player"); $(ytplayer).prepend('<div id="rate">' + speed +' </div>'); $("#rate").css("z-index","999"); $("#rate").css('position', 'absolute'); $("#rate").css('top', '0'); $("#rate").css('right', '0'); function getPlaybackRate() { var v = $('.video-stream')[0]; return v.playbackRate; } function setPlaybackRate(r) { var v = $('.video-stream')[0]; if (v === undefined || v.playbackRate === undefined) { setTimeout(function(){setPlaybackRate(r);}, 1000); return; } v.playbackRate = r; } $(window.document).mousewheel(function(e) { //Seek | Shift+WheelUp/Down if (e.shiftKey) { if (e.deltaX<0) { var ytplayer = document.getElementById("movie_player"); var time = ytplayer.getCurrentTime(); ytplayer.seekTo(time+5, true); } else { var ytplayer = document.getElementById("movie_player"); var time = ytplayer.getCurrentTime(); ytplayer.seekTo(time-5, true); } e.preventDefault(); } //Speed | Alt+WheelUp/Down if (e.altKey) { var step = 0.25; if (e.deltaY<0) { var speed = Math.max(0.0,(getPlaybackRate()-step).toFixed(2)); setPlaybackRate(speed); } else { var speed = Math.min(8,(getPlaybackRate()+step).toFixed(2)); setPlaybackRate(speed); } e.preventDefault(); $("#rate").remove(); speed = speed.toFixed(2); $(ytplayer).prepend('<div id="rate">' + speed +' </div>'); $("#rate").css("z-index","999"); $("#rate").css('position', 'absolute'); $("#rate").css('top', '0'); $("#rate").css('right', '0'); } }); })