Benissou / EmoJV

// ==UserScript==
// @name         EmoJV
// @author       Admonitio
// @description  Emoji
// @include      http://www.jeuxvideo.com/forums*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_notification
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText
// @grant        GM_getResourceURL
// @version      0.2.0
// @icon         http://image.noelshack.com/fichiers/2016/50/1481684643-benissou.gif 
// @copyright    2016+, Admonitio
// ==/UserScript==


/*jshint multistr: true */

var emo_smile = [
  "๐Ÿ˜€",
  "๐Ÿ˜",
  "๐Ÿ˜‚",
  "๐Ÿ˜ƒ",
  "๐Ÿ˜„",
  "๐Ÿ˜…",
  "๐Ÿ˜†",
  "๐Ÿ˜‡",
  "๐Ÿ˜ˆ",
  "๐Ÿ˜‰",
  "๐Ÿ˜Š",
  "๐Ÿ˜‹",
  "๐Ÿ˜Œ",
  "๐Ÿ˜",
  "๐Ÿ˜Ž",
  "๐Ÿ˜",
  "๐Ÿ˜",
  "๐Ÿ˜‘",
  "๐Ÿ˜’",
  "๐Ÿ˜“",
  "๐Ÿ˜”",
  "๐Ÿ˜•",
  "๐Ÿ˜–",
  "๐Ÿ˜—",
  "๐Ÿ˜˜",
  "๐Ÿ˜™",
  "๐Ÿ˜š",
  "๐Ÿ˜›",
  "๐Ÿ˜œ",
  "๐Ÿ˜",
  "๐Ÿ˜ž",
  "๐Ÿ˜Ÿ",
  "๐Ÿ˜ ",
  "๐Ÿ˜ก",
  "๐Ÿ˜ข",
  "๐Ÿ˜ฃ",
  "๐Ÿ˜ค",
  "๐Ÿ˜ฅ",
  "๐Ÿ˜ฆ",
  "๐Ÿ˜ง",
  "๐Ÿ˜จ",
  "๐Ÿ˜ฉ",
  "๐Ÿ˜ช",
  "๐Ÿ˜ซ",
  "๐Ÿ˜ฌ",
  "๐Ÿ˜ญ",
  "๐Ÿ˜ฎ",
  "๐Ÿ˜ฏ",
  "๐Ÿ˜ฐ",
  "๐Ÿ˜ฑ",
  "๐Ÿ˜ฒ",
  "๐Ÿ˜ณ",
  "๐Ÿ˜ด",
  "๐Ÿ˜ต",
  "๐Ÿ˜ถ",
  "๐Ÿ˜ท",
  "๐Ÿ˜ธ",
  "๐Ÿ˜น",
  "๐Ÿ˜บ",
  "๐Ÿ˜ป",
  "๐Ÿ˜ผ",
  "๐Ÿ˜ฝ",
  "๐Ÿ˜พ",
  "๐Ÿ˜ฟ",
  "๐Ÿ™€",
  "๐Ÿ™",
  "๐Ÿ™‚",
  "๐Ÿ™ƒ",
  "๐Ÿ™„"];
 
 var emo_astre = [  
  "๐ŸŒ€",
  "๐ŸŒ",
  "๐ŸŒ‚",
  "๐ŸŒƒ",
  "๐ŸŒ„",
  "๐ŸŒ…",
  "๐ŸŒ†",
  "๐ŸŒ‡",
  "๐ŸŒˆ",
  "๐ŸŒ‰",
  "๐ŸŒŠ",
  "๐ŸŒ‹",
  "๐ŸŒŒ",
  "๐ŸŒ",
  "๐ŸŒŽ",
  "๐ŸŒ",
  "๐ŸŒ",
  "๐ŸŒ‘",
  "๐ŸŒ’",
  "๐ŸŒ“",
  "๐ŸŒ”",
  "๐ŸŒ•",
  "๐ŸŒ–",
  "๐ŸŒ—",
  "๐ŸŒ˜",
  "๐ŸŒ™",
  "๐ŸŒš",
  "๐ŸŒ›",
  "๐ŸŒœ",
  "๐ŸŒ",
  "๐ŸŒž",
  "๐ŸŒŸ",
  "๐ŸŒ ",
  "๐ŸŒก",
  "๐ŸŒค",
  "๐ŸŒฅ",
  "๐ŸŒฆ",
  "๐ŸŒง",
  "๐ŸŒจ",
  "๐ŸŒฉ",
  "๐ŸŒช",
  "๐ŸŒซ",
  "๐ŸŒฌ"];
 
  var emo_eat = [
  "๐ŸŒญ",
  "๐ŸŒฎ",
  "๐ŸŒฏ",
  "๐ŸŒฐ",
  "๐ŸŒฑ",
  "๐ŸŒฒ",
  "๐ŸŒณ",
  "๐ŸŒด",
  "๐ŸŒต",
  "๐ŸŒถ",
  "๐ŸŒท",
  "๐ŸŒธ",
  "๐ŸŒน",
  "๐ŸŒบ",
  "๐ŸŒป",
  "๐ŸŒผ",
  "๐ŸŒฝ",
  "๐ŸŒพ",
  "๐ŸŒฟ",
  "๐Ÿ€",
  "๐Ÿ",
  "๐Ÿ‚",
  "๐Ÿƒ",
  "๐Ÿ„",
  "๐Ÿ…",
  "๐Ÿ†",
  "๐Ÿ‡",
  "๐Ÿˆ",
  "๐Ÿ‰",
  "๐ŸŠ",
  "๐Ÿ‹",
  "๐ŸŒ",
  "๐Ÿ",
  "๐ŸŽ",
  "๐Ÿ",
  "๐Ÿ",
  "๐Ÿ‘",
  "๐Ÿ’",
  "๐Ÿ“",
  "๐Ÿ”",
  "๐Ÿ•",
  "๐Ÿ–",
  "๐Ÿ—",
  "๐Ÿ˜",
  "๐Ÿ™",
  "๐Ÿš",
  "๐Ÿ›",
  "๐Ÿœ",
  "๐Ÿ",
  "๐Ÿž",
  "๐ŸŸ",
  "๐Ÿ ",
  "๐Ÿก",
  "๐Ÿข",
  "๐Ÿฃ",
  "๐Ÿค",
  "๐Ÿฅ",
  "๐Ÿฆ",
  "๐Ÿง",
  "๐Ÿจ",
  "๐Ÿฉ",
  "๐Ÿช",
  "๐Ÿซ",
  "๐Ÿฌ",
  "๐Ÿญ",
  "๐Ÿฎ",
  "๐Ÿฏ",
  "๐Ÿฐ",
  "๐Ÿฑ",
  "๐Ÿฒ",
  "๐Ÿณ",
  "๐Ÿด",
  "๐Ÿต",
  "๐Ÿถ",
  "๐Ÿท",
  "๐Ÿธ",
  "๐Ÿน",
  "๐Ÿบ",
  "๐Ÿป",
  "๐Ÿผ",
  "๐Ÿฝ",
  "๐Ÿพ",
  "๐Ÿฟ",
  "๐ŸŽ€",
  "๐ŸŽ",
  "๐ŸŽ‚"];
 
  var emo_act = [
  "๐ŸŽƒ",
  "๐ŸŽ„",
  "๐ŸŽ…๐Ÿป",
  "๐ŸŽ…๐Ÿผ",
  "๐ŸŽ…๐Ÿฝ",
  "๐ŸŽ…๐Ÿพ",
  "๐ŸŽ…๐Ÿฟ",
  "๐ŸŽ…",
  "๐ŸŽ†",
  "๐ŸŽ‡",
  "๐ŸŽˆ",
  "๐ŸŽ‰",
  "๐ŸŽŠ",
  "๐ŸŽ‹",
  "๐ŸŽŒ",
  "๐ŸŽ",
  "๐ŸŽŽ",
  "๐ŸŽ",
  "๐ŸŽ",
  "๐ŸŽ‘",
  "๐ŸŽ’",
  "๐ŸŽ“",
  "๐ŸŽ–",
  "๐ŸŽ—",
  "๐ŸŽ™",
  "๐ŸŽš",
  "๐ŸŽ›",
  "๐ŸŽž",
  "๐ŸŽŸ",
  "๐ŸŽ ",
  "๐ŸŽก",
  "๐ŸŽข",
  "๐ŸŽฃ",
  "๐ŸŽค",
  "๐ŸŽฅ",
  "๐ŸŽฆ",
  "๐ŸŽง",
  "๐ŸŽจ",
  "๐ŸŽฉ",
  "๐ŸŽช",
  "๐ŸŽซ",
  "๐ŸŽฌ",
  "๐ŸŽญ",
  "๐ŸŽฎ",
  "๐ŸŽฏ",
  "๐ŸŽฐ",
  "๐ŸŽฑ",
  "๐ŸŽฒ",
  "๐ŸŽณ",
  "๐ŸŽด",
  "๐ŸŽต",
  "๐ŸŽถ",
  "๐ŸŽท",
  "๐ŸŽธ",
  "๐ŸŽน",
  "๐ŸŽบ",
  "๐ŸŽป",
  "๐ŸŽผ",
  "๐ŸŽฝ",
  "๐ŸŽพ",
  "๐ŸŽฟ",
  "๐Ÿ€",
  "๐Ÿ",
  "๐Ÿ‚๐Ÿป",
  "๐Ÿ‚๐Ÿผ",
  "๐Ÿ‚๐Ÿฝ",
  "๐Ÿ‚๐Ÿพ",
  "๐Ÿ‚๐Ÿฟ",
  "๐Ÿ‚",
  "๐Ÿƒ๐Ÿปโ€โ™€๏ธ",
  "๐Ÿƒ๐Ÿปโ€โ™‚๏ธ",
  "๐Ÿƒ๐Ÿป",
  "๐Ÿƒ๐Ÿผโ€โ™€๏ธ",
  "๐Ÿƒ๐Ÿผโ€โ™‚๏ธ",
  "๐Ÿƒ๐Ÿผ",
  "๐Ÿƒ๐Ÿฝโ€โ™€๏ธ",
  "๐Ÿƒ๐Ÿฝโ€โ™‚๏ธ",
  "๐Ÿƒ๐Ÿฝ",
  "๐Ÿƒ๐Ÿพโ€โ™€๏ธ",
  "๐Ÿƒ๐Ÿพโ€โ™‚๏ธ",
  "๐Ÿƒ๐Ÿพ",
  "๐Ÿƒ๐Ÿฟโ€โ™€๏ธ",
  "๐Ÿƒ๐Ÿฟโ€โ™‚๏ธ",
  "๐Ÿƒ๐Ÿฟ",
  "๐Ÿƒโ€โ™€๏ธ",
  "๐Ÿƒโ€โ™‚๏ธ",
  "๐Ÿƒ",
  "๐Ÿ„๐Ÿปโ€โ™€๏ธ",
  "๐Ÿ„๐Ÿปโ€โ™‚๏ธ",
  "๐Ÿ„๐Ÿป",
  "๐Ÿ„๐Ÿผโ€โ™€๏ธ",
  "๐Ÿ„๐Ÿผโ€โ™‚๏ธ",
  "๐Ÿ„๐Ÿผ",
  "๐Ÿ„๐Ÿฝโ€โ™€๏ธ",
  "๐Ÿ„๐Ÿฝโ€โ™‚๏ธ",
  "๐Ÿ„๐Ÿฝ",
  "๐Ÿ„๐Ÿพโ€โ™€๏ธ",
  "๐Ÿ„๐Ÿพโ€โ™‚๏ธ",
  "๐Ÿ„๐Ÿพ",
  "๐Ÿ„๐Ÿฟโ€โ™€๏ธ",
  "๐Ÿ„๐Ÿฟโ€โ™‚๏ธ",
  "๐Ÿ„๐Ÿฟ",
  "๐Ÿ„โ€โ™€๏ธ",
  "๐Ÿ„โ€โ™‚๏ธ",
  "๐Ÿ„",
  "๐Ÿ…",
  "๐Ÿ†",
  "๐Ÿ‡๐Ÿป",
  "๐Ÿ‡๐Ÿผ",
  "๐Ÿ‡๐Ÿฝ",
  "๐Ÿ‡๐Ÿพ",
  "๐Ÿ‡๐Ÿฟ",
  "๐Ÿ‡",
  "๐Ÿˆ",
  "๐Ÿ‰",
  "๐ŸŠ๐Ÿปโ€โ™€๏ธ",
  "๐ŸŠ๐Ÿปโ€โ™‚๏ธ",
  "๐ŸŠ๐Ÿป",
  "๐ŸŠ๐Ÿผโ€โ™€๏ธ",
  "๐ŸŠ๐Ÿผโ€โ™‚๏ธ",
  "๐ŸŠ๐Ÿผ",
  "๐ŸŠ๐Ÿฝโ€โ™€๏ธ",
  "๐ŸŠ๐Ÿฝโ€โ™‚๏ธ",
  "๐ŸŠ๐Ÿฝ",
  "๐ŸŠ๐Ÿพโ€โ™€๏ธ",
  "๐ŸŠ๐Ÿพโ€โ™‚๏ธ",
  "๐ŸŠ๐Ÿพ",
  "๐ŸŠ๐Ÿฟโ€โ™€๏ธ",
  "๐ŸŠ๐Ÿฟโ€โ™‚๏ธ",
  "๐ŸŠ๐Ÿฟ",
  "๐ŸŠโ€โ™€๏ธ",
  "๐ŸŠโ€โ™‚๏ธ",
  "๐ŸŠ",
  "๐Ÿ‹๐Ÿปโ€โ™€๏ธ",
  "๐Ÿ‹๐Ÿปโ€โ™‚๏ธ",
  "๐Ÿ‹๐Ÿป",
  "๐Ÿ‹๐Ÿผโ€โ™€๏ธ",
  "๐Ÿ‹๐Ÿผโ€โ™‚๏ธ",
  "๐Ÿ‹๐Ÿผ",
  "๐Ÿ‹๐Ÿฝโ€โ™€๏ธ",
  "๐Ÿ‹๐Ÿฝโ€โ™‚๏ธ",
  "๐Ÿ‹๐Ÿฝ",
  "๐Ÿ‹๐Ÿพโ€โ™€๏ธ",
  "๐Ÿ‹๐Ÿพโ€โ™‚๏ธ",
  "๐Ÿ‹๐Ÿพ",
  "๐Ÿ‹๐Ÿฟโ€โ™€๏ธ",
  "๐Ÿ‹๐Ÿฟโ€โ™‚๏ธ",
  "๐Ÿ‹๐Ÿฟ",
  "๐Ÿ‹๏ธโ€โ™€๏ธ",
  "๐Ÿ‹๏ธโ€โ™‚๏ธ",
  "๐Ÿ‹",
  "๐ŸŒ๐Ÿปโ€โ™€๏ธ",
  "๐ŸŒ๐Ÿปโ€โ™‚๏ธ",
  "๐ŸŒ๐Ÿป",
  "๐ŸŒ๐Ÿผโ€โ™€๏ธ",
  "๐ŸŒ๐Ÿผโ€โ™‚๏ธ",
  "๐ŸŒ๐Ÿผ",
  "๐ŸŒ๐Ÿฝโ€โ™€๏ธ",
  "๐ŸŒ๐Ÿฝโ€โ™‚๏ธ",
  "๐ŸŒ๐Ÿฝ",
  "๐ŸŒ๐Ÿพโ€โ™€๏ธ",
  "๐ŸŒ๐Ÿพโ€โ™‚๏ธ",
  "๐ŸŒ๐Ÿพ",
  "๐ŸŒ๐Ÿฟโ€โ™€๏ธ",
  "๐ŸŒ๐Ÿฟโ€โ™‚๏ธ",
  "๐ŸŒ๐Ÿฟ",
  "๐ŸŒ๏ธโ€โ™€๏ธ",
  "๐ŸŒ๏ธโ€โ™‚๏ธ",
  "๐ŸŒ",
  "๐Ÿ",
  "๐ŸŽ",
  "๐Ÿ",
  "๐Ÿ",
  "๐Ÿ‘",
  "๐Ÿ’",
  "๐Ÿ“"];
 
  var emo_animal = [
    "๐Ÿ€",
  "๐Ÿ",
  "๐Ÿ‚",
  "๐Ÿƒ",
  "๐Ÿ„",
  "๐Ÿ…",
  "๐Ÿ†",
  "๐Ÿ‡",
  "๐Ÿˆ",
  "๐Ÿ‰",
  "๐ŸŠ",
  "๐Ÿ‹",
  "๐ŸŒ",
  "๐Ÿ",
  "๐ŸŽ",
  "๐Ÿ",
  "๐Ÿ",
  "๐Ÿ‘",
  "๐Ÿ’",
  "๐Ÿ“",
  "๐Ÿ”",
  "๐Ÿ•",
  "๐Ÿ–",
  "๐Ÿ—",
  "๐Ÿ˜",
  "๐Ÿ™",
  "๐Ÿš",
  "๐Ÿ›",
  "๐Ÿœ",
  "๐Ÿ",
  "๐Ÿž",
  "๐ŸŸ",
  "๐Ÿ ",
  "๐Ÿก",
  "๐Ÿข",
  "๐Ÿฃ",
  "๐Ÿค",
  "๐Ÿฅ",
  "๐Ÿฆ",
  "๐Ÿง",
  "๐Ÿจ",
  "๐Ÿฉ",
  "๐Ÿช",
  "๐Ÿซ",
  "๐Ÿฌ",
  "๐Ÿญ",
  "๐Ÿฎ",
  "๐Ÿฏ",
  "๐Ÿฐ",
  "๐Ÿฑ",
  "๐Ÿฒ",
  "๐Ÿณ",
  "๐Ÿด",
  "๐Ÿต",
  "๐Ÿถ",
  "๐Ÿท",
  "๐Ÿธ",
  "๐Ÿน",
  "๐Ÿบ",
  "๐Ÿป",
  "๐Ÿผ",
  "๐Ÿฝ",
  "๐Ÿพ",
  "๐Ÿฟ"];
 
  var emo_build = [
  "๐Ÿ”",
  "๐Ÿ•",
  "๐Ÿ–",
  "๐Ÿ—",
  "๐Ÿ˜",
  "๐Ÿ™",
  "๐Ÿš",
  "๐Ÿ›",
  "๐Ÿœ",
  "๐Ÿ",
  "๐Ÿž",
  "๐ŸŸ",
  "๐Ÿ ",
  "๐Ÿก",
  "๐Ÿข",
  "๐Ÿฃ",
  "๐Ÿค",
  "๐Ÿฅ",
  "๐Ÿฆ",
  "๐Ÿง",
  "๐Ÿจ",
  "๐Ÿฉ",
  "๐Ÿช",
  "๐Ÿซ",
  "๐Ÿฌ",
  "๐Ÿญ",
  "๐Ÿฎ",
  "๐Ÿฏ",
  "๐Ÿฐ"];
  
 var emo_obj = [
 "โŒš๏ธ","๐Ÿ“ฑ","๐Ÿ“ฒ","๐Ÿ’ป","โฐ","โณ","โŒ›๏ธ","๐Ÿ“ท","๐Ÿ“น","๐ŸŽฅ","๐Ÿ“บ","๐Ÿ“ป","๐Ÿ“Ÿ","๐Ÿ“ž","โ˜Ž๏ธ","๐Ÿ“ ","๐Ÿ’ฝ","๐Ÿ’พ","๐Ÿ’ฟ","๐Ÿ“€","๐Ÿ“ผ","๐Ÿ”‹","๐Ÿ”Œ","๐Ÿ’ก","๐Ÿ”ฆ","๐Ÿ“ก","๐Ÿ’ณ","๐Ÿ’ธ","๐Ÿ’ฐ","๐Ÿ’Ž","๐ŸŒ‚","๐Ÿ‘","๐Ÿ‘›","๐Ÿ‘œ","๐Ÿ’ผ","๐ŸŽ’","๐Ÿ’„","๐Ÿ‘“","๐Ÿ‘’","๐Ÿ‘ก","๐Ÿ‘ ","๐Ÿ‘ข","๐Ÿ‘ž","๐Ÿ‘Ÿ","๐Ÿ‘™","๐Ÿ‘—","๐Ÿ‘˜","๐Ÿ‘š","๐Ÿ‘•","๐Ÿ‘”","๐Ÿ‘–","๐Ÿšช","๐Ÿšฟ","๐Ÿ›","๐Ÿšฝ","๐Ÿ’ˆ","๐Ÿ’‰","๐Ÿ’Š","๐Ÿ”ฌ","๐Ÿ”ญ","๐Ÿ”ฎ","๐Ÿ”ง","๐Ÿ”ช","๐Ÿ”ฉ","๐Ÿ”จ","๐Ÿ’ฃ","๐Ÿšฌ","๐Ÿ”ซ","๐Ÿ”–","๐Ÿ“ฐ","๐Ÿ”‘","โœ‰๏ธ","๐Ÿ“ฉ","๐Ÿ“จ","๐Ÿ“ง","๐Ÿ“ฅ","๐Ÿ“ค","๐Ÿ“ฆ","๐Ÿ“ฏ","๐Ÿ“ฎ","๐Ÿ“ช","๐Ÿ“ซ","๐Ÿ“ฌ","๐Ÿ“ญ","๐Ÿ“„","๐Ÿ“ƒ","๐Ÿ“‘","๐Ÿ“ˆ","๐Ÿ“‰","๐Ÿ“Š","๐Ÿ“…","๐Ÿ“†","๐Ÿ”…","๐Ÿ”†","๐Ÿ“œ","๐Ÿ“‹","๐Ÿ“–","๐Ÿ““","๐Ÿ“”","๐Ÿ“’","๐Ÿ“•","๐Ÿ“—","๐Ÿ“˜","๐Ÿ“™","๐Ÿ“š","๐Ÿ“‡","๐Ÿ”—","๐Ÿ“Ž","๐Ÿ“Œ","โœ‚๏ธ","๐Ÿ“","๐Ÿ“","๐Ÿ“","๐Ÿšฉ","๐Ÿ“","๐Ÿ“‚","โœ’๏ธ","โœ๏ธ","๐Ÿ“","๐Ÿ”","๐Ÿ”","๐Ÿ”’","๐Ÿ”“","๐Ÿ“ฃ","๐Ÿ“ข","๐Ÿ”ˆ","๐Ÿ”‰","๐Ÿ”Š","๐Ÿ”‡","๐Ÿ’ค","๐Ÿ””","๐Ÿ”•","๐Ÿ’ญ","๐Ÿ’ฌ","๐Ÿšธ","๐Ÿ”","๐Ÿ”Ž","๐Ÿšซ","โ›”๏ธ","๐Ÿ“›","๐Ÿšท","๐Ÿšฏ","๐Ÿšณ","๐Ÿšฑ","๐Ÿ“ต","๐Ÿ”ž"];; 


(function() {
    'use strict';

	// Titre liste
		$( '<select id="titre_tag" style="margin-bottom:10px;"> \
  <option value="">-</option>\
  <option value="โš ๏ธ[ALERTE]">โš ๏ธ[Alerte]</option>\
  <option value="๐Ÿ“ท[PHOTO]">๐Ÿ“ท[Photo]</option>\
  <option value="๐Ÿ“บ[VIDEO]">๐Ÿ“บ[Vidรฉo]</option>\
  <option value="๐Ÿ‘ง[FILLE]">๐Ÿ‘ง[Fille]</option>\
  <option value="๐Ÿ“‹[SONDAGE]">๐Ÿ“‹[Sondage]</option>\
  <option value="๐Ÿ˜€[RISITAS]">๐Ÿ˜€[Risitas]</option>\
  <option value="โš–๏ธ[DILEMME]">โš–๏ธ[Dilemme]</option>\
  </select> ' ).insertBefore( "#titre_topic" );

	document.getElementsByClassName('btn btn-poster-msg datalayer-push')[0].addEventListener('click', function () {
		
		var e = document.getElementById("titre_tag");
		var strUser = e.options[e.selectedIndex].value;
		var normaltext=document.getElementById('titre_topic').value;
		document.getElementById('titre_topic').value = strUser  + " " + normaltext ;
		
	});
	
	
	
	
	
	
	
	GM_addStyle('#jv-emoji .modal-generic-main {width: 630px;margin-top: 184.5px !important;}');
	GM_addStyle('.emo {cursor: pointer;}');
	GM_addStyle('#emojiclose {cursor: pointer;}');

	var node = document.createElement("button");   
	node.className =  "btn btn-jv-editor-toolbar";	
	node.type ="button";
	node.name ="Emoji";
	node.id = "emoji";
	document.getElementsByClassName("btn-group")[2].appendChild(node); 

	$('#emoji').append('<span  style="color:#a90;">๐Ÿ˜€</span>');	
	 $('body').append('<div class="modal-generic modal-generic-scroll active" id="jv-emoji" style="display: none;">\
	<div class="modal-generic-main" style="margin-top: 0px;">\
	<a  class="modal-generic-close" id="emojiclose" ><span class="icon-close-popin-jv"></span></a>\
	<div class="modal-generic-header">Emoji</div>\
	<div class="modal-generic-content" id="emoji-list">\
	<p><strong>Pour insรฉrer un emoji, cliquez dessus.</strong></p>\
	</div></div></div>');	

	
	function appendArray (array)
	{
		var list = ""; 
		for(var i=0;i<array.length;i++)
		{
			list+= "<a class=\"emo\">" + array[i] + "</a>";
		}
		$('#emoji-list').append("<p style=\"font-size:24px !important;\">"+ list + "</p>"); 	 

	
	}

	
	$('#emoji-list').append("<p style=\"text-align: center;\">Visage</p>"); 	
	appendArray(emo_smile);
		$('#emoji-list').append("<p style=\"text-align: center;\">Astre</p>"); 
	appendArray(emo_astre);
		$('#emoji-list').append("<p style=\"text-align: center;\">Nourriture</p>"); 
	appendArray(emo_eat);
	//appendArray(emo_act);
		$('#emoji-list').append("<p style=\"text-align: center;\">Construction</p>"); 
	appendArray(emo_build);
		$('#emoji-list').append("<p style=\"text-align: center;\">Animal</p>"); 
	appendArray(emo_animal);
		$('#emoji-list').append("<p style=\"text-align: center;\">Objet</p>"); 
	appendArray(emo_obj);



	document.getElementById('emoji').addEventListener('click', function() {popup("open");});
	document.getElementById('emojiclose').addEventListener('click', function() {popup("close");});

	var classname = document.getElementsByClassName("emo");

	for (var i =0; i < classname.length-1; i++) {
		classname[i].addEventListener('click', function() {addemo(this);});
	}


	function addemo (ele)
	{	
		popup("close");
		elem.value = elem.value.substring(0,start) + ele.innerHTML + elem.value.substring(end,len);
	}

	var elem = document.getElementById('message_topic');
    var start = elem.selectionStart;
    var end = elem.selectionEnd;
    var len = elem.value.length;
    var sel_txt = elem.value.substring(start,end);
	
	
	// POPUP
	function popup (type)
	{
		if(type=="close")
		{
			document.getElementById("jv-emoji").style.display = "none";
		}
		else
		{
			elem = document.getElementById('message_topic');
			start = elem.selectionStart;
			end = elem.selectionEnd;
			len = elem.value.length;
			sel_txt = elem.value.substring(start,end);
			document.getElementById("jv-emoji").style.display = "block";
		}
	}

	
})();