A premium, customizable floating dashboard Chrome Extension to track biometric office hours, breaks, and exit time in real-time. Built with Manifest V3 and modular ES components.
- Node.js: v18.0.0 or higher
- NPM: v9.0.0 or higher
- Google Chrome (or any Chromium-based browser like Edge, Brave, Vivaldi)
All source code is cleanly split into single-responsibility modules in src/. Built assets are output to dist/:
hrms-extension/
โโโ manifest.json # Manifest V3 extension configuration
โโโ package.json # NPM dependencies and development scripts
โโโ build.js # Lightning-fast esbuild bundler script
โโโ dist/ # Compiled distribution folder (DO NOT EDIT DIRECTLY)
โ โโโ content-script.js # Compiled bundle output injected into HRMS page
โโโ assets/
โ โโโ icons/ # Extension icons (16px, 48px, 128px)
โโโ src/
โโโ background/
โ โโโ background.js # MV3 Service Worker for background alarms & notifications
โโโ styles/
โ โโโ widget.css # Vanilla CSS stylesheet & design tokens
โโโ modules/
โ โโโ api.js # Backend HRMS API fetchers
โ โโโ storage.js # Storage abstraction (localStorage & chrome.storage.local)
โ โโโ metrics.js # Pure business calculations (work/break mins, target exit time)
โ โโโ notifier.js # Desktop notification manager & throttler
โ โโโ icons.js # Centralized SVG icon registry
โ โโโ state.js # Central reactive state manager & subscriber
โ โโโ todo.js # Core pure business logic & urgency calculations for tasks
โ โโโ utils.js # Time formatting & formula expression parser
โโโ controllers/
โ โโโ WidgetController.js # Main widget UI controller, polling timers & lifecycle
โโโ components/
โ โโโ Draggable.js # Drag & Drop controller with bounds detection
โ โโโ BadgeView.js # Collapsed floating badge UI
โ โโโ DashboardCard.js # Main expanded dashboard card UI
โ โโโ TodoPanel.js # Interactive TODO manager subpanel
โ โโโ ShortcutsPanel.js # Quick bookmark links manager subpanel
โ โโโ SettingsPanel.js # Settings modal (custom target hours, themes, notification toggles)
โ โโโ SyncPanel.js # Mobile PWA QR code sync modal
โโโ content.js # Clean 15-line entry point bootstrapping WidgetController
Open your terminal in the project root directory:
npm install(Note for Windows PowerShell users: If script execution is blocked, run cmd /c npm install)
| Command | Description |
|---|---|
npm run build |
One-time production build. Bundles src/ into dist/content-script.js. |
npm run watch |
Watch mode. Re-bundles automatically whenever you edit any file in src/. |
- Open Google Chrome and navigate to
chrome://extensions/. - Enable Developer mode using the toggle switch in the top-right corner.
- Click the "Load unpacked" button in the top-left menu.
- Select the
hrms-extensionproject folder. - Open or refresh
https://apps.pal.tech/hrms/. - The floating HRMS Attendance widget will appear in the bottom-right corner!
When developing new features or tweaking styles:
- Start watch mode in your terminal:
npm run watch
- Edit source code inside
src/:- Styles ->
src/styles/widget.css - UI views ->
src/components/ - Controller logic ->
src/controllers/WidgetController.js - Data & calculation logic ->
src/modules/
- Styles ->
- The build script automatically updates
dist/content-script.js. - Refresh the
https://apps.pal.tech/hrms/webpage in Chrome to see your changes instantly! - If you modify
manifest.jsonorsrc/background/background.js, go tochrome://extensions/and click the Reload ๐ button on the extension card.
- Content Script Console Logs: Open Chrome DevTools (
F12orCtrl + Shift + I) on the HRMS webpage to view logs, network calls, and UI state. - Background Service Worker Logs: On
chrome://extensions/, click "service worker" under the extension card to open DevTools forbackground.js. - Reset Storage State: To clear saved settings and drag position during testing, run this in the Chrome Console on the HRMS page:
localStorage.clear(); location.reload();
src/content.js: Pure bootstrap (~15 lines). InitializesWidgetController.src/controllers/WidgetController.js: Owns UI mounting, collapse state toggling, and 1-sec / 1-min timers.src/modules/notifier.js: Owns desktop notification permission checks and 5-minute interval throttling.src/modules/metrics.js: Pure functions for work/break math. Zero DOM dependencies.docs/NOTIFICATION_GUIDE.md: Detailed architectural guide on how desktop notifications work.dist/content-script.js: Generated bundle file output byesbuild. Never edit manually!