aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-modules-news.js
blob: 0a1652a965ba55d076d69eff32235e7fb20f9023 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* Arching Kaos Module News
 *
 * Kaotisk Hund - 2024
 *
 * @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
 *
 */

function akModuleNews(zblockIPFSHash, zblockObject, blockObject, json){
    if (!document.querySelector('#news-'+zblockIPFSHash)){
        var newsSectionDivElement = document.querySelector('#news-section');
        var articleContainerElement = {
            element:"article",
            id:'news-'+zblockIPFSHash
        };
        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);
        }
        var small = {
            element:"p",
            innerText:"Contributor: " + getNicknameAssossiatedWithGPG(blockObject.gpg)
        };
        makeElement(small, articleContainerElement);
        var hr = { element:"hr" };
        makeElement(hr, articleContainerElement);
        if(json.ipfs){
            getipfstext(json.ipfs,articleContainerElement.id);
        }
        if (document.querySelector("#news-sec-not-found")) document.querySelector("#news-sec-not-found").hidden=true;
        makeElement(hr, newsSectionDivElement);
    }
}
// @license-end