diff --git a/static/sport2.html b/static/sport2.html index 3b935a4..35a7013 100644 --- a/static/sport2.html +++ b/static/sport2.html @@ -2417,10 +2417,54 @@ function renderCustomFindingPanel(c){
📄 Dokumenti / dokazi
Za ovaj manualni nalaz nisu priloženi PDF dokazi. Pokreni "Obogati podatke" za prikupljanje izvora.
+ + ${customFindingEnrichBlock(c.id, c.osoba || c.naslov)} `; openPanel('Forenzika · '+c.naslov, html); } +function customFindingEnrichBlock(customId, queryName){ + const safeId = String(customId).replace(/[^a-z0-9_-]/gi,'_'); + return ` +
+
+
✨ Obogati podatke (Wikipedia)
+ +
+
+
Lookup Wikipedia HR za "${esc(queryName)}" i prikaži dopune.
+
+
+ `; +} + +async function enrichCustomFinding(safeId, queryName){ + const out = document.getElementById('fenrich-out-'+safeId); + if(out) out.innerHTML = '
Lookup Wikipedia HR…
'; + // Custom findings aren't in DB — call wiki lookup via a synthesised forensic_findings.id of -1 won't work. + // Instead, use the existing /v2/enrich/sportas pattern to query Wikipedia by name. + // We re-use the wiki summary via a mini fetch helper. + try{ + const wiki = await fetch('https://hr.wikipedia.org/api/rest_v1/page/summary/'+encodeURIComponent(queryName.replace(/ /g,'_'))) + .then(r => r.ok ? r.json() : null).catch(()=>null); + if(!wiki || wiki.type==='disambiguation' || !wiki.extract){ + if(out) out.innerHTML = '
Nije pronađen Wikipedia HR članak za '+esc(queryName)+'.
'; + return; + } + const w = {title: wiki.title, extract: wiki.extract, description: wiki.description, url: (wiki.content_urls||{}).desktop?.page}; + if(out) out.innerHTML = ` +
🟢 Wikipedia HR
+
+
${esc(w.title||'')}
+ ${w.description?'
'+esc(w.description)+'
':''} + ${w.extract?'
'+esc(w.extract)+'
':''} + ${w.url?'
↗ Otvori članak
':''} +
`; + }catch(e){ + if(out) out.innerHTML = '
Greška: '+esc(String(e))+'
'; + } +} + function renderAlertPanel(a){ const sevColor = a.razina==='CRITICAL'?'rd':(a.razina==='HIGH'?'am':'b'); const html = `