diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-29 16:23:39 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-29 16:23:39 +0200 |
commit | afcedd44615d20423d58f4d9c9d8cfa3838a54d4 (patch) | |
tree | e16cd7f2eb4040f7b237baa45aa3f8f80516dcc4 /src/js/app.js | |
parent | 084e3ce6efc49c2d43ce9b44d96e430f8057848e (diff) | |
download | arching-kaos-web-ui-afcedd44615d20423d58f4d9c9d8cfa3838a54d4.tar.gz arching-kaos-web-ui-afcedd44615d20423d58f4d9c9d8cfa3838a54d4.tar.bz2 arching-kaos-web-ui-afcedd44615d20423d58f4d9c9d8cfa3838a54d4.zip |
Major refactoring
Diffstat (limited to 'src/js/app.js')
-rw-r--r-- | src/js/app.js | 142 |
1 files changed, 96 insertions, 46 deletions
diff --git a/src/js/app.js b/src/js/app.js index b84be92..fd92c87 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -10,40 +10,96 @@ * TODO: Figure out why it doesn't work in fullscreen App mode (android) * */ -body.width = window.innerWidth; -body.height = window.innerHeight; -pageLayout.width = window.innerWidth; -pageLayout.height = window.innerHeight; -mainContainer.style.display = 'block'; -window.innerWidth <= 850 ? isMobile = true : isMobile = false; +import { makeElement } from "./arching-kaos-generator.js"; +import { locationHashOnChange } from "./arching-kaos-spa-router.js"; +import { doubleFloorMenu, menuinit, menusel, stellarSubToggle, modulesSubToggle, exploreSubToggle } from './ui/menu.js'; +import { mainLayoutSpawn } from "./ui/mainLayout.js"; +import { scanStellarNetworkForPeers } from "./arching-kaos-stellar-network.js"; -function onWindowResize() +window.menusel = menusel; +window.locationHashOnChange = locationHashOnChange; +window.stellarSubToggle = stellarSubToggle; +window.modulesSubToggle = modulesSubToggle; +window.exploreSubToggle = exploreSubToggle; +window.scanStellarNetworkForPeers = scanStellarNetworkForPeers; + +export function body() { - body.width = window.innerWidth; - body.height = window.innerHeight; - pageLayout.width = window.innerWidth; - pageLayout.height = window.innerHeight; - window.innerWidth <= 850 ? isMobile = true : isMobile = false; - isMobile ? doubleFloorMenu.style.display = 'none':doubleFloorMenu.style.display = 'flex'; + return document.querySelector('body'); +} + +export function pageLayout() +{ + return document.querySelector('.page-layout'); } -window.addEventListener('resize', onWindowResize, false); +export function mainContainer() +{ + return document.querySelector('.main'); +} -progressPlaceholder.value = '0'; +window.isMobile = false; -progressPlaceholder.max++; +export function aknet() +{ + return document.querySelector('.aknet-network') +} + +export function resultsArea() +{ + return document.querySelector('.results-area') +} + +export function progressPlaceholder() +{ + return document.querySelector('#total-progress'); +} + +export function httpProgressPlaceholder() +{ + return document.querySelector('#http-progress'); +} -if ( settings.stellar.scan ) +export function currentLogMessageElement() { - scanStellarNetworkForPeers(); + return document.querySelector('#current-log-message'); } -if ( settings.ak.scan ) +export function logsAreaElement() { - ringlocalbell(); - setInterval(ringlocalbell, 10*60*1000); + return document.querySelector("#logs-area-element"); } +export function radio() +{ + return document.querySelector("#radio-player"); +} + +export function radioButton() +{ + return document.querySelector("#radio-button-controller"); +} + + +body().width = window.innerWidth; +body().height = window.innerHeight; +pageLayout().width = window.innerWidth; +pageLayout().height = window.innerHeight; +mainContainer().style.display = 'block'; +window.innerWidth <= 850 ? window.isMobile = true : window.isMobile = false; + +function onWindowResize() +{ + body.width = window.innerWidth; + body.height = window.innerHeight; + pageLayout.width = window.innerWidth; + pageLayout.height = window.innerHeight; + window.innerWidth <= 850 ? window.isMobile = true : window.isMobile = false; + window.isMobile ? doubleFloorMenu().style.display = 'none': doubleFloorMenu().style.display = 'flex'; +} +window.addEventListener('resize', onWindowResize, false); + + //scanStellarNetworkForPeers(); // setInterval(scanStellarNetworkForPeers, 60000); @@ -53,30 +109,24 @@ var root = { 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); -} +// var scripts = [ +// { +// element:"script", +// type: "module", +// src:"./js/ui/mainLayout.js" +// } +// ]; +// +// for ( var i = 0; i < scripts.length; i++ ) +// { +// makeElement(scripts[i], root.body); +// } + +mainLayoutSpawn(); +// And call +menuinit(); +locationHashOnChange(); + +window.isMobile ? doubleFloorMenu().style.display = 'none': doubleFloorMenu().style.display = 'flex'; // vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 // @license-end |