Welcome to mirror list, hosted at ThFree Co, Russian Federation.

smileys.js « javascripts « app - github.com/jappix/jappix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6353af8256b592a6eb0a797bc3050b77f70c7018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*

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;

})();