Fixed client order and several client/channel icons
This commit is contained in:
parent
aa6ab3e5bf
commit
66f76a91f7
4 changed files with 70 additions and 10 deletions
|
@ -108,8 +108,8 @@ class ChannelEntry {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
clients(deep = false) {
|
clients(deep = false) : ClientEntry[] {
|
||||||
const result = [];
|
const result: ClientEntry[] = [];
|
||||||
if(this.channelTree == null) return [];
|
if(this.channelTree == null) return [];
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
@ -152,14 +152,17 @@ class ChannelEntry {
|
||||||
let iconTag = $.spawn("span").addClass("icons");
|
let iconTag = $.spawn("span").addClass("icons");
|
||||||
iconTag.appendTo(this._tag_channel);
|
iconTag.appendTo(this._tag_channel);
|
||||||
|
|
||||||
//Default icon (4)
|
//Default icon (5)
|
||||||
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_default icon client-channel_default").attr("title", "Default channel")));
|
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_default icon client-channel_default").attr("title", "Default channel")));
|
||||||
//Password icon (3)
|
//Password icon (4)
|
||||||
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_password icon client-register").attr("title", "The channel is password protected")));
|
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_password icon client-register").attr("title", "The channel is password protected")));
|
||||||
//Music icon (2)
|
//Music icon (3)
|
||||||
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_music icon client-music").attr("title", "Music quality")));
|
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_music icon client-music").attr("title", "Music quality")));
|
||||||
|
//Channel moderated (2)
|
||||||
|
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry icon_moderated icon client-moderated").attr("title", "Channel is moderated")));
|
||||||
//Channel Icon (1)
|
//Channel Icon (1)
|
||||||
iconTag.append($.spawn("div").addClass("channel_only_normal").addClass("icon_entry channel_icon").attr("title", "Channel icon"));
|
//iconTag.append($.spawn("div").addClass("channel_only_normal").addClass("icon_entry channel_icon").attr("title", "Channel icon"));
|
||||||
|
iconTag.append($.spawn("div").addClass("channel_only_normal").append($.spawn("div").addClass("icon_entry channel_icon").attr("title", "Channel icon")));
|
||||||
//Default no sound (0)
|
//Default no sound (0)
|
||||||
let container = $.spawn("div");
|
let container = $.spawn("div");
|
||||||
let noSound = $.spawn("div").addClass("icon_entry icon_no_sound icon client-conflict-icon").attr("title", "You don't support the channel codec");
|
let noSound = $.spawn("div").addClass("icon_entry icon_no_sound icon client-conflict-icon").attr("title", "You don't support the channel codec");
|
||||||
|
@ -211,6 +214,34 @@ class ChannelEntry {
|
||||||
return this._tag_clients;
|
return this._tag_clients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reorderClients() {
|
||||||
|
let clients = this.clients();
|
||||||
|
|
||||||
|
if(clients.length > 1) {
|
||||||
|
clients.sort((a, b) => {
|
||||||
|
if(a.properties.client_talk_power < b.properties.client_talk_power)
|
||||||
|
return 1;
|
||||||
|
if(a.properties.client_talk_power > b.properties.client_talk_power)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if(a.properties.client_nickname > b.properties.client_nickname)
|
||||||
|
return 1;
|
||||||
|
if(a.properties.client_nickname < b.properties.client_nickname)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
clients.reverse();
|
||||||
|
|
||||||
|
for(let index = 0; index + 1 < clients.length; index++)
|
||||||
|
clients[index].tag.before(clients[index + 1].tag);
|
||||||
|
|
||||||
|
for(let client of clients) {
|
||||||
|
console.log("- %i %s", client.properties.client_talk_power, client.properties.client_nickname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adjustSize(parent = true) {
|
adjustSize(parent = true) {
|
||||||
const size = this.originalHeight;
|
const size = this.originalHeight;
|
||||||
let subSize = 0;
|
let subSize = 0;
|
||||||
|
@ -428,7 +459,8 @@ class ChannelEntry {
|
||||||
(this.properties.channel_flag_default ? $.fn.show : $.fn.hide).apply(this.channelTag().find(".icons .icon_default"));
|
(this.properties.channel_flag_default ? $.fn.show : $.fn.hide).apply(this.channelTag().find(".icons .icon_default"));
|
||||||
} else if(key == "channel_flag_password")
|
} else if(key == "channel_flag_password")
|
||||||
(this.properties.channel_flag_password ? $.fn.show : $.fn.hide).apply(this.channelTag().find(".icons .icon_password"));
|
(this.properties.channel_flag_password ? $.fn.show : $.fn.hide).apply(this.channelTag().find(".icons .icon_password"));
|
||||||
|
else if(key == "channel_needed_talk_power")
|
||||||
|
(this.properties.channel_needed_talk_power > 0 ? $.fn.show : $.fn.hide).apply(this.channelTag().find(".icons .icon_moderated"));
|
||||||
if(key == "channel_maxclients" || key == "channel_maxfamilyclients" || key == "channel_flag_private" || key == "channel_flag_password")
|
if(key == "channel_maxclients" || key == "channel_maxfamilyclients" || key == "channel_flag_private" || key == "channel_flag_password")
|
||||||
this.updateChannelTypeIcon();
|
this.updateChannelTypeIcon();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ class ClientProperties {
|
||||||
|
|
||||||
client_teaforum_id: number = 0;
|
client_teaforum_id: number = 0;
|
||||||
client_teaforum_name: string = "";
|
client_teaforum_name: string = "";
|
||||||
|
|
||||||
|
client_talk_power: number = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClientEntry {
|
class ClientEntry {
|
||||||
|
@ -241,6 +243,7 @@ class ClientEntry {
|
||||||
tag.append($.spawn("div").addClass("away").text(this.clientNickName()));
|
tag.append($.spawn("div").addClass("away").text(this.clientNickName()));
|
||||||
|
|
||||||
let clientIcons = $.spawn("span");
|
let clientIcons = $.spawn("span");
|
||||||
|
clientIcons.append($.spawn("div").addClass("icon icon_talk_power client-input_muted").hide());
|
||||||
tag.append(clientIcons);
|
tag.append(clientIcons);
|
||||||
|
|
||||||
return this._tag = tag;
|
return this._tag = tag;
|
||||||
|
@ -282,10 +285,18 @@ class ClientEntry {
|
||||||
set speaking(flag) {
|
set speaking(flag) {
|
||||||
if(flag == this._speaking) return;
|
if(flag == this._speaking) return;
|
||||||
this._speaking = flag;
|
this._speaking = flag;
|
||||||
this.updateClientIcon();
|
this.updateClientSpeakIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateClientIcon() {
|
updateClientStatusIcons() {
|
||||||
|
let talk_power = this.properties.client_talk_power >= this._channel.properties.channel_needed_talk_power;
|
||||||
|
if(talk_power)
|
||||||
|
this.tag.find("span").find(".icon_talk_power").hide();
|
||||||
|
else
|
||||||
|
this.tag.find("span").find(".icon_talk_power").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateClientSpeakIcon() {
|
||||||
let icon: string = "";
|
let icon: string = "";
|
||||||
let clicon: string = "";
|
let clicon: string = "";
|
||||||
if(this.properties.client_away) {
|
if(this.properties.client_away) {
|
||||||
|
@ -340,7 +351,7 @@ class ClientEntry {
|
||||||
if(chat) chat.name = variable.value;
|
if(chat) chat.name = variable.value;
|
||||||
}
|
}
|
||||||
if(variable.key == "client_away" || variable.key == "client_output_muted" || variable.key == "client_input_hardware" || variable.key == "client_input_muted" || variable.key == "client_is_channel_commander"){
|
if(variable.key == "client_away" || variable.key == "client_output_muted" || variable.key == "client_input_hardware" || variable.key == "client_input_muted" || variable.key == "client_is_channel_commander"){
|
||||||
this.updateClientIcon();
|
this.updateClientSpeakIcon();
|
||||||
}
|
}
|
||||||
if(variable.key == "client_away_message" || variable.key == "client_away") {
|
if(variable.key == "client_away_message" || variable.key == "client_away") {
|
||||||
this.updateAwayMessage();
|
this.updateAwayMessage();
|
||||||
|
@ -350,6 +361,13 @@ class ClientEntry {
|
||||||
console.error("Updated volume from config " + this.audioController.volume + " - " + "volume_client_" + this.clientUid() + " - " + settings.server("volume_client_" + this.clientUid(), "1"));
|
console.error("Updated volume from config " + this.audioController.volume + " - " + "volume_client_" + this.clientUid() + " - " + settings.server("volume_client_" + this.clientUid(), "1"));
|
||||||
console.log(this.avatarId());
|
console.log(this.avatarId());
|
||||||
}
|
}
|
||||||
|
if(variable.key == "client_talk_power") {
|
||||||
|
if(this._channel) {
|
||||||
|
this._channel.reorderClients();
|
||||||
|
this.updateClientStatusIcons();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group.end();
|
group.end();
|
||||||
|
|
|
@ -183,6 +183,7 @@ class ChannelTree {
|
||||||
let tag = client.tag.css({display: "none"}).fadeIn("slow");
|
let tag = client.tag.css({display: "none"}).fadeIn("slow");
|
||||||
tag.appendTo(channel.clientTag());
|
tag.appendTo(channel.clientTag());
|
||||||
channel.adjustSize(true);
|
channel.adjustSize(true);
|
||||||
|
client.currentChannel().reorderClients();
|
||||||
client.initializeListener();
|
client.initializeListener();
|
||||||
|
|
||||||
channel.updateChannelTypeIcon();
|
channel.updateChannelTypeIcon();
|
||||||
|
@ -195,6 +196,11 @@ class ChannelTree {
|
||||||
client.initializeListener();
|
client.initializeListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reorderAllClients() {
|
||||||
|
for(let channel of this.channels)
|
||||||
|
channel.reorderClients();
|
||||||
|
}
|
||||||
|
|
||||||
moveClient(client: ClientEntry, channel: ChannelEntry) {
|
moveClient(client: ClientEntry, channel: ChannelEntry) {
|
||||||
let oldChannel = client.currentChannel();
|
let oldChannel = client.currentChannel();
|
||||||
client["_channel"] = channel;
|
client["_channel"] = channel;
|
||||||
|
@ -208,8 +214,10 @@ class ChannelTree {
|
||||||
}
|
}
|
||||||
if(client.currentChannel()) {
|
if(client.currentChannel()) {
|
||||||
client.currentChannel().adjustSize();
|
client.currentChannel().adjustSize();
|
||||||
|
client.currentChannel().reorderClients();
|
||||||
client.currentChannel().updateChannelTypeIcon();
|
client.currentChannel().updateChannelTypeIcon();
|
||||||
}
|
}
|
||||||
|
client.updateClientStatusIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
findClient?(clientId: number) : ClientEntry {
|
findClient?(clientId: number) : ClientEntry {
|
||||||
|
|
|
@ -645,10 +645,12 @@
|
||||||
<td>Name:</td>
|
<td>Name:</td>
|
||||||
<td><node key="channel_name"/></td>
|
<td><node key="channel_name"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{if property_channel_topic}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Topic:</td>
|
<td>Topic:</td>
|
||||||
<td>{{>property_channel_topic}}</td>
|
<td>{{>property_channel_topic}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{/if}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Codec:</td>
|
<td>Codec:</td>
|
||||||
<td>{{>property_channel_codec}}</td>
|
<td>{{>property_channel_codec}}</td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue