Last active
May 27, 2021 10:54
-
-
Save moeffju/1e1bb5172f1f4404e4d0ac933a364037 to your computer and use it in GitHub Desktop.
This file contains 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
// Unblock everyone on Twitter: Go to https://twitter.com/settings/blocked and paste the below in DevTools | |
// Yes this is super ugly and hacky don’t @ me | |
function click_all_unblock_buttons() { document.querySelectorAll('button.blocked-text').forEach(btn => btn.click()); } | |
function unblock(min_num_accounts) { | |
var checkNumber, autoScroll, curScrollPos, prevScrollPos, checkScroll, done; | |
done = false; | |
curScrollPos = prevScrollPos = window.scrollY; | |
checkScroll = setInterval(() => { | |
if (window.scrollY <= prevScrollPos && window.scrollY <= curScrollPos) { | |
// page did not scroll in 1s so stop | |
console.log('page did not scroll'); | |
done = true; | |
} | |
prevScrollPos = curScrollPos; | |
curScrollPos = window.scrollY; | |
}, 1000); | |
autoScroll = setInterval(() => { | |
window.scrollTo(0, document.body.scrollHeight); | |
}, 200); | |
checkNumber = setInterval(() => { | |
var current_visible = document.getElementsByClassName('blocked-text').length; | |
console.log(current_visible + ' visible'); | |
if (current_visible >= min_num_accounts) { | |
done = true; | |
} | |
if (done) { | |
clearInterval(autoScroll); | |
clearInterval(checkNumber); | |
if (window.confirm('Unblocking ' + document.getElementsByClassName('blocked-text').length + ' accounts.')) { | |
click_all_unblock_buttons(); | |
location.reload(); | |
} | |
} | |
}, 1000); | |
}; | |
// pass the number of accounts you want to load before unblocking | |
unblock(1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment