Skip to content

Instantly share code, notes, and snippets.

@cometothed4rkside
Created May 4, 2025 23:05
Show Gist options
  • Select an option

  • Save cometothed4rkside/dbd13638f9ccb6670e5df77d8c985922 to your computer and use it in GitHub Desktop.

Select an option

Save cometothed4rkside/dbd13638f9ccb6670e5df77d8c985922 to your computer and use it in GitHub Desktop.
/* ---------- Ayarlanabilir parametreler ---------- */
const MAX_SELECTION = 100; // İşaretlenecek maksimum kutu
const DELAY_MS = 200; // Her kutu tıklaması arasındaki gecikme (ms)
const SELECT_MODE_WAIT = 500; // “Seç” düğmesinden sonra UI’nın açılmasını bekleme (ms)
const DIALOG_TIMEOUT = 5000; // Onay diyaloğunu bekleme üst sınırı (ms)
/* ---------- 0) “Seç” düğmesine tıkla ---------- */
(function clickSelectButton () {
const selectBtn = [...document.querySelectorAll('div[role="button"]')]
.find(el => el.textContent.trim() === 'Seç' &&
getComputedStyle(el).pointerEvents !== 'none');
if (selectBtn) {
selectBtn.click();
console.log('"Seç" butonuna tıklandı – çoklu seçim modu açılıyor …');
} else {
console.warn('"Seç" butonu bulunamadı veya tıklanabilir değil (zaten seçim modunda olabilirsiniz).');
}
})();
/* ---------- 1-2-3-4) Geri kalan adımlar ---------- */
setTimeout(() => {
/* 1) Kutuları işaretle */
const checkboxes = document.querySelectorAll('div[data-testid="bulk_action_checkbox"]');
const totalToSelect = Math.min(MAX_SELECTION, checkboxes.length);
checkboxes.forEach((cb, idx) => {
if (idx >= MAX_SELECTION) return;
setTimeout(() => {
cb.click();
console.log(`${idx + 1}/${totalToSelect} kutu işaretlendi`);
}, idx * DELAY_MS);
});
/* 2) Toplu “Beğenmekten Vazgeç” düğmesine tıkla */
const bulkDelay = totalToSelect * DELAY_MS + 500; // Ek 0,5 s tampon
setTimeout(() => {
const bulkUnlike = [...document.querySelectorAll('div[role="button"][aria-label="Beğenmekten Vazgeç"]')]
.find(el => getComputedStyle(el).pointerEvents !== 'none');
if (!bulkUnlike) {
console.warn('Toplu “Beğenmekten Vazgeç” düğmesi bulunamadı.');
return;
}
bulkUnlike.click();
console.log('Toplu “Beğenmekten Vazgeç” düğmesine tıklandı – onay penceresi bekleniyor …');
/* 3) Onay penceresindeki düğmeye tıkla */
const t0 = performance.now();
const poll = setInterval(() => {
const confirmBtn = [...document.querySelectorAll('div._a9-z button')]
.find(btn => btn.textContent.trim() === 'Beğenmekten Vazgeç');
if (confirmBtn) {
confirmBtn.click();
clearInterval(poll);
console.log('Onay penceresindeki “Beğenmekten Vazgeç” düğmesine tıklandı ✔️');
} else if (performance.now() - t0 > DIALOG_TIMEOUT) {
clearInterval(poll);
console.warn('Onay penceresi 5 s içinde bulunamadı.');
}
}, 300); // 0,3 s aralıklarla kontrol
}, bulkDelay);
}, SELECT_MODE_WAIT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment