diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-22 10:51:51 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-22 10:51:51 +0200 |
commit | 7a1f09d3236b74357c92ec18da69c3828c1a6db5 (patch) | |
tree | 10d3cfc47c44d256b31608bbeba4766fa045ab6f | |
parent | 819fb9ca5082175f4afc595766e75dd2f045395b (diff) | |
download | arching-kaos-web-ui-7a1f09d3236b74357c92ec18da69c3828c1a6db5.tar.gz arching-kaos-web-ui-7a1f09d3236b74357c92ec18da69c3828c1a6db5.tar.bz2 arching-kaos-web-ui-7a1f09d3236b74357c92ec18da69c3828c1a6db5.zip |
Compact refactoring
-rw-r--r-- | src/js/arching-kaos-modules-news.js | 36 |
1 files 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" }; |