Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +453 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: parser-2
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,453 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Text Parser & Clipboard Utility</title>
|
| 7 |
+
<style>
|
| 8 |
+
* {
|
| 9 |
+
box-sizing: border-box;
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
body {
|
| 15 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 16 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 17 |
+
min-height: 100vh;
|
| 18 |
+
display: flex;
|
| 19 |
+
justify-content: center;
|
| 20 |
+
align-items: center;
|
| 21 |
+
padding: 20px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.container {
|
| 25 |
+
background: white;
|
| 26 |
+
border-radius: 16px;
|
| 27 |
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
|
| 28 |
+
padding: 40px;
|
| 29 |
+
width: 100%;
|
| 30 |
+
max-width: 800px;
|
| 31 |
+
backdrop-filter: blur(10px);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
h1 {
|
| 35 |
+
text-align: center;
|
| 36 |
+
color: #333;
|
| 37 |
+
margin-bottom: 30px;
|
| 38 |
+
font-size: 2.2rem;
|
| 39 |
+
font-weight: 600;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.input-section {
|
| 43 |
+
margin-bottom: 30px;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.input-label {
|
| 47 |
+
display: block;
|
| 48 |
+
margin-bottom: 10px;
|
| 49 |
+
color: #555;
|
| 50 |
+
font-weight: 500;
|
| 51 |
+
font-size: 1.1rem;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
#textInput {
|
| 55 |
+
width: 100%;
|
| 56 |
+
height: 200px;
|
| 57 |
+
padding: 15px;
|
| 58 |
+
border: 2px solid #e1e5e9;
|
| 59 |
+
border-radius: 10px;
|
| 60 |
+
font-family: 'Courier New', monospace;
|
| 61 |
+
font-size: 14px;
|
| 62 |
+
line-height: 1.5;
|
| 63 |
+
resize: vertical;
|
| 64 |
+
transition: border-color 0.3s ease;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
#textInput:focus {
|
| 68 |
+
outline: none;
|
| 69 |
+
border-color: #667eea;
|
| 70 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.controls {
|
| 74 |
+
display: flex;
|
| 75 |
+
gap: 15px;
|
| 76 |
+
align-items: center;
|
| 77 |
+
margin-bottom: 20px;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
#nextButton {
|
| 81 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 82 |
+
color: white;
|
| 83 |
+
border: none;
|
| 84 |
+
padding: 12px 30px;
|
| 85 |
+
border-radius: 8px;
|
| 86 |
+
font-size: 16px;
|
| 87 |
+
font-weight: 600;
|
| 88 |
+
cursor: pointer;
|
| 89 |
+
transition: all 0.3s ease;
|
| 90 |
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
#nextButton:hover:not(:disabled) {
|
| 94 |
+
transform: translateY(-2px);
|
| 95 |
+
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
#nextButton:active:not(:disabled) {
|
| 99 |
+
transform: translateY(0);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
#nextButton:disabled {
|
| 103 |
+
background: #ccc;
|
| 104 |
+
cursor: not-allowed;
|
| 105 |
+
box-shadow: none;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
#resetButton {
|
| 109 |
+
background: #f8f9fa;
|
| 110 |
+
color: #666;
|
| 111 |
+
border: 2px solid #e1e5e9;
|
| 112 |
+
padding: 12px 20px;
|
| 113 |
+
border-radius: 8px;
|
| 114 |
+
font-size: 16px;
|
| 115 |
+
font-weight: 500;
|
| 116 |
+
cursor: pointer;
|
| 117 |
+
transition: all 0.3s ease;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
#resetButton:hover {
|
| 121 |
+
background: #e9ecef;
|
| 122 |
+
border-color: #adb5bd;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.status {
|
| 126 |
+
display: flex;
|
| 127 |
+
align-items: center;
|
| 128 |
+
gap: 10px;
|
| 129 |
+
margin-bottom: 20px;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.status-text {
|
| 133 |
+
font-size: 16px;
|
| 134 |
+
font-weight: 500;
|
| 135 |
+
padding: 8px 16px;
|
| 136 |
+
border-radius: 6px;
|
| 137 |
+
transition: all 0.3s ease;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.status-ready {
|
| 141 |
+
background: #e3f2fd;
|
| 142 |
+
color: #1976d2;
|
| 143 |
+
border: 1px solid #bbdefb;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.status-copying {
|
| 147 |
+
background: #e8f5e8;
|
| 148 |
+
color: #2e7d32;
|
| 149 |
+
border: 1px solid #c8e6c9;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.status-complete {
|
| 153 |
+
background: #fff3e0;
|
| 154 |
+
color: #f57c00;
|
| 155 |
+
border: 1px solid #ffcc02;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.status-error {
|
| 159 |
+
background: #ffebee;
|
| 160 |
+
color: #d32f2f;
|
| 161 |
+
border: 1px solid #ffcdd2;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.preview-section {
|
| 165 |
+
margin-top: 20px;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
.preview-label {
|
| 169 |
+
display: block;
|
| 170 |
+
margin-bottom: 10px;
|
| 171 |
+
color: #555;
|
| 172 |
+
font-weight: 500;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
#textPreview {
|
| 176 |
+
background: #f8f9fa;
|
| 177 |
+
border: 1px solid #e1e5e9;
|
| 178 |
+
border-radius: 8px;
|
| 179 |
+
padding: 15px;
|
| 180 |
+
max-height: 100px;
|
| 181 |
+
overflow-y: auto;
|
| 182 |
+
font-family: 'Courier New', monospace;
|
| 183 |
+
font-size: 14px;
|
| 184 |
+
line-height: 1.5;
|
| 185 |
+
white-space: pre-wrap;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.line-number {
|
| 189 |
+
color: #666;
|
| 190 |
+
margin-right: 10px;
|
| 191 |
+
user-select: none;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.current-line {
|
| 195 |
+
background: #fff3cd;
|
| 196 |
+
border-left: 4px solid #ffc107;
|
| 197 |
+
margin: -2px -15px;
|
| 198 |
+
padding: 2px 15px;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.copied-line {
|
| 202 |
+
background: #d4edda;
|
| 203 |
+
border-left: 4px solid #28a745;
|
| 204 |
+
margin: -2px -15px;
|
| 205 |
+
padding: 2px 15px;
|
| 206 |
+
opacity: 0.7;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
.info-section {
|
| 210 |
+
margin-top: 20px;
|
| 211 |
+
padding: 15px;
|
| 212 |
+
background: #f8f9fa;
|
| 213 |
+
border-radius: 8px;
|
| 214 |
+
border-left: 4px solid #17a2b8;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
.info-section h3 {
|
| 218 |
+
color: #17a2b8;
|
| 219 |
+
margin-bottom: 10px;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
.info-section p {
|
| 223 |
+
color: #666;
|
| 224 |
+
line-height: 1.5;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
@media (max-width: 768px) {
|
| 228 |
+
.container {
|
| 229 |
+
padding: 20px;
|
| 230 |
+
margin: 10px;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
h1 {
|
| 234 |
+
font-size: 1.8rem;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
.controls {
|
| 238 |
+
flex-direction: column;
|
| 239 |
+
align-items: stretch;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
#nextButton, #resetButton {
|
| 243 |
+
width: 100%;
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
</style>
|
| 247 |
+
</head>
|
| 248 |
+
<body>
|
| 249 |
+
<div class="container">
|
| 250 |
+
<h1>📋 Text Parser & Clipboard Utility</h1>
|
| 251 |
+
|
| 252 |
+
<div class="input-section">
|
| 253 |
+
<label for="textInput" class="input-label">Paste your text here:</label>
|
| 254 |
+
<textarea id="textInput" placeholder="Paste your multi-line text here. Each non-empty line will be copied individually when you click 'Next'."></textarea>
|
| 255 |
+
</div>
|
| 256 |
+
|
| 257 |
+
<div class="controls">
|
| 258 |
+
<button id="nextButton" disabled>Next</button>
|
| 259 |
+
<button id="resetButton">Reset</button>
|
| 260 |
+
<div class="status">
|
| 261 |
+
<span id="statusText" class="status-text status-ready">Ready - Paste text to begin</span>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
|
| 265 |
+
<div class="preview-section">
|
| 266 |
+
<label class="preview-label">Text Preview:</label>
|
| 267 |
+
<div id="textPreview">No text loaded</div>
|
| 268 |
+
</div>
|
| 269 |
+
|
| 270 |
+
<div class="info-section">
|
| 271 |
+
<h3>📝 Instructions</h3>
|
| 272 |
+
<p>
|
| 273 |
+
1. Paste your text in the textarea above<br>
|
| 274 |
+
2. Click "Next" to copy each line to your clipboard sequentially<br>
|
| 275 |
+
3. Empty lines are automatically skipped<br>
|
| 276 |
+
4. Use "Reset" to start over with the same text<br>
|
| 277 |
+
<strong>Note:</strong> This tool requires HTTPS or localhost for clipboard access.
|
| 278 |
+
</p>
|
| 279 |
+
</div>
|
| 280 |
+
</div>
|
| 281 |
+
|
| 282 |
+
<script>
|
| 283 |
+
class TextParserClipboard {
|
| 284 |
+
constructor() {
|
| 285 |
+
this.lines = [];
|
| 286 |
+
this.currentIndex = 0;
|
| 287 |
+
this.isProcessing = false;
|
| 288 |
+
|
| 289 |
+
// Get DOM elements
|
| 290 |
+
this.textInput = document.getElementById('textInput');
|
| 291 |
+
this.nextButton = document.getElementById('nextButton');
|
| 292 |
+
this.resetButton = document.getElementById('resetButton');
|
| 293 |
+
this.statusText = document.getElementById('statusText');
|
| 294 |
+
this.textPreview = document.getElementById('textPreview');
|
| 295 |
+
|
| 296 |
+
this.initializeEventListeners();
|
| 297 |
+
this.checkClipboardSupport();
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
initializeEventListeners() {
|
| 301 |
+
this.textInput.addEventListener('input', () => this.processText());
|
| 302 |
+
this.textInput.addEventListener('paste', () => {
|
| 303 |
+
// Small delay to allow paste content to be processed
|
| 304 |
+
setTimeout(() => this.processText(), 10);
|
| 305 |
+
});
|
| 306 |
+
|
| 307 |
+
this.nextButton.addEventListener('click', () => this.copyNextLine());
|
| 308 |
+
this.resetButton.addEventListener('click', () => this.reset());
|
| 309 |
+
|
| 310 |
+
// Handle keyboard shortcuts
|
| 311 |
+
document.addEventListener('keydown', (e) => {
|
| 312 |
+
if (e.ctrlKey || e.metaKey) {
|
| 313 |
+
if (e.key === 'Enter') {
|
| 314 |
+
e.preventDefault();
|
| 315 |
+
if (!this.nextButton.disabled) {
|
| 316 |
+
this.copyNextLine();
|
| 317 |
+
}
|
| 318 |
+
} else if (e.key === 'r') {
|
| 319 |
+
e.preventDefault();
|
| 320 |
+
this.reset();
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
});
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
checkClipboardSupport() {
|
| 327 |
+
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
| 328 |
+
this.updateStatus('Clipboard API not supported. Use HTTPS or localhost.', 'error');
|
| 329 |
+
this.nextButton.disabled = true;
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
processText() {
|
| 334 |
+
const text = this.textInput.value.trim();
|
| 335 |
+
|
| 336 |
+
if (!text) {
|
| 337 |
+
this.lines = [];
|
| 338 |
+
this.currentIndex = 0;
|
| 339 |
+
this.nextButton.disabled = true;
|
| 340 |
+
this.updateStatus('Ready - Paste text to begin', 'ready');
|
| 341 |
+
this.updatePreview();
|
| 342 |
+
return;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// Split text into lines and filter out empty lines
|
| 346 |
+
this.lines = text
|
| 347 |
+
.split('\n')
|
| 348 |
+
.map(line => line.trim())
|
| 349 |
+
.filter(line => line.length > 0);
|
| 350 |
+
|
| 351 |
+
this.currentIndex = 0;
|
| 352 |
+
this.nextButton.disabled = this.lines.length === 0;
|
| 353 |
+
|
| 354 |
+
if (this.lines.length === 0) {
|
| 355 |
+
this.updateStatus('No valid lines found', 'error');
|
| 356 |
+
} else {
|
| 357 |
+
this.updateStatus(`Ready - ${this.lines.length} lines loaded`, 'ready');
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
this.updatePreview();
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
async copyNextLine() {
|
| 364 |
+
if (this.currentIndex >= this.lines.length || this.isProcessing) {
|
| 365 |
+
return;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
this.isProcessing = true;
|
| 369 |
+
const lineText = this.lines[this.currentIndex];
|
| 370 |
+
|
| 371 |
+
try {
|
| 372 |
+
await navigator.clipboard.writeText(lineText);
|
| 373 |
+
|
| 374 |
+
this.currentIndex++;
|
| 375 |
+
this.updateStatus(`Copied line ${this.currentIndex}/${this.lines.length}`, 'copying');
|
| 376 |
+
|
| 377 |
+
if (this.currentIndex >= this.lines.length) {
|
| 378 |
+
this.nextButton.disabled = true;
|
| 379 |
+
this.updateStatus('All lines copied! Click Reset to start over.', 'complete');
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
this.updatePreview();
|
| 383 |
+
|
| 384 |
+
} catch (error) {
|
| 385 |
+
console.error('Failed to copy text:', error);
|
| 386 |
+
this.updateStatus('Failed to copy to clipboard', 'error');
|
| 387 |
+
} finally {
|
| 388 |
+
this.isProcessing = false;
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
reset() {
|
| 393 |
+
// Clear the textarea
|
| 394 |
+
this.textInput.value = '';
|
| 395 |
+
|
| 396 |
+
// Reset all variables
|
| 397 |
+
this.lines = [];
|
| 398 |
+
this.currentIndex = 0;
|
| 399 |
+
this.isProcessing = false;
|
| 400 |
+
|
| 401 |
+
// Reset UI state
|
| 402 |
+
this.nextButton.disabled = true;
|
| 403 |
+
this.updateStatus('Ready - Paste text to begin', 'ready');
|
| 404 |
+
this.updatePreview();
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
updateStatus(message, type) {
|
| 408 |
+
this.statusText.textContent = message;
|
| 409 |
+
this.statusText.className = `status-text status-${type}`;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
updatePreview() {
|
| 413 |
+
if (this.lines.length === 0) {
|
| 414 |
+
this.textPreview.textContent = 'No text loaded';
|
| 415 |
+
return;
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
const previewLines = this.lines.map((line, index) => {
|
| 419 |
+
const lineNumber = (index + 1).toString().padStart(2, '0');
|
| 420 |
+
let cssClass = '';
|
| 421 |
+
|
| 422 |
+
if (index < this.currentIndex) {
|
| 423 |
+
cssClass = 'copied-line';
|
| 424 |
+
} else if (index === this.currentIndex) {
|
| 425 |
+
cssClass = 'current-line';
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
return `<div class="${cssClass}"><span class="line-number">${lineNumber}:</span>${this.escapeHtml(line)}</div>`;
|
| 429 |
+
});
|
| 430 |
+
|
| 431 |
+
this.textPreview.innerHTML = previewLines.join('');
|
| 432 |
+
|
| 433 |
+
// Scroll current line into view
|
| 434 |
+
const currentElement = this.textPreview.querySelector('.current-line');
|
| 435 |
+
if (currentElement) {
|
| 436 |
+
currentElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
| 437 |
+
}
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
escapeHtml(text) {
|
| 441 |
+
const div = document.createElement('div');
|
| 442 |
+
div.textContent = text;
|
| 443 |
+
return div.innerHTML;
|
| 444 |
+
}
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
// Initialize the application when DOM is loaded
|
| 448 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 449 |
+
new TextParserClipboard();
|
| 450 |
+
});
|
| 451 |
+
</script>
|
| 452 |
+
</body>
|
| 453 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|