Last active
December 2, 2018 13:50
-
-
Save t-kuni/a8afcbd2726c2fcba922149377ae522e 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 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