mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
update
This commit is contained in:
3475
docs/assets/lunr.js
Normal file
3475
docs/assets/lunr.js
Normal file
File diff suppressed because it is too large
Load Diff
160
docs/assets/theme.css
Normal file
160
docs/assets/theme.css
Normal file
@@ -0,0 +1,160 @@
|
||||
:root {
|
||||
--bg-color: #ffffff;
|
||||
--text-color: #333333;
|
||||
--sidebar-bg: #f3f3f3;
|
||||
--sidebar-width: 240px;
|
||||
}
|
||||
[data-theme="dark"] {
|
||||
--bg-color: #222222;
|
||||
--text-color: #eeeeee;
|
||||
--sidebar-bg: #333333;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0.5rem 1rem;
|
||||
background: var(--sidebar-bg);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1100;
|
||||
}
|
||||
.search-input {
|
||||
margin-left: auto;
|
||||
padding: 0.25rem;
|
||||
}
|
||||
.search-results {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 1rem;
|
||||
top: 100%;
|
||||
background: var(--bg-color);
|
||||
border: 1px solid #ccc;
|
||||
width: 250px;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
z-index: 100;
|
||||
}
|
||||
.search-results a {
|
||||
display: block;
|
||||
padding: 0.25rem;
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
.search-results a:hover {
|
||||
background: var(--sidebar-bg);
|
||||
}
|
||||
.search-results .no-results {
|
||||
padding: 0.25rem;
|
||||
}
|
||||
.logo { text-decoration: none; color: var(--text-color); font-weight: bold; }
|
||||
.sidebar-toggle,
|
||||
.theme-toggle { background: none; border: none; font-size: 1.2rem; margin-right: 1rem; cursor: pointer; }
|
||||
.container { display: flex; flex: 1; }
|
||||
.sidebar {
|
||||
width: var(--sidebar-width);
|
||||
background: var(--sidebar-bg);
|
||||
padding: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.sidebar ul { list-style: none; padding: 0; margin: 0; }
|
||||
.sidebar li { margin: 0.25rem 0; }
|
||||
.sidebar a { text-decoration: none; color: var(--text-color); display: block; padding: 0.25rem 0; }
|
||||
.sidebar nav { font-size: 0.9rem; }
|
||||
.nav-link:hover { text-decoration: underline; }
|
||||
.nav-link.active { font-weight: bold; }
|
||||
.nav-section summary {
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.nav-section summary::-webkit-details-marker { display: none; }
|
||||
.nav-section summary::before {
|
||||
content: '▸';
|
||||
display: inline-block;
|
||||
margin-right: 0.25rem;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
.nav-section[open] > summary::before { transform: rotate(90deg); }
|
||||
.nav-level { padding-left: 1rem; margin-left: 0.5rem; border-left: 2px solid #ccc; }
|
||||
.sidebar ul ul { padding-left: 1rem; margin-left: 0.5rem; border-left: 2px solid #ccc; }
|
||||
main {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
}
|
||||
.breadcrumbs a { color: var(--text-color); text-decoration: none; }
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding: 1rem;
|
||||
background: var(--sidebar-bg);
|
||||
position: relative;
|
||||
}
|
||||
.footer-links {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.footer-links a {
|
||||
margin: 0 0.5rem;
|
||||
text-decoration: none;
|
||||
color: var(--text-color);
|
||||
}
|
||||
.footer-permanent-links {
|
||||
position: absolute;
|
||||
right: 0.5rem;
|
||||
bottom: 0.25rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
.footer-permanent-links a {
|
||||
margin-left: 0.5rem;
|
||||
text-decoration: none;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.sidebar-overlay {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
body.sidebar-open .sidebar-overlay {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
z-index: 999;
|
||||
}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
left: -100%;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
transition: none;
|
||||
z-index: 1000;
|
||||
}
|
||||
body.sidebar-open .sidebar { left: 0; }
|
||||
}
|
||||
|
||||
@media (min-width: 769px) {
|
||||
.sidebar {
|
||||
transition: width 0.2s ease;
|
||||
}
|
||||
body:not(.sidebar-open) .sidebar {
|
||||
width: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
107
docs/assets/theme.js
Normal file
107
docs/assets/theme.js
Normal file
@@ -0,0 +1,107 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const sidebarToggle = document.getElementById('sidebar-toggle');
|
||||
const themeToggle = document.getElementById('theme-toggle');
|
||||
const searchInput = document.getElementById('search-input');
|
||||
const searchResults = document.getElementById('search-results');
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const sidebarOverlay = document.getElementById('sidebar-overlay');
|
||||
const root = document.documentElement;
|
||||
|
||||
function setTheme(theme) {
|
||||
root.dataset.theme = theme;
|
||||
localStorage.setItem('theme', theme);
|
||||
}
|
||||
const stored = localStorage.getItem('theme');
|
||||
if (stored) setTheme(stored);
|
||||
|
||||
if (window.innerWidth > 768) {
|
||||
document.body.classList.add('sidebar-open');
|
||||
}
|
||||
|
||||
sidebarToggle?.addEventListener('click', () => {
|
||||
document.body.classList.toggle('sidebar-open');
|
||||
});
|
||||
|
||||
sidebarOverlay?.addEventListener('click', () => {
|
||||
document.body.classList.remove('sidebar-open');
|
||||
});
|
||||
|
||||
themeToggle?.addEventListener('click', () => {
|
||||
const next = root.dataset.theme === 'dark' ? 'light' : 'dark';
|
||||
setTheme(next);
|
||||
});
|
||||
|
||||
// search
|
||||
let lunrIndex;
|
||||
let docs = [];
|
||||
async function loadIndex() {
|
||||
if (lunrIndex) return;
|
||||
try {
|
||||
const res = await fetch('/search-index.json');
|
||||
const data = await res.json();
|
||||
lunrIndex = lunr.Index.load(data.index);
|
||||
docs = data.docs;
|
||||
} catch (e) {
|
||||
console.error('Search index failed to load', e);
|
||||
}
|
||||
}
|
||||
|
||||
function highlight(text, q) {
|
||||
const re = new RegExp('(' + q.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&') + ')', 'gi');
|
||||
return text.replace(re, '<mark>$1</mark>');
|
||||
}
|
||||
|
||||
searchInput?.addEventListener('input', async e => {
|
||||
const q = e.target.value.trim();
|
||||
await loadIndex();
|
||||
if (!lunrIndex || !q) {
|
||||
searchResults.style.display = 'none';
|
||||
searchResults.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
const matches = lunrIndex.search(q);
|
||||
searchResults.innerHTML = '';
|
||||
if (!matches.length) {
|
||||
searchResults.innerHTML = '<div class="no-results">No matches found</div>';
|
||||
searchResults.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
matches.forEach(m => {
|
||||
const doc = docs.find(d => d.id === m.ref);
|
||||
if (!doc) return;
|
||||
const a = document.createElement('a');
|
||||
a.href = doc.url;
|
||||
const snippet = doc.body ? doc.body.slice(0, 160) + (doc.body.length > 160 ? '...' : '') : '';
|
||||
a.innerHTML = '<strong>' + highlight(doc.title, q) + '</strong><br><small>' + highlight(snippet, q) + '</small>';
|
||||
searchResults.appendChild(a);
|
||||
});
|
||||
searchResults.style.display = 'block';
|
||||
});
|
||||
|
||||
document.addEventListener('click', e => {
|
||||
if (!searchResults.contains(e.target) && e.target !== searchInput) {
|
||||
searchResults.style.display = 'none';
|
||||
}
|
||||
if (
|
||||
window.innerWidth <= 768 &&
|
||||
document.body.classList.contains('sidebar-open') &&
|
||||
sidebar &&
|
||||
!sidebar.contains(e.target) &&
|
||||
e.target !== sidebarToggle
|
||||
) {
|
||||
document.body.classList.remove('sidebar-open');
|
||||
}
|
||||
});
|
||||
|
||||
// breadcrumbs
|
||||
const bc = document.getElementById('breadcrumbs');
|
||||
if (bc) {
|
||||
const parts = location.pathname.split('/').filter(Boolean);
|
||||
let path = '';
|
||||
bc.innerHTML = '<a href="/">Home</a>';
|
||||
parts.forEach((p) => {
|
||||
path += '/' + p;
|
||||
bc.innerHTML += ' / <a href="' + path + '">' + p.replace(/-/g, ' ') + '</a>';
|
||||
});
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user