-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemp.html
262 lines (244 loc) · 10.5 KB
/
temp.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
<!DOCTYPE html>
<html>
<head>
<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: 600px;
height: 300px;
background: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
margin: 20px;
}
.profile-pic {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 8px;
}
.social-icons {
display: flex;
margin-top: 20px;
}
.social-icons a {
margin-right: 10px;
text-decoration: none;
color: #333;
font-size: 20px;
}
.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">
<h2 id="name">Your Name</h2>
<p id="email">youremail@example.com</p>
<p id="caption">Your Caption</p>
<div class="social-icons">
<a id="instagramLink" href="#"><i class="fab fa-instagram"></i></a>
<a id="twitterLink" href="#"><i class="fab fa-twitter"></i></a>
<a id="githubLink" href="#"><i class="fab fa-github"></i></a>
<a id="portfolioLink" href="#"><i class="fas fa-globe"></i></a>
<a id="linkedinLink" href="#"><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');
});
// Download Frame Code as HTML
const downloadFrameButton = document.getElementById('downloadFrame');
downloadFrameButton.addEventListener('click', () => {
const frameHTML = `<html>${document.head.outerHTML}${document.body.outerHTML}</html>`;
downloadAsHTML(frameHTML, 'frame-code.html');
});
// 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>