Add key bindings for h, j, k, l, w, a, s, d
Committed 18914f
--- a/canopy/templates/template.html
+++ b/canopy/templates/template.html
enterTrigger.style.display = 'none'
initChat()
}
+
+ document.addEventListener('keydown', e => {
+ const keyCode = e.keyCode;
+ const em = parseFloat(getComputedStyle(document.documentElement).fontSize)
+ if (keyCode == 70) { // f
+ // TODO follow links
+ } else if (keyCode == 72) { // h
+ history.back()
+ } else if (keyCode == 74) { // j
+ document.documentElement.scrollTop += 3 * em
+ } else if (keyCode == 75) { // k
+ document.documentElement.scrollTop -= 3 * em
+ } else if (keyCode == 76) { // l
+ history.forward()
+ } else if (keyCode == 87) { // w
+ // move up (in room)
+ } else if (keyCode == 65) { // a
+ // move left (in room)
+ } else if (keyCode == 83) { // s
+ // move down (in room)
+ } else if (keyCode == 68) { // d
+ // move right (in room)
+ }
+ }, false)
}
</script>