Last active
January 4, 2024 05:58
-
-
Save bulletinmybeard/1c2b8a3858f4485a9ff146f06c85ab56 to your computer and use it in GitHub Desktop.
ChatGPT (chat.openai.com) - Disable keyboard command `CMD+K` that clears the prompt form and resets the URL (macOS!)
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 (chat.openai.com) - Disable keyboard command `CMD+K` | |
// @namespace https://rschu.me/ | |
// @homepage https://rschu.me/ | |
// @version 1.0.0 | |
// @encoding utf-8 | |
// @description ChatGPT (chat.openai.com) - Disable keyboard command `CMD+K` that clears the prompt form and resets the URL | |
// @author Robin Schulz | |
// @match *://chat.openai.com/c/* | |
// @compatible chrome | |
// @compatible firefox | |
// @compatible opera | |
// @compatible safari | |
// @connect chat.openai.com.com | |
// @run-at document-end | |
// ==/UserScript== | |
(async () => { | |
/** | |
* Event listener for the 'keydown' event. | |
* If the Meta (Command on macOS) key and 'K' key are pressed together, | |
* this function prevents the default action and stops the event from propagating. | |
* | |
* @param {KeyboardEvent} event - The keyboard event object. | |
*/ | |
document.addEventListener('keydown', (event) => { | |
if (event.metaKey && event.keyCode === 75) { | |
event.preventDefault() | |
event.stopImmediatePropagation() | |
} | |
}) | |
})().catch(err => { | |
console.error(err) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment