Spaces:
Running
Running
nothing change
Browse files- index.html +15 -57
index.html
CHANGED
|
@@ -140,7 +140,7 @@
|
|
| 140 |
</div>
|
| 141 |
<!-- Editable Name -->
|
| 142 |
<div class="relative mb-3">
|
| 143 |
-
<h1 id="editableName" class="text-3xl font-bold
|
| 144 |
</div>
|
| 145 |
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
|
@@ -261,55 +261,7 @@
|
|
| 261 |
document.getElementById('socialDropdown').style.display = 'none';
|
| 262 |
}
|
| 263 |
});
|
| 264 |
-
|
| 265 |
-
document.querySelectorAll('.social-option').forEach(option => {
|
| 266 |
-
option.addEventListener('click', function(e) {
|
| 267 |
-
e.preventDefault();
|
| 268 |
-
const platform = this.getAttribute('data-platform');
|
| 269 |
-
|
| 270 |
-
// Create modal for handle input
|
| 271 |
-
const modal = document.createElement('div');
|
| 272 |
-
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
|
| 273 |
-
modal.innerHTML = `
|
| 274 |
-
<div class="bg-gray-800 p-6 rounded-lg max-w-sm w-full mx-4">
|
| 275 |
-
<h3 class="text-lg font-medium mb-4">Add your ${platform} handle</h3>
|
| 276 |
-
<input type="text" id="handleInput" class="w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 mb-4 text-white" placeholder="Your handle">
|
| 277 |
-
<div class="flex justify-end space-x-2">
|
| 278 |
-
<button id="cancelHandle" class="px-4 py-2 text-gray-300 hover:text-white">Cancel</button>
|
| 279 |
-
<button id="saveHandle" class="px-4 py-2 bg-indigo-600 rounded hover:bg-indigo-700">Add</button>
|
| 280 |
-
</div>
|
| 281 |
-
</div>
|
| 282 |
-
`;
|
| 283 |
-
document.body.appendChild(modal);
|
| 284 |
-
|
| 285 |
-
const handleInput = document.getElementById('handleInput');
|
| 286 |
-
const cancelBtn = document.getElementById('cancelHandle');
|
| 287 |
-
const saveBtn = document.getElementById('saveHandle');
|
| 288 |
-
|
| 289 |
-
handleInput.focus();
|
| 290 |
-
|
| 291 |
-
cancelBtn.addEventListener('click', function() {
|
| 292 |
-
document.body.removeChild(modal);
|
| 293 |
-
});
|
| 294 |
-
|
| 295 |
-
saveBtn.addEventListener('click', function() {
|
| 296 |
-
const handle = handleInput.value.trim();
|
| 297 |
-
if (handle) {
|
| 298 |
-
addSocialIcon(platform, handle);
|
| 299 |
-
}
|
| 300 |
-
document.body.removeChild(modal);
|
| 301 |
-
document.getElementById('socialDropdown').style.display = 'none';
|
| 302 |
-
});
|
| 303 |
-
|
| 304 |
-
// Close modal when clicking outside
|
| 305 |
-
modal.addEventListener('click', function(e) {
|
| 306 |
-
if (e.target === modal) {
|
| 307 |
-
document.body.removeChild(modal);
|
| 308 |
-
}
|
| 309 |
-
});
|
| 310 |
-
});
|
| 311 |
-
});
|
| 312 |
-
// Initialize placeholder functionality for all editable elements except heading
|
| 313 |
document.querySelectorAll('.editable').forEach(editable => {
|
| 314 |
// Clear placeholder text when focusing
|
| 315 |
editable.addEventListener('focus', function() {
|
|
@@ -327,7 +279,6 @@
|
|
| 327 |
this.style.background = 'transparent';
|
| 328 |
});
|
| 329 |
});
|
| 330 |
-
|
| 331 |
// Special handling for heading element
|
| 332 |
const editableName = document.getElementById('editableName');
|
| 333 |
editableName.addEventListener('focus', function() {
|
|
@@ -335,6 +286,8 @@
|
|
| 335 |
this.textContent = '';
|
| 336 |
}
|
| 337 |
this.style.background = 'transparent';
|
|
|
|
|
|
|
| 338 |
});
|
| 339 |
|
| 340 |
editableName.addEventListener('blur', function() {
|
|
@@ -342,7 +295,14 @@
|
|
| 342 |
this.textContent = this.getAttribute('data-placeholder');
|
| 343 |
}
|
| 344 |
this.style.background = 'transparent';
|
|
|
|
|
|
|
| 345 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
function addSocialIcon(platform, handle) {
|
| 347 |
const container = document.getElementById('socialIconsContainer');
|
| 348 |
|
|
@@ -477,7 +437,6 @@ function getSocialUrl(platform, handle) {
|
|
| 477 |
});
|
| 478 |
});
|
| 479 |
});
|
| 480 |
-
|
| 481 |
function addSocialIcon(platform, handle) {
|
| 482 |
const container = document.getElementById('socialIconsContainer');
|
| 483 |
|
|
@@ -504,14 +463,13 @@ function getSocialUrl(platform, handle) {
|
|
| 504 |
iconWrapper.appendChild(icon);
|
| 505 |
iconWrapper.appendChild(removeBtn);
|
| 506 |
|
| 507 |
-
// Insert before the plus button
|
| 508 |
-
const
|
| 509 |
-
container.insertBefore(iconWrapper,
|
| 510 |
|
| 511 |
feather.replace();
|
| 512 |
}
|
| 513 |
-
|
| 514 |
-
function getFeatherIconName(platform) {
|
| 515 |
const iconMap = {
|
| 516 |
instagram: 'instagram',
|
| 517 |
facebook: 'facebook',
|
|
|
|
| 140 |
</div>
|
| 141 |
<!-- Editable Name -->
|
| 142 |
<div class="relative mb-3">
|
| 143 |
+
<h1 id="editableName" class="text-3xl font-bold text-white text-center min-h-[1.5em] px-2 py-1" contenteditable="true" data-placeholder="Tap to Add your Name">Tap to Add your Name</h1>
|
| 144 |
</div>
|
| 145 |
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
|
|
|
| 261 |
document.getElementById('socialDropdown').style.display = 'none';
|
| 262 |
}
|
| 263 |
});
|
| 264 |
+
// Initialize placeholder functionality for all editable elements except heading
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
document.querySelectorAll('.editable').forEach(editable => {
|
| 266 |
// Clear placeholder text when focusing
|
| 267 |
editable.addEventListener('focus', function() {
|
|
|
|
| 279 |
this.style.background = 'transparent';
|
| 280 |
});
|
| 281 |
});
|
|
|
|
| 282 |
// Special handling for heading element
|
| 283 |
const editableName = document.getElementById('editableName');
|
| 284 |
editableName.addEventListener('focus', function() {
|
|
|
|
| 286 |
this.textContent = '';
|
| 287 |
}
|
| 288 |
this.style.background = 'transparent';
|
| 289 |
+
this.style.border = 'none';
|
| 290 |
+
this.style.outline = 'none';
|
| 291 |
});
|
| 292 |
|
| 293 |
editableName.addEventListener('blur', function() {
|
|
|
|
| 295 |
this.textContent = this.getAttribute('data-placeholder');
|
| 296 |
}
|
| 297 |
this.style.background = 'transparent';
|
| 298 |
+
this.style.border = 'none';
|
| 299 |
+
this.style.outline = 'none';
|
| 300 |
});
|
| 301 |
+
|
| 302 |
+
// Force clear any existing background/border styles
|
| 303 |
+
editableName.style.background = 'transparent';
|
| 304 |
+
editableName.style.border = 'none';
|
| 305 |
+
editableName.style.outline = 'none';
|
| 306 |
function addSocialIcon(platform, handle) {
|
| 307 |
const container = document.getElementById('socialIconsContainer');
|
| 308 |
|
|
|
|
| 437 |
});
|
| 438 |
});
|
| 439 |
});
|
|
|
|
| 440 |
function addSocialIcon(platform, handle) {
|
| 441 |
const container = document.getElementById('socialIconsContainer');
|
| 442 |
|
|
|
|
| 463 |
iconWrapper.appendChild(icon);
|
| 464 |
iconWrapper.appendChild(removeBtn);
|
| 465 |
|
| 466 |
+
// Insert before the plus button
|
| 467 |
+
const addButton = document.getElementById('addSocialButton').parentNode;
|
| 468 |
+
container.insertBefore(iconWrapper, addButton);
|
| 469 |
|
| 470 |
feather.replace();
|
| 471 |
}
|
| 472 |
+
function getFeatherIconName(platform) {
|
|
|
|
| 473 |
const iconMap = {
|
| 474 |
instagram: 'instagram',
|
| 475 |
facebook: 'facebook',
|