Methods
appendWeather()
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)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
root |
string
|
the shadow root inside the monthly element to access the calendar button from |
indicateMonth(root)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
root |
HTMLElement
|
the shador root inside the yearly element to access the calendar button from |
loadDay(ID)
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 |
loadStyle(fontType, themeType)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
fontType |
string
|
font to apply |
themeType |
string
|
theme to apply |
loadVars()
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:
navigateEntry(amount)
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) |
navigateUnit(amount)
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()
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)
- 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()
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()
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()
Yearly div is set to visible, Monthly div is set to invisible
Zoom out icon is disabled in Yearly View
- Source:
updateEntries()
- 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)
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)
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()
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)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
transactionResult |
boolean
|
True if the delete transaction succeeded; false if it failed |
fetchCallback(fetchedData)
- 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)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
databaseObject |
Object
|
The database object if the operation succeeded; null if it failed |
setupScript()
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)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
transactionResult |
boolean
|
True if the storage transaction succeeded; false if it failed |