- Download tampermonkey in you brower
- now click on tamper monkey icon
- and select
create new script - and when a code editor opens up paste the code
Last active
May 24, 2024 14:51
-
-
Save leyuskckiran1510/30f2d1a70c8d4f275c56699da5ae7a8d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Speeder | |
| // @namespace randomnamespaceforusers | |
| // @version 2024-05-22 | |
| // @description control video playback in any site | |
| // @author leyuskc | |
| // @match *://*/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| let key_pressed = (key)=>{ | |
| if (key=="S"){ | |
| document.querySelectorAll("video").forEach(x => {if (!x.paused) {x.playbackRate += 0.25}}) | |
| }; | |
| if (key=="A"){ | |
| document.querySelectorAll("video").forEach(x => {if (!x.paused) {x.playbackRate -= 0.25}}) | |
| }; | |
| if (key=="Z"){ | |
| document.querySelectorAll("video").forEach(x => {if (!x.paused) {x.currentTime-=5}}) | |
| }; | |
| if (key=="C"){ | |
| document.querySelectorAll("video").forEach(x => {if (!x.paused) {x.currentTime+=5}}) | |
| }; | |
| if (key=="Q"){ | |
| document.querySelectorAll("video").forEach(x => {if (!x.paused) {x.pause()}else{x.play();}}) | |
| }; | |
| if (key=="D"){ | |
| document.querySelectorAll("video").forEach(x => {x.muted=!x.muted}) | |
| }; | |
| }; | |
| document.addEventListener('keyup', function(event) { | |
| if ('input' === document.activeElement.tagName.toLowerCase()) { | |
| return; | |
| } | |
| key_pressed(event.key); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment