Fixed chat new line indeed

This commit is contained in:
WolverinDEV 2018-09-25 19:47:08 +02:00
parent b6e41e8c47
commit 1d0d4f2f37
6 changed files with 37 additions and 12 deletions

View file

@ -7,6 +7,7 @@
* Using random password field ids for server connect modal
+ Improved forum not authenticated message within connect modal
- Added partitional MS Edge support
* Fixed chat new line indeed
* **24.09.18**:
- Added server passwords within login modal

View file

@ -4,9 +4,17 @@
min-width: 20%; }
.select_server {
height: 100%;
display: inline-flex;
flex-direction: column;
justify-content: space-between; }
.select_server .button-update {
width: 100%; }
width: 100%;
height: 23px; }
.select_server .button-update:disabled {
color: red;
pointer-events: none; }
.select_server .button-update:not(:disabled) {
color: green; }
/*# sourceMappingURL=SelectInfo.css.map */

View file

@ -9,10 +9,21 @@
}
.select_server {
height: 100%;
display: inline-flex;
flex-direction: column;
justify-content: space-between;
.button-update {
width: 100%;
height: 23px;
&:disabled {
color: red;
pointer-events: none;
}
&:not(:disabled) {
color: green;
}
}
}

View file

@ -6,11 +6,11 @@ enum ChatType {
}
namespace MessageHelper {
export function htmlEscape(message: string) : string {
export function htmlEscape(message: string) : string[] {
const div = document.createElement('div');
div.innerText = message;
message = div.innerHTML;
return message.replace(/ /g, ' ');
return message.replace(/ /g, '&nbsp;').split(/<br>/);
}
export function formatElement(object: any) : JQuery[] {
@ -21,7 +21,8 @@ namespace MessageHelper {
return result;
} else if(typeof(object) == "string") {
if(object.length == 0) return [];
return [$.spawn("a").html(this.htmlEscape(object))];
return this.htmlEscape(object).map((entry, idx, array) => $.spawn("a").css("display", (idx == 0 || idx + 1 == array.length ? "inline" : "") + "block").html(entry));
} else if(typeof(object) === "object") {
if(object instanceof jQuery)
return [object];

View file

@ -58,6 +58,16 @@ namespace app {
}
}
/* safari remove "fix" */
Object.defineProperty(Element.prototype, "remove", {
enumerable: false,
configurable: false,
writable: false,
value: function(){
this.parentElement.removeChild(this);
}
});
if(typeof Module === "undefined")
this["Module"] = {};
app.initialize();

View file

@ -199,13 +199,7 @@ class ServerInfoManager extends InfoManager<ServerEntry> {
{
let requestUpdate = rendered.find(".btn_update");
/*
let requestUpdate = $.spawn("button");
requestUpdate.css("min-height", "16px");
requestUpdate.css("bottom", 0);
requestUpdate.text("update info");
*/
requestUpdate.prop("enabled", server.shouldUpdateProperties());
requestUpdate.prop("disabled", !server.shouldUpdateProperties());
requestUpdate.click(() => {
server.updateProperties();
@ -213,7 +207,7 @@ class ServerInfoManager extends InfoManager<ServerEntry> {
});
this.registerTimer(setTimeout(function () {
requestUpdate.prop("enabled", true);
requestUpdate.prop("disabled", false);
}, server.nextInfoRequest - Date.now()));
}