# j-Emoji

> j-Emoji: Using UTF emoji; Personal history with frequently used emoticons

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 63148ed1835fb8a2760513e89d5e83a91adc54e4d7c7499bea812eb132bada1a
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- Using UTF emoji
- Personal history with frequently used emoticons
- Great search tool
- Changeable skin tones

__Configuration__:

- `categories {String}` change emoticons in categories. Use unicode without special characters (default: `128342,128578,128161,127944,128008,128690,128172,127828,127937`)
- `height {Number}` set component height (default: `295`)
- `history {Number}` history limit for frequently used emoticons (default: `49`)
- `empty {String}` a message when no emoticons are found  (default: `No emoji match your search`)
- `emptyemoji {Number}` change emoticon when no emoticons are found. Use unicode without special characters (default: `128557`)
- `speed {Number}` scroll speed in ms (default: `500`)
- `footer {String}` footer message (default: `Choose skin tone`)
- `toneemoji {String}` skin tones emoticon. Use unicode without special characters (default: `9995`)
- `search {String}` a placeholder for search field (default: `Search`)

__Good to know__:

- This component implements `FUNC.parseASCI(string)` function. The function will parse string and transform text like `:D` or `:joy:` into UTF emoticons.

```javascript
var message = 'This one was good. :joy: See you soon :P';
console.log(FUNC.parseASCI(message)); // This one was good. &#128514; See you soon &#128539;
```

## Usage

```javascript
var opt = {};

// opt.offsetX {Number}    : adds X offset (default: 0)
// opt.offsetY {Number}    : adds Y offset (default: 0)
// opt.align {String}      : align `left` (default), `center` or `right`
// opt.position {String}   : position `top` (default) or `bottom`

opt.element = YOUR_ELEMENT;
// or if you want to use a fixed position:
// opt.x {Number}          : `x` position
// opt.y {Number}          : `y` position

opt.callback = function(emoji) {
	console.log(emoji); // callback parameter has String.fromCodePoint() value
};

SETTER('emoji/show', opt);
```

Use it with `<ui-component name="emoji">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Denis Granec. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="emoji"></ui-component>

<div class="container">
	<div class="row">
		<div class="col-xs-4 col-xs-offset-4" style="text-align:center">
			<a href="javascript:void(0)" style="color:black;font-size:30px"><i class="ti ti-smile"></i></a>
		</div>
	</div>
</div>

<script>
$(document).on('click', 'a', function() {
	var opt = {};
	opt.align = 'center';
	opt.position = 'top';
	opt.element = this;
	opt.callback = function(selected) {
		console.log(selected);
	};
	SETTER('emoji/show', opt);
	console.log(FUNC.parseASCII('This one was good. :joy: See you soon :P'));
});
</script>
```
