Improved the connect modal and updated the change log
Signed-off-by: WolverinDEV <git@teaspeak.de>
This commit is contained in:
parent
cd01b9d89e
commit
1ad608ff72
5 changed files with 28 additions and 16 deletions
|
@ -7,6 +7,9 @@
|
||||||
- Added Headings to the chat
|
- Added Headings to the chat
|
||||||
- Added `[hr]` or `___` to the chat
|
- Added `[hr]` or `___` to the chat
|
||||||
- Added support for tables within the chat
|
- Added support for tables within the chat
|
||||||
|
- Fixed "undefined" history when pressing `arrowup` within the chat box
|
||||||
|
- Correctly logging ban messages within the server log
|
||||||
|
- Capturing last used profile for connect
|
||||||
|
|
||||||
* **20.12.19**
|
* **20.12.19**
|
||||||
- Fixing chat URL escaping
|
- Fixing chat URL escaping
|
||||||
|
|
|
@ -292,6 +292,7 @@ class ConnectionHandler {
|
||||||
this.channelTree.toggle_server_queries(this.client_status.queries_visible);
|
this.channelTree.toggle_server_queries(this.client_status.queries_visible);
|
||||||
|
|
||||||
this.sync_status_with_server();
|
this.sync_status_with_server();
|
||||||
|
this.channelTree.server.updateProperties();
|
||||||
/*
|
/*
|
||||||
No need to update the voice stuff because as soon we see ourself we're doing it
|
No need to update the voice stuff because as soon we see ourself we're doing it
|
||||||
this.update_voice_status();
|
this.update_voice_status();
|
||||||
|
|
|
@ -197,7 +197,8 @@ class Settings extends StaticSettings {
|
||||||
key: 'connect_address'
|
key: 'connect_address'
|
||||||
};
|
};
|
||||||
static readonly KEY_CONNECT_PROFILE: SettingsKey<string> = {
|
static readonly KEY_CONNECT_PROFILE: SettingsKey<string> = {
|
||||||
key: 'connect_profile'
|
key: 'connect_profile',
|
||||||
|
default_value: 'default'
|
||||||
};
|
};
|
||||||
static readonly KEY_CONNECT_USERNAME: SettingsKey<string> = {
|
static readonly KEY_CONNECT_USERNAME: SettingsKey<string> = {
|
||||||
key: 'connect_username'
|
key: 'connect_username'
|
||||||
|
|
|
@ -118,9 +118,9 @@ namespace Modals {
|
||||||
|
|
||||||
modal.htmlTag.find(".modal-body").addClass("modal-connect");
|
modal.htmlTag.find(".modal-body").addClass("modal-connect");
|
||||||
|
|
||||||
const container_last_servers = modal.htmlTag.find(".container-last-servers");
|
|
||||||
/* server list toggle */
|
/* server list toggle */
|
||||||
{
|
{
|
||||||
|
const container_last_servers = modal.htmlTag.find(".container-last-servers");
|
||||||
const button = modal.htmlTag.find(".button-toggle-last-servers");
|
const button = modal.htmlTag.find(".button-toggle-last-servers");
|
||||||
const set_show = shown => {
|
const set_show = shown => {
|
||||||
container_last_servers.toggleClass('shown', shown);
|
container_last_servers.toggleClass('shown', shown);
|
||||||
|
@ -134,8 +134,8 @@ namespace Modals {
|
||||||
}
|
}
|
||||||
|
|
||||||
const apply = (header, body, footer) => {
|
const apply = (header, body, footer) => {
|
||||||
const container = modal.htmlTag.find(".container-last-servers .table .body");
|
const container_last_server_body = modal.htmlTag.find(".container-last-servers .table .body");
|
||||||
const container_empty = container.find(".body-empty");
|
const container_empty = container_last_server_body.find(".body-empty");
|
||||||
let current_connect_data: connection_log.ConnectionEntry;
|
let current_connect_data: connection_log.ConnectionEntry;
|
||||||
|
|
||||||
const button_connect = footer.find(".button-connect");
|
const button_connect = footer.find(".button-connect");
|
||||||
|
@ -150,10 +150,9 @@ namespace Modals {
|
||||||
let updateFields = (reset_current_data: boolean) => {
|
let updateFields = (reset_current_data: boolean) => {
|
||||||
if(reset_current_data) {
|
if(reset_current_data) {
|
||||||
current_connect_data = undefined;
|
current_connect_data = undefined;
|
||||||
container.find(".selected").removeClass("selected");
|
container_last_server_body.find(".selected").removeClass("selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Updating");
|
|
||||||
let address = input_address.val().toString();
|
let address = input_address.val().toString();
|
||||||
settings.changeGlobal(Settings.KEY_CONNECT_ADDRESS, address);
|
settings.changeGlobal(Settings.KEY_CONNECT_ADDRESS, address);
|
||||||
let flag_address = !!address.match(Regex.IP_V4) || !!address.match(Regex.IP_V6) || !!address.match(Regex.DOMAIN);
|
let flag_address = !!address.match(Regex.IP_V4) || !!address.match(Regex.IP_V6) || !!address.match(Regex.DOMAIN);
|
||||||
|
@ -180,7 +179,6 @@ namespace Modals {
|
||||||
if(event.keyCode == KeyCode.KEY_ENTER && !event.shiftKey)
|
if(event.keyCode == KeyCode.KEY_ENTER && !event.shiftKey)
|
||||||
button_connect.trigger('click');
|
button_connect.trigger('click');
|
||||||
});
|
});
|
||||||
|
|
||||||
button_manage.on('click', event => {
|
button_manage.on('click', event => {
|
||||||
const modal = Modals.spawnSettingsModal("identity-profiles");
|
const modal = Modals.spawnSettingsModal("identity-profiles");
|
||||||
modal.close_listener.push(() => {
|
modal.close_listener.push(() => {
|
||||||
|
@ -189,7 +187,7 @@ namespace Modals {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
const last_nickname = settings.static_global(Settings.KEY_CONNECT_USERNAME, undefined);
|
/* Connect Profiles */
|
||||||
{
|
{
|
||||||
for(const profile of profiles.profiles()) {
|
for(const profile of profiles.profiles()) {
|
||||||
input_profile.append(
|
input_profile.append(
|
||||||
|
@ -198,18 +196,25 @@ namespace Modals {
|
||||||
}
|
}
|
||||||
|
|
||||||
input_profile.on('change', event => {
|
input_profile.on('change', event => {
|
||||||
selected_profile = profiles.find_profile(input_profile.val() as string);
|
selected_profile = profiles.find_profile(input_profile.val() as string) || profiles.default_profile();
|
||||||
{
|
{
|
||||||
settings.changeGlobal(Settings.KEY_CONNECT_USERNAME, undefined);
|
settings.changeGlobal(Settings.KEY_CONNECT_USERNAME, undefined);
|
||||||
input_nickname
|
input_nickname
|
||||||
.attr('placeholder', selected_profile.connect_username() || "Another TeaSpeak user")
|
.attr('placeholder', selected_profile.connect_username() || "Another TeaSpeak user")
|
||||||
.val("");
|
.val("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.changeGlobal(Settings.KEY_CONNECT_PROFILE, selected_profile.id);
|
||||||
input_profile.toggleClass("is-invalid", !selected_profile || !selected_profile.valid());
|
input_profile.toggleClass("is-invalid", !selected_profile || !selected_profile.valid());
|
||||||
updateFields(true);
|
updateFields(true);
|
||||||
});
|
});
|
||||||
input_profile.val(connect_profile && connect_profile.enforce ? connect_profile.profile.id : connect_profile && connect_profile.profile ? connect_profile.profile.id : 'default').trigger('change');
|
input_profile.val(connect_profile && connect_profile.profile ?
|
||||||
|
connect_profile.profile.id :
|
||||||
|
settings.static_global(Settings.KEY_CONNECT_PROFILE, "default")
|
||||||
|
).trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const last_nickname = settings.static_global(Settings.KEY_CONNECT_USERNAME, undefined);
|
||||||
if(last_nickname) /* restore */
|
if(last_nickname) /* restore */
|
||||||
settings.changeGlobal(Settings.KEY_CONNECT_USERNAME, last_nickname);
|
settings.changeGlobal(Settings.KEY_CONNECT_USERNAME, last_nickname);
|
||||||
|
|
||||||
|
@ -258,7 +263,7 @@ namespace Modals {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/* server list show */
|
/* connect history show */
|
||||||
{
|
{
|
||||||
for(const entry of connection_log.history().slice(0, 10)) {
|
for(const entry of connection_log.history().slice(0, 10)) {
|
||||||
$.spawn("div").addClass("row").append(
|
$.spawn("div").addClass("row").append(
|
||||||
|
@ -270,7 +275,7 @@ namespace Modals {
|
||||||
row.detach();
|
row.detach();
|
||||||
});
|
});
|
||||||
connection_log.delete_entry(entry.address);
|
connection_log.delete_entry(entry.address);
|
||||||
container_empty.toggle(container.children().length > 1);
|
container_empty.toggle(container_last_server_body.children().length > 1);
|
||||||
})
|
})
|
||||||
).append(
|
).append(
|
||||||
$.spawn("div").addClass("column name").append([
|
$.spawn("div").addClass("column name").append([
|
||||||
|
@ -296,18 +301,17 @@ namespace Modals {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
current_connect_data = entry;
|
current_connect_data = entry;
|
||||||
container.find(".selected").removeClass("selected");
|
container_last_server_body.find(".selected").removeClass("selected");
|
||||||
$(event.target).parent('.row').addClass('selected');
|
$(event.target).parent('.row').addClass('selected');
|
||||||
|
|
||||||
input_address.val(entry.address.hostname + (entry.address.port != 9987 ? (":" + entry.address.port) : ""));
|
input_address.val(entry.address.hostname + (entry.address.port != 9987 ? (":" + entry.address.port) : ""));
|
||||||
input_password.val(entry.password_hash ? "WolverinDEV Yeahr!" : "").trigger('change');
|
input_password.val(entry.flag_password && entry.password_hash ? "WolverinDEV Yeahr!" : "").trigger('change');
|
||||||
}).on('dblclick', event => {
|
}).on('dblclick', event => {
|
||||||
current_connect_data = entry;
|
current_connect_data = entry;
|
||||||
button_connect.trigger('click');
|
button_connect.trigger('click');
|
||||||
}).appendTo(container);
|
}).appendTo(container_last_server_body);
|
||||||
container_empty.toggle(false);
|
container_empty.toggle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
apply(modal.htmlTag, modal.htmlTag, modal.htmlTag);
|
apply(modal.htmlTag, modal.htmlTag, modal.htmlTag);
|
||||||
|
|
|
@ -1230,6 +1230,9 @@ namespace Modals {
|
||||||
profiles.set_default_profile(selected_profile.identity);
|
profiles.set_default_profile(selected_profile.identity);
|
||||||
profiles.mark_need_save();
|
profiles.mark_need_save();
|
||||||
update_profiles(selected_profile.identity.id);
|
update_profiles(selected_profile.identity.id);
|
||||||
|
|
||||||
|
/* set the connect profile to the just set once */
|
||||||
|
settings.changeGlobal(Settings.KEY_CONNECT_PROFILE, "default");
|
||||||
});
|
});
|
||||||
|
|
||||||
selected_profile_changed.push(() => {
|
selected_profile_changed.push(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue