From c054be36510e22d739ba3a13978cf1757344245c Mon Sep 17 00:00:00 2001 From: das08 Date: Tue, 22 Jun 2021 11:11:38 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/minipanda.ts | 1 + src/settings.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/minipanda.ts b/src/minipanda.ts index 6a97f30..d462670 100644 --- a/src/minipanda.ts +++ b/src/minipanda.ts @@ -165,6 +165,7 @@ async function createSettingsTab(): Promise { createSettingItem("課題キャッシュ時間 [秒]", CPsettings.kadaiCacheInterval ?? kadaiCacheInterval, "kadaiCacheInterval"); createSettingItem("クイズキャッシュ時間 [秒]", CPsettings.quizCacheInterval ?? quizCacheInterval, "quizCacheInterval"); createSettingItem("デバッグモード", CPsettings.makePandAGreatAgain ?? false, "makePandAGreatAgain", false); + createSettingItem("提出時に自動で完了済にする", CPsettings.detectSubmission ?? false, "detectSubmission"); createSettingItem("カラー① 締切24時間前", CPsettings.topColorDanger ?? "#f78989", "topColorDanger"); createSettingItem("カラー① 締切5日前", CPsettings.topColorWarning ?? "#fdd783", "topColorWarning"); diff --git a/src/settings.ts b/src/settings.ts index e74d6b6..b603ccf 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -3,6 +3,7 @@ export class Settings { quizCacheInterval?: number; displayCheckedKadai?: boolean; makePandAGreatAgain?: boolean; + detectSubmission?: boolean; topColorDanger?: string; topColorWarning?: string; topColorSuccess?: string; @@ -16,6 +17,7 @@ export class DefaultSettings extends Settings { static quizCacheInterval = 600; static displayCheckedKadai = true; static makePandAGreatAgain = false; + static detectSubmission = false; static topColorDanger = "#f78989"; static topColorWarning = "#fdd783"; static topColorSuccess = "#8bd48d"; From 93a7101bbb6b14c3c884f9df8644a1ddb8ed16f3 Mon Sep 17 00:00:00 2001 From: das08 Date: Tue, 22 Jun 2021 11:12:03 +0900 Subject: [PATCH 2/2] =?UTF-8?q?main=E9=96=A2=E6=95=B0=E5=86=85=E3=81=AB?= =?UTF-8?q?=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content_script.ts | 45 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/content_script.ts b/src/content_script.ts index 79c94fa..b8c9291 100644 --- a/src/content_script.ts +++ b/src/content_script.ts @@ -125,28 +125,31 @@ async function main() { miniPandAReady(); updateIsReadFlag(mergedKadaiListNoMemo); + + // 課題提出画面にいるなら、課題を完了済みとしてマークする + detectSubmission((info) => { + console.log('submission detected'); + console.log(info); + // 設定がONのとき + if (CPsettings.detectSubmission) { + loadFromStorage("TSkadaiList") + .then((kadaiList: Array) => { + LOOP: + for (const kadai of kadaiList) { + if (kadai.lectureID == info.siteId) { + for (const kadaiEntry of kadai.kadaiEntries) { + if (kadaiEntry.kadaiID == info.assignmentId) { + kadaiEntry.isFinished = true; + break LOOP; + } + } + } + } + saveToStorage("TSkadaiList", kadaiList); + }); + } + }); } } main(); - -// 課題提出画面にいるなら、課題を完了済みとしてマークする -detectSubmission(info => { - console.log('submission detected'); - console.log(info); - loadFromStorage("TSkadaiList") - .then((kadaiList: Array) => { - LOOP: - for (const kadai of kadaiList) { - if (kadai.lectureID == info.siteId) { - for (const kadaiEntry of kadai.kadaiEntries) { - if (kadaiEntry.kadaiID == info.assignmentId) { - kadaiEntry.isFinished = true; - break LOOP; - } - } - } - } - saveToStorage("TSkadaiList", kadaiList); - }); -});