Created
September 24, 2024 19:05
-
-
Save frock81/7153467b8be4d0a43d54408f6096af39 to your computer and use it in GitHub Desktop.
ChatGPT ViolentMonkey script to send with Control Enter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ChatGPT Submit with Ctrl+Enter | |
// @namespace Violentmonkey Scripts | |
// @match *://chatgpt.com/* | |
// @grant none | |
// @version 0.1 | |
// @author - | |
// @description Change Enter key behavior to Ctrl+Enter for submitting | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.addEventListener('keydown', function(event) { | |
if (event.key === 'Enter' && !event.ctrlKey) { | |
event.stopPropagation(); | |
} else if (event.key === 'Enter' && event.ctrlKey) { | |
// Trigger the submit action here | |
const submitButton = document.querySelector('button[type="submit"]'); | |
if (submitButton) { | |
submitButton.click(); | |
} | |
} | |
}, true); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment