Created
July 23, 2021 16:33
-
-
Save bessangel/156198b3817ce28883c235b1c109f024 to your computer and use it in GitHub Desktop.
html5 video rateX (by Tampermonkey )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name video rateX | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description vdeio rateX | |
// @author You | |
// @match https://*/* | |
// @match http://*/* | |
// @match https://*.youtube.com/watch?v=* | |
// @match https://*.instagram.com/* | |
// @match https://*.facebook.com/* | |
// @grant none | |
// ==/UserScript== | |
/* | |
Press Alt+5 to increase playbackRate and Alt+4 to decrease | |
*/ | |
(function() { | |
'use strict'; | |
setTimeout(()=>{ | |
document.addEventListener('keydown', (e)=>{ | |
if( e.altKey & (e.key == '5' || e.key == '4') ){ | |
document.querySelectorAll('video').forEach( o=>{ | |
o.playbackRate=o.playbackRate +(e.key == '5' ?0.5: -0.5); | |
console.log('Up speed:'+o); | |
document.body.insertAdjacentHTML('beforeend','<h1 id="_newRate" style="position:absolute; top:100px;left:200px; background-color:green;color:white;padding:1em;">x ' + o.playbackRate + '</h1>'); | |
setTimeout( ()=>{ document.getElementById('_newRate').remove() }, 3000 ); | |
} ); | |
} | |
}); | |
}, 2000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment