Browse Source

program controls & docs

develop
Rob Colbert 3 months ago
parent
commit
a26b4732a2
  1. 24
      README.md
  2. 18
      web-scroller.js

24
README.md

@ -1,7 +1,25 @@
# web-scroller
A utility program written in JavaScript to scroll a web page with infinity scroll capability (social media). When you start the program, it begins scrolling the current page, and will continue scrolling as additional content is loaded. It does not stop until it hits the configured limit or the page has legitimately reached its end.
A utility program written in JavaScript to scroll a web page with infinity scroll capability (social media). When you start the program, it begins scrolling the current page, and will continue scrolling as additional content is loaded.
## Running the Program
The scroller doesn't stop until it hits the configured limit or the page has legitimately reached its end.
Just copy the text of the [web-scroller.js](web-scroller.js) file into your browser's console and press ENTER. The script does not communicate with any network resources at all. It simply scrolls the current page with providions for the page to dynamically grow (infinity scroll, social media, blogs, etc.)
## Running The Program
Just copy the text of the [web-scroller.js](web-scroller.js) file into your browser's console and press ENTER. The script does not communicate with any network resources at all. It simply scrolls the current page with providions for the page to dynamically grow (infinity scroll, social media, blogs, etc.)
## Controlling The Program
The following control variables are offered by the program.
### TOP_MARGIN
Specifies the number of pixels to use as a top margin when scrolling begins.
### SCROLL_SPEED
Specifies the number of pixels moved by the scroller per frame.
### START_DELAY_MS
Specifies a number of milliseconds to wait at the margin before scrolling begins. Useful for startup delays that give you time to hit "record" before scrolling begins.
### HEIGHT
The maximum height of the document.

18
web-scroller.js

@ -2,21 +2,21 @@
(async ( ) => {
var topMargin = 0; // set to top margin you want for the page scroller
var scrollSpeed = 2; // number of pixels to scroll per frame
var startDelayMs = 0; // set startup delay in milliseconds
var height = 200000; // set to max distance you want to scroll
const TOP_MARGIN = 0; // set to top margin you want for the page scroller
const SCROLL_SPEED = 2; // number of pixels to scroll per frame
const START_DELAY_MS = 0; // set startup delay in milliseconds
const HEIGHT = 200000; // set to max distance you want to scroll
var y = topMargin;
var paused = false;
let y = TOP_MARGIN;
let paused = false;
function update ( ) {
try {
if (!paused) {
window.scrollTo(0, y);
y += scrollSpeed;
y += SCROLL_SPEED;
}
if (y < height) {
if (y < HEIGHT) {
window.requestAnimationFrame(update);
}
} catch (error) {
@ -26,7 +26,7 @@
try {
window.scrollTo(0, y);
window.setTimeout(update, startDelayMs);
window.setTimeout(update, START_DELAY_MS);
} catch (error) {
console.log('scroller has failed', error);
}

Loading…
Cancel
Save