Greasy Fork

Greasy Fork is available in English.

DeepSeek Chat 快捷停止

Auto send message on Enter key press, but not on Shift + Enter

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         DeepSeek Chat 快捷停止
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Auto send message on Enter key press, but not on Shift + Enter
// @author       tianyw0
// @license      MIT
// @match        https://chat.deepseek.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 获取输入框元素
    const chatInput = document.getElementById('chat-input');

    // 监听输入框的 keydown 事件
    chatInput.addEventListener('keydown', function(event) {
        // 检查是否按下了 Enter 键且没有按下 Shift 键
        if (event.key === 'Enter' && !event.shiftKey) {
            // 检查输入框内容是否为空
            if (chatInput.value.trim() !== '') {
                // 重新获取发送按钮元素
                const sendButtons = Array.from(document.querySelectorAll('div[role="button"]'))
                    .filter(button => button.classList[0] && button.classList[0].startsWith('_'));

                // 如果有符合条件的按钮,模拟点击第一个按钮
                if (sendButtons.length > 0) {
                    sendButtons[0].click();
                }
            }
        }
    });
})();