Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed
This commit is contained in:
parent
5e80d9ee99
commit
94e9669566
15
script.js
15
script.js
|
@ -133,9 +133,18 @@ document.addEventListener('keydown', function(e) {
|
||||||
if (isEnter && isModifierKey) {
|
if (isEnter && isModifierKey) {
|
||||||
if (interruptButton.style.display === 'block') {
|
if (interruptButton.style.display === 'block') {
|
||||||
interruptButton.click();
|
interruptButton.click();
|
||||||
setTimeout(function() {
|
const callback = (mutationList) => {
|
||||||
generateButton.click();
|
for (const mutation of mutationList) {
|
||||||
}, 500);
|
if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
|
||||||
|
if (interruptButton.style.display === 'none') {
|
||||||
|
generateButton.click();
|
||||||
|
observer.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const observer = new MutationObserver(callback);
|
||||||
|
observer.observe(interruptButton, {attributes: true});
|
||||||
} else {
|
} else {
|
||||||
generateButton.click();
|
generateButton.click();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue