Autoscroll page

Snippet to auto-scroll a page but 1 line every 3s. Used for reading on Project Gutenberg.

javascript:(function() {

var scrollEvery = 3 // seconds
var scrollByPx = 16 // 16px one row or so

var a;
function autoscroll() {
  a = window.setTimeout(scrollOneRow, scrollEvery * 1000);
}

function scrollOneRow() {
  window.scrollBy(0, scrollByPx);
  autoscroll();
}

function stopAutoscroll() {
  clearTimeout(a);
}

autoscroll()

})();