Module: add

Provides utility functions for formatting and displaying JSON data, as well as updating UI elements based on user input. This module includes functions to apply syntax highlighting to JSON strings, extract and clean the inner content of a JSON object, and dynamically toggle the visibility of form fields depending on the selected media type.
Source:

Methods

(inner) getInnerJsonString(obj) → {string}

Extracts the inner JSON content from an object, removing the outer braces and base indentation. Converts the given object into a pretty-printed JSON string, then strips the first and last lines (which contain the opening and closing braces) and removes the leading indentation from each remaining line. This is useful for embedding only the core content of an object in another context without the outer structure.
Parameters:
Name Type Description
obj Object The object to convert and extract from.
Source:
Returns:
A formatted string representing the inner JSON content (without outer braces or base indentation).
Type
string

(inner) syntaxHighlight(json) → {string}

Applies syntax highlighting to a JSON string or object. This function takes a JSON object or string, escapes HTML-sensitive characters, and wraps values (keys, strings, numbers, booleans, null) in elements with specific CSS classes for visual syntax highlighting. This is typically used to display JSON data in a readable and styled format within HTML.
Parameters:
Name Type Description
json string | Object The JSON string or object to highlight. If an object is provided, it is stringified using `JSON.stringify`.
Source:
Returns:
The highlighted HTML string representing the formatted JSON.
Type
string

(inner) updateFields()

Updates the visibility of input fields based on the selected media type. Displays the film-related fields if "film" is selected, the series-related fields if "serie" is selected, and hides both if no valid type is selected.
Source: