mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
control prep work
This commit is contained in:
+16
-7
@@ -1,7 +1,16 @@
|
||||
const getControlActiveTab = (...args) => {
|
||||
const selectedTab = gradioApp().querySelector('#control-tabs > .tab-nav > .selected');
|
||||
let activeTab = '';
|
||||
if (selectedTab) activeTab = selectedTab.innerText.toLowerCase();
|
||||
args.shift();
|
||||
return [activeTab, ...args];
|
||||
};
|
||||
function setupControlUI() {
|
||||
const tabs = ['input', 'output', 'preview'];
|
||||
for (const tab of tabs) {
|
||||
const btn = gradioApp().getElementById(`control-${tab}-button`);
|
||||
btn.style.cursor = 'pointer';
|
||||
btn.onclick = () => {
|
||||
const t = gradioApp().getElementById(`control-tab-${tab}`);
|
||||
t.style.display = t.style.display === 'none' ? 'block' : 'none';
|
||||
const c = gradioApp().getElementById(`control-${tab}-column`);
|
||||
c.style.flexGrow = c.style.flexGrow === '0' ? '9' : '0';
|
||||
};
|
||||
}
|
||||
log('initControlUI');
|
||||
}
|
||||
|
||||
onUiLoaded(setupControlUI);
|
||||
|
||||
Reference in New Issue
Block a user