From 5fdb94ddfed87d3c51e2e3e2c2433ad47b5e0d85 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Tue, 25 Jul 2023 16:16:43 +0800 Subject: Break long lines --- contents/ui/ActivityView.qml | 8 ++++++-- contents/ui/kanvas.js | 28 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/contents/ui/ActivityView.qml b/contents/ui/ActivityView.qml index 9b547c5..82b3458 100644 --- a/contents/ui/ActivityView.qml +++ b/contents/ui/ActivityView.qml @@ -49,7 +49,9 @@ RowLayout { text: `[${course}] ${title}` font.bold: important font.strikeout: finished - color: important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor + color: important + ? PlasmaCore.Theme.negativeTextColor + : PlasmaCore.Theme.textColor wrapMode: Text.WordWrap Layout.fillWidth: true } @@ -91,7 +93,9 @@ RowLayout { onClicked: () => { important = !important activityLabel.font.bold = important - activityLabel.color = important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor + activityLabel.color = important + ? PlasmaCore.Theme.negativeTextColor + : PlasmaCore.Theme.textColor const configKeys = { announcement: "importantAnnouncements", 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 -- cgit v1.2.3