From 9cfd827c71bc800644cd54cfea64950d62aa9542 Mon Sep 17 00:00:00 2001 From: anapnoe <124302297+anapnoe@users.noreply.github.com> Date: Tue, 22 Oct 2024 01:14:02 +0300 Subject: [PATCH] Update index.js --- extensions-builtin/sd-webui-ux/javascript/dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions-builtin/sd-webui-ux/javascript/dist/index.js b/extensions-builtin/sd-webui-ux/javascript/dist/index.js index 819edf50714..ed434041e88 100644 --- a/extensions-builtin/sd-webui-ux/javascript/dist/index.js +++ b/extensions-builtin/sd-webui-ux/javascript/dist/index.js @@ -20,7 +20,7 @@ async function dt(t,e,o){const n=document.querySelector(o),s=` [rel="stylesheet"][href*="/assets/"], [rel="stylesheet"][href*="theme.css"], [rel="stylesheet"][href*="index"]`).forEach(n=>{n.remove(),console.log("Remove stylesheet",n.getAttribute("href"))}),document.body.querySelectorAll(` - [rel="stylesheet"][href*="file=style.css"]`).forEach(n=>{n.remove(),console.log("Remove stylesheet",n.getAttribute("href"))});const t=document.querySelectorAll('.styler, [class*="svelte"]:not(input)'),e=t.length;let o=0;t.forEach(n=>{n.style.display!=="none"&&n.style.display!=="block"&&(n.removeAttribute("style"),o++),[...n.classList].filter(s=>s.match(/^svelte.*/)).forEach(s=>n.classList.remove(s))}),console.log("Remove inline styles from DOM","Total Selectors:",e,"Removed Selectors:",o)}function Ye(t){var n;const e=t.getAttribute("data-apply"),o=e?e.match(/^(\w+)\s*\(.*\)$/):null;if(o&&typeof window[o[1]]=="function"){t.removeEventListener("click",window[o[1]]);const s=t.getAttribute("data-name")||t.getAttribute("data-path")||((n=t.closest(".card"))==null?void 0:n.getAttribute("data-name"));s&&console.log("Remove EventListener",`${s} - ${o[1]} - ${t.getAttribute("title")||""}`)}}function Re(t){var n;const{target:e,currentTarget:o}=t;if(e.classList.contains("card")||e.classList.contains("card-button")||e.classList.contains("tree-list-content")){let s=e.getAttribute("data-apply")||e.getAttribute("onClick");if(s&&(e.setAttribute("data-apply",s),e.removeAttribute("onClick")),e.setAttribute("onClick",s),e.click(),Ye(e),e.removeAttribute("onClick"),e.classList.contains("card-button")&&jt(),e.classList.contains("tree-list-content-dir")){const i=(n=o.closest(".layout-extra-networks"))==null?void 0:n.querySelector(".search_extra_networks");i&&e.getAttribute("data-path")&&(i.value=e.getAttribute("data-path"),Ee(i))}t.stopImmediatePropagation()}}async function Qe(t){if(window.opts.uiux_enable_event_delegation||Z){const e=$t(t);console.log("Starting Optimizations for",t.id),Z||t.querySelectorAll(".card, .card-button, .tree-list-content").forEach(o=>{const n=o.getAttribute("onClick")||o.getAttribute("data-apply");n&&(o.setAttribute("data-apply",n),o.removeAttribute("onClick"),Ye(o))}),console.log("Total Inline Event Listeners Before:",e,"After:",0),console.log("Attaching Event Listener using Event Delegation",t.id),t.removeEventListener("click",Re),t.addEventListener("click",Re)}}async function Vt(){const t=j(),e=function(n){const s=n.target.value.toLowerCase(),i=n.target.getAttribute("data-target");t.querySelectorAll(i).forEach(a=>{let c=a.getAttribute("data-sort-path").toLowerCase().indexOf(s)!==-1;s.length<2&&(c=!0),a.style.display=c?"":"none"})};document.querySelectorAll(".search_extra_networks").forEach(n=>{n.addEventListener("input",e)});function o(n,s){function i(v,E){const T=v.getAttribute(s),b=E.getAttribute(s);return!isNaN(T)&&!isNaN(b)?parseInt(T)-parseInt(b):Tb?1:0}const a=n.getAttribute("data-target"),r=t.querySelectorAll(a),c=r[0].parentElement,p=Array.from(r).sort(i);n.nextElementSibling.className.indexOf("active")!==-1&&p.reverse(),p.forEach(v=>c.appendChild(v))}document.querySelectorAll(".extra_networks_order_by").forEach(n=>{n.addEventListener("change",function(s){o(s.target,this.value)}),n.nextElementSibling.addEventListener("click",s=>{o(n,n.value),console.log("You selected: ",n.value)})})}async function Xt(){var t,e,o,n;if(!Z){const s=j();console.log("Remove Extra Networks Instances"),(t=s.querySelector("#img2img_textual_inversion_cards_html"))==null||t.remove(),(e=s.querySelector("#img2img_checkpoints_cards_html"))==null||e.remove(),(o=s.querySelector("#img2img_hypernetworks_cards_html"))==null||o.remove(),(n=s.querySelector("#img2img_lora_cards_html"))==null||n.remove(),console.log("Remove element #img2img_textual_inversion_cards_html"),console.log("Remove element #img2img_checkpoints_cards_html"),console.log("Remove element #img2img_hypernetworks_cards_html"),console.log("Remove element #img2img_lora_cards_html")}}async function Jt(t){await Promise.all(Array.from(t.querySelectorAll(".ae-button")).map(async e=>{const o=e.getAttribute("toggle"),n=e.getAttribute("active"),s=e.querySelector("input");s&&(s.checked===!0&&!n||s.checked===!1&&n)&&s.click(),n?e.classList.add("active"):e.classList.remove("active"),o&&e.addEventListener("click",a=>{const r=e.querySelector("input");r?(r.click(),r.checked===!0?e.classList.add("active"):r.checked===!1&&e.classList.remove("active")):e.classList.toggle("active")});const i=e.getAttribute("data-click");i&&e.addEventListener("click",a=>{var r;if(e.classList.contains("refresh-extra-networks")){const d=((r=e.closest(".layout"))==null?void 0:r.id).split("layout_")[1],p=document.querySelector(`#${d}_pane > div`);[document.querySelector(`#${d}_dirs`),document.querySelector(`#${d}_tree`),document.querySelector(`#${d}_cards`)].forEach(v=>{v&&p.append(v)}),document.querySelector(`#${d}_extra_refresh_internal`).dispatchEvent(new Event("click")),setTimeout(()=>{const v=document.querySelector(`#${d}_aside_split`);v.querySelectorAll(".portal").forEach((E,T,b)=>{ee(E,v,0,T,b.length)}),Qe(v)},1e3)}document.querySelectorAll(i).forEach(c=>{c.click()})})}))}async function Kt(t){const e=Ut();await Promise.all(Array.from(t.querySelectorAll(".accordion-bar")).map(async o=>{const n=o.parentElement,s=n.closest(".split-container");let i=o;const a=n.getAttribute("iconTrigger");if(a){const r=t.querySelector(a);r&&(i=r,o.classList.add("pointer-events-none"))}if(n.className.indexOf("accordion-vertical")!==-1&&s.className.indexOf("split")!==-1){n.classList.add("expand");const r=s.parentElement.id,c=e[r];s.setAttribute("data-sizes",JSON.stringify(c.getSizes())),i==null||i.addEventListener("click",()=>{if(n.classList.toggle("expand"),s.className.indexOf("v-expand")!==-1)s.classList.remove("v-expand"),c.setSizes(JSON.parse(s.getAttribute("data-sizes")));else{s.classList.add("v-expand");let d=c.getSizes();s.setAttribute("data-sizes",JSON.stringify(d)),console.log(d),d[d.length-1]=0,d[d.length-2]=100;const p=parseFloat(window.getComputedStyle(o,null).getPropertyValue("padding-left"))*2;s.style.minWidth=o.offsetWidth+p+"px",c.setSizes(d)}})}else i==null||i.addEventListener("click",()=>{n.classList.toggle("expand")})}))}async function et(t){var o;await Pt(t),await Bt(t),await Kt(t),await Gt(t),await Jt(t),document.querySelector("#container-console-log").append(Xe()),(o=document.querySelector("#logger_screen"))==null||o.remove()}async function Zt(t=ke,e=1){return await(await fetch(`https://api.github.com/repos/${t}/contributors?per_page=100&page=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async function tt(t=ke,e=1,o=[]){const n=await Zt(t,e);return o=o.concat(n),n.length===100?tt(t,e+1,o):o}function Yt(){const t=document.querySelector("#contributors"),e=document.querySelector("#contributors_tabitem"),o=document.createElement("div");o.id="contributors_grid",o.innerHTML=`Kindly allow us a moment to retrieve the contributors. + [rel="stylesheet"][href*="file=style.css"]`).forEach(n=>{n.remove(),console.log("Remove stylesheet",n.getAttribute("href"))});const t=document.querySelectorAll('.styler, [class*="svelte"]:not(input)'),e=t.length;let o=0;t.forEach(n=>{n.style.display!=="none"&&n.style.display!=="block"&&(n.removeAttribute("style"),o++),[...n.classList].filter(s=>s.match(/^svelte.*/)).forEach(s=>n.classList.remove(s))}),console.log("Remove inline styles from DOM","Total Selectors:",e,"Removed Selectors:",o)}function Ye(t){var n;const e=t.getAttribute("data-apply"),o=e?e.match(/^(\w+)\s*\(.*\)$/):null;if(o&&typeof window[o[1]]=="function"){t.removeEventListener("click",window[o[1]]);const s=t.getAttribute("data-name")||t.getAttribute("data-path")||((n=t.closest(".card"))==null?void 0:n.getAttribute("data-name"));s&&console.log("Remove EventListener",`${s} - ${o[1]} - ${t.getAttribute("title")||""}`)}}function Re(t){var n;const{target:e,currentTarget:o}=t;if(e.classList.contains("card")||e.classList.contains("card-button")||e.classList.contains("tree-list-content")){let s=e.getAttribute("data-apply")||e.getAttribute("onClick");if(s&&(e.setAttribute("data-apply",s),e.removeAttribute("onClick")),e.setAttribute("onClick",s),e.click(),Ye(e),e.removeAttribute("onClick"),e.classList.contains("card-button")&&jt(),e.classList.contains("tree-list-content-dir")){const i=(n=o.closest(".layout-extra-networks"))==null?void 0:n.querySelector(".search_extra_networks");i&&e.getAttribute("data-path")&&(i.value=e.getAttribute("data-path"),Ee(i))}t.stopImmediatePropagation()}}async function Qe(t){if(window.opts.uiux_enable_event_delegation||Z){const e=$t(t);console.log("Starting Optimizations for",t.id),Z||t.querySelectorAll(".card, .card-button, .tree-list-content").forEach(o=>{const n=o.getAttribute("onClick")||o.getAttribute("data-apply");n&&(o.setAttribute("data-apply",n),o.removeAttribute("onClick"),Ye(o))}),console.log("Total Inline Event Listeners Before:",e,"After:",0),console.log("Attaching Event Listener using Event Delegation",t.id),t.removeEventListener("click",Re),t.addEventListener("click",Re)}}async function Vt(){const t=j(),e=function(n){const s=n.target.value.toLowerCase(),i=n.target.getAttribute("data-target");t.querySelectorAll(i).forEach(a=>{let c=a.getAttribute("data-sort-path").toLowerCase().indexOf(s)!==-1;s.length<2&&(c=!0),a.style.display=c?"":"none"})};document.querySelectorAll(".search_extra_networks").forEach(n=>{n.addEventListener("input",e)});function o(n,s){function i(v,E){const T=v.getAttribute(s),b=E.getAttribute(s);return!isNaN(T)&&!isNaN(b)?parseInt(T)-parseInt(b):Tb?1:0}const a=n.getAttribute("data-target"),r=t.querySelectorAll(a),c=r[0].parentElement,p=Array.from(r).sort(i);n.nextElementSibling.className.indexOf("active")!==-1&&p.reverse(),p.forEach(v=>c.appendChild(v))}document.querySelectorAll(".extra_networks_order_by").forEach(n=>{n.addEventListener("change",function(s){o(s.target,this.value)}),n.nextElementSibling.addEventListener("click",s=>{o(n,n.value),console.log("You selected: ",n.value)})})}async function Xt(){var t,e,o,n;if(!Z){const s=j();console.log("Remove Extra Networks Instances"),(t=s.querySelector("#img2img_textual_inversion_cards_html"))==null||t.remove(),(e=s.querySelector("#img2img_checkpoints_cards_html"))==null||e.remove(),(o=s.querySelector("#img2img_hypernetworks_cards_html"))==null||o.remove(),(n=s.querySelector("#img2img_lora_cards_html"))==null||n.remove(),console.log("Remove element #img2img_textual_inversion_cards_html"),console.log("Remove element #img2img_checkpoints_cards_html"),console.log("Remove element #img2img_hypernetworks_cards_html"),console.log("Remove element #img2img_lora_cards_html")}}async function Jt(t){await Promise.all(Array.from(t.querySelectorAll(".ae-button")).map(async e=>{const o=e.getAttribute("toggle"),n=e.getAttribute("active"),s=e.querySelector("input");s&&(s.checked===!0&&!n||s.checked===!1&&n)&&s.click(),n?e.classList.add("active"):e.classList.remove("active"),o&&e.addEventListener("click",a=>{const r=e.querySelector("input");r?(r.click(),r.checked===!0?e.classList.add("active"):r.checked===!1&&e.classList.remove("active")):e.classList.toggle("active")});const i=e.getAttribute("data-click");i&&e.addEventListener("click",a=>{var r;if(e.classList.contains("refresh-extra-networks")){const d=((r=e.closest(".layout"))==null?void 0:r.id).split("layout_")[1],p=document.querySelector(`#${d}_pane > div`);[document.querySelector(`#${d}_dirs`),document.querySelector(`#${d}_tree`),document.querySelector(`#${d}_cards`)].forEach(v=>{v&&p.append(v)}),document.querySelector(`#${d}_extra_refresh_internal`).dispatchEvent(new Event("click")),setTimeout(()=>{const v=document.querySelector(`#${d}_aside_split`);v.querySelectorAll(".portal").forEach((E,T,b)=>{ee(E,v,0,T,b.length)}),Qe(v)},1e3)}setTimeout(()=>{document.querySelectorAll(i).forEach(c=>{c.click()})},500)})}))}async function Kt(t){const e=Ut();await Promise.all(Array.from(t.querySelectorAll(".accordion-bar")).map(async o=>{const n=o.parentElement,s=n.closest(".split-container");let i=o;const a=n.getAttribute("iconTrigger");if(a){const r=t.querySelector(a);r&&(i=r,o.classList.add("pointer-events-none"))}if(n.className.indexOf("accordion-vertical")!==-1&&s.className.indexOf("split")!==-1){n.classList.add("expand");const r=s.parentElement.id,c=e[r];s.setAttribute("data-sizes",JSON.stringify(c.getSizes())),i==null||i.addEventListener("click",()=>{if(n.classList.toggle("expand"),s.className.indexOf("v-expand")!==-1)s.classList.remove("v-expand"),c.setSizes(JSON.parse(s.getAttribute("data-sizes")));else{s.classList.add("v-expand");let d=c.getSizes();s.setAttribute("data-sizes",JSON.stringify(d)),console.log(d),d[d.length-1]=0,d[d.length-2]=100;const p=parseFloat(window.getComputedStyle(o,null).getPropertyValue("padding-left"))*2;s.style.minWidth=o.offsetWidth+p+"px",c.setSizes(d)}})}else i==null||i.addEventListener("click",()=>{n.classList.toggle("expand")})}))}async function et(t){var o;await Pt(t),await Bt(t),await Kt(t),await Gt(t),await Jt(t),document.querySelector("#container-console-log").append(Xe()),(o=document.querySelector("#logger_screen"))==null||o.remove()}async function Zt(t=ke,e=1){return await(await fetch(`https://api.github.com/repos/${t}/contributors?per_page=100&page=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async function tt(t=ke,e=1,o=[]){const n=await Zt(t,e);return o=o.concat(n),n.length===100?tt(t,e+1,o):o}function Yt(){const t=document.querySelector("#contributors"),e=document.querySelector("#contributors_tabitem"),o=document.createElement("div");o.id="contributors_grid",o.innerHTML=`Kindly allow us a moment to retrieve the contributors. We're grateful for the many individuals who have generously put their time and effort to make this possible.`,e.append(o),t.addEventListener("click",n=>{t.getAttribute("data-visited")||(t.setAttribute("data-visited","true"),tt().then(i=>{o.innerHTML="";for(let a=0;a