diff --git a/www/js/channel/panels/emotePanel.js b/www/js/channel/panels/emotePanel.js index 464fd40..ded82f5 100644 --- a/www/js/channel/panels/emotePanel.js +++ b/www/js/channel/panels/emotePanel.js @@ -179,13 +179,15 @@ class emotePanel extends panelObj{ var search = this.searchPrompt.value; } + var searching = (search != null && search != ''); + //pull emote lists from the command preprocessor var siteEmotes = this.client.chatBox.commandPreprocessor.emotes.site; var chanEmotes = this.client.chatBox.commandPreprocessor.emotes.chan; var personalEmotes = this.client.chatBox.commandPreprocessor.emotes.personal; //If we have a search bar and a search in the search bar - if(search != null && search != ''){ + if(searching){ //filter emote lists using the filterQuery function siteEmotes = siteEmotes.filter(filterQuery); chanEmotes = chanEmotes.filter(filterQuery); @@ -198,9 +200,9 @@ class emotePanel extends panelObj{ } //render out the emote lists - this.renderEmotes(siteEmotes, this.siteEmoteList); - this.renderEmotes(chanEmotes, this.chanEmoteList); - this.renderEmotes(personalEmotes, this.personalEmoteList, true); + this.renderEmotes(siteEmotes, this.siteEmoteList, searching); + this.renderEmotes(chanEmotes, this.chanEmoteList, searching); + this.renderEmotes(personalEmotes, this.personalEmoteList, searching, true); } /** @@ -209,12 +211,12 @@ class emotePanel extends panelObj{ * @param {Node} container - Container to render emotes out to * @param {Boolean} personal - Denotes whether or not we're rendering personal emotes */ - renderEmotes(emoteList, container, personal = false){ + renderEmotes(emoteList, container, searchRender = false, personal = false){ //Clear out the container container.innerHTML = ''; //If we have two or less emotes - if(emoteList.length <= 2){ + if(emoteList.length <= 2 && searchRender){ //Set the container display to flex container.style.display = 'flex'; //otherwise @@ -260,7 +262,7 @@ class emotePanel extends panelObj{ emoteMedia.classList.add('emote-list-media'); //if we have a low emote count - if(emoteList.length <= 2){ + if(emoteList.length <= 2 && searchRender){ //render them huuuuuge emoteMedia.classList.add('emote-list-big-media'); }