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
BIN
public/img/apple-touch-icon.png
Normal file
BIN
public/img/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
BIN
public/img/favicon.png
Normal file
BIN
public/img/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 MiB |
BIN
public/img/palico-index.webp
Normal file
BIN
public/img/palico-index.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB |
BIN
public/img/palico-jukebox.webp
Normal file
BIN
public/img/palico-jukebox.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -4,12 +4,16 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Palico Bot</title>
|
<title>Palico Bot</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="description" content="Palico Bot : le jukebox du salon vocal Discord." />
|
||||||
|
<meta name="theme-color" content="#140b24" />
|
||||||
|
<link rel="icon" type="image/png" href="/img/favicon.png" />
|
||||||
|
<link rel="apple-touch-icon" href="/img/apple-touch-icon.png" />
|
||||||
<link rel="stylesheet" href="/style/styles.css" />
|
<link rel="stylesheet" href="/style/styles.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="hero hero--home">
|
<div class="hero hero--home">
|
||||||
<div class="hero__visual">
|
<div class="hero__visual">
|
||||||
<img src="/img/palico-index.png" alt="Palico Bot" />
|
<img src="/img/palico-index.webp" alt="Palico Bot" width="640" height="960" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hero__content">
|
<div class="hero__content">
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,22 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Palico Jukebox</title>
|
<title>Palico Jukebox</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#140b24" />
|
||||||
|
<link rel="icon" type="image/png" href="/img/favicon.png" />
|
||||||
|
<link rel="apple-touch-icon" href="/img/apple-touch-icon.png" />
|
||||||
<link rel="stylesheet" href="/style/styles.css" />
|
<link rel="stylesheet" href="/style/styles.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="hero">
|
<div class="hero">
|
||||||
<div class="hero__visual">
|
<div class="hero__visual">
|
||||||
<img src="/img/palico-jukebox.png" alt="Palico Jukebox" />
|
<img src="/img/palico-jukebox.webp" alt="Palico Jukebox" width="400" height="857" />
|
||||||
</div>
|
</div>
|
||||||
<div class="hero__content">
|
<div class="hero__content">
|
||||||
<p class="pill">Le Jukebox du Palico Bot</p>
|
<p class="pill">Le Jukebox du Palico Bot</p>
|
||||||
<h1>Un peu de son pour le Discord !</h1>
|
<h1>Un peu de son pour le Discord !</h1>
|
||||||
<p>
|
<p>
|
||||||
Tu veux chill avec les autres sur un petit fond musical ?<br />
|
Tu veux chill avec les autres sur un petit fond musical ?<br />
|
||||||
T'inquietes pas, je peux m'occuper de ca !<br />
|
T'inquiète pas, je peux m'occuper de ça !<br />
|
||||||
<br />
|
<br />
|
||||||
Uploade des fichiers et gère la playlist depuis cette interface web.
|
Uploade des fichiers et gère la playlist depuis cette interface web.
|
||||||
Tout est synchronisé avec le salon vocal.
|
Tout est synchronisé avec le salon vocal.
|
||||||
|
|
@ -31,7 +34,8 @@
|
||||||
<div class="panel panel--glass">
|
<div class="panel panel--glass">
|
||||||
<h2>Authentification</h2>
|
<h2>Authentification</h2>
|
||||||
<p class="panel__subtitle">
|
<p class="panel__subtitle">
|
||||||
La clé reste dans cet onglet jusqu'à sa fermeture.
|
Sans « Se souvenir de moi », le mot de passe est oublié à la
|
||||||
|
fermeture de l'onglet.
|
||||||
</p>
|
</p>
|
||||||
<form id="settingsForm">
|
<form id="settingsForm">
|
||||||
<div class="grid grid--two">
|
<div class="grid grid--two">
|
||||||
|
|
@ -56,6 +60,10 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<label class="form-checkbox u-mt-1">
|
||||||
|
<input type="checkbox" id="rememberKey" class="form-checkbox__input" />
|
||||||
|
<span>Se souvenir de moi sur cet appareil</span>
|
||||||
|
</label>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn">Sauvegarder</button>
|
<button type="submit" class="btn">Sauvegarder</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -65,7 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div id="status" class="status status--info" hidden></div>
|
<div id="status" class="status status--info" role="status" aria-live="polite" hidden></div>
|
||||||
|
|
||||||
<section class="panel panel--glass">
|
<section class="panel panel--glass">
|
||||||
<div class="panel__header">
|
<div class="panel__header">
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,52 @@
|
||||||
const API_KEY_STORAGE_KEY = "palico-api-key";
|
const API_KEY_STORAGE_KEY = "palico-api-key";
|
||||||
const DISPLAY_NAME_STORAGE_KEY = "palico-display-name";
|
const DISPLAY_NAME_STORAGE_KEY = "palico-display-name";
|
||||||
|
|
||||||
export function getStoredApiKey() {
|
// Le stockage peut être indisponible (navigation privée, cookies bloqués) : la page doit
|
||||||
return sessionStorage.getItem(API_KEY_STORAGE_KEY) || "";
|
// fonctionner quand même, simplement sans mémoire.
|
||||||
|
function storageGet(storage, key) {
|
||||||
|
try {
|
||||||
|
return storage.getItem(key);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setStoredApiKey(value) {
|
function storageSet(storage, key, value) {
|
||||||
sessionStorage.setItem(API_KEY_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() {
|
export function getStoredDisplayName() {
|
||||||
return localStorage.getItem(DISPLAY_NAME_STORAGE_KEY) || "";
|
return storageGet(localStorage, DISPLAY_NAME_STORAGE_KEY) || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setStoredDisplayName(value) {
|
export function setStoredDisplayName(value) {
|
||||||
localStorage.setItem(DISPLAY_NAME_STORAGE_KEY, value || "");
|
storageSet(localStorage, DISPLAY_NAME_STORAGE_KEY, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createStatusManager(statusElement) {
|
export function createStatusManager(statusElement) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
||||||
getStoredApiKey,
|
getStoredApiKey,
|
||||||
getStoredDisplayName,
|
getStoredDisplayName,
|
||||||
formatBytes,
|
formatBytes,
|
||||||
|
isApiKeyRemembered,
|
||||||
formatDate,
|
formatDate,
|
||||||
setStoredApiKey,
|
setStoredApiKey,
|
||||||
setStoredDisplayName,
|
setStoredDisplayName,
|
||||||
|
|
@ -22,6 +23,7 @@ const state = {
|
||||||
const elements = {
|
const elements = {
|
||||||
status: document.getElementById("status"),
|
status: document.getElementById("status"),
|
||||||
apiKeyInput: document.getElementById("apiKey"),
|
apiKeyInput: document.getElementById("apiKey"),
|
||||||
|
rememberKeyCheckbox: document.getElementById("rememberKey"),
|
||||||
displayNameInput: document.getElementById("displayName"),
|
displayNameInput: document.getElementById("displayName"),
|
||||||
settingsForm: document.getElementById("settingsForm"),
|
settingsForm: document.getElementById("settingsForm"),
|
||||||
uploadForm: document.getElementById("uploadForm"),
|
uploadForm: document.getElementById("uploadForm"),
|
||||||
|
|
@ -171,8 +173,8 @@ function renderQueue() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="media-item__actions">
|
<div class="media-item__actions">
|
||||||
<button class="btn btn--secondary" data-action="up" data-track="${track.id}">▲</button>
|
<button class="btn btn--secondary" data-action="up" data-track="${track.id}" aria-label="Monter" title="Monter">▲</button>
|
||||||
<button class="btn btn--secondary" data-action="down" data-track="${track.id}">▼</button>
|
<button class="btn btn--secondary" data-action="down" data-track="${track.id}" aria-label="Descendre" title="Descendre">▼</button>
|
||||||
<button class="btn btn--danger" data-action="remove" data-track="${track.id}">Supprimer</button>
|
<button class="btn btn--danger" data-action="remove" data-track="${track.id}">Supprimer</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
@ -312,7 +314,9 @@ function bindEvents() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
state.apiKey = elements.apiKeyInput.value.trim();
|
state.apiKey = elements.apiKeyInput.value.trim();
|
||||||
state.displayName = elements.displayNameInput.value.trim();
|
state.displayName = elements.displayNameInput.value.trim();
|
||||||
setStoredApiKey(state.apiKey);
|
setStoredApiKey(state.apiKey, {
|
||||||
|
remember: elements.rememberKeyCheckbox?.checked,
|
||||||
|
});
|
||||||
setStoredDisplayName(state.displayName);
|
setStoredDisplayName(state.displayName);
|
||||||
setStatus("Paramètres sauvegardés", "success");
|
setStatus("Paramètres sauvegardés", "success");
|
||||||
refreshAll({ silent: true });
|
refreshAll({ silent: true });
|
||||||
|
|
@ -403,6 +407,9 @@ function bindEvents() {
|
||||||
function initialize() {
|
function initialize() {
|
||||||
elements.apiKeyInput.value = state.apiKey;
|
elements.apiKeyInput.value = state.apiKey;
|
||||||
elements.displayNameInput.value = state.displayName;
|
elements.displayNameInput.value = state.displayName;
|
||||||
|
if (elements.rememberKeyCheckbox) {
|
||||||
|
elements.rememberKeyCheckbox.checked = isApiKeyRemembered();
|
||||||
|
}
|
||||||
bindEvents();
|
bindEvents();
|
||||||
updatePauseResumeButton();
|
updatePauseResumeButton();
|
||||||
refreshAll();
|
refreshAll();
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ p {
|
||||||
.hero__visual img {
|
.hero__visual img {
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.45));
|
filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.45));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue