-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
338 lines (315 loc) · 13.2 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
<title>Profile Card Builder</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
background: linear-gradient(to right, #00d2d3, #3a7bd5);
}
.form-card {
width: 400px;
background: white;
border-radius: 10px;
padding: 90px;
border: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
margin: 10px;
}
.profile-card {
width: 400px;
display: flex;
flex-direction: row;
justify-content: 20px;;
align-items: center;
width: 50%;
background: white;
border-radius: 20px;
padding: 15px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
margin: 20px;
}
.profile-pic {
width: 200px;
height: 200px;
object-fit: cover;
border-radius: 50%;
}
.profile-info {
flex: 2;
padding: 10px;
border-radius: 8px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.profile-info h2, .profile-info p {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 24px;
color: #333;
margin: 5px 0; /* Reduce the gap between elements */
}
.profile-info h2 {
font-weight: bold; /* Make the name bolder */
font-size: 28px; /* Increase the font size for the name */
font-style: normal; /* Reset the style */
}
.profile-info p {
font-style: italic; /* Make the caption italic */
font-family: 'cursive-font', cursive; /* Apply a stylish cursive handwriting font to the caption */
}
.social-icons {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.social-icons a {
margin-bottom: 10px;
text-decoration: none;
color: #333;
font-size: 30px;
}
.form-label {
font-weight: bold;
}
.form-input {
width: 100%;
padding: 10px;
margin: 5px 0;
border: 2px solid #ccc;
border-radius: 4px;
}
.form-button {
background: #00d2d3;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
}
.download-button {
background: #00d2d3;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="form-card">
<h2>Profile Card Builder</h2>
<form id="profileForm">
<div >
<label class="form-label" for="photo">Upload Photo or Avatar:</label>
<input type="file" id="photo" accept="image/*" >
</div>
<div>
<label class="form-label" for="name">Name:</label>
<input class="form-input" type="text" id="nameInput" placeholder="Your Name" required>
</div>
<div>
<label class="form-label" for="email">Email:</label>
<input class="form-input" type="email" id="emailInput" placeholder="youremail@example.com" required>
</div>
<div>
<label class="form-label" for="caption">Caption:</label>
<input class="form-input" type="text" id="captionInput" placeholder="Your Caption" required>
</div>
<div>
<label class="form-label" for="instagram">Instagram Username:</label>
<input class="form-input" type="text" id="instagramInput" placeholder="Your Instagram Username" required>
</div>
<div>
<label class="form-label" for="twitter">Twitter Username:</label>
<input class="form-input" type="text" id="twitterInput" placeholder="Your Twitter Username" required>
</div>
<div>
<label class="form-label" for="github">GitHub Username:</label>
<input class="form-input" type="text" id="githubInput" placeholder="Your GitHub Username" required>
</div>
<div>
<label class="form-label" for="portfolio">Portfolio URL:</label>
<input class="form-input" type="url" id="portfolioInput" placeholder="https://www.yourportfolio.com" required>
</div>
<div>
<label class="form-label" for="linkedin">LinkedIn Username:</label>
<input class="form-input" type="text" id="linkedinInput" placeholder="Your LinkedIn Username" required>
</div><br>
<button class="form-button" type="button" id="updateCardButton">Update Card</button>
</form>
</div>
<div class="profile-card">
<img class="profile-pic" id="profilePic" src="default-profile-pic.jpg" alt="Profile Picture">
<div class="profile-info">
<h2 id="name">Your Name</h2>
<p id="email">youremail@example.com</p>
<p id="caption">Your Caption</p>
</div>
<div class="social-icons">
<a id="instagramLink" href="#" title="Instagram"><i class="fab fa-instagram"></i></a>
<a id="twitterLink" href="#" title="Twitter"><i class="fab fa-twitter"></i></a>
<a id="githubLink" href="#" title="GitHub"><i class="fab fa-github"></i></a>
<a id="portfolioLink" href="#" title="Portfolio"><i class="fas fa-globe"></i></a>
<a id="linkedinLink" href="#" title="LinkedIn"><i class="fab fa-linkedin"></i></a>
</div>
</div>
<div class="btn-download">
<button class="download-button" id="downloadImage">Download as Image</button>
<button class="download-button" id="downloadCard">Download Card</button>
<button class="download-button" id="downloadFrame">Download Frame Code</button>
</div><br><br>
<footer style="text-align: center; font-size: small; margin-top: 20px;">
Crafted with love for you ❤️
</footer>
<script>
// Function to update the card content
function updateCard() {
const name = document.getElementById('nameInput').value;
const email = document.getElementById('emailInput').value;
const caption = document.getElementById('captionInput').value;
const instagramUsername = document.getElementById('instagramInput').value;
const twitterUsername = document.getElementById('twitterInput').value;
const githubUsername = document.getElementById('githubInput').value;
const portfolioURL = document.getElementById('portfolioInput').value;
const linkedinUsername = document.getElementById('linkedinInput').value;
// Update the card content
document.getElementById('name').textContent = name;
document.getElementById('email').textContent = email;
document.getElementById('caption').textContent = caption;
// Update social media links
document.getElementById('instagramLink').href = `https://www.instagram.com/${instagramUsername}`;
document.getElementById('twitterLink').href = `https://twitter.com/${twitterUsername}`;
document.getElementById('githubLink').href = `https://github.com/${githubUsername}`;
document.getElementById('portfolioLink').href = portfolioURL;
document.getElementById('linkedinLink').href = `https://www.linkedin.com/in/${linkedinUsername}`;
// Update profile picture (if a file was selected)
const photoInput = document.getElementById('photo');
if (photoInput.files && photoInput.files[0]) {
const reader = new FileReader();
reader.onload = function (e) {
document.getElementById('profilePic').src = e.target.result;
};
reader.readAsDataURL(photoInput.files[0]);
}
// Change the card background color
const card = document.querySelector('.profile-card');
card.style.background = getRandomGradient();
}
// Generate a random gradient background
function getRandomGradient() {
const gradientColors = [
'#00d2d3, #3a7bd5',
'#ff6a88, #56ab2f',
'#f6d365, #fda085',
'#92fe9d, #00c9ff',
'#fc00ff, #00dbde',
];
return `linear-gradient(to right, ${gradientColors[Math.floor(Math.random() * gradientColors.length)]})`;
}
// Initial update
updateCard();
// Update card when the button is clicked
const updateCardButton = document.getElementById('updateCardButton');
updateCardButton.addEventListener('click', updateCard);
// Download as Image
const downloadImageButton = document.getElementById('downloadImage');
downloadImageButton.addEventListener('click', () => {
const card = document.querySelector('.profile-card');
const cardImage = card.cloneNode(true);
cardImage.style.width = cardImage.style.height = '100%';
const cardImageContainer = document.createElement('div');
cardImageContainer.appendChild(cardImage);
const cardHTML = cardImageContainer.innerHTML;
downloadAsImage(cardHTML);
});
// Download Card as HTML
const downloadCardButton = document.getElementById('downloadCard');
downloadCardButton.addEventListener('click', () => {
const card = document.querySelector('.profile-card');
const cardHTML = card.outerHTML;
downloadAsHTML(cardHTML, 'profile-card.html');
});
// Function to generate iframe code for the banner
function generateIframeCode() {
const iframeContent = `
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
<style>
/* Your CSS styles for the banner */
body {
/* Add your styles for the iframe body here */
}
.profile-card {
/* Add your styles for the profile card here */
}
/* Add other styles for your banner content */
</style>
</head>
<body>
<div class="profile-card">
<img class="profile-pic" src="default-profile-pic.jpg" alt="Profile Picture">
<div class="profile-info">
<h2>Your Name</h2>
<p>youremail@example.com</p>
<p>Your Caption</p>
</div>
</div>
</body>
</html>
`;
// Create a Blob containing the iframe content
const iframeBlob = new Blob([iframeContent], { type: 'text/html' });
// Create a URL for the Blob
const iframeURL = URL.createObjectURL(iframeBlob);
// Create a link element to trigger the download
const iframeLink = document.createElement('a');
iframeLink.href = iframeURL;
iframeLink.download = 'profile-banner.html';
// Trigger a click event on the link to start the download
iframeLink.click();
}
// Add an event listener to the "Download Frame Code" button
const downloadFrameButton = document.getElementById('downloadFrame');
downloadFrameButton.addEventListener('click', generateIframeCode);
// Function to download content as an image
function downloadAsImage(content) {
const canvas = document.createElement('canvas');
const image = new Image();
image.onload = function () {
canvas.width = image.width;
canvas.height = image.height;
const context = canvas.getContext('2d');
context.drawImage(image, 0, 0);
const a = document.createElement('a');
a.href = canvas.toDataURL('image/png');
a.download = 'profile-card.png';
a.click();
};
image.src = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(content)));
}
// Function to download content as HTML
function downloadAsHTML(content, filename) {
const blob = new Blob([content], { type: 'text/html' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
}
</script>
</body>
</html>