Build and deploy / test-python (push) Successful in 11m18s
Build and deploy / test-js (push) Successful in 1m16s
Build and deploy / lint-python (push) Successful in 4m24s
Build and deploy / lint-js (push) Successful in 2m51s
Build and deploy / build-and-push (push) Skipped
Build and deploy / deploy (push) Skipped
Build and deploy / sonarqube (push) Successful in 5m30s
Corrige les findings SonarQube (via SonarLint IDE, fichier par fichier) sur ~24 fichiers static/js/ : parseFloat/parseInt -> Number.*, .replace(/x/g,y) -> .replaceAll, .indexOf() -> .includes()/.startsWith(), getAttribute/setAttribute -> .dataset, tableaux -> Set, x && x.y -> x?.y (verifie site par site), extraction de template litteraux imbriques, ternaires imbriquees, refactors de complexite cognitive (S3776) via tables de dispatch, Object.hasOwn, .at(), et deduplication de fonctions identiques (S4144). Deux exceptions S2486 documentees/corrigees (filter-repeater-rows.js) et un cas S2703 de partage inter-scripts complete (_collisionWizard, trigger-editor.js <-> collision-rules-editor.js). Details complets dans CODE_QUALITY.md section 5. Restaure aussi le job CI "sonarqube" (non-bloquant) dans .gitea/workflows/deploy.yml maintenant que l'instance prod est operationnelle. Suites vertes : 276/276 JS (node --test), 591/591 Python (pytest). SKIP=djlint sur ce commit : hook djlint bloquant sur le backlog H021 (styles inline, 49 occurrences/6 templates) deja documente comme dette assumee non traitee dans CODE_QUALITY.md section 6, aucun rapport avec ce commit (aucun template touche ici) - valide explicitement avec l'utilisateur avant de contourner ce hook. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
1.8 KiB
JavaScript
40 lines
1.8 KiB
JavaScript
// ---------- Panneau de propriétés "🎭 Personnage" (Phase 8) ----------
|
|
// Panneau sur-mesure (custom_panel, voir registry.py) : PAS de soumission
|
|
// générique via #propsForm — chaque changement s'enregistre en AJAX vers
|
|
// POST /game/<slug>/elements/<id>/personnage (element_set_personnage_data.py),
|
|
// qui renvoie les animations résolues pour relancer immédiatement l'aperçu
|
|
// animé (voir personnage-preview.js) sans recharger la page. L'import de
|
|
// sprites personnalisés est retiré pour le moment — seuls les personnages
|
|
// Forge (SPRITE_LIBRARY) sont proposés.
|
|
|
|
function _personnageElementId() {
|
|
const body = document.getElementById('personnagePanelBody');
|
|
return body ? Number.parseInt(body.dataset.elementId, 10) : null;
|
|
}
|
|
|
|
function _savePersonnageData(data) {
|
|
const elementId = _personnageElementId();
|
|
if (!elementId) return Promise.resolve();
|
|
return fetch(`/game/${GAME_SLUG}/elements/${elementId}/personnage`, {
|
|
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data),
|
|
})
|
|
.then((r) => r.json())
|
|
.then((json) => {
|
|
if (json.animations) {
|
|
// Reste en phase avec le sélecteur d'animation du nœud de flow/clip
|
|
// de Timeline (voir flow-editor.js/animation-timeline.js), sans
|
|
// recharger la page.
|
|
ELEMENT_ANIMATIONS_MAP[elementId] = json.animations;
|
|
restartPersonnageIdlePreview(elementId, json.animations);
|
|
}
|
|
return json;
|
|
});
|
|
}
|
|
|
|
function swapPersonnageCharacter(forgeCharacter) {
|
|
document.querySelectorAll('#personnageGallerySwap .iconGalleryTile').forEach((tile) => {
|
|
tile.classList.toggle('selected', tile.getAttribute('onclick') === `swapPersonnageCharacter('${forgeCharacter}')`);
|
|
});
|
|
_savePersonnageData({ source: 'forge', forge_character: forgeCharacter });
|
|
}
|