{% extends "base.html" %} {% block title %}Markdown Files - Directory Listing{% endblock %} {% block header_content %}
Aigon Viewer {{ files|length }} files{% if selected_config %} in {{ selected_config }}{% endif %} ({{ selected_source|default("local") }})
{% if not local_only %} {% endif %} {% if configurations|length > 0 %} {% endif %}
{% endblock %} {% block content %}
{% for file in files %} {% endfor %}
File Name Size Last Modified
📄 {{ file.name }} {% if file.configurations %} {% for config in file.configurations %} {{ config }} {% endfor %} {% endif %} {% if file.has_remote and not local_only %} 🌐 {% endif %} {{ file.size_human }} {{ file.modified_human }}
{% if not files %}

No markdown files found in the parent directory.

{% endif %}
{% endblock %} {% block extra_script %} // Store initial file states window.fileStates = {}; document.querySelectorAll('.file-row').forEach(row => { const filename = row.dataset.filename; const modified = parseFloat(row.dataset.modified); window.fileStates[filename] = modified; }); // Source and config update functions function updateSource(source) { const currentConfig = new URLSearchParams(window.location.search).get('config') || ''; let url = '/?source=' + source; if (currentConfig) { url += '&config=' + encodeURIComponent(currentConfig); } window.location.href = url; } function updateConfig(config) { const currentSource = new URLSearchParams(window.location.search).get('source') || 'local'; let url = '/?source=' + currentSource; if (config) { url += '&config=' + encodeURIComponent(config); } window.location.href = url; } // Index page refresh function window.refreshIndex = async function() { try { const response = await fetch('/api/files'); const files = await response.json(); // Check if any files have changed let hasChanges = false; for (const file of files) { if (window.fileStates[file.name] !== file.modified) { hasChanges = true; break; } } // If there are changes, reload the page if (hasChanges) { window.location.reload(); } } catch (error) { console.error('Error checking for updates:', error); } }; // Set up auto-refresh for index if (window.setupAutoRefresh) { window.setupAutoRefresh(window.refreshIndex); } {% endblock %}