alfabill commited on
Commit
cd034d8
·
verified ·
1 Parent(s): 8625ac7

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +300 -230
index.html CHANGED
@@ -1,14 +1,17 @@
1
  <!DOCTYPE html>
2
  <html lang="es">
 
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Node URL Interceptor Script</title>
7
- <script src="https://cdn.tailwindcss.com"></script>
8
- <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
9
- <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@300;400;600;800&display=swap" rel="stylesheet">
10
- <script>
11
- tailwind.config = {
 
 
12
  theme: {
13
  extend: {
14
  fontFamily: {
@@ -43,270 +46,324 @@
43
  }
44
  }
45
  }
46
- </script>
47
- <style>
48
- body {
49
- background-color: #0f172a;
50
- background-image:
51
- radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
52
- radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.1) 0px, transparent 50%),
53
- radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
54
- radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
55
- background-attachment: fixed;
56
- color: #e2e8f0;
57
- }
58
-
59
- .glass-panel {
60
- background: rgba(30, 41, 59, 0.7);
61
- backdrop-filter: blur(12px);
62
- border: 1px solid rgba(255, 255, 255, 0.1);
63
- box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
64
- }
65
 
66
- .code-block {
67
- background: #0d1117;
68
- border: 1px solid #30363d;
69
- border-radius: 0.5rem;
70
- position: relative;
71
- overflow: hidden;
72
- }
73
 
74
- /* Custom Scrollbar */
75
- ::-webkit-scrollbar {
76
- width: 8px;
77
- height: 8px;
78
- }
79
- ::-webkit-scrollbar-track {
80
- background: #0f172a;
81
- }
82
- ::-webkit-scrollbar-thumb {
83
- background: #334155;
84
- border-radius: 4px;
85
- }
86
- ::-webkit-scrollbar-thumb:hover {
87
- background: #475569;
88
- }
89
 
90
- .glow-text {
91
- text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
92
- }
 
 
93
 
94
- .terminal-line {
95
- opacity: 0;
96
- animation: fadeIn 0.3s forwards;
97
- }
98
- @keyframes fadeIn {
99
- to { opacity: 1; }
100
- }
101
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  </head>
 
103
  <body class="min-h-screen flex flex-col">
104
 
105
- <!-- Navbar -->
106
- <nav class="glass-panel border-b border-white/10 sticky top-0 z-50">
107
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
108
- <div class="flex items-center justify-between h-16">
109
- <div class="flex items-center gap-3">
110
- <div class="w-8 h-8 rounded bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center shadow-lg shadow-cyan-500/20">
111
- <i class="fa-solid fa-link text-white text-sm"></i>
112
- </div>
113
- <span class="font-bold text-xl tracking-tight text-white">Clip<span class="text-cyan-400">Snatch</span></span>
114
- </div>
115
- <div class="flex items-center gap-4">
116
- <span class="text-xs font-mono text-slate-400 bg-slate-800 px-2 py-1 rounded border border-slate-700">v1.0.0</span>
117
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="text-xs text-slate-400 hover:text-cyan-400 transition-colors">Built with anycoder</a>
118
- </div>
119
- </div>
120
  </div>
121
- </nav>
122
-
123
- <!-- Main Content -->
124
- <main class="flex-grow container mx-auto px-4 py-8 grid grid-cols-1 lg:grid-cols-12 gap-8">
125
-
126
- <!-- Left Column: Configuration & Code -->
127
- <div class="lg:col-span-5 space-y-6">
128
-
129
- <!-- Intro Card -->
130
- <div class="glass-panel rounded-2xl p-6 animate-float">
131
- <h1 class="text-2xl font-bold text-white mb-2 glow-text">Interceptor de URLs</h1>
132
- <p class="text-slate-400 text-sm mb-4">
133
- Genera un script de Node.js que monitorea el portapapeles en tiempo real.
134
- Detecta automáticamente URLs y ejecuta acciones personalizadas.
135
- </p>
136
- <div class="flex gap-2">
137
- <span class="px-2 py-1 rounded bg-blue-500/10 text-blue-400 text-xs border border-blue-500/20">Node.js</span>
138
- <span class="px-2 py-1 rounded bg-purple-500/10 text-purple-400 text-xs border border-purple-500/20">Clipboard</span>
139
- <span class="px-2 py-1 rounded bg-green-500/10 text-green-400 text-xs border border-green-500/20">Automation</span>
140
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  </div>
142
-
143
- <!-- Configuration Form -->
144
- <div class="glass-panel rounded-2xl p-6">
145
- <h2 class="text-lg font-semibold text-white mb-4 flex items-center gap-2">
146
- <i class="fa-solid fa-sliders text-cyan-400"></i> Configuración
147
- </h2>
148
-
149
- <div class="space-y-4">
150
- <!-- Check Interval -->
151
- <div>
152
- <label class="block text-xs font-medium text-slate-400 mb-1">Intervalo de Escaneo (ms)</label>
153
- <div class="relative">
154
- <input type="number" id="intervalInput" value="1000" min="500" step="100"
 
155
  class="w-full bg-slate-900/50 border border-slate-700 rounded-lg px-4 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 transition-all font-mono">
156
- <div class="absolute right-3 top-2 text-xs text-slate-500">ms</div>
157
- </div>
158
- </div>
159
-
160
- <!-- Regex Pattern -->
161
- <div>
162
- <label class="block text-xs font-medium text-slate-400 mb-1">Patrón Regex (URL)</label>
163
- <input type="text" id="regexInput" value="https?://[^\s]+"
164
  class="w-full bg-slate-900/50 border border-slate-700 rounded-lg px-4 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 transition-all font-mono">
165
- </div>
166
 
167
- <!-- Action Mode -->
168
- <div>
169
- <label class="block text-xs font-medium text-slate-400 mb-2">Acción al Detectar</label>
170
- <div class="grid grid-cols-3 gap-2">
171
- <button onclick="setAction('log')" id="btn-log" class="action-btn active ring-1 ring-cyan-500 bg-cyan-500/20 text-cyan-300 px-3 py-2 rounded-lg text-xs font-medium transition-all hover:bg-cyan-500/30">
172
  <i class="fa-solid fa-terminal mb-1 block"></i> Log
173
  </button>
174
- <button onclick="setAction('save')" id="btn-save" class="action-btn bg-slate-800 text-slate-400 px-3 py-2 rounded-lg text-xs font-medium transition-all hover:bg-slate-700 hover:text-white">
175
  <i class="fa-solid fa-file-arrow-down mb-1 block"></i> Guardar
176
  </button>
177
- <button onclick="setAction('open')" id="btn-open" class="action-btn bg-slate-800 text-slate-400 px-3 py-2 rounded-lg text-xs font-medium transition-all hover:bg-slate-700 hover:text-white">
178
  <i class="fa-solid fa-globe mb-1 block"></i> Abrir
179
  </button>
180
- </div>
181
- </div>
182
-
183
- <!-- Custom Action Code (Hidden by default or context aware) -->
184
- <div id="customActionContainer" class="hidden">
185
- <label class="block text-xs font-medium text-slate-400 mb-1">Comando Personalizado</label>
186
- <textarea id="customCode" rows="2" class="w-full bg-slate-900/50 border border-slate-700 rounded-lg px-4 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500"></textarea>
187
- </div>
188
-
189
- <button onclick="generateScript()" class="w-full bg-gradient-to-r from-cyan-500 to-blue-600 hover:from-cyan-400 hover:to-blue-500 text-white font-bold py-3 rounded-xl shadow-lg shadow-cyan-500/25 transition-all transform hover:scale-[1.02] active:scale-[0.98] flex items-center justify-center gap-2">
190
- <i class="fa-solid fa-rotate"></i> Generar Script
191
- </button>
192
- </div>
193
  </div>
 
194
 
195
- <!-- Installation Instructions -->
196
- <div class="glass-panel rounded-2xl p-6">
197
- <h3 class="text-sm font-semibold text-white mb-3">Requisitos</h3>
198
- <div class="bg-slate-950 rounded-lg p-3 font-mono text-xs text-slate-300 border border-slate-800 mb-2 relative group">
199
- <span class="text-purple-400">npm</span> install clipboardy
200
- <button onclick="copyToClipboard('npm install clipboardy')" class="absolute right-2 top-2 text-slate-500 hover:text-white transition-colors">
201
- <i class="fa-regular fa-copy"></i>
202
- </button>
203
- </div>
204
- <p class="text-xs text-slate-500">
205
- Ejecuta este comando en tu directorio de proyecto antes de correr el script.
206
- </p>
207
- </div>
208
 
 
 
 
209
  </div>
210
-
211
- <!-- Right Column: Code Preview & Simulation -->
212
- <div class="lg:col-span-7 space-y-6">
213
-
214
- <!-- Code Editor Window -->
215
- <div class="glass-panel rounded-2xl overflow-hidden flex flex-col h-[400px] lg:h-[500px]">
216
- <div class="bg-slate-900/80 px-4 py-2 border-b border-slate-700 flex items-center justify-between">
217
- <div class="flex items-center gap-2">
218
- <div class="flex gap-1.5">
219
- <div class="w-3 h-3 rounded-full bg-red-500"></div>
220
- <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
221
- <div class="w-3 h-3 rounded-full bg-green-500"></div>
222
- </div>
223
- <span class="ml-3 text-xs text-slate-400 font-mono">interceptor.js</span>
224
- </div>
225
- <button onclick="downloadScript()" class="text-xs bg-slate-800 hover:bg-slate-700 text-white px-3 py-1 rounded border border-slate-600 transition-colors flex items-center gap-2">
226
- <i class="fa-solid fa-download"></i> Descargar .js
227
  </button>
228
- </div>
229
- <div class="flex-grow relative bg-[#0d1117] overflow-auto">
230
- <pre class="p-4 text-sm font-mono leading-relaxed"><code id="codeDisplay" class="language-javascript text-slate-300"></code></pre>
231
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
- <!-- Live Simulation -->
235
- <div class="glass-panel rounded-2xl p-6 border-t-4 border-t-cyan-500">
236
- <div class="flex items-center justify-between mb-4">
237
- <h2 class="text-lg font-semibold text-white flex items-center gap-2">
238
- <i class="fa-solid fa-vial text-cyan-400"></i> Simulador en Vivo
239
- </h2>
240
- <div class="flex items-center gap-2">
241
- <div id="statusIndicator" class="w-2 h-2 rounded-full bg-slate-500"></div>
242
- <span id="statusText" class="text-xs text-slate-400 font-mono">DETENIDO</span>
243
- </div>
244
- </div>
245
-
246
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
247
- <!-- Controls -->
248
- <div class="space-y-3">
249
- <p class="text-xs text-slate-400 mb-2">Simula copiar una URL al portapapeles:</p>
250
- <div class="flex gap-2">
251
- <input type="text" id="simInput" placeholder="https://ejemplo.com"
252
  class="flex-grow bg-slate-900/50 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white focus:border-cyan-500 focus:outline-none font-mono">
253
- <button onclick="simulateCopy()" class="bg-cyan-600 hover:bg-cyan-500 text-white px-4 py-2 rounded-lg transition-colors">
254
  <i class="fa-solid fa-copy"></i>
255
  </button>
256
- </div>
257
- <div class="flex gap-2 mt-2">
258
- <button onclick="startSimulation()" id="btnStart" class="flex-1 bg-green-600/20 text-green-400 border border-green-600/50 hover:bg-green-600/30 py-2 rounded-lg text-xs font-bold transition-all">
259
  INICIAR
260
  </button>
261
- <button onclick="stopSimulation()" id="btnStop" class="flex-1 bg-red-600/20 text-red-400 border border-red-600/50 hover:bg-red-600/30 py-2 rounded-lg text-xs font-bold transition-all opacity-50 cursor-not-allowed" disabled>
262
  DETENER
263
  </button>
264
- </div>
265
- </div>
266
-
267
- <!-- Console Output -->
268
- <div class="bg-black rounded-lg p-3 font-mono text-xs h-40 overflow-y-auto border border-slate-800 shadow-inner" id="consoleOutput">
269
- <div class="text-slate-500 italic">// Terminal lista...</div>
270
- </div>
271
- </div>
272
  </div>
273
-
 
 
 
 
 
 
 
274
  </div>
275
- </main>
276
 
277
- <!-- Footer -->
278
- <footer class="border-t border-slate-800 mt-auto py-6 bg-slate-900/50">
279
- <div class="container mx-auto px-4 text-center text-slate-500 text-xs">
280
- <p>Generado para Node.js • Usa librería <code>clipboardy</code></p>
281
- </div>
282
- </footer>
283
 
284
- <script>
285
- // --- State Management ---
 
 
 
 
 
 
 
286
  let currentAction = 'log';
287
  let isSimulating = false;
288
  let simInterval = null;
289
  let lastSimClipboard = "";
 
290
 
291
  // --- Template Logic ---
292
- const scriptTemplate = (config) => {
293
- const { interval, regex, action, customCode } = config;
294
 
295
  let actionLogic = '';
296
- let imports = "const clipboardy = require('clipboardy');\n";
297
  let extraVars = '';
298
 
 
 
 
 
 
 
 
299
  if (action === 'log') {
300
  actionLogic = `
301
  console.log('\\x1b[36m[URL Detectada]\\x1b[0m', url);`;
302
  } else if (action === 'save') {
303
- imports += "const fs = require('fs');\n";
 
 
 
 
304
  extraVars = `const FILE_PATH = './captured_urls.txt';\n`;
305
  actionLogic = `
306
  fs.appendFileSync(FILE_PATH, url + '\\n');
307
  console.log('\\x1b[32m[Guardado]\\x1b[0m URL añadida a', FILE_PATH);`;
308
  } else if (action === 'open') {
309
- imports += "const { exec } = require('child_process');\n";
 
 
 
 
310
  actionLogic = `
311
  console.log('\\x1b[33m[Abriendo]\\x1b[0m Navegador...');
312
  exec(\`start \${url}\`); // Windows
@@ -346,6 +403,24 @@ setInterval(async () => {
346
 
347
  // --- UI Logic ---
348
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  function setAction(action) {
350
  currentAction = action;
351
 
@@ -379,25 +454,24 @@ setInterval(async () => {
379
  interval,
380
  regex,
381
  action: currentAction,
382
- customCode
 
383
  };
384
 
385
- const code = scriptTemplate(config);
386
 
387
- // Simple syntax highlighting (optional, keeping it raw for copy-paste reliability but styled)
388
  const codeBlock = document.getElementById('codeDisplay');
389
  codeBlock.textContent = code;
390
-
391
- // Re-highlight if we had a complex highlighter, but textContent is safer for copy-paste
392
  }
393
 
394
  function downloadScript() {
395
  const code = document.getElementById('codeDisplay').textContent;
 
396
  const blob = new Blob([code], { type: 'text/javascript' });
397
  const url = URL.createObjectURL(blob);
398
  const a = document.createElement('a');
399
  a.href = url;
400
- a.download = 'interceptor.js';
401
  document.body.appendChild(a);
402
  a.click();
403
  document.body.removeChild(a);
@@ -446,13 +520,8 @@ setInterval(async () => {
446
  document.getElementById('statusText').classList.add('text-green-400');
447
 
448
  logToConsole('Iniciando servicio de monitoreo...', 'warn');
 
449
  logToConsole(`Intervalo configurado: ${document.getElementById('intervalInput').value}ms`, 'info');
450
-
451
- // Simulation Loop
452
- const intervalTime = parseInt(document.getElementById('intervalInput').value);
453
-
454
- // We don't use setInterval for the logic itself, we just check when the user clicks "Copy"
455
- // But we simulate the "Running" state.
456
  }
457
 
458
  function stopSimulation() {
@@ -531,6 +600,7 @@ setInterval(async () => {
531
  });
532
  });
533
 
534
- </script>
535
  </body>
 
536
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="es">
3
+
4
  <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Node URL Interceptor Script</title>
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
10
+ <link
11
+ href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@300;400;600;800&display=swap"
12
+ rel="stylesheet">
13
+ <script>
14
+ tailwind.config = {
15
  theme: {
16
  extend: {
17
  fontFamily: {
 
46
  }
47
  }
48
  }
49
+ </script>
50
+ <style>
51
+ body {
52
+ background-color: #0f172a;
53
+ background-image:
54
+ radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
55
+ radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.1) 0px, transparent 50%),
56
+ radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
57
+ radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
58
+ background-attachment: fixed;
59
+ color: #e2e8f0;
60
+ }
 
 
 
 
 
 
 
61
 
62
+ .glass-panel {
63
+ background: rgba(30, 41, 59, 0.7);
64
+ backdrop-filter: blur(12px);
65
+ border: 1px solid rgba(255, 255, 255, 0.1);
66
+ box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
67
+ }
 
68
 
69
+ .code-block {
70
+ background: #0d1117;
71
+ border: 1px solid #30363d;
72
+ border-radius: 0.5rem;
73
+ position: relative;
74
+ overflow: hidden;
75
+ }
 
 
 
 
 
 
 
 
76
 
77
+ /* Custom Scrollbar */
78
+ ::-webkit-scrollbar {
79
+ width: 8px;
80
+ height: 8px;
81
+ }
82
 
83
+ ::-webkit-scrollbar-track {
84
+ background: #0f172a;
85
+ }
86
+
87
+ ::-webkit-scrollbar-thumb {
88
+ background: #334155;
89
+ border-radius: 4px;
90
+ }
91
+
92
+ ::-webkit-scrollbar-thumb:hover {
93
+ background: #475569;
94
+ }
95
+
96
+ .glow-text {
97
+ text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
98
+ }
99
+
100
+ .terminal-line {
101
+ opacity: 0;
102
+ animation: fadeIn 0.3s forwards;
103
+ }
104
+
105
+ @keyframes fadeIn {
106
+ to {
107
+ opacity: 1;
108
+ }
109
+ }
110
+
111
+ .toggle-checkbox:checked {
112
+ right: 0;
113
+ border-color: #38bdf8;
114
+ }
115
+ .toggle-checkbox:checked + .toggle-label {
116
+ background-color: #38bdf8;
117
+ }
118
+ </style>
119
  </head>
120
+
121
  <body class="min-h-screen flex flex-col">
122
 
123
+ <!-- Navbar -->
124
+ <nav class="glass-panel border-b border-white/10 sticky top-0 z-50">
125
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
126
+ <div class="flex items-center justify-between h-16">
127
+ <div class="flex items-center gap-3">
128
+ <div
129
+ class="w-8 h-8 rounded bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center shadow-lg shadow-cyan-500/20">
130
+ <i class="fa-solid fa-link text-white text-sm"></i>
131
+ </div>
132
+ <span class="font-bold text-xl tracking-tight text-white">Clip<span class="text-cyan-400">Snatch</span></span>
 
 
 
 
 
133
  </div>
134
+ <div class="flex items-center gap-4">
135
+ <span class="text-xs font-mono text-slate-400 bg-slate-800 px-2 py-1 rounded border border-slate-700">v2.0.0</span>
136
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank"
137
+ class="text-xs text-slate-400 hover:text-cyan-400 transition-colors">Built with anycoder</a>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </nav>
142
+
143
+ <!-- Main Content -->
144
+ <main class="flex-grow container mx-auto px-4 py-8 grid grid-cols-1 lg:grid-cols-12 gap-8">
145
+
146
+ <!-- Left Column: Configuration & Code -->
147
+ <div class="lg:col-span-5 space-y-6">
148
+
149
+ <!-- Intro Card -->
150
+ <div class="glass-panel rounded-2xl p-6 animate-float">
151
+ <h1 class="text-2xl font-bold text-white mb-2 glow-text">Interceptor de URLs</h1>
152
+ <p class="text-slate-400 text-sm mb-4">
153
+ Genera un script de Node.js que monitorea el portapapeles en tiempo real.
154
+ Detecta automáticamente URLs y ejecuta acciones personalizadas.
155
+ Ahora compatible con <span class="text-cyan-400 font-semibold">ES Modules</span>.
156
+ </p>
157
+ <div class="flex gap-2">
158
+ <span class="px-2 py-1 rounded bg-blue-500/10 text-blue-400 text-xs border border-blue-500/20">Node.js</span>
159
+ <span class="px-2 py-1 rounded bg-yellow-500/10 text-yellow-400 text-xs border border-yellow-500/20">ESM</span>
160
+ <span class="px-2 py-1 rounded bg-purple-500/10 text-purple-400 text-xs border border-purple-500/20">Clipboard</span>
161
+ <span class="px-2 py-1 rounded bg-green-500/10 text-green-400 text-xs border border-green-500/20">Automation</span>
162
+ </div>
163
+ </div>
164
+
165
+ <!-- Configuration Form -->
166
+ <div class="glass-panel rounded-2xl p-6">
167
+ <h2 class="text-lg font-semibold text-white mb-4 flex items-center gap-2">
168
+ <i class="fa-solid fa-sliders text-cyan-400"></i> Configuración
169
+ </h2>
170
+
171
+ <div class="space-y-4">
172
+ <!-- Module Type Toggle -->
173
+ <div class="flex items-center justify-between p-3 bg-slate-900/50 rounded-lg border border-slate-700">
174
+ <div>
175
+ <label class="block text-sm font-medium text-white">Tipo de Módulo</label>
176
+ <p class="text-xs text-slate-400">ESM (.mjs) recomendado para proyectos modernos</p>
177
  </div>
178
+ <div class="relative inline-block w-12 mr-2 align-middle select-none transition duration-200 ease-in">
179
+ <input type="checkbox" name="toggle" id="moduleToggle" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer transition-all duration-300 ease-in-out right-6 checked:right-0 checked:border-cyan-500" checked onchange="toggleModuleType()">
180
+ <label for="moduleToggle" class="toggle-label block overflow-hidden h-6 rounded-full bg-slate-700 cursor-pointer transition-colors duration-300 ease-in-out"></label>
181
+ </div>
182
+ </div>
183
+ <div id="moduleTypeDisplay" class="text-xs font-mono text-cyan-400 bg-cyan-500/10 px-2 py-1 rounded border border-cyan-500/20">
184
+ <i class="fa-solid fa-check-circle mr-1"></i> ES Modules (import/export)
185
+ </div>
186
+
187
+ <!-- Check Interval -->
188
+ <div>
189
+ <label class="block text-xs font-medium text-slate-400 mb-1">Intervalo de Escaneo (ms)</label>
190
+ <div class="relative">
191
+ <input type="number" id="intervalInput" value="1000" min="500" step="100"
192
  class="w-full bg-slate-900/50 border border-slate-700 rounded-lg px-4 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 transition-all font-mono">
193
+ <div class="absolute right-3 top-2 text-xs text-slate-500">ms</div>
194
+ </div>
195
+ </div>
196
+
197
+ <!-- Regex Pattern -->
198
+ <div>
199
+ <label class="block text-xs font-medium text-slate-400 mb-1">Patrón Regex (URL)</label>
200
+ <input type="text" id="regexInput" value="https?://[^\s]+"
201
  class="w-full bg-slate-900/50 border border-slate-700 rounded-lg px-4 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 transition-all font-mono">
202
+ </div>
203
 
204
+ <!-- Action Mode -->
205
+ <div>
206
+ <label class="block text-xs font-medium text-slate-400 mb-2">Acción al Detectar</label>
207
+ <div class="grid grid-cols-3 gap-2">
208
+ <button onclick="setAction('log')" id="btn-log" class="action-btn active ring-1 ring-cyan-500 bg-cyan-500/20 text-cyan-300 px-3 py-2 rounded-lg text-xs font-medium transition-all hover:bg-cyan-500/30">
209
  <i class="fa-solid fa-terminal mb-1 block"></i> Log
210
  </button>
211
+ <button onclick="setAction('save')" id="btn-save" class="action-btn bg-slate-800 text-slate-400 px-3 py-2 rounded-lg text-xs font-medium transition-all hover:bg-slate-700 hover:text-white">
212
  <i class="fa-solid fa-file-arrow-down mb-1 block"></i> Guardar
213
  </button>
214
+ <button onclick="setAction('open')" id="btn-open" class="action-btn bg-slate-800 text-slate-400 px-3 py-2 rounded-lg text-xs font-medium transition-all hover:bg-slate-700 hover:text-white">
215
  <i class="fa-solid fa-globe mb-1 block"></i> Abrir
216
  </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  </div>
218
+ </div>
219
 
220
+ <!-- Custom Action Code (Hidden by default or context aware) -->
221
+ <div id="customActionContainer" class="hidden">
222
+ <label class="block text-xs font-medium text-slate-400 mb-1">Comando Personalizado</label>
223
+ <textarea id="customCode" rows="2" class="w-full bg-slate-900/50 border border-slate-700 rounded-lg px-4 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500"></textarea>
224
+ </div>
 
 
 
 
 
 
 
 
225
 
226
+ <button onclick="generateScript()" class="w-full bg-gradient-to-r from-cyan-500 to-blue-600 hover:from-cyan-400 hover:to-blue-500 text-white font-bold py-3 rounded-xl shadow-lg shadow-cyan-500/25 transition-all transform hover:scale-[1.02] active:scale-[0.98] flex items-center justify-center gap-2">
227
+ <i class="fa-solid fa-rotate"></i> Generar Script
228
+ </button>
229
  </div>
230
+ </div>
231
+
232
+ <!-- Installation Instructions -->
233
+ <div class="glass-panel rounded-2xl p-6">
234
+ <h3 class="text-sm font-semibold text-white mb-3">Requisitos</h3>
235
+ <div
236
+ class="bg-slate-950 rounded-lg p-3 font-mono text-xs text-slate-300 border border-slate-800 mb-2 relative group">
237
+ <span class="text-purple-400">npm</span> install clipboardy
238
+ <button onclick="copyToClipboard('npm install clipboardy')" class="absolute right-2 top-2 text-slate-500 hover:text-white transition-colors">
239
+ <i class="fa-regular fa-copy"></i>
 
 
 
 
 
 
 
240
  </button>
241
+ </div>
242
+ <p class="text-xs text-slate-500">
243
+ Para ES Modules, asegúrate de tener <code>"type": "module"</code> en tu package.json o usa extensión .mjs
244
+ </p>
245
+ </div>
246
+
247
+ </div>
248
+
249
+ <!-- Right Column: Code Preview & Simulation -->
250
+ <div class="lg:col-span-7 space-y-6">
251
+
252
+ <!-- Code Editor Window -->
253
+ <div class="glass-panel rounded-2xl overflow-hidden flex flex-col h-[400px] lg:h-[500px]">
254
+ <div class="bg-slate-900/80 px-4 py-2 border-b border-slate-700 flex items-center justify-between">
255
+ <div class="flex items-center gap-2">
256
+ <div class="flex gap-1.5">
257
+ <div class="w-3 h-3 rounded-full bg-red-500"></div>
258
+ <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
259
+ <div class="w-3 h-3 rounded-full bg-green-500"></div>
260
  </div>
261
+ <span class="ml-3 text-xs text-slate-400 font-mono" id="filenameDisplay">interceptor.mjs</span>
262
+ </div>
263
+ <button onclick="downloadScript()" class="text-xs bg-slate-800 hover:bg-slate-700 text-white px-3 py-1 rounded border border-slate-600 transition-colors flex items-center gap-2">
264
+ <i class="fa-solid fa-download"></i> Descargar
265
+ </button>
266
+ </div>
267
+ <div class="flex-grow relative bg-[#0d1117] overflow-auto">
268
+ <pre
269
+ class="p-4 text-sm font-mono leading-relaxed"><code id="codeDisplay" class="language-javascript text-slate-300"></code></pre>
270
+ </div>
271
+ </div>
272
+
273
+ <!-- Live Simulation -->
274
+ <div class="glass-panel rounded-2xl p-6 border-t-4 border-t-cyan-500">
275
+ <div class="flex items-center justify-between mb-4">
276
+ <h2 class="text-lg font-semibold text-white flex items-center gap-2">
277
+ <i class="fa-solid fa-vial text-cyan-400"></i> Simulador en Vivo
278
+ </h2>
279
+ <div class="flex items-center gap-2">
280
+ <div id="statusIndicator" class="w-2 h-2 rounded-full bg-slate-500"></div>
281
+ <span id="statusText" class="text-xs text-slate-400 font-mono">DETENIDO</span>
282
+ </div>
283
+ </div>
284
 
285
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
286
+ <!-- Controls -->
287
+ <div class="space-y-3">
288
+ <p class="text-xs text-slate-400 mb-2">Simula copiar una URL al portapapeles:</p>
289
+ <div class="flex gap-2">
290
+ <input type="text" id="simInput" placeholder="https://ejemplo.com"
 
 
 
 
 
 
 
 
 
 
 
 
291
  class="flex-grow bg-slate-900/50 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white focus:border-cyan-500 focus:outline-none font-mono">
292
+ <button onclick="simulateCopy()" class="bg-cyan-600 hover:bg-cyan-500 text-white px-4 py-2 rounded-lg transition-colors">
293
  <i class="fa-solid fa-copy"></i>
294
  </button>
295
+ </div>
296
+ <div class="flex gap-2 mt-2">
297
+ <button onclick="startSimulation()" id="btnStart" class="flex-1 bg-green-600/20 text-green-400 border border-green-600/50 hover:bg-green-600/30 py-2 rounded-lg text-xs font-bold transition-all">
298
  INICIAR
299
  </button>
300
+ <button onclick="stopSimulation()" id="btnStop" class="flex-1 bg-red-600/20 text-red-400 border border-red-600/50 hover:bg-red-600/30 py-2 rounded-lg text-xs font-bold transition-all opacity-50 cursor-not-allowed" disabled>
301
  DETENER
302
  </button>
 
 
 
 
 
 
 
 
303
  </div>
304
+ </div>
305
+
306
+ <!-- Console Output -->
307
+ <div
308
+ class="bg-black rounded-lg p-3 font-mono text-xs h-40 overflow-y-auto border border-slate-800 shadow-inner"
309
+ id="consoleOutput">
310
+ <div class="text-slate-500 italic">// Terminal lista...</div>
311
+ </div>
312
  </div>
313
+ </div>
314
 
315
+ </div>
316
+ </main>
 
 
 
 
317
 
318
+ <!-- Footer -->
319
+ <footer class="border-t border-slate-800 mt-auto py-6 bg-slate-900/50">
320
+ <div class="container mx-auto px-4 text-center text-slate-500 text-xs">
321
+ <p>Generado para Node.js • Compatible con CommonJS y ES Modules</p>
322
+ </div>
323
+ </footer>
324
+
325
+ <script>
326
+ // --- State Management ---
327
  let currentAction = 'log';
328
  let isSimulating = false;
329
  let simInterval = null;
330
  let lastSimClipboard = "";
331
+ let isESM = true; // Default to ES Modules
332
 
333
  // --- Template Logic ---
334
+ const getScriptTemplate = (config) => {
335
+ const { interval, regex, action, customCode, esm } = config;
336
 
337
  let actionLogic = '';
338
+ let imports = '';
339
  let extraVars = '';
340
 
341
+ // Generate imports based on module type
342
+ if (esm) {
343
+ imports = `import clipboardy from 'clipboardy';\n`;
344
+ } else {
345
+ imports = `const clipboardy = require('clipboardy');\n`;
346
+ }
347
+
348
  if (action === 'log') {
349
  actionLogic = `
350
  console.log('\\x1b[36m[URL Detectada]\\x1b[0m', url);`;
351
  } else if (action === 'save') {
352
+ if (esm) {
353
+ imports += `import fs from 'fs';\n`;
354
+ } else {
355
+ imports += `const fs = require('fs');\n`;
356
+ }
357
  extraVars = `const FILE_PATH = './captured_urls.txt';\n`;
358
  actionLogic = `
359
  fs.appendFileSync(FILE_PATH, url + '\\n');
360
  console.log('\\x1b[32m[Guardado]\\x1b[0m URL añadida a', FILE_PATH);`;
361
  } else if (action === 'open') {
362
+ if (esm) {
363
+ imports += `import { exec } from 'child_process';\n`;
364
+ } else {
365
+ imports += `const { exec } = require('child_process');\n`;
366
+ }
367
  actionLogic = `
368
  console.log('\\x1b[33m[Abriendo]\\x1b[0m Navegador...');
369
  exec(\`start \${url}\`); // Windows
 
403
 
404
  // --- UI Logic ---
405
 
406
+ function toggleModuleType() {
407
+ isESM = document.getElementById('moduleToggle').checked;
408
+ const display = document.getElementById('moduleTypeDisplay');
409
+ const filename = document.getElementById('filenameDisplay');
410
+
411
+ if (isESM) {
412
+ display.innerHTML = '<i class="fa-solid fa-check-circle mr-1"></i> ES Modules (import/export)';
413
+ display.className = 'text-xs font-mono text-cyan-400 bg-cyan-500/10 px-2 py-1 rounded border border-cyan-500/20';
414
+ filename.textContent = 'interceptor.mjs';
415
+ } else {
416
+ display.innerHTML = '<i class="fa-solid fa-circle mr-1"></i> CommonJS (require/module.exports)';
417
+ display.className = 'text-xs font-mono text-yellow-400 bg-yellow-500/10 px-2 py-1 rounded border border-yellow-500/20';
418
+ filename.textContent = 'interceptor.js';
419
+ }
420
+
421
+ generateScript();
422
+ }
423
+
424
  function setAction(action) {
425
  currentAction = action;
426
 
 
454
  interval,
455
  regex,
456
  action: currentAction,
457
+ customCode,
458
+ esm: isESM
459
  };
460
 
461
+ const code = getScriptTemplate(config);
462
 
 
463
  const codeBlock = document.getElementById('codeDisplay');
464
  codeBlock.textContent = code;
 
 
465
  }
466
 
467
  function downloadScript() {
468
  const code = document.getElementById('codeDisplay').textContent;
469
+ const extension = isESM ? 'mjs' : 'js';
470
  const blob = new Blob([code], { type: 'text/javascript' });
471
  const url = URL.createObjectURL(blob);
472
  const a = document.createElement('a');
473
  a.href = url;
474
+ a.download = `interceptor.${extension}`;
475
  document.body.appendChild(a);
476
  a.click();
477
  document.body.removeChild(a);
 
520
  document.getElementById('statusText').classList.add('text-green-400');
521
 
522
  logToConsole('Iniciando servicio de monitoreo...', 'warn');
523
+ logToConsole(`Modulo: ${isESM ? 'ESM' : 'CommonJS'}`, 'info');
524
  logToConsole(`Intervalo configurado: ${document.getElementById('intervalInput').value}ms`, 'info');
 
 
 
 
 
 
525
  }
526
 
527
  function stopSimulation() {
 
600
  });
601
  });
602
 
603
+ </script>
604
  </body>
605
+
606
  </html>