fix(csp): docs + 418 sans style/script inline — CSS/JS externalisés, header/footer injectés par components.js (#h/#f), playground API déplacé dans docs-playground.js et docs.css

This commit is contained in:
riricdev 2026-09-07 15:34:23 +02:00
commit b65db0be44
7 changed files with 310 additions and 112 deletions

View file

@ -0,0 +1,15 @@
(function () {
var form = document.getElementById("ms-form")
var out = document.getElementById("ms-out")
if (!form || !out) return
form.addEventListener("submit", function (e) {
e.preventDefault()
var lat = document.getElementById("ms-lat").value
var lon = document.getElementById("ms-lon").value
out.textContent = "Chargement…"
fetch("/api/maxspeed/point?lat=" + encodeURIComponent(lat) + "&lon=" + encodeURIComponent(lon))
.then(function (r) { return r.json() })
.then(function (d) { out.textContent = JSON.stringify(d, null, 2) })
.catch(function (err) { out.textContent = "Erreur: " + err })
})
})()

16
public/js/teapot.js Normal file
View file

@ -0,0 +1,16 @@
(function () {
var toast = document.querySelector(".tea-toast");
if (!toast) return;
var timer = null;
function spin(msg) {
toast.textContent = msg;
toast.classList.add("show");
if (timer) clearTimeout(timer);
timer = setTimeout(function () { toast.classList.remove("show"); }, 3200);
}
document.querySelectorAll("[data-tea]").forEach(function (b) {
b.addEventListener("click", function () {
spin(b.getAttribute("data-toast") || "");
});
});
})();