-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathpopup.html
226 lines (223 loc) · 5.64 KB
/
popup.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
216
217
218
219
220
221
222
223
224
225
226
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Virtual Try-On</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
width: 400px;
min-height: 500px;
padding: 20px;
font-family: 'Inter', sans-serif;
background-color: #f5f5f5;
margin: 0;
display: flex;
flex-direction: column;
position: relative;
}
h2 {
color: #333;
margin-bottom: 20px;
margin-top: 0px;
text-align: center;
}
#personImage {
display: none;
}
#cachedImages {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 15px;
}
.cached-image, #uploadNewImage {
width: 60px;
height: 60px;
object-fit: cover;
border-radius: 5px;
cursor: pointer;
border: 2px solid transparent;
}
.cached-image.selected {
border-color: #3498db;
}
#uploadNewImage {
display: flex;
justify-content: center;
align-items: center;
background-color: #3498db;
color: white;
font-size: 24px;
transition: background-color 0.3s;
position: relative;
}
#uploadNewImage:hover {
background-color: #2980b9;
}
#uploadNewImage:hover::after {
content: "Upload new person";
position: absolute;
bottom: -30px;
left: 50%;
transform: translateX(-50%);
background-color: #333;
color: white;
padding: 5px 10px;
border-radius: 3px;
font-size: 12px;
white-space: nowrap;
}
button, input[type="text"] {
width: 100%;
padding: 10px;
background-color: #2ecc71;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
font-family: 'Inter', sans-serif;
font-size: 14px;
}
button:hover {
background-color: #27ae60;
}
button:disabled {
background-color: #95a5a6;
cursor: not-allowed;
}
input[type="text"] {
background-color: white;
color: #333;
border: 1px solid #eee;
cursor: text;
width: auto;
}
input[type="text"]:focus {
outline: none;
border-color: #27ae60;
box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}
.loader {
border: 3px solid #f3f3f3;
border-top: 3px solid #3498db;
border-radius: 50%;
width: 30px;
height: 30px;
animation: spin 1s linear infinite;
margin: 20px auto;
display: none;
}
#loadingMessage {
text-align: center;
color: #7f8c8d;
margin-top: 10px;
display: none;
}
#result {
margin-top: 20px;
margin-bottom: 10px;
text-align: center;
font-size: 14px;
}
#result img {
max-width: 100%;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.image-container {
position: relative;
width: 60px;
height: 60px;
}
.delete-btn {
position: absolute;
top: -5px;
right: -5px;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #e74c3c;
color: white;
border: none;
font-size: 14px;
line-height: 1;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.3s;
}
.image-container:hover .delete-btn {
opacity: 1;
}
#settingsForm {
display: flex;
flex-direction: column;
gap: 5px;
}
#settingsForm label {
margin-bottom: 5px;
color: #333;
}
#settingsButton {
position: absolute;
top: 8px;
right: 8px;
background: none;
border: none;
cursor: pointer;
font-size: 24px;
color: #333;
width: auto;
}
#settingsButton:hover {
color: #3498db;
}
#credit {
position: absolute;
bottom: 10px;
right: 10px;
font-size: 12px;
color: #7f8c8d;
}
</style>
</head>
<body>
<h2>Virtual Try-On 🧢</h2>
<button id="settingsButton" aria-label="Settings">⚙️</button>
<div id="mainContent">
<div id="cachedImages">
<!-- Cached images will be inserted here -->
</div>
<button id="tryOn" disabled>Try On</button>
<div id="loader" class="loader"></div>
<div id="loadingMessage">It may take around 30s to dress up the person</div>
<div id="result">Please fill <a href="https://tally.so/r/mYYjoz" target="_blank">this form</a> to get notified about the<br/>official release of this extension.</div>
<input type="file" id="personImage" accept="image/*" style="display: none;">
</div>
<div id="settingsContent" style="display: none;">
<h2>Settings</h2>
<form id="settingsForm">
<label for="openAIApiKey">OpenAI API Key:</label>
<input type="text" id="openAIApiKey" name="openAIApiKey"><br><br>
<label for="cloudName">Cloudinary Cloud Name:</label>
<input type="text" id="cloudName" name="cloudName"><br><br>
<label for="uploadPreset">Cloudinary Upload Preset:</label>
<input type="text" id="uploadPreset" name="uploadPreset"><br><br>
<button id="saveSettings" type="submit">Save</button>
</form>
</div>
<span id="credit">Created by <a href="https://shyjal.com" target="_blank">Shyjal</a></span>
<script src="utils.js"></script>
<script src="settings.js"></script>
<script src="popup.js"></script>
</body>
</html>