diff --git a/index.html b/index.html index 72939c3..89fb038 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,6 @@ tronnet - client - @@ -15,6 +14,7 @@
diff --git a/resources.html b/resources.html new file mode 100644 index 0000000..c41cb32 --- /dev/null +++ b/resources.html @@ -0,0 +1,23 @@ + + + + + + tronnet - client + + + + + +
+ +
+
+
+ + + \ No newline at end of file diff --git a/scripts/index.js b/scripts/index.js index 377dc4d..8c7cf74 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,4 +1,4 @@ -import {requestPVE, requestAPI, goToPage, deleteAllCookies} from "./utils.js"; +import {requestPVE, requestAPI, goToPage} from "./utils.js"; import { Dialog } from "./dialog.js"; window.addEventListener("DOMContentLoaded", init); diff --git a/scripts/resources.js b/scripts/resources.js new file mode 100644 index 0000000..b41bbf9 --- /dev/null +++ b/scripts/resources.js @@ -0,0 +1,30 @@ +import {requestPVE, requestAPI} from "./utils.js"; + +window.addEventListener("DOMContentLoaded", init); + +async function init () { + let resources = await requestAPI("/user/resources"); + document.querySelector("main").innerHTML = buildTable(resources.resources, 1); +} + +function buildTable (object, idx) { + + if (object instanceof Object) { + let table = ""; + if (idx === 1) { // topmost table gets some margin and a border + table += ``; + } + else { + table += `
`; + } + Object.keys(object).forEach((element) => { + table += ``; + }); + table += "
${element}${buildTable(object[element], idx + 1)}
" + + return table; + } + else { + return object; + } +} \ No newline at end of file