Skip to content

Instantly share code, notes, and snippets.

@t-kuni
Last active December 2, 2018 13:50
Show Gist options
  • Save t-kuni/a8afcbd2726c2fcba922149377ae522e to your computer and use it in GitHub Desktop.
Save t-kuni/a8afcbd2726c2fcba922149377ae522e to your computer and use it in GitHub Desktop.
フォロバされてないフォローを外す
/**
* フォロバックしてないフォロワーを外す
*/
function wait() {
return new Promise(function(resolve) {
setTimeout(function() {
resolve();
}, 1000);
});
}
function click() {
var $btn = this;
return new Promise(function(resolve) {
$btn.click();
alert('aa');
resolve();
});
}
function term() {
alert('終了');
}
var p = Promise.resolve();
$users = $('div[data-test-selector="ProfileTimelineUser"]');
$users.each(function() {
$user = $(this);
$status = $user.find("span.FollowStatus");
if ($status.length == 0) {
$btn = $user.find("span.follow-button");
p = p.then(click.bind($btn)).then(wait);
}
});
p.finally(term);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment