Skip to content

Commit 952979e

Browse files
Facebook invite script
The script that does the work. Load the jQuery library first, before this one!
1 parent 33714ce commit 952979e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

script.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Facebook auto-invite script
2+
// Author: Michael Warren
3+
// Author contact: mwarren04011990@gmail.com
4+
// Date: October 17, 2016
5+
// TODO: include jQuery somehow. jQuery will not be undefined if successful.
6+
// TODO: this StackOverflow question, http://stackoverflow.com/questions/7474354/include-jquery-in-the-javascript-console , contains two ways to do that.
7+
// Before running this script, copy and paste from http://code.jquery.com/jquery-latest.min.js into your Developer Console.
8+
var $ = jQuery,
9+
// names of people you don't want to invite go here. They must be spelled out perfectly or this won't work. Right now, excludeList is set with prompt
10+
excludeList = trim(prompt("Enter list of Facebook names of people you wish to exclude from invite, delimited by \",\". You need not enter the full name unless there are two or more people of the same name on your friends' list.", "Sam Smith, Joe Sample"))
11+
.split(/\s*,\s*/),
12+
comparisonTypes = {
13+
exactMatch: function(str, arrayOfStrings) {
14+
return $.inArray(str, arrayOfStrings);
15+
},
16+
indexOfElementContaining : function(str, arrayOfStrings) {
17+
var i = -1;
18+
$(arrayOfStrings).each(function(index, element) {
19+
if (element.toLowerCase().contains(str.toLowerCase()))
20+
{
21+
return (i = index);
22+
}
23+
});
24+
return i;
25+
}
26+
},
27+
inputs = $('.uiButton._1sm').filter(function() {
28+
return (comparisonTypes.indexOfElementContaining($(this).parents('._42ef').find('.text').text(), excludeList) == -1);
29+
});
30+
inputs.each(function() { $(this).click(); });

0 commit comments

Comments
 (0)