style buttons
This commit is contained in:
parent
8a53b968c0
commit
102bf79b12
3 changed files with 28 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="webpage/style.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title>APT mirror</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -16,6 +16,6 @@
|
|||
<pre><code></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<script src="webpage/script.js"></script>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
10
script.js
10
script.js
|
|
@ -3,12 +3,16 @@ const versionSelection = document.getElementById("versionSelection");
|
|||
const configurationDiv = document.getElementById("configuration");
|
||||
|
||||
async function generatePage() {
|
||||
const config = await (await fetch("webpage/config.json")).json();
|
||||
const config = await (await fetch("config.json")).json();
|
||||
console.log(config);
|
||||
config.forEach(category => {
|
||||
let button = document.createElement("button");
|
||||
button.innerText = category["name"]
|
||||
button.onclick = () => {
|
||||
Array.from(categorySeletion.getElementsByClassName("selected")).forEach(element => {
|
||||
element.classList.remove("selected")
|
||||
})
|
||||
button.classList.add("selected")
|
||||
versionSelection.innerHTML = "";
|
||||
category["entries"].forEach(entry => {
|
||||
const button2 = document.createElement("button");
|
||||
|
|
@ -16,6 +20,10 @@ async function generatePage() {
|
|||
button2.innerText = entry["name"];
|
||||
|
||||
button2.onclick = () => {
|
||||
Array.from(versionSelection.getElementsByClassName("selected")).forEach(element => {
|
||||
element.classList.remove("selected")
|
||||
})
|
||||
button2.classList.add("selected")
|
||||
configurationDiv.style.display = "block";
|
||||
configurationDiv.getElementsByTagName("code")[0].innerText = entry["config"]
|
||||
}
|
||||
|
|
|
|||
17
style.css
17
style.css
|
|
@ -27,4 +27,21 @@ border-radius: 10px;
|
|||
|
||||
#configuration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button{
|
||||
padding: 10px;
|
||||
margin: 5px;
|
||||
background-color: #393939;
|
||||
color: #eee;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #505050;
|
||||
}
|
||||
|
||||
.selected {
|
||||
background-color: #505050;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue