SmilerLolzteam

Adds automatic emoji insertion in the editor.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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