57 lines
1.2 KiB
HTML
57 lines
1.2 KiB
HTML
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Dashboard con Menu a Tendina</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
font-family: sans-serif;
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
}
|
|
header {
|
|
background: #333;
|
|
color: white;
|
|
padding: 1rem;
|
|
}
|
|
select {
|
|
padding: 0.5rem;
|
|
font-size: 1rem;
|
|
}
|
|
iframe {
|
|
flex: 1;
|
|
border: none;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<select id="siteSelect"></select>
|
|
</header>
|
|
<iframe id="contentFrame"></iframe>
|
|
|
|
<script>
|
|
fetch("/config.json")
|
|
.then(res => res.json())
|
|
.then(cfg => {
|
|
const select = document.getElementById("siteSelect");
|
|
const iframe = document.getElementById("contentFrame");
|
|
|
|
cfg.sites.forEach(site => {
|
|
const option = document.createElement("option");
|
|
option.value = `${cfg.url}/${site}`;
|
|
option.textContent = site;
|
|
select.appendChild(option);
|
|
});
|
|
|
|
// sito iniziale
|
|
iframe.src = `${cfg.url}/${cfg.sites[0]}`;
|
|
|
|
select.addEventListener("change", () => {
|
|
iframe.src = select.value;
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|