mirror of https://github.com/calzoneman/sync.git
Hoist sortUserlist outside of userlist population inner loop
This commit is contained in:
parent
bfe0d75278
commit
fdab26b792
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.55.7",
|
"version": "3.55.8",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -487,32 +487,13 @@ Callbacks = {
|
||||||
userlist: function(data) {
|
userlist: function(data) {
|
||||||
$(".userlist_item").remove();
|
$(".userlist_item").remove();
|
||||||
for(var i = 0; i < data.length; i++) {
|
for(var i = 0; i < data.length; i++) {
|
||||||
Callbacks.addUser(data[i]);
|
CyTube._internal_do_not_use_or_you_will_be_banned.addUserToList(data[i]);
|
||||||
}
|
}
|
||||||
|
sortUserlist();
|
||||||
},
|
},
|
||||||
|
|
||||||
addUser: function(data) {
|
addUser: function(data) {
|
||||||
var user = findUserlistItem(data.name);
|
CyTube._internal_do_not_use_or_you_will_be_banned.addUserToList(data);
|
||||||
// Remove previous instance of user, if there was one
|
|
||||||
if(user !== null)
|
|
||||||
user.remove();
|
|
||||||
var div = $("<div/>")
|
|
||||||
.addClass("userlist_item");
|
|
||||||
var icon = $("<span/>").appendTo(div);
|
|
||||||
var nametag = $("<span/>").text(data.name).appendTo(div);
|
|
||||||
div.data("name", data.name);
|
|
||||||
div.data("rank", data.rank);
|
|
||||||
div.data("leader", Boolean(data.leader));
|
|
||||||
div.data("profile", data.profile);
|
|
||||||
div.data("meta", data.meta);
|
|
||||||
if (data.meta.muted || data.meta.smuted) {
|
|
||||||
div.data("icon", "glyphicon-volume-off");
|
|
||||||
} else {
|
|
||||||
div.data("icon", false);
|
|
||||||
}
|
|
||||||
formatUserlistItem(div);
|
|
||||||
addUserDropdown(div, data);
|
|
||||||
div.appendTo($("#userlist"));
|
|
||||||
sortUserlist();
|
sortUserlist();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ CyTube.ui = {
|
||||||
CyTube.featureFlag = {
|
CyTube.featureFlag = {
|
||||||
efficientEmotes: true
|
efficientEmotes: true
|
||||||
};
|
};
|
||||||
|
CyTube._internal_do_not_use_or_you_will_be_banned = {};
|
||||||
|
|
||||||
function getOpt(k) {
|
function getOpt(k) {
|
||||||
var v = NO_STORAGE ? readCookie(k) : localStorage.getItem(k);
|
var v = NO_STORAGE ? readCookie(k) : localStorage.getItem(k);
|
||||||
|
|
|
@ -3363,3 +3363,27 @@ CyTube.ui.changeVideoWidth = function uiChangeVideoWidth(direction) {
|
||||||
|
|
||||||
handleVideoResize();
|
handleVideoResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CyTube._internal_do_not_use_or_you_will_be_banned.addUserToList = function (data) {
|
||||||
|
var user = findUserlistItem(data.name);
|
||||||
|
// Remove previous instance of user, if there was one
|
||||||
|
if(user !== null)
|
||||||
|
user.remove();
|
||||||
|
var div = $("<div/>")
|
||||||
|
.addClass("userlist_item");
|
||||||
|
var icon = $("<span/>").appendTo(div);
|
||||||
|
var nametag = $("<span/>").text(data.name).appendTo(div);
|
||||||
|
div.data("name", data.name);
|
||||||
|
div.data("rank", data.rank);
|
||||||
|
div.data("leader", Boolean(data.leader));
|
||||||
|
div.data("profile", data.profile);
|
||||||
|
div.data("meta", data.meta);
|
||||||
|
if (data.meta.muted || data.meta.smuted) {
|
||||||
|
div.data("icon", "glyphicon-volume-off");
|
||||||
|
} else {
|
||||||
|
div.data("icon", false);
|
||||||
|
}
|
||||||
|
formatUserlistItem(div);
|
||||||
|
addUserDropdown(div, data);
|
||||||
|
div.appendTo($("#userlist"));
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue