Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/PunctuOwlity/llms.txt
Use this file to discover all available pages before exploring further.
app.js contains all client-side application logic for the PunctuOwlity web app and is loaded on every page via a <script src="app.js"> tag at the bottom of each HTML file’s <body>. Shared setup — logo injection, back-button wiring, password-toggle listeners, and the topbar menu — runs unconditionally on every page. Page-specific logic (event rendering, form submission handlers, and SMS preference routing) is gated behind checks on document.body.dataset.page, which is set as a data-page attribute in each HTML file.
Because
app.js is shared by all pages, every function and constant defined at the top level is available in every page context. The events grid logic is guarded by if(document.body.dataset.page === 'main') and the add/edit form logic by if(document.body.dataset.page === 'add'); these are the only explicit dataset.page checks in the file. Form handlers on other pages (login, sign-up) attach via optional chaining (?.addEventListener) so they safely no-op on pages where the element is absent.Event Storage
getEvents
localStorage. If the key is missing, the stored value is not a valid JSON array, or any exception is thrown during parsing, the function falls back to the built-in seedEvents array. Every record — whether loaded from storage or from the seed — is passed through normalizeEvent before being returned.
Returns: Event[] — a normalized array of event objects ready for rendering.
saveEvents
localStorage under the key 'punctuowlity-events'. No validation is performed; callers are responsible for passing a well-formed array of event objects.
The full array of event objects to persist. The previous value is overwritten entirely.
normalizeEvent
getEvents. Note that the add-event.html submit handler builds its item object manually rather than delegating to normalizeEvent; the resulting object is stored directly via saveEvents.
The transformation steps are applied in order:
Returns: A fully normalized Event object with all fields populated.
User / Account Storage
User records are stored in bothlocalStorage and sessionStorage so that accounts survive browser restarts while also being available in private-browsing sessions where localStorage may be restricted.
getUsers
localStorage first, then sessionStorage) and returns the first array it successfully parses from the 'punctuowlity-users' key. Returns an empty array if no valid data is found in any storage.
Returns: User[] — the array of registered user objects, or [] if none exist.
saveUsers
The complete array of user objects to persist. Replaces any previously stored value.
boolean — true if at least one storage backend accepted the write; false if all writes failed (e.g. storage quota exceeded in all backends).
UI Helpers
toast
"toast" and appends it to document.body. Any existing .toast element is removed before the new one is inserted, so rapid successive calls never stack.
The text content to display in the notification. Rendered as
textContent, not HTML.- Element is created and appended.
requestAnimationFrametriggers the"show"CSS class to start the entrance transition.- After 2400 ms, the
"show"class is removed to start the exit transition. - After an additional 250 ms, the element is removed from the DOM.
icon
assets/icons.svg. The aria-hidden="true" attribute ensures the icon is invisible to screen readers (all interactive elements provide their own aria-label).
The symbol ID within
assets/icons.svg. Examples used in the application: "back", "search", "add-alarm", "edit", "delete", "alarm-on", "alarm-off".string — an SVG HTML string suitable for use with innerHTML or insertAdjacentHTML.
Seed Events
TheseedEvents constant is the fallback data set used when localStorage contains no valid events. All four objects are fully pre-normalized.
Storage Keys Reference
The following table lists every key used byapp.js across localStorage and sessionStorage.
| Key | Storage type | Value type | Purpose |
|---|---|---|---|
punctuowlity-events | localStorage | JSON array of Event objects | Persists all user-created events between sessions |
punctuowlity-users | localStorage + sessionStorage | JSON array of User objects | Stores registered user accounts |
punctuowlity-authenticated | sessionStorage | String "true" | Tracks whether the current session is authenticated; cleared when the tab closes |
punctuowlity-sms | localStorage | String "allowed" or "denied" | Records the user’s SMS/notification preference from sms.html; absence triggers a redirect to sms.html |
punctuowlity-notified-{id}-{date} | sessionStorage | String "true" | Prevents duplicate notifications for the same event on the same day |