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|
| 7 |
+
<!-- Lucide Icons -->
|
| 8 |
+
<script src="https://unpkg.com/lucide@latest"></script>
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--primary: #6366f1;
|
| 12 |
+
--primary-hover: #4f46e5;
|
| 13 |
+
--bg-dark: #0f172a;
|
| 14 |
+
--bg-card: #1e293b;
|
| 15 |
+
--text-main: #f8fafc;
|
| 16 |
+
--text-muted: #94a3b8;
|
| 17 |
+
--accent: #22d3ee;
|
| 18 |
+
--danger: #ef4444;
|
| 19 |
+
--success: #10b981;
|
| 20 |
+
--glass: rgba(30, 41, 59, 0.7);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
* {
|
| 24 |
+
margin: 0;
|
| 25 |
+
padding: 0;
|
| 26 |
+
box-sizing: border-box;
|
| 27 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
body {
|
| 31 |
+
background-color: var(--bg-dark);
|
| 32 |
+
color: var(--text-main);
|
| 33 |
+
min-height: 100vh;
|
| 34 |
+
line-height: 1.6;
|
| 35 |
+
overflow-x: hidden;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/* Header Styles */
|
| 39 |
+
header {
|
| 40 |
+
background: var(--glass);
|
| 41 |
+
backdrop-filter: blur(12px);
|
| 42 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
| 43 |
+
padding: 1rem 2rem;
|
| 44 |
+
display: flex;
|
| 45 |
+
justify-content: space-between;
|
| 46 |
+
align-items: center;
|
| 47 |
+
position: sticky;
|
| 48 |
+
top: 0;
|
| 49 |
+
z-index: 100;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.logo-container {
|
| 53 |
+
display: flex;
|
| 54 |
+
align-items: center;
|
| 55 |
+
gap: 10px;
|
| 56 |
+
font-weight: 700;
|
| 57 |
+
font-size: 1.2rem;
|
| 58 |
+
letter-spacing: -0.5px;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.logo-icon {
|
| 62 |
+
color: var(--accent);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.built-with {
|
| 66 |
+
font-size: 0.85rem;
|
| 67 |
+
color: var(--text-muted);
|
| 68 |
+
text-decoration: none;
|
| 69 |
+
transition: color 0.3s ease;
|
| 70 |
+
display: flex;
|
| 71 |
+
align-items: center;
|
| 72 |
+
gap: 5px;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.built-with:hover {
|
| 76 |
+
color: var(--accent);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/* Main Layout */
|
| 80 |
+
main {
|
| 81 |
+
max-width: 1200px;
|
| 82 |
+
margin: 0 auto;
|
| 83 |
+
padding: 2rem;
|
| 84 |
+
display: grid;
|
| 85 |
+
grid-template-columns: 1fr 350px;
|
| 86 |
+
gap: 2rem;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
@media (max-width: 992px) {
|
| 90 |
+
main {
|
| 91 |
+
grid-template-columns: 1fr;
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/* Hero Section */
|
| 96 |
+
.hero {
|
| 97 |
+
grid-column: 1 / -1;
|
| 98 |
+
text-align: center;
|
| 99 |
+
padding: 3rem 0;
|
| 100 |
+
animation: fadeIn 0.8s ease-out;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.hero h1 {
|
| 104 |
+
font-size: clamp(2rem, 5vw, 3.5rem);
|
| 105 |
+
margin-bottom: 1rem;
|
| 106 |
+
background: linear-gradient(to right, #fff, var(--accent));
|
| 107 |
+
-webkit-background-clip: text;
|
| 108 |
+
-webkit-text-fill-color: transparent;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.hero p {
|
| 112 |
+
color: var(--text-muted);
|
| 113 |
+
max-width: 600px;
|
| 114 |
+
margin: 0 auto 2rem;
|
| 115 |
+
font-size: 1.1rem;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/* Dashboard Card */
|
| 119 |
+
.card {
|
| 120 |
+
background: var(--bg-card);
|
| 121 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 122 |
+
border-radius: 24px;
|
| 123 |
+
padding: 2rem;
|
| 124 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
|
| 125 |
+
transition: transform 0.3s ease;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.card-title {
|
| 129 |
+
display: flex;
|
| 130 |
+
align-items: center;
|
| 131 |
+
gap: 10px;
|
| 132 |
+
font-size: 1.25rem;
|
| 133 |
+
margin-bottom: 1.5rem;
|
| 134 |
+
color: var(--text-main);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/* Interaction Area */
|
| 138 |
+
.interceptor-box {
|
| 139 |
+
display: flex;
|
| 140 |
+
flex-direction: column;
|
| 141 |
+
align-items: center;
|
| 142 |
+
justify-content: center;
|
| 143 |
+
border: 2px dashed rgba(255, 255, 255, 0.1);
|
| 144 |
+
border-radius: 20px;
|
| 145 |
+
padding: 3rem 2rem;
|
| 146 |
+
text-align: center;
|
| 147 |
+
cursor: pointer;
|
| 148 |
+
transition: all 0.3s ease;
|
| 149 |
+
background: rgba(15, 23, 42, 0.5);
|
| 150 |
+
margin-bottom: 2rem;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.interceptor-box:hover {
|
| 154 |
+
border-color: var(--primary);
|
| 155 |
+
background: rgba(99, 102, 241, 0.05);
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.interceptor-box.active {
|
| 159 |
+
border-color: var(--accent);
|
| 160 |
+
animation: pulse 1.5s infinite;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
.btn-primary {
|
| 164 |
+
background: var(--primary);
|
| 165 |
+
color: white;
|
| 166 |
+
border: none;
|
| 167 |
+
padding: 12px 24px;
|
| 168 |
+
border-radius: 12px;
|
| 169 |
+
font-weight: 600;
|
| 170 |
+
cursor: pointer;
|
| 171 |
+
transition: background 0.3s ease;
|
| 172 |
+
display: flex;
|
| 173 |
+
align-items: center;
|
| 174 |
+
gap: 8px;
|
| 175 |
+
margin-top: 1rem;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
.btn-primary:hover {
|
| 179 |
+
background: var(--primary-hover);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/* Code Section */
|
| 183 |
+
.code-container {
|
| 184 |
+
background: #011627;
|
| 185 |
+
border-radius: 12px;
|
| 186 |
+
padding: 1.5rem;
|
| 187 |
+
position: relative;
|
| 188 |
+
margin-top: 2rem;
|
| 189 |
+
font-family: 'Fira Code', monospace;
|
| 190 |
+
font-size: 0.9rem;
|
| 191 |
+
overflow-x: auto;
|
| 192 |
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
.code-header {
|
| 196 |
+
display: flex;
|
| 197 |
+
justify-content: space-between;
|
| 198 |
+
align-items: center;
|
| 199 |
+
margin-bottom: 1rem;
|
| 200 |
+
color: var(--text-muted);
|
| 201 |
+
font-size: 0.8rem;
|
| 202 |
+
text-transform: uppercase;
|
| 203 |
+
letter-spacing: 1px;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
pre {
|
| 207 |
+
color: #d6deeb;
|
| 208 |
+
white-space: pre-wrap;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.keyword { color: #c792ea; }
|
| 212 |
+
.function { color: #82aaff; }
|
| 213 |
+
.string { color: #ecc48d; }
|
| 214 |
+
.comment { color: #637777; font-style: italic; }
|
| 215 |
+
|
| 216 |
+
/* History Panel */
|
| 217 |
+
.history-panel {
|
| 218 |
+
display: flex;
|
| 219 |
+
flex-direction: column;
|
| 220 |
+
gap: 1rem;
|
| 221 |
+
max-height: 80vh;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.history-item {
|
| 225 |
+
background: rgba(255, 255, 255, 0.03);
|
| 226 |
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 227 |
+
padding: 1rem;
|
| 228 |
+
border-radius: 16px;
|
| 229 |
+
display: flex;
|
| 230 |
+
flex-direction: column;
|
| 231 |
+
gap: 8px;
|
| 232 |
+
animation: slideIn 0.3s ease-out;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.history-item .url {
|
| 236 |
+
font-size: 0.85rem;
|
| 237 |
+
color: var(--accent);
|
| 238 |
+
word-break: break-all;
|
| 239 |
+
text-decoration: none;
|
| 240 |
+
font-weight: 500;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
.history-item .meta {
|
| 244 |
+
display: flex;
|
| 245 |
+
justify-content: space-between;
|
| 246 |
+
font-size: 0.7rem;
|
| 247 |
+
color: var(--text-muted);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
.status-badge {
|
| 251 |
+
padding: 2px 8px;
|
| 252 |
+
border-radius: 10px;
|
| 253 |
+
background: rgba(16, 185, 129, 0.2);
|
| 254 |
+
color: var(--success);
|
| 255 |
+
font-weight: bold;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
/* Animations */
|
| 259 |
+
@keyframes fadeIn {
|
| 260 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 261 |
+
to { opacity: 1; transform: translateY(0); }
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
@keyframes slideIn {
|
| 265 |
+
from { opacity: 0; transform: translateX(20px); }
|
| 266 |
+
to { opacity: 1; transform: translateX(0); }
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
@keyframes pulse {
|
| 270 |
+
0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.4); }
|
| 271 |
+
70% { box-shadow: 0 0 0 15px rgba(34, 211, 238, 0); }
|
| 272 |
+
100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.empty-state {
|
| 276 |
+
text-align: center;
|
| 277 |
+
color: var(--text-muted);
|
| 278 |
+
padding: 2rem;
|
| 279 |
+
font-style: italic;
|
| 280 |
+
}
|
| 281 |
+
</style>
|
| 282 |
+
</head>
|
| 283 |
+
<body>
|
| 284 |
+
|
| 285 |
+
<header>
|
| 286 |
+
<div class="logo-container">
|
| 287 |
+
<i data-lucide="clipboard-copy" class="logo-icon"></i>
|
| 288 |
+
<span>URL Interceptor</span>
|
| 289 |
+
</div>
|
| 290 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with" target="_blank">
|
| 291 |
+
Built with anycoder <i data-lucide="external-link" size="14"></i>
|
| 292 |
+
</a>
|
| 293 |
+
</header>
|
| 294 |
+
|
| 295 |
+
<main>
|
| 296 |
+
<section class="hero">
|
| 297 |
+
<h1>Intercept Clipboard URLs</h1>
|
| 298 |
+
<p>Una herramienta conceptual para monitorear y capturar URLs copiadas al portapapeles. Implementa la l贸gica de detecci贸n en tiempo real.</p>
|
| 299 |
+
</section>
|
| 300 |
+
|
| 301 |
+
<div class="card">
|
| 302 |
+
<div class="card-title">
|
| 303 |
+
<i data-lucide="zap" style="color: var(--accent)"></i>
|
| 304 |
+
Simulador de Intercepci贸n
|
| 305 |
+
</div>
|
| 306 |
+
|
| 307 |
+
<div class="interceptor-box" id="dropZone">
|
| 308 |
+
<i data-lucide="mouse-pointer-2" size="48" style="margin-bottom: 1rem; color: var(--text-muted)"></i>
|
| 309 |
+
<h3>Haz clic aqu铆 y presiona Ctrl + V</h3>
|
| 310 |
+
<p style="color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem;">
|
| 311 |
+
O haz clic en el bot贸n para leer el portapapeles
|
| 312 |
+
</p>
|
| 313 |
+
<button class="btn-primary" id="readClipboardBtn">
|
| 314 |
+
<i data-lucide="clipboard-list"></i> Leer Portapapeles
|
| 315 |
+
</button>
|
| 316 |
+
</div>
|
| 317 |
+
|
| 318 |
+
<div class="card-title" style="margin-top: 3rem;">
|
| 319 |
+
<i data-lucide="code-2" style="color: var(--primary)"></i>
|
| 320 |
+
Implementaci贸n en Node.js
|
| 321 |
+
</div>
|
| 322 |
+
<p style="color: var(--text-muted); margin-bottom: 1rem; font-size: 0.9rem;">
|
| 323 |
+
Para interceptar URLs a nivel de sistema operativo (fuera del navegador), necesitas Node.js y una librer铆a como <code>clipboardy</code>.
|
| 324 |
+
</p>
|
| 325 |
+
<div class="code-container">
|
| 326 |
+
<div class="code-header">
|
| 327 |
+
<span>index.js</span>
|
| 328 |
+
<span style="color: var(--accent)">JavaScript</span>
|
| 329 |
+
</div>
|
| 330 |
+
<pre><code><span class="keyword">const</span> clipboardy = <span class="function">require</span>(<span class="string">'clipboardy'</span>);
|
| 331 |
+
|
| 332 |
+
<span class="comment">// Almac茅n para evitar duplicados consecutivos</span>
|
| 333 |
+
<span class="keyword">let</span> lastClipboardContent = <span class="string">''</span>;
|
| 334 |
+
|
| 335 |
+
<span class="function">console</span>.<span class="function">log</span>(<span class="string">"馃殌 Monitoreando portapapeles..."</span>);
|
| 336 |
+
|
| 337 |
+
<span class="comment">// Intervalo de monitoreo cada 1 segundo</span>
|
| 338 |
+
<span class="keyword">setInterval</span>(() => {
|
| 339 |
+
<span class="keyword">const</span> currentContent = clipboardy.readSync();
|
| 340 |
+
|
| 341 |
+
<span class="keyword">if</span> (currentContent !== lastClipboardContent) {
|
| 342 |
+
lastClipboardContent = currentContent;
|
| 343 |
+
|
| 344 |
+
<span class="comment">// Regex para validar si es una URL</span>
|
| 345 |
+
<span class="keyword">const</span> urlPattern = <span class="string">/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/</span>;
|
| 346 |
+
|
| 347 |
+
<span class="keyword">if</span> (urlPattern.test(currentContent)) {
|
| 348 |
+
<span class="function">console</span>.<span class="function">log</span>(<span class="string">"\n馃幆 URL Interceptada!"</span>);
|
| 349 |
+
<span class="function">console</span>.<span class="function">log</span>(<span class="string">`Enlace: ${currentContent}`</span>);
|
| 350 |
+
<span class="function">console</span>.<span class="function">log</span>(<span class="string">`Hora: ${<span class="keyword">new</span> Date().toLocaleTimeString()}`</span>);
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
}, <span class="number">1000</span>);</code></pre>
|
| 354 |
+
</div>
|
| 355 |
+
</div>
|
| 356 |
+
|
| 357 |
+
<aside>
|
| 358 |
+
<div class="card" style="height: 100%;">
|
| 359 |
+
<div class="card-title">
|
| 360 |
+
<i data-lucide="history" style="color: var(--success)"></i>
|
| 361 |
+
Historial
|
| 362 |
+
</div>
|
| 363 |
+
<div class="history-panel" id="historyPanel">
|
| 364 |
+
<div class="empty-state">No hay URLs interceptadas a煤n...</div>
|
| 365 |
+
</div>
|
| 366 |
+
</div>
|
| 367 |
+
</aside>
|
| 368 |
+
</main>
|
| 369 |
+
|
| 370 |
+
<script>
|
| 371 |
+
// Initialize Lucide Icons
|
| 372 |
+
lucide.createIcons();
|
| 373 |
+
|
| 374 |
+
const dropZone = document.getElementById('dropZone');
|
| 375 |
+
const readBtn = document.getElementById('readClipboardBtn');
|
| 376 |
+
const historyPanel = document.getElementById('historyPanel');
|
| 377 |
+
|
| 378 |
+
// URL Validation Regex
|
| 379 |
+
const urlRegex = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
|
| 380 |
+
|
| 381 |
+
// Function to add URL to history
|
| 382 |
+
function addToHistory(url) {
|
| 383 |
+
if (!urlRegex.test(url)) {
|
| 384 |
+
alert("El contenido del portapapeles no es una URL v谩lida.");
|
| 385 |
+
return false;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
// Remove empty state
|
| 389 |
+
if (historyPanel.querySelector('.empty-state')) {
|
| 390 |
+
historyPanel.innerHTML = '';
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
const now = new Date();
|
| 394 |
+
const timeStr = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
| 395 |
+
|
| 396 |
+
const item = document.createElement('div');
|
| 397 |
+
item.className = 'history-item';
|
| 398 |
+
item.innerHTML = `
|
| 399 |
+
<a href="${url}" target="_blank" class="url">${url}</a>
|
| 400 |
+
<div class="meta">
|
| 401 |
+
<span>${timeStr}</span>
|
| 402 |
+
<span class="status-badge">Capturado</span>
|
| 403 |
+
</div>
|
| 404 |
+
`;
|
| 405 |
+
|
| 406 |
+
historyPanel.prepend(item);
|
| 407 |
+
return true;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
// Read clipboard from button
|
| 411 |
+
async function handleReadClipboard() {
|
| 412 |
+
try {
|
| 413 |
+
const text = await navigator.clipboard.readText();
|
| 414 |
+
if (text) {
|
| 415 |
+
const success = addToHistory(text);
|
| 416 |
+
if (success) {
|
| 417 |
+
triggerSuccessEffect();
|
| 418 |
+
}
|
| 419 |
+
}
|
| 420 |
+
} catch (err) {
|
| 421 |
+
alert("Error al acceder al portapapeles. Por favor, otorga los permisos.");
|
| 422 |
+
console.error('Clipboard error:', err);
|
| 423 |
+
}
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
// Visual effect for success
|
| 427 |
+
function triggerSuccessEffect() {
|
| 428 |
+
dropZone.classList.add('active');
|
| 429 |
+
setTimeout(() => dropZone.classList.remove('active'), 600);
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
// Event Listeners
|
| 433 |
+
readBtn.addEventListener('click', handleReadClipboard);
|
| 434 |
+
|
| 435 |
+
// Handle Ctrl+V when focusing the dropzone
|
| 436 |
+
dropZone.addEventListener('click', () => {
|
| 437 |
+
dropZone.style.borderColor = 'var(--accent)';
|
| 438 |
+
dropZone.style.background = 'rgba(99, 102, 241, 0.1)';
|
| 439 |
+
});
|
| 440 |
+
|
| 441 |
+
window.addEventListener('paste', (e) => {
|
| 442 |
+
// Only intercept if the user is interacting with the app
|
| 443 |
+
const text = (e.clipboardData || window.clipboardData).getData('text');
|
| 444 |
+
if (text) {
|
| 445 |
+
const success = addToHistory(text);
|
| 446 |
+
if (success) {
|
| 447 |
+
triggerSuccessEffect();
|
| 448 |
+
}
|
| 449 |
+
}
|
| 450 |
+
});
|
| 451 |
+
|
| 452 |
+
// Reset dropzone style when clicking away
|
| 453 |
+
document.addEventListener('click', (e) => {
|
| 454 |
+
if (!dropZone.contains(e.target)) {
|
| 455 |
+
dropZone.style.borderColor = '';
|
| 456 |
+
dropZone.style.background = '';
|
| 457 |
+
}
|
| 458 |
+
});
|
| 459 |
+
</script>
|
| 460 |
+
</body>
|
| 461 |
+
</html>
|