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 3160e0a858
commit e369456c57
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

@ -85,3 +85,8 @@ export function goToPage (page, data={}) {
}
window.location.href = url.toString();
}
export function getURIData () {
let url = new URL(window.location.href);
return Object.fromEntries(url.searchParams);
}