Skip to content

Commit

Permalink
Added ESC hotkey for clearing userfocus
Browse files Browse the repository at this point in the history
  • Loading branch information
Voiture-0 committed Nov 15, 2024
1 parent a7f68f0 commit 5191c43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ class Chat {
this.eventBar.unselect();
} else if (!activeWindow.isScrollPinned()) {
activeWindow.scrollBottom();
} else if (this.userfocus.isFocused()) {
this.userfocus.clearFocus();
}
}
});
Expand Down
8 changes: 6 additions & 2 deletions assets/chat/js/focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ChatUserFocus {
this.toggleFocus(t.text());
} else if (t.hasClass('flair')) {
this.toggleFocus(t.data('flair'), true);
} else if (this.focused.length > 0) {
} else if (this.isFocused()) {
this.clearFocus();
}
}
Expand All @@ -43,6 +43,10 @@ class ChatUserFocus {
return this;
}

isFocused() {
return this.focused.length > 0;
}

addCssRule(value, isFlair) {
let rule;
if (isFlair) {
Expand Down Expand Up @@ -92,7 +96,7 @@ class ChatUserFocus {
}

redraw() {
this.chat.ui.toggleClass('focus', this.focused.length > 0);
this.chat.ui.toggleClass('focus', this.isFocused());
}
}

Expand Down

0 comments on commit 5191c43

Please sign in to comment.