ComfyUI/web/index.html

84 lines
3.0 KiB
HTML
Vendored

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ComfyUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="user.css" />
<link rel="stylesheet" type="text/css" href="materialdesignicons.min.css" />
<script type="module" crossorigin src="./assets/index-CoOvI8ZH.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-U_o182q3.css">
<script>
// Read the localstorage for "workflow" field
let storedApiJson = null;
// Function to check if any change has been made to the stored workflow
function checkForChanges() {
app.graphToPrompt().then(p=>{
if(storedApiJson === null) {
storedApiJson = JSON.stringify(p.output, null, 2);
}
const apiJson = JSON.stringify(p.output, null, 2);
if (apiJson !== storedApiJson) {
// Send a message to the parent window if change is detected
window.parent.postMessage({ type: 'workflowChanged', data: {currentApiJson: apiJson, storedApiJson: storedApiJson} }, '*');
storedApiJson = apiJson; // Update the stored workflow
}
});
}
// Call the checkForChanges function every second
setInterval(checkForChanges, 1000);
window.addEventListener('message', (event) => {
console.log(app, window);
if (event.data.type === 'promptWorkflow') {
const button = document.getElementById('queue-button');
if (button) {
button.click();
}
}
if (event.data.type === 'loadGraphData') {
app.loadGraphData(event.data.data);
window.parent.postMessage({ type: 'newWorkflowLoaded', data: event.data.data }, '*');
}
if (event.data.type === 'saveWorkflow') {
app.graphToPrompt().then(p=>{
const json = JSON.stringify(p.workflow, null, 2);
const apiJson = JSON.stringify(p.output, null, 2);
window.parent.postMessage({ type: 'workflowSaved', data: {normal: json, api: apiJson} }, '*');
});
}
});
</script>
</head>
<body class="litegraph grid">
<div id="vue-app"></div>
<div id="comfy-user-selection" class="comfy-user-selection" style="display: none;">
<main class="comfy-user-selection-inner">
<h1>ComfyUI</h1>
<form>
<section>
<label>New user:
<input placeholder="Enter a username" />
</label>
</section>
<div class="comfy-user-existing">
<span class="or-separator">OR</span>
<section>
<label>
Existing user:
<select>
<option hidden disabled selected value> Select a user </option>
</select>
</label>
</section>
</div>
<footer>
<span class="comfy-user-error">&nbsp;</span>
<button class="comfy-btn comfy-user-button-next">Next</button>
</footer>
</form>
</main>
</div>
</body>
</html>