-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (30 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// valid as of 5th July 2023
(() => {
let count = 0;
function getAllButtons() {
return [...document.querySelectorAll('.artdeco-button__text')].map(node => node.parentNode) || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
for (let button of buttons) {
if (button.querySelector('.artdeco-button__text').textContent.trim() === "Following") {
count = count + 1;
button.click();
await new Promise((resolve) => setTimeout(resolve, 300));
const unfollow = document.querySelectorAll(".artdeco-modal__confirm-dialog-btn")[1];
unfollow.click();
console.log(`Unfollow #${count}`);
window.scrollTo(0, button.offsetTop - 260);
await new Promise((resolve) => setTimeout(resolve, 300));
}
}
}
async function run() {
await unfollowAll();
window.scrollTo(0, document.body.scrollHeight);
await new Promise((resolve) => setTimeout(resolve, 1000));
const buttons = getAllButtons();
if (buttons.length) run();
}
run();
})();