.fiche-container {
max-width: 1140px;
margin: auto;
background: #ffffff;
border-radius: 15px;
padding: 30px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
font-family: Arial, sans-serif;
}
.fiche-container label {
font-weight: bold;
display: block;
margin-top: 15px;
}
.fiche-container input, .fiche-container textarea {
width: 100%;
padding: 8px;
margin-top: 5px;
border-radius: 6px;
border: 1px solid #ccc;
}
.fiche-container input[type="color"], input[type="file"] {
cursor: pointer;
}
.fiche-container button {
margin-top: 20px;
padding: 10px 20px;
font-size: 16px;
background: #2b0ca8;
color: #fff;
border: none;
border-radius: 6px;
margin-right: 10px;
cursor: pointer;
}
.fiche-container textarea.generated {
width: 100%;
height: 300px;
margin-top: 30px;
font-family: monospace;
}
function lightenColor(hex, percent) {
let r = parseInt(hex.slice(1,3), 16);
let g = parseInt(hex.slice(3,5), 16);
let b = parseInt(hex.slice(5,7), 16);
r = Math.min(255, Math.floor(r + (255 - r) * percent));
g = Math.min(255, Math.floor(g + (255 - g) * percent));
b = Math.min(255, Math.floor(b + (255 - b) * percent));
return `rgb(${r}, ${g}, ${b})`;
}function genererFiche() {
const titre = document.getElementById("titre").value;
const sousTitre = document.getElementById("sousTitre").value;
const auteur = document.getElementById("auteur").value;
const luPar = document.getElementById("luPar").value;
const date = document.getElementById("date").value;
const langue = document.getElementById("langue").value;
const format = document.getElementById("format").value;
const duree = document.getElementById("duree").value;
const editeur = document.getElementById("editeur").value;
const categories = document.getElementById("categories").value;
const resume = document.getElementById("resume").value.replace(/\\n/g, "
");
const bgColor = document.getElementById("bgColor").value;
const bgLight = lightenColor(bgColor, 0.5);
const image = document.getElementById("imageFile").files[0];
const reader = new FileReader();reader.onloadend = function () {
const imageURL = reader.result;
const html = `
🎧 ${titre}
${sousTitre}
DE ${auteur}
LU PAR ${luPar}
Date : ${date}
Langue : ${langue}
Format : ${format}
Durée : ${duree}
Éditeur : ${editeur}
Catégories : ${categories}
${resume}
`;
document.getElementById("codeOutput").value = html;
};if (image) {
reader.readAsDataURL(image);
} else {
alert("Ajoute une image !");
}
}function resetForm() {
document.querySelectorAll("input, textarea").forEach(el => {
if (el.type !== "color" && el.type !== "file") el.value = "";
});
document.getElementById("bgColor").value = "#ffdede";
document.getElementById("codeOutput").value = "";
}