1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00
jappix_ynh/source/app/javascripts/smileys.js
2014-11-25 23:42:38 +01:00

119 lines
No EOL
2.6 KiB
JavaScript

/*
Jappix - An open social platform
These are the smileys JS scripts for Jappix
-------------------------------------------------
License: AGPL
Author: Valérian Saliou
*/
// Bundle
var Smileys = (function () {
/**
* Alias of this
* @private
*/
var self = {};
/* Constants */
self.emote_list = {
'biggrin': ':-D',
'devil': ']:->',
'coolglasses': '8-)',
'tongue': ':-P',
'smile': ':-)',
'wink': ';-)',
'blush': ':-$',
'stare': ':-|',
'frowning': ':-/',
'oh': '=-O',
'unhappy': ':-(',
'cry': ':\'-(',
'angry': ':-@',
'puke': ':-!',
'hugright': '({)',
'hugleft': '(})',
'lion': ':3',
'pussy': '(@)',
'bat': ':-[',
'kiss': ':-{}',
'heart': '<3',
'brheart': '</3',
'flower': '@}->--',
'brflower': '(W)',
'thumbup': '(Y)',
'thumbdown': '(N)',
'lamp': '(I)',
'coffee': '(C)',
'drink': '(D)',
'beer': '(B)',
'boy': '(Z)',
'girl': '(X)',
'photo': '(P)',
'phone': '(T)',
'music': '(8)',
'cuffs': '(%)',
'mail': '(E)',
'rainbow': '(R)',
'star': '(*)',
'moon': '(S)'
};
/**
* Generates the correct HTML code for an emoticon insertion tool
* @public
* @param {string} smiley
* @param {string} image
* @param {string} hash
* @return {undefined}
*/
self.emoteLink = function(smiley, image, hash) {
try {
return '<a href="#" class="emoticon emoticon-' + image + ' smileys-images" data-smiley="' + smiley + '"></a>';
} catch(e) {
Console.error('Smileys.emoteLink', e);
}
};
/**
* Emoticon links arrays
* @public
* @param {string} hash
* @return {string}
*/
self.links = function(hash) {
try {
var links = '';
for(var cur_emote in self.emote_list) {
links += self.emoteLink(
self.emote_list[cur_emote],
cur_emote,
hash
);
}
return links;
} catch(e) {
Console.error('Smileys.links', e);
}
};
/**
* Return class scope
*/
return self;
})();