js/main.js
Main application logic for routing, filtering, searching, and initializing the app.
Methods
(inner) applyFilters()
Applies selected filters and sorting to the displayed items.
(inner) clearSearch()
Clears search input fields.
(inner) enableHorizontalWheelScroll(root)
Enables horizontal scrolling for elements with the 'scroll-row' class using the mouse wheel.
Parameters:
| Name | Type | Description |
|---|---|---|
root |
The root element to search within (default is document). |
(inner) handleSearch(e)
Handles search input and updates the displayed content accordingly.
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event | The input event. |
(inner) initHero()
Initializes the hero section with a featured item or the latest item.
(inner) populateFilters()
Populates filter dropdowns based on available data.
(inner) resetFilters()
Resets all filters to default values and reapplies them.
(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'). |
(inner) textWhite(navHome, navSeries, navFilms, navCollections)
Sets navigation link colors to default (removes highlight).
Parameters:
| Name | Type | Description |
|---|---|---|
navHome |
HTMLElement | Navigation link elements |
navSeries |
HTMLElement | Navigation link elements |
navFilms |
HTMLElement | Navigation link elements |
navCollections |
HTMLElement | Navigation link elements |