Global

Methods

appendWeather()

Appends a weather HTML div that shows the weather but only on the current day's daily log.

The weather is pulled from a third-party API based on the location of the client browser. The weather temperature starts off with fahrenheit units to begin with but can changed when the user clicks on it.

In the case of a fetch error or other error, it defaults to a question-mark style denoting unknown.

Source:

indicateDate(root)

Helper function to indicate what today's date is
Source:
Parameters:
Name Type Description
root string the shadow root inside the monthly element to access the calendar button from

indicateMonth(root)

Helper function to handle turning current month RED when under the current year
Source:
Parameters:
Name Type Description
root HTMLElement the shador root inside the yearly element to access the calendar button from

loadDay(ID)

Loads the current day into display

Calls generateID, attempts to use ID to retrieve data for the current day

If data is returned, calls on day custom element's setter for data

Otherwise, either an error occurred or ID isn't registered

Regardless, day custom element's blank setter is called

In both cases, the day element is appended to appropriate location in document (TODO)

Source:
Parameters:
Name Type Description
ID string Day ID used to load current date, defaults to generation if not provided

loadMonth()

Description here
Source:

loadStyle(fontType, themeType)

Helper function to apply styles loaded from database
Source:
Parameters:
Name Type Description
fontType string font to apply
themeType string theme to apply

loadVars()

Values assigned to variables defined earlier

Classnames used to load divs for the 3 views, the associated icon group, and all bullet elements (currently sections holding list elements but will be replaced once custom bullet element is defined)

IDs used to load button elements

Source:

loadYear()

Description here
Source:
Handles the navigation of entries by incre/decrements of one

Used to provide functionality to next/prev Entry buttons (only in daily view)

Relies on Unit movement being correctly disabled by the 'toggleCheck' function to avoid moving beyond the bounds of entries (dayID[]) and to only allow Entry movement under the daily view

Uses index after navigation to load target Day's ID and set's current Date with an ID conversion

Records date and view to history state, then loads the next/prev Entry using the dayID retrieved from entries (dayID[])

Performs a toggleCheck afterwards to update index and entries (dayID[]) as well as propertly disable prev/next buttons if navigation results in indexing to extremes (0 or length-1)

Source:
Parameters:
Name Type Description
amount Number of Entries to move (+/- 1)
Handles the actual navigation of units by incre/decrements of one

Used to provide functionality to next/prev Unit buttons

Updates currentDate, records date and view to history state, then loads the next Entry (loadDay, loadMonth, loadYear)

Performs a toggleCheck afterwards to update index and entries (dayID[]) as well as propertly disable prev/next buttons if navigation results in indexing to extremes (0 or length-1)

Source:
Parameters:
Name Type Description
amount Number of Units to move (+/- 1)

setupButtons()

Functionality applied via onClickListeners to the following buttons:

Zoom Out button - using zoomOut

Bullet items - using editBullet

Add bullet buttons (that are dynamically added to each section) - using addBullet

Create section button - using createSection

Minimize section button - using jQuery's slideToggle function

Source:

toggleCheck(inBounds)

Toggles relavant Entry navigation buttons based on:

- Whether or not currently in daily view

- Whether or not index navigation in entries (dayID[]) would result in out of bounds

Source:
Parameters:
Name Type Default Description
inBounds bool false whether or not the current day is within the list (to avoid disabling >> for days right before the last entry)

transitionDaily()

Handles transitioning from Monthly view to Daily view

Daily div is set to visible, Monthly div is set to invisible

Icon groups for entry jumping are made available to Daily view

Source:

transitionMonthly()

Handles transitioning from either Daily or Yearly view to Monthly view

Daily and Yearly div is set to invisible, Monthly div is set to visible

Icon groups for entry jumping are made unavailable to Monthly and Yearly view

Zoom out icon is enabled in Monthly and Daily view

Source:

transitionYearly()

Handles transitioning from Monthly view to Yearly view

Yearly div is set to visible, Monthly div is set to invisible

Zoom out icon is disabled in Yearly View

Source:

updateEntries()

Handles additions to entries (dayID[]), which can occur in 2 ways:

- Insertion at end of array, which requires expansion of the array (checked first)

- Taking up an existing index and 'pushing' all other entries afterwards (using splice)

Otherwise, logs an error indicating function was called unnecsarilly

Source:

updateIndex(currIDopt)

Performs updates to index and entries, then decides which buttons need to be disabled

A lookup is done on today's ID to determine index (using a binary search on entries since it's a sorted array), if the day hasn't been recorded yet, the day object will handle deciding whether or not to add the day to entries

Calls function to toggle buttons based off updated Index and whether or not currentID is 'inBounds'

Source:
Parameters:
Name Type Attributes Default Description
currID string <optional>
IDConverter.generateID('day', currDate) current Day's ID used to update indexing and decide whether to toggle buttons

zoomIn(event)

Provides functionality to calendar view in yearly/monthly logs

Access to contents (and therefor target date via ID) in the element that was triggered through event param

Converts stored ID to date with IDConverter and loads into currDate

Reads history state's current view to decide whether to transition to Monthly or Daily view, then calls appropriate transition + load function (loadDay, loadMonth)

Source:
Parameters:
Name Type Description
event OnClickEvent that triggered this function, provides access to target ID

zoomOut()

Zooms out to appropriate view based off history state

Calls finalizeInputs to finish any bullets that are being editted

Checks the current history state's view to determine which transition to make

Pushes the current view to history state and calls appropriate transition function (transitionMonthly, transitionDaily)

Source:

Type Definitions

deleteCallback(transactionResult)

Callback for success/failure functionality after a deletion transaction. Only needed if success and failure conditions must be treated appropriately. If the transaction succeeded, true will be passed as the parameter to this function. Otherwise, false will be passed as the parameter to this function. If additional arguments (varArgs) are given to the function that uses this callback, those arguments will be passed to this callback function in order after the transactionResult parameter.
Source:
Parameters:
Name Type Description
transactionResult boolean True if the delete transaction succeeded; false if it failed

fetchCallback(fetchedData)

Callback for data retrieval. This callback must be specified to have access to the data retrieved from the database request. If the transaction succeeded, the retrieved object will be passed as the parameter to this function. Otherwise, null will be passed as the parameter to this function. If additional arguments (varArgs) are given to the function that uses this callback, those arguments will be passed to this callback function in order after the fetchedData parameter.
Source:
Parameters:
Name Type Description
fetchedData Object The data that is retrieved from the object store if the get transaction succeeded; null if it failed

openCallback(databaseObject)

Callback function that is run after the database is opened and ready for transactions.
Source:
Parameters:
Name Type Description
databaseObject Object The database object if the operation succeeded; null if it failed

setupScript()

Helper called once DOM has loaded.

Will immediately push a state indicating current view is set to daily log to window history,

calls loadVars to load values into declared variables,

calls setupButtons to add onClickListeners to buttns

Source:

storeCallback(transactionResult)

Callback for success/failure functionality after a storage transaction. Only needed if success and failure conditions must be treated appropriately. If the transaction succeeded, true will be passed as the parameter to this function. Otherwise, false will be passed as the parameter to this function. If additional arguments (varArgs) are given to the function that uses this callback, those arguments will be passed to this callback function in order after the transactionResult parameter.
Source:
Parameters:
Name Type Description
transactionResult boolean True if the storage transaction succeeded; false if it failed