Download comfyui-custom-scripts/web/js/common/utils.js from MarkLilly/mis-custom-nodes: direct link, hf CLI and curl.
- Browser
- Download file 649 Bytes
-
https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-custom-scripts/web/js/common/utils.js
- Command line
-
hf download hf://MarkLilly/mis-custom-nodes/comfyui-custom-scripts/web/js/common/utils.js
-
curl -L -o utils.js https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-custom-scripts/web/js/common/utils.js
649 Bytes
| import { $el } from "../../../../scripts/ui.js"; | |
| export function addStylesheet(url) { | |
| if (url.endsWith(".js")) { | |
| url = url.substr(0, url.length - 2) + "css"; | |
| } | |
| $el("link", { | |
| parent: document.head, | |
| rel: "stylesheet", | |
| type: "text/css", | |
| href: url.startsWith("http") ? url : getUrl(url), | |
| }); | |
| } | |
| export function getUrl(path, baseUrl) { | |
| if (baseUrl) { | |
| return new URL(path, baseUrl).toString(); | |
| } else { | |
| return new URL("../" + path, import.meta.url).toString(); | |
| } | |
| } | |
| export async function loadImage(url) { | |
| return new Promise((res, rej) => { | |
| const img = new Image(); | |
| img.onload = res; | |
| img.onerror = rej; | |
| img.src = url; | |
| }); | |
| } | |