context menus

This commit is contained in:
Vladimir Mandic
2023-11-03 11:41:08 -04:00
parent 996344c6f7
commit da3d5d0fc7
8 changed files with 105 additions and 32 deletions
+20
View File
@@ -216,6 +216,18 @@ function applyStyles(styles) {
return newStyles.join('|');
}
function quickApplyStyle() {
const tabname = getENActiveTab();
const btnApply = gradioApp().getElementById(`${tabname}_extra_apply`);
if (btnApply) btnApply.click();
}
function quickSaveStyle() {
const tabname = getENActiveTab();
const btnSave = gradioApp().getElementById(`${tabname}_extra_quicksave`);
if (btnSave) btnSave.click();
}
// init
function setupExtraNetworksForTab(tabname) {
@@ -243,6 +255,14 @@ function setupExtraNetworksForTab(tabname) {
btnModel.onclick = () => btnModel.classList.toggle('toolbutton-selected');
tabs.appendChild(buttons);
// details
const detailsImg = gradioApp().getElementById(`${tabname}_extra_details_img`);
const detailsClose = gradioApp().getElementById(`${tabname}_extra_details_close`);
if (detailsImg && detailsClose) {
detailsImg.title = 'Close details';
detailsImg.onclick = () => detailsClose.click();
}
// search and description
const div = document.createElement('div');
div.classList.add('second-line');