Lighten the website and make it more accessible
- Serve the hero images as WebP at their display size: 118 KB and 55 KB instead of 3.5 MB and 1.4 MB. - Add a favicon, an apple-touch icon, a description and a theme colour. - Announce status messages to screen readers and label the move buttons. - Offer "Se souvenir de moi" to keep the password on the device, and keep working when browser storage is unavailable. - Fix typos in the jukebox introduction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
362c7772ba
commit
d200040691
11 changed files with 66 additions and 14 deletions
|
|
@ -1,20 +1,52 @@
|
|||
const API_KEY_STORAGE_KEY = "palico-api-key";
|
||||
const DISPLAY_NAME_STORAGE_KEY = "palico-display-name";
|
||||
|
||||
export function getStoredApiKey() {
|
||||
return sessionStorage.getItem(API_KEY_STORAGE_KEY) || "";
|
||||
// Le stockage peut être indisponible (navigation privée, cookies bloqués) : la page doit
|
||||
// fonctionner quand même, simplement sans mémoire.
|
||||
function storageGet(storage, key) {
|
||||
try {
|
||||
return storage.getItem(key);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function setStoredApiKey(value) {
|
||||
sessionStorage.setItem(API_KEY_STORAGE_KEY, value || "");
|
||||
function storageSet(storage, key, value) {
|
||||
try {
|
||||
if (value) {
|
||||
storage.setItem(key, value);
|
||||
} else {
|
||||
storage.removeItem(key);
|
||||
}
|
||||
} catch {
|
||||
// Stockage indisponible.
|
||||
}
|
||||
}
|
||||
|
||||
export function getStoredApiKey() {
|
||||
return (
|
||||
storageGet(sessionStorage, API_KEY_STORAGE_KEY) ||
|
||||
storageGet(localStorage, API_KEY_STORAGE_KEY) ||
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
export function isApiKeyRemembered() {
|
||||
return Boolean(storageGet(localStorage, API_KEY_STORAGE_KEY));
|
||||
}
|
||||
|
||||
// remember : garde la clé sur l'appareil (localStorage) au lieu de l'onglet (sessionStorage).
|
||||
export function setStoredApiKey(value, { remember = false } = {}) {
|
||||
storageSet(remember ? localStorage : sessionStorage, API_KEY_STORAGE_KEY, value);
|
||||
storageSet(remember ? sessionStorage : localStorage, API_KEY_STORAGE_KEY, "");
|
||||
}
|
||||
|
||||
export function getStoredDisplayName() {
|
||||
return localStorage.getItem(DISPLAY_NAME_STORAGE_KEY) || "";
|
||||
return storageGet(localStorage, DISPLAY_NAME_STORAGE_KEY) || "";
|
||||
}
|
||||
|
||||
export function setStoredDisplayName(value) {
|
||||
localStorage.setItem(DISPLAY_NAME_STORAGE_KEY, value || "");
|
||||
storageSet(localStorage, DISPLAY_NAME_STORAGE_KEY, value);
|
||||
}
|
||||
|
||||
export function createStatusManager(statusElement) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue