Skip to content
Coastal Healthcare Advocates

Module: secondary

Behavior for the secondary pages.

The secondary pages (pricing, for professionals, the legal pages, about this site and the 404 page) carry the shared icon sprite, header and footer as real HTML: scripts/build-partials.js writes them in from src/partials/, and marks the footer link to the current page there too. This script adds only what that markup can't do on its own:

  1. runs the mobile-menu open/close button (a trimmed copy of the handler in main.js, which secondary pages don't load);
  2. slides the header away while the footer is on screen;
  3. turns "Return to the homepage" into "Go back" for visitors who came straight from the homepage;
  4. keeps table semantics on tables that CSS restacks on phones.

A classic (non-module) <script> at the end of <body>, after the markup it wires. ES5 inside an IIFE so nothing leaks globally.

Source:

Members

(inner) TABLE_ROLES :Object.<string, string>

ARIA role for each table part, keyed by tag name. Header cells are handled separately, since their role depends on scope.

Type:
  • Object.<string, string>
Source:

(inner) mobileNav

The mobile nav panel it controls. @type {HTMLElement|null}

Source:

(inner) navToggle

The hamburger button. @type {HTMLElement|null}

Source:

(inner) referredFromHome :boolean

Whether this page was opened from the homepage, according to the referrer. The site's Referrer-Policy (strict-origin-when-cross-origin) sends the full URL for same-origin navigations.

Type:
  • boolean
Source:

(inner) startLength :number

History length when this page loaded; the fallback below uses it to count entries added since (e.g. by table-of-contents # links).

Type:
  • number
Source:

Methods

(inner) isHome(path) → {boolean}

Whether a URL path is the homepage: /, /index.html, or /index (Netlify's pretty URL).

Parameters:
Name Type Description
path string

A URL pathname.

Source:
Returns:

true for the homepage.

Type
boolean

(inner) setNav(open) → {void}

Opens or closes the mobile menu and updates the button to match.

Opening: un-hide the panel first, then add is-open on the next frame so the CSS entrance transition has a starting state to animate from. Closing: hide immediately.

Parameters:
Name Type Description
open boolean

true to open, false to close.

Source:
Returns:
Type
void

(inner) stepsToHome() → {number}

Works out how many steps back through history the homepage is, if the visitor reached this page straight from it.

Where the Navigation API exists, it reads the tab's real history: it skips back over entries for this same page (in-page # jumps), then checks that the entry before them is the homepage. Elsewhere it falls back to the referrer, counting the entries added since this page loaded.

Source:
Returns:

Steps to go back (1 or more), or 0 if the previous page wasn't the homepage.

Type
number