From 4111a1a05716cd0afc816d0c35827136df29d1c8 Mon Sep 17 00:00:00 2001 From: Rob Colbert Date: Wed, 22 Jan 2025 19:56:03 -0500 Subject: [PATCH] Project created --- README.md | 7 +++++++ web-scroller.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 README.md create mode 100644 web-scroller.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..6bc48e5 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# 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. + +## 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.) \ No newline at end of file diff --git a/web-scroller.js b/web-scroller.js new file mode 100644 index 0000000..b05ef49 --- /dev/null +++ b/web-scroller.js @@ -0,0 +1,34 @@ +'use strict'; + +(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 + + var y = topMargin; + var paused = false; + + function update ( ) { + try { + if (!paused) { + window.scrollTo(0, y); + y += scrollSpeed; + } + if (y < height) { + window.requestAnimationFrame(update); + } + } catch (error) { + console.log('update has failed', error); + } + } + + try { + window.scrollTo(0, y); + window.setTimeout(update, startDelayMs); + } catch (error) { + console.log('scroller has failed', error); + } + +})();