-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
381 lines (368 loc) · 16.8 KB
/
index.html
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html>
<html>
<head>
<title>EmojiPicker Demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="EmojiPicker.js"></script>
<link rel="stylesheet" type="text/css" href="EmojiPicker.css">
<style>
body {
font-family: Arial;
padding: 0px;
margin: 0px;
font-size: 15px;
}
h1 {
text-align: center;
}
p {
line-height: 20px;
}
.center {
width: 500px;
margin: 20px auto;
}
#result, #render, #renderTxt {
width: 100%;
box-sizing: border-box;
font-size: 15px;
min-height: 100px;
font-family: Arial;
padding: 10px;
border: 1px solid #cccccc;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
resize: none;
}
#render img {
width: 20px;
height: 20px;
margin-top: -5px;
vertical-align: middle;
}
blockquote {
background-color: #efefef;
font-style: italic;
margin: 5px;
padding: 10px;
}
span {
background-color: #ffcc33;
display: block;
text-align: center;
padding: 12px;
}
span.red {
background-color: #ff3333;
color: #fff;
}
</style>
<script>
/* global EmojiPickerSettings */
function initEmojiPicker() {
EmojiPickerSettings.icons = {'bowtie': 'bowtie.png',
'smile': 'smile.png',
'laughing': 'laughing.png',
'blush': 'blush.png',
'smiley': 'smiley.png',
'relaxed': 'relaxed.png',
'smirk': 'smirk.png',
'heart_eyes': 'heart_eyes.png',
'kissing_heart': 'kissing_heart.png',
'kissing_closed_eyes': 'kissing_closed_eyes.png',
'flushed': 'flushed.png',
'relieved': 'relieved.png',
'satisfied': 'satisfied.png',
'grin': 'grin.png',
'wink': 'wink.png',
'stuck_out_tongue_winking_eye': 'stuck_out_tongue_winking_eye.png',
'stuck_out_tongue_closed_eyes': 'stuck_out_tongue_closed_eyes.png',
'grinning': 'grinning.png',
'kissing': 'kissing.png',
'kissing_smiling_eyes': 'kissing_smiling_eyes.png',
'stuck_out_tongue': 'stuck_out_tongue.png',
'sleeping': 'sleeping.png',
'worried': 'worried.png',
'frowning': 'frowning.png',
'anguished': 'anguished.png',
'open_mouth': 'open_mouth.png',
'grimacing': 'grimacing.png',
'confused': 'confused.png',
'hushed': 'hushed.png',
'expressionless': 'expressionless.png',
'unamused': 'unamused.png',
'sweat_smile': 'sweat_smile.png',
'sweat': 'sweat.png',
'weary': 'weary.png',
'pensive': 'pensive.png',
'disappointed': 'disappointed.png',
'confounded': 'confounded.png',
'fearful': 'fearful.png',
'cold_sweat': 'cold_sweat.png',
'persevere': 'persevere.png',
'joy': 'joy.png',
'astonished': 'astonished.png',
'scream': 'scream.png',
'neckbeard': 'neckbeard.png',
'tired_face': 'tired_face.png',
'angry': 'angry.png',
'rage': 'rage.png',
'triumph': 'triumph.png',
'sleepy': 'sleepy.png',
'yum': 'yum.png',
'mask': 'mask.png',
'sunglasses': 'sunglasses.png',
'dizzy_face': 'dizzy_face.png',
'imp': 'imp.png',
'smiling_imp': 'smiling_imp.png',
'neutral_face': 'neutral_face.png',
'no_mouth': 'no_mouth.png',
'innocent': 'innocent.png',
'baby_chick': 'baby_chick.png',
'hatched_chick': 'hatched_chick.png',
'hatching_chick': 'hatching_chick.png',
'chicken': 'chicken.png',
'turtle': 'turtle.png',
'alien': 'alien.png',
'yellow_heart': 'yellow_heart.png',
'blue_heart': 'blue_heart.png',
'purple_heart': 'purple_heart.png',
'heart': 'heart.png',
'green_heart': 'green_heart.png',
'broken_heart': 'broken_heart.png',
'heartbeat': 'heartbeat.png',
'heartpulse': 'heartpulse.png',
'two_hearts': 'two_hearts.png',
'revolving_hearts': 'revolving_hearts.png',
'cupid': 'cupid.png',
'sparkling_heart': 'sparkling_heart.png',
'sparkles': 'sparkles.png',
'star': 'star.png',
'star2': 'star2.png',
'dizzy': 'dizzy.png',
'boom': 'boom.png',
'collision': 'collision.png',
'anger': 'anger.png',
'exclamation': 'exclamation.png',
'question': 'question.png',
'grey_exclamation': 'grey_exclamation.png',
'grey_question': 'grey_question.png',
'zzz': 'zzz.png',
'dash': 'dash.png',
'sweat_drops': 'sweat_drops.png',
'notes': 'notes.png',
'musical_note': 'musical_note.png',
'fire': 'fire.png',
'thumbsup': 'thumbsup.png',
'thumbsdown': 'thumbsdown.png',
'ok_hand': 'ok_hand.png',
'punch': 'punch.png',
'fist': 'fist.png',
'v': 'v.png',
'wave': 'wave.png',
'hand': 'hand.png',
'raised_hand': 'raised_hand.png',
'open_hands': 'open_hands.png',
'point_up': 'point_up.png',
'point_down': 'point_down.png',
'point_left': 'point_left.png',
'point_right': 'point_right.png',
'raised_hands': 'raised_hands.png',
'pray': 'pray.png',
'point_up_2': 'point_up_2.png',
'clap': 'clap.png',
'muscle': 'muscle.png',
'metal': 'metal.png',
'walking': 'walking.png',
'runner': 'runner.png',
'running': 'running.png',
'couple': 'couple.png',
'family': 'family.png',
'two_men_holding_hands': 'two_men_holding_hands.png',
'two_women_holding_hands': 'two_women_holding_hands.png',
'ok_woman': 'ok_woman.png',
'no_good': 'no_good.png',
'information_desk_person': 'information_desk_person.png',
'bride_with_veil': 'bride_with_veil.png',
'person_with_pouting_face': 'person_with_pouting_face.png',
'person_frowning': 'person_frowning.png',
'bow': 'bow.png',
'couplekiss': 'couplekiss.png',
'couple_with_heart': 'couple_with_heart.png',
'massage': 'massage.png',
'haircut': 'haircut.png',
'nail_care': 'nail_care.png',
'boy': 'boy.png',
'girl': 'girl.png',
'woman': 'woman.png',
'man': 'man.png',
'baby': 'baby.png',
'older_woman': 'older_woman.png',
'older_man': 'older_man.png',
'person_with_blond_hair': 'person_with_blond_hair.png',
'man_with_gua_pi_mao': 'man_with_gua_pi_mao.png',
'man_with_turban': 'man_with_turban.png',
'construction_worker': 'construction_worker.png',
'cop': 'cop.png',
'angel': 'angel.png',
'princess': 'princess.png',
'smiley_cat': 'smiley_cat.png',
'smile_cat': 'smile_cat.png',
'heart_eyes_cat': 'heart_eyes_cat.png',
'kissing_cat': 'kissing_cat.png',
'smirk_cat': 'smirk_cat.png',
'scream_cat': 'scream_cat.png',
'crying_cat_face': 'crying_cat_face.png',
'joy_cat': 'joy_cat.png',
'pouting_cat': 'pouting_cat.png',
'japanese_ogre': 'japanese_ogre.png',
'japanese_goblin': 'japanese_goblin.png',
'see_no_evil': 'see_no_evil.png',
'hear_no_evil': 'hear_no_evil.png',
'speak_no_evil': 'speak_no_evil.png',
'guardsman': 'guardsman.png',
'skull': 'skull.png',
'feet': 'feet.png',
'lips': 'lips.png',
'kiss': 'kiss.png',
'droplet': 'droplet.png',
'ear': 'ear.png',
'eyes': 'eyes.png',
'nose': 'nose.png',
'tongue': 'tongue.png',
'love_letter': 'love_letter.png',
'bust_in_silhouette': 'bust_in_silhouette.png',
'busts_in_silhouette': 'busts_in_silhouette.png'};
var ep = new EmojiPicker();
ep.editor.focus();
ep.editor.onkeypress = function () {
document.getElementById('result').textContent = ep.getValue();
document.getElementById('renderTxt').textContent = ep.render(ep.getValue());
document.getElementById('render').innerHTML = ep.render(ep.getValue());
};
}
</script>
</head>
<body onload="initEmojiPicker()">
<h1>EmojiPicker - by LaCodon</h1>
<div class="center">
<h2>Demo</h2>
<p>
Enter a text underneath this paragraph and add some Emojis to see
what output the <code>EmojiPicker()</code> class gives.
</p>
</div>
<div class="center">
<div id="emojiArea"></div>
</div>
<div class="center">
<h3>Result of <code>getValue()</code></h3>
<div id="result"></div>
<small><i>Updates only while typing text, not by clicking an emoji.</i></small>
</div>
<div class="center">
<h3>Result of <code>render()</code></h3>
<div id="renderTxt"></div>
<h4>As HTML again</h4>
<div id="render"></div>
</div>
<div class="center">
<h2>How to use EmojiPicker.js</h2>
<span>EmojiPicker.js does <b>not</b> require jQuery!</span>
<h3 id="minimal">Minimal</h3>
<p>Store emojis, for example as <code>*.png</code> files, in the <code>/emojis/</code> folder</p>
<blockquote>
⎮- index.html<br>
⎮- EmojiPicker.js<br>
⎮- EmojiPicker.css<br>
⎮- emojis/<br>
⎮- bowtie.png<br>
⎮- smile.png<br>
⎮- laughing.png<br>
⎮- blush.png<br>
⎮- smiley.png<br>
</blockquote>
<p>Include CSS an JavaScript files.</p>
<blockquote>
<script src="EmojiPicker.js"></script><br>
<link rel="stylesheet" type="text/css" href="EmojiPicker.css">
</blockquote>
<p>Add the following JavaScript Code to your index.html</p>
<blockquote>
function initEmojiPicker() {<br>
EmojiPickerSettings.path = 'emojis/';<br>
EmojiPickerSettings.icons = {'bowtie': 'bowtie.png',<br>
'smile': 'smile.png',<br>
'laughing': 'laughing.png',<br>
'blush': 'blush.png',<br>
'smiley': 'smiley.png'};<br>
<br>
var ep = new EmojiPicker();<br>
}
</blockquote>
<p>And the following HTML body tag</p>
<blockquote>
<body onload="initEmojiPicker()"><br>
<div id="emojiArea"></div><br>
</body>
</blockquote>
<h3>Advanced</h3>
<h4>Including emojis</h4>
<p>
Save all emojis in a folder and add each one with a shortcut code and
it's filename to <code>EmojiPickerSettings.icons</code> as seen
in <a href="#minimal">Minimal section</a> in the following format:
</p>
<blockquote>
{'<i>shortcut</i>': '<i>filename.png</i>'};
</blockquote>
<p>
You can also copy the <code>/emojis/</code> folder from the source
and include this <a href="snippet.txt">JavaScript Snippet</a> after including <code>EmojiPicker.js</code>
in your HTML.
</p>
<p>
The last step you have to do is to tell EmojiPicker.js where to find
the the emoji images. To do so, replace <i>path/to/png/</i> with yours.
</p>
<blockquote>
EmojiPickerSettings.path = '<i>path/to/png/</i>';
</blockquote>
<span>Sometimes it's necessary to also set <code>EmojiPickerSettings.renderPath</code>.
For example if you store your JavaScript files in a <code>/js/</code> folder.</span>
<blockquote>
EmojiPickerSettings.path = '<i>../path/to/png/</i>';<br>
EmojiPickerSettings.renderPath = '<i>path/to/png/</i>';
</blockquote>
<h4>Determine WYSIWYG div</h4>
<p>The div which to use as the editor needs the id <code>emojiArea</code></p>
<blockquote>
<div id="emojiArea"></div>
</blockquote>
<p>You can either use the original CSS file or create an own one. The following
list shows each element and it's selector.</p>
<ul>
<li><b>#emojiArea</b> - The editor div</li>
<li><b>#emojiMenu</b> - The emoji menu wrapper</li>
<li><b>#emojiMenu > div</b> - The emoji icon list</li>
<li><b>#emojiMenu img, #emojiArea img</b> - The img tags of WYSIWYG emojis</li>
<li><b>#emojiMenu a</b> - The link behind the emoji's icon</li>
<li><b>#emojiMenuBtnWrapper</b> - The wrapper of the button which opens the menu</li>
<li><b>#emojiMenuBtn</b> - The button himself</li>
</ul>
<span>If you face a selector issue because your page already uses the selectors of
EmojiPicker.js, you can set a prefix:</span>
<blockquote>
EmojiPickerSettings.prefix = '<i>yourPrefix_</i>';
</blockquote>
<p>Don't forget to add the prefix in your CSS!</p>
<span class="red">
EmojiPicker.js <b>always</b> requires this CSS:<br><br>
<i>
.visible { display: block; }<br>
.hidden { display: none; }
</i>
</span>
</div>
</body>
</html>