Last active
December 10, 2024 12:31
-
-
Save angelcgar/40a3ac4249027021005b9ea840ced7c8 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 Udemy Video Pause with K | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Control Udemy videos with the K key instead of space. | |
// @author Ángel | |
// @match https://www.udemy.com/* | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
document.addEventListener('keydown', function (event) { | |
if (event.key === 'k') { // Detect the key 'K' | |
const video = document.querySelector('video'); // Search for the video element | |
if (video) { | |
video.paused ? video.play() : video.pause(); // Pause or play the video | |
} | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment