-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
140 lines (128 loc) · 4.95 KB
/
Copy pathindex.html
File metadata and controls
140 lines (128 loc) · 4.95 KB
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
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documentación</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
--bg:#15110d;
--bg-card:#1f1a14;
--bg-card-hover:#26201a;
--line:#3a3024;
--cream:#efe7d8;
--muted:#a79c89;
--gold:#d3a94d;
--sage:#8a9a6e;
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
body{
background:
radial-gradient(ellipse 900px 500px at 15% -10%, rgba(211,169,77,.08), transparent),
var(--bg);
color:var(--cream);
font-family:'Inter',sans-serif;
min-height:100vh;
padding:48px 20px 80px;
}
.wrap{max-width:760px;margin:0 auto;}
.eyebrow{
font-family:'JetBrains Mono',monospace;font-size:11.5px;letter-spacing:1.5px;
text-transform:uppercase;color:var(--gold);margin-bottom:10px;
}
h1{
font-family:'Fraunces',serif;font-weight:600;font-size:clamp(30px,5vw,42px);
margin-bottom:8px;letter-spacing:-.01em;
}
.sub{color:var(--muted);font-size:14.5px;max-width:520px;margin-bottom:36px;}
#status{color:var(--muted);font-size:13.5px;font-family:'JetBrains Mono',monospace;}
#list{list-style:none;margin-top:8px;}
#list li{
background:var(--bg-card);border:1px solid var(--line);border-radius:12px;
margin-bottom:10px;transition:background .15s, border-color .15s, transform .15s;
}
#list li:hover{background:var(--bg-card-hover);border-color:var(--gold);transform:translateX(2px);}
#list a{
display:flex;justify-content:space-between;align-items:center;gap:16px;
padding:16px 18px;text-decoration:none;color:inherit;
}
.doc-name{font-family:'Fraunces',serif;font-weight:600;font-size:16.5px;}
.doc-meta{
font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--muted);
white-space:nowrap;
}
.empty{color:var(--muted);font-size:14px;padding:20px 0;}
footer{
max-width:760px;margin:48px auto 0;padding-top:20px;border-top:1px solid var(--line);
font-size:11.5px;color:var(--muted);font-family:'JetBrains Mono',monospace;
}
</style>
</head>
<body>
<div class="wrap">
<div class="eyebrow">Documentación de mis proyectos</div>
<h1>Documentación</h1>
<p class="sub">Cada documento generado queda listado acá automáticamente. Sube un HTML nuevo al repo y aparece solo — este índice nunca se edita a mano.</p>
<p id="status">Cargando documentos…</p>
<ul id="list"></ul>
</div>
<footer>index.html · lee el contenido del repo en vivo vía jsDelivr</footer>
<script>
// ── Datos del repo ──
const OWNER = 'alecelisdev';
const REPO = 'ale-docs';
const BRANCH = 'main'; // cambia a 'master' si tu repo usa esa rama por defecto
// ─────────────────────
const statusEl = document.getElementById('status');
const listEl = document.getElementById('list');
function prettifyName(filename){
return filename
.replace(/\.html$/i, '')
.replace(/[-_]+/g, ' ')
.replace(/\b\w/g, c => c.toUpperCase());
}
function formatSize(bytes){
if (bytes < 1024) return bytes + ' B';
return (bytes / 1024).toFixed(0) + ' KB';
}
async function loadDocs(){
try {
// jsDelivr espeja repos públicos de GitHub con límites de consulta
// mucho más generosos que la API directa de GitHub.
const res = await fetch(`https://data.jsdelivr.com/v1/package/gh/${OWNER}/${REPO}@${BRANCH}/flat`);
if (!res.ok) throw new Error('jsDelivr respondió ' + res.status);
const data = await res.json();
const allFiles = data.files || [];
const htmlFiles = allFiles
.filter(f => {
const path = f.name.replace(/^\//, '');
return path.toLowerCase().endsWith('.html') &&
path.toLowerCase() !== 'index.html' &&
!path.includes('/'); // solo archivos en la raíz del repo
})
.map(f => ({ name: f.name.replace(/^\//, ''), size: f.size }));
if (htmlFiles.length === 0){
statusEl.textContent = '';
listEl.innerHTML = '<li class="empty" style="background:none;border:none;">Aún no hay documentos subidos.</li>';
return;
}
htmlFiles.sort((a, b) => a.name.localeCompare(b.name));
statusEl.textContent = `${htmlFiles.length} documento${htmlFiles.length === 1 ? '' : 's'}`;
listEl.innerHTML = htmlFiles.map(f => `
<li>
<a href="./${f.name}">
<span class="doc-name">${prettifyName(f.name)}</span>
<span class="doc-meta">${formatSize(f.size)}</span>
</a>
</li>
`).join('');
} catch (err){
statusEl.textContent = 'No se pudo cargar el listado: ' + err.message;
}
}
loadDocs();
</script>
</body>
</html>