This file handles all logic that involves the UI.
- Source:
Classes
Methods
(inner) addError(msg, isError)
Adds an error or message to the queue and displays it if no error is currently being displayed.
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | The message to display. |
isError |
boolean | Whether the message is an error or just information. |
- Source:
(inner) addNewProject(data)
Selects and adds a new project.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the data of the project to be added, so the name, date and its versions. |
- Source:
(inner) addProjectElement(data, frame, addFront)
Adds a new project element to the projects frame.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the data of the project to be added, so the name, date and its versions. |
frame |
HTMLElement | Is the frame element the project element should be added to. |
addFront |
boolean | Says whether to add the project to the front or back of the projects. |
- Source:
(inner) addVersion(versionData, currProjData) → {HTMLElement}
Adds a new version to the projects and versions frames.
Parameters:
Name | Type | Description |
---|---|---|
versionData |
object | Holds the data of the version to be added, so the id, name, date and so on. |
currProjData |
object | Holds the data of the current project, so the name. |
- Source:
Returns:
The newly created version element from the projects frame.
- Type
- HTMLElement
(inner) buildConsoleMessage(data) → {HTMLElement}
Constructs a new message element for the console.
Parameters:
Name | Type | Description |
---|---|---|
data |
string | Is the message to be displayed on the console. |
- Source:
Returns:
The newly created console message element.
- Type
- HTMLElement
(inner) buildProjectElement(data) → {HTMLElement}
Constructs a new project HTML element.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the project name and number of versions for creating a project element. |
- Source:
Returns:
The newly created project element.
- Type
- HTMLElement
(inner) buildProjectVersionElement(data) → {HTMLElement}
Constructs a new version HTML element for the projects frame.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the version id, name, date and so on for creating a version element for the projects frame. |
- Source:
Returns:
The newly created version element.
- Type
- HTMLElement
(inner) buildSettingsElement(data) → {HTMLElement}
Constructs a new settings HTML element.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the settings name, type, and so on for creating a settings element. |
- Source:
Returns:
The newly created settings element.
- Type
- HTMLElement
(inner) buildVersionElement(data) → {HTMLElement}
Constructs a new version HTML element for the versions frame.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the version id, name, date for creating a version element for the versions frame. |
- Source:
Returns:
The newly created version element.
- Type
- HTMLElement
(inner) changeTheme()
Changes the theme of the page.
- Source:
(inner) clearChildren(element)
Clears all children of a certain HTML element.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The element to clear. |
- Source:
(inner) clearConsole()
Clears all messages in the console.
- Source:
(inner) closeProjectsFrame()
Closes the projects frame.
- Source:
(inner) closeSettingsFrame()
Closes the settings frame.
- Source:
(inner) closeVersionsFrame()
Closes the versions frame.
- Source:
(inner) deleteProject(data, wasCurrent)
Deletes a certain project from the projects frame.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the data of the project to be deleted, so the name. |
wasCurrent |
boolean | Says whether the deleted project was the current project. |
- Source:
(inner) deleteVersion(data, target)
Decreases the ammount of versions of a project and deletes the version.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the data of the version to be deleted, id, name, date and so on. |
target |
HTMLElement | Is the targeted UI element that was clicked. |
- Source:
(inner) deleteVersionElements(data)
Deletes a certain version from the projects and versions frames.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the version id, name, date for removing the version element. |
- Source:
(inner) favoriteVersion(data)
Favorites a certain version on the projects frame.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the version id, name, date of the version that is to be favorited. |
- Source:
(inner) formatDataTagName(name) → {string}
Formats a data tag name to match format "data-" + name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The data tag name. |
- Source:
Returns:
The formatted data tag name.
- Type
- string
(inner) formatTimeString(num) → {string}
Format a certain time number.
Parameters:
Name | Type | Description |
---|---|---|
num |
number | Is the time number to format. |
- Source:
Returns:
The formatted time number as a string.
- Type
- string
(inner) getConsoleContainer() → {HTMLElement}
Retrieves the container that holds all console messages.
- Source:
Returns:
The container that holds the console messages.
- Type
- HTMLElement
(inner) getDataAttributes(element) → {object}
Retrieves all data attributes of an HTML element.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | The element to retrieve the attributes of. |
- Source:
Returns:
The data attributes with their names.
- Type
- object
(inner) getFrame(data) → {HTMLElement}
Retrieves a certain frame based on a given name.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Is the data of the frame, so its name. |
- Source:
Returns:
The targeted frame element.
- Type
- HTMLElement
(inner) getIsFavorited(data) → {boolean}
Checks whether a given version is favorited or not.
Parameters:
Name | Type | Description |
---|---|---|
data |
HTMLElement | Is the version element itself or one of its children. |
- Source:
Returns:
Whether the version element is favorited or not.
- Type
- boolean
(inner) getIsFrameLoaded(data) → {boolean}
Checks whether a certain frame has been loaded yet or needs to be fetched.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Is the data of the frame, so its name. |
- Source:
Returns:
Whether the frame is loaded or not.
- Type
- boolean
(inner) getParentWithClassName(name, element) → {HTMLElement}
Retrieves a parent HTML element which has a certain class.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The class name attribute to query for. |
element |
HTMLElement | The HTML element to start at. |
- Source:
Returns:
The found HTML parent.
- Type
- HTMLElement
(inner) getParentWithDataAttribute(attrName, element) → {HTMLElement}
Retrieves a parent HTML element which has a certain data attribute.
Parameters:
Name | Type | Description |
---|---|---|
attrName |
string | The data attribute to query for. |
element |
HTMLElement | The HTML element to start at. |
- Source:
Returns:
The found HTML parent.
- Type
- HTMLElement
(inner) getProjectName(target) → {object}
Retrieves the name of a project stored in the project element.
Parameters:
Name | Type | Description |
---|---|---|
target |
HTMLElement | Is the targeted UI element that was clicked. |
- Source:
Returns:
The data attributes stored in the target element with their names.
- Type
- object
(inner) getVersionId(target) → {string}
Retrieves the id of a version stored in the version element.
Parameters:
Name | Type | Description |
---|---|---|
target |
HTMLElement | Is the targeted UI element that was clicked. |
- Source:
Returns:
The version id stored in the targeted element.
- Type
- string
(inner) increaseNumVersions(target, num)
Increases or decreases the number of versions stored in a project element on the page.
Parameters:
Name | Type | Description |
---|---|---|
target |
HTMLElement | Is the targeted UI element that was clicked. |
num |
number | Is the ammount, the number of versions should be increased or decreased to. |
- Source:
(inner) isThemed() → {boolean}
Get whether the page is themed or not.
- Source:
Returns:
Whether the page is themed or not.
- Type
- boolean
(inner) openFrame(data)
Opens a certain frame.
Parameters:
Name | Type | Description |
---|---|---|
data |
HTMLElement | Is the frame element to open. |
- Source:
(inner) openProjectsFrame(data)
Opens the projects frame and fills with fetched data if needed.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Either null or holds the project data to be rendered. |
- Source:
(inner) openSettingsFrame(data)
Opens the settings frame and fills with fetched data if needed.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Either null or holds the settings data to be rendered. |
- Source:
(inner) openVersionsFrame(data)
Opens the versions frame and fills with fetched data if needed.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Either null or holds the version data to be rendered. |
- Source:
(inner) parseStringToBool(string) → {boolean}
Parses a string to a boolean.
Parameters:
Name | Type | Description |
---|---|---|
string |
string | The string to parse. |
- Source:
Returns:
The parsed string as a boolean.
- Type
- boolean
(inner) queryElementsWithDataAttribute(attrName, attrValue) → {Array.<HTMLElement>}
Retrieves all HTML elements with a certain data tag with a certain value.
Parameters:
Name | Type | Description |
---|---|---|
attrName |
string | The data attribute to query for. |
attrValue |
string | The value the attribute. |
- Source:
Returns:
The found HTML elements.
- Type
- Array.<HTMLElement>
(inner) requestConfirm(callback, request)
Requests the user to confirm a statement.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | The callback to call after execution. |
request |
string | The message to convey. |
- Source:
(inner) requestFile(callback)
Requests a file from the user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | The callback to call after execution. |
- Source:
(inner) requestInput(callback, request)
Requests input from the user based off a statement.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | The callback to call after execution. |
request |
string | The message to convey. |
- Source:
(inner) selectProject(data)
Selects a certain project to be the new current project.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the data of the project to be selected, so the name, date and its versions. |
- Source:
(inner) setFrameLoaded(data)
Sets a frame as loaded, so it doesnt need to be fetched again.
Parameters:
Name | Type | Description |
---|---|---|
data |
HTMLElement | Is the frame element to be set as loaded. |
- Source:
(inner) setFrameLoaded() → {object}
Retrieves the settings currently displayed in the settings frame.
- Source:
Returns:
The settings values with their names.
- Type
- object
(inner) setFrameUnloaded(data)
Sets a frame as unloaded, so it can to be fetched again.
Parameters:
Name | Type | Description |
---|---|---|
data |
HTMLElement | Is the frame element to be set as unloaded. |
- Source:
(inner) showError()
Displays the next error or message in the queue on the page.
- Source:
(inner) toggleDebug(data)
Turns the debug mode on or off and updates the debug slider.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the name of the event that was called and whether the debug was toggled or not. |
- Source:
(inner) toggleProject(data)
Collapses or opens a certain project element to hide or reveal its versions.
Parameters:
Name | Type | Description |
---|---|---|
data |
HTMLElement | Is the project element itself or one of its children. |
- Source:
(inner) updateConsole(data)
Updates the main console with a message.
Parameters:
Name | Type | Description |
---|---|---|
data |
string | Is the message to be displayed on the console. |
- Source:
(inner) updateCurrentProject(data)
Updates the current project.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | Holds the data of the project to be set as the new current project, so the name, date and its versions. |
- Source: