File size: 2,322 Bytes
a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b a57c749 118b48b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
// Custom scripts by XpucT
// Homepage: https://boosty.to/xpuct
document.addEventListener('keydown', function(e)
{
// Показать предыдущую генерацию по клавише Shift
if (e.keyCode === 16 && document.querySelector('.livePreview'))
document.querySelector('.livePreview').style.display = 'none'
// Переключить Mask Mode по Ctrl + F2
else if (e.ctrlKey && e.code === 'F2')
{
const commonRadio = document.querySelector('#img2img_mask_mode').children[2]
commonRadio.children[0].className.includes('selected') ? commonRadio.children[1].click() : commonRadio.children[0].click()
e.preventDefault()
}
// Выгрузить модели по F4
else if (e.code === 'F4')
{
document.querySelector('#sett_unload_sd_model').click()
e.preventDefault()
}
// Reload UI по F2
else if (e.code === 'F2')
{
document.querySelector('#settings_restart_gradio').click()
e.preventDefault()
}
})
document.addEventListener('keyup', function(e)
{
if (e.keyCode === 16 && document.querySelector('.livePreview'))
{
document.querySelector('.livePreview').style.display = 'block'
}
})
onUiLoaded(function()
{
// Удаление рекламы в Photopea (работает не всегда)
const result = document.evaluate("//div[@class='flexrow app']/div[2]", document, null, XPathResult.ANY_TYPE, null)
var ad = result.iterateNext()
while (ad)
{
ad.parentNode.removeChild(ad)
ad = result.iterateNext()
}
// Граница в txt2img немного левее, а не посередине
document.querySelector('gradio-app .resize-handle-row').style.gridTemplateColumns = '676px 16px 1fr'
document.querySelectorAll('button[id$=_generate]').forEach((x) => x.addEventListener('mousedown', (e) =>
{
if (e.button === 1)
{
get_uiCurrentTabContent().querySelector('div[id$=_adetailer_ad_enable]').children[1].click()
get_uiCurrentTabContent().querySelector('button[id$=_generate]').click()
setTimeout(() => get_uiCurrentTabContent().querySelector('div[id$=_adetailer_ad_enable]').children[1].click(), 100)
e.preventDefault()
}
}))
}) |