Advertisement
dcomicboy

Auto-Decline posts FB Group

Jan 24th, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. (async function autoDeclinePosts() {
  2. function delay(ms) {
  3. return new Promise(resolve => setTimeout(resolve, ms));
  4. }
  5.  
  6. async function scrollToBottom() {
  7. return new Promise(resolve => {
  8. let distance = 2000; // Scroll distance in pixels
  9. let interval = 25; // Time between scrolls in ms
  10. let scrollCount = 0;
  11.  
  12. const scrollInterval = setInterval(() => {
  13. window.scrollBy(0, distance);
  14. scrollCount++;
  15. console.log(`Scrolled ${scrollCount * distance}px`);
  16.  
  17. // Stop scrolling if the bottom of the page is reached
  18. if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
  19. clearInterval(scrollInterval);
  20. resolve();
  21. }
  22. }, interval);
  23. });
  24. }
  25.  
  26. async function declinePosts() {
  27. while (true) {
  28. // Select all visible decline buttons
  29. const buttons = document.querySelectorAll('[aria-label="Decline"]'); // Adjust selector if needed
  30.  
  31. if (buttons.length === 0) {
  32. console.log("No more decline buttons found on this section.");
  33. await scrollToBottom(); // Scroll down to load more posts
  34. await delay(500); // Minimal delay to allow new posts to load
  35. continue; // Check for new buttons
  36. }
  37.  
  38. console.log(`Found ${buttons.length} posts to decline.`);
  39.  
  40. // Click all visible decline buttons in rapid succession
  41. buttons.forEach(button => button.click());
  42. console.log("All visible posts declined.");
  43.  
  44. await delay(250); // Very short delay to avoid overwhelming the page
  45. }
  46. }
  47.  
  48. console.log("Starting ultra-fast auto-decline process...");
  49. await declinePosts();
  50. console.log("Auto-decline process completed.");
  51. })();
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement