Methods
_addFadeIn(noteElem:, parent:)
Given a note element, add it to the page while fading it in
Parameters:
Name | Type | Description |
---|---|---|
noteElem: | Note | custom note element - reference to the note that is being added |
parent: | container that the note will be added to |
- Source
_addListeners(noteElem)
Given a note element, display the note editor and populate it with values of a note element if one is given
Parameters:
Name | Type | Description |
---|---|---|
noteElem | Note | custom element Note, aka "note-elements" in HTML, reference to note that is being edited |
- Source
_addNoteEditorListeners()
Add event listeners for the note editor display's save and cancel buttons
- Source
_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:
Name | Type | Default | Description |
---|---|---|---|
noteElem | Note | null | custom element Note, aka "note-elements" in HTML, reference to note that is being edited initialized as null (optional) |
- Source
_displayNoteEditor(noteElem)
Display the note editor and populate it with values of a note element if one is given
Parameters:
Name | Type | Default | Description |
---|---|---|---|
noteElem | Note | null | custom element Note, aka "note-elements" in HTML, reference to note that is being edited initialized as null (optional) |
- Source
_editCurrentNote()
Edit the current note (displays note editor popup) To be used with add/remove event listeners
- Source
_getAccomplishmentsToDisplay(allAccomplishmentsByOldest, options) → {Array.<accomplishemntsObj>}
Filter and sort (reverse or not) array of all accomplishments objects already sorted by oldest
Parameters:
Name | Type | Description |
---|---|---|
allAccomplishmentsByOldest | Array.<accomplishemntsObj> | accomplishment objects sorted by oldest |
options | Object | has 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:
Name | Type | Description |
---|---|---|
accomplishmentsObj | accomplishemntsObj | an 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:
Name | Type | Description |
---|---|---|
date | Date | date 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:
Name | Type | Default | Description |
---|---|---|---|
noteElem | Note | custom element Note, aka "note-elements" in HTML, reference to note that is being edited initialized as null (optional) | |
editorTitle | HTMLInputElement | null | input element for the editor's title section (optional) |
editorContent | HTMLTextAreaElement | null | textarea element for editor's content section(optional) |
- Source
_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:
Name | Type | Default | Description |
---|---|---|---|
id | String | null | id of note, initialized as null (optional) |
- Source
_removeFadeOut(noteElem:)
Given a note element, remove it from the page while fading it out
Parameters:
Name | Type | Description |
---|---|---|
noteElem: | Note | custom note element - reference to the note that is being deleted |
- Source
_updateNoteEditor(noteElem)
Update the note editor with values of a note element if one is given, otherwise clear the values
Parameters:
Name | Type | Default | Description |
---|---|---|---|
noteElem | Note | null | custom 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 |
- Source
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
- Source
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:
Name | Type | Description |
---|---|---|
calendar | Calendar | The calendar object initialized when the window is loaded. |
- Source
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:
Name | Type | Description |
---|---|---|
calendar | Calendar | The calendar object to be used for functionality. |
- Source
Returns:
- Type:
- void
copyAccomplishments(AccomplishmentsObjArr) → {Array.<accomplishemntsObj>}
return a shallow copy of an array that still points to the accomplishments objects
Parameters:
Name | Type | Description |
---|---|---|
AccomplishmentsObjArr | Array.<accomplishemntsObj> | array of accomplishments objects |
Returns:
shallow copy of parameter
- Type:
- Array.<accomplishemntsObj>
createAccomplishmentsObj(accomplishmentsObj)
Creates a new accomplishments object in LocalStorage
Parameters:
Name | Type | Description |
---|---|---|
accomplishmentsObj | AccomplishmentsObj | accomplishments 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:
Name | Type | Description |
---|---|---|
newItem | HTMLLIElement | The list element with the updated content and buttons |
- Source
deleteAccomplishmentsObj(date)
Deletes an accomplishments object from localStorage
Parameters:
Name | Type | Description |
---|---|---|
date | Date | date 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:
Name | Type | Description |
---|---|---|
record | Record | The record containing either from the record from local storage or new a record |
- Source
deleteFromStorage(noteId)
Given a note id, delete the note from local storage and remove it from the html page
Parameters:
Name | Type | Description |
---|---|---|
noteId | String | |
- Source
displayMsgIfEmpty(allAccomplishmentsObj)
Display a message on the page if there are no accomplishments
Parameters:
Name | Type | Description |
---|---|---|
allAccomplishmentsObj | Array.<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:
Name | Type | Description |
---|---|---|
item | HTMLLIElement | The list element with the content and buttons in it |
- Source
filterAccomplishments(accomplishmentsObjArr, options) → {Array.<accomplishemntsObj>}
Filters an array of accomplishments objects by current year, current month, or no filtering
Parameters:
Name | Type | Description |
---|---|---|
accomplishmentsObjArr | Array.<accomplishemntsObj> | array of accomplishments objects |
options | Object | contains 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:
Name | Type | Description |
---|---|---|
date | Date | date 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:
Name | Type | Description |
---|---|---|
date | Date | date 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
- Source
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
- Source
logFunctionality(text)
Initializes log functionality by setting up the event listeners for the submit and delete buttons
Parameters:
Name | Type | Description |
---|---|---|
text | string | The content to be added to the list item |
- Source
populateDefaultLog(record)
Populates the daily log with the information from the record object
Parameters:
Name | Type | Description |
---|---|---|
record | Record | The record containing either from the record from local storage or new a record |
- Source
populateTable(accomplishmentsObjArr)
Populate the accomplishments table given an arry of accomplishments objects. Puts every accomplishment on a new row.
Parameters:
Name | Type | Description |
---|---|---|
accomplishmentsObjArr | Array.<accomplishemntsObj> | array of accomplishments objects |
setStatusMDE(statusMDE)
Sets the status of whether to enable markdown editing
Parameters:
Name | Type | Description |
---|---|---|
statusMDE | Boolean |
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:
Name | Type | Description |
---|---|---|
accomplishmentsObjArr | Array.<accomplishemntsObj> | array of accomplishments objects |
options | Object | contains 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:
Name | Type | Description |
---|---|---|
record | Record | The record containing either from the record from local storage or new a record |
- Source
submitToStorage()
Checks if RecordsStorage has the ID, if it does, update the RecordStorage Else create a new Record and store that into RecordStorage
- Source
updateAccomplishmentsObj(accomplishmentsObj)
Updates an accomplishmentsObj in LocalStorage
Parameters:
Name | Type | Description |
---|---|---|
accomplishmentsObj | AccomplishmentsObj | accomplishments 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:
Name | Type | Description |
---|---|---|
newItem | HTMLLIElement | The list element |
text | string | The content to be added to the list item |
- Source
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
- Source