Created
March 25, 2025 11:36
-
-
Save cometothed4rkside/5ff16659bb9f235944f8cf148f95fd6e to your computer and use it in GitHub Desktop.
Twitter DM Toplu Temizleyici - Twitter Dm Cleaner (TamperMonkey)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Twitter DM Toplu Temizleyici | |
| // @description Twitter DM kutusunda tüm mesajları otomatik olarak siler (sonsuz kaydırma destekli). | |
| // @match https://x.com/messages* | |
| // @version 1.0.0 | |
| // @grant GM_registerMenuCommand | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| GM_registerMenuCommand("💣 Tüm DM'leri Otomatik Sil", autoDeleteAllMessages); | |
| async function autoDeleteAllMessages() { | |
| if (!isOnMessagesPage()) { | |
| alert("Bu komut yalnızca DM kutusunda çalışır."); | |
| return; | |
| } | |
| let deleted = 0; | |
| const progress = createProgressBox(); | |
| document.body.appendChild(progress); | |
| while (true) { | |
| await scrollToBottom(); // sonsuz kaydırma | |
| await sleep(1500); // yeni içerik yüklenmesi için bekle | |
| const conversations = [...document.querySelectorAll('[data-testid="conversation"]')]; | |
| if (conversations.length === 0 || deleted >= conversations.length) break; | |
| for (const convo of conversations) { | |
| try { | |
| await deleteConversation(convo); | |
| deleted++; | |
| updateProgressBox(progress, deleted); | |
| await sleep(1000); // sistemin tıkanmaması için bekleme süresi | |
| } catch (e) { | |
| console.error("Silme hatası:", e); | |
| } | |
| } | |
| } | |
| progress.textContent = `✅ ${deleted} DM silindi.`; | |
| } | |
| function isOnMessagesPage() { | |
| return location.pathname.startsWith("/messages") && !location.pathname.includes("requests"); | |
| } | |
| function createProgressBox() { | |
| const box = document.createElement("div"); | |
| box.style.position = "fixed"; | |
| box.style.top = "10px"; | |
| box.style.right = "10px"; | |
| box.style.background = "#1da1f2"; | |
| box.style.color = "white"; | |
| box.style.padding = "10px"; | |
| box.style.zIndex = "9999"; | |
| box.style.borderRadius = "8px"; | |
| box.style.fontWeight = "bold"; | |
| box.textContent = "🔄 Silme başlatılıyor..."; | |
| return box; | |
| } | |
| function updateProgressBox(box, count) { | |
| box.textContent = `✂️ Silinen: ${count}`; | |
| } | |
| function scrollToBottom() { | |
| return new Promise(resolve => { | |
| window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" }); | |
| setTimeout(resolve, 1000); | |
| }); | |
| } | |
| function sleep(ms) { | |
| return new Promise(r => setTimeout(r, ms)); | |
| } | |
| function deleteConversation(convo) { | |
| return new Promise((resolve, reject) => { | |
| const moreBtn = convo.querySelector('button[aria-label="More"], button[aria-label="Daha fazla"], button[aria-label="更多"]'); | |
| if (!moreBtn) return reject("More butonu yok"); | |
| moreBtn.click(); | |
| const observer = new MutationObserver(() => { | |
| const deleteBtn = [...document.querySelectorAll('div[role="menuitem"]')].find(btn => | |
| btn.textContent.includes("Delete") || btn.textContent.includes("Sil") || btn.textContent.includes("删除") | |
| ); | |
| if (deleteBtn) { | |
| observer.disconnect(); | |
| deleteBtn.click(); | |
| const confirmInterval = setInterval(() => { | |
| const confirmBtn = document.querySelector('[data-testid="confirmationSheetConfirm"]'); | |
| if (confirmBtn) { | |
| clearInterval(confirmInterval); | |
| confirmBtn.click(); | |
| resolve(); | |
| } | |
| }, 500); | |
| } | |
| }); | |
| observer.observe(document.body, { childList: true, subtree: true }); | |
| }); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment