MCPcopy Create free account
hub / github.com/SoHeil-R/google-traffic-bot / scroll

Function scroll

libs/autobot.js:1–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1function scroll(){
2 return `
3 var scrollHeight = 0
4 var scrollDown = true
5 var scrollValue = 200
6 function random(min, max){
7 min = Math.ceil(min);
8 max = Math.floor(max);
9 return Math.floor(Math.random() * (max - min + 1) + min);
10 }
11 setInterval(() => {
12 var scrollLimit = document.body.offsetHeight - window.innerHeight;
13 if (scrollDown){
14 if (scrollHeight < scrollLimit)
15 scrollHeight += random(50, scrollValue);
16 else
17 scrollDown = false;
18 }else{
19 if (scrollHeight > 0)
20 scrollHeight -= random(50, scrollValue);
21 else
22 scrollDown = true;
23 }
24 window.scrollTo(0, (scrollHeight > scrollLimit ? scrollLimit : scrollHeight < 0 ? 0 : scrollHeight))
25 }, 1000)
26 `
27}
28
29module.exports = {
30 scroll: scroll

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected