xRock / :jvchat: -> sticker jvchat

// ==UserScript==
// @name         :jvchat: -> sticker jvchat
// @namespace    :jvchat: -> sticker jvchat
// @version      1.4.1
// @description  Remplace des codes de sticker par des stickers
// @author       xRock
// @match        http://*.jeuxvideo.com/forums/42-*
// @match        https://*.jeuxvideo.com/forums/42-*
// @match        http://*.jeuxvideo.com/forums/1-*
// @match        https://*.jeuxvideo.com/forums/1-*
// @license      MIT
// ==/UserScript==

let mapEmoji = new Map()
mapEmoji.set(":cr7nez:", " http://image.noelshack.com/fichiers/2018/10/3/1520404559-ronaldo2.png ")
mapEmoji.set(":cr7bg:", " http://image.noelshack.com/fichiers/2019/08/5/1550842414-ronaldo-bg-lunettes.png ")
mapEmoji.set(":pleure2:", " http://image.noelshack.com/fichiers/2018/43/7/1540734361-kermitou.png ")
mapEmoji.set(":pleure:", " http://image.noelshack.com/fichiers/2017/06/1486476913-kermit-triste.png ")
mapEmoji.set(":paz:", " http://image.noelshack.com/fichiers/2018/52/1/1545642362-cr7ds.png ")
mapEmoji.set(":pyj:", " http://image.noelshack.com/fichiers/2019/34/6/1566663237-marloupyjama.png ")
mapEmoji.set(":colippi:", " http://image.noelshack.com/fichiers/2019/20/6/1558215357-colippi.png ")
mapEmoji.set(":sombrero:", " http://image.noelshack.com/fichiers/2019/42/7/1571560668-cr7-sombrero.png ")
mapEmoji.set(":melonlgbt:", " http://image.noelshack.com/fichiers/2019/42/7/1571560672-chien-melon.png ")
mapEmoji.set(":sasuke:", " http://image.noelshack.com/fichiers/2019/42/7/1571560672-chien-sasuke.png ")
mapEmoji.set(":alkpote:", " http://image.noelshack.com/fichiers/2019/42/7/1571560969-alkpote-bouche.png ")
mapEmoji.set(":cr7bouche:", " http://image.noelshack.com/fichiers/2019/42/7/1571560969-cr7-bouche.png ")
mapEmoji.set(":cr7danse:", " http://image.noelshack.com/fichiers/2019/42/7/1571560969-cr7-danse.png ")
mapEmoji.set(":cr7:", " http://image.noelshack.com/fichiers/2019/42/7/1571560969-cr7-macron.png ")
mapEmoji.set(":moustache:", " http://image.noelshack.com/fichiers/2019/42/7/1571560969-cr7-moustache-chauve.png ")
mapEmoji.set(":cr7exclamation:", " http://image.noelshack.com/fichiers/2019/42/7/1571560969-cr7-point-exclamation.png ")
mapEmoji.set(":zizou:", " http://image.noelshack.com/fichiers/2019/25/5/1561139711-zissou.png ")
mapEmoji.set(":cr7enerve:", " http://image.noelshack.com/fichiers/2019/01/3/1546468106-cr7-miroir-zoom.png ")
mapEmoji.set(":jesus:", " http://image.noelshack.com/fichiers/2017/31/5/1501862610-jesus56bestreup.png ")
mapEmoji.set(":google:", " http://image.noelshack.com/fichiers/2017/47/5/1511558439-download7fe7b8e-res-2fimage-20editor-2f1511274901720-4-2-2-2-2-2-2-2-2-2-2-2-2-2-2-4-4-4-2-2-2-2.png ")
mapEmoji.set(":cassini:", " http://image.noelshack.com/fichiers/2016/34/1472411294-yeux2.png ")
mapEmoji.set(":freeze:", " http://image.noelshack.com/fichiers/2017/30/7/1501422770-freeze-corleone-fume-2.png ")
mapEmoji.set(":cr7nice:", " http://image.noelshack.com/fichiers/2019/35/5/1567172213-picsart-08-30-03-28-05.png ")
mapEmoji.set(":marlou:", " https://image.noelshack.com/fichiers/2019/25/1/1560799835-1ddea9bd-c147-4ce1-9d8e-cf5b79695181.png ")
mapEmoji.set(":cr7gun:", " http://image.noelshack.com/fichiers/2019/13/4/1553794895-ronaldo-flingue.png ")
mapEmoji.set(":cr7doigt:", " http://image.noelshack.com/fichiers/2018/10/7/1520733539-49842-full-1.png ")
mapEmoji.set(":hassen:", " http://image.noelshack.com/fichiers/2019/47/6/1574533951-hassen.png ")
mapEmoji.set(":jesusbras:", " http://image.noelshack.com/fichiers/2016/26/1467335935-jesus1.png ")
mapEmoji.set(":jesusnez:", " http://image.noelshack.com/fichiers/2018/13/4/1522325846-jesusopti.png ")
mapEmoji.set(":sueur:", " http://image.noelshack.com/fichiers/2018/10/1/1520256134-risitasue2.png ")
mapEmoji.set(":chance:", " http://image.noelshack.com/fichiers/2018/51/3/1545248326-larryreup.png ")
mapEmoji.set(":jesusmain:", " https://image.noelshack.com/fichiers/2018/52/4/1545950497-jesus-deux-mains-rire-sticker.png ")
mapEmoji.set(":ingenieur:", " http://image.noelshack.com/fichiers/2019/29/6/1563574280-finefil.png ")
mapEmoji.set(":lemp:", "  http://image.noelshack.com/fichiers/2016/24/1466366306-risitas52.png ")
mapEmoji.set(":spy:", " http://image.noelshack.com/fichiers/2019/48/5/1575065576-1575065526-mine-a-micromania.png ")
mapEmoji.set(":zemmour:", " https://image.noelshack.com/fichiers/2017/15/1492377603-zemmour10.png ")
mapEmoji.set(":macronptdr:", " http://image.noelshack.com/fichiers/2017/18/1494036459-macronmdr.png ")
mapEmoji.set(":pasdechance:", " https://image.noelshack.com/fichiers/2017/20/1495197402-larrysilver.png ")
mapEmoji.set(":journal:", " http://image.noelshack.com/fichiers/2017/30/4/1501185683-jesusjournalbestreup.png ")
mapEmoji.set(":chat:", " https://image.noelshack.com/fichiers/2018/23/3/1528251470-lechaent16.png ")
mapEmoji.set(":cool1:", " http://image.noelshack.com/fichiers/2019/08/7/1551041210-chien-melon7.png ")
mapEmoji.set(":jesustable:", " http://image.noelshack.com/fichiers/2016/38/1474488555-jesus24.png ")
mapEmoji.set(":perromain:", " https://image.noelshack.com/fichiers/2019/33/7/1566151930-chen3.png ")
mapEmoji.set(":perrodab:", " https://image.noelshack.com/fichiers/2019/49/5/1575664269-chendab.png ")
mapEmoji.set(":cool1:", " http://image.noelshack.com/fichiers/2019/08/7/1551041210-chien-melon7.png ")
mapEmoji.set(":melon1:", " http://image.noelshack.com/fichiers/2019/04/6/1548522891-chien-melon.png ")
mapEmoji.set(":cr7melon:", " http://image.noelshack.com/fichiers/2019/21/1/1558380323-ronaldo-melon.png ")
mapEmoji.set(":hulk:", " https://image.noelshack.com/fichiers/2019/49/4/1575504187-1379901034-1.png ")
mapEmoji.set(":ours:", " https://image.noelshack.com/fichiers/2019/29/4/1563417245-nounours-mega-demon.png ")
mapEmoji.set(":broula:", " https://image.noelshack.com/minis/2019/19/4/1557437332-ace383ce-418a-47f9-91b0-a862161adaac.png ")
mapEmoji.set(":marloulunettes:", " https://image.noelshack.com/fichiers/2020/07/3/1581545207-marloulunettes2.png ")
mapEmoji.set(":marloutire:", " https://image.noelshack.com/fichiers/2019/36/5/1567775895-marlou-sniper.png ")
mapEmoji.set(":marloucheck:", " https://image.noelshack.com/fichiers/2019/34/6/1566615316-resosp.png ")
mapEmoji.set(":marloutoz:", " https://image.noelshack.com/fichiers/2019/34/6/1566662197-marlou-zemmour.jpg ")
mapEmoji.set(":marlouzizou:", " https://image.noelshack.com/fichiers/2019/34/7/1566769293-marlouzidane.png ")
mapEmoji.set(":marloudiscours:", " https://image.noelshack.com/fichiers/2020/07/3/1581531895-marloumain.png ")
mapEmoji.set(":marlouzoom:", " https://image.noelshack.com/fichiers/2020/07/3/1581531879-marlouzoom2.png ")
mapEmoji.set(":ademecque:", " https://image.noelshack.com/fichiers/2020/13/7/1585510719-1505974635-img-20170921-081633.png ")


const mainmt = (listener) => {
    document.getElementById("message_topic").addEventListener(listener, () => {
        let messageContent = document.getElementById("message_topic").value
        for (const clé of mapEmoji.keys()) {
            messageContent = messageContent.replace(new RegExp(`${clé}`, 'g'), mapEmoji.get(clé))
        }
        document.getElementById("message_topic").value = messageContent
    })
}

addEventListener("jvchat:activation", function(event) {
    mainmt("input")
})