order popup emoji modal results by usage count
parent
df0184b728
commit
027ba80e85
|
@ -38,6 +38,8 @@ const favorite_emojis = JSON.parse(localStorage.getItem("favorite_emojis")) || {
|
||||||
/** Associative array of all the emojis' DOM */
|
/** Associative array of all the emojis' DOM */
|
||||||
let emojiDOMs = {};
|
let emojiDOMs = {};
|
||||||
|
|
||||||
|
let globalEmojis;
|
||||||
|
|
||||||
const EMOIJ_SEARCH_ENGINE_MIN_INTERVAL = 350;
|
const EMOIJ_SEARCH_ENGINE_MIN_INTERVAL = 350;
|
||||||
let emojiSearcher = {
|
let emojiSearcher = {
|
||||||
working: false,
|
working: false,
|
||||||
|
@ -141,11 +143,13 @@ const emojisSearchDictionary = {
|
||||||
const emojiRequest = new XMLHttpRequest();
|
const emojiRequest = new XMLHttpRequest();
|
||||||
emojiRequest.open("GET", '/emojis.csv');
|
emojiRequest.open("GET", '/emojis.csv');
|
||||||
emojiRequest.setRequestHeader('xhr', 'xhr');
|
emojiRequest.setRequestHeader('xhr', 'xhr');
|
||||||
emojiRequest.onload = async (e) => {
|
emojiRequest.onload = async () => {
|
||||||
let emojis = JSON.parse(emojiRequest.response);
|
let emojis = JSON.parse(emojiRequest.response);
|
||||||
if(! (emojis instanceof Array ))
|
if(! (emojis instanceof Array ))
|
||||||
throw new TypeError("[EMOJI DIALOG] rDrama's server should have sent a JSON-coded Array!");
|
throw new TypeError("[EMOJI DIALOG] rDrama's server should have sent a JSON-coded Array!");
|
||||||
|
|
||||||
|
globalEmojis = emojis.map(i => i.name);
|
||||||
|
|
||||||
let classes = new Set();
|
let classes = new Set();
|
||||||
const bussyDOM = document.createElement("div");
|
const bussyDOM = document.createElement("div");
|
||||||
|
|
||||||
|
@ -430,7 +434,11 @@ function update_speed_emoji_modal(event)
|
||||||
speed_carot_modal.style.top = modal_pos.y + box_coords.y + 14 + "px";
|
speed_carot_modal.style.top = modal_pos.y + box_coords.y + 14 + "px";
|
||||||
|
|
||||||
// Do the search (and do something with it)
|
// Do the search (and do something with it)
|
||||||
populate_speed_emoji_modal(emojisSearchDictionary.completeSearch(current_word.substr(1).replace(/#/g, "").replace(/!/g, "")), event.target);
|
const resultSet = emojisSearchDictionary.completeSearch(current_word.substr(1).replace(/#/g, "").replace(/!/g, ""))
|
||||||
|
|
||||||
|
const found = globalEmojis.filter(value => resultSet.has(value));
|
||||||
|
|
||||||
|
populate_speed_emoji_modal(found, event.target);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue