]> git.r.bdr.sh - rbdr/blog/blobdiff - static/js/blog.js
🐛✨📝 Add quick access, favicons and fix publish cmd
[rbdr/blog] / static / js / blog.js
diff --git a/static/js/blog.js b/static/js/blog.js
new file mode 100644 (file)
index 0000000..a49a72f
--- /dev/null
@@ -0,0 +1,28 @@
+'use strict';
+
+/* globals window */
+
+((window) => {
+
+  const internals = {
+    kEntryPoint: '.event-details',
+
+    // Application entry point, for now just band to keyboard
+
+    main() {
+
+      window.document.addEventListener('keydown', internals._onKeyDown);
+    },
+
+    // Handles key events to point to the correct blog post.
+
+    _onKeyDown(event) {
+
+      if (['1','2','3'].indexOf(event.key) > -1) {
+        window.location.hash = event.key;
+      }
+    }
+  };
+
+  window.addEventListener('load', internals.main);
+})(window);