SmilerLolzteam

Adds automatic emoji insertion in the editor.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);
            }
        })
    });
})();