tractatus/public/js/docs-viewer-app.js
TheFlow edf3b4165c feat: fix CSP violations & implement three audience paths
CSP Compliance (complete):
- Install Tailwind CSS v3 locally (24KB build)
- Replace CDN with /css/tailwind.css in all HTML files
- Extract all inline scripts to external JS files
- Created 6 external JS files for demos & docs
- All pages now comply with script-src 'self'

Three Audience Paths (complete):
- Created /researcher.html (academic/theoretical)
- Created /implementer.html (practical integration)
- Created /advocate.html (mission/values/community)
- Updated homepage links to audience pages
- Each path has dedicated nav, hero, resources, CTAs

Files Modified (20):
- 7 HTML files (CSP compliance)
- 3 audience landing pages (new)
- 6 external JS files (extracted)
- package.json (Tailwind v3)
- tailwind.config.js (new)
- Built CSS (24KB minified)

All resources CSP-compliant, all pages tested 200 OK

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 12:21:00 +13:00

35 lines
966 B
JavaScript

// Initialize document viewer
const viewer = new DocumentViewer('document-viewer');
// Load navigation
async function loadNavigation() {
try {
const response = await API.Documents.list({ limit: 50 });
const nav = document.getElementById('doc-navigation');
if (response.success && response.documents) {
nav.innerHTML = response.documents.map(doc => `
<a href="/docs/${doc.slug}"
data-route="/docs/${doc.slug}"
class="block px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-md">
${doc.title}
</a>
`).join('');
}
} catch (error) {
console.error('Failed to load navigation:', error);
}
}
// Setup routing
router
.on('/docs-viewer.html', async () => {
// Show default document
await viewer.render('introduction-to-the-tractatus-framework');
})
.on('/docs/:slug', async (params) => {
await viewer.render(params.slug);
});
// Initialize
loadNavigation();