Skip to content

Instantly share code, notes, and snippets.

@ansipunk
Last active March 19, 2021 09:22
Show Gist options
  • Save ansipunk/f5f818a950b78e35e4e424f665a8863b to your computer and use it in GitHub Desktop.
Save ansipunk/f5f818a950b78e35e4e424f665a8863b to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Wipe threads on 2ch.hk
// @namespace https://2ch.hk/
// @version 0.4.1
// @description Wipes threads. Duh.
// @match https://2ch.hk/*
// ==/UserScript==
const wipeText = 'W'.repeat(12000);
const emailInput = document.getElementById('e-mail');
const textArea = document.getElementById('shampoo');
const form = document.getElementById('postform');
const getWipeText = () => {
const raw_posts = document.getElementsByClassName('postbtn-reply-href post__reflink');
const posts = Array.prototype.slice.call(raw_posts, 0, 30);
replies = Array.prototype.map.call(posts, (post) => `>>${post.textContent}`).join('\n');
return `${replies}\n\n${wipeText}`;
};
const wipe = () => {
emailInput.value = 'sage';
textArea.value = getWipeText();
};
const setUp = () => {
const wipeButton = document.createElement('input');
wipeButton.className = 'button desktop';
wipeButton.id = 'wipe';
wipeButton.type = 'button';
wipeButton.value = 'Wipe';
wipeButton.onclick = wipe;
emailInput.after(wipeButton);
};
setUp();
/**
* Just hit the 'Wipe' button next to the email input and submit the form.
* Script will reply to the first 30 posts which will make the thread unreadable.
* 30 posts is Wakaba's limit: any >>reply beyond 30 will just be greentexted.
*
* TODO:
* - Utilize a captcha resolver like anti-captcha.com or whatever;
* - Make 'Wipe' button a switch so it automatically posts with set timeout.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment