client/general: scroll to top on page change

This commit is contained in:
rr- 2016-05-08 18:56:08 +02:00
parent 906eddc61f
commit f083e5fdc8

View file

@ -3,6 +3,12 @@
require('./util/polyfill.js');
const page = require('page');
const origPushState = page.Context.prototype.pushState;
page.Context.prototype.pushState = function() {
window.scrollTo(0, 0);
origPushState.call(this);
};
const mousetrap = require('mousetrap');
page(/.*/, (ctx, next) => {
mousetrap.reset();