View difference between Paste ID: rfL9SWwt and e8Lf2hEP
SHOW: | | - or go back to the newest paste.
1
/*
2
	Friend removal bot
3
		v 1.3
4
			12/02/2014
5
			horrible Javascript by AetherKnight
6
			ROBLOX pls add official fetur kthx
7
*/
8
var ignore = ['namehere'];
9
var MyId = 4308133;
10
// Any best friends you have automatically get ignored
11
12
function deletePls()
13
{
14
	var friends = $('.friend-container'); 
15
	var bestFriends = $('.friend-container .remove-best-friend').parent().parent().parent().parent().parent().parent();
16
	// Yay, finding the ancestor in the family tree!
17
	
18
	for (i = 0; i < bestFriends.length; i++) 
19
	{
20
		$(bestFriends[i]).attr('data-ignore-deletion','true');
21
	}
22
	for (i = 0; i < friends.length; i++) 
23
	{
24
		var friend = $(friends[i]);
25
		var name = friend.children('.friend-name').children('a').text();
26
		if (friend.attr('data-ignore-deletion') === "true" || ignore.indexOf(name.toLowerCase()) !== -1)
27
		{
28
			// Ignore any best friends I have.
29
		}
30
		else 
31
		{
32
			var tehButton = friend[0].children[0].children[0].children[0].children[1].children[1].children[0];
33
			// An ugly hack to get the delete button
34
			var targetId = parseInt($(tehButton).attr('data-target-user-id'));
35
			$.ajax({ // remove each friend, give us ROBLOX's friends back - since he has none.
36
				type: 'POST', 
37
				url: './friends/removefriend',
38
				data: {"targetUserID":targetId, "displayedUserID":1,"pageNum":1, "view":'Friends',"invitationID":"undefined"},
39
				async: true, 
40
			});
41
		}
42
	}
43
	
44
	$.ajax({
45
		type: 'GET',
46
		url: './friends/Friends?DisplayedUserID=' + MyId + '&PageNum=1',
47
		success: function(result){  $('#FriendsTab').html(result);   } ,
48
	}); // Load more friends into the list, so we can keep going
49
50
	setTimeout(deletePls, 2000); // Works optimal at 2 seconds, no idea why.
51
};
52
53
deletePls();