File size: 17,545 Bytes
980236d
 
 
 
 
 
b0f8cf3
980236d
 
b0f8cf3
980236d
b0f8cf3
 
 
 
 
 
980236d
b0f8cf3
 
 
 
 
 
 
980236d
 
b0f8cf3
 
980236d
 
 
 
b0f8cf3
 
 
980236d
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
 
b0f8cf3
 
 
 
 
 
 
 
 
 
 
980236d
b0f8cf3
 
 
980236d
b0f8cf3
 
 
980236d
b0f8cf3
 
 
980236d
b0f8cf3
 
 
 
 
 
 
980236d
 
 
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
980236d
 
 
 
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
 
b0f8cf3
980236d
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
 
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
b0f8cf3
980236d
b0f8cf3
980236d
b0f8cf3
 
 
 
 
 
 
 
980236d
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
b0f8cf3
 
 
980236d
 
b0f8cf3
 
 
 
980236d
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
980236d
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
 
b0f8cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980236d
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JFK Document Release 2025</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            background-color: #f8f9fa;
            padding-top: 20px;
            padding-bottom: 40px;
        }
        .container {
            max-width: 1200px;
        }
        .header {
            background-color: #fff;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        h1 {
            color: #212529;
            margin-bottom: 15px;
        }
        .search-container {
            margin: 20px 0;
        }
        .card {
            margin-bottom: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .document-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
        }
        .table {
            background-color: #fff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .table th {
            background-color: #f1f3f5;
            border-top: none;
        }
        .pagination {
            justify-content: center;
            margin-top: 20px;
        }
        .document-category {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 600;
            margin-right: 5px;
        }
        .category-CIA {
            background-color: #e3f2fd;
            color: #0d6efd;
        }
        .category-FBI {
            background-color: #fff3cd;
            color: #ffc107;
        }
        .category-HSCA {
            background-color: #d1e7dd;
            color: #198754;
        }
        .category-Other {
            background-color: #f8d7da;
            color: #dc3545;
        }
        .loading {
            text-align: center;
            padding: 40px;
        }
        .loading-spinner {
            width: 3rem;
            height: 3rem;
        }
        .footer {
            margin-top: 30px;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        #documentViewer {
            height: 600px;
            width: 100%;
            border: none;
        }
        .modal-xl {
            max-width: 90%;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>JFK Document Release 2025</h1>
            <p class="lead">Browse and search through declassified documents related to the assassination of President John F. Kennedy.</p>
        </div>
        
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="input-group mb-3">
                            <input type="text" id="search" class="form-control" placeholder="Search documents by name or content..." aria-label="Search documents">
                            <button class="btn btn-primary" type="button" onclick="filterDocuments()">Search</button>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="d-flex justify-content-end">
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-outline-secondary" onclick="filterByCategory('all')">All</button>
                                <button type="button" class="btn btn-outline-primary" onclick="filterByCategory('CIA')">CIA</button>
                                <button type="button" class="btn btn-outline-warning" onclick="filterByCategory('FBI')">FBI</button>
                                <button type="button" class="btn btn-outline-success" onclick="filterByCategory('HSCA')">HSCA</button>
                                <button type="button" class="btn btn-outline-danger" onclick="filterByCategory('Other')">Other</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="loading" id="loading">
            <div class="spinner-border loading-spinner text-primary" role="status">
                <span class="visually-hidden">Loading...</span>
            </div>
            <p class="mt-3">Loading documents...</p>
        </div>
        
        <div id="documentsContainer" style="display: none;">
            <table class="table table-hover" id="documents-table">
                <thead>
                    <tr>
                        <th scope="col">Document Name</th>
                        <th scope="col">Category</th>
                        <th scope="col">Size</th>
                        <th scope="col">Actions</th>
                    </tr>
                </thead>
                <tbody id="documents-list">
                    <!-- Documents will be populated here by JavaScript -->
                </tbody>
            </table>
            
            <nav aria-label="Document pagination">
                <ul class="pagination" id="pagination">
                    <!-- Pagination will be populated here by JavaScript -->
                </ul>
            </nav>
        </div>
        
        <!-- Document Viewer Modal -->
        <div class="modal fade" id="documentModal" tabindex="-1" aria-labelledby="documentModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="documentModalLabel">Document Viewer</h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <iframe id="documentViewer" title="Document Viewer"></iframe>
                    </div>
                    <div class="modal-footer">
                        <a id="downloadLink" href="#" class="btn btn-primary" download>Download Document</a>
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="footer">
            <h4>About this Collection</h4>
            <p>This collection contains declassified documents related to the assassination of President John F. Kennedy.
            The documents were released by the National Archives and Records Administration (NARA) as part of the JFK Records Act.</p>
            <p>The documents follow the National Archives naming convention: <code>104-XXXXX-XXXXX.pdf</code></p>
            <p>For more information, visit the <a href="https://github.com/varun-heman/jfk-files-2025" target="_blank">GitHub repository</a>.</p>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Global variables
        let allDocuments = [];
        let currentPage = 1;
        let documentsPerPage = 20;
        let currentCategory = 'all';
        let currentSearch = '';
        
        // Document modal
        const documentModal = new bootstrap.Modal(document.getElementById('documentModal'));
        
        // Function to determine document category based on filename
        function getDocumentCategory(fileName) {
            if (fileName.includes('104-10')) return 'FBI';
            if (fileName.includes('157-10')) return 'CIA';
            if (fileName.includes('180-10')) return 'HSCA';
            return 'Other';
        }
        
        // Function to format file size
        function formatFileSize(bytes) {
            if (bytes < 1024) return bytes + ' B';
            if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
            return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
        }
        
        // Function to load document list
        async function loadDocuments() {
            try {
                const response = await fetch('https://huggingface.co/api/datasets/varunh/jfk-files-2025/tree/main/data');
                const data = await response.json();
                
                // Sort files alphabetically
                allDocuments = data
                    .filter(file => file.path.endsWith('.pdf'))
                    .map(file => {
                        const fileName = file.path.split('/').pop();
                        return {
                            name: fileName,
                            path: file.path,
                            size: file.size || 0,
                            category: getDocumentCategory(fileName)
                        };
                    })
                    .sort((a, b) => a.name.localeCompare(b.name));
                
                // Hide loading indicator and show documents
                document.getElementById('loading').style.display = 'none';
                document.getElementById('documentsContainer').style.display = 'block';
                
                // Display the documents
                displayDocuments();
            } catch (error) {
                console.error('Error loading documents:', error);
                document.getElementById('loading').innerHTML = `
                    <div class="alert alert-danger" role="alert">
                        Error loading documents. Please try again later.
                    </div>
                `;
            }
        }
        
        // Function to display documents with pagination
        function displayDocuments() {
            // Filter documents based on search and category
            let filteredDocuments = allDocuments.filter(doc => {
                const matchesSearch = currentSearch === '' || 
                    doc.name.toLowerCase().includes(currentSearch.toLowerCase());
                const matchesCategory = currentCategory === 'all' || 
                    doc.category === currentCategory;
                return matchesSearch && matchesCategory;
            });
            
            // Calculate pagination
            const totalPages = Math.ceil(filteredDocuments.length / documentsPerPage);
            const startIndex = (currentPage - 1) * documentsPerPage;
            const endIndex = Math.min(startIndex + documentsPerPage, filteredDocuments.length);
            const currentDocuments = filteredDocuments.slice(startIndex, endIndex);
            
            // Display documents
            const documentsList = document.getElementById('documents-list');
            documentsList.innerHTML = '';
            
            if (currentDocuments.length === 0) {
                documentsList.innerHTML = `
                    <tr>
                        <td colspan="4" class="text-center">No documents found matching your criteria.</td>
                    </tr>
                `;
                return;
            }
            
            currentDocuments.forEach(doc => {
                const row = document.createElement('tr');
                row.className = 'document-card';
                
                const nameCell = document.createElement('td');
                nameCell.textContent = doc.name;
                
                const categoryCell = document.createElement('td');
                const categorySpan = document.createElement('span');
                categorySpan.className = `document-category category-${doc.category}`;
                categorySpan.textContent = doc.category;
                categoryCell.appendChild(categorySpan);
                
                const sizeCell = document.createElement('td');
                sizeCell.textContent = formatFileSize(doc.size);
                
                const actionsCell = document.createElement('td');
                
                const viewButton = document.createElement('button');
                viewButton.className = 'btn btn-sm btn-primary me-2';
                viewButton.textContent = 'View';
                viewButton.onclick = () => viewDocument(doc);
                
                const downloadLink = document.createElement('a');
                downloadLink.className = 'btn btn-sm btn-outline-secondary';
                downloadLink.href = `https://huggingface.co/datasets/varunh/jfk-files-2025/resolve/main/${doc.path}`;
                downloadLink.textContent = 'Download';
                downloadLink.download = doc.name;
                
                actionsCell.appendChild(viewButton);
                actionsCell.appendChild(downloadLink);
                
                row.appendChild(nameCell);
                row.appendChild(categoryCell);
                row.appendChild(sizeCell);
                row.appendChild(actionsCell);
                
                documentsList.appendChild(row);
            });
            
            // Update pagination
            updatePagination(totalPages);
        }
        
        // Function to update pagination controls
        function updatePagination(totalPages) {
            const pagination = document.getElementById('pagination');
            pagination.innerHTML = '';
            
            // Previous button
            const prevItem = document.createElement('li');
            prevItem.className = `page-item ${currentPage === 1 ? 'disabled' : ''}`;
            const prevLink = document.createElement('a');
            prevLink.className = 'page-link';
            prevLink.href = '#';
            prevLink.textContent = 'Previous';
            prevLink.onclick = (e) => {
                e.preventDefault();
                if (currentPage > 1) {
                    currentPage--;
                    displayDocuments();
                }
            };
            prevItem.appendChild(prevLink);
            pagination.appendChild(prevItem);
            
            // Page numbers
            const maxVisiblePages = 5;
            const startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2));
            const endPage = Math.min(totalPages, startPage + maxVisiblePages - 1);
            
            for (let i = startPage; i <= endPage; i++) {
                const pageItem = document.createElement('li');
                pageItem.className = `page-item ${i === currentPage ? 'active' : ''}`;
                const pageLink = document.createElement('a');
                pageLink.className = 'page-link';
                pageLink.href = '#';
                pageLink.textContent = i;
                pageLink.onclick = (e) => {
                    e.preventDefault();
                    currentPage = i;
                    displayDocuments();
                };
                pageItem.appendChild(pageLink);
                pagination.appendChild(pageItem);
            }
            
            // Next button
            const nextItem = document.createElement('li');
            nextItem.className = `page-item ${currentPage === totalPages ? 'disabled' : ''}`;
            const nextLink = document.createElement('a');
            nextLink.className = 'page-link';
            nextLink.href = '#';
            nextLink.textContent = 'Next';
            nextLink.onclick = (e) => {
                e.preventDefault();
                if (currentPage < totalPages) {
                    currentPage++;
                    displayDocuments();
                }
            };
            nextItem.appendChild(nextLink);
            pagination.appendChild(nextItem);
        }
        
        // Function to filter documents based on search
        function filterDocuments() {
            currentSearch = document.getElementById('search').value.toLowerCase();
            currentPage = 1;
            displayDocuments();
        }
        
        // Function to filter by category
        function filterByCategory(category) {
            currentCategory = category;
            currentPage = 1;
            displayDocuments();
        }
        
        // Function to view document in modal
        function viewDocument(doc) {
            const viewerUrl = `https://huggingface.co/datasets/varunh/jfk-files-2025/resolve/main/${doc.path}`;
            document.getElementById('documentViewer').src = viewerUrl;
            document.getElementById('documentModalLabel').textContent = doc.name;
            document.getElementById('downloadLink').href = viewerUrl;
            documentModal.show();
        }
        
        // Add event listener for search input
        document.getElementById('search').addEventListener('keyup', function(event) {
            if (event.key === 'Enter') {
                filterDocuments();
            }
        });
        
        // Load documents when page loads
        window.onload = loadDocuments;
    </script>
</body>
</html>