Update index.html
Browse files- index.html +46 -95
index.html
CHANGED
@@ -21,23 +21,12 @@
|
|
21 |
}
|
22 |
|
23 |
/* Layout container */
|
24 |
-
.
|
25 |
display: flex;
|
26 |
min-height: 100vh;
|
27 |
-
justify-content: flex-start;
|
28 |
-
}
|
29 |
-
|
30 |
-
/* When TOC is collapsed, center the content globally */
|
31 |
-
.container.toc-collapsed {
|
32 |
-
justify-content: center;
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
margin-left: 0;
|
37 |
-
margin-right: 0;
|
38 |
-
}
|
39 |
-
|
40 |
-
/* Fixed TOC Sidebar */
|
41 |
.toc-sidebar {
|
42 |
position: fixed;
|
43 |
left: 0;
|
@@ -52,35 +41,27 @@
|
|
52 |
transition: transform 0.3s ease;
|
53 |
}
|
54 |
|
55 |
-
/* Collapsible sidebar */
|
56 |
.toc-sidebar.collapsed {
|
57 |
transform: translateX(-240px);
|
58 |
}
|
59 |
|
60 |
-
.toc-
|
61 |
-
position:
|
62 |
top: 20px;
|
63 |
-
|
|
|
|
|
64 |
background: #3b82f6;
|
65 |
color: white;
|
66 |
border: none;
|
67 |
-
border-radius:
|
68 |
-
width: 32px;
|
69 |
-
height: 32px;
|
70 |
cursor: pointer;
|
71 |
display: flex;
|
72 |
align-items: center;
|
73 |
justify-content: center;
|
74 |
-
font-size:
|
|
|
75 |
transition: all 0.3s ease;
|
76 |
-
z-index: 102;
|
77 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
78 |
-
}
|
79 |
-
|
80 |
-
.toc-sidebar.collapsed .collapse-btn {
|
81 |
-
right: -16px;
|
82 |
-
background: #3b82f6;
|
83 |
-
color: white;
|
84 |
}
|
85 |
|
86 |
.toc-sidebar h3 {
|
@@ -133,22 +114,23 @@
|
|
133 |
padding-left: 32px;
|
134 |
}
|
135 |
|
136 |
-
/* Main content area */
|
137 |
.main-content {
|
138 |
-
margin-left: 280px;
|
139 |
max-width: 896px;
|
140 |
-
|
141 |
-
|
142 |
width: 100%;
|
143 |
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
149 |
}
|
150 |
|
151 |
-
/*
|
152 |
h1 {
|
153 |
font-size: 2.25rem;
|
154 |
font-weight: 700;
|
@@ -310,6 +292,7 @@
|
|
310 |
transform: scale(1.1);
|
311 |
}
|
312 |
|
|
|
313 |
div[style*="border: 2px solid black"] {
|
314 |
border: 1px solid #e5e7eb !important;
|
315 |
border-radius: 0.75rem !important;
|
@@ -329,24 +312,13 @@
|
|
329 |
@media (max-width: 1024px) {
|
330 |
.toc-sidebar {
|
331 |
transform: translateX(-100%);
|
332 |
-
transition: transform 0.3s ease;
|
333 |
}
|
334 |
|
335 |
.toc-sidebar.open {
|
336 |
transform: translateX(0);
|
337 |
}
|
338 |
|
339 |
-
.toc-sidebar .collapse-btn {
|
340 |
-
display: none;
|
341 |
-
}
|
342 |
-
|
343 |
.main-content {
|
344 |
-
margin-left: 0;
|
345 |
-
padding: 16px;
|
346 |
-
}
|
347 |
-
|
348 |
-
.main-content.expanded {
|
349 |
-
margin-left: 0;
|
350 |
padding: 16px;
|
351 |
}
|
352 |
|
@@ -355,7 +327,7 @@
|
|
355 |
position: fixed;
|
356 |
top: 16px;
|
357 |
left: 16px;
|
358 |
-
z-index:
|
359 |
background: #3b82f6;
|
360 |
color: white;
|
361 |
border: none;
|
@@ -371,24 +343,26 @@
|
|
371 |
</style>
|
372 |
</head>
|
373 |
<body>
|
374 |
-
<div class="
|
375 |
<!-- TOC Sidebar -->
|
376 |
-
<
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
|
384 |
<!-- Mobile TOC Toggle -->
|
385 |
-
<button class="mobile-toc-toggle" onclick="
|
386 |
-
|
387 |
-
<!-- Main Content -->
|
388 |
-
<
|
389 |
-
<
|
390 |
-
|
391 |
-
|
|
|
|
|
392 |
</div>
|
393 |
|
394 |
<script>
|
@@ -407,7 +381,6 @@
|
|
407 |
.replace(/-+/g, '-')
|
408 |
.replace(/^-|-$/g, '');
|
409 |
|
410 |
-
// Add ID to heading for linking
|
411 |
heading.id = id;
|
412 |
|
413 |
const tocClass = `toc-level-${level}`;
|
@@ -419,42 +392,24 @@
|
|
419 |
}
|
420 |
|
421 |
function setActiveLink(clickedLink) {
|
422 |
-
// Remove active class from all links
|
423 |
document.querySelectorAll('.toc-sidebar a').forEach(link => {
|
424 |
link.classList.remove('active');
|
425 |
});
|
426 |
-
// Add active class to clicked link
|
427 |
clickedLink.classList.add('active');
|
428 |
}
|
429 |
|
430 |
function toggleTOC() {
|
431 |
-
document.getElementById('toc-sidebar').classList.toggle('open');
|
432 |
-
}
|
433 |
-
|
434 |
-
function toggleSidebar() {
|
435 |
const sidebar = document.getElementById('toc-sidebar');
|
436 |
-
const
|
437 |
-
const container = document.querySelector('.container');
|
438 |
-
const btn = document.getElementById('collapse-btn');
|
439 |
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
container.classList.remove('toc-collapsed');
|
447 |
-
btn.innerHTML = '◀';
|
448 |
-
} else {
|
449 |
-
// Collapsing
|
450 |
-
sidebar.classList.add('collapsed');
|
451 |
-
mainContent.classList.add('expanded');
|
452 |
-
container.classList.add('toc-collapsed');
|
453 |
-
btn.innerHTML = '▶';
|
454 |
-
}
|
455 |
}
|
456 |
|
457 |
-
// Highlight current section while scrolling
|
458 |
function highlightCurrentSection() {
|
459 |
const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
460 |
const tocLinks = document.querySelectorAll('.toc-sidebar a');
|
@@ -489,12 +444,8 @@
|
|
489 |
const contentDiv = document.getElementById('content');
|
490 |
contentDiv.innerHTML = html;
|
491 |
|
492 |
-
// Generate TOC after content is loaded
|
493 |
generateTOC(contentDiv);
|
494 |
-
|
495 |
document.getElementById('loading').style.display = 'none';
|
496 |
-
|
497 |
-
// Add scroll listener for highlighting current section
|
498 |
window.addEventListener('scroll', highlightCurrentSection);
|
499 |
|
500 |
} catch (error) {
|
|
|
21 |
}
|
22 |
|
23 |
/* Layout container */
|
24 |
+
.layout {
|
25 |
display: flex;
|
26 |
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
+
/* TOC Sidebar */
|
|
|
|
|
|
|
|
|
|
|
30 |
.toc-sidebar {
|
31 |
position: fixed;
|
32 |
left: 0;
|
|
|
41 |
transition: transform 0.3s ease;
|
42 |
}
|
43 |
|
|
|
44 |
.toc-sidebar.collapsed {
|
45 |
transform: translateX(-240px);
|
46 |
}
|
47 |
|
48 |
+
.toc-toggle {
|
49 |
+
position: absolute;
|
50 |
top: 20px;
|
51 |
+
right: -20px;
|
52 |
+
width: 40px;
|
53 |
+
height: 40px;
|
54 |
background: #3b82f6;
|
55 |
color: white;
|
56 |
border: none;
|
57 |
+
border-radius: 0 6px 6px 0;
|
|
|
|
|
58 |
cursor: pointer;
|
59 |
display: flex;
|
60 |
align-items: center;
|
61 |
justify-content: center;
|
62 |
+
font-size: 16px;
|
63 |
+
z-index: 101;
|
64 |
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
.toc-sidebar h3 {
|
|
|
114 |
padding-left: 32px;
|
115 |
}
|
116 |
|
117 |
+
/* Main content area - always centered */
|
118 |
.main-content {
|
|
|
119 |
max-width: 896px;
|
120 |
+
margin: 0 auto;
|
121 |
+
padding: 32px 48px;
|
122 |
width: 100%;
|
123 |
}
|
124 |
|
125 |
+
/* Content wrapper */
|
126 |
+
.content-wrapper {
|
127 |
+
flex: 1;
|
128 |
+
display: flex;
|
129 |
+
justify-content: center;
|
130 |
+
min-height: 100vh;
|
131 |
}
|
132 |
|
133 |
+
/* Typography - Hugging Face style */
|
134 |
h1 {
|
135 |
font-size: 2.25rem;
|
136 |
font-weight: 700;
|
|
|
292 |
transform: scale(1.1);
|
293 |
}
|
294 |
|
295 |
+
/* Custom styled boxes */
|
296 |
div[style*="border: 2px solid black"] {
|
297 |
border: 1px solid #e5e7eb !important;
|
298 |
border-radius: 0.75rem !important;
|
|
|
312 |
@media (max-width: 1024px) {
|
313 |
.toc-sidebar {
|
314 |
transform: translateX(-100%);
|
|
|
315 |
}
|
316 |
|
317 |
.toc-sidebar.open {
|
318 |
transform: translateX(0);
|
319 |
}
|
320 |
|
|
|
|
|
|
|
|
|
321 |
.main-content {
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
padding: 16px;
|
323 |
}
|
324 |
|
|
|
327 |
position: fixed;
|
328 |
top: 16px;
|
329 |
left: 16px;
|
330 |
+
z-index: 102;
|
331 |
background: #3b82f6;
|
332 |
color: white;
|
333 |
border: none;
|
|
|
343 |
</style>
|
344 |
</head>
|
345 |
<body>
|
346 |
+
<div class="layout">
|
347 |
<!-- TOC Sidebar -->
|
348 |
+
<aside class="toc-sidebar" id="toc-sidebar">
|
349 |
+
<button class="toc-toggle" onclick="toggleTOC()" id="toc-toggle">◀</button>
|
350 |
+
<h3>Table of Contents</h3>
|
351 |
+
<div id="toc-content">
|
352 |
+
<!-- TOC will be generated here -->
|
353 |
+
</div>
|
354 |
+
</aside>
|
355 |
|
356 |
<!-- Mobile TOC Toggle -->
|
357 |
+
<button class="mobile-toc-toggle" onclick="toggleMobileTOC()">☰ TOC</button>
|
358 |
+
|
359 |
+
<!-- Main Content Wrapper -->
|
360 |
+
<div class="content-wrapper">
|
361 |
+
<main class="main-content">
|
362 |
+
<div id="loading">Loading...</div>
|
363 |
+
<div id="content"></div>
|
364 |
+
</main>
|
365 |
+
</div>
|
366 |
</div>
|
367 |
|
368 |
<script>
|
|
|
381 |
.replace(/-+/g, '-')
|
382 |
.replace(/^-|-$/g, '');
|
383 |
|
|
|
384 |
heading.id = id;
|
385 |
|
386 |
const tocClass = `toc-level-${level}`;
|
|
|
392 |
}
|
393 |
|
394 |
function setActiveLink(clickedLink) {
|
|
|
395 |
document.querySelectorAll('.toc-sidebar a').forEach(link => {
|
396 |
link.classList.remove('active');
|
397 |
});
|
|
|
398 |
clickedLink.classList.add('active');
|
399 |
}
|
400 |
|
401 |
function toggleTOC() {
|
|
|
|
|
|
|
|
|
402 |
const sidebar = document.getElementById('toc-sidebar');
|
403 |
+
const btn = document.getElementById('toc-toggle');
|
|
|
|
|
404 |
|
405 |
+
sidebar.classList.toggle('collapsed');
|
406 |
+
btn.innerHTML = sidebar.classList.contains('collapsed') ? '▶' : '◀';
|
407 |
+
}
|
408 |
+
|
409 |
+
function toggleMobileTOC() {
|
410 |
+
document.getElementById('toc-sidebar').classList.toggle('open');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
}
|
412 |
|
|
|
413 |
function highlightCurrentSection() {
|
414 |
const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
415 |
const tocLinks = document.querySelectorAll('.toc-sidebar a');
|
|
|
444 |
const contentDiv = document.getElementById('content');
|
445 |
contentDiv.innerHTML = html;
|
446 |
|
|
|
447 |
generateTOC(contentDiv);
|
|
|
448 |
document.getElementById('loading').style.display = 'none';
|
|
|
|
|
449 |
window.addEventListener('scroll', highlightCurrentSection);
|
450 |
|
451 |
} catch (error) {
|