MarkTheArtist commited on
Commit
a0ff15d
·
verified ·
1 Parent(s): c65173b

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +250 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Clipboard Parser
3
- emoji: 📊
4
- colorFrom: blue
5
- colorTo: blue
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: clipboard-parser
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: red
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,250 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Line-by-Line Clipboard Parser</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .clipboard-display {
11
+ min-height: 150px;
12
+ transition: all 0.3s ease;
13
+ }
14
+ .progress-bar {
15
+ transition: width 0.3s ease;
16
+ }
17
+ .fade-in {
18
+ animation: fadeIn 0.5s;
19
+ }
20
+ @keyframes fadeIn {
21
+ from { opacity: 0; }
22
+ to { opacity: 1; }
23
+ }
24
+ </style>
25
+ </head>
26
+ <body class="bg-gray-100 min-h-screen flex items-center justify-center p-4">
27
+ <div class="w-full max-w-2xl bg-white rounded-xl shadow-lg overflow-hidden">
28
+ <div class="bg-indigo-600 p-6 text-white">
29
+ <div class="flex items-center justify-between">
30
+ <h1 class="text-2xl font-bold flex items-center">
31
+ <i class="fas fa-clipboard-list mr-3"></i>
32
+ Line-by-Line Clipboard Parser
33
+ </h1>
34
+ <div class="flex space-x-2">
35
+ <button id="resetBtn" class="bg-indigo-700 hover:bg-indigo-800 px-4 py-2 rounded-lg text-sm font-medium transition">
36
+ <i class="fas fa-redo mr-1"></i> Reset
37
+ </button>
38
+ </div>
39
+ </div>
40
+ <p class="mt-2 opacity-90">Paste your multi-line text and cycle through each line</p>
41
+ </div>
42
+
43
+ <div class="p-6">
44
+ <div class="mb-6">
45
+ <label for="pasteArea" class="block text-gray-700 font-medium mb-2">Paste your text here:</label>
46
+ <textarea id="pasteArea" rows="5" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Paste your multi-line content here..."></textarea>
47
+ <div class="flex justify-between mt-2">
48
+ <button id="parseBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-2 rounded-lg font-medium flex items-center transition disabled:opacity-50" disabled>
49
+ <i class="fas fa-play mr-2"></i> Start Parsing
50
+ </button>
51
+ <span id="lineCount" class="text-gray-500 text-sm self-center">0 lines detected</span>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="mb-6">
56
+ <div class="flex justify-between mb-2">
57
+ <span class="text-gray-700 font-medium">Current Clipboard:</span>
58
+ <span id="currentLineNum" class="text-indigo-600 font-medium">Line 0/0</span>
59
+ </div>
60
+ <div class="relative">
61
+ <div id="clipboardDisplay" class="clipboard-display bg-gray-50 border border-gray-300 rounded-lg p-4 text-gray-700 whitespace-pre-wrap fade-in">
62
+ <div class="absolute inset-0 flex items-center justify-center text-gray-400">
63
+ <i class="fas fa-clipboard text-4xl opacity-30"></i>
64
+ </div>
65
+ </div>
66
+ <button id="copyBtn" class="absolute top-2 right-2 bg-gray-200 hover:bg-gray-300 p-2 rounded-md text-gray-700 transition opacity-0 invisible">
67
+ <i class="fas fa-copy"></i>
68
+ </button>
69
+ </div>
70
+ <div class="mt-2 flex items-center">
71
+ <div class="w-full bg-gray-200 rounded-full h-2.5 mr-2">
72
+ <div id="progressBar" class="progress-bar bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
73
+ </div>
74
+ <span id="progressText" class="text-sm text-gray-500">0%</span>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="flex justify-between">
79
+ <button id="prevBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-lg font-medium flex items-center transition disabled:opacity-50" disabled>
80
+ <i class="fas fa-arrow-left mr-2"></i> Previous
81
+ </button>
82
+ <button id="nextBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-2 rounded-lg font-medium flex items-center transition disabled:opacity-50" disabled>
83
+ Next <i class="fas fa-arrow-right ml-2"></i>
84
+ </button>
85
+ </div>
86
+ </div>
87
+
88
+ <div class="bg-gray-50 px-6 py-4 border-t border-gray-200">
89
+ <div class="flex items-center text-sm text-gray-500">
90
+ <i class="fas fa-info-circle mr-2 text-indigo-500"></i>
91
+ <span>Click "Next" to copy the next line to clipboard</span>
92
+ </div>
93
+ </div>
94
+ </div>
95
+
96
+ <script>
97
+ document.addEventListener('DOMContentLoaded', function() {
98
+ const pasteArea = document.getElementById('pasteArea');
99
+ const parseBtn = document.getElementById('parseBtn');
100
+ const nextBtn = document.getElementById('nextBtn');
101
+ const prevBtn = document.getElementById('prevBtn');
102
+ const resetBtn = document.getElementById('resetBtn');
103
+ const copyBtn = document.getElementById('copyBtn');
104
+ const clipboardDisplay = document.getElementById('clipboardDisplay');
105
+ const lineCount = document.getElementById('lineCount');
106
+ const currentLineNum = document.getElementById('currentLineNum');
107
+ const progressBar = document.getElementById('progressBar');
108
+ const progressText = document.getElementById('progressText');
109
+
110
+ let lines = [];
111
+ let currentLineIndex = -1;
112
+
113
+ // Update button states based on textarea content
114
+ pasteArea.addEventListener('input', function() {
115
+ const text = pasteArea.value.trim();
116
+ parseBtn.disabled = text.length === 0;
117
+
118
+ // Count lines for display
119
+ const tempLines = text.split('\n').filter(line => line.trim() !== '');
120
+ lineCount.textContent = `${tempLines.length} line${tempLines.length !== 1 ? 's' : ''} detected`;
121
+ });
122
+
123
+ // Parse button click handler
124
+ parseBtn.addEventListener('click', function() {
125
+ const text = pasteArea.value;
126
+ lines = text.split('\n').filter(line => line.trim() !== '');
127
+
128
+ if (lines.length > 0) {
129
+ currentLineIndex = -1;
130
+ updateUI();
131
+ nextBtn.disabled = false;
132
+ parseBtn.disabled = true;
133
+ pasteArea.disabled = true;
134
+
135
+ // Show success message
136
+ showToast('Text parsed successfully!', 'success');
137
+ }
138
+ });
139
+
140
+ // Next button click handler
141
+ nextBtn.addEventListener('click', function() {
142
+ if (currentLineIndex < lines.length - 1) {
143
+ currentLineIndex++;
144
+ copyToClipboard(lines[currentLineIndex]);
145
+ updateUI();
146
+ prevBtn.disabled = currentLineIndex <= 0;
147
+
148
+ // Show feedback
149
+ showToast('Copied to clipboard!', 'success');
150
+ }
151
+
152
+ if (currentLineIndex >= lines.length - 1) {
153
+ nextBtn.disabled = true;
154
+ }
155
+ });
156
+
157
+ // Previous button click handler
158
+ prevBtn.addEventListener('click', function() {
159
+ if (currentLineIndex > 0) {
160
+ currentLineIndex--;
161
+ copyToClipboard(lines[currentLineIndex]);
162
+ updateUI();
163
+ nextBtn.disabled = false;
164
+
165
+ // Show feedback
166
+ showToast('Copied to clipboard!', 'success');
167
+ }
168
+
169
+ if (currentLineIndex <= 0) {
170
+ prevBtn.disabled = true;
171
+ }
172
+ });
173
+
174
+ // Reset button click handler
175
+ resetBtn.addEventListener('click', function() {
176
+ pasteArea.value = '';
177
+ lines = [];
178
+ currentLineIndex = -1;
179
+ parseBtn.disabled = true;
180
+ nextBtn.disabled = true;
181
+ prevBtn.disabled = true;
182
+ pasteArea.disabled = false;
183
+ updateUI();
184
+ lineCount.textContent = '0 lines detected';
185
+
186
+ // Show feedback
187
+ showToast('Reset complete', 'info');
188
+ });
189
+
190
+ // Copy button click handler
191
+ copyBtn.addEventListener('click', function() {
192
+ if (currentLineIndex >= 0 && currentLineIndex < lines.length) {
193
+ copyToClipboard(lines[currentLineIndex]);
194
+ showToast('Copied again!', 'success');
195
+ }
196
+ });
197
+
198
+ // Update UI elements
199
+ function updateUI() {
200
+ if (currentLineIndex >= 0 && currentLineIndex < lines.length) {
201
+ clipboardDisplay.innerHTML = `<span class="text-indigo-600 font-medium">Line ${currentLineIndex + 1}:</span>\n${lines[currentLineIndex]}`;
202
+ clipboardDisplay.classList.remove('opacity-0');
203
+ copyBtn.classList.remove('opacity-0', 'invisible');
204
+ } else {
205
+ clipboardDisplay.innerHTML = '<div class="absolute inset-0 flex items-center justify-center text-gray-400"><i class="fas fa-clipboard text-4xl opacity-30"></i></div>';
206
+ clipboardDisplay.classList.add('opacity-0');
207
+ copyBtn.classList.add('opacity-0', 'invisible');
208
+ }
209
+
210
+ currentLineNum.textContent = `Line ${currentLineIndex + 1}/${lines.length}`;
211
+
212
+ // Update progress
213
+ const progress = lines.length > 0 ? ((currentLineIndex + 1) / lines.length) * 100 : 0;
214
+ progressBar.style.width = `${progress}%`;
215
+ progressText.textContent = `${Math.round(progress)}%`;
216
+ }
217
+
218
+ // Copy text to clipboard
219
+ function copyToClipboard(text) {
220
+ navigator.clipboard.writeText(text).then(function() {
221
+ console.log('Copying to clipboard was successful!');
222
+ }, function(err) {
223
+ console.error('Could not copy text: ', err);
224
+ showToast('Failed to copy to clipboard', 'error');
225
+ });
226
+ }
227
+
228
+ // Show toast notification
229
+ function showToast(message, type) {
230
+ const toast = document.createElement('div');
231
+ toast.className = `fixed bottom-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white font-medium flex items-center ${type === 'success' ? 'bg-green-500' : type === 'error' ? 'bg-red-500' : 'bg-blue-500'} animate-bounce`;
232
+ toast.innerHTML = `
233
+ <i class="fas ${type === 'success' ? 'fa-check-circle' : type === 'error' ? 'fa-exclamation-circle' : 'fa-info-circle'} mr-2"></i>
234
+ ${message}
235
+ `;
236
+
237
+ document.body.appendChild(toast);
238
+
239
+ setTimeout(() => {
240
+ toast.classList.remove('animate-bounce');
241
+ toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
242
+ setTimeout(() => {
243
+ document.body.removeChild(toast);
244
+ }, 300);
245
+ }, 3000);
246
+ }
247
+ });
248
+ </script>
249
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MarkTheArtist/clipboard-parser" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
250
+ </html>