aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-modules-files.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-11-11 23:37:28 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-11-11 23:37:28 +0200
commit22bdc082a3fb26144f861732a971e091718a215f (patch)
treef6724e9983441c1d59068f0dba8d40e9eb3b7064 /src/js/arching-kaos-modules-files.js
parent075ef0c6213585094266cceaaac6a281afa1099e (diff)
downloadarching-kaos-web-ui-22bdc082a3fb26144f861732a971e091718a215f.tar.gz
arching-kaos-web-ui-22bdc082a3fb26144f861732a971e091718a215f.tar.bz2
arching-kaos-web-ui-22bdc082a3fb26144f861732a971e091718a215f.zip
Refactoring using ak-generator
Diffstat (limited to 'src/js/arching-kaos-modules-files.js')
-rw-r--r--src/js/arching-kaos-modules-files.js37
1 files changed, 12 insertions, 25 deletions
diff --git a/src/js/arching-kaos-modules-files.js b/src/js/arching-kaos-modules-files.js
index f5aed1b..b566226 100644
--- a/src/js/arching-kaos-modules-files.js
+++ b/src/js/arching-kaos-modules-files.js
@@ -8,32 +8,19 @@
function akModuleFiles(zblockIPFSHash, blockObject, json){
if (!document.querySelector('#file-'+zblockIPFSHash)){
var divs = document.querySelector('#files-section');
- var art = document.createElement("article");
- art.id = 'file-'+zblockIPFSHash;
- if(json.title){
- var h3 = document.createElement("h3");
- h3.innerText = json.filename;
- art.appendChild(h3);
- }
- if(json.datetime){
- var small = document.createElement("p");
- small.innerText="Published: " +json.datetime;
- art.appendChild(small);
- }
- getNicknameAssossiatedWithGPG(blockObject.gpg);
- var small = document.createElement("p");
- small.innerText="Contributor: " + getNicknameAssossiatedWithGPG(blockObject.gpg);
- art.appendChild(small);
- if(json.ipfs){
- // getipfstext(json.ipfs,art.id);
- var small = document.createElement("a");
- small.innerText=json.filename;
- small.href="https://ipfs.arching-kaos.com/ipfs/"+json.ipfs+"?filename="+json.filename;
- art.appendChild(small);
- }
- divs.appendChild(art);
+ var art = {
+ element:"article",
+ id : 'file-'+zblockIPFSHash,
+ innerHTML: [
+ { element:"h3", innerText: (json.filename===null)?'':json.filename },
+ { element:"p", innerText:"Published: "+ (json.datetime===null)?'':json.datetime },
+ { element:"p", innerText:"Contributor: " + (getNicknameAssossiatedWithGPG(blockObject.gpg))?blockObject.gpg:getNicknameAssossiatedWithGPG(blockObject.gpg)},
+ { element:"a", innerText:json.filename, href:"https://ipfs.arching-kaos.com/ipfs/"+json.ipfs+"?filename="+json.filename}
+ ]
+ };
+ makeElement(art, divs);
if(document.querySelector("#files-sec-not-found")) document.querySelector("#files-sec-not-found").hidden = true;
- divs.appendChild(document.createElement("hr"));
+ makeElement({element:"hr"}, divs);
}
}
// @license-end