2025-06-09 14:03:30 +00:00

1302 lines
47 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Swiggis Bildgenerator</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎨</text></svg>">
<style>
:root {
/* Colors */
--color-background: rgba(252, 252, 249, 1);
--color-surface: rgba(255, 255, 253, 1);
--color-text: rgba(19, 52, 59, 1);
--color-text-secondary: rgba(98, 108, 113, 1);
--color-primary: rgba(33, 128, 141, 1);
--color-primary-hover: rgba(29, 116, 128, 1);
--color-primary-active: rgba(26, 104, 115, 1);
--color-secondary: rgba(94, 82, 64, 0.12);
--color-secondary-hover: rgba(94, 82, 64, 0.2);
--color-secondary-active: rgba(94, 82, 64, 0.25);
--color-border: rgba(94, 82, 64, 0.2);
--color-btn-primary-text: rgba(252, 252, 249, 1);
--color-card-border: rgba(94, 82, 64, 0.12);
--color-card-border-inner: rgba(94, 82, 64, 0.12);
--color-error: rgba(192, 21, 47, 1);
--color-success: rgba(33, 128, 141, 1);
--color-warning: rgba(168, 75, 47, 1);
--color-info: rgba(98, 108, 113, 1);
--color-focus-ring: rgba(33, 128, 141, 0.4);
--color-select-caret: rgba(19, 52, 59, 0.8);
/* Common style patterns */
--focus-ring: 0 0 0 3px var(--color-focus-ring);
--focus-outline: 2px solid var(--color-primary);
--status-bg-opacity: 0.15;
--status-border-opacity: 0.25;
--select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
/* RGB versions for opacity control */
--color-success-rgb: 33, 128, 141;
--color-error-rgb: 192, 21, 47;
--color-warning-rgb: 168, 75, 47;
--color-info-rgb: 98, 108, 113;
/* Typography */
--font-family-base: "FKGroteskNeue", "Geist", "Inter", -apple-system,
BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo,
Monaco, Consolas, monospace;
--font-size-xs: 11px;
--font-size-sm: 12px;
--font-size-base: 14px;
--font-size-md: 14px;
--font-size-lg: 16px;
--font-size-xl: 18px;
--font-size-2xl: 20px;
--font-size-3xl: 24px;
--font-size-4xl: 30px;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 550;
--font-weight-bold: 600;
--line-height-tight: 1.2;
--line-height-normal: 1.5;
--letter-spacing-tight: -0.01em;
/* Spacing */
--space-0: 0;
--space-1: 1px;
--space-2: 2px;
--space-4: 4px;
--space-6: 6px;
--space-8: 8px;
--space-10: 10px;
--space-12: 12px;
--space-16: 16px;
--space-20: 20px;
--space-24: 24px;
--space-32: 32px;
/* Border Radius */
--radius-sm: 6px;
--radius-base: 8px;
--radius-md: 10px;
--radius-lg: 12px;
--radius-full: 9999px;
/* Shadows */
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04),
0 2px 4px -1px rgba(0, 0, 0, 0.02);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
0 4px 6px -2px rgba(0, 0, 0, 0.02);
--shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15),
inset 0 -1px 0 rgba(0, 0, 0, 0.03);
/* Animation */
--duration-fast: 150ms;
--duration-normal: 250ms;
--ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
/* Layout */
--container-sm: 640px;
--container-md: 768px;
--container-lg: 1024px;
--container-xl: 1280px;
}
/* Dark mode colors */
@media (prefers-color-scheme: dark) {
:root {
--color-background: rgba(31, 33, 33, 1);
--color-surface: rgba(38, 40, 40, 1);
--color-text: rgba(245, 245, 245, 1);
--color-text-secondary: rgba(167, 169, 169, 0.7);
--color-primary: rgba(50, 184, 198, 1);
--color-primary-hover: rgba(45, 166, 178, 1);
--color-primary-active: rgba(41, 150, 161, 1);
--color-secondary: rgba(119, 124, 124, 0.15);
--color-secondary-hover: rgba(119, 124, 124, 0.25);
--color-secondary-active: rgba(119, 124, 124, 0.3);
--color-border: rgba(119, 124, 124, 0.3);
--color-error: rgba(255, 84, 89, 1);
--color-success: rgba(50, 184, 198, 1);
--color-warning: rgba(230, 129, 97, 1);
--color-info: rgba(167, 169, 169, 1);
--color-focus-ring: rgba(50, 184, 198, 0.4);
--color-btn-primary-text: rgba(19, 52, 59, 1);
--color-card-border: rgba(119, 124, 124, 0.2);
--color-card-border-inner: rgba(119, 124, 124, 0.15);
--shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
inset 0 -1px 0 rgba(0, 0, 0, 0.15);
--button-border-secondary: rgba(119, 124, 124, 0.2);
--color-border-secondary: rgba(119, 124, 124, 0.2);
--color-select-caret: rgba(245, 245, 245, 0.8);
/* Common style patterns - updated for dark mode */
--focus-ring: 0 0 0 3px var(--color-focus-ring);
--focus-outline: 2px solid var(--color-primary);
--status-bg-opacity: 0.15;
--status-border-opacity: 0.25;
--select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
/* RGB versions for dark mode */
--color-success-rgb: 50, 184, 198;
--color-error-rgb: 255, 84, 89;
--color-warning-rgb: 230, 129, 97;
--color-info-rgb: 167, 169, 169;
}
}
/* Data attribute for manual theme switching */
[data-color-scheme="dark"] {
--color-background: rgba(31, 33, 33, 1);
--color-surface: rgba(38, 40, 40, 1);
--color-text: rgba(245, 245, 245, 1);
--color-text-secondary: rgba(167, 169, 169, 0.7);
--color-primary: rgba(50, 184, 198, 1);
--color-primary-hover: rgba(45, 166, 178, 1);
--color-primary-active: rgba(41, 150, 161, 1);
--color-secondary: rgba(119, 124, 124, 0.15);
--color-secondary-hover: rgba(119, 124, 124, 0.25);
--color-secondary-active: rgba(119, 124, 124, 0.3);
--color-border: rgba(119, 124, 124, 0.3);
--color-error: rgba(255, 84, 89, 1);
--color-success: rgba(50, 184, 198, 1);
--color-warning: rgba(230, 129, 97, 1);
--color-info: rgba(167, 169, 169, 1);
--color-focus-ring: rgba(50, 184, 198, 0.4);
--color-btn-primary-text: rgba(19, 52, 59, 1);
--color-card-border: rgba(119, 124, 124, 0.15);
--color-card-border-inner: rgba(119, 124, 124, 0.15);
--shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
inset 0 -1px 0 rgba(0, 0, 0, 0.15);
--color-border-secondary: rgba(119, 124, 124, 0.2);
--color-select-caret: rgba(245, 245, 245, 0.8);
/* Common style patterns - updated for dark mode */
--focus-ring: 0 0 0 3px var(--color-focus-ring);
--focus-outline: 2px solid var(--color-primary);
--status-bg-opacity: 0.15;
--status-border-opacity: 0.25;
--select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
/* RGB versions for dark mode */
--color-success-rgb: 50, 184, 198;
--color-error-rgb: 255, 84, 89;
--color-warning-rgb: 230, 129, 97;
--color-info-rgb: 167, 169, 169;
}
[data-color-scheme="light"] {
--color-background: rgba(252, 252, 249, 1);
--color-surface: rgba(255, 255, 253, 1);
--color-text: rgba(19, 52, 59, 1);
--color-text-secondary: rgba(98, 108, 113, 1);
--color-primary: rgba(33, 128, 141, 1);
--color-primary-hover: rgba(29, 116, 128, 1);
--color-primary-active: rgba(26, 104, 115, 1);
--color-secondary: rgba(94, 82, 64, 0.12);
--color-secondary-hover: rgba(94, 82, 64, 0.2);
--color-secondary-active: rgba(94, 82, 64, 0.25);
--color-border: rgba(94, 82, 64, 0.2);
--color-btn-primary-text: rgba(252, 252, 249, 1);
--color-card-border: rgba(94, 82, 64, 0.12);
--color-card-border-inner: rgba(94, 82, 64, 0.12);
--color-error: rgba(192, 21, 47, 1);
--color-success: rgba(33, 128, 141, 1);
--color-warning: rgba(168, 75, 47, 1);
--color-info: rgba(98, 108, 113, 1);
--color-focus-ring: rgba(33, 128, 141, 0.4);
/* RGB versions for light mode */
--color-success-rgb: 33, 128, 141;
--color-error-rgb: 192, 21, 47;
--color-warning-rgb: 168, 75, 47;
--color-info-rgb: 98, 108, 113;
}
/* Base styles */
html {
font-size: var(--font-size-lg); /* Updated from style.css for consistency */
font-family: "Segoe UI", "Roboto", "Helvetica Neue", sans-serif; /* Updated */
line-height: var(--line-height-normal);
color: #000000; /* Updated */
background-color: #f9fafc; /* Updated */
-webkit-font-smoothing: antialiased;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
background-color: #f9fafc; /* Added from index.html specific styles */
color: #000000; /* Added from index.html specific styles */
font-size: 16px; /* Added from index.html specific styles */
line-height: 1.5; /* Added from index.html specific styles */
}
*,
*::before,
*::after {
box-sizing: inherit;
}
/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
font-weight: var(--font-weight-semibold);
line-height: var(--line-height-tight);
color: #000000; /* Updated */
letter-spacing: var(--letter-spacing-tight);
}
h1 {
font-size: 24px; /* From index.html specific styles */
text-align: center; /* From index.html specific styles */
margin-bottom: var(--space-8); /* From index.html specific styles */
}
h2 {
font-size: var(--font-size-3xl);
}
h3 {
font-size: var(--font-size-2xl);
}
h4 {
font-size: var(--font-size-xl);
}
h5 {
font-size: var(--font-size-lg);
}
h6 {
font-size: var(--font-size-md);
}
p {
margin: 0 0 var(--space-16) 0;
color: #000000; /* Updated */
}
header p { /* From index.html specific styles */
text-align: center;
margin-bottom: var(--space-32);
color: #000000;
}
a {
color: var(--color-primary);
text-decoration: none;
transition: color var(--duration-fast) var(--ease-standard);
}
a:hover {
color: var(--color-primary-hover);
}
code,
pre {
font-family: var(--font-family-mono);
font-size: calc(var(--font-size-base) * 0.95);
background-color: var(--color-secondary);
border-radius: var(--radius-sm);
}
code {
padding: var(--space-1) var(--space-4);
}
pre {
padding: var(--space-16);
margin: var(--space-16) 0;
overflow: auto;
border: 1px solid var(--color-border);
}
pre code {
background: none;
padding: 0;
}
/* Container and Layout */
.container { /* From index.html specific styles */
max-width: 640px;
margin: 0 auto;
padding: var(--space-20);
}
/* Form Styling */
.image-form { /* From index.html specific styles */
background: white;
padding: var(--space-24);
border-radius: var(--radius-lg);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
margin-bottom: var(--space-24);
}
.form-group {
margin-bottom: var(--space-16);
}
.form-label { /* Modified from index.html specific styles */
display: block;
margin-bottom: var(--space-8);
font-weight: 500; /* was --font-weight-medium */
color: #333333;
font-size: 16px; /* was var(--font-size-sm) */
}
.form-label i { /* From index.html specific styles */
margin-right: var(--space-8);
color: #007BFF;
}
.form-control { /* Modified from index.html specific styles */
width: 100%;
padding: var(--space-12) var(--space-16); /* Was var(--space-8) var(--space-12) */
border: 1px solid #e1e5e9; /* Was var(--color-border) */
border-radius: var(--radius-base);
font-size: 16px; /* Was var(--font-size-md) */
color: #000000; /* Was var(--color-text) */
background-color: white; /* Was var(--color-surface) */
transition: border-color 0.3s ease, box-shadow 0.3s ease; /* Updated transition */
box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Added shadow */
}
.form-control:focus { /* Modified from index.html specific styles */
outline: none; /* Was var(--focus-outline) */
border-color: #007BFF; /* Was var(--color-primary) */
box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1); /* Added shadow */
}
.form-control:disabled { /* From index.html specific styles */
background-color: #f8f9fa;
color: #6c757d;
cursor: not-allowed;
opacity: 0.65;
}
textarea.form-control {
resize: vertical; /* From index.html specific styles */
min-height: 80px; /* From index.html specific styles */
font-family: "Segoe UI", "Roboto", "Helvetica Neue", sans-serif; /* Updated */
font-size: 16px; /* Updated */
}
select.form-control {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: var(--select-caret-light);
background-repeat: no-repeat;
background-position: right var(--space-12) center;
background-size: 16px;
padding-right: var(--space-32);
}
/* Form Row Layout */
.form-row { /* From index.html specific styles */
display: flex;
gap: var(--space-16);
}
.form-row .form-group { /* From index.html specific styles */
flex: 1;
}
/* Checkbox Group */
.checkbox-group { /* From index.html specific styles */
display: flex;
flex-wrap: wrap;
gap: var(--space-16);
margin-bottom: var(--space-20);
}
.checkbox-label { /* From index.html specific styles */
display: flex;
align-items: center;
cursor: pointer;
font-size: 16px;
color: #000000;
user-select: none;
transition: opacity 0.3s ease;
}
.checkbox-label.disabled { /* From index.html specific styles */
opacity: 0.5;
cursor: not-allowed;
}
.checkbox-label input[type="checkbox"] { /* From index.html specific styles */
margin-right: var(--space-8);
width: 18px;
height: 18px;
accent-color: #007BFF;
}
.checkbox-label input[type="checkbox"]:disabled { /* From index.html specific styles */
cursor: not-allowed;
}
.checkbox-label i { /* From index.html specific styles */
margin-left: var(--space-4);
color: #007BFF;
}
/* Button Styling */
.btn { /* Modified from index.html specific styles */
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 20px; /* Was var(--space-8) var(--space-16) */
font-size: 17px; /* Was var(--font-size-base) */
font-weight: 500;
border: none; /* Was: border: none; */
border-radius: 8px; /* Was var(--radius-base) */
cursor: pointer;
text-decoration: none;
transition: all 0.3s ease; /* Was all var(--duration-normal) var(--ease-standard) */
width: 100%; /* Added from index.html specific styles */
margin-bottom: var(--space-16); /* Added from index.html specific styles */
}
.btn i { /* From index.html specific styles */
margin-right: var(--space-8);
}
.btn:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
.btn--primary { /* Modified from index.html specific styles */
background-color: #007BFF; /* Was var(--color-primary) */
color: white; /* Was var(--color-btn-primary-text) */
}
.btn--primary:hover:not(:disabled) { /* Modified from index.html specific styles */
background-color: #0056b3; /* Was var(--color-primary-hover) */
transform: translateY(-1px); /* Added from index.html specific styles */
}
.btn--primary:active {
background: var(--color-primary-active);
}
.btn--secondary {
background: var(--color-secondary);
color: var(--color-text);
border: 1px solid var(--color-border); /* Added from index.html specific styles */
}
.btn--secondary:hover:not(:disabled) { /* Modified */
background-color: var(--color-secondary-hover);
}
.btn--secondary:active {
background: var(--color-secondary-active);
}
.btn--outline {
background: transparent;
border: 1px solid var(--color-border);
color: var(--color-text);
}
.btn--outline:hover {
background: var(--color-secondary);
}
.btn--sm {
padding: var(--space-4) var(--space-12);
font-size: var(--font-size-sm);
border-radius: var(--radius-sm);
}
.btn--lg {
padding: var(--space-10) var(--space-20);
font-size: var(--font-size-lg);
border-radius: var(--radius-md);
}
.btn--full-width {
width: 100%;
}
.btn:disabled { /* Modified from index.html specific styles */
opacity: 0.6; /* Was 0.5 */
cursor: not-allowed;
transform: none; /* Added */
}
/* Loading Spinner */
.spinner { /* From index.html specific styles */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: var(--space-32);
background: white;
border-radius: var(--radius-lg);
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
margin-bottom: var(--space-24);
}
.spinner-circle { /* From index.html specific styles */
width: 40px;
height: 40px;
border: 4px solid #e1e5e9;
border-top: 4px solid #007BFF;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: var(--space-16);
}
.spinner p { /* From index.html specific styles */
margin:0;
color: #000000;
font-weight: 500;
font-size: 16px;
}
@keyframes spin { /* From index.html specific styles */
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Image Container */
.image-container { /* From index.html specific styles */
text-align: center;
padding: var(--space-24);
background: white;
border-radius: var(--radius-lg);
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
opacity: 0;
transition: opacity 0.5s ease;
}
.image-container.show { /* From index.html specific styles */
opacity: 1;
}
.image-container img { /* From index.html specific styles */
max-width: 100%;
max-height: 80vh;
border-radius: var(--radius-base);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
display: block;
margin: 0 auto var(--space-16) auto;
}
.image-actions { /* From index.html specific styles */
margin-top: var(--space-16);
}
.image-actions .btn { /* From index.html specific styles */
width: auto;
margin: 0;
}
/* URL Display */
.url-display { /* From index.html specific styles */
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: var(--radius-base);
padding: var(--space-12);
margin-top: var(--space-16);
}
.url-label { /* From index.html specific styles */
display: block;
font-weight: 500;
color: #333333;
margin-bottom: var(--space-4);
font-size: 14px;
}
.url-display code { /* From index.html specific styles */
background: none;
color: #007BFF;
font-size: 13px;
word-break: break-all;
padding: 0;
}
/* Error Message */
.error-message { /* From index.html specific styles */
background-color: #f8d7da;
color: #721c24;
padding: var(--space-12) var(--space-16);
border: 1px solid #f5c6cb;
border-radius: var(--radius-base);
margin-top: var(--space-16);
font-weight: 500;
}
/* Card component */
.card {
background-color: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-card-border);
box-shadow: var(--shadow-sm);
overflow: hidden;
transition: box-shadow var(--duration-normal) var(--ease-standard);
}
.card:hover {
box-shadow: var(--shadow-md);
}
.card__body {
padding: var(--space-16);
}
.card__header,
.card__footer {
padding: var(--space-16);
border-bottom: 1px solid var(--color-card-border-inner);
}
/* Status indicators - simplified with CSS variables */
.status {
display: inline-flex;
align-items: center;
padding: var(--space-6) var(--space-12);
border-radius: var(--radius-full);
font-weight: var(--font-weight-medium);
font-size: var(--font-size-sm);
}
.status--success {
background-color: rgba(
var(--color-success-rgb, 33, 128, 141),
var(--status-bg-opacity)
);
color: var(--color-success);
border: 1px solid
rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}
.status--error {
background-color: rgba(
var(--color-error-rgb, 192, 21, 47),
var(--status-bg-opacity)
);
color: var(--color-error);
border: 1px solid
rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}
.status--warning {
background-color: rgba(
var(--color-warning-rgb, 168, 75, 47),
var(--status-bg-opacity)
);
color: var(--color-warning);
border: 1px solid
rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}
.status--info {
background-color: rgba(
var(--color-info-rgb, 98, 108, 113),
var(--status-bg-opacity)
);
color: var(--color-info);
border: 1px solid
rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}
/* Utility classes */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.items-center {
align-items: center;
}
.justify-center {
justify-content: center;
}
.justify-between {
justify-content: space-between;
}
.gap-4 {
gap: var(--space-4);
}
.gap-8 {
gap: var(--space-8);
}
.gap-16 {
gap: var(--space-16);
}
.m-0 {
margin: 0;
}
.mt-8 {
margin-top: var(--space-8);
}
.mb-8 {
margin-bottom: var(--space-8);
}
.mx-8 {
margin-left: var(--space-8);
margin-right: var(--space-8);
}
.my-8 {
margin-top: var(--space-8);
margin-bottom: var(--space-8);
}
.p-0 {
padding: 0;
}
.py-8 {
padding-top: var(--space-8);
padding-bottom: var(--space-8);
}
.px-8 {
padding-left: var(--space-8);
padding-right: var(--space-8);
}
.py-16 {
padding-top: var(--space-16);
padding-bottom: var(--space-16);
}
.px-16 {
padding-left: var(--space-16);
padding-right: var(--space-16);
}
.block {
display: block;
}
.hidden {
display: none !important; /* Added !important from index.html specific styles */
}
/* Form disabled state */
.form-disabled .form-control, /* From index.html specific styles */
.form-disabled .checkbox-label {
pointer-events: none;
opacity: 0.6;
}
/* Accessibility */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
:focus-visible {
outline: var(--focus-outline);
outline-offset: 2px;
}
/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
border: 1px solid var(--color-border-secondary);
}
/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
select.form-control {
background-image: var(--select-caret-dark);
}
}
/* Also handle data-color-scheme for select caret */
[data-color-scheme="dark"] select.form-control {
background-image: var(--select-caret-dark);
}
[data-color-scheme="light"] select.form-control {
background-image: var(--select-caret-light);
}
/* Responsive Design */
@media (max-width: 768px) { /* From index.html specific styles */
.container {
padding: var(--space-16);
}
.form-row {
flex-direction: column;
}
.checkbox-group {
flex-direction: column;
gap: var(--space-8);
}
h1 {
font-size: 20px;
}
.btn {
font-size: 16px;
}
}
/* Container responsive overrides from original style.css */
@media (min-width: 640px) {
/* .container from index.html takes precedence */
}
@media (min-width: 768px) {
/* .container from index.html takes precedence */
}
@media (min-width: 1024px) {
/* .container from index.html takes precedence */
}
@media (min-width: 1280px) {
/* .container from index.html takes precedence */
}
@font-face {
font-family: 'FKGroteskNeue';
src: url('https://www.perplexity.ai/fonts/FKGroteskNeue.woff2')
format('woff2');
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Swiggis Bild-KI</h1>
<p>Erstelle ein Bild, indem du es beschreibst.</p>
</header>
<form id="imageForm" class="image-form">
<div class="form-group">
<label for="prompt" class="form-label"><i class="fas fa-paint-brush"></i> Image Description (Prompt)</label>
<textarea id="prompt" class="form-control" placeholder="Bildbeschreibung..." rows="3" required></textarea>
</div>
<div class="form-row">
<div class="form-group">
<label for="model" class="form-label"><i class="fas fa-cogs"></i> Model</label>
<select id="model" class="form-control">
<option value="flux">Flux (General, Good Quality)</option>
<option value="flux-pro">Flux Pro (Best Quality, Slower)</option>
<option value="flux-realism">Flux Realism (Realistic Style)</option>
<option value="flux-anime">Flux Anime (Anime/Manga Style)</option>
<option value="flux-3d">Flux 3D (3D Scenes)</option>
<option value="cablyai">Flux Cablyai (General, Good Quality)</option>
<option value="turbo">Turbo (Fast, Medium Quality)</option>
</select>
</div>
<div class="form-group">
<label for="seed" class="form-label"><i class="fas fa-seedling"></i> Seed (Optional)</label>
<input type="number" id="seed" class="form-control" placeholder="e.g., 12345">
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="width" class="form-label"><i class="fas fa-arrows-alt-h"></i> Breite (px)</label>
<input type="number" id="width" class="form-control" value="1024" min="256" max="2048" step="64">
</div>
<div class="form-group">
<label for="height" class="form-label"><i class="fas fa-arrows-alt-v"></i> Höhe (px)</label>
<input type="number" id="height" class="form-control" value="1024" min="256" max="2048" step="64">
</div>
</div>
<div class="checkbox-group">
<label class="checkbox-label" for="enhance">
<input type="checkbox" id="enhance" checked> Enhance <i class="fas fa-info-circle" title="Enhance the prompt for better results"></i>
</label>
</div>
<button type="submit" id="generateBtn" class="btn btn--primary"><i class="fas fa-magic"></i> Generate Image</button>
</form>
<div id="loadingSpinner" class="spinner hidden">
<div class="spinner-circle"></div>
<p>Generating image, please wait...</p>
</div>
<div id="urlDisplay" class="url-display hidden">
<span class="url-label">Generated URL:</span>
<code id="urlText"></code>
</div>
<div id="error" class="error-message hidden"></div>
<div id="imageContainer" class="image-container hidden">
<img id="generatedImage" src="#" alt="Generated Image">
<div class="image-actions">
<a id="downloadLink" href="#" download="generated_image.png" class="btn btn--secondary" style="display: none;"><i class="fas fa-download"></i> Download Image</a>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get form elements
const form = document.getElementById('imageForm');
const generateBtn = document.getElementById('generateBtn');
const loadingSpinner = document.getElementById('loadingSpinner');
const imageContainer = document.getElementById('imageContainer');
const generatedImage = document.getElementById('generatedImage');
const errorDiv = document.getElementById('error');
const urlDisplay = document.getElementById('urlDisplay');
const urlText = document.getElementById('urlText');
const downloadLink = document.getElementById('downloadLink');
// Get form inputs
const promptInput = document.getElementById('prompt');
const modelSelect = document.getElementById('model');
const widthInput = document.getElementById('width');
const heightInput = document.getElementById('height');
const seedInput = document.getElementById('seed');
const enhanceCheckbox = document.getElementById('enhance');
// Get all form controls for disabling
const allFormControls = form.querySelectorAll('.form-control, input[type="checkbox"]');
const allCheckboxLabels = form.querySelectorAll('.checkbox-label');
// API base URL
const API_BASE_URL = 'https://image.pollinations.ai/prompt/';
// Form submission handler
form.addEventListener('submit', function(event) {
event.preventDefault();
generateImage();
});
function generateImage() {
// Validate required fields
const prompt = promptInput.value.trim();
if (!prompt) {
showError('Please enter an image description.');
return;
}
// Clear previous error and image
hideError();
hideImage();
hideUrlDisplay();
// Set loading state immediately
setLoadingState(true);
// Get form values
const model = modelSelect.value;
const width = parseInt(widthInput.value) || 1024;
const height = parseInt(heightInput.value) || 1024;
const seed = seedInput.value.trim();
const nologo = true;
const isPrivate = false;
const enhance = enhanceCheckbox.checked;
// Construct URL
const imageUrl = buildImageUrl(prompt, {
model,
width,
height,
seed,
nologo,
private: isPrivate,
enhance
});
// Debug output
console.log('Constructed URL:', imageUrl);
console.log('Parameters:', {
model,
width,
height,
seed,
nologo,
private: isPrivate,
enhance
});
// Show the constructed URL for debugging
showUrlDisplay(imageUrl);
// Load image
loadImage(imageUrl);
}
function buildImageUrl(prompt, options) {
// Encode the prompt properly for URL
const encodedPrompt = encodeURIComponent(prompt);
// Start with base URL + encoded prompt
let url = API_BASE_URL + encodedPrompt;
// Build query parameters array
const params = [];
// CRITICAL FIX: Always add model parameter
if (options.model) {
params.push(`model=${encodeURIComponent(options.model)}`);
}
// Add dimensions if not default
if (options.width && options.width !== 1024) {
params.push(`width=${options.width}`);
}
if (options.height && options.height !== 1024) {
params.push(`height=${options.height}`);
}
// Add seed if provided
if (options.seed) {
params.push(`seed=${options.seed}`);
}
// Add boolean flags if checked
if (options.nologo) {
params.push('nologo=true');
}
if (options.private) {
params.push('private=true');
}
if (options.enhance) {
params.push('enhance=true');
}
// Append query string if we have parameters
if (params.length > 0) {
url += '?' + params.join('&');
}
console.log('Final URL built:', url);
return url;
}
function loadImage(imageUrl) {
// Clear any previous image
generatedImage.src = '';
generatedImage.onload = null;
generatedImage.onerror = null;
downloadLink.style.display = 'none';
// Set timeout for very slow loading
const timeout = setTimeout(() => {
console.log('Image loading timeout');
setLoadingState(false);
showError('Image is taking too long to load. Please try again.');
}, 60000); // 60 second timeout
// Set up event handlers BEFORE setting src
generatedImage.onload = function() {
console.log('Image loaded successfully');
clearTimeout(timeout);
setLoadingState(false);
showImage();
downloadLink.href = imageUrl;
downloadLink.style.display = 'inline-flex';
};
generatedImage.onerror = function() {
console.log('Image failed to load');
clearTimeout(timeout);
setLoadingState(false);
showError('Error loading image. The API might be temporarily unavailable or the combination of parameters is invalid. Please try again.');
};
// Set alt text
generatedImage.alt = promptInput.value;
// Start loading - this should be last
console.log('Starting to load image from:', imageUrl);
generatedImage.src = imageUrl;
// Handle case where image is already cached
if (generatedImage.complete && generatedImage.naturalHeight !== 0) {
console.log('Image was already cached');
clearTimeout(timeout); // Clear timeout as it's already loaded
setLoadingState(false);
showImage();
downloadLink.href = imageUrl;
downloadLink.style.display = 'inline-flex';
}
}
function setLoadingState(isLoading) {
const generateBtnIcon = generateBtn.querySelector('i');
if (isLoading) {
// Disable button
generateBtn.disabled = true;
generateBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Generating...';
// Disable all form controls
allFormControls.forEach(control => {
control.disabled = true;
});
// Add disabled class to checkbox labels
allCheckboxLabels.forEach(label => {
label.classList.add('disabled');
});
// Add disabled class to form
form.classList.add('form-disabled');
// Show spinner
loadingSpinner.classList.remove('hidden');
// Hide image
hideImage();
} else {
// Enable button
generateBtn.disabled = false;
generateBtn.innerHTML = '<i class="fas fa-magic"></i> Generate Image';
// Enable all form controls
allFormControls.forEach(control => {
control.disabled = false;
});
// Remove disabled class from checkbox labels
allCheckboxLabels.forEach(label => {
label.classList.remove('disabled');
});
// Remove disabled class from form
form.classList.remove('form-disabled');
// Hide spinner
loadingSpinner.classList.add('hidden');
}
}
function showImage() {
imageContainer.classList.remove('hidden');
// Add show class for fade-in animation
setTimeout(() => {
imageContainer.classList.add('show');
}, 10);
}
function hideImage() {
imageContainer.classList.add('hidden');
imageContainer.classList.remove('show');
downloadLink.style.display = 'none';
}
function showError(message) {
errorDiv.textContent = message;
errorDiv.classList.remove('hidden');
// Auto-hide error after 10 seconds
setTimeout(() => {
hideError();
}, 10000);
}
function hideError() {
errorDiv.classList.add('hidden');
errorDiv.textContent = '';
}
function showUrlDisplay(url) {
if (urlDisplay && urlText) {
urlText.textContent = url;
urlDisplay.classList.remove('hidden');
}
}
function hideUrlDisplay() {
if (urlDisplay) {
urlDisplay.classList.add('hidden');
}
}
// Auto-resize textarea
promptInput.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = Math.max(this.scrollHeight, 80) + 'px';
});
// Validate numeric inputs
function validateNumericInput(input, min, max) {
input.addEventListener('input', function() {
let value = parseInt(this.value);
if (isNaN(value)) return;
if (value < min) this.value = min;
if (value > max) this.value = max;
});
}
// Apply validation to width and height inputs
validateNumericInput(widthInput, 256, 2048);
validateNumericInput(heightInput, 256, 2048);
// Seed input validation (non-negative numbers only)
seedInput.addEventListener('input', function() {
if (this.value && parseInt(this.value) < 0) {
this.value = 0;
}
});
// Ensure dimensions are multiples of 64 for better compatibility
function roundToNearest64(input) {
input.addEventListener('blur', function() { // Changed to 'blur' for better UX
let value = parseInt(this.value);
if (!isNaN(value)) {
// Ensure value is within min/max before rounding
const min = parseInt(input.min) || 256;
const max = parseInt(input.max) || 2048;
value = Math.max(min, Math.min(max, value));
this.value = Math.round(value / 64) * 64;
}
});
}
roundToNearest64(widthInput);
roundToNearest64(heightInput);
// Set focus on prompt input when page loads
setTimeout(() => {
promptInput.focus();
}, 100);
});
</script>
<!-- Font Awesome for icons - replace with your preferred icon library or SVGs if needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/js/all.min.js"></script>
</body>
</html>