diff options
author | yfszzx <yfszzx@gmail.com> | 2022-10-11 12:23:41 +0000 |
---|---|---|
committer | yfszzx <yfszzx@gmail.com> | 2022-10-11 12:23:41 +0000 |
commit | 594ab4ba53a80a0a3606565404e6d1fbb60f6629 (patch) | |
tree | 2821eef661e6568b65d8d29c268b657a17dcd423 /script.js | |
parent | 7b1db45e1fda8603d4617affd976066be5e5b821 (diff) | |
parent | dce7fc902ae2c6d9ffa71db67471abdcda72f82c (diff) | |
download | stable-diffusion-webui-gfx803-594ab4ba53a80a0a3606565404e6d1fbb60f6629.tar.gz stable-diffusion-webui-gfx803-594ab4ba53a80a0a3606565404e6d1fbb60f6629.tar.bz2 stable-diffusion-webui-gfx803-594ab4ba53a80a0a3606565404e6d1fbb60f6629.zip |
images history improvement
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -6,6 +6,10 @@ function get_uiCurrentTab() { return gradioApp().querySelector('.tabs button:not(.border-transparent)') } +function get_uiCurrentTabContent() { + return gradioApp().querySelector('.tabitem[id^=tab_]:not([style*="display: none"])') +} + uiUpdateCallbacks = [] uiTabChangeCallbacks = [] let uiCurrentTab = null @@ -41,6 +45,25 @@ 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) { + button = get_uiCurrentTabContent().querySelector('button[id$=_generate]'); + if (button) { + button.click(); + } + e.preventDefault(); + } +}) + +/** * checks that a UI element is not in another hidden element or tab content */ function uiElementIsVisible(el) { |