diff --git a/src/internal/application.ts b/src/internal/application.ts index dd12b6fc..12b41cd2 100644 --- a/src/internal/application.ts +++ b/src/internal/application.ts @@ -1,9 +1,9 @@ -import {Client, NewChromeClientMessage, NewExtensionClientMessage} from "./utils/message"; -import {HttpUtils} from "./utils/utils"; -import {ConfigItems} from "./utils/config"; -import {Logger} from "./utils/log"; -import {SystemConfig} from "@App/config"; -import {QuestionBank} from "./app/question"; +import { Client, NewChromeClientMessage, NewExtensionClientMessage } from "./utils/message"; +import { HttpUtils } from "./utils/utils"; +import { ConfigItems } from "./utils/config"; +import { Logger } from "./utils/log"; +import { SystemConfig } from "@App/config"; +import { QuestionBank } from "./app/question"; export const Backend = "backend"; export const Frontend = "frontend"; @@ -108,7 +108,7 @@ export class Application { hotversion: json.hotversion, injection: json.injection, }; - chrome.storage && chrome.storage.local.set(data); + Application.IsContent && chrome.storage.local.set(data); await callback((SystemConfig.version < data.version), data); }, error: async function () { await callback(false, undefined); diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index 9d736fc3..d0d53ce1 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -142,14 +142,14 @@ export class PageLog implements Logger { const windowHeight = window.innerHeight; const containerWidth = getProperty(this.div, "width"); const containerHeight = getProperty(this.div, "height"); - let x = parseInt(Application.App.config.GetConfig("notify_tools_x").replace('px', '')); + let x = parseInt(Application.App.config.GetConfig("notify_tools_x", "60px").replace('px', '')); if (x < 0) { x = 0; } if (x >= windowWidth - containerWidth) x = windowWidth - containerWidth; this.div.style.left = x + "px"; - let y = parseInt(Application.App.config.GetConfig("notify_tools_y").replace('px', '')); + let y = parseInt(Application.App.config.GetConfig("notify_tools_y", "40px").replace('px', '')); if (y < 0) { y = 0; } diff --git a/src/mooc/chaoxing/course.ts b/src/mooc/chaoxing/course.ts index b969144f..77835056 100644 --- a/src/mooc/chaoxing/course.ts +++ b/src/mooc/chaoxing/course.ts @@ -20,7 +20,7 @@ export class CxCourse extends EventListener implements MoocTaskSet { Application.App.log.Info("超星新窗口加载"); this.OperateCard(el); // 超星会有多次加载,所以使用一个flag变量,只回调一次 - first && resolve(); + first && resolve(undefined); first = false; } }, true); diff --git a/src/mooc/chaoxing/question.ts b/src/mooc/chaoxing/question.ts index 9b64e6c6..11af3cb0 100644 --- a/src/mooc/chaoxing/question.ts +++ b/src/mooc/chaoxing/question.ts @@ -1,4 +1,4 @@ -import {substrex, randNumber as RandNumber, removeHTMLTag} from "@App/internal/utils/utils"; +import { substrex, randNumber as RandNumber, removeHTMLTag } from "@App/internal/utils/utils"; import { Question, TopicStatus, @@ -9,7 +9,7 @@ import { Answer, PushAnswer } from "@App/internal/app/question"; -import {CreateNoteLine} from "./utils"; +import { CreateNoteLine } from "./utils"; //TODO: 优化 export class CxQuestionFactory { @@ -356,21 +356,31 @@ class cxJudgeQuestion extends cxSelectQuestion implements Question { public Correct(): Answer { let el = this.el.querySelector(".Py_answer.clearfix"); let ret = this.defaultAnswer(); - if (el.querySelectorAll('.fr.dui').length <= 0 && el.querySelectorAll('.fr.cuo').length <= 0) { + let score = this.el.querySelector(".Cy_TItle.clearfix .font18.fb"); + if (el.innerHTML.indexOf('正确答案') !== -1 || (score && score.querySelector(".Cy_TItle.clearfix .font18.fb").innerHTML != "0.0")) { + let correctText = el.querySelector("span").innerText; + if (correctText.indexOf('×') !== -1) { + ret.correct.push({ option: false, content: false }); + } else { + ret.correct.push({ option: true, content: true }); + } + return ret; + } + if (!el.querySelectorAll('.fr.dui').length && !el.querySelectorAll('.fr.cuo').length) { return null; } let correctText = el.querySelector("span").innerText; if (el.querySelectorAll('.fr.dui').length) { - if (correctText.indexOf('×') >= 0) { - ret.correct.push({option: false, content: false}); + if (correctText.indexOf('×') !== -1) { + ret.correct.push({ option: false, content: false }); } else { - ret.correct.push({option: true, content: true}); + ret.correct.push({ option: true, content: true }); } } else { - if (correctText.indexOf('×') >= 0) { - ret.correct.push({option: true, content: true}); + if (correctText.indexOf('×') !== -1) { + ret.correct.push({ option: true, content: true }); } else { - ret.correct.push({option: false, content: false}); + ret.correct.push({ option: false, content: false }); } } return ret; diff --git a/src/mooc/chaoxing/topic.ts b/src/mooc/chaoxing/topic.ts index 335dd2f6..aaa0ecae 100644 --- a/src/mooc/chaoxing/topic.ts +++ b/src/mooc/chaoxing/topic.ts @@ -43,7 +43,7 @@ export class TopicAdapter extends CxTask { return new Promise(async resolve => { Application.App.log.Debug("题目信息", this.taskinfo); await this.topic.Init(); - resolve(); + resolve(undefined); }); } @@ -117,7 +117,7 @@ export class CxCourseTopic extends Topic { if (this.context.document.URL.indexOf("selectWorkQuestionYiPiYue") > 0) { await this.CollectAnswer(); } - resolve(); + resolve(undefined); } }, 500); }); @@ -156,7 +156,7 @@ export class CxCourseTopic extends Topic { .addEventListener("load", async function () { if (this.contentWindow.document.URL.indexOf('selectWorkQuestionYiPiYue') > 0) { await self.CollectAnswer(); - resolve(); + resolve(undefined); } }); //确定提交 @@ -192,7 +192,7 @@ export class ExamTopic extends Topic implements QueryQuestions { public Submit(): Promise { return new Promise(resolve => { - resolve(); + resolve(undefined); }); } } diff --git a/src/tampermonkey/course163.js b/src/tampermonkey/course163.js index b65f1124..48137be4 100644 --- a/src/tampermonkey/course163.js +++ b/src/tampermonkey/course163.js @@ -15,7 +15,7 @@ // ==/UserScript== let config = { - answer_ignore: true, //忽略题目,勾选此处将不会答题 + answer_ignore: false, //忽略题目,勾选此处将不会答题 auto: true, //全自动挂机,无需手动操作,即可自动观看视频等 rand_answer: false, //随机答案,没有答案的题目将自动的生成一个答案 interval: 1, //时间间隔,当任务点完成后,会等待1分钟然后跳转到下一个任务点 diff --git a/src/tampermonkey/cxmooc.js b/src/tampermonkey/cxmooc.js index 1fe9a659..b311a65f 100644 --- a/src/tampermonkey/cxmooc.js +++ b/src/tampermonkey/cxmooc.js @@ -23,7 +23,7 @@ // ==/UserScript== let config = { - answer_ignore: true, //忽略题目,勾选此处将不会答题 + answer_ignore: false, //忽略题目,勾选此处将不会答题 auto: true, //全自动挂机,无需手动操作,即可自动观看视频等 interval: 1, //时间间隔,当任务点完成后,会等待1分钟然后跳转到下一个任务点 rand_answer: false, //随机答案,没有答案的题目将自动的生成一个答案