Tweak some single line elseifs

This commit is contained in:
Stubenhocker1399
2019-09-10 15:39:09 +02:00
parent cd27246069
commit 70eed8c686
2 changed files with 16 additions and 11 deletions
@@ -98,15 +98,18 @@ export class ChatBox implements AfterViewInit, OnDestroy {
} }
addEmoji(emoji: string) { addEmoji(emoji: string) {
this.toggleEmojiBox(); this.toggleEmojiBox();
if (!this.message) this.message = emoji; if (!this.message) {
else if (this.input.maxLength > this.message.length) { this.message = emoji;
} else if (this.input.maxLength > this.message.length) {
this.message += emoji; this.message += emoji;
} }
} }
toggleEmojiBox() { toggleEmojiBox() {
if (this.emojiBoxState === 'none') if (this.emojiBoxState === 'none') {
this.emojiBoxState = 'inline-block'; this.emojiBoxState = 'inline-block';
else this.emojiBoxState = 'none'; } else {
this.emojiBoxState = 'none';
}
} }
send(_event: Event | undefined) { send(_event: Event | undefined) {
let chatType = this.chatType; let chatType = this.chatType;
@@ -455,8 +455,9 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
this.unFocus(); this.unFocus();
this.filterChatLogLines('', false); this.filterChatLogLines('', false);
return; return;
} else {
this.filterColor = this.bg;
} }
else this.filterColor = this.bg;
this.autoClear = setTimeout(() => { this.autoClear = setTimeout(() => {
this.filterTab.nativeElement.value = ''; this.filterTab.nativeElement.value = '';
@@ -470,8 +471,9 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
let toLowerCase = false; let toLowerCase = false;
if (value.startsWith('#')) value = value.slice(1); if (value.startsWith('#')) {
else if (value.startsWith('/')) { value = value.slice(1);
} else if (value.startsWith('/')) {
value = value.slice(1); value = value.slice(1);
try { try {
const regExp = new RegExp(value); const regExp = new RegExp(value);
@@ -482,8 +484,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
this.filterTab.nativeElement.style.color = '#ff6666'; this.filterTab.nativeElement.style.color = '#ff6666';
} }
return; return;
} } else {
else {
value = value.toLowerCase(); value = value.toLowerCase();
toLowerCase = true; toLowerCase = true;
} }
@@ -499,10 +500,11 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
textContent = textContent.slice(10); textContent = textContent.slice(10);
if (typeof content === 'string') { if (typeof content === 'string') {
if (caseSensitive) if (caseSensitive) {
lines[i].hidden = !textContent.toLowerCase().includes(content); lines[i].hidden = !textContent.toLowerCase().includes(content);
else } else {
lines[i].hidden = !textContent.includes(content); lines[i].hidden = !textContent.includes(content);
}
} else { } else {
lines[i].hidden = !textContent.match(content); lines[i].hidden = !textContent.match(content);
} }