diff options
author | Melan <alexleander91@gmail.com> | 2022-10-10 16:16:04 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-10 16:32:30 +0000 |
commit | 6c36fe5719a824fa18f6ad3e02727783f095bc5f (patch) | |
tree | 71198ede21bdf03ff0eefefef2f8bf48d04705cd | |
parent | d5c14365fd468dbf89fa12a68bea5b217077273c (diff) | |
download | stable-diffusion-webui-gfx803-6c36fe5719a824fa18f6ad3e02727783f095bc5f.tar.gz stable-diffusion-webui-gfx803-6c36fe5719a824fa18f6ad3e02727783f095bc5f.tar.bz2 stable-diffusion-webui-gfx803-6c36fe5719a824fa18f6ad3e02727783f095bc5f.zip |
Add ctrl+enter as a shortcut to quickly start a generation.
-rw-r--r-- | script.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -41,6 +41,22 @@ document.addEventListener("DOMContentLoaded", function() { }); /** + * Add a ctrl+enter as a shortcut to start a generation + */ + document.addEventListener('keydown', function(e) { + var handled = false; + if (e.key !== undefined) { + if((e.key == "Enter" && (e.metaKey || e.ctrlKey))) handled = true; + } else if (e.keyCode !== undefined) { + if((e.keyCode == 13 && (e.metaKey || e.ctrlKey))) handled = true; + } + if (handled) { + gradioApp().querySelector("#txt2img_generate").click(); + e.preventDefault(); + } +}) + +/** * checks that a UI element is not in another hidden element or tab content */ function uiElementIsVisible(el) { |