From 7a1f09d3236b74357c92ec18da69c3828c1a6db5 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 22 Nov 2024 10:51:51 +0200 Subject: Compact refactoring --- src/js/arching-kaos-modules-news.js | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/js/arching-kaos-modules-news.js b/src/js/arching-kaos-modules-news.js index 0a1652a..d1ebc23 100644 --- a/src/js/arching-kaos-modules-news.js +++ b/src/js/arching-kaos-modules-news.js @@ -11,35 +11,19 @@ function akModuleNews(zblockIPFSHash, zblockObject, blockObject, json){ var newsSectionDivElement = document.querySelector('#news-section'); var articleContainerElement = { element:"article", - id:'news-'+zblockIPFSHash + id:`news-${zblockIPFSHash}`, + innerHTML: [ + { element:"a", innerText : json.title, href : '#news-'+zblockIPFSHash }, + { element:"a", innerText:'[permalink]', target: '_blank', href:'https://news.arching-kaos.net/?from_zblock='+zblockIPFSHash }, + { element:"p", innerText:"Published: " + new Date(blockObject.timestamp*1000) }, + { element:"p", innerText:"Contributor: " + getNicknameAssossiatedWithGPG(blockObject.gpg) }, + { element:"hr" } + ] }; makeElement(articleContainerElement, newsSectionDivElement); - articleContainerElement = document.querySelector(`#news-${zblockIPFSHash}`); - if(json.title){ - var ubs = { - element:"a", - innerText : json.title, - href : '#news-'+zblockIPFSHash - }; - makeElement(ubs, articleContainerElement); - var ahref = { - element:"a", - innerText:'[permalink]', - target: '_blank', - href:'https://news.arching-kaos.net/?from_zblock='+zblockIPFSHash - }; - makeElement(ahref, articleContainerElement); - } - if(json.datetime){ - var small = { - element:"p", - innerText:"Published: " + new Date(blockObject.timestamp*1000) - }; - makeElement(small, articleContainerElement); + if(json.ipfs){ + archingKaosFetchText(getIPFSURL(json.ipfs), getFullText,[`#news-${zblockIPFSHash}`]); } - var small = { - element:"p", - innerText:"Contributor: " + getNicknameAssossiatedWithGPG(blockObject.gpg) }; makeElement(small, articleContainerElement); var hr = { element:"hr" }; -- cgit v1.2.3