mokecome commited on
Commit
29facc1
·
verified ·
1 Parent(s): a79d5e4

Upload 3 files

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. LICENSE +21 -0
  3. index.html +378 -19
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .DS_Store
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 pathfinder
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
index.html CHANGED
@@ -1,19 +1,378 @@
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>Convert Directory to LLM XML prompt</title>
7
+ <style>
8
+ :root {
9
+ --primary-color: #2563eb;
10
+ --hover-color: #1d4ed8;
11
+ --border-color: #e5e7eb;
12
+ --text-color: #1f2937;
13
+ --background-color: #ffffff;
14
+ --excluded-opacity: 0.65;
15
+ }
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ margin: 0;
20
+ padding: 0;
21
+ }
22
+
23
+ body {
24
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
25
+ sans-serif;
26
+ line-height: 1.5;
27
+ color: var(--text-color);
28
+ padding: 1rem;
29
+ }
30
+
31
+ .container {
32
+ max-width: 1200px;
33
+ margin: 0 auto;
34
+ display: block;
35
+ gap: 1rem;
36
+ }
37
+
38
+ .header-controls {
39
+ display: flex;
40
+ gap: 0.5rem;
41
+ align-items: center;
42
+ width: 100%;
43
+ justify-content: space-between;
44
+ }
45
+
46
+ .header-controls-left {
47
+ display: flex;
48
+ gap: 0.5rem;
49
+ align-items: center;
50
+ }
51
+
52
+ .form-group {
53
+ margin-bottom: 1rem;
54
+ }
55
+
56
+ .form-group label {
57
+ display: block;
58
+ margin-bottom: 0.5rem;
59
+ font-weight: 500;
60
+ }
61
+
62
+ .form-group input[type='text'] {
63
+ width: 100%;
64
+ padding: 0.5rem;
65
+ border: 1px solid var(--border-color);
66
+ border-radius: 0.25rem;
67
+ font-size: 0.875rem;
68
+ }
69
+
70
+ .checkbox-group {
71
+ margin-bottom: 1rem;
72
+ }
73
+
74
+ .button {
75
+ padding: 0.5rem;
76
+ border: 1px solid var(--border-color);
77
+ border-radius: 0.25rem;
78
+ background-color: white;
79
+ cursor: pointer;
80
+ font-size: 0.875rem;
81
+ transition: all 0.2s;
82
+ }
83
+
84
+ .button.primary {
85
+ background-color: var(--primary-color);
86
+ color: white;
87
+ border-color: var(--primary-color);
88
+ }
89
+
90
+ .button:hover {
91
+ background-color: var(--hover-color);
92
+ border-color: var(--hover-color);
93
+ color: white;
94
+ padding: 0.5rem 1rem;
95
+ }
96
+
97
+ .tree-container {
98
+ border: 1px solid var(--border-color);
99
+ border-radius: 0.5rem;
100
+ overflow: hidden;
101
+ }
102
+
103
+ .tree-header {
104
+ padding: 1rem;
105
+ border-bottom: 1px solid var(--border-color);
106
+ display: flex;
107
+ justify-content: space-between;
108
+ align-items: center;
109
+ }
110
+
111
+ .tree-controls {
112
+ display: flex;
113
+ gap: 0.5rem;
114
+ }
115
+
116
+ #fileTree {
117
+ height: 100%;
118
+ overflow-y: auto;
119
+ padding: 1rem;
120
+ min-width: 0;
121
+ }
122
+
123
+ .tree-node {
124
+ display: flex;
125
+ align-items: center;
126
+ padding: 0.25rem 0;
127
+ margin-left: 1.5rem;
128
+ }
129
+
130
+ .tree-node.excluded {
131
+ opacity: var(--excluded-opacity);
132
+ }
133
+
134
+ .tree-node-content {
135
+ display: flex;
136
+ align-items: center;
137
+ gap: 0.5rem;
138
+ cursor: pointer;
139
+ padding: 0.25rem;
140
+ border-radius: 0.25rem;
141
+ }
142
+
143
+ .tree-checkbox {
144
+ width: 16px;
145
+ height: 16px;
146
+ margin-right: 0.5rem;
147
+ }
148
+
149
+ .stats {
150
+ margin-top: 1rem;
151
+ padding: 1rem;
152
+ background-color: #f9fafb;
153
+ border-radius: 0.25rem;
154
+ font-size: 0.875rem;
155
+ }
156
+
157
+ .upload-message {
158
+ text-align: center;
159
+ padding: 2rem;
160
+ color: #6b7280;
161
+ }
162
+
163
+ .container-split {
164
+ display: grid;
165
+ grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr);
166
+ gap: 1rem;
167
+ height: calc(100vh - 200px);
168
+ overflow: hidden;
169
+ }
170
+
171
+ @media (max-width: 768px) {
172
+ .container-split {
173
+ grid-template-columns: 1fr;
174
+ height: auto;
175
+ min-height: calc(100vh - 200px);
176
+ }
177
+
178
+ .header-controls {
179
+ flex-direction: column;
180
+ align-items: stretch;
181
+ gap: 1rem;
182
+ }
183
+
184
+ .header-controls-left {
185
+ flex-wrap: wrap;
186
+ }
187
+
188
+ .button {
189
+ padding: 0.75rem;
190
+ min-height: 44px;
191
+ }
192
+
193
+ .button span:not(.icon) {
194
+ display: inline-block;
195
+ margin-left: 0.25rem;
196
+ }
197
+
198
+ .selected-files-panel {
199
+ border-left: none;
200
+ border-top: 1px solid var(--border-color);
201
+ max-height: 50vh;
202
+ }
203
+
204
+ .tree-container {
205
+ max-height: 100vh;
206
+ overflow: auto;
207
+ }
208
+ }
209
+
210
+ .selected-files-panel {
211
+ border-left: 1px solid var(--border-color);
212
+ padding: 1rem;
213
+ display: flex;
214
+ flex-direction: column;
215
+ min-width: 0;
216
+ overflow: hidden;
217
+ }
218
+
219
+ .selected-files-header {
220
+ display: flex;
221
+ justify-content: space-between;
222
+ align-items: center;
223
+ margin-bottom: 1rem;
224
+ }
225
+
226
+ .selected-files-content {
227
+ flex: 1;
228
+ overflow: auto;
229
+ background: #f9fafb;
230
+ padding: 1rem;
231
+ border-radius: 0.25rem;
232
+ font-family: monospace;
233
+ font-size: 0.875rem;
234
+ white-space: pre;
235
+ margin: 0;
236
+ }
237
+
238
+ .button-group {
239
+ margin-left: 1rem;
240
+ display: flex;
241
+ gap: 0.25rem;
242
+ border-radius: 0.25rem;
243
+ }
244
+
245
+ .button-group .button {
246
+ border-radius: 0;
247
+ }
248
+
249
+ .button-group .button:first-child {
250
+ border-top-left-radius: 0.25rem;
251
+ border-bottom-left-radius: 0.25rem;
252
+ }
253
+
254
+ .button-group .button:last-child {
255
+ border-top-right-radius: 0.25rem;
256
+ border-bottom-right-radius: 0.25rem;
257
+ }
258
+
259
+ .button .icon {
260
+ display: inline-block;
261
+ margin-right: 0;
262
+ }
263
+
264
+ .button span:not(.icon) {
265
+ display: none;
266
+ }
267
+
268
+ .button-group:hover .button span:not(.icon) {
269
+ display: inline-block;
270
+ margin-left: 0.25rem;
271
+ }
272
+
273
+ .button-group:hover .button {
274
+ padding: 0.5rem 1rem;
275
+ }
276
+
277
+ .button.danger {
278
+ border-color: #dc2626;
279
+ color: #dc2626;
280
+ }
281
+
282
+ .button.danger:hover {
283
+ background-color: #dc2626;
284
+ border-color: #dc2626;
285
+ color: white;
286
+ }
287
+
288
+ .mobile-warning {
289
+ display: none;
290
+ background-color: #fff3cd;
291
+ border: 1px solid #ffeeba;
292
+ color: #856404;
293
+ padding: 1rem;
294
+ margin-bottom: 1rem;
295
+ border-radius: 0.25rem;
296
+ text-align: center;
297
+ }
298
+
299
+ @media (max-width: 768px) {
300
+ .mobile-warning {
301
+ display: block;
302
+ }
303
+ }
304
+ </style>
305
+ <script
306
+ lang="javascript"
307
+ src="https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js"
308
+ ></script>
309
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script>
310
+ <script>
311
+ pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js';
312
+ </script>
313
+ </head>
314
+ <body>
315
+ <div class="container">
316
+ <div class="mobile-warning">
317
+ ⚠ This tool is optimized for larger screens. Mobile functionality is basic.
318
+ </div>
319
+ <div class="tree-container">
320
+ <div class="tree-header">
321
+ <div class="header-controls">
322
+ <div class="header-controls-left">
323
+ <label for="directoryInput" class="button primary">Select Directory</label>
324
+ <input
325
+ type="file"
326
+ id="directoryInput"
327
+ webkitdirectory
328
+ directory
329
+ multiple
330
+ style="display: none"
331
+ />
332
+ <div class="button-group">
333
+ <button id="expandAllButton" class="button" title="Expand all folders">
334
+ <span class="icon">▼</span><span>Expand All</span>
335
+ </button>
336
+ <button id="collapseAllButton" class="button" title="Collapse all folders">
337
+ <span class="icon">▶</span><span>Collapse All</span>
338
+ </button>
339
+ </div>
340
+ <div class="button-group">
341
+ <button id="selectAllButton" class="button" title="Select all files">
342
+ <span class="icon">☑</span><span>Select All</span>
343
+ </button>
344
+ <button id="deselectAllButton" class="button" title="Deselect all files">
345
+ <span class="icon">☐</span><span>Deselect All</span>
346
+ </button>
347
+ </div>
348
+ </div>
349
+ <button id="clearButton" class="button danger" title="Clear all files">
350
+ <span class="icon">×</span><span>Clear</span>
351
+ </button>
352
+ </div>
353
+ </div>
354
+
355
+ <div class="container-split">
356
+ <div id="fileTree">
357
+ <div class="upload-message">Select a directory to view its contents</div>
358
+ </div>
359
+
360
+ <div class="selected-files-panel">
361
+ <div class="selected-files-header">
362
+ <h3>Selected Files</h3>
363
+ <button id="copyButton" class="button">Copy to Clipboard</button>
364
+ </div>
365
+ <pre id="selectedFilesContent" class="selected-files-content"></pre>
366
+ </div>
367
+ </div>
368
+
369
+ <div class="stats">
370
+ Selected Files: <span id="selectedCount">0</span> | Estimated Tokens:
371
+ <span id="estimatedTokens">0</span>
372
+ </div>
373
+ </div>
374
+ </div>
375
+
376
+ <script src="static/js/app.js"></script>
377
+ </body>
378
+ </html>