aboutsummaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
authoralg-wiki <47810160+alg-wiki@users.noreply.github.com>2022-10-10 19:35:28 +0000
committerGitHub <noreply@github.com>2022-10-10 19:35:28 +0000
commitf0ab972f85b4a185e7ff74b6f325835f1135deff (patch)
tree1719b7d8019c44aa55d51432d708ce8c9ca325d3 /script.js
parentbc3e183b739913e7be91213a256f038b10eb71e9 (diff)
parent5da1ba0e91a81804dc911d34c9a2e6956a23199c (diff)
downloadstable-diffusion-webui-gfx803-f0ab972f85b4a185e7ff74b6f325835f1135deff.tar.gz
stable-diffusion-webui-gfx803-f0ab972f85b4a185e7ff74b6f325835f1135deff.tar.bz2
stable-diffusion-webui-gfx803-f0ab972f85b4a185e7ff74b6f325835f1135deff.zip
Merge branch 'master' into textual__inversion
Diffstat (limited to 'script.js')
-rw-r--r--script.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/script.js b/script.js
index cf989605..a92c0f77 100644
--- a/script.js
+++ b/script.js
@@ -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) {