aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-modules-news.js
blob: b4c6819bfd2a21e869212165db4a0d1e6138c574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

function akModuleNews(zblockIPFSHash, zblockObject, blockObject, json){
    if (!document.querySelector('#news-'+zblockIPFSHash)){
        var divs = document.querySelector('#news-section');
        var art = document.createElement("article");
        art.id = 'news-'+zblockIPFSHash;
        if(json.title){
            var ahref = document.createElement("a");
            ahref.innerText = json.title +' [permalink]';
            ahref.href = 'https://news.arching-kaos.net/?from_block='+zblockObject.block;
            art.appendChild(ahref);
        }
        if(json.datetime){
            var small = document.createElement("p");
            small.innerText="Published: " + new Date(blockObject.timestamp*1000);
            art.appendChild(small);
        }
        var small = document.createElement("p");
        small.innerText="Contributor: " + getNicknameAssossiatedWithGPG(blockObject.gpg);
        art.appendChild(small);
        art.appendChild(document.createElement("hr"));
        if(json.ipfs){
            getipfstext(json.ipfs,art.id);
        }
        if (document.querySelector("#news-sec-not-found")) document.querySelector("#news-sec-not-found").hidden=true;
        divs.appendChild(art);
        divs.appendChild(document.createElement("hr"));
    }
}