Section 1
Project Overview
Second Terms is a self-contained, single-file web application providing educational definitions of political science vocabulary for university students, faculty, and the general public. The glossary covers American and global political terms across constitutional concepts, contemporary movements, foreign policy doctrine, electoral mechanics, social justice, economics, media, and political history.
The application is designed as a public-facing academic resource under the Academic Applications brand, intended to be hosted on a university web server and accessed through a browser on any device without requiring installation, login, or server-side processing.
Core design principle: The tool works completely offline once loaded, requires no maintenance infrastructure, and is deployable by uploading a single HTML file. This single-file architecture also makes it the template for a planned family of subject-specific glossaries — African American Studies, Theology, Economics, and others — each of which can reuse the same application engine with different content and a distinct visual identity.
Section 2
Technology Stack
Language and Runtime
- HTML5 — semantic document structure
- CSS3 — all styling, including responsive layout, animations, and accessibility states
- Vanilla JavaScript (ES6+) — all application logic; no frameworks or libraries
- Web Speech API — browser-native text-to-speech for the Read Aloud feature; no external service or API key required
Fonts
- Playfair Display (Google Fonts CDN) — display headings, term names, masthead
- IBM Plex Serif (Google Fonts CDN) — body text, definition copy
- IBM Plex Mono (Google Fonts CDN) — labels, navigation, metadata, badges
- If the CDN is unavailable the application falls back gracefully to Georgia and system serif fonts
No Build Step Required
The application requires no npm, no bundler, no server-side language, and no build process. All code lives in a single index.html file and is deployed by upload.
Section 3
File Structure
second-terms/
index.html
README.html
.htaccess
All three files are uploaded together to the Apache web server directory. The application has no other dependencies.
Section 4
Content Organization
Term Data Structure
All terms are stored as a JavaScript object const DEFS in the script block. Each entry has three fields:
"term key here": {
"definition": "The definition text...",
"significance": "Why it matters politically...",
"example": "Example: A sentence illustrating the term in context."
}
Key Conventions
- Keys are lowercase by default; proper nouns, acronyms, and terms with unconventional casing use their correct form (e.g.
DACA, McCarthyism, al-Qaeda, Pan-Africanism)
- Numeric and symbolic keys (e.g.
1619, 9/11, 270) are sorted into the # bucket
- Multi-word terms use spaces; hyphenated terms preserve hyphens where standard
- Terms beginning with “the” are stored and indexed under T (e.g.
the Union, the Black Church)
Index Buckets
Terms are organized into 27 buckets: # (numeric, symbolic, and alphanumeric terms) plus A–Z.
Title Case Rendering
The titleCase() function renders term names with smart capitalization: first word always capitalized; small words (a, an, the, and, but, or, of, in, on, at, to, by, v., vs., etc.) kept lowercase; all-caps acronyms preserved; hyphenated terms handled part by part; and a TITLE_OVERRIDES map for terms requiring custom display casing (currently: al-Qaeda, McCain-Feingold, McCarthyism).
Cross-Reference Linking
When a card is expanded, the linkify() function scans all three text fields for glossary terms and renders the first occurrence of each as a clickable link. Linking rules:
- Multi-word terms (2+ words) are always eligible
- Single-word terms of 7+ characters are automatically linked
- Short single-word terms (under 7 characters) are linked only if listed in
XREF_SINGLE — a curated set including acronyms (NATO, LGBTQ, DACA, FEMA, ISIS, ICE, ADA, DEI, HBCU, etc.) and significant dates (1619, 1776, 1865, 1945, 2020, 9/11, 270, 538)
- Longest match wins; first occurrence only per card; no self-linking
XREF_EXCLUSIONS suppresses specific links in specific cards where the match would be contextually misleading
Section 5
Functionality
Navigation
A sticky alpha navigation bar provides buttons for # and A–Z, plus a counts toggle button that shows or hides per-letter term counts as small superscript badges. Clicking an already-active letter collapses the section and returns to the welcome screen.
Sub-Letter Filter
For letter buckets with 50 or more terms (currently B, C, D, P, R, S, T), a secondary filter bar appears after a letter is selected, offering two-character sub-groups (e.g. PO, PR, PA) each labeled with their count. An All button restores the full letter view. The sub-filter resets when a new letter is selected.
Pagination
When a letter section or sub-group contains more than 30 terms, results are paginated with ← Previous and Next → controls and a “1–30 of N terms” count. Navigating to a specific term automatically jumps to the correct page and expands the card.
Search
A live search field filters terms as the user types. Results display with a count in an aria-live region. Search bypasses the letter nav and sub-filter.
Welcome Screen
The default state on page load, showing the Random Term card and the About This Reference Guide section. The term count badge is a clickable toggle for letter count badges, synchronized with the counts button in the nav bar.
Random Term Card
On every page load a randomly selected term is displayed with its definition. The term name itself is clickable and navigates to the full entry, identical to the Explore this term button. The ↻ New Random Term button selects a different term and refreshes the card.
Page Title as Home
The SECOND TERMS masthead title is a clickable button. Clicking it returns to the welcome screen and simultaneously picks a new random term — functioning identically to the New Random Term button. This makes every click on the title feel like a fresh page experience without a full browser reload.
Term Card Layout
Expanded cards have a deliberate four-corner layout:
- Top left — term name
- Top right — ⌂ Home button (returns to welcome with a new random term)
- Bottom left — Read Aloud controls (button + voice selector + speed controls)
- Bottom right — × Close button
The bottom action bar is separated from content by a thin ruled line. On mobile (≤600px) the bottom zone stacks vertically, Read Aloud first, Close at the bottom, both full-width.
Read Aloud
Powered by the browser’s built-in Web Speech API — no external service or API key required. Reads the term name followed by all three fields in sequence. While reading, the button shows ▮▮ Stop in crimson.
- Voice selector — dropdown of English-language voices available on the device; persists across cards for the session
- Speed controls — – and + step buttons across seven levels: Slow (0.5×), Slower (0.75×), Normal (1.0×), Faster (1.25×), Fast (1.5×), Very Fast (1.75×), Max (2.0×). Changes apply in real time during playback by resuming from the last word boundary
- Speech stops automatically on card close, navigation, or new card open
- Graceful degradation: if the Web Speech API is unavailable, controls do not render
Dynamic Term Count & Copyright Year
The term count in the footer is populated by Object.keys(DEFS).length at runtime. The copyright year is set by new Date().getFullYear(). Neither requires manual editing.
Section 6
Design System
Aesthetic Direction
The visual design follows an editorial/newspaper aesthetic — formal, serious, and legible — evoking quality print journalism and signaling academic credibility.
Color Palette
All combinations verified at WCAG 2.1 AA contrast ratios:
--paper#f5f0e8 — Page background
--ink#1a1a2e — Primary text
--crimson#9b2226 — Accent / active
--gold#6b4f12 — Secondary labels
--muted#4a4a60 — Body text
--focus-ring#005fcc — Focus indicators
Typography
- Playfair Display — masthead, term names, welcome headings
- IBM Plex Serif — definition body text
- IBM Plex Mono — navigation, labels, badges, controls
All font sizes use rem and clamp() for fluid scaling. No fixed pixel sizes.
Responsive Layout
| Viewport | Columns |
| < 480px | 1 |
| 480–900px | 2 |
| 900–1400px | 3 |
| 1400–1800px | 4 |
| > 1800px | 5 |
Motion and High Contrast
All transitions are disabled via @media (prefers-reduced-motion: reduce). A @media (forced-colors: active) block supports Windows High Contrast Mode.
Section 7
Accessibility
The application is built to conform with WCAG 2.1 Level AA throughout.
Structure and Semantics
lang="en" on the <html> element
- Semantic landmarks:
<header role="banner">, <nav>, <main>, <footer role="contentinfo">
- Logical heading hierarchy throughout; screen-reader-only
<h2> headings announce letter sections
Keyboard Navigation
- All interactive elements reachable and operable by keyboard
- Cards respond to Enter and Space; focus returns to the card after closing
- All controls (Read Aloud, speed, voice, Close, Home, pagination, sub-filter) are keyboard accessible
- Skip link bypasses navigation for keyboard and screen reader users
Screen Reader Support
aria-expanded, aria-pressed, and aria-label on all interactive elements
aria-live="polite" regions for search count and pagination range
role="group" on the speed control row; role="toolbar" on the sub-filter bar
- Letter buttons announce term counts when counts are toggled on
- Speed buttons announce current speed level in their
aria-label
Visual
- 3px
:focus-visible ring on all interactive elements; suppressed for mouse users
- Minimum 44×44px touch targets
- WCAG 2.1 AA contrast ratios throughout
Section 8
Security
The .htaccess file configures the Apache server with: HTTPS redirect, Options -Indexes, X-Frame-Options: SAMEORIGIN, X-Content-Type-Options: nosniff, Referrer-Policy, Content Security Policy (self + unsafe-inline + Google Fonts), Permissions-Policy, and Cache-Control: no-cache on HTML files. Requires mod_rewrite and mod_headers.
Section 9
Content Objectivity
Factual Grounding
Definitions are based on documented historical and political facts grounded in verifiable events, legislation, court decisions, and scholarly consensus.
Balanced Framing
For contested terms, entries present the term’s meaning as used by proponents and the nature of the controversy, without endorsing either position.
No Advocacy
The glossary does not advocate for particular policies, parties, or ideological positions. Terms are explained accurately without endorsement or condemnation.
Historical Completeness
Terms related to difficult historical realities — slavery, lynching, redlining, COINTELPRO, January 6th — are defined with the accuracy their significance demands.
Contested Terminology
Where a term’s meaning is itself politically contested, the entry acknowledges that nature and notes preferred alternatives where relevant.
Language Choices
Where terms carry offensive connotations, the entry notes the pejorative nature while defining the term accurately, consistent with the glossary’s role as a reference tool.
Attribution
Concept, curation, and intellectual property: Malik Singleton.
Definitions researched and composed with the assistance of Claude AI (Anthropic).
Section 10
Workflow and Collaboration
Development Process
Built through an iterative conversational workflow between Malik Singleton and Claude AI over an extended multi-session process. Stages:
- Concept and initial build — Architecture, visual design, and first batch of definitions
- UI iteration — Welcome state, alpha navigation, search, card expand/collapse, Random Term feature
- Static export — Fully self-contained file with all definitions embedded
- Responsive and accessible upgrade — Full-width responsive layout and WCAG 2.1 AA implementation
- Content expansion — Iterative additions across many sessions growing vocabulary to 1,000+ terms
- Cross-reference system — Smart linkify engine with multi-word and single-word thresholds, XREF_SINGLE, XREF_EXCLUSIONS, and TITLE_OVERRIDES
- Content consolidation — Redundant entries merged; key naming standardized
- Read Aloud feature — Web Speech API with voice selector, real-time speed controls, word-boundary tracking
- Navigation enhancements — Per-letter count badges (user-toggled), sub-letter filter, 30-term pagination
- UX refinements — Clickable masthead title, clickable featured term name, four-corner card layout, Home button, term count badge as counts toggle
- Security — .htaccess configuration for Apache hosting
- Documentation — This README, updated continuously
Adding New Terms
"your term here": {
"definition": "The definition text...",
"significance": "Why it matters politically...",
"example": "Example: A sentence illustrating the term."
},
Save and re-upload. The term count and letter section update automatically.
Managing Cross-Reference Exclusions
const XREF_EXCLUSIONS = {
'your card key': new Set(['false positive term']),
};
Adding Short-Word Cross-References
const XREF_SINGLE = new Set([
'al-Qaeda', 'LGBTQ', /* ... */
'your short term',
]);
Adding Display Name Overrides
const TITLE_OVERRIDES = {
'al-Qaeda': 'al-Qaeda',
'your term': 'Your Display Name',
};
Section 11
Scalability and Repurposing
Second Terms is the first in a planned family of subject-specific glossaries under the Academic Applications brand. The application engine and its content are distinct layers that can be separated cleanly.
What Is Reusable
The entire engine — search, navigation, card system, cross-reference linker, read-aloud, pagination, sub-filter, accessibility markup, and CSS design system — is completely generic. It contains no subject-specific logic. Approximately 95% of the code can be reused unchanged for any new glossary.
What Is Subject-Specific
To create a new glossary, only four elements change: the DEFS object (term entries), the page title and masthead title, the subtitle and about section copy, and optionally the color palette in :root for a distinct visual identity per subject.
Planned Subject Glossaries
Future glossaries in the Academic Applications family may include African American Studies, Theology, and Economics, each sharing the same engine while serving a distinct academic community.
Template Preparation
When a second glossary is ready to begin, a clean template will be extracted from the current index.html — with DEFS empty, placeholder text in the masthead and about section, and a comment block explaining what to customize.
Section 12
Maintenance Guide
Routine Tasks
| Task | Action |
| Add new terms | Edit DEFS in index.html, re-upload |
| Update a definition | Edit the relevant field in DEFS, re-upload |
| Rename a term key | Change the key in DEFS; update XREF_SINGLE or TITLE_OVERRIDES if applicable |
| Add a cross-ref exclusion | Edit XREF_EXCLUSIONS |
| Add a short-word cross-ref | Add to XREF_SINGLE |
| Fix a display name | Add to TITLE_OVERRIDES |
| Change branding or copy | Edit the HTML masthead and welcome section directly |
| Update copyright year | Automatic — no action needed |
| Update term count | Automatic — no action needed |
| Read-aloud voices missing | Try Chrome; voices load asynchronously and may require reopening the card |
Hosting Requirements
- Apache web server with
mod_rewrite and mod_headers enabled
- HTTPS certificate (standard on university hosting)
- No server-side language or database required
- File size: approximately 1 MB (grows with additional terms)
Testing After Updates
- New term appears in the correct letter section
- Card expands correctly with all three fields
- Cross-reference links within the new term’s text work correctly
- Read Aloud reads all three fields in sequence
- Speed controls change rate in real time during playback
- Stop button halts playback; closing or navigating also stops audio
- Random Term card can display the new term
- Counts toggle shows the correct count for the new term’s letter
Contact
For questions about the content or application, contact Malik Singleton through Academic Applications.