Replace quadratic emote list impl with Map
This commit is contained in:
parent
8399eab33f
commit
0f9bc44925
7 changed files with 57 additions and 153 deletions
|
|
@ -127,7 +127,6 @@ 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,12 +846,6 @@ $("#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,18 +2944,6 @@ 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) {
|
||||
|
|
@ -3039,7 +3027,6 @@ function onEmoteClicked(emote) {
|
|||
}
|
||||
|
||||
window.EMOTELIST = new EmoteList("#emotelist", onEmoteClicked);
|
||||
window.EMOTELIST.sortAlphabetical = USEROPTS.emotelist_sort;
|
||||
|
||||
function CSEmoteList(selector) {
|
||||
EmoteList.call(this, selector);
|
||||
|
|
@ -3192,7 +3179,6 @@ 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