Improved server kick modal

This commit is contained in:
WolverinDEV 2019-10-24 18:37:12 +02:00
parent 89d2f8db88
commit d5f32487bd
3 changed files with 36 additions and 16 deletions

View file

@ -462,6 +462,19 @@
} }
} }
.modal-body.modal-disconnect-kick {
display: block;
a {
display: inline-block;
}
.htmltag-client {
display: inline-block;
color: unset!important;
}
}
/* button look */ /* button look */
.btn { .btn {
cursor: pointer; cursor: pointer;

View file

@ -529,19 +529,20 @@ class ConnectionHandler {
}).open(); }).open();
break; break;
case DisconnectReason.CLIENT_KICKED: case DisconnectReason.CLIENT_KICKED:
createErrorModal( const have_invoker = typeof(data["invokerid"]) !== "undefined" && parseInt(data["invokerid"]) !== 0;
const modal = createErrorModal(
tr("You've been kicked"), tr("You've been kicked"),
MessageHelper.formatMessage( MessageHelper.formatMessage(
tr("You've been kicked from this server{0}.{:br:}{1}"), have_invoker ? tr("You've been kicked from the server by {0}:{:br:}{1}") : tr("You've been kicked from the server:{:br:}{1}"),
typeof(data["invokerid"]) !== "undefined" ? have_invoker ?
htmltags.generate_client_object(parseInt(data["invokerid"]) === 0 ? htmltags.generate_client_object({ client_id: parseInt(data["invokerid"]), client_unique_id: data["invokeruid"], client_name: data["invokername"]}) :
{ client_id: 0, client_unique_id: this.channelTree.server.properties.virtualserver_unique_identifier, client_name: this.channelTree.server.properties.virtualserver_name} :
{ client_id: parseInt(data["invokerid"]), client_unique_id: data["invokeruid"], client_name: data["invokername"]}
) :
"", "",
data["extra_message"] || data["reasonmsg"] data["extra_message"] || data["reasonmsg"] || ""
) )
).open(); );
modal.htmlTag.find(".modal-body").addClass("modal-disconnect-kick");
modal.open();
this.sound.play(Sound.SERVER_KICKED); this.sound.play(Sound.SERVER_KICKED);
auto_reconnect = false; auto_reconnect = false;
break; break;

View file

@ -13,14 +13,20 @@ const ModalFunctions = {
return val; return val;
}, },
jqueriefy: function(val: BodyCreator, type?: ElementType) : JQuery { jqueriefy: function(val: BodyCreator, type?: ElementType) : JQuery[] | JQuery | undefined {
if($.isFunction(val)) val = val(); if(typeof(val) === "function")
if($.isArray(val)) { val = val();
let result = $.spawn("div");
for(let element of val) if(val instanceof jQuery)
this.jqueriefy(element, type).appendTo(result); return val as JQuery;
return result;
if(Array.isArray(val)) {
if(val.length == 0)
return undefined;
return val.map(e => this.jqueriefy(e));
} }
switch (typeof val){ switch (typeof val){
case "string": case "string":
if(type == ElementType.HEADER) if(type == ElementType.HEADER)