diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/css/akn.css | 51 | ||||
-rw-r--r-- | src/fonts/Doto.woff2 | bin | 0 -> 8664 bytes | |||
-rw-r--r-- | src/img/chat-logo.png | bin | 0 -> 5884 bytes | |||
-rw-r--r-- | src/img/mixtapes-logo.png | bin | 0 -> 3210 bytes | |||
-rw-r--r-- | src/img/news-logo.png | bin | 0 -> 2764 bytes | |||
-rw-r--r-- | src/img/radio-logo.png | bin | 0 -> 39213 bytes | |||
-rw-r--r-- | src/img/stellar.svg | 8 | ||||
-rw-r--r-- | src/index.html | 74 | ||||
-rw-r--r-- | src/js/app.js | 44 | ||||
-rw-r--r-- | src/js/arching-kaos-generator.js | 1 | ||||
-rw-r--r-- | src/js/arching-kaos-modules-news.js | 36 | ||||
-rw-r--r-- | src/js/arching-kaos-spa-router.js | 1 | ||||
-rw-r--r-- | src/js/arching-kaos-stellar-network.js | 90 | ||||
-rw-r--r-- | src/js/arching-kaos-tools.js | 8 | ||||
-rw-r--r-- | src/js/arching-kaos-web-ui-settings.js | 58 | ||||
-rw-r--r-- | src/js/environment-setup.js | 1 | ||||
-rw-r--r-- | src/js/menu-magic.js | 68 | ||||
-rw-r--r-- | src/js/ui/footer.js | 41 | ||||
-rw-r--r-- | src/js/ui/header.js | 19 | ||||
-rw-r--r-- | src/js/ui/main.js | 0 | ||||
-rw-r--r-- | src/js/ui/mainLayout.js | 22 | ||||
-rw-r--r-- | src/js/ui/menu.js | 148 | ||||
-rw-r--r-- | src/js/url-generators.js | 18 |
23 files changed, 380 insertions, 308 deletions
diff --git a/src/css/akn.css b/src/css/akn.css index e7ded1e..d879a0e 100644 --- a/src/css/akn.css +++ b/src/css/akn.css @@ -8,15 +8,15 @@ } @font-face { - font-family: 'Hack Nerd Font'; - src: url('../fonts/Hack.woff2') format('woff'); - font-weight: normal; + font-family: 'Doto'; + src: url('../fonts/Doto.woff2') format('woff'); + font-weight: 700; } body { - word-break: break-all; + word-break: normal; padding: 1%; - font-family: 'Hack Nerd Font'; + font-family: 'Doto'; font-size: medium; background-color: #1a1a1a; color: #7ef07e; @@ -86,17 +86,18 @@ fieldset { #menu a {display:inline-block;} -.footer p { margin: 0px; } +#footer p { margin: 0px; } -.footer { +#footer div { display: flex; gap: 5px; flex-direction: row; } +#footer { text-align: center; } .inv {display:block;text-align:center;} -pre {overflow:auto;} - -.whole{ +pre { + font-family: 'Doto'; + overflow:auto; } #gotop-link{ @@ -234,7 +235,7 @@ article { top: 48px; /* background-color: #2a2a2a;*/ background-color: #000000; - bottom: 62px; + bottom: 32px; width: auto; right: 0vw; left: 0vw; @@ -242,7 +243,7 @@ article { padding-right: 2vw; padding-top: 1vh; padding-bottom: 1vh; - max-height: 80vh; + max-height: 90vh; height: auto; min-height: 45vh; overflow-y: auto; @@ -284,7 +285,7 @@ h1 { padding: 2px; overflow-y: auto; display: flex; - align-items: end; + /* align-items: end; */ background: #cacaca; width: 100%; color:rgb(51, 200, 234); @@ -300,7 +301,7 @@ button { /* color: rgb(51, 200, 234);*/ color: rgb(0, 255, 231); text-decoration: none; - font-family: 'Hack Nerd Font'; + font-family: 'Doto'; border: 1px solid #17392e; padding: 10px; margin: 1px; @@ -341,7 +342,7 @@ button:hover { #double-floor { display: flex; - flex-direction: column; + flex-direction: row; } .upper-floor { @@ -396,6 +397,7 @@ audio { summary { background-color: #080808; padding: 4px; + word-break: break-all; } details { @@ -434,18 +436,11 @@ details { } #settings-section button {} -footer { - position: absolute; - right: 0; - bottom: 0; - padding: 2px; - text-align: right; -} -.footer { +#footer { margin: 0px; font-size: medium; position: fixed; - height: 62px; + height: 32px; display: flex; justify-content: center; align-items: center; @@ -492,13 +487,13 @@ footer { } } -@media (max-width: 880px) { - .footer { - font-size: smaller; +@media (max-width: 960px) { + #footer { + font-size: 8px; gap: 0px; flex-direction: column; } - .footer span { + #footer span { display: none; } } diff --git a/src/fonts/Doto.woff2 b/src/fonts/Doto.woff2 Binary files differnew file mode 100644 index 0000000..cba4776 --- /dev/null +++ b/src/fonts/Doto.woff2 diff --git a/src/img/chat-logo.png b/src/img/chat-logo.png Binary files differnew file mode 100644 index 0000000..e3f42f1 --- /dev/null +++ b/src/img/chat-logo.png diff --git a/src/img/mixtapes-logo.png b/src/img/mixtapes-logo.png Binary files differnew file mode 100644 index 0000000..4320ed4 --- /dev/null +++ b/src/img/mixtapes-logo.png diff --git a/src/img/news-logo.png b/src/img/news-logo.png Binary files differnew file mode 100644 index 0000000..9c6b6eb --- /dev/null +++ b/src/img/news-logo.png diff --git a/src/img/radio-logo.png b/src/img/radio-logo.png Binary files differnew file mode 100644 index 0000000..6727540 --- /dev/null +++ b/src/img/radio-logo.png diff --git a/src/img/stellar.svg b/src/img/stellar.svg new file mode 100644 index 0000000..1a1c2f4 --- /dev/null +++ b/src/img/stellar.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 236.36 200" height="16px" width="16px" fill="#ffffff"> + <g id="Layer_2" data-name="Layer 2"> + <g id="Layer_1-2" data-name="Layer 1"> + <path d="M203,26.16l-28.46,14.5-137.43,70a82.49,82.49,0,0,1-.7-10.69A81.87,81.87,0,0,1,158.2,28.6l16.29-8.3,2.43-1.24A100,100,0,0,0,18.18,100q0,3.82.29,7.61a18.19,18.19,0,0,1-9.88,17.58L0,129.57V150l25.29-12.89,0,0,8.19-4.18,8.07-4.11v0L186.43,55l16.28-8.29,33.65-17.15V9.14Z"/> + <path d="M236.36,50,49.78,145,33.5,153.31,0,170.38v20.41l33.27-16.95,28.46-14.5L199.3,89.24A83.45,83.45,0,0,1,200,100,81.87,81.87,0,0,1,78.09,171.36l-1,.53-17.66,9A100,100,0,0,0,218.18,100c0-2.57-.1-5.14-.29-7.68a18.2,18.2,0,0,1,9.87-17.58l8.6-4.38Z"/> + </g> + </g> +</svg> diff --git a/src/index.html b/src/index.html index 3541763..62e12d3 100644 --- a/src/index.html +++ b/src/index.html @@ -20,52 +20,9 @@ </head> <body> <div class="page-layout"> - <div class="topbar"> - <div class="header"> - <a href="#/welcome-section" id="#/welcome-section" onclick="menusel(this)"><img src="./img/header-logo.png"></a> - <h1 style="text-align: center;">Arching Kaos</h1> - </div> - <button class="menu-clickable" id="mobile-menu" onclick="toggleMenu(this)">Show menu</button> - <nav id="double-floor" class=""> - <div id="menu" class="upper-floor"> - <button class="menu-clickable" id="#/welcome-section" onclick="menusel(this)">🏡 Home</button> - <button class="has-dropdown menu-clickable" id="modules-submenu-link" onclick="modulesSubToggle(this)">🔌 Modules</button> - <button class="has-dropdown menu-clickable" id="explore-submenu-link" onclick="exploreSubToggle(this)">🥽 Explore</button> - <button class="menu-clickable" id="#/chat-section" onclick="menusel(this)">✍️ Chat</button> - <button class="menu-clickable" id="#/radio-section" onclick="menusel(this)">Radio</button> - <button class="menu-clickable" id="#/settings-section" onclick="menusel(this)">🔧 Settings</button> - <button class="has-dropdown menu-clickable" id="#/stellar-section" onclick="stellarSubToggle(this)"> - <img style="width: 13px; height: 13px;" src="./img/stellar.svg"/> - Stellar</button> - <button class="menu-clickable" id="#/about-section" onclick="menusel(this)">About</button> - </div> - <div id="menu" class="lower-floor"> - <div class="dropdown" id="modules-submenu"> - <button class="menu-clickable" onclick="modulesSubToggle(this)">..</button> - <button class="menu-clickable" id="#/mixtapes-section" onclick="menusel(this)">Mixtapes</button> - <button class="menu-clickable" id="#/news-section" onclick="menusel(this)">News</button> - <button class="menu-clickable" id="#/comments-section" onclick="menusel(this)">Comments</button> - <button class="menu-clickable" id="#/files-section" onclick="menusel(this)">Files</button> - </div> - <div class="dropdown" id="explore-submenu"> - <button class="menu-clickable" onclick="exploreSubToggle(this)">..</button> - <button class="menu-clickable" id="#/zchain-data-section" onclick="menusel(this)">zchain</button> - <button class="menu-clickable" id="#/stats-section" onclick="menusel(this)">Stats</button> - </div> - <div class="dropdown" id="stellar-submenu"> - <button class="menu-clickable" onclick="stellarSubToggle(this)">..</button> - <button class="menu-clickable" id="#/mypage-section" onclick="menusel(this)">My page</button> - <button class="menu-clickable" id="#/stellar-balances" onclick="menusel(this)">Balances</button> - <button class="menu-clickable" id="#/stellar-data-config" onclick="menusel(this)">Data</button> - <button class="menu-clickable" id="#/arching-kaos-node-info" onclick="menusel(this)">Node Info</button> - </div> - </div> - </nav> - <!-- <audio id="radio-player" controls autoplay hidden></audio> --> - <div hidden> - <span>Radio</span> - <button id="radio-button-controller" class="menu-clickable" onclick="radioToggle();">Loading...</button> - </div> + <div id="topbar" class="topbar"> + <div id="logo-title-placeholder"></div> + <div id="menu-placeholder"></div> </div> <div class="main"> <div id="welcome-section"> @@ -222,29 +179,9 @@ </div> </div> <div class="footer"> - <div> - <p> - Arching Kaos - <a target="_blank" href="https://github.com/arching-kaos/arching-kaos-tools">Tools</a>, - <a target="_blank" href="https://arching-kaos.org">Org</a>, - <a target="_blank" href="https://arching-kaos.net">Net</a> - </p> - </div> - <span>::</span> - <div> - <p> - <a target="_blank" href="https://github.com/arching-kaos/arching-kaos-web-ui/issues/new/choose">Report an issue</a> - </p> - </div> - <span>::</span> - <div> - <p> - Fra <a target="_blank" href="https://www.kaotisk-hund.com">Kaotisk Hund</a> med kjærlighet. - <a href="bitcoin:BC1QYL9K5KDLSLJAED9PZCJJX0CPGZVY9LWY427SD4">Donate</a> - </p> - </div> </div> </div> + <script src="./js/arching-kaos-generator.js"></script> <script src="./external/stellarSdk.js"></script> <script src="./external/purify.min.js"></script> <script src="./js/environment-setup.js"></script> @@ -252,7 +189,6 @@ <script src="./js/url-generators.js"></script> <script src="./js/arching-kaos-fetch.js"></script> <script src="./js/arching-kaos-log.js"></script> - <script src="./js/menu-magic.js"></script> <script src="./js/arching-kaos-spa-router.js"></script> <script src="./js/arching-kaos-modules-files.js"></script> <script src="./js/arching-kaos-modules-news.js"></script> @@ -262,8 +198,8 @@ <script src="./js/arching-kaos-tools.js"></script> <script src="./js/arching-kaos-stellar-network.js"></script> <script src="./js/arching-kaos-decentralized-radio.js"></script> - <script src="./js/arching-kaos-generator.js"></script> <script src="./js/utils.js"></script> + <script src="./js/footer.js"></script> <script src="./js/app.js"></script> </body> <!-- diff --git a/src/js/app.js b/src/js/app.js index f8fca5a..b84be92 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -15,33 +15,30 @@ body.height = window.innerHeight; pageLayout.width = window.innerWidth; pageLayout.height = window.innerHeight; mainContainer.style.display = 'block'; -window.innerWidth <= 770 ? isMobile = true : isMobile = false; -isMobile ? doubleFloorMenu.style.display = 'none':doubleFloorMenu.style.display = 'flex'; +window.innerWidth <= 850 ? isMobile = true : isMobile = false; + function onWindowResize() { body.width = window.innerWidth; body.height = window.innerHeight; pageLayout.width = window.innerWidth; pageLayout.height = window.innerHeight; - window.innerWidth <= 770 ? isMobile = true : isMobile = false; + window.innerWidth <= 850 ? isMobile = true : isMobile = false; isMobile ? doubleFloorMenu.style.display = 'none':doubleFloorMenu.style.display = 'flex'; } window.addEventListener('resize', onWindowResize, false); -// And call -menuinit(); -locationHashOnChange(); progressPlaceholder.value = '0'; progressPlaceholder.max++; -if ( activeSettings.stellar.scan ) +if ( settings.stellar.scan ) { scanStellarNetworkForPeers(); } -if ( activeSettings.ak.scan ) +if ( settings.ak.scan ) { ringlocalbell(); setInterval(ringlocalbell, 10*60*1000); @@ -50,5 +47,36 @@ if ( activeSettings.ak.scan ) //scanStellarNetworkForPeers(); // setInterval(scanStellarNetworkForPeers, 60000); +var root = { + head: document.querySelector('head'), + body: document.querySelector('body'), + html: document.querySelector('html') +}; + +var scripts = [ + { + element:"script", + src:"./js/ui/mainLayout.js" + } +]; +//, +// { +// element:"script", +// src:"./js/page-navigation.js" +// }, +// { +// element:"script", +// src:"./js/page-projects.js" +// }, +// { +// element:"script", +// src:"./js/menu.js" +// } +//]; + +for ( var i = 0; i < scripts.length; i++ ) +{ + makeElement(scripts[i], root.body); +} // vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 // @license-end diff --git a/src/js/arching-kaos-generator.js b/src/js/arching-kaos-generator.js index 67ab351..9c80954 100644 --- a/src/js/arching-kaos-generator.js +++ b/src/js/arching-kaos-generator.js @@ -30,6 +30,7 @@ function makeElement(obj, attachTo) if ( obj.src !== undefined ) temp.src = obj.src; if ( obj.as !== undefined ) temp.as = obj.as; if ( obj.target !== undefined ) temp.target = obj.target; + if ( obj.onclick !== undefined ) temp.setAttribute("onclick", obj.onclick); if ( obj.alt !== undefined ) temp.alt = obj.alt; if ( obj.charset !== undefined ) temp.charset = obj.charset; if ( obj.value !== undefined ) temp.value = obj.value; 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" }; diff --git a/src/js/arching-kaos-spa-router.js b/src/js/arching-kaos-spa-router.js index aa8ab31..1775d24 100644 --- a/src/js/arching-kaos-spa-router.js +++ b/src/js/arching-kaos-spa-router.js @@ -50,4 +50,5 @@ function locationHashOnChange(){ document.querySelector('#not-found-section').hidden=false; } } + // @license-end diff --git a/src/js/arching-kaos-stellar-network.js b/src/js/arching-kaos-stellar-network.js index b05770b..ca4d586 100644 --- a/src/js/arching-kaos-stellar-network.js +++ b/src/js/arching-kaos-stellar-network.js @@ -86,11 +86,11 @@ function getHolders(a=0){ } function getStellarConfigurationVariableURL(stellarAddress){ - return activeSettings.stellar.horizon.list[activeSettings.stellar.horizon.active]+ + return settings.stellar.horizon.list[settings.stellar.horizon.active]+ 'accounts/'+ stellarAddress+ '/data/'+ - activeSettings.stellar.variableNames.list[activeSettings.stellar.variableNames.active]; + settings.stellar.variableNames.list[settings.stellar.variableNames.active]; } function checkAddressForConfigurationVariable(stellarAddress) { @@ -99,13 +99,28 @@ function checkAddressForConfigurationVariable(stellarAddress) { progressPlaceholder.value++; } -var server = new StellarSdk.Server(activeSettings.stellar.horizon.list[activeSettings.stellar.horizon.active], {allowHttp:true}); +var server = new StellarSdk.Server(settings.stellar.horizon.list[settings.stellar.horizon.active], {allowHttp:true}); -function steptwo(r){ - const L = r; - putit(L); +function steptwo(i){ + var ta=document.querySelector("#stellar-balances-table"); + for (b in i.balances) { + x = i.balances[b]; + var amount = { + element:"tr", + innerHTML:[ + { element:"td", innerText: x.balance }, + { element:"td", innerText: ( x.asset_code && x.asset_code != "undefined" ? x.asset_code : 'XLM')} + ] + } + makeElement(amount, ta); + progressPlaceholder.max++; + progressPlaceholder.value++; + if(document.querySelector("#stellar-balances-not-found")) document.querySelector("#stellar-balances-not-found").hidden = true; + } } + function letme(a){ + console.log("HERE WE GO"); server.accounts() .accountId(a) .call() @@ -114,24 +129,6 @@ function letme(a){ ); } -function putit(i){ - var ta=document.querySelector("#stellar-balances-table"); - for (b in i.balances) { - var row = document.createElement("tr"); - x = i.balances[b]; - var amount = document.createElement("td"); - var assetCode = document.createElement("td"); - amount.innerText = x.balance; - assetCode.innerText = ( x.asset_code && x.asset_code != "undefined" ? x.asset_code : 'XLM'); - row.appendChild(assetCode); - row.appendChild(amount); - ta.appendChild(row); - progressPlaceholder.max++; - progressPlaceholder.value++; - if(document.querySelector("#stellar-balances-not-found")) document.querySelector("#stellar-balances-not-found").hidden = true; - } -} - async function fetchNodeInfoFromClientWallet(stellarAddress){ archingKaosLog("Loading your profile..."); fetch(getStellarConfigurationVariableURL(stellarAddress), { @@ -142,56 +139,35 @@ async function fetchNodeInfoFromClientWallet(stellarAddress){ }).then(response=>{ if(response.ok){ response.json().then(json=>{ - var cnf = document.createElement("p"); - cnf.innerText = atob(json.value); - document.querySelector('#stellar-data-config').appendChild(cnf); + var cnf = { + element:"p", + innerText:atob(json.value) + }; + makeElement(cnf, document.querySelector('#stellar-data-config')); progressPlaceholder.max++; progressPlaceholder.value++; getConfiguration(atob(json.value),stellarAddress); - }) + }); } - }) + }); } function putKeyToField(k){ - let base = document.querySelector("#stellar-freigher-connect-address-button"); + const address = k; + var base = document.querySelector("#stellar-freigher-connect-address-button"); + base.innerText=address; + base.onclick=''; stellar_connection_status = 1; checkAddressForConfigurationVariable(k); - base.innerText=k; - base.onclick=''; } -// TODO: Clarify which parts of here will be needed -//function showStellar(){ -// if (stellar_connection_status === 1 ){ -// document.querySelector("#stellar-balances-link").hidden=false; -// document.querySelector("#stellar-data-config-link").hidden=false; -// document.querySelector("#arching-kaos-node-info-link").hidden=false; -// document.querySelector("#mypage-section-link").hidden=false; -// } -//} -// TODO: (follow up) eg below -// Hide stellar stuff if no freighter -//if (!window.freighterApi.isConnected()) { -// document.querySelector("#stellar-freigher-connect-address-button").hidden=true; -//} -// -//function hideStellar(){ -// document.querySelector("#stellar-balances-link").hidden=true; -// document.querySelector("#stellar-data-config-link").hidden=true; -// document.querySelector("#arching-kaos-node-info-link").hidden=true; -// document.querySelector("#mypage-section-link").hidden=true; -//} -// -//hideStellar(); - // That's how we get the publicKey const retrievePublicKey = async () => { let publicKey = ""; let error = ""; try { publicKey = await window.freighterApi.getPublicKey() - .then(publicKey => {putKeyToField(publicKey);letme(publicKey)}); + .then((publicKey) => {putKeyToField(publicKey);letme(publicKey)}); } catch (e) { error = e; } diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js index 0e35c7f..0f62fd5 100644 --- a/src/js/arching-kaos-tools.js +++ b/src/js/arching-kaos-tools.js @@ -460,7 +460,7 @@ function crawlSchain(sblockHash){ zchainLoadingStatus[sblockHash] = {loading : "started"}; zchainsFound++; zchains[sblockHash] = []; - var url=activeSettings.localAPI+'/v0/sblock/'+sblockHash; + var url=settings.localAPI+'/v0/sblock/'+sblockHash; archingKaosLog("Fetching "+sblockHash+" sblock..."); archingKaosFetchJSON(url, sblockExpanding, [sblockHash]); archingKaosLog("Fetching "+sblockHash+" sblock... Done!"); @@ -485,21 +485,21 @@ function checkPeers(json){ function checkLocalPeers(){ archingKaosLog("🔎 Querying for peers..."); - var url=activeSettings.localAPI+'/v0/peers'; + var url=settings.ak.connect.list[settings.ak.connect.active]+'/v0/peers'; archingKaosFetchJSON(url, checkPeers); archingKaosLog("Querying for peers... Done!"); } function checkLocalNodeInfo(){ archingKaosLog("Ringing local bell..."); - var url=activeSettings.localAPI+'/v0/node_info'; + var url=settings.ak.connect.list[settings.ak.connect.active]+'/v0/node_info'; archingKaosFetchJSON(url, checkIfZchainAndProceed, ["localnode"]); archingKaosLog("Ringing local bell... Done!"); } function checkLocalSchain(){ archingKaosLog("Querying for schain..."); - var url=activeSettings.localAPI+'/v0/slatest'; + var url=settings.ak.connect.list[settings.ak.connect.active]+'/v0/slatest'; archingKaosFetchJSON(url, initCrawlSchain); archingKaosLog("Querying for schain... Done!"); } diff --git a/src/js/arching-kaos-web-ui-settings.js b/src/js/arching-kaos-web-ui-settings.js index 802e770..e170f4e 100644 --- a/src/js/arching-kaos-web-ui-settings.js +++ b/src/js/arching-kaos-web-ui-settings.js @@ -62,7 +62,7 @@ var default_settings = { ], active: 0 }, - scan: true + scan: false }, ak: { settings : { @@ -74,7 +74,7 @@ var default_settings = { 'http://[fc59:6076:6299:6776:c13d:fbb2:1226:ead0]:8610', 'http://api.aknet.z.kaotisk-hund.com/' ], - active: 0 + active: 1 }, scan: false } @@ -89,11 +89,11 @@ var default_settings = { // if ( window.localStorage.getItem("ak-settings") === null ) { // window.localStorage.setItem("ak-settings", JSON.stringify(default_settings)); // } -// var activeSettings = JSON.parse(window.localStorage.getItem("ak-settings")); +// var settings = JSON.parse(window.localStorage.getItem("ak-settings")); // // All comments above are replaced by temporary initializing without saving // anything in the localStorage -var activeSettings = default_settings; +var settings = default_settings; // Also, remove any settings stored from previous runs window.localStorage.removeItem("ak-settings"); @@ -104,17 +104,17 @@ window.localStorage.removeItem("ak-settings"); if (( location.origin === "http://z.kaotisk-hund.com") || ( location.origin === "http://gw.ipfs.z.kaotisk-hund.com") || ( location.origin === "http://[fc59:6076:6299:6776:c13d:fbb2:1226:ead0]")) { - activeSettings.ipfsSelectedGatewayAddress = 1; - activeSettings.horizonSelectedAddress = 1; + settings.ipfs.gateway.active = 1; + settings.stellar.horizon.active = 1; } else if ( location.origin === "http://localhost:3000" ) { - activeSettings.ipfsSelectedGatewayAddress = 2; + settings.ipfs.gateway.active = 2; } else { - activeSettings.ipfsSelectedGatewayAddress = 0; + settings.ipfs.gateway.active = 0; } var settingsPage = document.querySelector('#settings-section'); -var settingsKeys = Object.keys(activeSettings); +var settingsKeys = Object.keys(settings); function renderCheck(container, value){ var checkbox = document.createElement('input'); @@ -161,16 +161,10 @@ function settingPlaceToDOM(key, value){ value.map((v)=>{ if (v.constructor.name === "Object"){ Object.keys(v).forEach((value)=>{ - var li = document.createElement("option"); - li.innerText = value + ': ' + v[value]; - li.value = value; - ul.appendChild(li); + makeElement({element:"option", innerText:value + ': ' + v[value], value: value}, ul); }); } else { - var li = document.createElement("option"); - li.innerText = v; - li.value = v; - ul.appendChild(li); + makeElement({element:"option", innerText:v, value: v}, ul); } }); container.appendChild(ul); @@ -178,37 +172,25 @@ function settingPlaceToDOM(key, value){ console.log("KEY: "+key); switch (key){ case 'ipfs': - var label = document.createElement('summary'); - label.innerText = "Gateway"; - container.appendChild(label); + makeElement({ element:"summary",innerText:"IPFS" }, container); renderList(container, value.gateway); break; case 'stellar': - var label = document.createElement('summary'); - label.innerText = "Stellar"; - container.appendChild(label); + makeElement({ element:"summary",innerText:"Asset" }, container); renderAssets(container, value.asset); - var label = document.createElement('summary'); - label.innerText = "Variable Names"; - container.appendChild(label); + makeElement({ element:"summary",innerText:"Variable Names" }, container); renderList(container, value.variableNames); - var label = document.createElement('summary'); - label.innerText = "Horizon"; - container.appendChild(label); + makeElement({ element:"summary",innerText:"Horizon" }, container); renderList(container, value.horizon); - var label = document.createElement('summary'); - label.innerText = "Scan"; - container.appendChild(label); + makeElement({ element:"summary",innerText:"Scan" }, container); renderCheck(container, value.scan); break; case 'ak': - var label = document.createElement('summary'); - label.innerText = "Connect"; - container.appendChild(label); + makeElement({ element:"summary",innerText:"Connect" }, container); renderList(container, value.connect); break; default: @@ -223,17 +205,17 @@ function settingPlaceToDOM(key, value){ settingsKeys.forEach( (value) => { - settingPlaceToDOM(value, activeSettings[value]); + settingPlaceToDOM(value, settings[value]); } ); /* Small dump as pre text */ var predump = document.createElement('pre'); -predump.innerText = JSON.stringify(activeSettings, null, 2); +predump.innerText = JSON.stringify(settings, null, 2); settingsPage.appendChild(predump); /* END of: Small dump as pre text */ -// console.log(activeSettings.ipfsGatewayAddress[activeSettings.ipfsSelectedGatewayAddress]); +// console.log(settings.ipfsGatewayAddress[settings.ipfsSelectedGatewayAddress]); // vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 // @license-end diff --git a/src/js/environment-setup.js b/src/js/environment-setup.js index d66465b..5daf7c7 100644 --- a/src/js/environment-setup.js +++ b/src/js/environment-setup.js @@ -26,7 +26,6 @@ var nodeInfo = new Array; var body = document.querySelector('body'); var pageLayout = document.querySelector('.page-layout'); var mainContainer = document.querySelector('.main'); -var doubleFloorMenu = document.querySelector('#double-floor'); var isMobile = false; var aknet = document.querySelector('.aknet-network' |