add config.html,

add config.js,
add getURIData function to parse URI search params
This commit is contained in:
Arthur Lu 2022-12-18 22:14:57 -08:00
parent 4fd15f804b
commit ecb7e6f192
3 changed files with 26 additions and 0 deletions

13
config.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>tronnet - client</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<script src="scripts/config.js" type="module"></script>
</head>
<body>
</body>
</template>
</html>

8
scripts/config.js Normal file
View File

@ -0,0 +1,8 @@
import {request, goToPage, getURIData} from "./utils.js";
window.addEventListener("DOMContentLoaded", init);
async function init () {
let uriData = getURIData();
console.log(uriData);
}

View File

@ -84,4 +84,9 @@ export function goToPage (page, data={}) {
url.searchParams.append(k, data[k]);
}
window.location.href = url.toString();
}
export function getURIData () {
let url = new URL(window.location.href);
return Object.fromEntries(url.searchParams);
}