-
+ {% for p in series_sorted %}
+
- + {{ p.extra.series_index }} + {% if p.permalink == page.permalink %} + {{ p.title }} + {% else %} + {{ p.title }} + {% endif %} + + {% endfor %} +
diff --git a/TODO.md b/TODO.md index 3fe6f01..c1b52b6 100644 --- a/TODO.md +++ b/TODO.md @@ -2,4 +2,4 @@ ## Features & Content -- [ ] **Post Series Support** — Add a `series` front-matter field to automatically group related tutorials (e.g., "Buffer Overflows Part 1, 2, 3") and render a "Part N of X" navigation box. +- [x] **Post Series Support** — Add a `series` front-matter field to automatically group related tutorials (e.g., "Buffer Overflows Part 1, 2, 3") and render a "Part N of X" navigation box. diff --git a/sass/_404.scss b/sass/_404.scss index 7454faa..c064aca 100644 --- a/sass/_404.scss +++ b/sass/_404.scss @@ -1,4 +1,31 @@ // 404 Terminal Page +// Scoped custom properties switch with html.dark + +.term-window { + // Dark mode values (default — site defaults to dark) + --tw-bg: #0d0d0d; + --tw-bar: #1c1c1c; + --tw-border: #2a2a2a; + --tw-text: #cdd6f4; + --tw-prompt: #10b981; + --tw-error: #f38ba8; + --tw-muted: #6c7086; + --tw-link: #89b4fa; + --tw-cursor: #10b981; +} + +html:not(.dark) .term-window { + // Light mode: Catppuccin Latte palette + --tw-bg: #eff1f5; + --tw-bar: #e6e9ef; + --tw-border: #ccd0da; + --tw-text: #4c4f69; + --tw-prompt: #40a02b; + --tw-error: #d20f39; + --tw-muted: #7c7f93; + --tw-link: #1e66f5; + --tw-cursor: #40a02b; +} .notfound-wrap { min-height: 70dvh; @@ -11,22 +38,23 @@ .term-window { width: 100%; max-width: 680px; - background: #0d0d0d; + background: var(--tw-bg); border-radius: 10px; - border: 1px solid #2a2a2a; - box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7); + border: 1px solid var(--tw-border); + box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4); overflow: hidden; font-family: var(--font-mono); font-size: clamp(0.78rem, 1.5vw, 0.9rem); + transition: background-color 0.3s ease, border-color 0.3s ease; } .term-titlebar { - background: #1c1c1c; + background: var(--tw-bar); padding: 0.7rem 1rem; display: flex; align-items: center; gap: 0.75rem; - border-bottom: 1px solid #2a2a2a; + border-bottom: 1px solid var(--tw-border); user-select: none; } @@ -50,48 +78,48 @@ flex: 1; text-align: center; font-size: 0.72rem; - color: #555; + color: var(--tw-muted); letter-spacing: 0.03em; } .term-body { padding: 1.5rem; line-height: 1.65; - color: #cdd6f4; + color: var(--tw-text); min-height: 260px; } .term-row { display: flex; align-items: baseline; - gap: 0.6ch; + gap: 0; white-space: nowrap; overflow: hidden; } .term-ps1 { - color: #10b981; + color: var(--tw-prompt); flex-shrink: 0; white-space: nowrap; pointer-events: none; } .term-input { - color: #cdd6f4; + color: var(--tw-text); overflow: hidden; } .term-out { - padding-left: 0; margin-bottom: 0.9rem; } .term-out-error { - color: #f38ba8; + color: var(--tw-error); } .term-out-muted { - color: #6c7086; + color: var(--tw-muted); + margin-bottom: 0.9rem; } .term-out-ls { @@ -101,17 +129,17 @@ margin-bottom: 0.9rem; a { - color: #89b4fa; + color: var(--tw-link); text-decoration: none; font-weight: 500; &::before { content: '→ '; - color: #10b981; + color: var(--tw-prompt); } &:hover { - color: #10b981; + color: var(--tw-prompt); text-decoration: underline; } } @@ -121,7 +149,7 @@ display: inline-block; width: 0.55em; height: 1.1em; - background: #10b981; + background: var(--tw-cursor); vertical-align: text-bottom; animation: blink-cursor 1s step-end infinite; margin-left: 0.15ch; diff --git a/sass/_article.scss b/sass/_article.scss index fad9db6..2a6e368 100644 --- a/sass/_article.scss +++ b/sass/_article.scss @@ -95,6 +95,98 @@ } } +// ────────────────────────────────────────── +// Series Navigation Box +// ────────────────────────────────────────── +.series-nav { + background: var(--surface-color); + border: 1px solid var(--border-color); + border-left: 3px solid var(--accent-color); + border-radius: 12px; + padding: 1.25rem 1.5rem; + margin-bottom: 2rem; +} + +.series-nav-header { + display: flex; + align-items: baseline; + flex-wrap: wrap; + gap: 0.4rem 0.75rem; + margin-bottom: 1rem; +} + +.series-nav-eyebrow { + font-family: var(--font-mono); + font-size: 0.7rem; + text-transform: uppercase; + letter-spacing: 0.1em; + color: var(--accent-color); + opacity: 0.8; +} + +.series-nav-title { + font-weight: 600; + font-size: 0.95rem; + color: var(--heading-color, var(--text-color)); + flex: 1; +} + +.series-nav-badge { + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--text-muted); + background: var(--bg-color); + border: 1px solid var(--border-color); + border-radius: 99px; + padding: 0.1em 0.6em; + white-space: nowrap; +} + +.series-nav-list { + list-style: none; + padding: 0; + margin: 0; + display: flex; + flex-direction: column; + gap: 0.4rem; +} + +.series-nav-item { + display: flex; + align-items: baseline; + gap: 0.75rem; + + &.is-current { + .series-nav-index { + color: var(--accent-color); + } + .series-nav-label { + color: var(--text-color); + font-weight: 600; + } + } +} + +.series-nav-index { + font-family: var(--font-mono); + font-size: 0.7rem; + color: var(--text-muted); + opacity: 0.6; + flex-shrink: 0; + width: 1.5ch; + text-align: right; +} + +.series-nav-label { + font-size: 0.9rem; + color: var(--text-muted); + text-decoration: none; + + &:hover { + color: var(--accent-color); + } +} + .post-toc { background: var(--surface-color); border: 1px solid var(--border-color); diff --git a/static/js/404.js b/static/js/404.js new file mode 100644 index 0000000..bc49082 --- /dev/null +++ b/static/js/404.js @@ -0,0 +1,103 @@ +(function () { + 'use strict'; + + var body = document.getElementById('term-body'); + if (!body) return; + + var path = window.location.pathname; + + var links = [ + { href: body.dataset.linkHome, label: '~/home' }, + { href: body.dataset.linkPosts, label: '~/posts' }, + { href: body.dataset.linkTags, label: '~/tags' } + ]; + + var steps = [ + { type: 'cmd', text: 'cd ' + path }, + { type: 'out-error', text: 'bash: cd: ' + path + ': No such file or directory' }, + { type: 'cmd', text: 'whoami' }, + { type: 'out', text: 'l0st_r3ader' }, + { type: 'cmd', text: 'ls ~/recovery/' }, + { type: 'ls' } + ]; + + var CHAR_DELAY = 28; + var LINE_DELAY = 180; + + function ps1() { + var s = document.createElement('span'); + s.className = 'term-ps1'; + s.textContent = 'user@blackout:~$ '; + return s; + } + + function appendCmdLine(text, callback) { + var row = document.createElement('div'); + row.className = 'term-row'; + row.appendChild(ps1()); + var input = document.createElement('span'); + input.className = 'term-input'; + row.appendChild(input); + body.appendChild(row); + + var i = 0; + function tick() { + if (i < text.length) { + input.textContent += text[i++]; + setTimeout(tick, CHAR_DELAY); + } else { + setTimeout(callback, LINE_DELAY); + } + } + tick(); + } + + function appendOut(text, extraClass, callback) { + var div = document.createElement('div'); + div.className = 'term-out' + (extraClass ? ' ' + extraClass : ''); + div.textContent = text; + body.appendChild(div); + setTimeout(callback, LINE_DELAY); + } + + function appendLs(callback) { + var div = document.createElement('div'); + div.className = 'term-out-ls'; + links.forEach(function (l) { + var a = document.createElement('a'); + a.href = l.href; + a.textContent = l.label; + div.appendChild(a); + }); + body.appendChild(div); + setTimeout(callback, LINE_DELAY); + } + + function appendCursor() { + var row = document.createElement('div'); + row.className = 'term-row'; + row.appendChild(ps1()); + var cur = document.createElement('span'); + cur.className = 'term-cursor'; + cur.setAttribute('aria-hidden', 'true'); + row.appendChild(cur); + body.appendChild(row); + } + + function runSteps(i) { + if (i >= steps.length) { + appendCursor(); + return; + } + var step = steps[i]; + var next = function () { runSteps(i + 1); }; + + if (step.type === 'cmd') appendCmdLine(step.text, next); + else if (step.type === 'out-error') appendOut(step.text, 'term-out-error', next); + else if (step.type === 'out') appendOut(step.text, 'term-out-muted', next); + else if (step.type === 'ls') appendLs(next); + else next(); + } + + runSteps(0); +})(); diff --git a/templates/404.html b/templates/404.html index cc495c9..1e2cf37 100644 --- a/templates/404.html +++ b/templates/404.html @@ -16,135 +16,17 @@ -