SmilerLolzteam

Adds automatic emoji insertion in the editor.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         SmilerLolzteam
// @namespace    smiler_lzt
// @version      0.3
// @description  Adds automatic emoji insertion in the editor.
// @author       its_niks, MeloniuM
// @match       https://lolz.guru/*
// @match       https://zelenka.guru/*
// @match       https://lolz.live/*
// @license      MIT
// @icon         https://lolz.live/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    $(document).ready(function(){
        $('img.mceSmilie').on('click', function(e) {
            if ($(event.target).parent().is('.messageText')) {
                var ed = XenForo.getEditorInForm('#QuickReply');
                ed.html.insert(' '+e.target.outerHTML+' ')

            } else if ($(event.target).parent().is('.chat2-message-text-inner')) {
                let target = $('.chat2-input')[0]
                let position = target.selectionStart;
                target.value = target.value.slice(0, position) + e.target.alt + target.value.slice(position)
                target.focus()
                position = position + e.target.alt.length;
                target.setSelectionRange(position, position);
            }
        })
    });
})();