# uv-xii/k-l-attendance-calculator architecture

> Architecture diagram of the GitHub repository uv-xii/k-l-attendance-calculator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uv-xii/k-l-attendance-calculator
- Repository: https://github.com/uv-xii/k-l-attendance-calculator

## Overview

KL Attendance is a browser extension that reads attendance data from the KL University ERP and sends it to the attendance calculator. It offers two paths: a popup that scrapes the active ERP tab and opens or focuses the calculator, and a floating button embedded on ERP attendance pages. The popup also previews weighted attendance percentages. The calculator’s handling of the received message is outside this repository evidence, so its internal behavior is not shown.

Main entry points: [`kl-extension/popup.js`](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js) (Popup Sync), [`kl-extension/content.js`](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/content.js) (Floating Button), [`kl-extension/popup.html`](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.html) (Popup Controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_popup["Extension Popup"]
  node_popup_ui["Popup Controls<br/>[popup.html]"]
  node_popup_flow["Popup Sync<br/>[popup.js]"]
  node_popup_scraper["Popup Scraper<br/>[popup.js]"]
  node_preview["Attendance Preview<br/>[popup.js]"]
end

subgraph group_page["ERP Page Extension"]
  node_page_button["Floating Button<br/>[content.js]"]
  node_page_scraper["Page Scraper<br/>[content.js]"]
end

node_student(("Student"))
node_erp["ERP Attendance"]
node_session_storage[("Session Storage")]
node_calculator["Attendance Calculator"]

node_student -->|"uses"| node_popup_ui
node_popup_ui -->|"triggers sync"| node_popup_flow
node_popup_flow -->|"executes scraper"| node_popup_scraper
node_popup_scraper -->|"reads table"| node_erp
node_popup_flow -->|"renders results"| node_preview
node_popup_flow -->|"sends message"| node_calculator
node_student -->|"clicks"| node_page_button
node_page_button -->|"invokes scraper"| node_page_scraper
node_page_scraper -->|"reads table"| node_erp
node_page_button -->|"opens and posts"| node_calculator
node_page_button -->|"stores fallback"| node_session_storage

click node_popup_ui "https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.html"
click node_popup_flow "https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js"
click node_popup_scraper "https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js"
click node_preview "https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js"
click node_page_button "https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/content.js"
click node_page_scraper "https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/content.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_popup_ui,node_popup_flow,node_popup_scraper,node_preview toneBlue
class node_page_button,node_page_scraper,node_session_storage toneAmber
class node_student,node_erp,node_calculator toneIndigo
```

## Components

### Extension Popup

- [Popup Controls](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.html): `kl-extension/popup.html`
- [Popup Sync](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js): `kl-extension/popup.js`
- [Popup Scraper](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js): `kl-extension/popup.js`
- [Attendance Preview](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/popup.js): `kl-extension/popup.js`

### ERP Page Extension

- [Floating Button](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/content.js): `kl-extension/content.js`
- [Page Scraper](https://github.com/uv-xii/k-l-attendance-calculator/blob/main/kl-extension/content.js): `kl-extension/content.js`

### Other components

- **Student**
- **ERP Attendance**
- **Session Storage**
- **Attendance Calculator**

## Connections

- Student → Popup Controls: uses
- Popup Controls → Popup Sync: triggers sync (evidence: `kl-extension/popup.js`)
- Popup Sync → Popup Scraper: executes scraper (evidence: `kl-extension/popup.js`)
- Popup Scraper → ERP Attendance: reads table (evidence: `kl-extension/popup.js`)
- Popup Sync → Attendance Preview: renders results (evidence: `kl-extension/popup.js`)
- Popup Sync → Attendance Calculator: sends message (evidence: `kl-extension/popup.js`)
- Student → Floating Button: clicks (evidence: `kl-extension/content.js`)
- Floating Button → Page Scraper: invokes scraper (evidence: `kl-extension/content.js`)
- Page Scraper → ERP Attendance: reads table (evidence: `kl-extension/content.js`)
- Floating Button → Attendance Calculator: opens and posts (evidence: `kl-extension/content.js`)
- Floating Button → Session Storage: stores fallback (evidence: `kl-extension/content.js`)
