Skip to content

Instantly share code, notes, and snippets.

@dvygolov
Last active February 17, 2026 08:37
Show Gist options
  • Select an option

  • Save dvygolov/3194204bc06b355f063a2d0590f1a07a to your computer and use it in GitHub Desktop.

Select an option

Save dvygolov/3194204bc06b355f063a2d0590f1a07a to your computer and use it in GitHub Desktop.
This bookmarklet script scrolls Facebook Reels imitating live account benavior. By Сельский Арбитраж at https://t.me/c/1428671974/194
javascript:(function(){const old=document.getElementById("__neutralAutoScrollUI__");if(old)old.remove();const P='__fine_'+Math.random().toString(36).substr(2,6)+'_';let running=false,countdownTimer=null,_cachedScrollTarget=null,_cacheTimestamp=0;const CACHE_TTL=15000;let stats={scrolls:0,likes:0,likeFails:0,alreadyLiked:0,startTime:null};const LIKE_LABELS=['like','нравится','thích','me gusta',"j'aime",'gefällt mir','curtir','좋아요','いいね','أعجبني','beğen','suka','mi piace','tykkää','leuk','gilla','synes godt om','lubię to','подобається','лайк','patīk','patinka'];const randInt=(a,b)=>Math.floor(Math.random()*(b-a+1))+a;const clamp=(v,a,b)=>Math.max(a,Math.min(b,v));const $=id=>document.getElementById(P+id);function simulateRealClick(el){return new Promise(resolve=>{const r=el.getBoundingClientRect();const x=r.left+r.width*(0.3+Math.random()*0.4);const y=r.top+r.height*(0.3+Math.random()*0.4);const c={view:window,bubbles:true,cancelable:true,clientX:x,clientY:y,screenX:x+window.screenX,screenY:y+window.screenY};el.dispatchEvent(new PointerEvent('pointerover',{...c,pointerId:1,pointerType:'mouse',isPrimary:true}));el.dispatchEvent(new PointerEvent('pointerenter',{...c,pointerId:1,pointerType:'mouse',isPrimary:true}));el.dispatchEvent(new PointerEvent('pointerdown',{...c,button:0,buttons:1,pointerId:1,pointerType:'mouse',isPrimary:true}));setTimeout(()=>{el.dispatchEvent(new PointerEvent('pointerup',{...c,button:0,buttons:0,pointerId:1,pointerType:'mouse',isPrimary:true}));el.dispatchEvent(new MouseEvent('mousedown',{...c,button:0,buttons:1}));el.dispatchEvent(new MouseEvent('mouseup',{...c,button:0,buttons:0}));el.dispatchEvent(new MouseEvent('click',{...c,button:0,buttons:0}));el.dispatchEvent(new FocusEvent('focus',{bubbles:false}));el.dispatchEvent(new FocusEvent('focusin',{bubbles:true}));resolve()},randInt(50,170))})}function isAlreadyLiked(btn){if(btn.getAttribute('aria-pressed')==='true')return true;const t=btn.getAttribute('data-testid')||'';if(t.includes('unlike')||t.includes('liked'))return true;const svg=btn.querySelector('svg');if(svg){const paths=svg.querySelectorAll('path,circle');for(const p of paths){const f=p.getAttribute('fill')||'';if(f.match(/#(0866ff|1877f2|1b74e4|e4405f|ed4956|f02849|fe0234)/i))return true}}try{const co=getComputedStyle(btn).color;if(co==='rgb(8, 102, 255)'||co==='rgb(24, 119, 242)')return true}catch(e){}const l=(btn.getAttribute('aria-label')||'').toLowerCase();if(l.includes('unlike')||l.includes('remove')||l.includes('убрать'))return true;return false}function findLikeButton(){const cands=Array.from(document.querySelectorAll('[role="button"][aria-label],[aria-label][tabindex]'));const vH=window.innerHeight;const m=vH*0.05;const vis=cands.filter(el=>{const r=el.getBoundingClientRect();return r.height>0&&r.width>0&&r.top>m&&r.top<(vH-m)});return vis.find(btn=>{const label=(btn.getAttribute('aria-label')||'').toLowerCase().trim();const isLike=LIKE_LABELS.some(l=>label===l||label.startsWith(l));if(!isLike)return false;if(isAlreadyLiked(btn)){stats.alreadyLiked++;return false}return true})}function getScrollTarget(){const now=Date.now();if(_cachedScrollTarget&&(now-_cacheTimestamp)<CACHE_TTL&&document.contains(_cachedScrollTarget)&&_cachedScrollTarget.scrollHeight>_cachedScrollTarget.clientHeight)return _cachedScrollTarget;const sels=['[data-pagelet="Reels"] [style*="overflow"]','[data-pagelet] [style*="overflow"]','[role="main"] [style*="overflow"]','div[style*="overflow-y: auto"]','div[style*="overflow-y:auto"]','div[style*="overflow: auto"]'];let best=null;for(const s of sels){const els=document.querySelectorAll(s);for(const el of els){if(el.scrollHeight>el.clientHeight*1.2&&el.clientHeight>200&&el.getClientRects().length>0){if(!best||el.scrollHeight>best.scrollHeight)best=el}}if(best)break}if(!best){const fb=document.querySelectorAll('div,main,section');const lim=Math.min(fb.length,500);for(let i=0;i<lim;i++){try{const st=getComputedStyle(fb[i]);if((st.overflowY==='auto'||st.overflowY==='scroll')&&fb[i].scrollHeight>fb[i].clientHeight*1.3&&fb[i].clientHeight>300){if(!best||fb[i].clientHeight>best.clientHeight)best=fb[i]}}catch(e){}}}_cachedScrollTarget=best||document.documentElement;_cacheTimestamp=now;return _cachedScrollTarget}function doScroll(){const t=getScrollTarget();const s=$('smooth').checked;t.scrollBy({top:window.innerHeight+randInt(-20,20),left:0,behavior:s?'smooth':'auto'});stats.scrolls++;updateStatsUI()}function startNextCycle(){if(!running)return;let minS=parseInt($('minS').value)||5;let maxS=parseInt($('maxS').value)||15;minS=clamp(minS,1,300);maxS=clamp(maxS,1,300);if(minS>maxS){let t=minS;minS=maxS;maxS=t}let chMin=parseInt($('chanceMin').value)||30;let chMax=parseInt($('chanceMax').value)||60;chMin=clamp(chMin,2,1000);chMax=clamp(chMax,2,1000);if(chMin>chMax){let t=chMin;chMin=chMax;chMax=t}let sec=randInt(minS,maxS);const oneIn=randInt(chMin,chMax);const willLike=Math.random()<(1/oneIn);updateStatusUI(sec,willLike,oneIn);let expected=Date.now()+1000;countdownTimer=setInterval(()=>{const drift=Date.now()-expected;if(drift>2000){const skip=Math.floor(drift/1000);sec=Math.max(0,sec-skip)}sec--;expected+=1000;if(sec<=0){clearInterval(countdownTimer);countdownTimer=null;performActionAndScroll(willLike)}else{updateStatusUI(sec,willLike,oneIn)}},1000)}async function performActionAndScroll(shouldLike){if(!running)return;if(shouldLike){const btn=findLikeButton();if(btn){await simulateRealClick(btn);stats.likes++;const prev=btn.style.outline;btn.style.outline='3px solid #e25822';setTimeout(()=>{btn.style.outline=prev},1200);updateInfoText('❤️ LIKED! Scrolling...')}else{stats.likeFails++;updateInfoText('⏭️ Skip (already liked or n/f)')}setTimeout(()=>{doScroll();setTimeout(()=>startNextCycle(),randInt(200,500))},randInt(800,2200))}else{doScroll();setTimeout(()=>startNextCycle(),randInt(200,700))}updateStatsUI()}function updateStatusUI(s,wl,ch){const t=$('timer');const a=$('action');const p=document.getElementById('__neutralAutoScrollUI__');if(t)t.textContent=s+'s';if(a){if(wl){a.innerHTML='Next: <span style="color:#d90429;font-weight:900;text-shadow:1px 1px 0 #fff;">🔥 FIRE LIKE!</span>';if(p)p.style.borderColor='#d90429'}else{a.innerHTML='Next: <span style="color:#264653;">Just Scroll 💨</span>';if(p)p.style.borderColor='#e76f51'}}const ci=$('chanceInfo');if(ci)ci.textContent=wl?'(Rolled 1/'+ch+' — HIT! 🎯)':'(Rolled 1/'+ch+' — miss)'}function updateInfoText(t){const e=$('action');if(e)e.textContent=t}function updateStatsUI(){const e=$('stats');if(!e||!stats.startTime)return;const m=Math.floor((Date.now()-stats.startTime)/60000);const r=stats.scrolls>0?((stats.likes/stats.scrolls)*100).toFixed(1):'0.0';e.innerHTML='📊 Scrolled: <b>'+stats.scrolls+'</b> · Liked: <b style="color:#d90429">'+stats.likes+'</b> · Skip: '+stats.alreadyLiked+' · '+m+'m · '+r+'%'}const ui=document.createElement('div');ui.id='__neutralAutoScrollUI__';ui.style.cssText='position:fixed;right:20px;bottom:60px;z-index:99999;width:280px;padding:0;background:#f4a261;color:#264653;border:4px solid #e76f51;border-radius:15px;font-family:Comic Sans MS,Chalkboard SE,Segoe UI,sans-serif;box-shadow:6px 6px 0px #264653;overflow:hidden;user-select:none;transition:border-color .3s;';ui.innerHTML='<div id="'+P+'header" style="background:#e76f51;padding:10px 14px;display:flex;justify-content:space-between;align-items:center;color:white;cursor:grab;"><div style="font-weight:bold;display:flex;align-items:center;gap:5px;"><span style="font-size:18px;">🐶</span><span>THIS IS FINE</span><span style="font-size:9px;opacity:.7;">v2</span></div><div id="'+P+'close" style="cursor:pointer;font-weight:bold;font-size:18px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:background .2s;">✕</div></div><div style="padding:14px;"><div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;"><div style="font-size:11px;font-weight:bold;text-transform:uppercase;">Next scroll in:</div><div id="'+P+'timer" style="font-size:30px;font-weight:900;color:#fff;text-shadow:2px 2px 0 #000;min-width:60px;text-align:right;">--</div></div><div style="background:rgba(255,255,255,.45);padding:10px;border-radius:10px;margin-bottom:12px;text-align:center;"><div id="'+P+'action" style="font-weight:bold;font-size:13px;">Stopped ☕️</div><div id="'+P+'chanceInfo" style="font-size:10px;opacity:.6;margin-top:3px;">Chance: configurable below</div></div><div id="'+P+'stats" style="font-size:10px;text-align:center;opacity:.75;margin-bottom:12px;min-height:14px;">📊 Ready</div><div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px;"><div style="background:rgba(255,255,255,.3);padding:8px;border-radius:8px;text-align:center;"><div style="font-size:9px;font-weight:bold;margin-bottom:4px;">⏱️ DELAY (sec)</div><div style="display:flex;gap:4px;justify-content:center;"><input id="'+P+'minS" type="number" value="5" min="1" max="300" style="width:38px;text-align:center;border:2px solid #264653;border-radius:5px;padding:2px;background:#fff;font-size:13px;"><span style="align-self:center;font-size:11px;">—</span><input id="'+P+'maxS" type="number" value="15" min="1" max="300" style="width:38px;text-align:center;border:2px solid #264653;border-radius:5px;padding:2px;background:#fff;font-size:13px;"></div></div><div style="background:rgba(255,255,255,.3);padding:8px;border-radius:8px;text-align:center;"><div style="font-size:9px;font-weight:bold;margin-bottom:4px;">❤️ LIKE 1/N</div><div style="display:flex;gap:4px;justify-content:center;"><input id="'+P+'chanceMin" type="number" value="30" min="2" max="1000" style="width:38px;text-align:center;border:2px solid #264653;border-radius:5px;padding:2px;background:#fff;font-size:13px;"><span style="align-self:center;font-size:11px;">—</span><input id="'+P+'chanceMax" type="number" value="60" min="2" max="1000" style="width:38px;text-align:center;border:2px solid #264653;border-radius:5px;padding:2px;background:#fff;font-size:13px;"></div></div></div><div style="margin-bottom:14px;text-align:center;"><label style="cursor:pointer;font-size:12px;font-weight:bold;"><input id="'+P+'smooth" type="checkbox" checked style="accent-color:#e76f51;"> Smooth Scroll</label></div><button id="'+P+'toggle" style="width:100%;padding:11px;background:#264653;border:none;border-radius:10px;color:white;font-weight:bold;cursor:pointer;font-size:14px;box-shadow:0 4px 0 #1a323c;transition:transform .1s;font-family:inherit;">🔥 START FIRE</button></div><div style="background:#2a9d8f;height:8px;width:100%;"></div>';document.body.appendChild(ui);(function(){const h=$(('header'));let d=false,ox=0,oy=0;h.addEventListener('mousedown',e=>{if(e.target.id===P+'close'||e.target.closest('#'+P+'close'))return;d=true;h.style.cursor='grabbing';const r=ui.getBoundingClientRect();ox=e.clientX-r.left;oy=e.clientY-r.top;e.preventDefault()});document.addEventListener('mousemove',e=>{if(!d)return;ui.style.left=clamp(e.clientX-ox,0,window.innerWidth-ui.offsetWidth)+'px';ui.style.top=clamp(e.clientY-oy,0,window.innerHeight-ui.offsetHeight)+'px';ui.style.right='auto';ui.style.bottom='auto'});document.addEventListener('mouseup',()=>{if(d){d=false;h.style.cursor='grab'}})})();const tb=$('toggle');tb.onclick=function(){running=!running;if(running){this.textContent='☕️ STOP';this.style.background='#e76f51';this.style.boxShadow='0 4px 0 #c4492d';stats={scrolls:0,likes:0,likeFails:0,alreadyLiked:0,startTime:Date.now()};startNextCycle()}else{this.textContent='🔥 START FIRE';this.style.background='#264653';this.style.boxShadow='0 4px 0 #1a323c';clearInterval(countdownTimer);countdownTimer=null;$('timer').textContent='--';$('action').textContent='Stopped ☕️'}};tb.onmousedown=function(){this.style.transform='translateY(4px)';this.style.boxShadow='none'};tb.onmouseup=function(){this.style.transform='translateY(0)';this.style.boxShadow=running?'0 4px 0 #c4492d':'0 4px 0 #1a323c'};const cb=$('close');cb.onmouseenter=function(){this.style.background='rgba(0,0,0,.2)'};cb.onmouseleave=function(){this.style.background='transparent'};cb.onclick=()=>{running=false;clearInterval(countdownTimer);countdownTimer=null;ui.remove()};document.addEventListener('visibilitychange',()=>{if(document.hidden&&running)console.log('⏸️ Tab hidden');if(!document.hidden&&running)console.log('▶️ Tab visible')})})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment