-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOrderedFriendsListPlus.js
45 lines (44 loc) · 1.47 KB
/
OrderedFriendsListPlus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
OrderedFriendsList = function() {
var a = [];
var b = {};
var c = false;
return copy_properties(new Arbiter, {
init: function(d) {
this.init = bagofholding;
a = d;
a.forEach(function(f, e) {
b[f] = e;
});
c = true;
this.inform("initialized", {}, Arbiter.BEHAVIOR_PERSISTENT);
},
contains: function(d) {
return d in b;
},
compare: function(d, e) {
var h = OrderedFriendsList.getRank(d);
var i = OrderedFriendsList.getRank(e);
if (h !== i) return h - i;
var f = ((ChatUserInfos[d] || {}).name || "~").toLowerCase();
var g = ((ChatUserInfos[e] || {}).name || "~").toLowerCase();
if (f !== g) return f < g ? -1 : 1;
return 0;
},
getList: function() {
//This is the only line that was changed from facebook's code.
//Make sure the list returned only contains user ids from the AvailableList
return AvailableList.getAvailableIDs();
},
getRank: function(d) {
return d in b ? b[d] : a.length;
},
isReady: function() {
return c;
}
});
}();
OrderedFriendsList.init(AvailableList.getAvailableIDs());
if (ChatSidebar.isEnabled() && ChatSidebar.isVisible()) {
ChatSidebar.toggle();
ChatSidebar.toggle();
}