正如@samathingamajig 所解决的那样,我刚刚将此脚本设置为键A
解释Left Arrow
,并D
解释Right Arrow
。
它最终在我的TamperMonkey
:
// MEDIA TO THE RIGHT - ASSIGNED TO *D* KEY
(() => {
window.addEventListener('keydown', (e) => {
if (e.key == 'd' && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
;
const keyboardEvent = new KeyboardEvent('keydown', {
key: 'ArrowRight',
keyCode: 39,
bubbles: true,
cancelable: true,
shiftKey: false,
ctrlKey: false,
altKey: false,
metaKey: false,
});
document.dispatchEvent(keyboardEvent);
}
});
})();
// MEDIA TO THE LEFT - ASSIGNED TO *A* KEY
(() => {
window.addEventListener('keydown', (e) => {
if (e.key == 'a' && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
;
const keyboardEvent = new KeyboardEvent('keydown', {
key: 'ArrowLeft',
keyCode: 39,
bubbles: true,
cancelable: true,
shiftKey: false,
ctrlKey: false,
altKey: false,
metaKey: false,
});
document.dispatchEvent(keyboardEvent);
}
});
})();