DecentM / Reddit infinite autoload

// ==UserScript==
// @name         Reddit infinite autoload
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Makes RES infinite Reddit load a screen's worth of content
// @author       DecentM
// @include      *reddit.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

((window, document, undefined) => {
  'use strict';

  window.addEventListener('neverEndingLoad', () => {
    const bounding = document.getElementById('progressIndicator').getBoundingClientRect();
    const inViewport =
      bounding.top >= 0 &&
	  bounding.left >= 0 &&
	  bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
	  bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight);

    if (inViewport) {
      window.dispatchEvent(new Event('scroll'));
    }
  });
})(window, window.document);