From 1d0d4f2f3798940732c4d08260dbf7abe575c465 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 25 Sep 2018 19:47:08 +0200 Subject: [PATCH] Fixed chat new line indeed --- ChangeLog.md | 1 + css/frame/SelectInfo.css | 10 +++++++++- css/frame/SelectInfo.scss | 11 +++++++++++ js/chat.ts | 7 ++++--- js/load.ts | 10 ++++++++++ js/ui/frames/SelectedItemInfo.ts | 10 ++-------- 6 files changed, 37 insertions(+), 12 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4497797e..95a1b574 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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 diff --git a/css/frame/SelectInfo.css b/css/frame/SelectInfo.css index 593e5440..ea4120f9 100644 --- a/css/frame/SelectInfo.css +++ b/css/frame/SelectInfo.css @@ -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 */ diff --git a/css/frame/SelectInfo.scss b/css/frame/SelectInfo.scss index 8797453e..1564fc7c 100644 --- a/css/frame/SelectInfo.scss +++ b/css/frame/SelectInfo.scss @@ -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; + } } } \ No newline at end of file diff --git a/js/chat.ts b/js/chat.ts index 6d884fb2..c5dafe7b 100644 --- a/js/chat.ts +++ b/js/chat.ts @@ -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, ' ').split(/
/); } 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]; diff --git a/js/load.ts b/js/load.ts index 5e29b9ad..0193d4ca 100644 --- a/js/load.ts +++ b/js/load.ts @@ -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(); diff --git a/js/ui/frames/SelectedItemInfo.ts b/js/ui/frames/SelectedItemInfo.ts index 477889c8..10c19f8c 100644 --- a/js/ui/frames/SelectedItemInfo.ts +++ b/js/ui/frames/SelectedItemInfo.ts @@ -199,13 +199,7 @@ class ServerInfoManager extends InfoManager { { 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 { }); this.registerTimer(setTimeout(function () { - requestUpdate.prop("enabled", true); + requestUpdate.prop("disabled", false); }, server.nextInfoRequest - Date.now())); }