From 70eed8c686cf75e2b7f66cbe8b5ddcd1a4b5c28c Mon Sep 17 00:00:00 2001 From: Stubenhocker1399 Date: Tue, 10 Sep 2019 15:39:09 +0200 Subject: [PATCH] Tweak some single line elseifs --- src/ts/components/shared/chat-box/chat-box.ts | 11 +++++++---- src/ts/components/shared/chat-log/chat-log.ts | 16 +++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/ts/components/shared/chat-box/chat-box.ts b/src/ts/components/shared/chat-box/chat-box.ts index 878920a..30f9217 100644 --- a/src/ts/components/shared/chat-box/chat-box.ts +++ b/src/ts/components/shared/chat-box/chat-box.ts @@ -98,15 +98,18 @@ export class ChatBox implements AfterViewInit, OnDestroy { } addEmoji(emoji: string) { this.toggleEmojiBox(); - if (!this.message) this.message = emoji; - else if (this.input.maxLength > this.message.length) { + if (!this.message) { + this.message = emoji; + } else if (this.input.maxLength > this.message.length) { this.message += emoji; } } toggleEmojiBox() { - if (this.emojiBoxState === 'none') + if (this.emojiBoxState === 'none') { this.emojiBoxState = 'inline-block'; - else this.emojiBoxState = 'none'; + } else { + this.emojiBoxState = 'none'; + } } send(_event: Event | undefined) { let chatType = this.chatType; diff --git a/src/ts/components/shared/chat-log/chat-log.ts b/src/ts/components/shared/chat-log/chat-log.ts index 6739f47..67e56dd 100644 --- a/src/ts/components/shared/chat-log/chat-log.ts +++ b/src/ts/components/shared/chat-log/chat-log.ts @@ -455,8 +455,9 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { this.unFocus(); this.filterChatLogLines('', false); return; + } else { + this.filterColor = this.bg; } - else this.filterColor = this.bg; this.autoClear = setTimeout(() => { this.filterTab.nativeElement.value = ''; @@ -470,8 +471,9 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { let toLowerCase = false; - if (value.startsWith('#')) value = value.slice(1); - else if (value.startsWith('/')) { + if (value.startsWith('#')) { + value = value.slice(1); + } else if (value.startsWith('/')) { value = value.slice(1); try { const regExp = new RegExp(value); @@ -482,8 +484,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { this.filterTab.nativeElement.style.color = '#ff6666'; } return; - } - else { + } else { value = value.toLowerCase(); toLowerCase = true; } @@ -499,10 +500,11 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { textContent = textContent.slice(10); if (typeof content === 'string') { - if (caseSensitive) + if (caseSensitive) { lines[i].hidden = !textContent.toLowerCase().includes(content); - else + } else { lines[i].hidden = !textContent.includes(content); + } } else { lines[i].hidden = !textContent.match(content); }