working demo

This commit is contained in:
matan
2023-12-08 21:32:23 +02:00
parent 4ff3eb4cae
commit 92f9529fe3
6 changed files with 367 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
import { app } from "../../scripts/app.js";
import {LearnModal} from './learn-menu.js'
var docStyle = document.createElement('style');
docStyle.innerHTML = `
@keyframes Gradient {
0%{background-position: 0% 50%}
50%{background-position: 100% 50%}
100%{background-position: 0% 50%}
}
`;
document.head.appendChild(docStyle);
let learnModalInstance = null;
const ext = {
// Unique name for the extension
name: "ComfyUI-Assistant",
async setup(app) {
const menuLoadDefault = document.querySelector("#comfy-load-default-button");
const learnBtn = document.createElement("button");
learnBtn.textContent = "Learn";
if(!localStorage.getItem("clickedLearn")) {
learnBtn.style.background = "linear-gradient(270deg, #d53369, #daae51)";
learnBtn.style.backgroundSize = "200% 200%";
learnBtn.style.animation = "Gradient 2s ease infinite";
learnBtn.addEventListener("click", ()=>{
localStorage.setItem("clickedLearn","true")
learnBtn.style=null;
})
}
learnBtn.addEventListener("click", ()=>{
LearnModal.get().show();
})
menuLoadDefault.after(learnBtn);
},
};
app.registerExtension(ext);