Skip to content

Instantly share code, notes, and snippets.

@dariusf
Last active October 9, 2023 10:05
Show Gist options
  • Save dariusf/c790925f5381eafc50be032da37916f3 to your computer and use it in GitHub Desktop.
Save dariusf/c790925f5381eafc50be032da37916f3 to your computer and use it in GitHub Desktop.
Softmark workflow hacks
// Keybindings for compound rubrics
document.onkeypress = function(e) {
if (e.key === 'n') {
setTimeout(() => {
// both events have to be sent
document.dispatchEvent(new KeyboardEvent('keydown', {'key': 'j'}));
document.dispatchEvent(new KeyboardEvent('keyup', {'key': 'j'}));
setTimeout(() => {
document.dispatchEvent(new KeyboardEvent('keydown', {'key': 'k'}));
document.dispatchEvent(new KeyboardEvent('keyup', {'key': 'k'}));
setTimeout(() => {
document.dispatchEvent(new KeyboardEvent('keydown', {'key': 'l'}));
document.dispatchEvent(new KeyboardEvent('keyup', {'key': 'l'}));
}, 300); // slow enough that events don't disappear and the text doesn't overlap
}, 300);
}, 300);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment