summaryrefslogtreecommitdiff
path: root/contents/ui/kanvas.js
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2023-07-25 16:16:43 +0800
committerFrederick Yin <fkfd@fkfd.me>2023-07-25 16:16:43 +0800
commit5fdb94ddfed87d3c51e2e3e2c2433ad47b5e0d85 (patch)
tree522ed36aed46725a45ada5f672995549f0a6aa89 /contents/ui/kanvas.js
parent681f3ad2cd1163dbd049b4e917c4631541d3bb89 (diff)
Break long lines
Diffstat (limited to 'contents/ui/kanvas.js')
-rw-r--r--contents/ui/kanvas.js28
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