Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self' https://cloudflareinsights.com; worker-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'none'"
/>
<!-- Set the saved theme on <html> before first paint so a reload doesn't flash
the default dark theme. Same-origin, so covered by script-src 'self'. -->
<script src="/theme-init.js"></script>
<title>Cave Survey Viewer</title>
<meta name="google-site-verification" content="yhJBw46UtDk7-YZn_gDqYoYJpHEHPOMHRE065-Nohf4" />
<!-- Favicons: SVG first so capable browsers render a sharp, scalable icon;
Expand Down
9 changes: 9 additions & 0 deletions public/theme-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Apply the saved colour theme before first paint so a light-mode reload doesn't
// flash the default (dark) theme. Loaded as a blocking <script> in <head>, ahead
// of the deferred app bundle which runs too late. Mirrors THEME_KEY in main.ts.
try {
var theme = localStorage.getItem("cv.theme") === "light" ? "light" : "dark";
document.documentElement.setAttribute("data-theme", theme);
} catch (e) {
/* localStorage unavailable (e.g. blocked cookies) — fall back to the CSS default. */
}
Loading