mirror of https://github.com/calzoneman/sync.git
EmoteList live reconfig support
This commit is contained in:
parent
46fcec8d14
commit
af6e7bed0c
|
@ -2891,18 +2891,37 @@ function formatScriptAccessPrefs() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmoteList(selector, emoteClickCallback) {
|
|
||||||
|
class EmoteList {
|
||||||
|
constructor(selector, emoteClickCallback){
|
||||||
|
this._cols = 5;
|
||||||
|
this._itemsPerPage = 25;
|
||||||
this.elem = $(selector);
|
this.elem = $(selector);
|
||||||
this.initSearch();
|
this.initSearch();
|
||||||
this.initSortOption();
|
this.initSortOption();
|
||||||
this.table = this.elem.find(".emotelist-table")[0];
|
this.table = this.elem.find(".emotelist-table")[0];
|
||||||
this.paginatorContainer = this.elem.find(".emotelist-paginator-container");
|
this.paginatorContainer = this.elem.find(".emotelist-paginator-container");
|
||||||
this.cols = 5;
|
|
||||||
this.itemsPerPage = 25;
|
|
||||||
this.emotes = [];
|
this.emotes = [];
|
||||||
this.page = 0;
|
this.page = 0;
|
||||||
this.emoteClickCallback = emoteClickCallback || function(){};
|
this.emoteClickCallback = emoteClickCallback || function(){};
|
||||||
}
|
}
|
||||||
|
set itemsPerPage(val) {
|
||||||
|
this.page = 0;
|
||||||
|
this._itemsPerPage = val;
|
||||||
|
this.handleChange();
|
||||||
|
}
|
||||||
|
get itemsPerPage() {
|
||||||
|
return this._itemsPerPage;
|
||||||
|
}
|
||||||
|
set cols(val) {
|
||||||
|
this.page = 0;
|
||||||
|
this._cols = val;
|
||||||
|
this.handleChange();
|
||||||
|
}
|
||||||
|
get cols() {
|
||||||
|
return this._cols;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EmoteList.prototype.initSearch = function () {
|
EmoteList.prototype.initSearch = function () {
|
||||||
this.searchbar = this.elem.find(".emotelist-search");
|
this.searchbar = this.elem.find(".emotelist-search");
|
||||||
|
@ -3019,11 +3038,11 @@ function onEmoteClicked(emote) {
|
||||||
window.EMOTELIST = new EmoteList("#emotelist", onEmoteClicked);
|
window.EMOTELIST = new EmoteList("#emotelist", onEmoteClicked);
|
||||||
window.EMOTELIST.sortAlphabetical = USEROPTS.emotelist_sort;
|
window.EMOTELIST.sortAlphabetical = USEROPTS.emotelist_sort;
|
||||||
|
|
||||||
function CSEmoteList(selector) {
|
class CSEmoteList extends EmoteList {
|
||||||
EmoteList.call(this, selector);
|
constructor(selector) {
|
||||||
|
super(selector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSEmoteList.prototype = Object.create(EmoteList.prototype);
|
|
||||||
|
|
||||||
CSEmoteList.prototype.loadPage = function (page) {
|
CSEmoteList.prototype.loadPage = function (page) {
|
||||||
var tbody = this.table.children[1];
|
var tbody = this.table.children[1];
|
||||||
|
|
Loading…
Reference in New Issue