- Fase A: license templates, search history, cost estimator - Fase B: import URL, bulk ZIP, batch download - Fase C: comparison mode, mesh validation, measurement tool - Fase D: cross-section clipping, overhang heatmap, layer animation - Refactor Pydantic/SQLAlchemy warnings - 24 tests pytest - README actualizado - WebP thumbnails, lazy loading, cache headers
40 lines
994 B
JavaScript
40 lines
994 B
JavaScript
(function() {
|
|
const STORAGE_KEY = 'stl-repo-theme';
|
|
|
|
function getTheme() {
|
|
return localStorage.getItem(STORAGE_KEY) || 'dark';
|
|
}
|
|
|
|
function setTheme(theme) {
|
|
localStorage.setItem(STORAGE_KEY, theme);
|
|
applyTheme(theme);
|
|
}
|
|
|
|
function applyTheme(theme) {
|
|
const html = document.documentElement;
|
|
if (theme === 'light') {
|
|
html.classList.add('light-mode');
|
|
} else {
|
|
html.classList.remove('light-mode');
|
|
}
|
|
window.dispatchEvent(new CustomEvent('themechange', { detail: theme }));
|
|
}
|
|
|
|
function toggleTheme() {
|
|
const current = getTheme();
|
|
setTheme(current === 'dark' ? 'light' : 'dark');
|
|
}
|
|
|
|
// Expose globally
|
|
window.getTheme = getTheme;
|
|
window.setTheme = setTheme;
|
|
window.toggleTheme = toggleTheme;
|
|
|
|
// Apply on load
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
applyTheme(getTheme());
|
|
const btn = document.getElementById('theme-toggle');
|
|
if (btn) btn.addEventListener('click', toggleTheme);
|
|
});
|
|
})();
|