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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>picture crrd</title>
|
7 |
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap" rel="stylesheet">
|
8 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
|
9 |
+
<style>
|
10 |
+
/* Общие стили (остаются без изменений) */
|
11 |
+
body {
|
12 |
+
font-family: 'Poppins', sans-serif;
|
13 |
+
margin: 0;
|
14 |
+
padding: 0;
|
15 |
+
background: linear-gradient(135deg, #000000, #111111);
|
16 |
+
color: #ffffff;
|
17 |
+
overflow-x: hidden;
|
18 |
+
}
|
19 |
+
|
20 |
+
h1, h2, h3, h4, h5, h6 {
|
21 |
+
font-family: 'Playfair Display', serif;
|
22 |
+
font-weight: 700;
|
23 |
+
}
|
24 |
+
|
25 |
+
.navbar {
|
26 |
+
background: rgba(0, 0, 0, 0.8);
|
27 |
+
color: white;
|
28 |
+
padding: 15px 30px;
|
29 |
+
text-align: center;
|
30 |
+
font-size: 24px;
|
31 |
+
font-weight: 600;
|
32 |
+
position: sticky;
|
33 |
+
top: 0;
|
34 |
+
backdrop-filter: blur(10px);
|
35 |
+
z-index: 1000;
|
36 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
37 |
+
}
|
38 |
+
|
39 |
+
.container {
|
40 |
+
max-width: 1200px;
|
41 |
+
margin: 20px auto;
|
42 |
+
padding: 30px;
|
43 |
+
background: rgba(255, 255, 255, 0.1);
|
44 |
+
border-radius: 15px;
|
45 |
+
backdrop-filter: blur(10px);
|
46 |
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
47 |
+
position: relative;
|
48 |
+
overflow: hidden;
|
49 |
+
}
|
50 |
+
|
51 |
+
.btn {
|
52 |
+
background: #007bff;
|
53 |
+
color: white;
|
54 |
+
padding: 12px 24px;
|
55 |
+
border: none;
|
56 |
+
border-radius: 8px;
|
57 |
+
cursor: pointer;
|
58 |
+
font-size: 16px;
|
59 |
+
font-weight: 500;
|
60 |
+
transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
|
61 |
+
}
|
62 |
+
|
63 |
+
.btn:hover {
|
64 |
+
background: #0056b3;
|
65 |
+
transform: translateY(-2px);
|
66 |
+
box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
|
67 |
+
}
|
68 |
+
|
69 |
+
.btn:active {
|
70 |
+
transform: translateY(0);
|
71 |
+
}
|
72 |
+
|
73 |
+
.card {
|
74 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
75 |
+
border-radius: 15px;
|
76 |
+
padding: 25px;
|
77 |
+
margin: 20px 0;
|
78 |
+
background: rgba(255, 255, 255, 0.05);
|
79 |
+
transition: box-shadow 0.3s ease, transform 0.3s ease;
|
80 |
+
}
|
81 |
+
|
82 |
+
.card:hover {
|
83 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
84 |
+
transform: translateY(-5px);
|
85 |
+
}
|
86 |
+
|
87 |
+
.card input,
|
88 |
+
.card textarea,
|
89 |
+
.card select {
|
90 |
+
width: 100%;
|
91 |
+
padding: 12px;
|
92 |
+
margin: 10px 0;
|
93 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
94 |
+
border-radius: 8px;
|
95 |
+
font-size: 16px;
|
96 |
+
background: rgba(255, 255, 255, 0.1);
|
97 |
+
color: white;
|
98 |
+
transition: border-color 0.3s ease;
|
99 |
+
}
|
100 |
+
|
101 |
+
.card input:focus,
|
102 |
+
.card textarea:focus,
|
103 |
+
.card select:focus {
|
104 |
+
border-color: #007bff;
|
105 |
+
outline: none;
|
106 |
+
}
|
107 |
+
|
108 |
+
.card-preview {
|
109 |
+
text-align: center;
|
110 |
+
margin-top: 20px;
|
111 |
+
padding: 20px;
|
112 |
+
background: rgba(255, 255, 255, 0.1);
|
113 |
+
border-radius: 15px;
|
114 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
115 |
+
}
|
116 |
+
|
117 |
+
.card-preview img,
|
118 |
+
.card-preview audio {
|
119 |
+
max-width: 100%;
|
120 |
+
border-radius: 10px;
|
121 |
+
}
|
122 |
+
|
123 |
+
.card-preview a {
|
124 |
+
color: #007bff;
|
125 |
+
text-decoration: none;
|
126 |
+
font-weight: 500;
|
127 |
+
}
|
128 |
+
|
129 |
+
.card-preview a:hover {
|
130 |
+
text-decoration: underline;
|
131 |
+
}
|
132 |
+
|
133 |
+
.hidden {
|
134 |
+
display: none;
|
135 |
+
}
|
136 |
+
|
137 |
+
/* Анимации */
|
138 |
+
@keyframes fadeIn {
|
139 |
+
from {
|
140 |
+
opacity: 0;
|
141 |
+
transform: translateY(20px);
|
142 |
+
}
|
143 |
+
to {
|
144 |
+
opacity: 1;
|
145 |
+
transform: translateY(0);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
@keyframes glow {
|
150 |
+
0% {
|
151 |
+
box-shadow: 0 0 10px rgba(0, 123, 255, 0.6);
|
152 |
+
}
|
153 |
+
50% {
|
154 |
+
box-shadow: 0 0 20px rgba(0, 123, 255, 0.8);
|
155 |
+
}
|
156 |
+
100% {
|
157 |
+
box-shadow: 0 0 10px rgba(0, 123, 255, 0.6);
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
.fade-in {
|
162 |
+
animation: fadeIn 0.5s ease-in-out;
|
163 |
+
}
|
164 |
+
|
165 |
+
.glow {
|
166 |
+
animation: glow 2s infinite;
|
167 |
+
}
|
168 |
+
|
169 |
+
/* Footer */
|
170 |
+
.footer {
|
171 |
+
text-align: center;
|
172 |
+
padding: 20px;
|
173 |
+
background: rgba(0, 0, 0, 0.8);
|
174 |
+
color: white;
|
175 |
+
margin-top: 40px;
|
176 |
+
font-size: 14px;
|
177 |
+
backdrop-filter: blur(10px);
|
178 |
+
}
|
179 |
+
|
180 |
+
.footer a {
|
181 |
+
color: #007bff;
|
182 |
+
text-decoration: none;
|
183 |
+
}
|
184 |
+
|
185 |
+
.footer a:hover {
|
186 |
+
text-decoration: underline;
|
187 |
+
}
|
188 |
+
|
189 |
+
/* Tools Section */
|
190 |
+
.tools {
|
191 |
+
display: flex;
|
192 |
+
justify-content: space-between;
|
193 |
+
margin-bottom: 20px;
|
194 |
+
}
|
195 |
+
|
196 |
+
.tools .btn {
|
197 |
+
flex: 1;
|
198 |
+
margin: 0 5px;
|
199 |
+
}
|
200 |
+
|
201 |
+
/* Параллакс-эффект */
|
202 |
+
.parallax {
|
203 |
+
background-attachment: fixed;
|
204 |
+
background-position: center;
|
205 |
+
background-repeat: no-repeat;
|
206 |
+
background-size: cover;
|
207 |
+
position: relative;
|
208 |
+
height: 300px;
|
209 |
+
display: flex;
|
210 |
+
align-items: center;
|
211 |
+
justify-content: center;
|
212 |
+
color: white;
|
213 |
+
font-size: 32px;
|
214 |
+
font-weight: 600;
|
215 |
+
text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
|
216 |
+
}
|
217 |
+
|
218 |
+
.parallax::before {
|
219 |
+
content: '';
|
220 |
+
position: absolute;
|
221 |
+
top: 0;
|
222 |
+
left: 0;
|
223 |
+
right: 0;
|
224 |
+
bottom: 0;
|
225 |
+
background: rgba(0, 0, 0, 0.5);
|
226 |
+
}
|
227 |
+
|
228 |
+
.parallax h1 {
|
229 |
+
position: relative;
|
230 |
+
z-index: 1;
|
231 |
+
}
|
232 |
+
|
233 |
+
/* History Section */
|
234 |
+
.history-item {
|
235 |
+
margin-bottom: 20px;
|
236 |
+
padding: 15px;
|
237 |
+
background: rgba(255, 255, 255, 0.05);
|
238 |
+
border-radius: 10px;
|
239 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
240 |
+
}
|
241 |
+
|
242 |
+
.history-item img,
|
243 |
+
.history-item video {
|
244 |
+
max-width: 100%;
|
245 |
+
border-radius: 10px;
|
246 |
+
}
|
247 |
+
</style>
|
248 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
249 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
250 |
+
</head>
|
251 |
+
<body>
|
252 |
+
<div class="navbar">picture crrd</div>
|
253 |
+
|
254 |
+
<!-- Параллакс-секция -->
|
255 |
+
<div class="parallax" style="background-image: url('https://source.unsplash.com/1600x900/?nature,water');">
|
256 |
+
<h1>Create Stunning Cards</h1>
|
257 |
+
</div>
|
258 |
+
|
259 |
+
<!-- Welcome Section -->
|
260 |
+
<div id="welcome" class="container fade-in">
|
261 |
+
<h1>Welcome to picture crrd</h1>
|
262 |
+
<p>Create stunning picture cards with ease. Customize text, colors, media, and more!</p>
|
263 |
+
</div>
|
264 |
+
|
265 |
+
<!-- Tools Section -->
|
266 |
+
<div class="container tools">
|
267 |
+
<button class="btn glow" onclick="showTool('cardMaker')">Card Maker <i class="fas fa-paint-brush"></i></button>
|
268 |
+
<button class="btn glow" onclick="showTool('imageVideoToCard')">Image/Video to Card <i class="fas fa-image"></i></button>
|
269 |
+
<button class="btn glow" onclick="showTool('history')">History <i class="fas fa-history"></i></button>
|
270 |
+
</div>
|
271 |
+
|
272 |
+
<!-- Card Maker Section -->
|
273 |
+
<div id="cardMaker" class="container hidden fade-in">
|
274 |
+
<h1>Card Maker</h1>
|
275 |
+
<div class="card">
|
276 |
+
<input type="text" id="cardMakerText" placeholder="Enter card text">
|
277 |
+
<input type="color" id="cardMakerColor" value="#ffffff">
|
278 |
+
<input type="file" id="cardMakerMedia" accept="image/*,video/*">
|
279 |
+
<select id="cardMakerFont">
|
280 |
+
<option value="Arial, sans-serif">Arial</option>
|
281 |
+
<option value="'Poppins', sans-serif">Poppins</option>
|
282 |
+
<option value="'Playfair Display', serif">Playfair Display</option>
|
283 |
+
<option value="'Courier New', monospace">Courier New</option>
|
284 |
+
</select>
|
285 |
+
<button class="btn" onclick="previewCardMaker()">Preview Card <i class="fas fa-eye"></i></button>
|
286 |
+
</div>
|
287 |
+
<div class="card-preview" id="cardMakerPreview"></div>
|
288 |
+
<button class="btn" onclick="saveCardToHistory()">Save to History <i class="fas fa-save"></i></button>
|
289 |
+
<button class="btn" onclick="downloadCardMakerImage()">Download Image <i class="fas fa-download"></i></button>
|
290 |
+
<button class="btn" onclick="downloadCardMakerPDF()">Download PDF <i class="fas fa-file-pdf"></i></button>
|
291 |
+
</div>
|
292 |
+
|
293 |
+
<!-- Image/Video to Card Section -->
|
294 |
+
<div id="imageVideoToCard" class="container hidden fade-in">
|
295 |
+
<h1>Image/Video to Card</h1>
|
296 |
+
<div class="card">
|
297 |
+
<input type="file" id="mediaUpload" accept="image/*,video/*" onchange="handleMediaUpload(event)">
|
298 |
+
<div class="card-preview" id="mediaPreview"></div>
|
299 |
+
<input type="text" id="generatedText" placeholder="Generated Text" readonly>
|
300 |
+
<input type="text" id="generatedLink" placeholder="Generated Link" readonly>
|
301 |
+
<input type="color" id="generatedColor" value="#ffffff">
|
302 |
+
<select id="generatedFont">
|
303 |
+
<option value="Arial, sans-serif">Arial</option>
|
304 |
+
<option value="'Poppins', sans-serif">Poppins</option>
|
305 |
+
<option value="'Playfair Display', serif">Playfair Display</option>
|
306 |
+
<option value="'Courier New', monospace">Courier New</option>
|
307 |
+
</select>
|
308 |
+
<button class="btn" onclick="generateCardFromMedia()">Generate Card <i class="fas fa-magic"></i></button>
|
309 |
+
</div>
|
310 |
+
<div class="card-preview" id="generatedCardPreview"></div>
|
311 |
+
<button class="btn" onclick="saveCardToHistory()">Save to History <i class="fas fa-save"></i></button>
|
312 |
+
<button class="btn" onclick="downloadGeneratedImage()">Download Image <i class="fas fa-download"></i></button>
|
313 |
+
<button class="btn" onclick="downloadGeneratedPDF()">Download PDF <i class="fas fa-file-pdf"></i></button>
|
314 |
+
</div>
|
315 |
+
|
316 |
+
<!-- History Section -->
|
317 |
+
<div id="history" class="container hidden fade-in">
|
318 |
+
<h1>History</h1>
|
319 |
+
<div id="historyList"></div>
|
320 |
+
</div>
|
321 |
+
|
322 |
+
<!-- Footer -->
|
323 |
+
<div class="footer">
|
324 |
+
<p>Made with ❤️ by <a href="#" target="_blank">Alex Felguk</a></p>
|
325 |
+
</div>
|
326 |
+
|
327 |
+
<script>
|
328 |
+
// Массив для хранения истории карточек
|
329 |
+
let history = [];
|
330 |
+
|
331 |
+
// Функция для переключения между инструментами
|
332 |
+
function showTool(toolId) {
|
333 |
+
// Скрыть все инструменты
|
334 |
+
document.querySelectorAll('.container').forEach(container => {
|
335 |
+
if (container.id !== 'welcome' && container.id !== 'tools') {
|
336 |
+
container.classList.add('hidden');
|
337 |
+
}
|
338 |
+
});
|
339 |
+
|
340 |
+
// Показать выбранный инструмент
|
341 |
+
if (toolId) {
|
342 |
+
document.getElementById(toolId).classList.remove('hidden');
|
343 |
+
}
|
344 |
+
|
345 |
+
// Если открыта история, обновить её
|
346 |
+
if (toolId === 'history') {
|
347 |
+
updateHistory();
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
// Сохранить карточку в историю
|
352 |
+
function saveCardToHistory() {
|
353 |
+
const cardPreview = document.getElementById('cardMakerPreview').innerHTML || document.getElementById('generatedCardPreview').innerHTML;
|
354 |
+
if (cardPreview) {
|
355 |
+
history.push(cardPreview);
|
356 |
+
updateHistory();
|
357 |
+
alert('Card saved to history!');
|
358 |
+
} else {
|
359 |
+
alert('No card to save!');
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
// Обновить историю
|
364 |
+
function updateHistory() {
|
365 |
+
const historyList = document.getElementById('historyList');
|
366 |
+
historyList.innerHTML = ''; // Очистить список
|
367 |
+
|
368 |
+
history.forEach((card, index) => {
|
369 |
+
const historyItem = document.createElement('div');
|
370 |
+
historyItem.className = 'history-item';
|
371 |
+
historyItem.innerHTML = `
|
372 |
+
<h3>Card #${index + 1}</h3>
|
373 |
+
${card}
|
374 |
+
`;
|
375 |
+
historyList.appendChild(historyItem);
|
376 |
+
});
|
377 |
+
}
|
378 |
+
|
379 |
+
// Preview Card Maker
|
380 |
+
function previewCardMaker() {
|
381 |
+
const cardText = document.getElementById('cardMakerText').value;
|
382 |
+
const cardColor = document.getElementById('cardMakerColor').value;
|
383 |
+
const cardMedia = document.getElementById('cardMakerMedia').files[0];
|
384 |
+
const cardFont = document.getElementById('cardMakerFont').value;
|
385 |
+
|
386 |
+
let previewHTML = `
|
387 |
+
<div style="background: ${cardColor}; padding: 20px; border-radius: 10px; font-family: ${cardFont}; text-align: center;">
|
388 |
+
<p>${cardText}</p>
|
389 |
+
`;
|
390 |
+
|
391 |
+
if (cardMedia) {
|
392 |
+
if (cardMedia.type.startsWith('image')) {
|
393 |
+
previewHTML += `<img src="${URL.createObjectURL(cardMedia)}" alt="Media" style="max-width: 100%; border-radius: 10px;">`;
|
394 |
+
} else if (cardMedia.type.startsWith('video')) {
|
395 |
+
previewHTML += `<video controls src="${URL.createObjectURL(cardMedia)}" style="max-width: 100%; border-radius: 10px;"></video>`;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
previewHTML += `</div>`;
|
400 |
+
|
401 |
+
document.getElementById('cardMakerPreview').innerHTML = previewHTML;
|
402 |
+
}
|
403 |
+
|
404 |
+
// Download Card Maker as Image
|
405 |
+
function downloadCardMakerImage() {
|
406 |
+
const cardMakerPreview = document.getElementById('cardMakerPreview');
|
407 |
+
html2canvas(cardMakerPreview).then(canvas => {
|
408 |
+
const link = document.createElement('a');
|
409 |
+
link.download = 'card-maker.png';
|
410 |
+
link.href = canvas.toDataURL('image/png');
|
411 |
+
link.click();
|
412 |
+
});
|
413 |
+
}
|
414 |
+
|
415 |
+
// Download Card Maker as PDF
|
416 |
+
function downloadCardMakerPDF() {
|
417 |
+
const cardMakerPreview = document.getElementById('cardMakerPreview');
|
418 |
+
html2canvas(cardMakerPreview).then(canvas => {
|
419 |
+
const imgData = canvas.toDataURL('image/png');
|
420 |
+
const pdf = new jspdf.jsPDF();
|
421 |
+
const imgWidth = pdf.internal.pageSize.getWidth();
|
422 |
+
const imgHeight = (canvas.height * imgWidth) / canvas.width;
|
423 |
+
pdf.addImage(imgData, 'PNG', 0, 0, imgWidth, imgHeight);
|
424 |
+
pdf.save('card-maker.pdf');
|
425 |
+
});
|
426 |
+
}
|
427 |
+
|
428 |
+
// Handle Media Upload
|
429 |
+
function handleMediaUpload(event) {
|
430 |
+
const file = event.target.files[0];
|
431 |
+
const preview = document.getElementById('mediaPreview');
|
432 |
+
if (file) {
|
433 |
+
if (file.type.startsWith('image')) {
|
434 |
+
preview.innerHTML = `<img src="${URL.createObjectURL(file)}" alt="Uploaded Image" style="max-width: 100%; border-radius: 10px;">`;
|
435 |
+
} else if (file.type.startsWith('video')) {
|
436 |
+
preview.innerHTML = `<video controls src="${URL.createObjectURL(file)}" style="max-width: 100%; border-radius: 10px;"></video>`;
|
437 |
+
}
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
// Generate Card from Media
|
442 |
+
function generateCardFromMedia() {
|
443 |
+
const generatedText = "Generated Text Based on Media"; // Замените на реальную логику генерации текста
|
444 |
+
const generatedLink = "https://example.com"; // Замените на реальную логику генерации ссылки
|
445 |
+
const generatedColor = document.getElementById('generatedColor').value;
|
446 |
+
const generatedFont = document.getElementById('generatedFont').value;
|
447 |
+
|
448 |
+
document.getElementById('generatedText').value = generatedText;
|
449 |
+
document.getElementById('generatedLink').value = generatedLink;
|
450 |
+
|
451 |
+
const previewHTML = `
|
452 |
+
<div style="background: ${generatedColor}; padding: 20px; border-radius: 10px; font-family: ${generatedFont}; text-align: center;">
|
453 |
+
<p>${generatedText}</p>
|
454 |
+
<p><a href="${generatedLink}" target="_blank">${generatedLink}</a></p>
|
455 |
+
${document.getElementById('mediaPreview').innerHTML}
|
456 |
+
</div>
|
457 |
+
`;
|
458 |
+
|
459 |
+
document.getElementById('generatedCardPreview').innerHTML = previewHTML;
|
460 |
+
}
|
461 |
+
|
462 |
+
// Download Generated Image
|
463 |
+
function downloadGeneratedImage() {
|
464 |
+
const generatedCardPreview = document.getElementById('generatedCardPreview');
|
465 |
+
html2canvas(generatedCardPreview).then(canvas => {
|
466 |
+
const link = document.createElement('a');
|
467 |
+
link.download = 'generated-card.png';
|
468 |
+
link.href = canvas.toDataURL('image/png');
|
469 |
+
link.click();
|
470 |
+
});
|
471 |
+
}
|
472 |
+
|
473 |
+
// Download Generated PDF
|
474 |
+
function downloadGeneratedPDF() {
|
475 |
+
const generatedCardPreview = document.getElementById('generatedCardPreview');
|
476 |
+
html2canvas(generatedCardPreview).then(canvas => {
|
477 |
+
const imgData = canvas.toDataURL('image/png');
|
478 |
+
const pdf = new jspdf.jsPDF();
|
479 |
+
const imgWidth = pdf.internal.pageSize.getWidth();
|
480 |
+
const imgHeight = (canvas.height * imgWidth) / canvas.width;
|
481 |
+
pdf.addImage(imgData, 'PNG', 0, 0, imgWidth, imgHeight);
|
482 |
+
pdf.save('generated-card.pdf');
|
483 |
+
});
|
484 |
+
}
|
485 |
+
</script>
|
486 |
+
</body>
|
487 |
+
</html>
|