v3
This commit is contained in:
@@ -81,6 +81,14 @@
|
||||
const content=document.getElementById('content');
|
||||
if(!main||!content)return; // Pages secondaires : seulement le thème transversal.
|
||||
function el(tag,className,txt){const node=document.createElement(tag);if(className)node.className=className;if(txt!==undefined)node.textContent=String(txt);return node;}
|
||||
// DONA_MARKDOWN_V1 — ne jamais interpréter le Markdown avec innerHTML brut.
|
||||
function rich(tag,className,markdown,inline=false){
|
||||
const node=el(tag,className);
|
||||
if(window.DonaMarkdown && typeof window.DonaMarkdown.render==='function')
|
||||
window.DonaMarkdown.render(node,markdown,{inline});
|
||||
else node.textContent=String(markdown??'');
|
||||
return node;
|
||||
}
|
||||
let busy=false;let original='';
|
||||
function renderCards(){
|
||||
if(busy || content.firstElementChild?.classList.contains('dh-response'))return;
|
||||
@@ -100,8 +108,8 @@
|
||||
const wrap=el('section','dh-response');
|
||||
wrap.setAttribute('aria-label','Synthèse contextuelle de la réponse Hermes');
|
||||
const primary=el('article','dh-primary');
|
||||
primary.append(el('div','dh-kicker','RÉPONSE · DONA'),el('div','dh-headline',summary.headline));
|
||||
if(summary.excerpt && summary.excerpt!==summary.headline)primary.append(el('div','dh-excerpt',summary.excerpt));
|
||||
primary.append(el('div','dh-kicker','RÉPONSE · DONA'),rich('div','dh-headline',summary.headline,true));
|
||||
if(summary.excerpt && summary.excerpt!==summary.headline)primary.append(rich('div','dh-excerpt',summary.excerpt));
|
||||
else primary.append(el('div','dh-excerpt','Réponse disponible dans son intégralité.'));
|
||||
const more=el('button','dh-more');more.type='button';more.setAttribute('aria-expanded','false');more.append(el('span','', '▤ Afficher la réponse complète'),el('span','','›'));
|
||||
primary.append(more);wrap.append(primary);
|
||||
@@ -121,7 +129,7 @@
|
||||
wrap.classList.add('dh-no-facts');
|
||||
}
|
||||
const full=el('section','dh-full');full.hidden=true;full.id='dhFullReply';
|
||||
full.append(el('h3','', 'Réponse complète d’Hermes'),el('div','dh-full-text',text),el('p','dh-source','Affichage fidèle au texte reçu. Les faits n’ont pas été vérifiés séparément.'));
|
||||
full.append(el('h3','', 'Réponse complète d’Hermes'),rich('div','dh-full-text',text),el('p','dh-source','Affichage fidèle au texte reçu. Les faits n’ont pas été vérifiés séparément.'));
|
||||
more.setAttribute('aria-controls','dhFullReply');
|
||||
more.addEventListener('click',()=>{
|
||||
const opened=full.hidden;full.hidden=!opened;more.setAttribute('aria-expanded',String(opened));
|
||||
|
||||
Reference in New Issue
Block a user