Fixed names

This commit is contained in:
stab.ing
2026-05-18 03:01:01 -05:00
parent ace5d4546f
commit 71221d8f06
2 changed files with 0 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
// ==UserScript==
// @name No youtube numpad
// @match https://www.youtube.com/watch*
// @author Stabosa87
// @grant none
// ==/UserScript==
(function () {
'use strict';
const keyset = new Set([
'Digit0','Digit1','Digit2','Digit3','Digit4',
'Digit5','Digit6','Digit7','Digit8','Digit9',
'Numpad0','Numpad1','Numpad2','Numpad3','Numpad4',
'Numpad5','Numpad6','Numpad7','Numpad8','Numpad9'
]);
function typing(el) {
if (!el) return false;
const tag = el.tagName;
if (tag === 'INPUT' || tag === 'TEXTAREA') return true;
if (el.isContentEditable) return true;
return false;
}
function handler(e) {
if (!keyset.has(e.code)) return;
if (typing(document.activeElement)) return;
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
}
document.addEventListener('keydown', handler, true);
})();