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 * Using random password field ids for server connect modal
+ Improved forum not authenticated message within connect modal + Improved forum not authenticated message within connect modal
- Added partitional MS Edge support - Added partitional MS Edge support
* Fixed chat new line indeed
* **24.09.18**: * **24.09.18**:
- Added server passwords within login modal - Added server passwords within login modal

View file

@ -4,9 +4,17 @@
min-width: 20%; } min-width: 20%; }
.select_server { .select_server {
height: 100%;
display: inline-flex; display: inline-flex;
flex-direction: column;
justify-content: space-between; } justify-content: space-between; }
.select_server .button-update { .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 */ /*# sourceMappingURL=SelectInfo.css.map */

View file

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

View file

@ -6,11 +6,11 @@ enum ChatType {
} }
namespace MessageHelper { namespace MessageHelper {
export function htmlEscape(message: string) : string { export function htmlEscape(message: string) : string[] {
const div = document.createElement('div'); const div = document.createElement('div');
div.innerText = message; div.innerText = message;
message = div.innerHTML; message = div.innerHTML;
return message.replace(/ /g, '&nbsp;'); return message.replace(/ /g, '&nbsp;').split(/<br>/);
} }
export function formatElement(object: any) : JQuery[] { export function formatElement(object: any) : JQuery[] {
@ -21,7 +21,8 @@ namespace MessageHelper {
return result; return result;
} else if(typeof(object) == "string") { } else if(typeof(object) == "string") {
if(object.length == 0) return []; 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") { } else if(typeof(object) === "object") {
if(object instanceof jQuery) if(object instanceof jQuery)
return [object]; 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") if(typeof Module === "undefined")
this["Module"] = {}; this["Module"] = {};
app.initialize(); app.initialize();

View file

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