C50BARZ commited on
Commit
06291f5
Β·
verified Β·
1 Parent(s): 61f70f9

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +236 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Clean Paste
3
- emoji: πŸ†
4
- colorFrom: purple
5
- colorTo: gray
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: clean-paste
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: purple
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,236 @@
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>Clean Paste - Remove Text Formatting</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
+ .text-area-container {
11
+ position: relative;
12
+ transition: all 0.3s ease;
13
+ }
14
+ .text-area-container:focus-within {
15
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
16
+ }
17
+ .paste-btn {
18
+ transition: all 0.2s ease;
19
+ }
20
+ .paste-btn:hover {
21
+ transform: translateY(-1px);
22
+ }
23
+ .copy-btn {
24
+ transition: all 0.2s ease;
25
+ }
26
+ .copy-btn:hover {
27
+ transform: translateY(-1px);
28
+ }
29
+ .character-count {
30
+ font-variant-numeric: tabular-nums;
31
+ }
32
+ .tooltip {
33
+ position: absolute;
34
+ top: -40px;
35
+ left: 50%;
36
+ transform: translateX(-50%);
37
+ background-color: #333;
38
+ color: white;
39
+ padding: 5px 10px;
40
+ border-radius: 4px;
41
+ font-size: 12px;
42
+ opacity: 0;
43
+ transition: opacity 0.3s;
44
+ pointer-events: none;
45
+ white-space: nowrap;
46
+ }
47
+ .tooltip:after {
48
+ content: "";
49
+ position: absolute;
50
+ top: 100%;
51
+ left: 50%;
52
+ margin-left: -5px;
53
+ border-width: 5px;
54
+ border-style: solid;
55
+ border-color: #333 transparent transparent transparent;
56
+ }
57
+ .show-tooltip {
58
+ opacity: 1;
59
+ }
60
+ </style>
61
+ </head>
62
+ <body class="bg-gray-100 min-h-screen flex flex-col items-center justify-center p-4">
63
+ <div class="w-full max-w-3xl bg-white rounded-xl shadow-lg overflow-hidden">
64
+ <div class="bg-blue-600 p-4">
65
+ <div class="flex items-center justify-between">
66
+ <div class="flex items-center space-x-2">
67
+ <i class="fas fa-broom text-white text-2xl"></i>
68
+ <h1 class="text-white text-2xl font-bold">Clean Paste</h1>
69
+ </div>
70
+ <div class="flex items-center space-x-2">
71
+ <span class="text-blue-100 text-sm">Paste β†’ Clean β†’ Copy</span>
72
+ </div>
73
+ </div>
74
+ <p class="text-blue-100 mt-1 text-sm">Remove all formatting from your clipboard content</p>
75
+ </div>
76
+
77
+ <div class="p-6">
78
+ <div class="text-area-container bg-gray-50 rounded-lg border border-gray-200 p-4">
79
+ <div class="flex justify-between items-center mb-2">
80
+ <label for="clean-text" class="text-gray-600 font-medium">Paste your formatted text here:</label>
81
+ <div class="flex items-center space-x-2">
82
+ <span class="text-xs text-gray-500 character-count">0 characters</span>
83
+ <button id="paste-btn" class="paste-btn bg-blue-100 hover:bg-blue-200 text-blue-700 px-3 py-1 rounded-md text-sm flex items-center">
84
+ <i class="fas fa-paste mr-1"></i> Paste
85
+ </button>
86
+ </div>
87
+ </div>
88
+ <textarea
89
+ id="clean-text"
90
+ class="w-full h-64 p-3 bg-white border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"
91
+ placeholder="Paste your formatted text here (or click the Paste button above)..."
92
+ spellcheck="false"
93
+ ></textarea>
94
+ </div>
95
+
96
+ <div class="mt-4 flex justify-between items-center">
97
+ <div class="flex items-center space-x-2">
98
+ <button id="clear-btn" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-4 py-2 rounded-md flex items-center">
99
+ <i class="fas fa-trash-alt mr-2"></i> Clear
100
+ </button>
101
+ <button id="copy-btn" class="copy-btn bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md flex items-center relative">
102
+ <i class="fas fa-copy mr-2"></i> Copy Clean Text
103
+ <span class="tooltip">Copied to clipboard!</span>
104
+ </button>
105
+ </div>
106
+ <div class="text-xs text-gray-500">
107
+ <span id="word-count">0 words</span>
108
+ </div>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="bg-gray-50 p-4 border-t border-gray-200">
113
+ <div class="flex flex-wrap items-center justify-center gap-4 text-sm text-gray-600">
114
+ <div class="flex items-center">
115
+ <i class="fas fa-info-circle mr-1"></i>
116
+ <span>Formats removed: bold, italic, colors, fonts, etc.</span>
117
+ </div>
118
+ <div class="flex items-center">
119
+ <i class="fas fa-keyboard mr-1"></i>
120
+ <span>Shortcut: Ctrl+V to paste, Ctrl+C to copy</span>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="mt-8 text-center text-gray-500 text-sm">
127
+ <p>Clean Paste - A simple tool to remove text formatting from your clipboard</p>
128
+ </div>
129
+
130
+ <script>
131
+ document.addEventListener('DOMContentLoaded', function() {
132
+ const cleanTextArea = document.getElementById('clean-text');
133
+ const pasteBtn = document.getElementById('paste-btn');
134
+ const copyBtn = document.getElementById('copy-btn');
135
+ const clearBtn = document.getElementById('clear-btn');
136
+ const charCount = document.querySelector('.character-count');
137
+ const wordCount = document.getElementById('word-count');
138
+ const tooltip = document.querySelector('.tooltip');
139
+
140
+ // Update character and word count
141
+ function updateCounts() {
142
+ const text = cleanTextArea.value;
143
+ charCount.textContent = `${text.length} characters`;
144
+
145
+ const words = text.trim() === '' ? 0 : text.trim().split(/\s+/).length;
146
+ wordCount.textContent = `${words} words`;
147
+ }
148
+
149
+ // Handle paste from button
150
+ pasteBtn.addEventListener('click', async function() {
151
+ try {
152
+ const text = await navigator.clipboard.readText();
153
+ cleanTextArea.value = text;
154
+ updateCounts();
155
+
156
+ // Show success feedback
157
+ pasteBtn.innerHTML = '<i class="fas fa-check mr-1"></i> Pasted!';
158
+ pasteBtn.classList.remove('bg-blue-100', 'text-blue-700');
159
+ pasteBtn.classList.add('bg-green-100', 'text-green-700');
160
+
161
+ setTimeout(() => {
162
+ pasteBtn.innerHTML = '<i class="fas fa-paste mr-1"></i> Paste';
163
+ pasteBtn.classList.remove('bg-green-100', 'text-green-700');
164
+ pasteBtn.classList.add('bg-blue-100', 'text-blue-700');
165
+ }, 1500);
166
+ } catch (err) {
167
+ alert('Failed to read clipboard. Please paste manually into the text area.');
168
+ console.error('Failed to read clipboard contents:', err);
169
+ }
170
+ });
171
+
172
+ // Handle copy button
173
+ copyBtn.addEventListener('click', function() {
174
+ if (cleanTextArea.value.trim() === '') {
175
+ alert('Nothing to copy! Please paste some text first.');
176
+ return;
177
+ }
178
+
179
+ navigator.clipboard.writeText(cleanTextArea.value)
180
+ .then(() => {
181
+ // Show tooltip
182
+ tooltip.classList.add('show-tooltip');
183
+ setTimeout(() => {
184
+ tooltip.classList.remove('show-tooltip');
185
+ }, 2000);
186
+ })
187
+ .catch(err => {
188
+ console.error('Failed to copy text: ', err);
189
+ alert('Failed to copy text. Please try again.');
190
+ });
191
+ });
192
+
193
+ // Handle clear button
194
+ clearBtn.addEventListener('click', function() {
195
+ cleanTextArea.value = '';
196
+ updateCounts();
197
+ });
198
+
199
+ // Update counts when typing
200
+ cleanTextArea.addEventListener('input', updateCounts);
201
+
202
+ // Handle direct paste into textarea
203
+ cleanTextArea.addEventListener('paste', function(e) {
204
+ // Let the paste happen first
205
+ setTimeout(() => {
206
+ updateCounts();
207
+
208
+ // Show feedback
209
+ const originalPlaceholder = cleanTextArea.placeholder;
210
+ cleanTextArea.placeholder = "βœ“ Text pasted!";
211
+
212
+ setTimeout(() => {
213
+ cleanTextArea.placeholder = originalPlaceholder;
214
+ }, 1500);
215
+ }, 10);
216
+ });
217
+
218
+ // Keyboard shortcuts
219
+ document.addEventListener('keydown', function(e) {
220
+ if ((e.ctrlKey || e.metaKey) && e.key === 'v' && document.activeElement !== cleanTextArea) {
221
+ e.preventDefault();
222
+ pasteBtn.click();
223
+ }
224
+
225
+ if ((e.ctrlKey || e.metaKey) && e.key === 'c' && document.activeElement === cleanTextArea) {
226
+ e.preventDefault();
227
+ copyBtn.click();
228
+ }
229
+ });
230
+
231
+ // Initialize counts
232
+ updateCounts();
233
+ });
234
+ </script>
235
+ <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=C50BARZ/clean-paste" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
236
+ </html>