Revert "Replace quadratic emote list impl with Map"
This reverts commit 0f9bc44925.
The original commit was not backwards compatible with use cases that
users were relying on, such as emotes being sorted in insertion order by
default.
I will develop a new patch which fixes the performance issue in a
backwards compatible way.
This commit is contained in:
parent
aeab31825e
commit
966da1ac58
7 changed files with 153 additions and 57 deletions
|
|
@ -127,6 +127,7 @@ var USEROPTS = {
|
|||
default_quality : getOrDefault("default_quality", "auto"),
|
||||
boop : getOrDefault("boop", "never"),
|
||||
show_shadowchat : getOrDefault("show_shadowchat", false),
|
||||
emotelist_sort : getOrDefault("emotelist_sort", true),
|
||||
no_emotes : getOrDefault("no_emotes", false),
|
||||
strip_image : getOrDefault("strip_image", false),
|
||||
chat_tab_method : getOrDefault("chat_tab_method", "Cycle options")
|
||||
|
|
|
|||
|
|
@ -846,6 +846,12 @@ $("#emotelistbtn").click(function () {
|
|||
EMOTELISTMODAL.modal();
|
||||
});
|
||||
|
||||
EMOTELISTMODAL.find(".emotelist-alphabetical").change(function () {
|
||||
USEROPTS.emotelist_sort = this.checked;
|
||||
setOpt("emotelist_sort", USEROPTS.emotelist_sort);
|
||||
});
|
||||
EMOTELISTMODAL.find(".emotelist-alphabetical").prop("checked", USEROPTS.emotelist_sort);
|
||||
|
||||
$("#fullscreenbtn").click(function () {
|
||||
var elem = document.querySelector("#videowrap .embed-responsive");
|
||||
// this shit is why frontend web development sucks
|
||||
|
|
|
|||
|
|
@ -2915,8 +2915,8 @@ function formatScriptAccessPrefs() {
|
|||
|
||||
function EmoteList(selector, emoteClickCallback) {
|
||||
this.elem = $(selector);
|
||||
this.sortAlphabetical = true;
|
||||
this.initSearch();
|
||||
this.initSortOption();
|
||||
this.table = this.elem.find(".emotelist-table")[0];
|
||||
this.paginatorContainer = this.elem.find(".emotelist-paginator-container");
|
||||
this.cols = 5;
|
||||
|
|
@ -2944,6 +2944,18 @@ EmoteList.prototype.initSearch = function () {
|
|||
});
|
||||
};
|
||||
|
||||
EmoteList.prototype.initSortOption = function () {
|
||||
this.sortOption = this.elem.find(".emotelist-alphabetical");
|
||||
this.sortAlphabetical = false;
|
||||
var self = this;
|
||||
|
||||
this.sortOption.change(function () {
|
||||
self.sortAlphabetical = this.checked;
|
||||
self.handleChange();
|
||||
self.loadPage(0);
|
||||
});
|
||||
};
|
||||
|
||||
EmoteList.prototype.handleChange = function () {
|
||||
this.emotes = CHANNEL.emotes.slice();
|
||||
if (this.sortAlphabetical) {
|
||||
|
|
@ -3027,6 +3039,7 @@ function onEmoteClicked(emote) {
|
|||
}
|
||||
|
||||
window.EMOTELIST = new EmoteList("#emotelist", onEmoteClicked);
|
||||
window.EMOTELIST.sortAlphabetical = USEROPTS.emotelist_sort;
|
||||
|
||||
function CSEmoteList(selector) {
|
||||
EmoteList.call(this, selector);
|
||||
|
|
@ -3179,6 +3192,7 @@ CSEmoteList.prototype.loadPage = function (page) {
|
|||
};
|
||||
|
||||
window.CSEMOTELIST = new CSEmoteList("#cs-emotes");
|
||||
window.CSEMOTELIST.sortAlphabetical = USEROPTS.emotelist_sort;
|
||||
|
||||
function showChannelSettings() {
|
||||
$("#channeloptions").modal();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue