Moving some initialization logic to its own module

This commit is contained in:
shockrah
2021-01-25 18:21:35 -08:00
parent b67bb6105f
commit 1292e5ab3f
2 changed files with 49 additions and 13 deletions

View File

@@ -79,24 +79,16 @@
<!-- JQuery doesn't load so our squishy boi of the the collapsable menu literally doesn't work-->
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script>window.jQuery = window.$ = require('jquery')</script>
<script type="text/javascript" src="../node_modules/popper.js/dist/umd/popper.js"></script>
<script type="text/javascript" src="../node_modules/popper.js/dist/umd/popper-utils.js"></script>
<script type="text/javascript" src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script>
const { ipcRenderer } = require('electron')
const config = ipcRenderer.sendSync('config-request', 'benis')
// only put things like the server list up if theres anythng to put in there
if(config['servers']) {
let parent = document.getElementById('server-list')
for(const server of config['servers']) {
let node = document.createElement('button')
node.classList.add('btn', 'btn-outline-secondary', 'btn-nav-settings')
node.type = 'button'
node.textContent = server['name']
node.id = server['ip'] || server['url'] // perfer the ip to avoid dns
parent.appendChild(node)
}
}
const config = ipcRenderer.sendSync('config-request')
const html = require('../src/html.js')
html.build_server_list(config, 'server-list')
</script>
</html>