mirror of https://github.com/calzoneman/sync.git
Fix userlist (Issue #31)
This commit is contained in:
parent
4c58506575
commit
e9d3fa83e4
|
@ -59,7 +59,8 @@ function fmtUserlistItem(div, rank, leader) {
|
||||||
|
|
||||||
// Adds a dropdown with user actions (promote/demote/leader)
|
// Adds a dropdown with user actions (promote/demote/leader)
|
||||||
function addUserDropdown(entry, name) {
|
function addUserDropdown(entry, name) {
|
||||||
$(entry).find("dropdown").remove();
|
$(entry).find(".dropdown").remove();
|
||||||
|
$(entry).unbind();
|
||||||
var div = $("<div />").addClass("dropdown").appendTo(entry);
|
var div = $("<div />").addClass("dropdown").appendTo(entry);
|
||||||
var ul = $("<ul />").addClass("dropdown-menu").appendTo(div);
|
var ul = $("<ul />").addClass("dropdown-menu").appendTo(div);
|
||||||
ul.attr("role", "menu");
|
ul.attr("role", "menu");
|
||||||
|
@ -76,13 +77,13 @@ function addUserDropdown(entry, name) {
|
||||||
a.click(function() {
|
a.click(function() {
|
||||||
if(IGNORED.indexOf(name) != -1) {
|
if(IGNORED.indexOf(name) != -1) {
|
||||||
IGNORED.splice(IGNORED.indexOf(name), 1);
|
IGNORED.splice(IGNORED.indexOf(name), 1);
|
||||||
a.text("Ignore User");
|
this.text("Ignore User");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IGNORED.push(name);
|
IGNORED.push(name);
|
||||||
a.text("Unignore User");
|
this.text("Unignore User");
|
||||||
}
|
}
|
||||||
});
|
}.bind(a));
|
||||||
|
|
||||||
if(RANK >= Rank.Moderator) {
|
if(RANK >= Rank.Moderator) {
|
||||||
$("<li />").addClass("divider").appendTo(ul);
|
$("<li />").addClass("divider").appendTo(ul);
|
||||||
|
@ -146,6 +147,12 @@ function addUserDropdown(entry, name) {
|
||||||
|
|
||||||
$(entry).click(function() {
|
$(entry).click(function() {
|
||||||
if(ul.css("display") == "none") {
|
if(ul.css("display") == "none") {
|
||||||
|
// Hide others
|
||||||
|
$("#userlist ul.dropdown-menu").each(function() {
|
||||||
|
if(this != ul) {
|
||||||
|
$(this).css("display", "none");
|
||||||
|
}
|
||||||
|
});
|
||||||
ul.css("display", "block");
|
ul.css("display", "block");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue