Manages the rendering and visual presentation of film and series content.
This module provides functions to display popular items, individual films and series,
generate styled content cards, and handle empty result states. It also includes logic
to determine the type of content item and structure the corresponding HTML output.
All rendering is performed by injecting HTML into predefined container elements in the DOM.
- Source:
Methods
(inner) createContentCard(item) → {string}
Creates an HTML content card for a given item (film or series).
Builds a styled card element containing the item's title, banner image, genres,
release year, IMDb rating, and a badge indicating whether it has been fully watched.
The card includes an onclick handler to open a modal with detailed information.
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | The content item to render (must include title, genres, year, IMDb rating, and optionally a banner). |
- Source:
Returns:
A string of HTML representing the content card.
- Type
- string
(inner) displayContent(items, containerId)
Displays a list of content items in the specified container.
Retrieves the DOM element by its ID and populates it with content cards generated
from the provided items. If the container is not found or the items array is empty,
a "no results" message is displayed instead.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<Object> | An array of content objects to display (e.g., films or series). |
containerId |
string | The ID of the DOM element where the content should be rendered. |
- Source:
(inner) displayFilms(films)
Displays a list of film items in the films display grid.
Sorts the provided films alphabetically by title, then renders them
in the DOM element with the ID "filmsGrid" using the displayContent function.
Parameters:
Name | Type | Description |
---|---|---|
films |
Array.<Object> | An array of film objects to display. |
- Source:
(inner) displayPopularContent()
Displays the most popular films and series based on IMDb ratings.
Sorts the film and series data by descending IMDb rating, selects the top six items
from each category, and renders them using the appropriate display container.
- Source:
(inner) displaySeries(series)
Displays a list of film items in the series display grid.
Sorts the provided series alphabetically by title, then renders them
in the DOM element with the ID "seriesGrid" using the displayContent function.
Parameters:
Name | Type | Description |
---|---|---|
series |
Array.<Object> | An array of series objects to display. |
- Source:
(inner) getItemType(item) → {string}
Determines the type of content item based on its properties.
Checks whether the item has a "seasons" property to classify it as a series;
otherwise, it is considered a film.
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | The content item to evaluate. |
- Source:
Returns:
Returns "series" if the item has seasons, otherwise "film".
- Type
- string
(inner) showNoResults(messageopt) → {string}
Generates an HTML block displaying a "no results" message.
Returns a styled HTML string containing an icon and a message, used when no content matches the user's search or filter criteria.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
string |
<optional> |
"Aucun résultat trouvé" | The message to display. |
- Source:
Returns:
An HTML string representing the "no results" message.
- Type
- string