Global

Members

(constant) consistentStyle

Contains all of the Shadow DOMs we want to make the right column work without bloating to code too much
Source:

(constant) images

Preloads the images that can be displayed as icons on a card. Without this, a user might add an icon and not have it render until they do something else to update the card, which isn't ideal.
Source:

Methods

deleteCard()

Removes the current card from localStorage and opens up a new card for the user to use
Source:

deleteCard(cardName) → {Promise.<boolean>}

Delete a specific card from local storage and trigger a UI update.
Parameters:
Name Type Description
cardName string The name of the card to delete.
Source:
Returns:
- True if deleted, false if card not found.
Type
Promise.<boolean>

deleteDialog(deleteBtn, cardName, page)

Attaches a delete confirmation dialog to a button.
Parameters:
Name Type Description
deleteBtn HTMLElement Button that triggers the dialog.
cardName string Name of the card to delete.
page string Context where the delete happens, e.g. "home".
Source:

downloadCardJSON(cardName)

Download the selected card's data as a JSON file.
Parameters:
Name Type Description
cardName string The name of the card to download.
Source:

downloadURL(url, name)

Causes the user to download the file at the given URL under the given name
Parameters:
Name Type Description
url String The URL to download
name String The name to download it as
Source:

exportCardsList()

Saves the current value of cardsList to localStorage, used for saving cards
Source:

exportCurrentCardName()

Sets the value of current_card to the current card's name in localStorage
Source:

getStarStatus(cardName) → {boolean}

Check if a specific card is currently starred.
Parameters:
Name Type Description
cardName string The name of the card to check.
Source:
Returns:
- True if the card is starred.
Type
boolean

handleFiles(files) → {boolean}

Handles parsing and storing of uploaded JSON card files.
Parameters:
Name Type Description
files FileList List of uploaded files (only the first is processed).
Source:
Returns:
Whether the upload and parsing succeeded.
Type
boolean

handleStarCard(cardName, cardData) → {Object}

Handle the logic to star or unstar a card. Only one card can be starred.
Parameters:
Name Type Description
cardName string The name of the card to (un)star.
cardData Object The card data to store if starring.
Source:
Returns:
- Action result and success flag.
Type
Object

importCardsList()

Imports the user's saved cards from localStorage
Source:
Returns:
A dictionary of card names and their descriptions

importCurrentCardName()

Imports what the last value of current_card was in localStorage. Used to save session information so that if a user reloads the screen, they'll stay on the same card. If there is no such value, get the next unused name with nextUntitled();
Source:
Returns:
The name of the card to use

init()

Initializes the objects on the editor page.
Source:

initListeners()

Initializes all listener actions for the top bar, which will then have functionality when the user clicks on them.
Source:

newCard()

Before jump to editor-page, clears the current card selection in localStorage.
Source:

nextUntitled()

A helper function to find the first card name of the form "UntitledX" that isn't currently used by another card
Source:
Returns:
The next unused name

openNew()

Opens a new card
Source:

removePopupMenu()

Removes the current popup menu, hiding it from the user. This is important because we reuse the same div to handle the popup menu, so we need to hide it away whenever a menu is gone; we can't delete it.
Source:

renderScaledPreview(canvas, data, width, height)

Render a preview of a card on a canvas with scaling applied.
Parameters:
Name Type Description
canvas HTMLCanvasElement The canvas to render on.
data Object The card data object.
width number Target width for rendering.
height number Target height for rendering.
Source:

renderYourCard(frontCard, backCard, cardName) → {string|false}

Renders the front and back sides of a card into canvases.
Parameters:
Name Type Description
frontCard HTMLCanvasElement Canvas for the front of the card.
backCard HTMLCanvasElement Canvas for the back of the card.
cardName string The name of the card to render.
Source:
Returns:
- The card name, or false if not found.
Type
string | false

reset(saved)

Resets the rendering of the current card. Used to open up new cards without having to fully create new Canvas objects, which would be expensive.
Parameters:
Name Type Description
saved boolean Whether to display the top bar as saved or not
Source:

saveAs(name)

Creates a copy of the current card with a new name
Parameters:
Name Type Description
name String The new name
Source:

saveCardsList(cardsList)

Save the updated card list to local storage.
Parameters:
Name Type Description
cardsList Object The full card list to save.
Source:

searchLocalStorage(searchInput)

Searches localStorage card names and displays matching results in a dropdown under the input.
Parameters:
Name Type Description
searchInput HTMLInputElement The input element the user types in.
Source:

setCardName(name)

Sets the name of the current card
Parameters:
Name Type Description
name String Name to set it to
Source:

setName(name)

Sets the name in the top bar, adding an asterisk if the card isn't saved.
Parameters:
Name Type Description
name String Name to set to
Source:

setSaved(value)

Sets the value of saved
Parameters:
Name Type Description
value boolean Value
Source:

triggerDeleteMenu(e)

Makes the popup menu into a confirmation screen before the user deletes the current card.
Parameters:
Name Type Description
e * The click event triggering the menu; unused
Source:

triggerOpenMenu()

Triggers an open menu, where the user can select a card to open from their list of currently available cards.
Source:

triggerSaveAsMenu(e)

Opens a "save as" menu, where the user can choose the name of their card that they want to save it as.
Parameters:
Name Type Description
e * The click event triggering the menu; unused
Source:

uploadFeature()

Adds upload functionality triggered by the upload button. Allows drag-and-drop or file input, shows a confirmation dialog, and reads/parses the uploaded JSON file.
Source:

uploadFeature()

Set up the upload button to allow file uploads via dialog or drag-drop.
Source:

yourCardFeature()

Displays the starred card in an overlay preview, with options to edit, download, or delete.
Source: