Skip to content

Instantly share code, notes, and snippets.

@angelcgar
Last active December 10, 2024 12:31
Show Gist options
  • Save angelcgar/40a3ac4249027021005b9ea840ced7c8 to your computer and use it in GitHub Desktop.
Save angelcgar/40a3ac4249027021005b9ea840ced7c8 to your computer and use it in GitHub Desktop.
// ==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