キーボードショートカットを追加するUserScript
hr.icon
hr.icon
実装
code:script.js
(() => {
const aliases = {
KeyA: '',
KeyB: '👍',
KeyC: '',
KeyD: '',
KeyE: '',
KeyF: '',
KeyG: '',
KeyH: 'hr.icon',
KeyI: '',
KeyJ: '',
KeyK: '',
KeyL: '',
KeyM: '',
KeyN: '🙇',
KeyO: '🙇',
KeyP: '',
KeyQ: '',
KeyR: '',
KeyS: '',
KeyT: '',
KeyU: 'ユニティちゃん.icon',
KeyV: '✅',
KeyW: '',
KeyX: '❌',
KeyY: '',
KeyZ: '',
Digit1: '',
Digit2: '',
Digit3: '',
Digit4: '',
Digit5: '',
Digit6: '',
Digit7: '',
Digit8: '',
Digit9: '',
Digit0: '',
Slash: '',
Backslash: '',
Period: '.icon',
BracketLeft: '',
BracketRight: '',
Comma: '',
Equal: '',
Minus: '',
Quote: '',
Backquote: '',
Semicolon: '',
Enter: '',
Space: '',
MetaRight: '',
MetaLeft: '',
AltRight: '',
AltLeft: '',
ControlRight: '',
ControlLeft: '',
Tab: '',
}
const onKeyDown = function (e) {
if (e.altKey) {
const cursor = document.getElementById('text-input');
if (name) {
e.preventDefault();
cursor.focus();
document.execCommand('insertText', null, ${name});
}
}
}
document.addEventListener('keydown', onKeyDown);
})()