2 changed files with 41 additions and 0 deletions
@ -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.) |
@ -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); |
|||
} |
|||
|
|||
})(); |
Loading…
Reference in new issue