MCPcopy
hub / github.com/MALSync/MALSync / keyEvent

Function keyEvent

src/utils/player.ts:271–296  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

269 document.addEventListener('keyup', keyEvent);
270
271 function keyEvent(e) {
272
273 e = e || event;
274 const key = e.which || e.keyCode;
275 keyMap[key] = e.type === 'keydown';
276
277 for (let i = 0; i < shortcutOptions.length; i++) {
278 const option = shortcutOptions[i];
279 if (checkShortcut(option)) {
280 if (
281 e.target instanceof Node &&
282 (/textarea|input|select/i.test(e.target.nodeName) || (e.target instanceof Element && (e.target.shadowRoot || e.target.isContentEditable)))
283 ) {
284 con.info('Input field. Shortcut suppressed.');
285 } else {
286 shortcutDetected(option);
287 }
288 }
289 }
290
291 function shortcutDetected(option) {
292 keyMap = {};
293 callback({ shortcut: option });
294 return false;
295 }
296 };
297
298 window.addEventListener(
299 'focus',

Callers

nothing calls this directly

Calls 3

checkShortcutFunction · 0.85
shortcutDetectedFunction · 0.85
infoMethod · 0.45

Tested by

no test coverage detected