better view on mobiles

This commit is contained in:
Karl 2025-06-06 11:21:32 +01:00
parent 2ff03fe101
commit a75c7c554a

View File

@ -1,12 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Create An Image</title> <title>Create An Image</title>
<style> <style>
/* ---------- reset ---------- */ /* ---------- reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; } * {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* ---------- layout ---------- */ /* ---------- layout ---------- */
body { body {
@ -20,6 +25,7 @@
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
padding: 20px; padding: 20px;
} }
textarea { textarea {
width: 80vw; width: 80vw;
height: 200px; height: 200px;
@ -33,12 +39,15 @@
color: #eee; color: #eee;
border: 1px solid #333; border: 1px solid #333;
} }
.button-group { .button-group {
display: flex; display: flex;
gap: 20px; gap: 20px;
align-items: center; align-items: center;
} }
button, select {
button,
select {
background: #333; background: #333;
color: white; color: white;
border: none; border: none;
@ -48,8 +57,11 @@
cursor: pointer; cursor: pointer;
transition: background 0.3s; transition: background 0.3s;
} }
button:hover, button:hover,
select:hover { background: #555; } select:hover {
background: #555;
}
/* ---------- spinner ---------- */ /* ---------- spinner ---------- */
#spinner-overlay { #spinner-overlay {
@ -62,6 +74,7 @@
visibility: hidden; visibility: hidden;
z-index: 1000; z-index: 1000;
} }
.spinner { .spinner {
width: 50px; width: 50px;
height: 50px; height: 50px;
@ -70,9 +83,39 @@
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s linear infinite; animation: spin 0.8s linear infinite;
} }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin {
to {
transform: rotate(360deg);
}
}
@media (max-width: 600px) {
body {
min-height: 100dvh;
height: auto;
justify-content: flex-start;
padding-top: 40px;
}
.button-group {
flex-direction: column;
align-items: stretch;
width: 100%;
}
button,
select {
width: 100%;
}
textarea {
height: 150px;
}
}
</style> </style>
</head> </head>
<body> <body>
<h1 style="margin-bottom: 20px;">Create An Image</h1> <h1 style="margin-bottom: 20px;">Create An Image</h1>
@ -89,9 +132,9 @@
<!-- new model selector --> <!-- new model selector -->
<select id="model-select"> <select id="model-select">
{% for m in models %} {% for m in models %}
<option value="{{ m }}">{{ m }}</option> <option value="{{ m }}">{{ m }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
@ -108,7 +151,7 @@
function sendPrompt() { function sendPrompt() {
showSpinner(); showSpinner();
const prompt = document.getElementById('prompt-box').value; const prompt = document.getElementById('prompt-box').value;
const model = document.getElementById('model-select').value; const model = document.getElementById('model-select').value;
const formData = new URLSearchParams(); const formData = new URLSearchParams();
formData.append('prompt', prompt); formData.append('prompt', prompt);
@ -119,13 +162,13 @@
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: formData.toString() body: formData.toString()
}) })
.then(response => { .then(response => {
window.location.href = response.redirected ? response.url : '/create'; window.location.href = response.redirected ? response.url : '/create';
}) })
.catch(error => { .catch(error => {
overlay.style.visibility = 'hidden'; overlay.style.visibility = 'hidden';
alert("Error sending prompt: " + error); alert("Error sending prompt: " + error);
}); });
} }
// wrapper for Random Prompt button so it also sends the model // wrapper for Random Prompt button so it also sends the model
@ -141,14 +184,15 @@
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: formData.toString() body: formData.toString()
}) })
.then(response => { .then(response => {
window.location.href = response.redirected ? response.url : '/create'; window.location.href = response.redirected ? response.url : '/create';
}) })
.catch(error => { .catch(error => {
overlay.style.visibility = 'hidden'; overlay.style.visibility = 'hidden';
alert("Error requesting random prompt: " + error); alert("Error requesting random prompt: " + error);
}); });
} }
</script> </script>
</body> </body>
</html>
</html>