Fix emote click-to-insert behavior

This commit is contained in:
calzoneman 2016-05-04 20:52:55 -07:00
parent 46eaa7e090
commit 59c7571ad5
1 changed files with 19 additions and 16 deletions

View File

@ -2901,7 +2901,7 @@ function googlePlusSimulator2014(data) {
return data;
}
function EmoteList(selector) {
function EmoteList(selector, emoteClickCallback) {
this.elem = $(selector);
this.initSearch();
this.initSortOption();
@ -2911,6 +2911,7 @@ function EmoteList(selector) {
this.itemsPerPage = 25;
this.emotes = [];
this.page = 0;
this.emoteClickCallback = emoteClickCallback || function(){};
}
EmoteList.prototype.initSearch = function () {
@ -3000,7 +3001,17 @@ EmoteList.prototype.loadPage = function (page) {
img.src = emote.image;
img.className = "emote-preview";
img.title = emote.name;
img.onclick = function () {
img.onclick = _this.emoteClickCallback.bind(null, emote);
td.appendChild(img);
row.appendChild(td);
})(this.emotes[i]);
}
this.page = page;
};
function onEmoteClicked(emote) {
var val = chatline.value;
if (!val) {
chatline.value = emote.name;
@ -3011,19 +3022,11 @@ EmoteList.prototype.loadPage = function (page) {
chatline.value += emote.name;
}
_this.modal.modal("hide");
window.EMOTELISTMODAL.modal("hide");
chatline.focus();
};
td.appendChild(img);
row.appendChild(td);
})(this.emotes[i]);
}
this.page = page;
};
window.EMOTELIST = new EmoteList("#emotelist");
window.EMOTELIST = new EmoteList("#emotelist", onEmoteClicked);
window.EMOTELIST.sortAlphabetical = USEROPTS.emotelist_sort;
function showChannelSettings() {