Wavetype commited on
Commit
77d2e57
·
verified ·
1 Parent(s): c0eaf7e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +200 -149
index.html CHANGED
@@ -3,165 +3,216 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Wavetype Frequency Grid - Flux.1</title>
7
- <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
8
- <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.1/font/bootstrap-icons.min.css" rel="stylesheet">
9
  <style>
10
- :root { --border-ai: #ff00ff; --accent: #00ff00; --bg: #000; }
11
- body, html { margin: 0; padding: 0; width: 100%; height: 100vh; overflow: hidden; background: var(--bg); color: white; font-family: monospace; }
12
-
13
- #sidebar { position: fixed; left: 0; top: 0; width: 320px; height: 100vh; background: #111; border-right: 1px solid #333; z-index: 2000; transition: transform 0.3s; }
14
- #sidebar.collapsed { transform: translateX(-320px); }
15
-
16
- #sidebar-toggle { position: fixed; left: 320px; top: 20px; z-index: 2001; cursor: pointer; background: #111; color: var(--accent); border: 1px solid #333; border-left: none; padding: 5px; transition: left 0.3s; }
17
- #sidebar.collapsed ~ #sidebar-toggle { left: 0; }
18
-
19
- #grid-container { display: grid; width: 100vw; height: 100vh; gap: 4px; padding: 4px 4px 4px 324px; transition: padding 0.3s; }
20
- #sidebar.collapsed ~ #grid-container { padding-left: 4px; }
21
-
22
- .block { border: 2px solid #222; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; transition: 0.3s; }
23
- .block.active { position: fixed; top: 0; left: 0; width: 100vw!important; height: 100vh!important; z-index: 2500; background: #000; padding: 40px; cursor: default; }
24
-
25
- .ai-ui { display: none; width: 100%; max-width: 800px; flex-direction: column; gap: 15px; position: relative; }
26
- .block.active .ai-ui { display: flex; }
27
-
28
- /* Loading Visuals */
29
- .loader-overlay {
30
- display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
31
- background: rgba(0,0,0,0.8); z-index: 10; flex-direction: column; align-items: center; justify-content: center;
32
- border: 2px solid var(--border-ai); border-radius: 8px; animation: pulse 1.5s infinite;
33
- }
34
- @keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }
35
-
36
- .close-btn { display: none; position: absolute; top: 20px; right: 20px; background: #ff0055; color: #fff; border: none; padding: 5px 15px; z-index: 2600; }
37
- .block.active .close-btn { display: block; }
38
-
39
- .preview-img { width: 100%; max-height: 60vh; object-fit: contain; margin-top: 15px; border: 1px solid var(--border-ai); display: none; }
40
-
41
- input, textarea { border-radius: 0!important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  </style>
43
  </head>
44
  <body>
45
 
46
- <div id="sidebar">
47
- <div class="p-3 border-bottom border-secondary small">
48
- HF_AUTH: <span id="authStatus" class="text-danger">MISSING</span>
49
- </div>
50
- <div class="p-3">
51
- <label class="small text-muted">GRID DENSITY</label>
52
- <input type="range" class="form-range" id="density" min="1" max="16" value="4" oninput="initGrid()">
53
- <div class="mt-3">
54
- <label class="small text-muted">API TOKEN</label>
55
- <input type="password" class="form-control form-control-sm bg-dark text-white border-secondary" id="tokenField" placeholder="hf_...">
56
  </div>
57
- <button class="btn btn-info btn-sm w-100 mt-4" onclick="save()">SAVE TO CACHE</button>
58
- <button class="btn btn-outline-danger btn-sm w-100 mt-2" onclick="localStorage.clear(); location.reload();">CLEAR ALL</button>
 
 
 
 
59
  </div>
60
- </div>
61
-
62
- <div id="sidebar-toggle" onclick="document.getElementById('sidebar').classList.toggle('collapsed')"><i class="bi bi-list"></i></div>
63
- <div id="grid-container"></div>
64
-
65
- <script>
66
- let nodes = [];
67
-
68
- function init() {
69
- const params = new URLSearchParams(window.location.search);
70
- const urlKey = params.get('token');
71
- const hfInp = document.getElementById('tokenField');
72
-
73
- if (urlKey) {
74
- hfInp.value = urlKey;
75
- window.history.replaceState({}, '', window.location.pathname);
76
- save();
77
- } else {
78
- const cache = JSON.parse(localStorage.getItem('flux_cfg') || '{}');
79
- if (cache.token) hfInp.value = cache.token;
80
- if (cache.count) document.getElementById('density').value = cache.count;
81
- }
82
- updateStatus();
83
- initGrid();
84
- }
85
-
86
- function updateStatus() {
87
- const hasToken = document.getElementById('tokenField').value.length > 5;
88
- document.getElementById('authStatus').innerText = hasToken ? "ACTIVE" : "MISSING";
89
- document.getElementById('authStatus').className = hasToken ? "text-success" : "text-danger";
90
- }
91
-
92
- function initGrid() {
93
- const count = document.getElementById('density').value;
94
- const container = document.getElementById('grid-container');
95
- const cols = Math.ceil(Math.sqrt(count));
96
- container.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;
97
- container.innerHTML = '';
98
- nodes = Array.from({length: count}, (_, i) => ({ id: i }));
99
-
100
- nodes.forEach(n => {
101
- const div = document.createElement('div');
102
- div.className = 'block';
103
- div.onclick = () => { if(!div.classList.contains('active')) div.classList.add('active'); };
104
- div.innerHTML = `
105
- <div class="ai-ui">
106
- <div id="loader-${n.id}" class="loader-overlay">
107
- <div class="spinner-border text-info mb-2"></div>
108
- <div class="small">VPS INFERENCE IN PROGRESS...</div>
109
- </div>
110
- <h4 class="text-info">NODE_${n.id + 1}</h4>
111
- <textarea class="form-control bg-dark text-white border-secondary" id="p-${n.id}" rows="4" placeholder="Describe the image..."></textarea>
112
- <button class="btn btn-info mt-2" onclick="gen(${n.id}, this)">GENERATE ON FLUX</button>
113
- <img id="img-${n.id}" class="preview-img">
114
  </div>
115
- <div class="small text-muted">FLUX_NODE_${n.id + 1}</div>
116
- <button class="close-btn" onclick="event.stopPropagation(); this.parentElement.classList.remove('active')">EXIT</button>
 
 
 
 
117
  `;
118
- container.appendChild(div);
119
- });
120
- }
121
-
122
- async function gen(id, btn) {
123
- event.stopPropagation();
124
- const token = document.getElementById('tokenField').value;
125
- const prompt = document.getElementById(`p-${id}`).value;
126
- const img = document.getElementById(`img-${id}`);
127
- const loader = document.getElementById(`loader-${id}`);
128
-
129
- if (!token || !prompt) return alert("Please enter a token in sidebar and a prompt in the node.");
130
-
131
- // Show Loading state
132
- loader.style.display = 'flex';
133
- img.style.display = 'none';
134
- btn.disabled = true;
135
-
136
- try {
137
- const res = await fetch("https://api-inference.huggingface.co/models/Comfy-Org/flux2-klein-9B", {
138
- headers: { Authorization: `Bearer ${token}` },
139
- method: "POST",
140
- body: JSON.stringify({ inputs: prompt })
 
 
141
  });
 
 
 
 
 
 
 
 
142
 
143
- if (!res.ok) throw new Error("API Limit or Token Error");
144
-
145
- const blob = await res.blob();
146
- img.src = URL.createObjectURL(blob);
147
- img.style.display = 'block';
148
- } catch (e) {
149
- alert("Error: " + e.message);
150
- } finally {
151
- loader.style.display = 'none';
152
- btn.disabled = false;
153
- }
154
- }
155
-
156
- function save() {
157
- localStorage.setItem('flux_cfg', JSON.stringify({
158
- token: document.getElementById('tokenField').value,
159
- count: document.getElementById('density').value
160
- }));
161
- updateStatus();
162
- }
163
-
164
- window.onload = init;
165
- </script>
166
  </body>
167
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Modular HTML Builder</title>
 
 
7
  <style>
8
+ :root {
9
+ --bg: #0a0a0a;
10
+ --card: #1a1a1a;
11
+ --accent: #7b2ff7;
12
+ --text: #e0e0e0;
13
+ --border: #333;
14
+ }
15
+
16
+ body {
17
+ background: var(--bg);
18
+ color: var(--text);
19
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
20
+ margin: 0;
21
+ padding: 20px;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ }
26
+
27
+ #canvas {
28
+ width: 100%;
29
+ max-width: 800px;
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: 20px;
33
+ }
34
+
35
+ .module-box {
36
+ background: var(--card);
37
+ border: 2px solid var(--accent);
38
+ border-radius: 8px;
39
+ padding: 15px;
40
+ position: relative;
41
+ box-shadow: 0 4px 15px rgba(0,0,0,0.5);
42
+ }
43
+
44
+ .module-header {
45
+ display: flex;
46
+ justify-content: space-between;
47
+ margin-bottom: 10px;
48
+ font-size: 0.8rem;
49
+ text-transform: uppercase;
50
+ letter-spacing: 1px;
51
+ color: var(--accent);
52
+ }
53
+
54
+ textarea {
55
+ width: 100%;
56
+ height: 100px;
57
+ background: #000;
58
+ color: #00ff41;
59
+ border: 1px solid var(--border);
60
+ border-radius: 4px;
61
+ font-family: monospace;
62
+ padding: 10px;
63
+ box-sizing: border-box;
64
+ resize: vertical;
65
+ }
66
+
67
+ .controls {
68
+ margin-top: 10px;
69
+ display: flex;
70
+ gap: 10px;
71
+ flex-wrap: wrap;
72
+ }
73
+
74
+ button {
75
+ background: transparent;
76
+ color: white;
77
+ border: 1px solid var(--accent);
78
+ padding: 8px 15px;
79
+ border-radius: 4px;
80
+ cursor: pointer;
81
+ transition: 0.2s;
82
+ font-size: 0.8rem;
83
+ }
84
+
85
+ button:hover {
86
+ background: var(--accent);
87
+ }
88
+
89
+ .save-btn {
90
+ border-color: #00ff41;
91
+ color: #00ff41;
92
+ }
93
+
94
+ .save-btn:hover {
95
+ background: #00ff41;
96
+ color: black;
97
+ }
98
+
99
+ #library {
100
+ width: 100%;
101
+ max-width: 800px;
102
+ margin-top: 30px;
103
+ padding: 15px;
104
+ background: #111;
105
+ border-top: 1px solid var(--border);
106
+ }
107
+
108
+ .library-title {
109
+ font-size: 0.9rem;
110
+ margin-bottom: 10px;
111
+ color: #888;
112
+ }
113
+
114
+ .library-grid {
115
+ display: flex;
116
+ gap: 10px;
117
+ flex-wrap: wrap;
118
+ }
119
+
120
+ .lib-item {
121
+ background: #222;
122
+ border: 1px solid #444;
123
+ padding: 5px 10px;
124
+ font-size: 0.75rem;
125
+ cursor: pointer;
126
+ }
127
+
128
+ .lib-item:hover {
129
+ border-color: var(--accent);
130
+ }
131
+
132
+ .add-module-trigger {
133
+ margin: 20px;
134
+ padding: 15px 40px;
135
+ font-weight: bold;
136
+ border-width: 2px;
137
+ }
138
  </style>
139
  </head>
140
  <body>
141
 
142
+ <div id="canvas">
 
 
 
 
 
 
 
 
 
143
  </div>
144
+
145
+ <button class="add-module-trigger" onclick="createModule()">+ ADD NEW MODULE</button>
146
+
147
+ <div id="library">
148
+ <div class="library-title">SAVED HTML SNIPPETS (AUTO-SAVED)</div>
149
+ <div id="library-grid" class="library-grid"></div>
150
  </div>
151
+
152
+ <script>
153
+ let library = JSON.parse(localStorage.getItem('html_library')) || [];
154
+
155
+ function init() {
156
+ renderLibrary();
157
+ createModule(); // Start with one module
158
+ }
159
+
160
+ function createModule(initialContent = '') {
161
+ const canvas = document.getElementById('canvas');
162
+ const moduleId = 'mod_' + Date.now();
163
+
164
+ const box = document.createElement('div');
165
+ box.className = 'module-box';
166
+ box.id = moduleId;
167
+
168
+ box.innerHTML = `
169
+ <div class="module-header">
170
+ <span>HTML NODE</span>
171
+ <span style="cursor:pointer" onclick="document.getElementById('${moduleId}').remove()">[EXIT]</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  </div>
173
+ <textarea placeholder="Paste or type HTML here..." id="text_${moduleId}">${initialContent}</textarea>
174
+ <div class="controls">
175
+ <button onclick="previewModule('${moduleId}')">RENDER PREVIEW</button>
176
+ <button class="save-btn" onclick="saveToLibrary('${moduleId}')">SAVE TO LIBRARY</button>
177
+ </div>
178
+ <div id="preview_${moduleId}" style="margin-top:15px; display:none; padding:10px; border:1px dashed #444;"></div>
179
  `;
180
+
181
+ canvas.appendChild(box);
182
+ }
183
+
184
+ function saveToLibrary(moduleId) {
185
+ const content = document.getElementById(`text_${moduleId}`).value;
186
+ if (!content.trim()) return;
187
+
188
+ const name = prompt("Name this snippet:", "Snippet " + (library.length + 1));
189
+ if (name) {
190
+ library.push({ name, content });
191
+ localStorage.setItem('html_library', JSON.stringify(library));
192
+ renderLibrary();
193
+ }
194
+ }
195
+
196
+ function renderLibrary() {
197
+ const grid = document.getElementById('library-grid');
198
+ grid.innerHTML = '';
199
+ library.forEach((item, index) => {
200
+ const btn = document.createElement('button');
201
+ btn.className = 'lib-item';
202
+ btn.innerText = item.name;
203
+ btn.onclick = () => createModule(item.content);
204
+ grid.appendChild(btn);
205
  });
206
+ }
207
+
208
+ function previewModule(moduleId) {
209
+ const content = document.getElementById(`text_${moduleId}`).value;
210
+ const prevDiv = document.getElementById(`preview_${moduleId}`);
211
+ prevDiv.style.display = 'block';
212
+ prevDiv.innerHTML = content;
213
+ }
214
 
215
+ init();
216
+ </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  </body>
218
  </html>