Spaces:
Runtime error
Runtime error
Download extensions/sd-webui-controlnet/javascript/modal.js from youngwoo-dev/test1: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/youngwoo-dev/test1/resolve/main/extensions/sd-webui-controlnet/javascript/modal.js
- Command line
-
hf download hf://spaces/youngwoo-dev/test1/extensions/sd-webui-controlnet/javascript/modal.js
-
curl -L -o modal.js https://huggingface.co/spaces/youngwoo-dev/test1/resolve/main/extensions/sd-webui-controlnet/javascript/modal.js
1.27 kB
| (function () { | |
| const cnetModalRegisteredElements = new Set(); | |
| onUiUpdate(() => { | |
| // Get all the buttons that open a modal | |
| const btns = gradioApp().querySelectorAll(".cnet-modal-open"); | |
| // Get all the <span> elements that close a modal | |
| const spans = document.querySelectorAll(".cnet-modal-close"); | |
| // For each button, add a click event listener that opens the corresponding modal | |
| btns.forEach((btn) => { | |
| if (cnetModalRegisteredElements.has(btn)) return; | |
| cnetModalRegisteredElements.add(btn); | |
| const modalId = btn.id.replace('cnet-modal-open-', ''); | |
| const modal = document.getElementById("cnet-modal-" + modalId); | |
| btn.addEventListener('click', () => { | |
| modal.style.display = "block"; | |
| }); | |
| }); | |
| // For each <span> element, add a click event listener that closes the corresponding modal | |
| spans.forEach((span) => { | |
| if (cnetModalRegisteredElements.has(span)) return; | |
| cnetModalRegisteredElements.add(span); | |
| const modal = span.parentNode; | |
| span.addEventListener('click', () => { | |
| modal.style.display = "none"; | |
| }); | |
| }); | |
| }); | |
| })(); | |