diff options
Diffstat (limited to 'contents/ui/kanvas.js')
-rw-r--r-- | contents/ui/kanvas.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/contents/ui/kanvas.js b/contents/ui/kanvas.js index 6ed64ac..3162474 100644 --- a/contents/ui/kanvas.js +++ b/contents/ui/kanvas.js @@ -14,11 +14,17 @@ function callApi(path, perPage, callback) { if (callback) { callback(json) } } catch (e) { if (e instanceof SyntaxError) { - console.error(`Cannot parse response for ${path} as JSON:\n${xhr.responseText}`) + console.error( + `Cannot parse response for ${path} as JSON:\n` + + xhr.responseText + ) } else { throw e } } } else { - console.error(`XHR failed when retrieving ${path} (status ${xhr.status}):\n${xhr.responseText}`) + console.error( + `XHR failed when retrieving ${path} (status ${xhr.status}):\n` + + xhr.responseText + ) } } xhr.send() @@ -75,8 +81,10 @@ function syncCourses(courses, courseIndices, showSubmittedAssignments, userId) { course: course.code, title: announcement.title, url: announcement.html_url, - important: plasmoid.configuration.importantAnnouncements.includes(announcement.id.toString()), - finished: plasmoid.configuration.finishedAnnouncements.includes(announcement.id.toString()), + important: plasmoid.configuration.importantAnnouncements + .includes(announcement.id.toString()), + finished: plasmoid.configuration.finishedAnnouncements + .includes(announcement.id.toString()), } // figure out where we insert it into list @@ -110,7 +118,8 @@ function syncCourses(courses, courseIndices, showSubmittedAssignments, userId) { callApi(`/courses/${course.id}/assignments`, 50, assignments => { assignments.forEach(assignment => { - callApi(`/courses/${course.id}/assignments/${assignment.id}/submissions/${userId}`, 0, submission => { + callApi(`/courses/${course.id}/assignments/${assignment.id}` + + `/submissions/${userId}`, 0, submission => { const submitted = submission.workflow_state == "submitted" || submission.workflow_state == "graded" if (submitted && !showSubmittedAssignments) return // discard this @@ -121,11 +130,14 @@ function syncCourses(courses, courseIndices, showSubmittedAssignments, userId) { courseId: course.id, course: course.code, title: assignment.name, - dueAt: assignment.due_at || "", // if null, use empty string to suppress errors + // if null, use empty string to suppress errors + dueAt: assignment.due_at || "", submitted: submitted, url: assignment.html_url, - important: plasmoid.configuration.importantAssignments.includes(assignment.id.toString()), - finished: plasmoid.configuration.finishedAssignments.includes(assignment.id.toString()), + important: plasmoid.configuration.importantAssignments + .includes(assignment.id.toString()), + finished: plasmoid.configuration.finishedAssignments + .includes(assignment.id.toString()), } let idx = 0 |