First implementation of emoji system

This commit is contained in:
Pierre 2017-06-20 13:29:15 +02:00
parent e59efad29b
commit 2601da21ad
7 changed files with 793 additions and 124 deletions

567
assets/3rdparty/twemoji/2/twemoji.js vendored Executable file

File diff suppressed because one or more lines are too long

2
assets/3rdparty/twemoji/2/twemoji.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,12 @@
/**
* Emojies parser
*
* @author Pierre HUBERT
*/
/**
* Emoji images global style
*/
.emoji {
height: 2em;
}

View File

@ -580,7 +580,21 @@ var ComunicWeb = {
*/ */
userSelect:{ userSelect:{
//TODO : implement //TODO : implement
} },
/**
* Emoji functions
*/
emoji:{
/**
* Emoji parser system
*/
parser: {
//TODO : implement
},
},
}, },
/** /**

View 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;
},
}

View File

@ -28,6 +28,18 @@ ComunicWeb.pages.home.home = {
loginButton.innerHTML="Logout"; loginButton.innerHTML="Logout";
targetElement.appendChild(loginButton); targetElement.appendChild(loginButton);
//Dev feature emojies
var emojiesArea = createElem2({
appendTo: targetElement,
type: "p",
innerHTML: "Emoji test : :) 🇬🇫 🎅🏻"
});
//Parse emojies
ComunicWeb.components.emoji.parser.parse({
element: emojiesArea,
});
} }
else{ else{
//Display landing page //Display landing page

View File

@ -42,6 +42,9 @@ $config['CSSfiles'] = array(
//User selector stylesheet //User selector stylesheet
"%PATH_ASSETS%css/components/userSelect/userSelect.css", "%PATH_ASSETS%css/components/userSelect/userSelect.css",
//Emojies
"%PATH_ASSETS%css/components/emoji/parser.css",
); );
//JS files to include (at the end of the page) //JS files to include (at the end of the page)
@ -71,6 +74,9 @@ $config['JSfiles'] = array(
//Bootstrap notify //Bootstrap notify
"%PATH_ASSETS%3rdparty/bootstrap-notify-3.1.3.min.js", "%PATH_ASSETS%3rdparty/bootstrap-notify-3.1.3.min.js",
//Twitter emojies
"%PATH_ASSETS%3rdparty/twemoji/2/twemoji.min.js",
//Utilities //Utilities
"%PATH_ASSETS%js/common/utils.js", "%PATH_ASSETS%js/common/utils.js",
@ -80,6 +86,7 @@ $config['JSfiles'] = array(
//Pages list //Pages list
"%PATH_ASSETS%js/pagesList.js", "%PATH_ASSETS%js/pagesList.js",
//App scripts -- common scripts //App scripts -- common scripts
"%PATH_ASSETS%js/common/cacheManager.js", "%PATH_ASSETS%js/common/cacheManager.js",
"%PATH_ASSETS%js/common/network.js", "%PATH_ASSETS%js/common/network.js",
@ -128,11 +135,15 @@ $config['JSfiles'] = array(
//User selector //User selector
"%PATH_ASSETS%js/components/userSelect/userSelect.js", "%PATH_ASSETS%js/components/userSelect/userSelect.js",
//Emojies
"%PATH_ASSETS%js/components/emoji/parser.js",
//User scripts //User scripts
"%PATH_ASSETS%js/user/loginTokens.js", "%PATH_ASSETS%js/user/loginTokens.js",
"%PATH_ASSETS%js/user/userLogin.js", "%PATH_ASSETS%js/user/userLogin.js",
"%PATH_ASSETS%js/user/userInfos.js", "%PATH_ASSETS%js/user/userInfos.js",
//Pages scripts //Pages scripts
//Home page //Home page
"%PATH_ASSETS%js/pages/home/home.js", "%PATH_ASSETS%js/pages/home/home.js",