aboutsummaryrefslogtreecommitdiff
path: root/static/js/blog.js
blob: 68c13dacbeb1d35be9f94884a2f3d4ce9d492f75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';

/* globals window */

((w) => {

  const internals = {
    // Application entry point, for now just band to keyboard

    main() {

      w.document.addEventListener('keydown', internals._onKeyDown);
    },

    // Handles key events to point to the correct blog post.

    _onKeyDown(e) {

      if (['1','2','3'].indexOf(e.key) > -1) {
        w.location.hash = e.key;
      }
    }
  };

  w.addEventListener('load', internals.main);
})(window);