Created
September 5, 2018 17:54
-
-
Save OverlordQ/56cb1a676e1a83c6cd5719b5f17728f1 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
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
function clickAll(buttons) { | |
for (i = 0; i < buttons.length; i++) { | |
buttons[i].click(); | |
} | |
} | |
async function unblock(timeoutMs, maxScrolls) { | |
var prevScrollY; | |
var scrollY = window.scrollY; | |
var numScrolls = 0; | |
do { | |
window.scrollTo(0,document.body.scrollHeight); | |
numScrolls++; | |
prevScrollY = scrollY; | |
await sleep(timeoutMs); | |
scrollY = window.scrollY; | |
} while((scrollY - prevScrollY) > 0 && (typeof maxScrolls === 'undefined' || numScrolls < maxScrolls)); | |
var unblockButtons = $('div.user-actions.btn-group.blocked.not-muting > span.user-actions-follow-button.js-follow-btn.follow-button') | |
clickAll(unblockButtons); | |
} | |
function main() { | |
unblock(500, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment