emoji_picker: Add get_emoji_coordinates() function.

Given the `emoji-id` of an emoji in emoji picker this function
returns its coordinates, i.e, section number and index.
This commit is contained in:
Harshit Bansal
2017-10-05 19:52:16 +05:30
committed by Tim Abbott
parent da86cbdaf5
commit 7546e3325f

View File

@@ -72,6 +72,16 @@ function get_emoji_id(section, index) {
return emoji_id;
}
function get_emoji_coordinates(emoji_id) {
// Emoji id is of the following form: <emoji_type>_<section_number>_<index>
// <emoji_type> itself contains two underscores. See `get_emoji_id()`.
var emoji_info = emoji_id.split("_");
return {
section: parseInt(emoji_info[3], 10),
index: parseInt(emoji_info[4], 10),
};
}
function show_search_results() {
$(".emoji-popover-emoji-map").hide();
$(".emoji-popover-category-tabs").hide();