.
This commit is contained in:
parent
c4dcb6e38b
commit
531029a18f
129 changed files with 7765 additions and 6938 deletions
9
static/css/dark.css
Normal file
9
static/css/dark.css
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* import common css */
|
||||
@import url("main.css");
|
||||
@import url("syntax.css");
|
||||
|
||||
/* define colors */
|
||||
:root {
|
||||
--bg: black;
|
||||
--fg: white;
|
||||
}
|
||||
9
static/css/light.css
Normal file
9
static/css/light.css
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* import common css */
|
||||
@import url("main.css");
|
||||
@import url("syntax.css");
|
||||
|
||||
/* define colors */
|
||||
:root {
|
||||
--bg: white;
|
||||
--fg: black;
|
||||
}
|
||||
95
static/css/main.css
Normal file
95
static/css/main.css
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/* ===== Base Reset ===== */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
line-height: 1.6;
|
||||
background-color: var(--bg);
|
||||
color: var(--fg);
|
||||
padding: 0 1rem;
|
||||
/* layout */
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* ===== Typography ===== */
|
||||
h1, h2, h3, h4 {
|
||||
line-height: 1.3;
|
||||
font-weight: 600;
|
||||
margin: 1.5rem 0 0.75rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1.3rem;
|
||||
}
|
||||
|
||||
/* ===== Images ===== */
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* ===== Navigation ===== */
|
||||
nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin: 0.5rem;
|
||||
}
|
||||
|
||||
.home {
|
||||
font-size: 24px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toggle-button {
|
||||
font-size: 24px;
|
||||
border: none;
|
||||
background-color: var(--bg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toggle-button:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
/* .search-container { */
|
||||
/* text-align: center; */
|
||||
/* } */
|
||||
|
||||
#search {
|
||||
width: 100%;
|
||||
background-color: var(--bg);
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
/* #results li { */
|
||||
/* list-style: none; */
|
||||
/* padding: 20px; */
|
||||
/* font-size: 1.2rem; */
|
||||
/* } */
|
||||
|
||||
footer {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ===== Responsive ===== */
|
||||
@media (min-width: 768px) {
|
||||
body {
|
||||
padding: 0 2rem;
|
||||
}
|
||||
nav {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
59
static/css/syntax.css
Normal file
59
static/css/syntax.css
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* Background */ .chroma { color: #f8f8f2; background-color: #272822 }
|
||||
/* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
|
||||
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
|
||||
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
|
||||
/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
|
||||
/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||
/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||
/* Keyword */ .chroma .k { color: #66d9ef }
|
||||
/* KeywordConstant */ .chroma .kc { color: #66d9ef }
|
||||
/* KeywordDeclaration */ .chroma .kd { color: #66d9ef }
|
||||
/* KeywordNamespace */ .chroma .kn { color: #f92672 }
|
||||
/* KeywordPseudo */ .chroma .kp { color: #66d9ef }
|
||||
/* KeywordReserved */ .chroma .kr { color: #66d9ef }
|
||||
/* KeywordType */ .chroma .kt { color: #66d9ef }
|
||||
/* NameAttribute */ .chroma .na { color: #a6e22e }
|
||||
/* NameClass */ .chroma .nc { color: #a6e22e }
|
||||
/* NameConstant */ .chroma .no { color: #66d9ef }
|
||||
/* NameDecorator */ .chroma .nd { color: #a6e22e }
|
||||
/* NameException */ .chroma .ne { color: #a6e22e }
|
||||
/* NameFunction */ .chroma .nf { color: #a6e22e }
|
||||
/* NameOther */ .chroma .nx { color: #a6e22e }
|
||||
/* NameTag */ .chroma .nt { color: #f92672 }
|
||||
/* Literal */ .chroma .l { color: #ae81ff }
|
||||
/* LiteralDate */ .chroma .ld { color: #e6db74 }
|
||||
/* LiteralString */ .chroma .s { color: #e6db74 }
|
||||
/* LiteralStringAffix */ .chroma .sa { color: #e6db74 }
|
||||
/* LiteralStringBacktick */ .chroma .sb { color: #e6db74 }
|
||||
/* LiteralStringChar */ .chroma .sc { color: #e6db74 }
|
||||
/* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 }
|
||||
/* LiteralStringDoc */ .chroma .sd { color: #e6db74 }
|
||||
/* LiteralStringDouble */ .chroma .s2 { color: #e6db74 }
|
||||
/* LiteralStringEscape */ .chroma .se { color: #ae81ff }
|
||||
/* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 }
|
||||
/* LiteralStringInterpol */ .chroma .si { color: #e6db74 }
|
||||
/* LiteralStringOther */ .chroma .sx { color: #e6db74 }
|
||||
/* LiteralStringRegex */ .chroma .sr { color: #e6db74 }
|
||||
/* LiteralStringSingle */ .chroma .s1 { color: #e6db74 }
|
||||
/* LiteralStringSymbol */ .chroma .ss { color: #e6db74 }
|
||||
/* LiteralNumber */ .chroma .m { color: #ae81ff }
|
||||
/* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
|
||||
/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
|
||||
/* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
|
||||
/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
|
||||
/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
|
||||
/* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
|
||||
/* Operator */ .chroma .o { color: #f92672 }
|
||||
/* OperatorWord */ .chroma .ow { color: #f92672 }
|
||||
/* Comment */ .chroma .c { color: #75715e }
|
||||
/* CommentHashbang */ .chroma .ch { color: #75715e }
|
||||
/* CommentMultiline */ .chroma .cm { color: #75715e }
|
||||
/* CommentSingle */ .chroma .c1 { color: #75715e }
|
||||
/* CommentSpecial */ .chroma .cs { color: #75715e }
|
||||
/* CommentPreproc */ .chroma .cp { color: #75715e }
|
||||
/* CommentPreprocFile */ .chroma .cpf { color: #75715e }
|
||||
/* GenericDeleted */ .chroma .gd { color: #f92672 }
|
||||
/* GenericEmph */ .chroma .ge { font-style: italic }
|
||||
/* GenericInserted */ .chroma .gi { color: #a6e22e }
|
||||
/* GenericStrong */ .chroma .gs { font-weight: bold }
|
||||
/* GenericSubheading */ .chroma .gu { color: #75715e }
|
||||
46
static/js/search.js
Normal file
46
static/js/search.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
document.addEventListener("DOMContentLoaded", function () {
|
||||
let index = [];
|
||||
|
||||
// Load JSON index
|
||||
fetch("/index.json")
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
index = data;
|
||||
console.log("Index loaded:", index.length, "posts");
|
||||
})
|
||||
.catch((err) => console.error("Error loading index.json", err));
|
||||
|
||||
const searchInput = document.getElementById("search");
|
||||
const resultsList = document.getElementById("results");
|
||||
|
||||
function runSearch() {
|
||||
const query = searchInput.value.trim().toLowerCase();
|
||||
resultsList.innerHTML = "";
|
||||
|
||||
if (!query) return;
|
||||
|
||||
// filter out posts that don't match
|
||||
const matches = index.filter(
|
||||
(post) =>
|
||||
post.title.toLowerCase().includes(query) ||
|
||||
post.content.toLowerCase().includes(query),
|
||||
);
|
||||
|
||||
if (matches.length === 0) {
|
||||
resultsList.innerHTML = "<li>No results found.</li>";
|
||||
return;
|
||||
}
|
||||
|
||||
// Render matching posts
|
||||
matches.forEach((post) => {
|
||||
const li = document.createElement("li");
|
||||
const link = document.createElement("a");
|
||||
link.href = post.url;
|
||||
link.textContent = post.title;
|
||||
li.appendChild(link);
|
||||
resultsList.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
||||
searchInput.addEventListener("input", runSearch);
|
||||
});
|
||||
43
static/js/toggle.js
Normal file
43
static/js/toggle.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
function toggleTheme() {
|
||||
|
||||
var stylesheet = document.getElementById('stylesheet');
|
||||
|
||||
if (stylesheet.getAttribute('href') === '/css/dark.css') {
|
||||
|
||||
// update stylesheet and store
|
||||
stylesheet.setAttribute('href', '/css/light.css');
|
||||
localStorage.setItem('stylesheet', '/css/light.css');
|
||||
// update button emoji and store
|
||||
button = document.getElementById('toggle-button').innerText = '🌚'
|
||||
localStorage.setItem('button-emoji', '🌚');
|
||||
|
||||
} else {
|
||||
|
||||
// update stylesheet and store
|
||||
stylesheet.setAttribute('href', '/css/dark.css');
|
||||
localStorage.setItem('stylesheet', '/css/dark.css');
|
||||
// update button emoji and store
|
||||
button = document.getElementById('toggle-button').innerText = '🌞'
|
||||
localStorage.setItem('button-emoji', '🌞');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
|
||||
// get stored style
|
||||
var storedStyle = localStorage.getItem('stylesheet');
|
||||
var stylesheet = document.getElementById('stylesheet');
|
||||
// get stored emoji
|
||||
var storedEmoji = localStorage.getItem('button-emoji');
|
||||
var button = document.getElementById('toggle-button')
|
||||
|
||||
// set stored style it exists
|
||||
if (storedStyle) {
|
||||
stylesheet.setAttribute('href', storedStyle);
|
||||
}
|
||||
// set stored emoji it exists
|
||||
if (storedEmoji) {
|
||||
button.innerText = storedEmoji;
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue