Methods

_addFadeIn(noteElem:, parent:)

Given a note element, add it to the page while fading it in
Parameters:
NameTypeDescription
noteElem:Notecustom note element - reference to the note that is being added
parent:container that the note will be added to

_addListeners(noteElem)

Given a note element, display the note editor and populate it with values of a note element if one is given
Parameters:
NameTypeDescription
noteElemNotecustom element Note, aka "note-elements" in HTML, reference to note that is being edited

_addNoteEditorListeners()

Add event listeners for the note editor display's save and cancel buttons

_clearTable()

Clears the accomplishments table

_createNoteEditor(noteElem)

Create the note editor and populate it with values of a note element if one is given
Parameters:
NameTypeDefaultDescription
noteElemNotenullcustom element Note, aka "note-elements" in HTML, reference to note that is being edited initialized as null (optional)

_displayNoteEditor(noteElem)

Display the note editor and populate it with values of a note element if one is given
Parameters:
NameTypeDefaultDescription
noteElemNotenullcustom element Note, aka "note-elements" in HTML, reference to note that is being edited initialized as null (optional)

_editCurrentNote()

Edit the current note (displays note editor popup) To be used with add/remove event listeners

_getAccomplishmentsToDisplay(allAccomplishmentsByOldest, options) → {Array.<accomplishemntsObj>}

Filter and sort (reverse or not) array of all accomplishments objects already sorted by oldest
Parameters:
NameTypeDescription
allAccomplishmentsByOldestArray.<accomplishemntsObj>accomplishment objects sorted by oldest
optionsObjecthas sortByOldest (boolean) & filterBy (String: "none", "month", "year")
Throws:
if options has incorrect parameter settings
Type
Error
Returns:
filtered and sorted list of accomplishment objects
Type: 
Array.<accomplishemntsObj>

_getDate(accomplishmentsObj) → {Date}

Get the date of an accomplishments object as a Date object
Parameters:
NameTypeDescription
accomplishmentsObjaccomplishemntsObjan accomplishments object - has date and content fields
Returns:
Date object corresponding to the accomplishments object's date
Type: 
Date

_handleDateInput(date) → {Date}

Turn a date object into a new date object that only contains year, month, date
Parameters:
NameTypeDescription
dateDatedate object (new Date(Year, Month, Day))
Returns:
returns a new date object with same Year, Month, Date
Type: 
Date

_initNoteEditorValues(noteElem, editorTitle, editorContent)

Given a note element, note title input (optional) and note content textarea (optional) initialize the title and content displays of the poopup note editor to be the title and content of the noteELem or empty if the noteElem is null
Parameters:
NameTypeDefaultDescription
noteElemNotecustom element Note, aka "note-elements" in HTML, reference to note that is being edited initialized as null (optional)
editorTitleHTMLInputElementnullinput element for the editor's title section (optional)
editorContentHTMLTextAreaElementnulltextarea element for editor's content section(optional)

_loadNotefromStorage(id)

Given the id of a note, load it from storage. If no id is given, it will load the most recently added note
Parameters:
NameTypeDefaultDescription
idStringnullid of note, initialized as null (optional)

_removeFadeOut(noteElem:)

Given a note element, remove it from the page while fading it out
Parameters:
NameTypeDescription
noteElem:Notecustom note element - reference to the note that is being deleted

_updateNoteEditor(noteElem)

Update the note editor with values of a note element if one is given, otherwise clear the values
Parameters:
NameTypeDefaultDescription
noteElemNotenullcustom element Note, aka "note-elements" in HTML, reference to note that is being edited noteElem initialized as null (optional) - clears editor values if it is null

addAccomplishment()

Adds a new list item into the accomplishment paragraph Clears the input value for accomplishment input, so that new input can be taken in

addClickToDays(calendar) → {void}

Adds event listeners to each date and stores the record created in session storage. Redirects to the "daily log" page for the date clicked.
Parameters:
NameTypeDescription
calendarCalendarThe calendar object initialized when the window is loaded.
Returns:
Type: 
void

calendarFunctionality(calendar) → {void}

Uses Calendar class from ./calendar-class.js to populate the month view and show the next or previous month when you click the left or right buttons on the calendar page. Also highlights the current day and grays out the rollover dates from the prev/next month.
Parameters:
NameTypeDescription
calendarCalendarThe calendar object to be used for functionality.
Returns:
Type: 
void

copyAccomplishments(AccomplishmentsObjArr) → {Array.<accomplishemntsObj>}

return a shallow copy of an array that still points to the accomplishments objects
Parameters:
NameTypeDescription
AccomplishmentsObjArrArray.<accomplishemntsObj>array of accomplishments objects
Returns:
shallow copy of parameter
Type: 
Array.<accomplishemntsObj>

createAccomplishmentsObj(accomplishmentsObj)

Creates a new accomplishments object in LocalStorage
Parameters:
NameTypeDescription
accomplishmentsObjAccomplishmentsObjaccomplishments object
Throws:
could not create accomplishments object due to date already existing
Type
Error

deleteAccomplishment(newItem)

Delete the list element Confirms if the element is to be deleted
Parameters:
NameTypeDescription
newItemHTMLLIElementThe list element with the updated content and buttons

deleteAccomplishmentsObj(date)

Deletes an accomplishments object from localStorage
Parameters:
NameTypeDescription
dateDatedate object (new Date(Year, Month, Day))
Throws:
could not delete accomplishments object due to date not found
Type
Error

deleteButtonClick(record)

Delets record from local storage when the delete button is clicked Has a confirm message, to ask for confirmation Brings to the calendar page
Parameters:
NameTypeDescription
recordRecordThe record containing either from the record from local storage or new a record

deleteFromStorage(noteId)

Given a note id, delete the note from local storage and remove it from the html page
Parameters:
NameTypeDescription
noteIdString | Int

displayMsgIfEmpty(allAccomplishmentsObj)

Display a message on the page if there are no accomplishments
Parameters:
NameTypeDescription
allAccomplishmentsObjArray.<accomplishemntsObj>array of all accomplishments objects from storage

editAccomplishment(item)

Updates the content of a specific accomplishment by Creates an input box to get updated accomplishment
Parameters:
NameTypeDescription
itemHTMLLIElementThe list element with the content and buttons in it

filterAccomplishments(accomplishmentsObjArr, options) → {Array.<accomplishemntsObj>}

Filters an array of accomplishments objects by current year, current month, or no filtering
Parameters:
NameTypeDescription
accomplishmentsObjArrArray.<accomplishemntsObj>array of accomplishments objects
optionsObjectcontains byCurrentMonth (Boolean) and byCurrentYear (Boolean)
Throws:
if options has incorrect parameter settings
Type
Error
Returns:
Type: 
Array.<accomplishemntsObj>

getAccomplishmentsObjByDate(date) → {AccomplishmentsObj}

Gets an accomplishmentsObj from LocalStorage by date
Parameters:
NameTypeDescription
dateDatedate ojbect (new Date(Year, Month, Day))
Throws:
accomplishments object not found for date if it doesn't exist
Type
Error
Returns:
accomplishments object
Type: 
AccomplishmentsObj

getAllAccomplishmentsObj() → {Array.<AccomplishmentsObj>}

Gets all accomplishments from LocalStorage
Returns:
array of accoplishment objects
Type: 
Array.<AccomplishmentsObj>

getStatusMDE() → {Boolean}

Gets the status of whether markdown editing is enabled
Returns:
Whether or not markdown editing is enabled
Type: 
Boolean

hasAccomplishmentsObjByDate(date) → {Boolean}

Checks if an accomplishments object exists in localStorage by date
Parameters:
NameTypeDescription
dateDatedate object (new Date(Year, Month, Day))
Returns:
true if accomplishments object exists, false if it doesn't exist
Type: 
Boolean

init()

Create two SimpleMDE objects to apply to textareas

loadAccomplishmentFromStorage() → {Array.<accomplishemntsObj>}

Get all accomplishment Objects from storage
Returns:
array of accomplishments objects retrieved from storage
Type: 
Array.<accomplishemntsObj>

loadAllNotesFromStorage()

Loads note records from storage and creates note-elements to display them in notes.html

logFunctionality(text)

Initializes log functionality by setting up the event listeners for the submit and delete buttons
Parameters:
NameTypeDescription
textstringThe content to be added to the list item

populateDefaultLog(record)

Populates the daily log with the information from the record object
Parameters:
NameTypeDescription
recordRecordThe record containing either from the record from local storage or new a record

populateTable(accomplishmentsObjArr)

Populate the accomplishments table given an arry of accomplishments objects. Puts every accomplishment on a new row.
Parameters:
NameTypeDescription
accomplishmentsObjArrArray.<accomplishemntsObj>array of accomplishments objects

setStatusMDE(statusMDE)

Sets the status of whether to enable markdown editing
Parameters:
NameTypeDescription
statusMDEBoolean

sortAccomplishments(accomplishmentsObjArr, options) → {Array.<accomplishemntsObj>}

Sort an array of accomplishments objects by oldest or newest given an unsorted or sorted array This allows for quick reversing betweeen newest and oldest rather than fully resorting each time
Parameters:
NameTypeDescription
accomplishmentsObjArrArray.<accomplishemntsObj>array of accomplishments objects
optionsObjectcontains byOldest (boolean) and alreadySortedByOldest(boolean)
Returns:
Type: 
Array.<accomplishemntsObj>

submitButtonClick(record)

Updates the imformation of the record saved in the local storage when the submit button is clicked Jumps to the calendar page
Parameters:
NameTypeDescription
recordRecordThe record containing either from the record from local storage or new a record

submitToStorage()

Checks if RecordsStorage has the ID, if it does, update the RecordStorage Else create a new Record and store that into RecordStorage

updateAccomplishmentsObj(accomplishmentsObj)

Updates an accomplishmentsObj in LocalStorage
Parameters:
NameTypeDescription
accomplishmentsObjAccomplishmentsObjaccomplishments object
Throws:
could not update accomplishments object due to object date not found
Type
Error

updateContentButtons(newItem, text) → {HTMLLIElement}

Updates an accomplishment list element by adding text and buttons for edit, done, and delete actions
Parameters:
NameTypeDescription
newItemHTMLLIElementThe list element
textstringThe content to be added to the list item
Returns:
The list element with the updated content and buttons
Type: 
HTMLLIElement

updateStatusMDE()

Sets the status of markdown editing based on the user's actions