Untitled
unknown
plain_text
4 months ago
1.9 kB
4
Indexable
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Directory Listing</title> <style> body { font-family: Arial, sans-serif; background: #f7f7f7; padding: 20px; color: #333; } h1 { text-align: center; } .file-list { max-width: 600px; margin: 20px auto; } .file-item { background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 10px; margin-bottom: 10px; transition: background 0.3s; } .file-item:hover { background: #f0f8ff; } .file-item a { text-decoration: none; color: #007BFF; font-size: 16px; } .file-item a:hover { text-decoration: underline; } </style> </head> <body> <h1>Files in this Folder</h1> <div class="file-list" id="fileList"></div> <script> // Attempt to fetch the directory listing. fetch(window.location.href) .then(response => response.text()) .then(html => { const parser = new DOMParser(); const doc = parser.parseFromString(html, 'text/html'); const links = doc.querySelectorAll('a'); const fileList = document.getElementById('fileList'); links.forEach(link => { const href = link.getAttribute('href'); // Skip parent directory links and this index file. if (href === '../' || href === 'index.html' || href === './') return; const div = document.createElement('div'); div.className = 'file-item'; const a = document.createElement('a'); a.href = href; a.textContent = href; div.appendChild(a); fileList.appendChild(div); }); }) .catch(err => { console.error('Error fetching directory listing:', err); document.getElementById('fileList').textContent = 'Error loading file list.'; }); </script> </body> </html>
Editor is loading...
Leave a Comment