keys: load page hash as initial mode
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 18 Jun 2017 07:53:27 +0000 (09:53 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Jul 2017 15:13:43 +0000 (17:13 +0200)
Support #modeX links to preselect custom mode.

keys.js

diff --git a/keys.js b/keys.js
index 5dc2e2d..dba04a1 100644 (file)
--- a/keys.js
+++ b/keys.js
@@ -17,6 +17,10 @@ function setmode(classname) {
        }
 }
 
+if (location.hash) {
+       setmode(location.hash.slice(1));
+}
+
 var keyfocus = undefined;
 document.onkeypress = function(e) {
        var keylabels = document.getElementById('rows').getElementsByTagName('B');