mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 21:33:19 +00:00
12406bbbf4
A third switch next to the page break and transport notes switches scales the day content's type by 1.35 and darkens its greys, for readers who print the plan. Off by default and remembered per browser like the other two; the day content's sizes and greys now come from three CSS variables on <body>.
23 lines
691 B
TypeScript
23 lines
691 B
TypeScript
/*
|
|
* The switches of the trip PDF preview (a new page for every day, the notes of
|
|
* the transports, large text), remembered in this browser.
|
|
*/
|
|
|
|
/** A preview switch as it was last left; `defaultOn` until it is first touched, or when storage is blocked. */
|
|
export function pdfSwitchOn(key: string, defaultOn = true): boolean {
|
|
try {
|
|
const stored = localStorage.getItem(key);
|
|
return stored === null ? defaultOn : stored !== '0';
|
|
} catch {
|
|
return defaultOn;
|
|
}
|
|
}
|
|
|
|
export function rememberPdfSwitch(key: string, on: boolean): void {
|
|
try {
|
|
localStorage.setItem(key, on ? '1' : '0');
|
|
} catch {
|
|
// A blocked localStorage costs the preference, not the export.
|
|
}
|
|
}
|