# dtrung98/gpabookmarklet architecture

> Architecture diagram of the GitHub repository dtrung98/gpabookmarklet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dtrung98/gpabookmarklet
- Repository: https://github.com/dtrung98/gpabookmarklet

## Overview

##### Main Components and Their Roles
- User Browser: Represents the client where the bookmarklet is installed and executed.
- Bookmarklet (bookmarklet.js): Acts as the entry point when a user clicks the bookmarklet. This script likely injects or triggers the GPA calculation routines within the browser.
- Application Logic (app.js): Contains the core functionality for processing the GPA calculation based on data extracted from the HCMUS Portal.
- User Interface: Consists of HTML files (index.html, guideline_mobile.html, README.html) that show information, guidelines, or results, along with default.css to ensure consistent styling.
- Supporting Documentation/Assets: Files like Changelog.md, LICENSE, READMEs, and potentially the “Figure” directory (which might contain images or additional assets for UI decoration or further explanations).

##### Relationships and Interactions
- A user accesses the HCMUS GPA Calculator Bookmarklet via their browser.
- When activated, the bookmarklet.js script executes, interacting with the currently loaded HCMUS Portal page, and triggers the app.js component to parse and calculate the GPA from available data.
- The outcome or user guidance is displayed using one or more HTML pages (index.html for the main UI and guideline_mobile.html for mobile users).
- The default.css file applies consistent styling across these components.
- Any updates or changes are tracked in the Changelog.md, and licensing details are available in the LICENSE file.

##### Architectural Design Patterns and Principles
- Client-Side Execution: The entire application logic runs within the browser, ensuring fast interaction without the need for server-side components.
- Modularity: Separation of concerns is evident—bookmarklet for entry point actions, app.js for core logic, HTML for presentation, and CSS for styling.

##### Relevant Technologies and Libraries
- JavaScript: For both the main application logic (app.js) and the bookmarklet's behavior (bookmarklet.js).
- HTML/CSS: For UI presentation (index.html, guideline_mobile.html) and styling (default.css).
- No explicit backend or database is involved since it’s a client-side tool that operates as an enhancement to an external website.

##### Additional Detail
- “Figure” directory as a resource for assets if applicable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Components
    Browser["User Browser"]:::browser
    Bookmarklet["Bookmarklet Script (bookmarklet.js)"]:::bookmarklet
    AppLogic["Application Logic (app.js)"]:::logic
    Portal["HCMUS Portal"]:::external

    %% UI Subgraph
    subgraph "User Interface"
        UI_Main["Main UI (index.html)"]:::ui
        UI_Mobile["Mobile Guidelines (guideline_mobile.html)"]:::ui
        UI_Readme["Additional Info (README.html)"]:::ui
        UI_CSS["Styling (default.css)"]:::css
    end

    %% Documentation & Assets Subgraph
    subgraph "Documentation & Assets"
        DocChange["Changelog (Changelog.md)"]:::docs
        DocLicense["LICENSE (LICENSE)"]:::docs
        DocReadme["README (README.md)"]:::docs
        DocAssets["Assets (Figure directory)"]:::docs
    end

    %% Relationships and Data Flow
    Browser -->|"activates"| Bookmarklet
    Bookmarklet -->|"triggers"| AppLogic
    Portal -->|"suppliesData"| AppLogic
    AppLogic -->|"displayResults"| UI_Main
    AppLogic -->|"mobileGuidance"| UI_Mobile
    AppLogic -->|"infoDisplay"| UI_Readme
    UI_CSS -->|"appliesStyling"| UI_Main
    UI_CSS -->|"appliesStyling"| UI_Mobile
    UI_CSS -->|"appliesStyling"| UI_Readme
    AppLogic -->|"referencesDocs"| DocChange

    %% Click Events
    click Bookmarklet "https://github.com/dtrung98/gpabookmarklet/blob/master//bookmarklet.js"
    click AppLogic "https://github.com/dtrung98/gpabookmarklet/blob/master//app.js"
    click UI_Main "https://github.com/dtrung98/gpabookmarklet/blob/master//index.html"
    click UI_Mobile "https://github.com/dtrung98/gpabookmarklet/blob/master//guideline_mobile.html"
    click UI_Readme "https://github.com/dtrung98/gpabookmarklet/blob/master//README.html"
    click UI_CSS "https://github.com/dtrung98/gpabookmarklet/blob/master//default.css"
    click DocChange "https://github.com/dtrung98/gpabookmarklet/blob/master//Changelog.md"
    click DocLicense "https://github.com/dtrung98/gpabookmarklet/tree/master//LICENSE"
    click DocReadme "https://github.com/dtrung98/gpabookmarklet/blob/master//README.md"
    click DocAssets "https://github.com/dtrung98/gpabookmarklet/tree/master//Figure directory"

    %% Styles
    classDef browser fill:#AEDFF7,stroke:#000,stroke-width:1px
    classDef bookmarklet fill:#DFFFB0,stroke:#000,stroke-width:1px
    classDef logic fill:#F9E79F,stroke:#000,stroke-width:1px
    classDef ui fill:#D6EAF8,stroke:#000,stroke-width:1px
    classDef css fill:#D5F5E3,stroke:#000,stroke-width:1px
    classDef external fill:#F5B7B1,stroke:#000,stroke-width:1px
    classDef docs fill:#E8DAEF,stroke:#000,stroke-width:1px
```
