Last active
May 1, 2022 13:15
-
-
Save dkniffin/26514271160571386b3a17e55fbcdd77 to your computer and use it in GitHub Desktop.
Adds hotkeys for FamilySearch's Review Names tool (for the 1950 census)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const matchButton = document.querySelector("[data-testid='Match']").closest("button") | |
const editButton = document.querySelector("[data-testid='Edit']").closest("button") | |
const unsureButton = document.querySelector("[data-testid='Unsure']").closest("button") | |
const notAPersonButton = document.querySelector("[data-testid='Not A Person']").closest("button") | |
const transcriptionErrorButton = document.querySelector("[data-testid='Transcription Error']").closest("button") | |
document.addEventListener("keydown", (e) => { | |
const nameField = document.querySelector("input[name='nameField']") | |
if (nameField == document.activeElement) { return } | |
switch (e.code) { | |
case "KeyM": | |
e.preventDefault() | |
matchButton.click() | |
break | |
case "KeyE": | |
e.preventDefault() | |
editButton.click() | |
break | |
case "KeyU": | |
e.preventDefault() | |
unsureButton.click() | |
break | |
case "KeyN": | |
e.preventDefault() | |
notAPersonButton.click() | |
break | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTE: this is not quite working right. There's an issue with it when hitting enter to submit the edit. That doesn't seem to unfocus the field.
Clicking any of the hotkeys while not focused on the edit field will trigger the corresponding action
M = Match
E = Edit (focus on the name field; you can hit enter to go to the next line and unfocus the edit field)
U = Unsure
N = Not a Person