aboutsummaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
authorkaalibro <konstantin.adamovich@gmail.com>2023-12-10 10:28:56 +0000
committerkaalibro <konstantin.adamovich@gmail.com>2023-12-10 10:28:56 +0000
commit1d42babd324b933bae317cb427fe0513138954f4 (patch)
treeb11f9389c6451926a2e75cb3db99106250072abd /script.js
parent9c201550ddae0b33367adfb99bcbb57ba9b207a9 (diff)
downloadstable-diffusion-webui-gfx803-1d42babd324b933bae317cb427fe0513138954f4.tar.gz
stable-diffusion-webui-gfx803-1d42babd324b933bae317cb427fe0513138954f4.tar.bz2
stable-diffusion-webui-gfx803-1d42babd324b933bae317cb427fe0513138954f4.zip
Replace Ctrl+Alt+Enter with Esc
Diffstat (limited to 'script.js')
-rw-r--r--script.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/script.js b/script.js
index 69598f45..44950090 100644
--- a/script.js
+++ b/script.js
@@ -124,18 +124,19 @@ document.addEventListener("DOMContentLoaded", function() {
* Add keyboard shortcuts:
* Ctrl+Enter to start/restart a generation
* Alt/Option+Enter to skip a generation
- * Alt/Option+Ctrl+Enter to interrupt a generation
+ * Esc to interrupt a generation
*/
document.addEventListener('keydown', function(e) {
const isEnter = e.key === 'Enter' || e.keyCode === 13;
const isCtrlKey = e.metaKey || e.ctrlKey;
const isAltKey = e.altKey;
+ const isEsc = e.key === 'Escape';
const generateButton = get_uiCurrentTabContent().querySelector('button[id$=_generate]');
const interruptButton = get_uiCurrentTabContent().querySelector('button[id$=_interrupt]');
const skipButton = get_uiCurrentTabContent().querySelector('button[id$=_skip]');
- if (isCtrlKey && isEnter && !isAltKey) {
+ if (isCtrlKey && isEnter) {
if (interruptButton.style.display === 'block') {
interruptButton.click();
const callback = (mutationList) => {
@@ -156,14 +157,18 @@ document.addEventListener('keydown', function(e) {
e.preventDefault();
}
- if (isAltKey && isEnter && !isCtrlKey) {
+ if (isAltKey && isEnter) {
skipButton.click();
e.preventDefault();
}
- if (isAltKey && isCtrlKey && isEnter) {
- interruptButton.click();
- e.preventDefault();
+ if (isEsc) {
+ if (!globalPopup || globalPopup.style.display === "none") {
+ interruptButton.click();
+ e.preventDefault();
+ } else {
+ closePopup();
+ }
}
});