Greasy Fork is available in English.
Adds Ctrl+Enter shortcut for sending messages in OpenAI chat
当前为
// ==UserScript==
// @name ChatGPT: Ctrl+Enter Send Shortcut for OpenAI Chat
// @version 1.0
// @description Adds Ctrl+Enter shortcut for sending messages in OpenAI chat
// @match https://chat.openai.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @auther ChopChopsticks
// @namespace http://greasyfork.icu/users/1052311
// ==/UserScript==
(function() {
'use strict';
// Get the send button
const sendButton = document.querySelector('[data-testid="send-button"]');
// Add event listener for keydown events on the chat input field
document.querySelector('[data-testid="chat-input"]').addEventListener('keydown', function(event) {
// Check if Ctrl+Enter is pressed
if (event.ctrlKey && event.keyCode === 13) {
// If so, prevent the default action of the Enter key (adding a newline)
event.preventDefault();
// Simulate a click on the send button
sendButton.click();
}
});
})();