mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 12:25:16 +00:00
First implementation of emoji system
This commit is contained in:
51
assets/js/components/emoji/parser.js
Normal file
51
assets/js/components/emoji/parser.js
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Emoji parser system
|
||||
*
|
||||
* Based on the work of Twitter Emoji
|
||||
* https://github.com/twitter/twemoji
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.emoji.parser = {
|
||||
|
||||
/**
|
||||
* Define twemoji base
|
||||
*/
|
||||
__twemojiBase: ComunicWeb.__config.assetsURL + "3rdparty/twemoji/2/",
|
||||
|
||||
/**
|
||||
* Parse emojies
|
||||
*
|
||||
* @param {Object} infos Informations about the area to parse
|
||||
* @info {HTMLElement} element The element to parser
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
parse: function(infos){
|
||||
|
||||
|
||||
//Perform Twitter parsing
|
||||
this.twitterEmojiesParsing(infos.element);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Perform Twitter emojies parsing
|
||||
*
|
||||
* @param {Object} target The target of the parsing
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
twitterEmojiesParsing: function(target){
|
||||
|
||||
//Call Twitter
|
||||
twemoji.parse(target, {
|
||||
base: this.__twemojiBase
|
||||
});
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
}
|
Reference in New Issue
Block a user