feat(site): horário sem barra de dias em cima, CrossFit ganha contactos
- Horário de aulas (home e CrossFit, mesmo componente partilhado): removida a barra de botões Seg/Ter/Qua/Qui/Sex/Sab acima da grelha — o próprio cabeçalho do dia (já existente) passa a ser sempre visível (antes só em desktop, 3 dias) e ganha setas ‹ › ao lado do nome do dia para mudar de dia em ecrãs de telemóvel/tablet. No desktop (3 dias lado a lado) as setas ficam escondidas — clicar no dia lateral já muda o dia em foco. CSS/JS morto do botão-filtro removido. - Informações e contactos extraído para site/includes/contactos.php, partilhado pela home e pelo CrossFit — a página CrossFit ganha a mesma secção de contactos (localização, telefone, e-mail, horário de funcionamento, mapa, formulário) em vez de só linkar de volta à home. Hero e restantes secções do CrossFit não foram tocados. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5478952171
commit
65182eecd6
6 files changed
+230
-207
No files matched your search
+24
-22
@@ -377,26 +377,28 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
window.addEventListener('scroll', function () { if (panelOpen() && !floating.matches && !opening) closePanel(); }, { passive: true });
|
||||
});
|
||||
|
||||
/* ── Schedule day filter ─────────────────────────────────────────────────────
|
||||
The on-screen schedule shows the chosen day (phones) or that day centred
|
||||
between the day before and after (desktop ≥992px); a day-picker bar switches
|
||||
days (each header + class cell is tagged with data-day). Defaults to today
|
||||
when the gym is open that day, otherwise the first day. The JPG export is
|
||||
unaffected — its clone removes every .sched-hide and re-renders the full week. */
|
||||
/* ── Schedule day switcher ────────────────────────────────────────────────────
|
||||
The on-screen schedule shows the chosen day (phones/tablets) or that day
|
||||
centred between the day before and after (desktop ≥992px, .is-3day); each
|
||||
header + class cell is tagged with data-day. There is no separate day-picker
|
||||
bar — the header itself is the switcher: prev/next arrows beside the day
|
||||
name on phones/tablets, and clicking a side day's header on desktop.
|
||||
Defaults to today when the gym is open that day, otherwise the first day.
|
||||
The JPG export is unaffected — its clone removes every .sched-hide and
|
||||
re-renders the full week. */
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Works on the home page (#horario) and the CrossFit page (bare .schedule).
|
||||
var scope = document.querySelector('.schedule');
|
||||
if (!scope) return;
|
||||
var filter = scope.querySelector('.schedule-day-filter');
|
||||
var dayheads = scope.querySelectorAll('.schedule_dayhead');
|
||||
var cells = scope.querySelectorAll('.schedule_cell, .schedule_dayhead');
|
||||
if (!filter || !cells.length) return;
|
||||
var buttons = filter.querySelectorAll('.sdf-btn');
|
||||
if (!dayheads.length) return;
|
||||
var labels = scope.querySelectorAll('.schedule_section_label');
|
||||
|
||||
// Desktop shows three days — the chosen one centred between the day before
|
||||
// and the day after (wrapping round the week); phones show just the one.
|
||||
var wide = window.matchMedia('(min-width: 992px)');
|
||||
var week = Array.prototype.map.call(buttons, function (b) { return b.getAttribute('data-day'); });
|
||||
var week = Array.prototype.map.call(dayheads, function (h) { return h.getAttribute('data-day'); });
|
||||
var current = null;
|
||||
|
||||
// Toggle classes (not inline display) — .sched-hide carries !important so it
|
||||
@@ -418,9 +420,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (three && col !== 2) c.classList.add('sched-side');
|
||||
}
|
||||
});
|
||||
buttons.forEach(function (b) {
|
||||
b.classList.toggle('active', b.getAttribute('data-day') === day);
|
||||
});
|
||||
// Show a Manhã / Tarde divider only when a visible day has a class in that block.
|
||||
labels.forEach(function (lbl) {
|
||||
var sec = lbl.getAttribute('data-section');
|
||||
@@ -431,25 +430,28 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
}
|
||||
|
||||
filter.addEventListener('click', function (e) {
|
||||
var btn = e.target.closest('.sdf-btn');
|
||||
if (btn) showDay(btn.getAttribute('data-day'));
|
||||
});
|
||||
// Clicking a side day's header centres it.
|
||||
function step(dir) {
|
||||
var i = week.indexOf(current), n = week.length;
|
||||
if (i === -1 || !n) return;
|
||||
showDay(week[(i + dir + n) % n]);
|
||||
}
|
||||
|
||||
scope.addEventListener('click', function (e) {
|
||||
if (e.target.closest('.sched-prev')) { step(-1); return; }
|
||||
if (e.target.closest('.sched-next')) { step(1); return; }
|
||||
// Clicking a side day's header (desktop 3-day view) centres it.
|
||||
var head = e.target.closest('.schedule_dayhead.sched-side');
|
||||
if (head) showDay(head.getAttribute('data-day'));
|
||||
});
|
||||
var reflow = function () { if (current) showDay(current); };
|
||||
if (wide.addEventListener) wide.addEventListener('change', reflow); else if (wide.addListener) wide.addListener(reflow);
|
||||
|
||||
// Pre-select today when the schedule has a button for it (PT day names),
|
||||
// Pre-select today when the schedule has a header for it (PT day names),
|
||||
// otherwise the first day.
|
||||
var ptDays = { 1: 'segunda', 2: 'terça', 3: 'quarta', 4: 'quinta', 5: 'sexta', 6: 'sábado' };
|
||||
var today = ptDays[new Date().getDay()];
|
||||
var todayBtn = today ? filter.querySelector('.sdf-btn[data-day="' + today + '"]') : null;
|
||||
var start = todayBtn || buttons[0];
|
||||
if (start) showDay(start.getAttribute('data-day'));
|
||||
var start = (today && week.indexOf(today) !== -1) ? today : week[0];
|
||||
if (start) showDay(start);
|
||||
});
|
||||
|
||||
/* ── Contact form: stretch the message box to meet the map ───────────────────
|
||||
|
||||
Reference in new issue
Block a user