mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-02-01 13:22:04 -08:00
fix activation text and updating of cards
This commit is contained in:
parent
58eef032cd
commit
2c5c1263c2
3 changed files with 19 additions and 21 deletions
|
|
@ -236,17 +236,18 @@ class ExtraNetworksTab {
|
|||
this.prompts_elem.classList.toggle("extra-page-prompts-active", show_neg_prompt || show_prompt);
|
||||
}
|
||||
|
||||
refreshSingleCard(name) {
|
||||
refreshSingleCard(elem) {
|
||||
requestGet(
|
||||
"./sd_extra_networks/get-single-card",
|
||||
{
|
||||
tabname: this.tabname,
|
||||
extra_networks_tabname: this.extra_networks_tabname,
|
||||
name: name,
|
||||
name: elem.dataset.name,
|
||||
div_id: elem.dataset.divId,
|
||||
},
|
||||
(data) => {
|
||||
if (data && data.html) {
|
||||
this.cards_list.updateCard(name, data.html);
|
||||
this.cards_list.updateCard(elem, data.html);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
@ -686,7 +687,9 @@ function extraNetworksShowMetadata(text) {
|
|||
|
||||
function extraNetworksRefreshSingleCard(tabname, extra_networks_tabname, name) {
|
||||
const tab = extra_networks_tabs[`${tabname}_${extra_networks_tabname}`];
|
||||
tab.refreshSingleCard(name);
|
||||
const elem = tab.cards_list.content_elem.querySelector(`.card[data-name="${name}"]`);
|
||||
isElementThrowError(elem);
|
||||
tab.refreshSingleCard(elem);
|
||||
}
|
||||
|
||||
function extraNetworksRefreshTab(tabname_full) {
|
||||
|
|
|
|||
|
|
@ -522,26 +522,14 @@ class ExtraNetworksClusterizeCardsList extends ExtraNetworksClusterize {
|
|||
this.data_obj = await this.options.callbacks.initData();
|
||||
}
|
||||
|
||||
updateCard(name, new_html) {
|
||||
updateCard(elem, new_html) {
|
||||
const parsed_html = htmlStringToElement(new_html);
|
||||
|
||||
const old_card = this.content_elem.querySelector(`.card[data-name="${name}"]`);
|
||||
if (!isElementLogError(old_card)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const div_id = old_card.dataset.divId;
|
||||
|
||||
// replace new html's data attributes with the current ones
|
||||
for (const [k, v] of Object.entries(old_card.dataset)) {
|
||||
parsed_html.dataset[k] = v;
|
||||
}
|
||||
|
||||
// replace the element in DOM with our new element
|
||||
old_card.replaceWith(parsed_html);
|
||||
elem.replaceWith(parsed_html);
|
||||
|
||||
// update the internal cache with the new html
|
||||
this.lru.set(String(div_id), new_html);
|
||||
this.lru.set(String(elem.dataset.divId), new_html);
|
||||
}
|
||||
|
||||
async fetchData(idx_start, idx_end) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue