File size: 12,216 Bytes
222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe 222f9c1 dc32cbe | 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 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Username Effect Manager</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap');
:root {
--bg-color: #0f172a;
--card-bg: #1e293b;
--text-primary: #f1f5f9;
--text-secondary: #94a3b8;
--accent: #6366f1;
--accent-hover: #4f46e5;
--border: #334155;
--success: #22c55e;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-color);
color: var(--text-primary);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
}
/* Header */
header {
width: 100%;
max-width: 800px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 3rem;
border-bottom: 1px solid var(--border);
padding-bottom: 1rem;
}
.brand {
font-weight: 800;
font-size: 1.2rem;
color: var(--text-secondary);
}
.brand a {
color: var(--accent);
text-decoration: none;
transition: color 0.2s;
}
.brand a:hover {
color: var(--accent-hover);
text-decoration: underline;
}
/* Main Layout */
.container {
width: 100%;
max-width: 800px;
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
}
@media (min-width: 768px) {
.container {
grid-template-columns: 1fr 1fr;
}
}
/* Cards */
.card {
background-color: var(--card-bg);
border-radius: 16px;
padding: 2rem;
border: 1px solid var(--border);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
h2 {
font-size: 1.1rem;
color: var(--text-secondary);
margin-bottom: 1.5rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Current Profile Section */
.profile-display {
text-align: center;
margin-bottom: 2rem;
}
.avatar-placeholder {
width: 80px;
height: 80px;
background: linear-gradient(135deg, var(--accent), #ec4899);
border-radius: 50%;
margin: 0 auto 1rem;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: bold;
}
/* The Active Username Effect */
.username-active {
font-size: 2rem;
font-weight: 800;
/* The Effect: Rainbow Gradient Text */
background: linear-gradient(to right, #ef4444, #f59e0b, #eab308, #22c55e, #3b82f6, #a855f7, #ec4899);
background-size: 200% auto;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: shine 3s linear infinite;
filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
transition: all 0.3s ease;
}
@keyframes shine {
to {
background-position: 200% center;
}
}
/* Input Area */
.input-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
label {
font-size: 0.9rem;
color: var(--text-secondary);
}
input[type="text"] {
background-color: var(--bg-color);
border: 1px solid var(--border);
color: var(--text-primary);
padding: 0.75rem 1rem;
border-radius: 8px;
font-size: 1rem;
outline: none;
transition: border-color 0.2s;
}
input[type="text"]:focus {
border-color: var(--accent);
}
button {
background-color: var(--accent);
color: white;
border: none;
padding: 0.75rem 1rem;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
margin-top: 0.5rem;
transition: background-color 0.2s;
}
button:hover {
background-color: var(--accent-hover);
}
/* History List */
.history-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
max-height: 400px;
overflow-y: auto;
}
.history-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem;
background-color: rgba(0,0,0,0.2);
border-radius: 8px;
border-left: 3px solid var(--border);
}
/* The Old Username Effect - Explicitly Plain */
.username-old {
font-size: 1.1rem;
font-weight: 600;
color: var(--text-secondary);
text-decoration: line-through; /* Visual indication it's old */
opacity: 0.7;
}
.timestamp {
font-size: 0.75rem;
color: var(--text-secondary);
}
.badge {
background-color: rgba(255, 255, 255, 0.1);
padding: 2px 8px;
border-radius: 4px;
font-size: 0.7rem;
text-transform: uppercase;
color: var(--text-secondary);
}
/* Empty State */
.empty-state {
text-align: center;
color: var(--text-secondary);
font-style: italic;
padding: 2rem;
}
/* Notification Toast */
.toast {
position: fixed;
bottom: 2rem;
right: 2rem;
background-color: var(--card-bg);
border-left: 4px solid var(--success);
color: var(--text-primary);
padding: 1rem 2rem;
border-radius: 4px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
transform: translateY(150%);
transition: transform 0.3s ease-out;
z-index: 100;
}
.toast.show {
transform: translateY(0);
}
</style>
</head>
<body>
<header>
<div class="brand">User Control Panel</div>
<div class="brand">Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a></div>
</header>
<div class="container">
<!-- Section 1: Update Username -->
<div class="card">
<h2>Account Settings</h2>
<div class="profile-display">
<div class="avatar-placeholder" id="avatar">U</div>
<!-- The active username with the cool effect -->
<div id="currentUsernameDisplay" class="username-active">Loading...</div>
<p style="margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-secondary);">Current Status: <span style="color: var(--success);">Active</span></p>
</div>
<div class="input-group">
<label for="usernameInput">Enter New Username</label>
<input type="text" id="usernameInput" placeholder="e.g. CyberNinja99" autocomplete="off">
<button onclick="handleUpdate()">Update Username</button>
</div>
</div>
<!-- Section 2: History (Old Usernames) -->
<div class="card">
<h2>Username History</h2>
<p style="font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem;">
Previous usernames are preserved for history but lose their special effects to prevent impersonation.
</p>
<div id="historyList" class="history-list">
<!-- JS will populate this -->
<div class="empty-state">No username changes yet.</div>
</div>
</div>
</div>
<!-- Toast Notification -->
<div id="toast" class="toast">
Username updated successfully!
</div>
<script>
// State
let currentUsername = "NewUser_01";
let usernameHistory = [];
// DOM Elements
const currentDisplay = document.getElementById('currentUsernameDisplay');
const inputField = document.getElementById('usernameInput');
const historyList = document.getElementById('historyList');
const avatar = document.getElementById('avatar');
const toast = document.getElementById('toast');
// Initialize
window.onload = () => {
updateUI();
// Set input value to current for easy editing
inputField.value = currentUsername;
};
function handleUpdate() {
const newName = inputField.value.trim();
if (!newName) {
alert("Please enter a username");
return;
}
if (newName === currentUsername) {
alert("You are already using this username.");
return;
}
// 1. Save old username to history
const oldRecord = {
name: currentUsername,
changedAt: new Date().toLocaleString()
};
// Add to beginning of array
usernameHistory.unshift(oldRecord);
// 2. Update Current Username
currentUsername = newName;
// 3. Update Avatar Initial
avatar.textContent = newName.charAt(0).toUpperCase();
// 4. Refresh UI
updateUI();
// 5. Reset Input
inputField.value = newName;
// 6. Show Toast
showToast();
}
function updateUI() {
// Update Main Display (Apply Effect)
currentDisplay.textContent = currentUsername;
// Render History (Remove Effect)
renderHistory();
}
function renderHistory() {
historyList.innerHTML = '';
if (usernameHistory.length === 0) {
historyList.innerHTML = '<div class="empty-state">No username changes yet.</div>';
return;
}
usernameHistory.forEach(record => {
const item = document.createElement('div');
item.className = 'history-item';
// HTML for the history item
// IMPORTANT: We use class 'username-old' which has text-decoration: line-through and grey color
// This fulfills the requirement: "update old embedded username... users cant have an old username with text effect"
item.innerHTML = `
<span class="username-old">${escapeHtml(record.name)}</span>
<div style="text-align: right;">
<div class="badge">Old</div>
<div class="timestamp">${record.changedAt}</div>
</div>
`;
historyList.appendChild(item);
});
}
function showToast() {
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 3000);
}
// Security: Basic HTML escaping to prevent XSS
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
</script>
</body>
</html> |