Update script.js

Exclude lambda
This commit is contained in:
Khachatur Avanesian 2023-10-15 10:25:36 +03:00 committed by GitHub
parent f00eaa4d00
commit 77bd953da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -123,23 +123,25 @@ document.addEventListener("DOMContentLoaded", function() {
/**
* Add a Ctrl (Alt) + Enter as a shortcut to start / restart a generation
*/
document.addEventListener('keydown', (e) => {
const isEnter = e.key === 'Enter' || e.keyCode === 13
const isModifierKey = e.metaKey || e.ctrlKey || e.altKey
document.addEventListener('keydown', function(e) {
const isEnter = e.key === 'Enter' || e.keyCode === 13;
const isModifierKey = e.metaKey || e.ctrlKey || e.altKey;
const interruptButton = get_uiCurrentTabContent().querySelector('button[id$=_interrupt]')
const generateButton = get_uiCurrentTabContent().querySelector('button[id$=_generate]')
const interruptButton = get_uiCurrentTabContent().querySelector('button[id$=_interrupt]');
const generateButton = get_uiCurrentTabContent().querySelector('button[id$=_generate]');
if (isEnter && isModifierKey) {
if (interruptButton.style.display === 'block') {
interruptButton.click()
setTimeout(() => generateButton.click(), 500)
interruptButton.click();
setTimeout(function() {
generateButton.click();
}, 500);
} else {
generateButton.click()
generateButton.click();
}
e.preventDefault()
e.preventDefault();
}
})
});
/**
* checks that a UI element is not in another hidden element or tab content