-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClogReader.html
More file actions
784 lines (659 loc) · 38.2 KB
/
ClogReader.html
File metadata and controls
784 lines (659 loc) · 38.2 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
<!-- SEO Meta Tags -->
<meta name="theme-color" content="#f44234">
<meta name="title" content="The Core Log | MainRoute Core" />
<meta name="description" content="Technical deep-dives, architecture updates, and engineering logs from MainRoute Core." />
<!-- Icons & Manifest -->
<link rel="icon" type="image/png" sizes="192x192" href="https://avatars.githubusercontent.com/u/249983472?s=192&v=4">
<link href="https://avatars.githubusercontent.com/u/249983472?s=180&v=4" rel="apple-touch-icon" sizes="180x180" />
<title>The Core Log | MainRoute Core</title>
<!-- Custom Font -->
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link href="https://cdn.jsdelivr.net/gh/MainRoute-Core/CoreSans@main/CoreSans-Regular_en.otf" rel="stylesheet">
<!-- Marked.js Markdown Parser -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/9.1.6/marked.min.js"></script>
<!-- GitHub Styled Markdown CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.5.1/github-markdown.min.css">
<style>
@font-face {
font-family: 'Core Sans';
src: url(https://cdn.jsdelivr.net/gh/MainRoute-Core/CoreSans@main/CoreSans-Regular_en.otf);
font-display: swap;
}
:root {
/* Core Colors */
--mrc: #f44234;
--mrc-light: #ff7063;
--mrc-glow: rgba(244, 66, 52, 0.4);
--danger: #ef4444;
--danger-glow: rgba(239, 68, 68, 0.2);
--success: #10b981;
--info: #3b82f6;
--warn: #f59e0b;
/* Material Dark Theme */
--bg-dark: #09090b;
--bg-surface: #111115;
--bg-surface-elevated: #1d1d24;
/* Text */
--text-main: #f8fafc;
--text-muted: #94a3b8;
/* Glassmorphism */
--glass-bg: rgba(17, 17, 21, 0.7);
--glass-border: rgba(255, 255, 255, 0.06);
--glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
/* Typography */
--font-sans: 'Core Sans', system-ui, -apple-system, sans-serif;
--font-mono: 'Space Mono', ui-monospace, monospace;
--nav-height: 80px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
font-family: var(--font-sans); background-color: var(--bg-dark);
color: var(--text-main); overflow-x: hidden;
-webkit-font-smoothing: antialiased; line-height: 1.6;
}
a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
img, svg { max-width: 100%; display: block; }
button, input, select { font-family: inherit; }
.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.text-mrc { color: var(--mrc); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }
/* Loading Screen */
#loader {
position: fixed; inset: 0; z-index: 99999; background: var(--bg-dark);
display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1rem;
transition: opacity 0.4s ease, visibility 0.4s;
}
.loader-ring {
width: 50px; height: 50px; border: 3px solid var(--glass-border);
border-top-color: var(--mrc); border-radius: 50%; animation: spin 1s linear infinite;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes spin { 100% { transform: rotate(360deg); } }
/* Background Effects */
.tech-grid {
position: fixed; inset: 0; z-index: 0; pointer-events: none;
background-image: linear-gradient(var(--glass-border) 1px, transparent 1px), linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
background-size: 40px 40px; mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
-webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
}
.ambient-orb {
position: fixed; border-radius: 50%; filter: blur(120px); opacity: 0.12; z-index: -1; background: var(--mrc);
}
/* Glassmorphism Panel */
.glass-panel {
background: var(--glass-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
border: 1px solid var(--glass-border); border-radius: 1rem; box-shadow: var(--glass-shadow);
}
/* Navigation */
.header { position: fixed; top: 1rem; left: 1rem; right: 1rem; z-index: 100; transition: transform 0.3s ease; }
@media (min-width: 1024px) { .header { top: 1.5rem; left: 2rem; right: 2rem; } }
.nav-bar { padding: 0.75rem 1.5rem; border-radius: 9999px; display: flex; justify-content: space-between; align-items: center; }
.nav-logo { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 900; letter-spacing: -0.05em; }
.nav-logo img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--mrc); }
.system-status { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-family: var(--font-mono); color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
/* Core Layout Architecture */
#list-view { padding-top: calc(var(--nav-height) + 5rem); max-width: 1240px; margin: 0 auto; position: relative; z-index: 10; min-height: 100vh; padding-bottom: 4rem; }
.layout-container { display: flex; gap: 2rem; padding: 0 1.5rem; }
.content-area { flex: 1; }
.sidebar { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.blog-controls {
display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
margin-bottom: 2rem;
}
.search-box { position: relative; flex-grow: 1; max-width: 100%; }
.search-box input {
width: 100%; padding: 0.8rem 1rem 0.8rem 2.8rem; border-radius: 99px;
background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border);
color: white; outline: none; transition: all 0.3s ease; font-family: inherit;
}
.search-box input:focus { border-color: var(--mrc); background: rgba(244,66,52,0.03); box-shadow: 0 0 15px var(--mrc-glow); }
.search-box svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 1.1rem; }
.mobile-filter-btn { display: none; }
/* Sidebar Widgets */
.sidebar-widget { padding: 1.5rem; }
.sidebar-widget h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono); color: var(--text-muted); margin-bottom: 1rem; border-bottom: 1px dashed var(--glass-border); padding-bottom: 0.5rem; }
.sidebar-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: all 0.2s; font-weight: 500; }
.sidebar-item:hover { background: rgba(255,255,255,0.04); color: white; }
.sidebar-item.active { background: rgba(244,66,52,0.08); color: var(--mrc); border-left: 3px solid var(--mrc); }
.sidebar-count { background: rgba(255,255,255,0.05); font-family: var(--font-mono); font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; color: var(--text-muted); }
.tags-wrapper { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
font-family: var(--font-mono); font-size: 0.7rem; padding: 0.4rem 0.8rem;
border-radius: 99px; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.tag:hover { background: rgba(255,255,255,0.08); color: white; border-color: rgba(255,255,255,0.2); }
.tag.active { background: rgba(244,66,52,0.1); color: var(--mrc); border-color: rgba(244,66,52,0.3); }
/* Blog Grid */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.card {
padding: 1.8rem; display: flex; flex-direction: column; cursor: pointer; transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; background: rgba(24, 24, 27, 0.4);
}
.card:hover { transform: translateY(-5px); border-color: var(--mrc); box-shadow: 0 8px 24px rgba(244, 66, 52, 0.1); }
.card.status-not { cursor: not-allowed; opacity: 0.7; border-color: var(--danger-glow); }
.card.status-not:hover { transform: none; border-color: var(--danger); box-shadow: 0 0 20px var(--danger-glow); }
.card-top-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-status { font-size: 0.62rem; font-weight: 800; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; padding: 0.3rem 0.6rem; border-radius: 4px; display: inline-block; }
.status-pub { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-not { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.card-cat { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--mrc-light); letter-spacing: 0.05em; }
.card-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.5rem; line-height: 1.3; color: white; }
.card-desc { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 1.5rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; border-top: 1px solid var(--glass-border); padding-top: 1rem; font-size: 0.78rem; font-family: var(--font-mono); color: var(--text-muted); }
/* Configuration Diagnostic Panel overlay */
.config-bar { display: none; margin: 0 1.5rem 1.5rem 1.5rem; padding: 1rem; font-size: 0.85rem; border: 1px dashed var(--warn); background: rgba(245, 158, 11, 0.05); color: #fde68a; }
.config-bar span { font-weight: bold; }
/* --- Full Blog Reader View --- */
#full-view {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
background: var(--bg-dark); z-index: 1000; overflow-y: auto; overflow-x: hidden;
opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#full-view.active { opacity: 1; visibility: visible; transform: translateY(0); }
.reader-nav {
position: sticky; top: 0; width: 100%; background: rgba(9, 9, 11, 0.9);
backdrop-filter: blur(12px); border-bottom: 1px solid var(--glass-border);
padding: 1rem 2rem; z-index: 101; display: flex; align-items: center;
}
.back-btn {
background: transparent; color: white; border: 1px solid var(--glass-border);
padding: 0.6rem 1.2rem; border-radius: 99px; cursor: pointer; display: flex; align-items: center; gap: 8px;
font-size: 0.8rem; font-weight: 700; text-transform: uppercase; transition: 0.3s;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
.reader-progress-container { position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: transparent; }
.reader-progress { height: 100%; width: 0%; background: var(--mrc); box-shadow: 0 0 10px var(--mrc-glow); }
.article-container { max-width: 800px; margin: 0 auto; padding: 4rem 1.5rem 8rem; }
.hero-img { width: 100%; height: 400px; object-fit: cover; border-radius: 1.5rem; margin-bottom: 2.5rem; border: 1px solid var(--glass-border); }
.article-title { font-size: clamp(2.3rem, 5vw, 3.8rem); font-weight: 900; line-height: 1.1; margin-bottom: 1rem; letter-spacing: -0.02em; color: white; }
.article-meta { display: flex; flex-wrap: wrap; gap: 1rem 2rem; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.85rem; padding-bottom: 2rem; border-bottom: 1px solid var(--glass-border); margin-bottom: 2rem; }
/* Markdown Overrides to fit Theme styling */
.markdown-body {
box-sizing: border-box; min-width: 200px; max-width: 980px; margin: 0 auto; padding: 0;
background: transparent !important; color: #cbd5e1 !important; font-family: var(--font-sans) !important;
font-size: 1.05rem; line-height: 1.8;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: #fff !important; font-weight: 800; border-bottom-color: var(--glass-border) !important; }
.markdown-body h2 { font-size: 1.8rem; margin-top: 2.5rem; padding-bottom: 0.3rem; }
.markdown-body h3 { font-size: 1.4rem; }
.markdown-body p { margin-bottom: 1.5rem; }
.markdown-body a { color: var(--mrc) !important; text-decoration: underline; text-underline-offset: 4px; }
.markdown-body a:hover { color: var(--mrc-light) !important; }
.markdown-body pre { background-color: #000 !important; border: 1px solid var(--glass-border) !important; border-radius: 1rem !important; padding: 1.5rem !important; }
.markdown-body code { background-color: rgba(255, 255, 255, 0.08) !important; color: #f8fafc !important; font-family: var(--font-mono) !important; font-size: 0.85em !important; border-radius: 4px; padding: 0.2rem 0.4rem !important; }
.markdown-body pre code { background: transparent !important; padding: 0 !important; border-radius: 0; }
.markdown-body blockquote { border-left: 4px solid var(--mrc) !important; color: var(--text-muted) !important; padding-left: 1.5rem !important; margin: 2rem 0 !important; font-style: italic; }
.markdown-body img { border-radius: 1rem; border: 1px solid var(--glass-border); margin: 2rem auto; display: block; }
.markdown-body table tr { background-color: var(--bg-dark) !important; border-top-color: var(--glass-border) !important; }
.markdown-body table tr:nth-child(2n) { background-color: var(--bg-surface) !important; }
.markdown-body table td, .markdown-body table th { border-color: var(--glass-border) !important; padding: 0.75rem 1rem !important; }
.markdown-body table th { color: #fff !important; background-color: rgba(255, 255, 255, 0.04) !important; }
/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(244, 66, 52, 0.5); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--mrc); }
/* Responsive Breakpoints */
@media (max-width: 1023px) {
.layout-container { flex-direction: column; }
.sidebar { width: 100%; display: none; order: -1; }
.sidebar.active-mobile { display: flex; }
.blog-controls { gap: 0.75rem; }
.search-box { flex-basis: 100%; }
.mobile-filter-btn { display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border); padding: 0.8rem 1.5rem; border-radius: 99px; color: white; cursor: pointer; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; gap: 0.5rem; transition: 0.2s; flex-grow: 1; }
.mobile-filter-btn:hover { background: rgba(255,255,255,0.06); }
}
</style>
</head>
<body>
<!-- Inline SVG Icons -->
<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
<symbol id="icon-search" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></symbol>
<symbol id="icon-filter" viewBox="0 0 24 24"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"></polygon></symbol>
<symbol id="icon-arrow-left" viewBox="0 0 24 24"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></symbol>
<symbol id="icon-lock" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></symbol>
<symbol id="icon-book-open" viewBox="0 0 24 24"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"></path><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"></path></symbol>
</svg>
<!-- Initial Loader -->
<div id="loader">
<div class="loader-ring"></div>
<div class="font-mono text-mrc font-bold tracking-widest text-sm uppercase">Loading Repository Logs...</div>
</div>
<!-- Ambient Backgrounds -->
<div class="tech-grid"></div>
<div class="ambient-orb" style="width: 40vw; height: 40vw; top: -10%; left: -10%;"></div>
<!-- Navigation -->
<header class="header" id="navbar">
<div class="nav-bar glass-panel">
<a href="./" class="nav-logo" id="home-link">
<img src="https://avatars.githubusercontent.com/u/249983472" alt="MRC Logo">
<span style="color:var(--text-main);">MainRoute <span class="text-mrc">Core</span></span>
</a>
<div class="system-status" id="system-status">
<div class="status-dot"></div> Logs Online
</div>
</div>
</header>
<!-- Main List View -->
<main id="list-view">
<div style="text-align: center; margin-bottom: 3.5rem; padding: 0 1.5rem;">
<h1 class="font-black uppercase" style="font-size: clamp(2.8rem, 6vw, 4.8rem); letter-spacing: -0.05em; line-height: 1; color: white;">The Core <span class="text-mrc">Log.</span></h1>
<p class="text-muted mt-2" style="font-size: 1.05rem;">Engineering documentation, architectural blueprints, and diagnostic updates.</p>
</div>
<!-- Local Diagnostic Fallback Notice -->
<div id="local-diagnostic-bar" class="config-bar glass-panel">
<span>Environment Diagnostic Notice:</span> CORS rules prevent loading local metadata under the <code>file://</code> protocol. Launching a local server or deploying to GitHub fixes this.
</div>
<div class="layout-container">
<!-- Sidebar (Desktop left sidebar / Mobile accordion) -->
<aside class="sidebar" id="sidebar-filters">
<div class="sidebar-widget glass-panel">
<h3>Categories</h3>
<ul class="sidebar-list" id="category-list">
<!-- Dynamic Categories Injection -->
</ul>
</div>
<div class="sidebar-widget glass-panel">
<h3>Tags</h3>
<div class="tags-wrapper" id="tag-cloud">
<!-- Dynamic Tag Injection -->
</div>
</div>
</aside>
<!-- Main Blog Grid area -->
<section class="content-area">
<div class="blog-controls">
<div class="search-box">
<svg class="icon"><use href="#icon-search"></use></svg>
<input type="text" id="search" placeholder="Search architecture, terms, tags...">
</div>
<button class="mobile-filter-btn" id="mobile-filter-toggle">
<svg class="icon"><use href="#icon-filter"></use></svg> Filter Panel
</button>
</div>
<div class="blog-grid" id="grid">
<!-- Dynamic Grid Card Injections -->
</div>
</section>
</div>
</main>
<!-- Full Reader View -->
<div id="full-view">
<div class="reader-nav">
<button class="back-btn" id="backBtn">
<svg class="icon"><use href="#icon-arrow-left"></use></svg> Return
</button>
<div class="reader-progress-container">
<div class="reader-progress" id="read-progress"></div>
</div>
</div>
<article class="article-container" id="articleBody">
<!-- Dynamic Markdown Compiled HTML Injection -->
</article>
</div>
<!-- VANILLA JS APP CONTROL LOGIC -->
<script>
// --- 1. CONFIGURATION INTERACTION PATHS ---
// Dynamically detects if run inside a local workspace environment or on a server
const isLocalHost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
const isLocalFile = window.location.protocol === 'file:';
// Target paths configurations (Modify these parameters for specific GitHub repositories)
const DEFAULT_GITHUB_INDEX = "https://raw.githubusercontent.com/MainRoute-Core/blog/output/blogs.json";
const DEFAULT_GITHUB_CDN_BASE = "https://cdn.jsdelivr.net/gh/MainRoute-Core/blog@main/";
const INDEX_URL = (isLocalHost) ? './blogs.json' : DEFAULT_GITHUB_INDEX;
const CONTENT_BASE_URL = (isLocalHost) ? './' : DEFAULT_GITHUB_CDN_BASE;
let allBlogs = [];
let activeCategory = null;
let activeTag = null;
let activeSearchQuery = "";
// Establish GFM compliant options for marked parser
if (window.marked) {
marked.setOptions({
gfm: true,
breaks: true,
headerIds: true,
mangle: false
});
}
// --- 2. BASE INITIALIZATION & FETCH ROUTING ---
async function initApp() {
// Visual indicators for diagnostic modes
if (isLocalFile) {
document.getElementById('local-diagnostic-bar').style.display = 'block';
}
try {
let res;
try {
res = await fetch(INDEX_URL);
} catch (fetchErr) {
// Fallback to github fetch index if running locally but files are absent
if (isLocalHost || isLocalFile) {
console.warn("Local logs index not discovered. Routing fetch query to remote GitHub CDN fallback...");
res = await fetch(DEFAULT_GITHUB_INDEX);
} else {
throw fetchErr;
}
}
if (!res.ok) throw new Error("Metadata response query failed.");
const rawData = await res.json();
// Schema Normalization and Unpublished ('Un') removal
allBlogs = rawData
.map(normalizeSchema)
.filter(b => b.Status !== 'Un');
// Configure elements and apply URL state query parameters
syncUrlParams();
renderSidebarCategories();
renderSidebarTags();
applyFiltersAndSearch(false);
// Bind home link to safely restore navigation states
document.getElementById('home-link').addEventListener('click', (e) => {
e.preventDefault();
resetFilters();
});
} catch (err) {
console.error("Index load aborted:", err);
document.getElementById('grid').innerHTML = `
<div style="grid-column: 1/-1; padding: 4rem 1.5rem; text-align: center;">
<p class="text-mrc font-bold">Failed to load Core indexes.</p>
<p class="text-muted" style="margin-top: 0.5rem; font-size: 0.9rem;">
Verify if <code>blogs.json</code> path index matches or verify network state options.
</p>
</div>
`;
} finally {
setTimeout(() => {
document.getElementById('loader').classList.add('hidden');
}, 400);
}
}
// --- 3. DATABASE SCHEMA SANITIZATION ---
// Keeps both old Builder indices and the Upgraded Clog Builder outputs functional
function normalizeSchema(b) {
return {
Title: b.Title || b.Name || "Untitled Post",
Desc: b.Desc || b.Description || "No logs summary metadata compiled.",
Author: b.Author || "SYSTEM CORE",
Id: b.Id || b.Article || "",
Tags: Array.isArray(b.Tags) ? b.Tags : (b.SubCat ? b.SubCat : (b.Tags ? b.Tags.split(',').map(s=>s.trim()) : [])),
Categories: Array.isArray(b.Categories) ? b.Categories : (b.Cat ? b.Cat : (b.Categories ? [b.Categories] : [])),
Date: b.Date || "Unknown Date",
Img: b.Img || b.Image || "",
Status: b.Status || "Pub",
Url: b.Url || `blogs/${b.Id || b.Article}.json`
};
}
// --- 4. RENDER PROCEDURES ---
function renderGrid(data) {
const grid = document.getElementById('grid');
if (data.length === 0) {
grid.innerHTML = '<p class="text-muted text-center" style="grid-column: 1/-1; padding: 5rem 0;">No active logs found matching configuration variables.</p>';
return;
}
grid.innerHTML = data.map(b => {
const isNotReady = b.Status === 'Not';
const cardClass = isNotReady ? 'card glass-panel status-not' : 'card glass-panel';
const statusBadge = isNotReady
? `<span class="card-status status-not"><svg class="icon" style="width:10px; height:10px; display:inline; margin-right:4px;"><use href="#icon-lock"></use></svg> Classified</span>`
: `<span class="card-status status-pub"><svg class="icon" style="width:10px; height:10px; display:inline; margin-right:4px;"><use href="#icon-book-open"></use></svg> Published</span>`;
const clickEvent = isNotReady ? '' : `onclick="openArticle('${b.Id}')"`;
const mainCategory = b.Categories[0] || "LOGS";
return `
<div class="${cardClass}" ${clickEvent}>
<div class="card-top-info">
${statusBadge}
<span class="card-cat">${mainCategory}</span>
</div>
<h2 class="card-title">${b.Title}</h2>
<p class="card-desc">${b.Desc}</p>
<div class="card-meta">
<span>DATE: ${b.Date}</span>
<span>BY: ${b.Author}</span>
</div>
</div>`;
}).join('');
}
function renderSidebarCategories() {
const listContainer = document.getElementById('category-list');
// Build unique category inventory with counts mapping
const catMap = {};
allBlogs.forEach(b => {
b.Categories.forEach(cat => {
catMap[cat] = (catMap[cat] || 0) + 1;
});
});
let listHtml = `
<li class="sidebar-item ${!activeCategory ? 'active' : ''}" onclick="selectCategory(null)">
<span>All System Logs</span>
<span class="sidebar-count">${allBlogs.length}</span>
</li>
`;
for (const [cat, count] of Object.entries(catMap)) {
const isActive = (activeCategory === cat) ? 'active' : '';
listHtml += `
<li class="sidebar-item ${isActive}" onclick="selectCategory('${cat}')">
<span>${cat}</span>
<span class="sidebar-count">${count}</span>
</li>
`;
}
listContainer.innerHTML = listHtml;
}
function renderSidebarTags() {
const cloudContainer = document.getElementById('tag-cloud');
const tagsSet = new Set();
allBlogs.forEach(b => b.Tags.forEach(t => tagsSet.add(t)));
let tagsHtml = `
<span class="tag ${!activeTag ? 'active' : ''}" onclick="selectTag(null)">#all</span>
`;
tagsSet.forEach(t => {
const isActive = (activeTag === t) ? 'active' : '';
tagsHtml += `
<span class="tag ${isActive}" onclick="selectTag('${t}')">#${t}</span>
`;
});
cloudContainer.innerHTML = tagsHtml;
}
// --- 5. SEARCH & INTERACTIVE FILTER LOGIC ---
function selectCategory(cat) {
activeCategory = cat;
renderSidebarCategories();
applyFiltersAndSearch(true);
// Smooth scroll up to list start on mobile
if (window.innerWidth < 1024) {
document.getElementById('sidebar-filters').classList.remove('active-mobile');
}
}
function selectTag(tag) {
activeTag = tag;
renderSidebarTags();
applyFiltersAndSearch(true);
if (window.innerWidth < 1024) {
document.getElementById('sidebar-filters').classList.remove('active-mobile');
}
}
function resetFilters() {
activeCategory = null;
activeTag = null;
activeSearchQuery = "";
document.getElementById('search').value = "";
renderSidebarCategories();
renderSidebarTags();
applyFiltersAndSearch(true);
closeArticle(true);
}
function applyFiltersAndSearch(pushToHistory = true) {
let processed = [...allBlogs];
if (activeCategory) {
processed = processed.filter(b => b.Categories.includes(activeCategory));
}
if (activeTag) {
processed = processed.filter(b => b.Tags.includes(activeTag));
}
if (activeSearchQuery) {
const query = activeSearchQuery.toLowerCase();
processed = processed.filter(b =>
b.Title.toLowerCase().includes(query) ||
b.Desc.toLowerCase().includes(query) ||
b.Author.toLowerCase().includes(query) ||
b.Tags.some(t => t.toLowerCase().includes(query)) ||
b.Categories.some(c => c.toLowerCase().includes(query))
);
}
renderGrid(processed);
if (pushToHistory) {
updateUrlParams();
}
}
// Real-time search query inputs bind
document.getElementById('search').addEventListener('input', (e) => {
activeSearchQuery = e.target.value.trim();
applyFiltersAndSearch(true);
});
// Toggle filters dashboard on mobile
document.getElementById('mobile-filter-toggle').addEventListener('click', () => {
document.getElementById('sidebar-filters').classList.toggle('active-mobile');
});
// --- 6. ROUTING & URL SYNC CONTROL STATE ---
function syncUrlParams() {
const params = new URLSearchParams(window.location.search);
const query = params.get('q');
const category = params.get('cat');
const tag = params.get('tag');
const logId = params.get('log');
if (query) {
activeSearchQuery = query;
document.getElementById('search').value = query;
}
if (category) activeCategory = category;
if (tag) activeTag = tag;
if (logId) {
openArticle(logId, false);
}
}
function updateUrlParams() {
const params = new URLSearchParams();
if (activeSearchQuery) params.set('q', activeSearchQuery);
if (activeCategory) params.set('cat', activeCategory);
if (activeTag) params.set('tag', activeTag);
const currentLog = new URLSearchParams(window.location.search).get('log');
if (currentLog) params.set('log', currentLog);
const searchStr = params.toString();
const newUrl = searchStr ? `?${searchStr}` : window.location.pathname;
window.history.replaceState({ activeCategory, activeTag, activeSearchQuery }, '', newUrl);
}
// --- 7. DEEP ARTICLE LOAD & RENDERING ENGINE ---
async function openArticle(id, pushState = true) {
const blog = allBlogs.find(b => b.Id === id);
if (!blog) return;
// Push article log variables to parameter structures
if (pushState) {
const params = new URLSearchParams(window.location.search);
params.set('log', id);
window.history.pushState({ id }, blog.Title, `?${params.toString()}`);
}
const loader = document.getElementById('loader');
loader.classList.remove('hidden');
try {
let targetUrl = `${CONTENT_BASE_URL}${blog.Url}`;
let res;
try {
res = await fetch(targetUrl);
} catch (fetchErr) {
// Failover path diagnostics for localhost checks
if (isLocalHost || isLocalFile) {
const directLocalPath = `./${blog.Url}`;
console.warn(`Local file target unreachable via remote path. Trying alternative mapping: ${directLocalPath}`);
res = await fetch(directLocalPath);
} else {
throw fetchErr;
}
}
if (!res.ok) throw new Error("Document retrieval failure.");
const post = await res.json();
renderFullPost(post, blog);
// Reveal full article overlay
document.getElementById('full-view').classList.add('active');
document.getElementById('full-view').scrollTo(0, 0);
document.body.style.overflow = 'hidden';
} catch (err) {
console.error("Reader load aborted:", err);
alert("Core System Error: Failed to retrieve or parse targeted log. Target resource may be missing.");
} finally {
loader.classList.add('hidden');
}
}
function renderFullPost(post, metadata) {
const container = document.getElementById('articleBody');
const title = post.Title || metadata.Title;
const date = post.Date || metadata.Date;
const author = post.Author || metadata.Author;
const banner = post.Img || metadata.Img;
const bannerHtml = banner
? `<img src="${banner}" alt="Hero Image" class="hero-img" onerror="this.style.display='none'">`
: '';
// Extract content from schema output configurations
const rawBodyMarkdown = post.Data || post.content || "";
let htmlContent = "";
if (window.marked) {
htmlContent = marked.parse(rawBodyMarkdown);
} else {
htmlContent = `<p class="text-mrc">Markdown rendering parser (marked.js) was blocked from execution. Raw Data:</p><pre>${rawBodyMarkdown}</pre>`;
}
container.innerHTML = `
${bannerHtml}
<h1 class="article-title">${title}</h1>
<div class="article-meta">
<span><strong style="color:var(--text-main)">DATE:</strong> ${date}</span>
<span><strong style="color:var(--text-main)">AUTHOR:</strong> ${author}</span>
</div>
<div class="markdown-body">
${htmlContent || '<p class="text-muted">Empty log context payload received.</p>'}
</div>
`;
}
function closeArticle(pushState = true) {
document.getElementById('full-view').classList.remove('active');
document.body.style.overflow = ''; // Release scroll lock
if (pushState) {
const params = new URLSearchParams(window.location.search);
params.delete('log');
const searchStr = params.toString();
const newUrl = searchStr ? `?${searchStr}` : window.location.pathname;
window.history.pushState({}, '', newUrl);
}
}
// Navigation back button click bind
document.getElementById('backBtn').addEventListener('click', () => closeArticle(true));
// Window browser navigation popstate tracking bind
window.addEventListener('popstate', (e) => {
const params = new URLSearchParams(window.location.search);
const logId = params.get('log');
if (logId) {
openArticle(logId, false);
} else {
closeArticle(false);
}
});
// Reader Scroll Progress Engine
const fullView = document.getElementById('full-view');
const progressBar = document.getElementById('read-progress');
fullView.addEventListener('scroll', () => {
const scrollTop = fullView.scrollTop;
const scrollHeight = fullView.scrollHeight - fullView.clientHeight;
const scrollPercentage = scrollHeight > 0 ? (scrollTop / scrollHeight) * 100 : 0;
progressBar.style.width = scrollPercentage + '%';
});
// Initialize execution setup
initApp();
</script>
</body>
</html>