Greasy Fork is available in English.
Auto delete Facebook activity logs with confirmation and auto scroll support. Skips problematic entries. Stable and smooth.
当前为
// ==UserScript==
// @name Facebook Activity Auto Deleter
// @namespace http://greasyfork.icu/en/users/1454546-shawnfrost13
// @version 3.3
// @description Auto delete Facebook activity logs with confirmation and auto scroll support. Skips problematic entries. Stable and smooth.
// @author shawnfrost13
// @license MIT
// @match https://www.facebook.com/*/allactivity*
// @grant none
// @run-at document-end
// @tags facebook, delete, activity, privacy, automation, cleanup
// ==/UserScript==
(function () {
'use strict';
const log = (msg) => {
console.log(`[FB AutoDeleter] ${msg}`);
const toastId = 'fb-auto-deleter-toast';
let toast = document.getElementById(toastId);
if (!toast) {
toast = document.createElement('div');
toast.id = toastId;
toast.style.cssText = `
position: fixed;
bottom: 10px;
right: 10px;
background: #222;
color: #0f0;
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
z-index: 99999;
font-family: sans-serif;
`;
document.body.appendChild(toast);
}
toast.textContent = msg;
};
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const randomWait = () => wait(1100 + Math.random() * 1000);
async function deleteOneActivity(entry) {
try {
// Click the 3-dot action button
entry.setAttribute('data-fb-processed', 'true');
entry.click();
log('Clicked action menu...');
await wait(600);
// Find and click the "Delete" option
const deleteSpan = Array.from(document.querySelectorAll('span')).find(
(el) => /delete/i.test(el.textContent)
);
if (!deleteSpan) {
log('⚠️ No delete option found, skipping.');
return;
}
deleteSpan.click();
log('🗑️ Clicked delete...');
await wait(800);
// Look for the confirmation dialog
const confirmBtn = Array.from(document.querySelectorAll('div[role="dialog"] div[role="button"]')).find(
(btn) => /delete|confirm|yes/i.test(btn.textContent)
);
if (confirmBtn) {
confirmBtn.click();
log('✅ Confirmed deletion');
} else {
log('⚠️ No confirm button, skipping.');
}
await randomWait();
} catch (err) {
console.error("❌ Error during deletion", err);
log('❌ Error - skipped');
}
}
function scrollPage() {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
}
async function processLoop() {
log('🚀 Started Facebook Activity Auto Deleter...');
while (true) {
const actions = Array.from(document.querySelectorAll('div[aria-label="Action options"]')).filter(
(el) => !el.getAttribute('data-fb-processed')
);
if (actions.length === 0) {
log('🔁 No new items, scrolling...');
scrollPage();
await wait(3000);
continue;
}
for (let i = 0; i < actions.length; i++) {
await deleteOneActivity(actions[i]);
}
await wait(1500);
}
}
setTimeout(processLoop, 2500);
})();