Correct list style, apply gen forever to both tabs, roll3 on both tabs

This commit is contained in:
DepFA 2022-10-11 13:10:11 +01:00 committed by AUTOMATIC1111
parent dce7fc902a
commit 45ada1c910

View File

@ -16,7 +16,7 @@ contextMenuInit = function(){
oldMenu.remove() oldMenu.remove()
} }
let tabButton = gradioApp().querySelector('button') let tabButton = uiCurrentTab
let baseStyle = window.getComputedStyle(tabButton) let baseStyle = window.getComputedStyle(tabButton)
const contextMenu = document.createElement('nav') const contextMenu = document.createElement('nav')
@ -130,9 +130,9 @@ addContextMenuEventListener = initResponse[2]
//Start example Context Menu Items //Start example Context Menu Items
generateOnRepeatId = appendContextMenuOption('#txt2img_generate','Generate forever',function(){ generateOnRepeat = function(genbuttonid,interruptbuttonid){
let genbutton = gradioApp().querySelector('#txt2img_generate'); let genbutton = gradioApp().querySelector(genbuttonid);
let interruptbutton = gradioApp().querySelector('#txt2img_interrupt'); let interruptbutton = gradioApp().querySelector(interruptbuttonid);
if(!interruptbutton.offsetParent){ if(!interruptbutton.offsetParent){
genbutton.click(); genbutton.click();
} }
@ -142,8 +142,15 @@ generateOnRepeatId = appendContextMenuOption('#txt2img_generate','Generate forev
genbutton.click(); genbutton.click();
} }
}, },
500)} 500)
) }
generateOnRepeatId = appendContextMenuOption('#txt2img_generate','Generate forever',function(){
generateOnRepeat('#txt2img_generate','#txt2img_interrupt');
})
generateOnRepeatId = appendContextMenuOption('#img2img_generate','Generate forever',function(){
generateOnRepeat('#img2img_generate','#img2img_interrupt');
})
cancelGenerateForever = function(){ cancelGenerateForever = function(){
clearInterval(window.generateOnRepeatInterval) clearInterval(window.generateOnRepeatInterval)
@ -151,11 +158,12 @@ cancelGenerateForever = function(){
appendContextMenuOption('#txt2img_interrupt','Cancel generate forever',cancelGenerateForever) appendContextMenuOption('#txt2img_interrupt','Cancel generate forever',cancelGenerateForever)
appendContextMenuOption('#txt2img_generate', 'Cancel generate forever',cancelGenerateForever) appendContextMenuOption('#txt2img_generate', 'Cancel generate forever',cancelGenerateForever)
appendContextMenuOption('#img2img_interrupt','Cancel generate forever',cancelGenerateForever)
appendContextMenuOption('#img2img_generate', 'Cancel generate forever',cancelGenerateForever)
appendContextMenuOption('#roll','Roll three', appendContextMenuOption('#roll','Roll three',
function(){ function(){
let rollbutton = gradioApp().querySelector('#roll'); let rollbutton = get_uiCurrentTabContent().querySelector('#roll');
setTimeout(function(){rollbutton.click()},100) setTimeout(function(){rollbutton.click()},100)
setTimeout(function(){rollbutton.click()},200) setTimeout(function(){rollbutton.click()},200)
setTimeout(function(){rollbutton.click()},300) setTimeout(function(){rollbutton.click()},300)