- Implemented `stage_parse_schedule.py` to normalize and prepare university schedule data. - Created `stage_process_logs.py` for processing authentication logs and generating session records. - Added necessary classes and methods for log entry parsing, session extraction, and CSV output. - Updated `settings.yaml` with new schedule and processing configurations. - Introduced new templates and styles for report generation, including HTML and CSS files. - Added main entry point `run.py` to execute the attendance processing pipeline. - Included `.gitkeep` files in `output` and `result` directories to maintain structure.
74 lines
1.9 KiB
JavaScript
74 lines
1.9 KiB
JavaScript
(function () {
|
|
function qs(selector, root) {
|
|
return (root || document).querySelector(selector);
|
|
}
|
|
|
|
function qsa(selector, root) {
|
|
return Array.from((root || document).querySelectorAll(selector));
|
|
}
|
|
|
|
function setActiveSection(sectionId) {
|
|
qsa('.section-nav .nav-btn[data-section]').forEach((btn) => {
|
|
btn.classList.toggle('active', btn.dataset.section === sectionId);
|
|
});
|
|
|
|
qsa('.class-nav-group').forEach((group) => {
|
|
group.classList.toggle('active', group.dataset.section === sectionId);
|
|
});
|
|
|
|
const firstButton = qs(`.class-nav-group.active .class-btn[data-class-id]`);
|
|
if (firstButton) {
|
|
setActiveClass(firstButton.dataset.classId, false);
|
|
}
|
|
}
|
|
|
|
function setActiveClass(classId, scrollIntoView) {
|
|
qsa('.class-btn[data-class-id]').forEach((btn) => {
|
|
btn.classList.toggle('active', btn.dataset.classId === classId);
|
|
});
|
|
|
|
qsa('.class-block[data-class-id]').forEach((block) => {
|
|
const active = block.dataset.classId === classId;
|
|
block.classList.toggle('active', active);
|
|
if (active && scrollIntoView) {
|
|
block.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
}
|
|
});
|
|
}
|
|
|
|
function init() {
|
|
const report = window.__CLASS_REPORT__ || {};
|
|
const activeSection = report.active_section || '';
|
|
const activeClass = report.active_class || '';
|
|
|
|
qsa('.section-nav .nav-btn[data-section]').forEach((btn) => {
|
|
btn.addEventListener('click', () => setActiveSection(btn.dataset.section));
|
|
});
|
|
|
|
qsa('.class-btn[data-class-id]').forEach((btn) => {
|
|
btn.addEventListener('click', () => setActiveClass(btn.dataset.classId, true));
|
|
});
|
|
|
|
if (activeSection) {
|
|
setActiveSection(activeSection);
|
|
}
|
|
|
|
if (activeClass) {
|
|
setActiveClass(activeClass, false);
|
|
}
|
|
}
|
|
|
|
window.printReport = function printReport() {
|
|
window.print();
|
|
};
|
|
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', init);
|
|
} else {
|
|
init();
|
|
}
|
|
})();
|
|
function printReport() {
|
|
window.print();
|
|
}
|