Skip to content

Commit ce25c98

Browse files
committed
update documentation and comments
1 parent db6d769 commit ce25c98

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

classtime.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ function update() {
172172
function updateVariables() {
173173
currentScheduleIndex = getCurrentScheduleIndex();
174174
currentClassPeriodIndex = getCurrentClassPeriodIndex();
175-
//document.getElementById('currentClass').innerHTML = data.schedule[selectedSchedule][currentClassPeriodIndex].name;
176175
}
177176

178177
/**
@@ -231,6 +230,9 @@ function updateText() {
231230
}
232231

233232

233+
/**
234+
* @returns a flag that represents the current chunk of time categorically
235+
*/
234236
function getCurrentTimeState() {
235237

236238
//there is no schedule that applies today
@@ -303,13 +305,11 @@ function getCurrentTimeObject() {
303305

304306

305307
/**
306-
*
307308
* @returns the current time as a formatted string
308309
*/
309310
function getCurrentTimeString() { return currentDate.toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: !use24HourTime }) }
310311

311312
/**
312-
*
313313
* @returns the current date as a formatted string
314314
*/
315315
function getCurrentDateString() {
@@ -319,7 +319,7 @@ return "on <strong>" + currentDate.toLocaleString('en-US', { weekday: 'short', m
319319
/**
320320
* this function determines the index of the class period that is currently going on (if any)
321321
*
322-
* @returns an index for looking up the current class period, or -1 if there is no school today
322+
* @returns an index for looking up the current class period, or -1 if there is no class happening right now
323323
*/
324324
function getCurrentClassPeriodIndex() {
325325
if (isNoSchoolDay()) {
@@ -340,8 +340,6 @@ function getCurrentClassPeriodIndex() {
340340

341341

342342
/**
343-
*
344-
*
345343
* @returns the index of the class that started most recently
346344
*/
347345
function getMostRecentlyStartedClassIndex() {
@@ -466,6 +464,13 @@ function getTimeDelta(timeObject1, timeObject2) {
466464
}
467465

468466

467+
/**
468+
* this function returns a new time object that has been checked for inconsistencies
469+
* such as omitted or invalid values and corrected
470+
*
471+
* @param {*} timeObject the timeObject to validate
472+
* @returns a new, validated time object
473+
*/
469474
function sanitizeTimeObject(timeObject) {
470475

471476
//this prevents the original object from being modified
@@ -520,6 +525,12 @@ function getTimeToStartOfSchoolString() {
520525
}
521526

522527

528+
/**
529+
* A shortcut function that inserts the current time into getTimeDelta() for convenience
530+
*
531+
* @param {*} timeObject
532+
* @returns
533+
*/
523534
function getTimeTo(timeObject) {
524535
return getTimeDelta(getCurrentTimeObject(), timeObject)
525536
}

0 commit comments

Comments
 (0)