Horário
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
services:
|
||||
horario-escolar:
|
||||
image: nginx:alpine
|
||||
container_name: horario-escolar
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "2090:80"
|
||||
volumes:
|
||||
- ./horario-escolar.html:/usr/share/nginx/html/index.html:ro
|
||||
@@ -0,0 +1,509 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Horário 5.º C</title>
|
||||
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
/* HORÁRIO */
|
||||
|
||||
.schedule {
|
||||
display: grid;
|
||||
|
||||
/* Hora = 35px | cada dia = 58px */
|
||||
grid-template-columns: 42px repeat(5, 58px);
|
||||
|
||||
gap: 2px;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
/* CÉLULAS */
|
||||
|
||||
.cell {
|
||||
height: 26px;
|
||||
padding: 2px 3px;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
position: relative;
|
||||
|
||||
border-radius: 4px;
|
||||
|
||||
background: #edf2f4;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* CABEÇALHO */
|
||||
|
||||
.header-cell {
|
||||
height: 25px;
|
||||
|
||||
background: #19594f;
|
||||
color: white;
|
||||
|
||||
font-weight: bold;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
/* HORAS */
|
||||
|
||||
.time {
|
||||
background: #e3eaec;
|
||||
|
||||
font-size: 8px;
|
||||
font-weight: bold;
|
||||
|
||||
line-height: 1.05;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* DISCIPLINAS */
|
||||
|
||||
.class {
|
||||
justify-content: space-between;
|
||||
|
||||
font-size: 9px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
/* SALA */
|
||||
|
||||
.room {
|
||||
margin-left: 2px;
|
||||
|
||||
font-size: 7px;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* NOTA SEMESTRAL */
|
||||
|
||||
.note {
|
||||
position: absolute;
|
||||
|
||||
right: 2px;
|
||||
bottom: 1px;
|
||||
|
||||
font-size: 5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* CORES */
|
||||
|
||||
.mat { background: #93c5f5; }
|
||||
.cn { background: #9de8b7; }
|
||||
.ing { background: #98e5ac; }
|
||||
.port { background: #ff6674; }
|
||||
.hgp { background: #ffad61; }
|
||||
.ef { background: #bca3ee; }
|
||||
.et { background: #ffe27a; }
|
||||
.em { background: #f49abb; }
|
||||
.ev { background: #ef96c7; }
|
||||
.tic { background: #c4a5ef; }
|
||||
.cd { background: #ed95c3; }
|
||||
|
||||
/* DIA ATUAL */
|
||||
|
||||
.today {
|
||||
box-shadow: inset 0 0 0 2px #0e8878;
|
||||
}
|
||||
|
||||
.header-cell.today {
|
||||
background: #0e8878;
|
||||
}
|
||||
|
||||
/* AULA ATUAL */
|
||||
|
||||
.current {
|
||||
outline: 2px solid #16a34a;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="schedule" class="schedule"></div>
|
||||
|
||||
<script>
|
||||
|
||||
/* HORAS */
|
||||
|
||||
const periods = [
|
||||
["08:30","09:20"],
|
||||
["09:20","10:10"],
|
||||
["10:30","11:20"],
|
||||
["11:20","12:10"],
|
||||
["12:25","13:15"],
|
||||
["13:30","14:20"],
|
||||
["14:20","15:10"],
|
||||
["15:20","16:10"],
|
||||
["16:20","17:10"],
|
||||
["17:30","18:20"]
|
||||
];
|
||||
|
||||
const days = [
|
||||
"Seg",
|
||||
"Ter",
|
||||
"Qua",
|
||||
"Qui",
|
||||
"Sex"
|
||||
];
|
||||
|
||||
|
||||
/* HORÁRIO */
|
||||
|
||||
const timetable = {
|
||||
|
||||
1: [
|
||||
{
|
||||
start:"08:30",
|
||||
end:"09:20",
|
||||
subject:"Lab.",
|
||||
room:"B12",
|
||||
note:"Sem.",
|
||||
color:"tic"
|
||||
},
|
||||
{
|
||||
start:"09:20",
|
||||
end:"10:10",
|
||||
subject:"ET",
|
||||
room:"B5",
|
||||
color:"et"
|
||||
},
|
||||
{
|
||||
start:"10:30",
|
||||
end:"11:20",
|
||||
subject:"EM",
|
||||
room:"D5",
|
||||
color:"em"
|
||||
},
|
||||
{
|
||||
start:"11:20",
|
||||
end:"12:10",
|
||||
subject:"ING",
|
||||
room:"B4",
|
||||
color:"ing"
|
||||
}
|
||||
],
|
||||
|
||||
2: [
|
||||
{
|
||||
start:"08:30",
|
||||
end:"10:10",
|
||||
subject:"MAT",
|
||||
room:"B4",
|
||||
color:"mat"
|
||||
},
|
||||
{
|
||||
start:"10:30",
|
||||
end:"12:10",
|
||||
subject:"EF2",
|
||||
room:"E2",
|
||||
color:"ef"
|
||||
},
|
||||
{
|
||||
start:"12:25",
|
||||
end:"13:15",
|
||||
subject:"CN",
|
||||
room:"B4",
|
||||
color:"cn"
|
||||
},
|
||||
{
|
||||
start:"14:20",
|
||||
end:"15:10",
|
||||
subject:"HGP",
|
||||
room:"B13",
|
||||
color:"hgp"
|
||||
},
|
||||
{
|
||||
start:"15:20",
|
||||
end:"16:10",
|
||||
subject:"ING",
|
||||
room:"B4",
|
||||
color:"ing"
|
||||
}
|
||||
],
|
||||
|
||||
3: [
|
||||
{
|
||||
start:"08:30",
|
||||
end:"10:10",
|
||||
subject:"CN",
|
||||
room:"B12",
|
||||
color:"cn"
|
||||
},
|
||||
{
|
||||
start:"10:30",
|
||||
end:"12:10",
|
||||
subject:"MAT",
|
||||
room:"C10",
|
||||
color:"mat"
|
||||
},
|
||||
{
|
||||
start:"12:25",
|
||||
end:"13:15",
|
||||
subject:"ET",
|
||||
room:"B5",
|
||||
color:"et"
|
||||
},
|
||||
{
|
||||
start:"14:20",
|
||||
end:"15:10",
|
||||
subject:"CD",
|
||||
room:"B4",
|
||||
color:"cd"
|
||||
},
|
||||
{
|
||||
start:"15:20",
|
||||
end:"16:10",
|
||||
subject:"PORT",
|
||||
room:"B15",
|
||||
color:"port"
|
||||
}
|
||||
],
|
||||
|
||||
4: [
|
||||
{
|
||||
start:"08:30",
|
||||
end:"10:10",
|
||||
subject:"EV2",
|
||||
room:"B5",
|
||||
color:"ev"
|
||||
},
|
||||
{
|
||||
start:"10:30",
|
||||
end:"11:20",
|
||||
subject:"HGP",
|
||||
room:"B4",
|
||||
color:"hgp"
|
||||
},
|
||||
{
|
||||
start:"11:20",
|
||||
end:"12:10",
|
||||
subject:"PORT",
|
||||
room:"B4",
|
||||
color:"port"
|
||||
},
|
||||
{
|
||||
start:"12:25",
|
||||
end:"13:15",
|
||||
subject:"ING",
|
||||
room:"B4",
|
||||
color:"ing"
|
||||
}
|
||||
],
|
||||
|
||||
5: [
|
||||
{
|
||||
start:"08:30",
|
||||
end:"09:20",
|
||||
subject:"HGP",
|
||||
room:"B4",
|
||||
color:"hgp"
|
||||
},
|
||||
{
|
||||
start:"09:20",
|
||||
end:"10:10",
|
||||
subject:"EF2",
|
||||
room:"E4",
|
||||
color:"ef"
|
||||
},
|
||||
{
|
||||
start:"10:30",
|
||||
end:"12:10",
|
||||
subject:"PORT",
|
||||
room:"B4",
|
||||
color:"port"
|
||||
},
|
||||
{
|
||||
start:"12:25",
|
||||
end:"13:15",
|
||||
subject:"EM",
|
||||
room:"D6",
|
||||
color:"em"
|
||||
}
|
||||
]
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* FUNÇÕES */
|
||||
|
||||
function minutes(time) {
|
||||
const [h, m] = time.split(":").map(Number);
|
||||
return h * 60 + m;
|
||||
}
|
||||
|
||||
function findClass(day, start) {
|
||||
return timetable[day]?.find(c =>
|
||||
minutes(start) >= minutes(c.start) &&
|
||||
minutes(start) < minutes(c.end)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* CONSTRUIR HORÁRIO */
|
||||
|
||||
function buildSchedule() {
|
||||
|
||||
const container = document.getElementById("schedule");
|
||||
|
||||
/* Cabeçalho */
|
||||
|
||||
const hourHeader = document.createElement("div");
|
||||
hourHeader.className = "cell header-cell";
|
||||
hourHeader.textContent = "Hora";
|
||||
|
||||
container.appendChild(hourHeader);
|
||||
|
||||
days.forEach((name, index) => {
|
||||
|
||||
const cell = document.createElement("div");
|
||||
|
||||
cell.className = "cell header-cell";
|
||||
cell.dataset.day = index + 1;
|
||||
cell.textContent = name;
|
||||
|
||||
container.appendChild(cell);
|
||||
});
|
||||
|
||||
|
||||
/* Aulas */
|
||||
|
||||
periods.forEach(period => {
|
||||
|
||||
const time = document.createElement("div");
|
||||
|
||||
time.className = "cell time";
|
||||
time.innerHTML = `${period[0]}<br>${period[1]}`;
|
||||
|
||||
container.appendChild(time);
|
||||
|
||||
|
||||
for (let day = 1; day <= 5; day++) {
|
||||
|
||||
const lesson = findClass(day, period[0]);
|
||||
|
||||
const cell = document.createElement("div");
|
||||
|
||||
cell.className = "cell";
|
||||
cell.dataset.day = day;
|
||||
|
||||
if (lesson) {
|
||||
|
||||
cell.classList.add("class", lesson.color);
|
||||
|
||||
cell.dataset.start = lesson.start;
|
||||
cell.dataset.end = lesson.end;
|
||||
|
||||
cell.innerHTML =
|
||||
`<span>${lesson.subject}</span>
|
||||
<span class="room">${lesson.room}</span>`;
|
||||
|
||||
if (lesson.note) {
|
||||
cell.innerHTML +=
|
||||
`<span class="note">${lesson.note}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
container.appendChild(cell);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* DESTACAR DIA E AULA ATUAL */
|
||||
|
||||
function updateHighlight() {
|
||||
|
||||
const now = new Date();
|
||||
|
||||
const day = now.getDay();
|
||||
|
||||
const currentMinutes =
|
||||
now.getHours() * 60 +
|
||||
now.getMinutes();
|
||||
|
||||
|
||||
document
|
||||
.querySelectorAll(".today, .current")
|
||||
.forEach(el => {
|
||||
el.classList.remove("today", "current");
|
||||
});
|
||||
|
||||
|
||||
if (day < 1 || day > 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Dia atual */
|
||||
|
||||
document
|
||||
.querySelectorAll(`[data-day="${day}"]`)
|
||||
.forEach(cell => {
|
||||
cell.classList.add("today");
|
||||
});
|
||||
|
||||
|
||||
/* Aula atual */
|
||||
|
||||
const lesson = timetable[day].find(c =>
|
||||
currentMinutes >= minutes(c.start) &&
|
||||
currentMinutes < minutes(c.end)
|
||||
);
|
||||
|
||||
|
||||
if (!lesson) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
document
|
||||
.querySelectorAll(
|
||||
`[data-day="${day}"][data-start="${lesson.start}"]`
|
||||
)
|
||||
.forEach(cell => {
|
||||
cell.classList.add("current");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* INICIAR */
|
||||
|
||||
buildSchedule();
|
||||
updateHighlight();
|
||||
|
||||
setInterval(updateHighlight, 30000);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user