Module: main

js/main.js Main application logic for routing, filtering, searching, and initializing the app.
Source:

Methods

(inner) applyFilters()

Applies selected filters and sorting to the displayed items.
Source:

(inner) clearSearch()

Clears search input fields.
Source:

(inner) closeActorDetailsAndRoute()

Closes actor details overlay and restores the base view route.
Source:

(inner) closeDetailsAndRoute()

Closes media details overlay and restores the base view route.
Source:

(inner) enableHorizontalWheelScroll(rootopt)

Enables horizontal scrolling for elements with the 'scroll-row' class using the mouse wheel.
Parameters:
Name Type Attributes Default Description
root Document | HTMLElement <optional>
document The root element to search within.
Source:

(inner) findActorBySlug(slug) → {Object|null}

Finds an actor by slug.
Parameters:
Name Type Description
slug string Actor slug.
Source:
Returns:
Actor object or null.
Type
Object | null

(inner) findCollectionBySlug(slug) → {Object|null}

Finds a collection by slug.
Parameters:
Name Type Description
slug string Collection slug.
Source:
Returns:
Collection object or null.
Type
Object | null

(inner) findMediaBySlug(type, slug) → {Object|null}

Finds a media item by slug within a media collection.
Parameters:
Name Type Description
type string 'films' or 'series'.
slug string Media slug.
Source:
Returns:
Media item or null.
Type
Object | null

(inner) getBasePath(pathname) → {string}

Determines the base path (useful for deployments in subfolders).
Parameters:
Name Type Description
pathname string Current location pathname.
Source:
Returns:
Normalized base path ending with '/'.
Type
string

(inner) getCollectionItems(collection) → {Array}

Builds media items array for a collection.
Parameters:
Name Type Description
collection Object Collection object.
Source:
Returns:
Ordered media items.
Type
Array

(inner) handleSearch(e)

Handles search input and updates the displayed content accordingly.
Parameters:
Name Type Description
e Event The input event.
Source:

(inner) initHero()

Initializes the hero section with a featured item or the latest item.
Source:

(inner) openActorDetailsRoute(actor, filmsData, seriesData)

Opens an actor details overlay and syncs the route.
Parameters:
Name Type Description
actor Object Actor item.
filmsData Object Films data.
seriesData Object Series data.
Source:

(inner) openMediaDetails(item)

Opens a media details overlay and syncs the route.
Parameters:
Name Type Description
item Object Media item.
Source:

(inner) parseLocationRoute() → {string}

Resolves the view name from the current URL.
Source:
Returns:
View name.
Type
string

(inner) populateFilters()

Populates filter dropdowns based on available data.
Source:

(inner) resetFilters()

Resets all filters to default values and reapplies them.
Source:

(inner) router(view)

Routes to the specified view and updates the UI accordingly.
Parameters:
Name Type Description
view string The view to route to ('home', 'series', 'films', 'collections', 'actors').
Source:

(inner) slugify(text) → {string}

Builds a URL-friendly slug from a title string.
Parameters:
Name Type Description
text string Source text.
Source:
Returns:
Slug.
Type
string

(inner) textWhite(navHome, navSeries, navFilms, navCollections, navActors)

Sets navigation link colors to default (removes highlight).
Parameters:
Name Type Description
navHome HTMLElement Navigation link for home
navSeries HTMLElement Navigation link for series
navFilms HTMLElement Navigation link for films
navCollections HTMLElement Navigation link for collections
navActors HTMLElement Navigation link for actors
Source:

(inner) updateRoute(view, detail)

Updates the URL path for the current view and optional detail.
Parameters:
Name Type Default Description
view string Base view.
detail Object | null null Optional detail route.
Source: