Auto add facebook suggested friends
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
// Run at this location: https://www.facebook.com/?sk=ff | |
var addFriendsCount = 100; | |
var addPause = 3 * 1000; | |
function waitForScroll() { | |
return new Promise(function(resolve, reject) { | |
var it = 0; | |
var interval = window.setInterval(function() { | |
console.log('Wait...'); | |
if (it++ > 15) | |
{ | |
window.clearInterval(interval); | |
resolve(); | |
} | |
window.scrollBy(0, 2000); | |
}, 800, resolve); | |
}); | |
} | |
waitForScroll().then(function() { | |
var added = 0; | |
var addFriends = document.querySelectorAll('#fbSearchResultsBox button.FriendRequestAdd'); | |
addFriends = Array.prototype.slice.call(addFriends).reverse(); | |
var clickInterval = window.setInterval(function() { | |
if (!addFriends.length || added++ == addFriendsCount) | |
{ | |
window.clearInterval(clickInterval); | |
return; | |
} | |
var button = addFriends.pop(); | |
button.scrollIntoView(false); | |
button.click(); | |
console.log('Send request #' + added); | |
try{document.querySelector('div[role="dialog"] a.layerCancel').click()}catch(e){}; | |
}, addPause); | |
}); |
что бы он фильтровал по городу кол-ву общих друзей.
В моем случае город Киев, кол-во общих от 5
А вот это хорошая идея. Тоже такой хочу :)
Уже не работает! Выдает ошибку Uncaught SyntaxError: Unexpected identifier
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Макс, будь добр допиши пожалуйста пару строк в скрипт, что бы он фильтровал по городу кол-ву общих друзей.
В моем случае город Киев, кол-во общих от 5