SmilerLolzteam

Adds automatic emoji insertion in the editor.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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