Spaces:
Running
Running
Update index.html
Browse files- index.html +148 -182
index.html
CHANGED
|
@@ -1,290 +1,256 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html lang="
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
| 9 |
<style>
|
| 10 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
| 11 |
|
| 12 |
:root {
|
| 13 |
-
--
|
| 14 |
-
--
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
body {
|
| 18 |
-
font-family: '
|
| 19 |
background-color: var(--bg);
|
| 20 |
-
color: #
|
| 21 |
-
|
| 22 |
}
|
| 23 |
|
| 24 |
-
.
|
| 25 |
-
background:
|
| 26 |
-
|
| 27 |
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 28 |
}
|
| 29 |
|
| 30 |
#verification-overlay {
|
| 31 |
position: fixed; inset: 0; background: #000; z-index: 9999;
|
| 32 |
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 33 |
-
transition:
|
| 34 |
}
|
| 35 |
|
| 36 |
-
.
|
| 37 |
-
background:
|
| 38 |
-
|
| 39 |
-
|
| 40 |
}
|
| 41 |
|
| 42 |
-
.btn-
|
| 43 |
-
background:
|
| 44 |
-
|
| 45 |
}
|
| 46 |
|
| 47 |
-
.btn-
|
| 48 |
-
transform: translateY(
|
| 49 |
-
box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
.image-card {
|
| 53 |
-
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
| 54 |
}
|
| 55 |
|
| 56 |
.loader {
|
| 57 |
-
width:
|
| 58 |
-
border-radius: 50%; display: inline-block; animation: rotation
|
| 59 |
}
|
| 60 |
@keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
</style>
|
| 67 |
</head>
|
| 68 |
<body class="min-h-screen">
|
| 69 |
|
| 70 |
<!-- Cloudflare Gate -->
|
| 71 |
<div id="verification-overlay">
|
| 72 |
-
<div class="text-center
|
| 73 |
-
<h1 class="text-
|
| 74 |
-
<p class="text-
|
| 75 |
</div>
|
| 76 |
<div class="cf-turnstile" data-sitekey="1x00000000000000000000AA" data-callback="onVerified"></div>
|
| 77 |
</div>
|
| 78 |
|
| 79 |
-
<!--
|
| 80 |
-
<
|
| 81 |
-
<div class="flex items-center gap-
|
| 82 |
-
<
|
| 83 |
-
<
|
|
|
|
| 84 |
</div>
|
| 85 |
<div class="flex items-center gap-4">
|
| 86 |
-
<
|
| 87 |
-
<
|
| 88 |
-
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364-6.364l-.707.707M6.343 17.657l-.707.707m12.728 0l-.707-.707M6.343 6.343l-.707-.707M12 8a4 4 0 100 8 4 4 0 000-8z"></path></svg>
|
| 89 |
-
</div>
|
| 90 |
</div>
|
| 91 |
-
</
|
| 92 |
|
| 93 |
-
<main class="max-w-
|
| 94 |
-
<!--
|
| 95 |
-
<div class="lg:col-span-
|
| 96 |
-
<div class="
|
| 97 |
-
<
|
| 98 |
-
<
|
| 99 |
-
|
| 100 |
-
|
|
|
|
| 101 |
|
| 102 |
<div class="space-y-4">
|
| 103 |
<div>
|
| 104 |
-
<label class="text-[10px] font-bold text-
|
| 105 |
-
<
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
| 107 |
</div>
|
| 108 |
|
| 109 |
-
<div
|
| 110 |
-
<
|
| 111 |
-
|
| 112 |
-
<
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
</select>
|
| 117 |
-
</div>
|
| 118 |
-
<div>
|
| 119 |
-
<label class="text-[10px] font-bold text-gray-400 uppercase mb-2 block">Art Style</label>
|
| 120 |
-
<select id="style" class="w-full bg-white/5 border border-white/10 rounded-xl p-3 text-xs focus:outline-none">
|
| 121 |
-
<option value="">None (Standard)</option>
|
| 122 |
-
<option value="cinematic, highly detailed, 8k">Cinematic</option>
|
| 123 |
-
<option value="anime style, vibrant colors">Anime</option>
|
| 124 |
-
<option value="oil painting style, rich texture">Oil Painting</option>
|
| 125 |
-
<option value="3d render, unreal engine 5, octane render">3D Render</option>
|
| 126 |
-
</select>
|
| 127 |
-
</div>
|
| 128 |
</div>
|
| 129 |
-
|
| 130 |
-
<button id="btn-generate" disabled class="w-full btn-generate py-4 rounded-2xl font-bold text-sm flex items-center justify-center gap-3 opacity-50 cursor-not-allowed">
|
| 131 |
-
<span id="btn-text">GENERATE IMAGE</span>
|
| 132 |
-
<div id="btn-loader" class="hidden"><span class="loader"></span></div>
|
| 133 |
-
</button>
|
| 134 |
</div>
|
| 135 |
|
| 136 |
-
<
|
| 137 |
-
<
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
</div>
|
| 143 |
</div>
|
| 144 |
|
| 145 |
-
<!--
|
| 146 |
-
<div class="lg:col-span-
|
| 147 |
-
<div id="
|
| 148 |
-
<div id="placeholder" class="text-center
|
| 149 |
-
<
|
| 150 |
-
|
| 151 |
-
</div>
|
| 152 |
-
<p class="text-gray-400 text-sm italic">Mô tả ý tưởng của Minh Đức và nhấn Generate...</p>
|
| 153 |
</div>
|
| 154 |
-
<img id="result-img" class="hidden w-full h-full object-contain animate-in fade-in duration-700">
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
|
|
|
|
|
|
| 160 |
</button>
|
| 161 |
-
<button onclick="
|
| 162 |
-
<svg width="
|
| 163 |
</button>
|
| 164 |
</div>
|
| 165 |
</div>
|
| 166 |
|
| 167 |
-
<!-- History -->
|
| 168 |
-
<div>
|
| 169 |
-
<
|
| 170 |
-
<
|
| 171 |
-
|
| 172 |
-
</
|
| 173 |
-
<div id="
|
| 174 |
-
<!-- Cards
|
| 175 |
</div>
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
</main>
|
| 179 |
|
| 180 |
<script>
|
| 181 |
-
const
|
| 182 |
-
const
|
| 183 |
-
const
|
| 184 |
-
const
|
| 185 |
const resultImg = document.getElementById('result-img');
|
| 186 |
const placeholder = document.getElementById('placeholder');
|
| 187 |
-
const
|
| 188 |
-
const
|
| 189 |
-
const ratioSelect = document.getElementById('ratio');
|
| 190 |
-
const styleSelect = document.getElementById('style');
|
| 191 |
-
|
| 192 |
-
let isVerified = false;
|
| 193 |
|
| 194 |
function onVerified() {
|
| 195 |
-
isVerified = true;
|
| 196 |
const overlay = document.getElementById('verification-overlay');
|
| 197 |
overlay.style.opacity = '0';
|
| 198 |
setTimeout(() => {
|
| 199 |
overlay.style.display = 'none';
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
|
|
|
| 203 |
}
|
| 204 |
|
| 205 |
-
async function
|
| 206 |
-
const
|
| 207 |
-
if (!
|
| 208 |
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
const
|
| 216 |
-
const
|
| 217 |
-
const style = styleSelect.value;
|
| 218 |
-
const finalPrompt = style ? `${prompt}, ${style}` : prompt;
|
| 219 |
|
| 220 |
-
const
|
| 221 |
|
| 222 |
-
// Pre-load image
|
| 223 |
const img = new Image();
|
| 224 |
img.onload = () => {
|
| 225 |
-
resultImg.src =
|
| 226 |
-
resultImg.classList.remove('hidden', 'opacity-
|
| 227 |
placeholder.classList.add('hidden');
|
| 228 |
-
|
| 229 |
|
| 230 |
-
|
| 231 |
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
btnLoader.classList.add('hidden');
|
| 236 |
-
};
|
| 237 |
-
img.onerror = () => {
|
| 238 |
-
alert("Lỗi server tạo ảnh, Minh Đức vui lòng thử lại!");
|
| 239 |
-
btnGen.disabled = false;
|
| 240 |
-
btnText.classList.remove('hidden');
|
| 241 |
-
btnLoader.classList.add('hidden');
|
| 242 |
};
|
| 243 |
-
img.src =
|
| 244 |
}
|
| 245 |
|
| 246 |
-
function
|
| 247 |
const div = document.createElement('div');
|
| 248 |
-
div.className = "
|
| 249 |
-
div.innerHTML =
|
| 250 |
-
<img src="${url}" class="w-full h-full object-cover">
|
| 251 |
-
<div class="absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex flex-col justify-end p-3">
|
| 252 |
-
<p class="text-[9px] text-white truncate font-medium">${title}</p>
|
| 253 |
-
</div>
|
| 254 |
-
`;
|
| 255 |
div.onclick = () => {
|
| 256 |
resultImg.src = url;
|
| 257 |
resultImg.classList.remove('hidden');
|
| 258 |
placeholder.classList.add('hidden');
|
|
|
|
| 259 |
};
|
| 260 |
-
|
| 261 |
}
|
| 262 |
|
| 263 |
-
function
|
| 264 |
-
const url = resultImg.src;
|
| 265 |
const link = document.createElement('a');
|
| 266 |
-
link.href =
|
| 267 |
-
link.download = `
|
| 268 |
-
document.body.appendChild(link);
|
| 269 |
link.click();
|
| 270 |
-
document.body.removeChild(link);
|
| 271 |
}
|
| 272 |
|
| 273 |
-
function
|
| 274 |
-
|
| 275 |
-
const
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
dummy.select();
|
| 279 |
-
document.execCommand("copy");
|
| 280 |
-
document.body.removeChild(dummy);
|
| 281 |
-
alert("Đã sao chép link ảnh!");
|
| 282 |
}
|
| 283 |
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
}
|
| 288 |
</script>
|
| 289 |
</body>
|
| 290 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Flux Pro | Image Generation</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
| 9 |
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono&display=swap');
|
| 11 |
|
| 12 |
:root {
|
| 13 |
+
--bg: #0a0a0a;
|
| 14 |
+
--accent: #ffffff;
|
| 15 |
+
--border: rgba(255, 255, 255, 0.1);
|
| 16 |
}
|
| 17 |
|
| 18 |
body {
|
| 19 |
+
font-family: 'Inter', sans-serif;
|
| 20 |
background-color: var(--bg);
|
| 21 |
+
color: #ececec;
|
| 22 |
+
letter-spacing: -0.01em;
|
| 23 |
}
|
| 24 |
|
| 25 |
+
.panel {
|
| 26 |
+
background: #111111;
|
| 27 |
+
border: 1px solid var(--border);
|
|
|
|
| 28 |
}
|
| 29 |
|
| 30 |
#verification-overlay {
|
| 31 |
position: fixed; inset: 0; background: #000; z-index: 9999;
|
| 32 |
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 33 |
+
transition: opacity 0.5s ease;
|
| 34 |
}
|
| 35 |
|
| 36 |
+
.btn-primary {
|
| 37 |
+
background: #ffffff;
|
| 38 |
+
color: #000000;
|
| 39 |
+
transition: all 0.2s ease;
|
| 40 |
}
|
| 41 |
|
| 42 |
+
.btn-primary:hover:not(:disabled) {
|
| 43 |
+
background: #e5e5e5;
|
| 44 |
+
transform: translateY(-1px);
|
| 45 |
}
|
| 46 |
|
| 47 |
+
.btn-primary:active:not(:disabled) {
|
| 48 |
+
transform: translateY(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
.loader {
|
| 52 |
+
width: 18px; height: 18px; border: 2px solid #000; border-bottom-color: transparent;
|
| 53 |
+
border-radius: 50%; display: inline-block; animation: rotation 0.8s linear infinite;
|
| 54 |
}
|
| 55 |
@keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
| 56 |
|
| 57 |
+
select, textarea, input {
|
| 58 |
+
background: #1a1a1a !important;
|
| 59 |
+
border: 1px solid var(--border) !important;
|
| 60 |
+
color: white !important;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
select:focus, textarea:focus {
|
| 64 |
+
border-color: rgba(255,255,255,0.3) !important;
|
| 65 |
+
outline: none;
|
| 66 |
+
}
|
| 67 |
</style>
|
| 68 |
</head>
|
| 69 |
<body class="min-h-screen">
|
| 70 |
|
| 71 |
<!-- Cloudflare Gate -->
|
| 72 |
<div id="verification-overlay">
|
| 73 |
+
<div class="mb-8 text-center">
|
| 74 |
+
<h1 class="text-2xl font-bold tracking-tight mb-1">FLUX PRO</h1>
|
| 75 |
+
<p class="text-zinc-500 text-[10px] font-mono uppercase tracking-widest">System Authentication Required</p>
|
| 76 |
</div>
|
| 77 |
<div class="cf-turnstile" data-sitekey="1x00000000000000000000AA" data-callback="onVerified"></div>
|
| 78 |
</div>
|
| 79 |
|
| 80 |
+
<!-- Nav -->
|
| 81 |
+
<nav class="border-b border-white/5 h-16 flex items-center px-6 justify-between bg-black/50 backdrop-blur-md sticky top-0 z-40">
|
| 82 |
+
<div class="flex items-center gap-6">
|
| 83 |
+
<span class="font-bold text-sm tracking-tighter uppercase">Flux Engine <span class="text-zinc-500 font-medium">v1.0</span></span>
|
| 84 |
+
<div class="h-4 w-[1px] bg-white/10 hidden sm:block"></div>
|
| 85 |
+
<span class="hidden sm:block text-[10px] font-mono text-zinc-500">STATUS: STABLE</span>
|
| 86 |
</div>
|
| 87 |
<div class="flex items-center gap-4">
|
| 88 |
+
<div id="connection-dot" class="w-2 h-2 bg-zinc-700 rounded-full"></div>
|
| 89 |
+
<span class="text-[10px] font-mono text-zinc-500 uppercase tracking-wider">Secure Connection</span>
|
|
|
|
|
|
|
| 90 |
</div>
|
| 91 |
+
</nav>
|
| 92 |
|
| 93 |
+
<main class="max-w-7xl mx-auto p-6 grid grid-cols-1 lg:grid-cols-12 gap-6">
|
| 94 |
+
<!-- Sidebar Controls -->
|
| 95 |
+
<div class="lg:col-span-3 space-y-4">
|
| 96 |
+
<div class="panel p-5 rounded-xl space-y-5">
|
| 97 |
+
<div>
|
| 98 |
+
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-wider mb-2 block">Prompt</label>
|
| 99 |
+
<textarea id="prompt" rows="5" placeholder="Enter technical description..."
|
| 100 |
+
class="w-full rounded-lg p-3 text-sm resize-none transition-all"></textarea>
|
| 101 |
+
</div>
|
| 102 |
|
| 103 |
<div class="space-y-4">
|
| 104 |
<div>
|
| 105 |
+
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-wider mb-2 block">Resolution</label>
|
| 106 |
+
<select id="ratio" class="w-full rounded-lg p-2.5 text-xs">
|
| 107 |
+
<option value="1024x1024">1:1 Square</option>
|
| 108 |
+
<option value="1024x1792">9:16 Portrait</option>
|
| 109 |
+
<option value="1792x1024">16:9 Landscape</option>
|
| 110 |
+
</select>
|
| 111 |
</div>
|
| 112 |
|
| 113 |
+
<div>
|
| 114 |
+
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-wider mb-2 block">Visual Model</label>
|
| 115 |
+
<select id="model" class="w-full rounded-lg p-2.5 text-xs">
|
| 116 |
+
<option value="flux">Flux.1 Standard</option>
|
| 117 |
+
<option value="flux-realism">Flux Realism</option>
|
| 118 |
+
<option value="flux-pro">Flux High-Res</option>
|
| 119 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
</div>
|
| 122 |
|
| 123 |
+
<button id="btn-generate" disabled class="w-full btn-primary py-3 rounded-lg font-bold text-xs flex items-center justify-center gap-2 opacity-30 cursor-not-allowed">
|
| 124 |
+
<span id="btn-text">GENERATE</span>
|
| 125 |
+
<div id="btn-loader" class="hidden"><span class="loader"></span></div>
|
| 126 |
+
</button>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div class="panel p-4 rounded-xl">
|
| 130 |
+
<p class="text-[9px] text-zinc-600 font-mono leading-relaxed uppercase">
|
| 131 |
+
API Endpoints: pollinations.ai<br>
|
| 132 |
+
License: CreativeML Open RAIL-M<br>
|
| 133 |
+
Hardware: Cloud-Based GPU Cluster
|
| 134 |
+
</p>
|
| 135 |
</div>
|
| 136 |
</div>
|
| 137 |
|
| 138 |
+
<!-- Main Workspace -->
|
| 139 |
+
<div class="lg:col-span-9 space-y-6">
|
| 140 |
+
<div id="viewport" class="aspect-video lg:aspect-auto lg:h-[600px] panel rounded-2xl flex items-center justify-center relative overflow-hidden group bg-[#050505]">
|
| 141 |
+
<div id="placeholder" class="text-center opacity-20">
|
| 142 |
+
<svg class="mx-auto mb-4" width="40" height="40" fill="none" stroke="currentColor" stroke-width="1" viewBox="0 0 24 24"><path d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
|
| 143 |
+
<p class="text-xs font-mono uppercase tracking-widest">Waiting for input</p>
|
|
|
|
|
|
|
| 144 |
</div>
|
|
|
|
| 145 |
|
| 146 |
+
<img id="result-img" class="hidden max-w-full max-h-full object-contain">
|
| 147 |
+
|
| 148 |
+
<!-- Overlay Tools -->
|
| 149 |
+
<div id="tools" class="hidden absolute top-4 right-4 flex gap-2">
|
| 150 |
+
<button onclick="downloadImg()" class="p-2 bg-black/60 hover:bg-black border border-white/10 rounded-lg backdrop-blur-md transition-all">
|
| 151 |
+
<svg width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
|
| 152 |
</button>
|
| 153 |
+
<button onclick="copyLink()" class="p-2 bg-black/60 hover:bg-black border border-white/10 rounded-lg backdrop-blur-md transition-all">
|
| 154 |
+
<svg width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
|
| 155 |
</button>
|
| 156 |
</div>
|
| 157 |
</div>
|
| 158 |
|
| 159 |
+
<!-- History Feed -->
|
| 160 |
+
<div class="space-y-3">
|
| 161 |
+
<div class="flex items-center justify-between">
|
| 162 |
+
<h3 class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em]">Session History</h3>
|
| 163 |
+
<button onclick="clearHistory()" class="text-[10px] text-zinc-600 hover:text-red-400 transition-colors uppercase">Clear</button>
|
| 164 |
+
</div>
|
| 165 |
+
<div id="history" class="grid grid-cols-3 sm:grid-cols-6 gap-3">
|
| 166 |
+
<!-- Cards -->
|
| 167 |
</div>
|
| 168 |
</div>
|
| 169 |
</div>
|
| 170 |
</main>
|
| 171 |
|
| 172 |
<script>
|
| 173 |
+
const btn = document.getElementById('btn-generate');
|
| 174 |
+
const btnTxt = document.getElementById('btn-text');
|
| 175 |
+
const loader = document.getElementById('btn-loader');
|
| 176 |
+
const prompt = document.getElementById('prompt');
|
| 177 |
const resultImg = document.getElementById('result-img');
|
| 178 |
const placeholder = document.getElementById('placeholder');
|
| 179 |
+
const tools = document.getElementById('tools');
|
| 180 |
+
const history = document.getElementById('history');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
function onVerified() {
|
|
|
|
| 183 |
const overlay = document.getElementById('verification-overlay');
|
| 184 |
overlay.style.opacity = '0';
|
| 185 |
setTimeout(() => {
|
| 186 |
overlay.style.display = 'none';
|
| 187 |
+
btn.disabled = false;
|
| 188 |
+
btn.classList.remove('opacity-30', 'cursor-not-allowed');
|
| 189 |
+
document.getElementById('connection-dot').classList.replace('bg-zinc-700', 'bg-emerald-500');
|
| 190 |
+
}, 500);
|
| 191 |
}
|
| 192 |
|
| 193 |
+
async function process() {
|
| 194 |
+
const text = prompt.value.trim();
|
| 195 |
+
if (!text) return;
|
| 196 |
|
| 197 |
+
btn.disabled = true;
|
| 198 |
+
btnTxt.innerText = "PROCESSING";
|
| 199 |
+
loader.classList.remove('hidden');
|
| 200 |
+
resultImg.classList.add('opacity-30');
|
| 201 |
+
|
| 202 |
+
const seed = Math.floor(Math.random() * 10000000);
|
| 203 |
+
const res = document.getElementById('ratio').value.split('x');
|
| 204 |
+
const model = document.getElementById('model').value;
|
|
|
|
|
|
|
| 205 |
|
| 206 |
+
const url = `https://image.pollinations.ai/prompt/${encodeURIComponent(text)}?seed=${seed}&width=${res[0]}&height=${res[1]}&nologo=true&model=${model}`;
|
| 207 |
|
|
|
|
| 208 |
const img = new Image();
|
| 209 |
img.onload = () => {
|
| 210 |
+
resultImg.src = url;
|
| 211 |
+
resultImg.classList.remove('hidden', 'opacity-30');
|
| 212 |
placeholder.classList.add('hidden');
|
| 213 |
+
tools.classList.remove('hidden');
|
| 214 |
|
| 215 |
+
saveToHistory(url);
|
| 216 |
|
| 217 |
+
btn.disabled = false;
|
| 218 |
+
btnTxt.innerText = "GENERATE";
|
| 219 |
+
loader.classList.add('hidden');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
};
|
| 221 |
+
img.src = url;
|
| 222 |
}
|
| 223 |
|
| 224 |
+
function saveToHistory(url) {
|
| 225 |
const div = document.createElement('div');
|
| 226 |
+
div.className = "aspect-square panel rounded-lg overflow-hidden cursor-pointer hover:border-white/30 transition-all";
|
| 227 |
+
div.innerHTML = `<img src="${url}" class="w-full h-full object-cover">`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
div.onclick = () => {
|
| 229 |
resultImg.src = url;
|
| 230 |
resultImg.classList.remove('hidden');
|
| 231 |
placeholder.classList.add('hidden');
|
| 232 |
+
tools.classList.remove('hidden');
|
| 233 |
};
|
| 234 |
+
history.prepend(div);
|
| 235 |
}
|
| 236 |
|
| 237 |
+
function downloadImg() {
|
|
|
|
| 238 |
const link = document.createElement('a');
|
| 239 |
+
link.href = resultImg.src;
|
| 240 |
+
link.download = `output_${Date.now()}.png`;
|
|
|
|
| 241 |
link.click();
|
|
|
|
| 242 |
}
|
| 243 |
|
| 244 |
+
function copyLink() {
|
| 245 |
+
navigator.clipboard.writeText(resultImg.src);
|
| 246 |
+
const originalText = btnTxt.innerText;
|
| 247 |
+
btnTxt.innerText = "COPIED";
|
| 248 |
+
setTimeout(() => btnTxt.innerText = originalText, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
}
|
| 250 |
|
| 251 |
+
function clearHistory() { history.innerHTML = ''; }
|
| 252 |
+
|
| 253 |
+
btn.onclick = process;
|
|
|
|
| 254 |
</script>
|
| 255 |
</body>
|
| 256 |
</html>
|