Facebook Activity Auto Deleter + Auto Confirm + Auto Scroll

Automatically deletes Facebook activity log entries, confirms popups, and scrolls to load more. Perfect for cleanup or blanking your profile.

当前为 2025-04-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         Facebook Activity Auto Deleter + Auto Confirm + Auto Scroll
// @namespace    https://gf.qytechs.cn/en/users/1454546-shawnfrost13
// @version      3.2
// @description  Automatically deletes Facebook activity log entries, confirms popups, and scrolls to load more. Perfect for cleanup or blanking your profile.
// @author       shawnfrost13
// @license      MIT
// @match        https://www.facebook.com/*/allactivity*
// @grant        none
// @run-at       document-end
// @tags         facebook, delete, cleanup, automation, privacy, scroll
// ==/UserScript==

(function () {
  'use strict';

  const randomDelay = () => 1000 + Math.random() * 1000;

  const clickDeleteButtons = async () => {
    const items = Array.from(document.querySelectorAll('div[aria-label="Action options"]'))
      .filter(el => !el.getAttribute('data-fb-auto-deleted'));

    if (items.length === 0) {
      console.log("✅ No more deletable items found.");
      return false;
    }

    for (const item of items) {
      try {
        // Click 3-dot action menu
        item.click();
        await new Promise(r => setTimeout(r, 500 + Math.random() * 500));

        // Look for the delete option in the dropdown
        const deleteOption = Array.from(document.querySelectorAll('span'))
          .find(span => /delete/i.test(span.textContent));

        if (deleteOption) {
          deleteOption.click();
          console.log("🗑️ Clicked delete option.");
        } else {
          console.log("⚠️ Delete option not found. Skipping.");
          item.setAttribute("data-fb-auto-deleted", "no-delete");
          continue;
        }

        await new Promise(r => setTimeout(r, 700));

        // Handle confirmation dialog (if any)
        const confirmButton = Array.from(document.querySelectorAll('div[role="dialog"] div[role="button"]'))
          .find(btn => /delete|confirm|yes/i.test(btn.textContent));

        if (confirmButton) {
          confirmButton.click();
          console.log("✅ Confirmed deletion.");
        }

        // Check for error toast
        await new Promise(r => setTimeout(r, 500));
        const errorToast = document.querySelector('[role="alert"]:not([data-fb-auto-deleted])');
        if (errorToast && errorToast.textContent.includes("Something went wrong")) {
          console.warn("❌ Facebook error detected. Skipping item.");
          item.setAttribute("data-fb-auto-deleted", "failed");
          const closeBtn = errorToast.querySelector('div[aria-label="Close"]');
          if (closeBtn) closeBtn.click();
          continue;
        }

        // Mark as deleted
        item.setAttribute("data-fb-auto-deleted", "true");
        console.log("✅ Marked item as deleted.");

        // Random wait
        await new Promise(r => setTimeout(r, randomDelay()));
      } catch (err) {
        console.error("⚠️ Error while deleting:", err);
      }
    }

    return true;
  };

  const autoScroll = () => {
    window.scrollTo(0, document.body.scrollHeight);
  };

  const startLoop = async () => {
    console.log("🚀 Facebook Auto Deleter running...");
    while (true) {
      const didDelete = await clickDeleteButtons();
      autoScroll();
      await new Promise(r => setTimeout(r, 2000 + Math.random() * 2000));
      if (!didDelete) break;
    }
    console.log("🏁 Script completed.");
  };

  // Start script after slight delay
  setTimeout(startLoop, 3000);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址