From 5652c7f391b92fb3ef0b9f401e22b9e51ca5a7a5 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 11 Apr 2024 18:29:43 +0300 Subject: results of render now output results --- src/css/akn.css | 20 +++++++ src/index.html | 5 +- src/js/arching-kaos-tools.js | 124 +++++++++++++++++++++++++++++++------------ src/js/environment-setup.js | 1 + 4 files changed, 115 insertions(+), 35 deletions(-) diff --git a/src/css/akn.css b/src/css/akn.css index 816b098..0c548b2 100644 --- a/src/css/akn.css +++ b/src/css/akn.css @@ -488,3 +488,23 @@ footer { display: none; } } + +#unique-overlay { + position: fixed; + z-index: 1; + background: black; + width: auto; + height: auto; + overflow: scroll; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + margin: 0px; + padding: 1vh 4vw; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; + align-content: flex-start; +} diff --git a/src/index.html b/src/index.html index 66c6b12..11dab10 100644 --- a/src/index.html +++ b/src/index.html @@ -77,10 +77,13 @@ align-items: center; gap: 10px;" > -
Render since zblock
+

Render since zblock

+
+

Results

+
{ + document.querySelector('#unique-overlay').remove(); + }; + closeButton.innerHTML = 'x'; + overlay.appendChild(closeButton); + overlay.appendChild(found); + resultsArea.appendChild(overlay); +} + function renderStellarAddressPlaceholder(stellarAddress){ var divs = document.querySelector('#'+stellarAddress); if ( divs === null ){ @@ -53,7 +70,7 @@ function nodeInfoRenderAndProceed(json, stellarAddress){ function renderZblockAndProceed(json, params){ console.log(typeof(params)) const [zblockIPFSHash, group, recursive] = params; - console.log(group) + console.log(group); var zblockElement = document.querySelector('#zb-'+zblockIPFSHash); if(json.block){ var p = document.createElement("p"); @@ -122,7 +139,7 @@ function blockRenderAndProceed(json, params){ if(detailsPlace!== null) detailsPlace.appendChild(p); } progressPlaceholder.value++; - exe(json.action,json.data,json,zblockIPFSHash,group,zblockObject); + exe(json.action,json.data,json,zblockIPFSHash,group,zblockObject,recursive); if ( checkIfGenesis(json.previous) ){ archingKaosLog("Done loading " + group + " zchain!") progressPlaceholder.value++; @@ -273,7 +290,7 @@ function getConfiguration(nodeInfoIPNSLink,stellarAddress){ } function renderZblockAsModule(json, params){ - const [action, zblockIPFSHash, zblockObject, blockObject, references] = params; + const [action, group, zblockIPFSHash, zblockObject, blockObject, references, recursive] = params; if (action == "files/add") { akModuleFiles(zblockIPFSHash, blockObject, json); } @@ -292,40 +309,79 @@ function renderZblockAsModule(json, params){ else { archingKaosLog(action + " module not found"); } +} +function saveDataAndFullZblocks(json,params){ + const [action, group, zblockIPFSHash, zblockObject, blockObject, references, recursive] = params; + fullZblocks[zblockIPFSHash]={ + zblock:zblockIPFSHash, + block:zblockObject.block, + block_signature:zblockObject.block_signature, + action:blockObject.action, + previous:blockObject.previous, + data:blockObject.data, + dataExpansion:json, + detach:blockObject.detach, + gpg:blockObject.gpg, + timestamp:blockObject.timestamp + }; + zblocks[group] = new Array; + zblocks[group].push(zblockIPFSHash); + data[blockObject.data]=json; + progressPlaceholder.max++; + progressPlaceholder.value++; } -function exe(action,dataIPFSHash,blockObject,zblockIPFSHash,group,zblockObject){ - archingKaosLog("Render ZBLOCK "+zblockIPFSHash+" as " + action + " ..."); - archingKaosFetchJSON(getIPFSURL(dataIPFSHash), renderZblockAsModule, [action, zblockIPFSHash, zblockObject, blockObject, references]); - fetch(getIPFSURL(dataIPFSHash), { - method:'GET', - headers:{ - Accept: 'application/json' - } - }).then(response=>{ - if(response.ok){ - response.json().then(json=>{ - fullZblocks[zblockIPFSHash]={ - zblock:zblockIPFSHash, - block:zblockObject.block, - block_signature:zblockObject.block_signature, - action:blockObject.action, - previous:blockObject.previous, - data:blockObject.data, - dataExpansion:json, - detach:blockObject.detach, - gpg:blockObject.gpg, - timestamp:blockObject.timestamp - }; - zblocks[group] = new Array; - zblocks[group].push(zblockIPFSHash); - data[dataIPFSHash]=json; - progressPlaceholder.max++; - progressPlaceholder.value++; - }) - } - }) +function doStuffWithFetchedDataBlock(json, params){ + saveDataAndFullZblocks(json,params); + renderZblockAsModule(json, params); +} + +function exe(action,dataIPFSHash,blockObject,zblockIPFSHash,group,zblockObject,recursive){ + if (!recursive) { + var button = document.createElement('button'); + button.innerText =`${action.split('/')[0]}-${zblockIPFSHash} 📖`; + var params = `${action.split('/')[0]}-${zblockIPFSHash}` + button.onclick = ()=>{ + showResult(params); + }; + resultsArea.appendChild(button); + } + archingKaosLog(`Render ZBLOCK ${zblockIPFSHash} as ${action} ...`); + archingKaosFetchJSON( + getIPFSURL(dataIPFSHash), + doStuffWithFetchedDataBlock, + [action, group, zblockIPFSHash, zblockObject, blockObject, references, recursive] + ); +// archingKaosFetchJSON(getIPFSURL(dataIPFSHash), saveDataAndFullZblocks, [group, zblockIPFSHash,zblockObject,blockObject]); +// fetch(getIPFSURL(dataIPFSHash), { +// method:'GET', +// headers:{ +// Accept: 'application/json' +// } +// }).then(response=>{ +// if(response.ok){ +// response.json().then(json=>{ +// fullZblocks[zblockIPFSHash]={ +// zblock:zblockIPFSHash, +// block:zblockObject.block, +// block_signature:zblockObject.block_signature, +// action:blockObject.action, +// previous:blockObject.previous, +// data:blockObject.data, +// dataExpansion:json, +// detach:blockObject.detach, +// gpg:blockObject.gpg, +// timestamp:blockObject.timestamp +// }; +// zblocks[group] = new Array; +// zblocks[group].push(zblockIPFSHash); +// data[dataIPFSHash]=json; +// progressPlaceholder.max++; +// progressPlaceholder.value++; +// }) +// } +// }) } function getipfstext(ipfsHash, articleid){ diff --git a/src/js/environment-setup.js b/src/js/environment-setup.js index ebcc4b6..f33e0b8 100644 --- a/src/js/environment-setup.js +++ b/src/js/environment-setup.js @@ -22,6 +22,7 @@ var mainContainer = document.querySelector('.main'); var doubleFloorMenu = document.querySelector('#double-floor'); var isMobile = false; var aknet = document.querySelector('.aknet-network') +var resultsArea = document.querySelector('.results-area') /* -- cgit v1.2.3