Greasy Fork 还支持 简体中文。

Discord Emoji URL Extractor (Shift Modifier)

Quickly extract emoji URL from Discord when Shift+Clicking and copy it to clipboard with size=48, otherwise use default behavior. This is useful if you don't have nitro and still want to use animated emotes or any emote as a gif instead as a cheap mans emoji.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Discord Emoji URL Extractor (Shift Modifier)
// @namespace    https://greasyfork.org/en/scripts/531175-discord-emoji-url-extractor-shift-modifier
// @version      1.2
// @description  Quickly extract emoji URL from Discord when Shift+Clicking and copy it to clipboard with size=48, otherwise use default behavior. This is useful if you don't have nitro and still want to use animated emotes or any emote as a gif instead as a cheap mans emoji.
// @author       Cragsand
// @license      MIT
// @match        *://discord.com/*
// @grant        GM_setClipboard
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('click', async function(event) {
        // Check if Shift is held down
        if (!event.shiftKey) {
            return; // Allow normal Discord behavior
        }

        // Find the closest emoji button based on stable attributes
        let emojiButton = event.target.closest('button[data-type="emoji"]');
        if (emojiButton) {
            event.stopPropagation();
            event.preventDefault();

            // Find the emoji image inside the button
            let emojiImg = emojiButton.querySelector('img[src*="cdn.discordapp.com/emojis/"]');
            if (emojiImg && emojiImg.src) {
                let emojiURL = new URL(emojiImg.src);
                emojiURL.searchParams.set('size', '48'); // Force size=48

                // Copy modified emoji URL to clipboard
                try {
                    await navigator.clipboard.writeText(emojiURL.toString());
                } catch (err) {
                    console.error("Clipboard copy failed, using fallback:", err);
                    GM_setClipboard(emojiURL.toString()); // Tampermonkey fallback
                }
            }
        }
    }, true);
})();