-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
215 lines (189 loc) · 6.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Generator</title>
<style>
/* Base styling for body */
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background-color: #1e1e2f;
}
/* Container styling */
.container {
text-align: center;
background: #2e2e3f;
padding: 30px;
border-radius: 12px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
max-width: 400px;
width: 100%;
color: #f0f0f0;
display: flex;
flex-direction: column;
justify-content: center;
gap: 20px;
}
/* Header styling */
.container h1 {
font-size: 28px;
margin-bottom: 20px;
color: #ff6f61;
}
/* Input and button styling */
input[type="text"], button {
padding: 12px;
width: 100%;
font-size: 16px;
border-radius: 8px;
border: none;
outline: none;
}
/* Centered placeholder text */
input[type="text"]::placeholder {
text-align: center;
}
/* Input styling */
input[type="text"] {
background-color: #3a3a4f;
color: #fff;
}
/* Button styling */
button {
cursor: pointer;
background-color: #ff6f61;
color: #fff;
transition: background-color 0.3s, transform 0.2s;
will-change: transform;
position: relative;
overflow: hidden;
}
/* Pulse animation on button click */
button:active::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 200%;
height: 200%;
background-color: rgba(255, 255, 255, 0.3);
border-radius: 50%;
transform: translate(-50%, -50%) scale(0);
animation: pulse 0.6s ease-out;
}
@keyframes pulse {
0% { transform: translate(-50%, -50%) scale(0); }
100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
button:hover {
background-color: #ff5733;
}
/* Image styling */
img {
max-width: 100%;
margin-top: 20px;
border-radius: 8px;
display: none;
}
/* Center the regenerate button */
.button-group {
display: flex;
justify-content: center;
margin-top: 10px;
}
/* Loading spinner styling */
.spinner {
border: 4px solid rgba(255, 255, 255, 0.3);
border-top: 4px solid #ff6f61;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 0.8s linear infinite;
display: none;
margin: 20px auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Telegram button styling */
.telegram-link {
margin-top: 20px;
display: none; /* Initially hidden */
text-decoration: none;
padding: 10px 20px;
color: white;
background-color: #ff6f61;
border-radius: 8px;
transition: transform 0.3s, background-color 0.3s;
}
.telegram-link:hover {
background-color: #ff5733;
transform: scale(1.05);
}
</style>
</head>
<body>
<div class="container">
<h1>Rishu Image Generator</h1>
<input type="text" id="promptInput" placeholder="Enter your prompt here" />
<button onclick="generateImage()">Generate Image</button>
<div class="button-group">
<button id="regenerateButton" onclick="regenerateImage()" style="display: none;">Regenerate</button>
</div>
<div class="spinner" id="loadingSpinner"></div>
<img id="generatedImage" src="" alt="Generated Image" />
<!-- Telegram link button at the bottom, initially hidden -->
<a href="https://t.me/UR_RISHU_143" target="_blank" class="telegram-link" id="telegramLink">
Join Our Telegram
</a>
</div>
<script>
// Function to generate or regenerate the image
function generateImage() {
const prompt = document.getElementById("promptInput").value.trim();
if (!prompt) {
alert("Please enter a prompt.");
return;
}
displayImage(prompt);
}
function regenerateImage() {
const prompt = document.getElementById("promptInput").value.trim();
if (!prompt) {
alert("Please enter a prompt.");
return;
}
displayImage(prompt);
}
// Helper function to display the image with loading animation
function displayImage(prompt) {
const imageUrl = `https://img.hazex.workers.dev/?prompt=${encodeURIComponent(prompt)}&improve=true&format=square&random=${Math.random()}`;
const imageElement = document.getElementById("generatedImage");
const spinner = document.getElementById("loadingSpinner");
const regenerateButton = document.getElementById("regenerateButton");
const telegramLink = document.getElementById("telegramLink");
// Show the loading spinner and hide the image, buttons
spinner.style.display = "block";
imageElement.style.display = "none";
regenerateButton.style.display = "none";
telegramLink.style.display = "none";
// Load the image and hide the spinner when it's ready
imageElement.onload = () => {
spinner.style.display = "none";
imageElement.style.display = "block";
regenerateButton.style.display = "inline-block";
telegramLink.style.display = "inline-block"; // Show Telegram button after image is displayed
};
// Set the image source
imageElement.src = imageUrl;
}
</script>
</body>
</html>