Greasy Fork

Kbin Easy Emoticon

easy way to add emoticons to your text with / commands

目前为 2023-06-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         Kbin Easy Emoticon
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  easy way to add emoticons to your text with / commands
// @author       minnieo
// @match        https://kbin.social/*
// @match        https://fedia.io/*
// @match        https://karab.in/*
// @match        https://www.kbin.cafe/*
// @icon         https://upload.wikimedia.org/wikipedia/commons/2/24/Lenny_face.png
// @grant        none
// @license      GNU GPLv3
// ==/UserScript==

// thanks for using!! ❤︎❤︎❤︎❤︎❤︎❤︎❤︎

(function() {
    'use strict';

    const emoticons = ['¯\\_(ツ)_/¯', '( ͡° ͜ʖ ͡°)', '¯\\_( ͡° ͜ʖ ͡°)_/¯ ',
        '( ͡° ͜ʖ ͡°)╭∩╮', '( ͡~ ͜ʖ ͡°)', 'ツ', '(͠≖ ͜ʖ͠≖)', '(╯°□°)╯︵ ┻━┻', '┬─┬ノ( º _ ºノ)'];

    const emoticonsCute = ['ʕ •ᴥ•ʔ', 'ʕっ• ᴥ • ʔっ', '(♡ヮ♡)', '╰(´꒳`)╯',
        '૮ ˙Ⱉ˙ ა', '( ⸝⸝´꒳`⸝⸝)', '(o/////o " )', '⁄(⁄ ⁄•⁄-⁄•⁄ ⁄)⁄', '( ˶ˆ꒳ˆ˵ )',
         '(⸝⸝⸝• ω •⸝⸝⸝) ♡', '(   ͡º ꒳ ͡º)', '(˘︶˘).。.:*♡', '( ˘ ³˘)♥', '(  •̀ - •́  )',
         '(˵ •̀ ᴗ - ˵ ) ✧', '৻(  •̀ ᗜ •́  ৻)', 'ᕙ( •̀ ᗜ •́ )ᕗ', '(ㅅ´ ˘ `)', '(╥﹏╥)',
          '( • ᴖ • 。 )', '◝(ᵔᵕᵔ)◜', '♡⟡˙⋆', ' ⋆˙⟡♡', '❤︎', '♡', '★', '✿',
          '(。•́︿•̀。)', '(⸝⸝ᵕᴗᵕ⸝⸝)', '(ノ^ヮ^)ノ', 'ᐠ( ᐛ )ᐟ', '(¬_¬")', '( ´・・)ノ(._.`)',
          'ಠ_ಠ', 'ᕕ( ᐛ )ᕗ'];

 document.addEventListener('input', (e) => {
        if (e.target.tagName === 'TEXTAREA') {
            emoticonMake(e.target);
            console.log('working');
        }
    });

    function emoticonMake(param) {
        let text = param.value;
        text = text
            .replace(/\/shrug/, `${emoticons[0]} `)
            .replace(/\/lenny/, `${emoticons[1]} `)
            .replace(/\/lenshrug/, `${emoticons[2]} `)
            .replace(/\/flipoff/, `${emoticons[3]} `)
            .replace(/\/lenwink/, `${emoticons[4]} `)
            .replace(/\/welp/, `${emoticons[5]} `)
            .replace(/\/lensexy/, `${emoticons[6]} `)
            .replace(/\/tableflip/, `${emoticons[7]} `)
            .replace(/\/tableback/, `${emoticons[8]} `);

        // cute emoticons
        text = text
            .replace(/\/bear/, `${emoticonsCute[0]} `)
            .replace(/\/1bear/, `${emoticonsCute[1]} `)
            .replace(/\/hearteyes/, `${emoticonsCute[2]} `)
            .replace(/\/happy/, `${emoticonsCute[3]} `)
            .replace(/\/rawr/, `${emoticonsCute[4]} `)
            .replace(/\/blush/, `${emoticonsCute[5]} `)
            .replace(/\/1blush/, `${emoticonsCute[6]} `)
            .replace(/\/2blush/, `${emoticonsCute[7]} `)
            .replace(/\/1happy/, `${emoticonsCute[8]} `)
            .replace(/\/3blush/, `${emoticonsCute[9]} `)
            .replace(/\/smirk/, `${emoticonsCute[10]} `)
            .replace(/\/givelove/, `${emoticonsCute[11]} `)
            .replace(/\/kiss/, `${emoticonsCute[12]} `)
            .replace(/\/frown/, `${emoticonsCute[13]} `)
            .replace(/\/wink/, `${emoticonsCute[14]} `)
            .replace(/\/awesome/, `${emoticonsCute[15]} `)
            .replace(/\/tough/, `${emoticonsCute[16]} `)
            .replace(/\/pleased/, `${emoticonsCute[17]} `)
            .replace(/\/cry/, `${emoticonsCute[18]} `)
            .replace(/\/bummed/, `${emoticonsCute[19]} `)
            .replace(/\/wave/, `${emoticonsCute[20]} `)
            .replace(/\/1s/, `${emoticonsCute[21]} `)
            .replace(/\/2s/, `${emoticonsCute[22]} `)
            .replace(/\/heart/, `${emoticonsCute[23]} `)
            .replace(/\/1heart/, `${emoticonsCute[24]} `)
            .replace(/\/star/, `${emoticonsCute[25]} `)
            .replace(/\/flower/, `${emoticonsCute[26]} `)
            .replace(/\/concern/, `${emoticonsCute[27]} `)
            .replace(/\/4blush/, `${emoticonsCute[28]} `)
            .replace(/\/3happy/, `${emoticonsCute[29]} `)
            .replace(/\/4happy/, `${emoticonsCute[30]} `)
            .replace(/\/unhappy/, `${emoticonsCute[31]} `)
            .replace(/\/comfort/, `${emoticonsCute[32]} `)
            .replace(/\/look/, `${emoticonsCute[33]} `)
            .replace(/\/5happy/, `${emoticonsCute[34]} `)
           ;

        param.value = text;

    }

})();