CSC Autoscroll

Automatically scroll on cocksizecontest main page

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        CSC Autoscroll
// @description Automatically scroll on cocksizecontest main page
// @namespace   cocksizecontest.com
// @include     https://www.cocksizecontest.com/
// @include     https://www.cocksizecontest.com/#*
// @version     1
// @grant       none
// ==/UserScript==

var autoscrollTimeout = null;

window.addEventListener('scroll', function() {
  if (autoscrollTimeout) {
    clearTimeout(autoscrollTimeout);
  }
  autoscrollTimeout = window.setTimeout(function() {

    // window.scrollTop + window.innerHeight == lowest pixel viewable
    // subtract document.height to get how much is left below the page
    //console.log("scrollTop: " + window.scrollY);
    //console.log("innerHeight: " + window.innerHeight);
    //console.log("height: " + document.body.scrollHeight);
    if (document.body.scrollHeight < 500) {
      return;
    }
    var remaining = document.body.scrollHeight - (window.scrollY + window.innerHeight);
    if (remaining < 500) {
      var link = document.querySelector('.cscMoreFeedLink > a[href]');
      if (link) {
        link.click();
      }
    }
    
  }, 300);
});