// ==UserScript==
// @name 超星慕课小工具(黄金精神)
// @namespace https://github.com/CodFrm/cxmooc-tools
// @version 2.4.1
// @description 一个超星慕课刷课工具,火狐,谷歌,油猴支持.全自动任务,视频倍速秒过,作业考试题库,验证码自动打码(੧ᐛ੭挂科模式,启动)
// @author CodFrm
// @run-at document-start
// @match *://*/mycourse/studentstudy?*
// @match *://*/ztnodedetailcontroller/visitnodedetail?*
// @match *://*/antispiderShowVerify.ac*
// @match *://*/html/processVerify.ac?*
// @match *://*/exam/test/reVersionPaperMarkContentNew?*
// @match *://*/exam/test/reVersionTestStartNew?*
// @match *://*/work/selectWorkQuestionYiPiYue?*
// @match *://*/work/doHomeWorkNew?*
// @match *://*/ananas/modules/*/index.html?*
// @match *://*/exam/test?*
// @match *://*/course/*.html?*
// @grant GM_xmlhttpRequest
// @grant GM_notification
// @grant unsafeWindow
// @license MIT
// ==/UserScript==
let config = {
answer_ignore: false, //忽略题目,勾选此处将不会答题
auto: true, //全自动挂机,无需手动操作,即可自动观看视频等
interval: 2, //时间间隔,当任务点完成后,会等待2分钟然后跳转到下一个任务点
rand_answer: false, //随机答案,没有答案的题目将自动的生成一个答案
video_multiple: 1, //视频播放倍速,视频播放的倍数,建议不要改动,为1即可,这是危险的功能
video_mute: true, //视频静音,视频自动静音播放
vtoken: "",
video_cdn: "公网1", //锁定视频播放源,为空为记录最后一次选中的源(公网1,公网2等)
super_mode: true, //解锁flash弹幕视频等,详情请看文档
};
Object.keys(config).forEach(k => {
localStorage[k] = config[k];
});
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/tampermonkey/cxmooc-pack.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./src/config.ts":
/*!***********************!*\
!*** ./src/config.ts ***!
\***********************/
/*! exports provided: SystemConfig */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SystemConfig\", function() { return SystemConfig; });\nvar SystemConfig = /** @class */ (function () {\r\n function SystemConfig() {\r\n }\r\n SystemConfig.version = 2.4;\r\n SystemConfig.url = \"https://cxmooc.wget.es/\";\r\n SystemConfig.hotVersion = \"2.4.0\";\r\n SystemConfig.match = [\r\n \"*://*/mycourse/studentstudy?*\",\r\n \"*://*/work/doHomeWorkNew?*\",\r\n \"*://*/work/selectWorkQuestionYiPiYue?*\",\r\n \"*://*/exam/test/reVersionTestStartNew?*\",\r\n \"*://*/ztnodedetailcontroller/visitnodedetail?*\",\r\n \"*://*/antispiderShowVerify.ac*\",\r\n \"*://*/html/processVerify.ac?*\",\r\n \"*://*/exam/test/reVersionPaperMarkContentNew?*\",\r\n \"*://*/ananas/modules/*/index.html?*\",\r\n \"*://*/exam/test?*\",\r\n \"*://*/course/*.html?*\",\r\n \"*://examh5.zhihuishu.com/stuExamWeb.html*\",\r\n \"*://onlineexamh5new.zhihuishu.com/stuExamWeb.html*\",\r\n \"*://studyh5.zhihuishu.com/videoStudy.html*\",\r\n \"*://www.icourse163.org/learn/*\",\r\n \"*://www.icourse163.org/spoc/learn/*\"\r\n ];\r\n return SystemConfig;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/config.ts?");
/***/ }),
/***/ "./src/internal/app/question.ts":
/*!**************************************!*\
!*** ./src/internal/app/question.ts ***!
\**************************************/
/*! exports provided: PushAnswer, TopicStatusString, QuestionStatusString, SwitchTopicType, ToolsQuestionBank, ToolsQuestionBankFacade */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PushAnswer\", function() { return PushAnswer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TopicStatusString\", function() { return TopicStatusString; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuestionStatusString\", function() { return QuestionStatusString; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SwitchTopicType\", function() { return SwitchTopicType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ToolsQuestionBank\", function() { return ToolsQuestionBank; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ToolsQuestionBankFacade\", function() { return ToolsQuestionBankFacade; });\n/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/config */ \"./src/config.ts\");\n/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../application */ \"./src/internal/application.ts\");\n\r\n\r\n\r\nvar PushAnswer = /** @class */ (function () {\r\n function PushAnswer() {\r\n }\r\n PushAnswer.prototype.Equal = function (content1, content2) {\r\n return content1 == content2;\r\n };\r\n return PushAnswer;\r\n}());\r\n\r\nvar topicStatusMap = new Map();\r\ntopicStatusMap.set(\"ok\", \"搜索成功\").set(\"random\", \"随机答案\").set(\"no_support_random\", \"不支持的随机答案类型\").set(\"no_answer\", \"题库中没有搜索到答案\").set(\"no_match\", \"题库中没有符合的答案\");\r\nvar questionStatusMap = new Map();\r\nquestionStatusMap.set(\"success\", \"搜索成功\").set(\"network\", \"题库网络错误\").set(\"incomplete\", \"题库不全\").set(\"processing\", \"搜索中...\");\r\nfunction TopicStatusString(status) {\r\n return topicStatusMap.get(status) || \"未知错误\";\r\n}\r\nfunction QuestionStatusString(status) {\r\n return questionStatusMap.get(status) || \"未知错误\";\r\n}\r\nfunction SwitchTopicType(title) {\r\n switch (title) {\r\n case \"单选题\": {\r\n return 1;\r\n }\r\n case \"多选题\": {\r\n return 2;\r\n }\r\n case \"判断题\": {\r\n return 3;\r\n }\r\n case \"填空题\": {\r\n return 4;\r\n }\r\n default: {\r\n return null;\r\n }\r\n }\r\n}\r\n// 小工具题库\r\nvar ToolsQuestionBank = /** @class */ (function () {\r\n function ToolsQuestionBank(platform, info) {\r\n this.platform = platform;\r\n this.info = info;\r\n }\r\n ToolsQuestionBank.prototype.SetInfo = function (info) {\r\n this.info = info;\r\n };\r\n ToolsQuestionBank.prototype.GetInfo = function () {\r\n return encodeURIComponent(JSON.stringify(this.info));\r\n };\r\n ToolsQuestionBank.prototype.Answer = function (topic, resolve) {\r\n var _this = this;\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(\"答案查询\", topic);\r\n var num = 10;\r\n var answer = new Array();\r\n var retStatus = \"success\";\r\n var next = function (index) {\r\n var body = \"info=\" + _this.GetInfo() + \"&\";\r\n var t = index;\r\n for (; t < index + num && t < topic.length; t++) {\r\n var val = topic[t];\r\n body += \"topic[\" + (t - index) + \"]=\" + encodeURIComponent((val.topic)) + \"&type[\" + (t - index) + \"]=\" + val.type + \"&\";\r\n }\r\n _utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"HttpUtils\"].HttpPost(_App_config__WEBPACK_IMPORTED_MODULE_1__[\"SystemConfig\"].url + \"v2/answer?platform=\" + _this.platform, body, {\r\n json: true,\r\n success: function (result) {\r\n var status = \"success\";\r\n var tmpResult = new Array();\r\n for (var i = 0; i < result.length; i++) {\r\n if (result[i].result == undefined || result[i].result.length <= 0) {\r\n tmpResult.push({\r\n index: index + result[i].index,\r\n topic: result[i].topic,\r\n type: -1,\r\n status: \"no_answer\",\r\n answers: null,\r\n correct: null,\r\n Equal: _this.Equal,\r\n });\r\n status = \"incomplete\";\r\n continue;\r\n }\r\n var val = result[i].result[0];\r\n tmpResult.push({\r\n index: index + result[i].index,\r\n topic: val.topic,\r\n type: val.type,\r\n correct: val.correct,\r\n status: \"ok\",\r\n Equal: _this.Equal,\r\n });\r\n }\r\n answer = answer.concat(tmpResult);\r\n if (status != \"success\") {\r\n retStatus = status;\r\n }\r\n resolve({ status: \"processing\", answer: tmpResult });\r\n if (t < topic.length) {\r\n next(t);\r\n }\r\n else {\r\n return resolve({ status: retStatus, answer: answer });\r\n }\r\n },\r\n error: function () {\r\n return resolve({ status: \"network\", answer: answer });\r\n }\r\n });\r\n };\r\n next(0);\r\n };\r\n ToolsQuestionBank.prototype.Push = function (answer) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(\"采集提交\", answer);\r\n _utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"HttpUtils\"].HttpPost(_App_config__WEBPACK_IMPORTED_MODULE_1__[\"SystemConfig\"].url + \"answer?platform=\" + _this.platform, \"info=\" + _this.GetInfo() + \"&data=\" + encodeURIComponent(JSON.stringify(answer)), {\r\n json: true,\r\n success: function (result) {\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Info(\"答案自动记录成功,成功获得\" + result.add_token_num + \"个打码数,剩余数量:\" + result.token_num);\r\n resolve(\"success\");\r\n },\r\n error: function () {\r\n resolve(\"network\");\r\n }\r\n });\r\n });\r\n };\r\n ToolsQuestionBank.prototype.Equal = function (content1, content2) {\r\n return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"removeHTML\"])(content1) == Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"removeHTML\"])(content2);\r\n };\r\n ToolsQuestionBank.prototype.CheckCourse = function (info) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n info = info || [_this.info];\r\n _utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"HttpUtils\"].HttpPost(_App_config__WEBPACK_IMPORTED_MODULE_1__[\"SystemConfig\"].url + \"v2/check?platform=\" + _this.platform, \"info=\" + encodeURIComponent(JSON.stringify(info)), {\r\n success: function () {\r\n //TODO:课程题目数量\r\n resolve(0);\r\n }, error: function () {\r\n resolve(-1);\r\n }\r\n });\r\n resolve();\r\n });\r\n };\r\n return ToolsQuestionBank;\r\n}());\r\n\r\nvar ToolsQuestionBankFacade = /** @class */ (function () {\r\n function ToolsQuestionBankFacade(platform, info) {\r\n if (typeof platform == \"string\") {\r\n this.bank = new ToolsQuestionBank(platform, info);\r\n }\r\n else {\r\n this.bank = platform;\r\n }\r\n this.question = new Array();\r\n }\r\n ToolsQuestionBankFacade.prototype.ClearQuestion = function () {\r\n this.question = new Array();\r\n };\r\n ToolsQuestionBankFacade.prototype.AddQuestion = function (q) {\r\n this.question.push(q);\r\n };\r\n ToolsQuestionBankFacade.prototype.Answer = function (callback) {\r\n var _this = this;\r\n var topic = new Array();\r\n this.question.forEach(function (val) {\r\n var type = val.GetType();\r\n if (type == -1) {\r\n return;\r\n }\r\n topic.push({\r\n topic: (val.GetTopic()),\r\n type: type,\r\n });\r\n });\r\n var status = \"success\";\r\n this.bank.Answer(topic, function (ret) {\r\n if (ret.status != \"processing\") {\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(\"题库返回\", ret);\r\n if (ret.status != \"success\" || status == \"success\") {\r\n return callback(ret.status);\r\n }\r\n return callback(status);\r\n }\r\n for (var i = 0; i < ret.answer.length; i++) {\r\n var answer = ret.answer[i];\r\n var question = _this.question[answer.index];\r\n var tmpStatus = answer.status;\r\n if (answer.status == \"no_answer\") {\r\n status = _this.randAnswer(status, tmpStatus, question);\r\n continue;\r\n }\r\n if (answer.type != question.GetType()) {\r\n tmpStatus = \"no_match\";\r\n }\r\n else {\r\n tmpStatus = question.Fill(answer);\r\n }\r\n if (tmpStatus == \"no_match\") {\r\n status = _this.randAnswer(status, tmpStatus, question);\r\n continue;\r\n }\r\n question.SetStatus(tmpStatus);\r\n }\r\n });\r\n };\r\n ToolsQuestionBankFacade.prototype.randAnswer = function (status, tmpStatus, question) {\r\n if (_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.config.rand_answer) {\r\n tmpStatus = question.Random();\r\n }\r\n else {\r\n status = \"incomplete\";\r\n }\r\n if (tmpStatus == \"no_support_random\") {\r\n status = \"incomplete\";\r\n }\r\n question.SetStatus(tmpStatus);\r\n return status;\r\n };\r\n ToolsQuestionBankFacade.prototype.Push = function (callback) {\r\n var answer = new Array();\r\n this.question.forEach(function (val) {\r\n var correct = val.Correct();\r\n if (correct == null || correct.correct == null || correct.type == -1) {\r\n return;\r\n }\r\n correct.topic = correct.topic;\r\n correct.answers = correct.answers;\r\n correct.correct = correct.correct;\r\n answer.push(correct);\r\n });\r\n this.bank.Push(answer).then(function (ret) {\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(\"题库返回\", ret);\r\n return callback(ret);\r\n });\r\n };\r\n ToolsQuestionBankFacade.prototype.dealOption = function (options) {\r\n for (var i = 0; i < options.length; i++) {\r\n if (typeof options[i].content == \"string\") {\r\n options[i].content = (options[i].content);\r\n }\r\n }\r\n return options;\r\n };\r\n ToolsQuestionBankFacade.prototype.CheckCourse = function () {\r\n return this.bank.CheckCourse();\r\n };\r\n return ToolsQuestionBankFacade;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/internal/app/question.ts?");
/***/ }),
/***/ "./src/internal/app/topic.ts":
/*!***********************************!*\
!*** ./src/internal/app/topic.ts ***!
\***********************************/
/*! exports provided: Topic */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Topic\", function() { return Topic; });\n/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/config */ \"./src/config.ts\");\n\r\n\r\nvar Topic = /** @class */ (function () {\r\n function Topic(content, answer) {\r\n this.answer = answer;\r\n this.context = content;\r\n }\r\n Topic.prototype.SetQueryQuestions = function (queryQuestions) {\r\n this.queryQuestions = queryQuestions;\r\n };\r\n Topic.prototype.addQuestion = function () {\r\n var _this = this;\r\n var questions = this.queryQuestions.QueryQuestions();\r\n this.answer.ClearQuestion();\r\n questions.forEach(function (val) {\r\n _this.answer.AddQuestion(val);\r\n });\r\n };\r\n Topic.prototype.QueryAnswer = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n if (_this.lock) {\r\n return resolve(\"processing\");\r\n }\r\n _this.lock = true;\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(\"题目搜索中...\");\r\n _this.addQuestion();\r\n _this.answer.Answer(function (status) {\r\n _this.lock = false;\r\n resolve(status);\r\n if (status == \"network\") {\r\n return _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Error(\"题库无法访问,请查看:\" + _App_config__WEBPACK_IMPORTED_MODULE_1__[\"SystemConfig\"].url);\r\n }\r\n else if (status == \"incomplete\") {\r\n return _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Warn(\"题库答案不全,请手动填写操作\");\r\n }\r\n });\r\n });\r\n };\r\n Topic.prototype.CollectAnswer = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Debug(\"收集题目答案\", _this.context);\r\n _this.addQuestion();\r\n _this.answer.Push(function (status) {\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Debug(\"采集答案返回\", status);\r\n resolve();\r\n });\r\n });\r\n };\r\n return Topic;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/internal/app/topic.ts?");
/***/ }),
/***/ "./src/internal/app/vcode.ts":
/*!***********************************!*\
!*** ./src/internal/app/vcode.ts ***!
\***********************************/
/*! exports provided: VCode */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VCode\", function() { return VCode; });\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/config */ \"./src/config.ts\");\n/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../application */ \"./src/internal/application.ts\");\n\r\n\r\n\r\nvar VCode = /** @class */ (function () {\r\n function VCode(mooc, listen) {\r\n this.mooc = mooc;\r\n this.listen = listen;\r\n }\r\n VCode.prototype.Start = function () {\r\n var _this = this;\r\n this.mooc && this.mooc.Start();\r\n this.listen.Listen(function (fill) {\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Info(\"准备进行打码\");\r\n _this.getVcode(fill);\r\n });\r\n };\r\n VCode.prototype.getVcode = function (fill) {\r\n var img = fill.GetImage();\r\n var base64 = \"\";\r\n if (typeof img == \"string\") {\r\n base64 = img;\r\n }\r\n else {\r\n base64 = Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"getImageBase64\"])(img, 'jpeg');\r\n }\r\n _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"HttpUtils\"].HttpPost(_App_config__WEBPACK_IMPORTED_MODULE_1__[\"SystemConfig\"].url + 'vcode', 'img=' + encodeURIComponent(base64.substr('data:image/jpeg;base64,'.length)), {\r\n json: false,\r\n success: function (ret) {\r\n var json = JSON.parse(ret);\r\n _application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(json);\r\n if (json.code == -2) {\r\n fill.Fill(\"error\", json.msg, \"\");\r\n }\r\n else if (json.code == -1) {\r\n fill.Fill(\"error\", \"打码服务器发生错误\", \"\");\r\n }\r\n else if (json.msg) {\r\n fill.Fill(\"ok\", \"打码成功\", json.msg);\r\n }\r\n else {\r\n fill.Fill(\"error\", \"未知错误\", \"\");\r\n }\r\n }, error: function () {\r\n fill.Fill(\"network\", \"网络请求失败\", \"\");\r\n }\r\n });\r\n };\r\n return VCode;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/internal/app/vcode.ts?");
/***/ }),
/***/ "./src/internal/application.ts":
/*!*************************************!*\
!*** ./src/internal/application.ts ***!
\*************************************/
/*! exports provided: Backend, Frontend, Content, AppName, Application */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Backend\", function() { return Backend; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Frontend\", function() { return Frontend; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Content\", function() { return Content; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AppName\", function() { return AppName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Application\", function() { return Application; });\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/message */ \"./src/internal/utils/message.ts\");\n/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/config */ \"./src/config.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\n\r\nvar Backend = \"backend\";\r\nvar Frontend = \"frontend\";\r\nvar Content = \"content\";\r\nvar AppName = \"cxmooc-tools\";\r\nvar Application = /** @class */ (function () {\r\n function Application(runEnv, launcher, component) {\r\n Application.app = this;\r\n Application.runEnv = runEnv;\r\n this.runEnvSwitch(runEnv);\r\n this.launcher = launcher;\r\n this.component = component;\r\n }\r\n Object.defineProperty(Application, \"App\", {\r\n get: function () {\r\n return Application.app;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Application.prototype, \"debug\", {\r\n get: function () {\r\n return \"development\" == \"development\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Application.prototype, \"prod\", {\r\n get: function () {\r\n return \"development\" == \"production\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Application.prototype, \"config\", {\r\n get: function () {\r\n return this.component.get(\"config\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Application.prototype, \"log\", {\r\n get: function () {\r\n return this.component.get(\"logger\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Application.prototype.run = function () {\r\n this.launcher.start();\r\n };\r\n Object.defineProperty(Application.prototype, \"IsFrontend\", {\r\n get: function () {\r\n return Application.IsFrontend;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Application.prototype, \"IsBackend\", {\r\n get: function () {\r\n return Application.IsBackend;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Application.prototype, \"IsContent\", {\r\n get: function () {\r\n return Application.IsContent;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Application.prototype.runEnvSwitch = function (env) {\r\n switch (env) {\r\n case Frontend:\r\n Application.IsFrontend = true;\r\n break;\r\n case Backend:\r\n Application.IsBackend = true;\r\n break;\r\n case Content:\r\n Application.IsContent = true;\r\n break;\r\n }\r\n ;\r\n };\r\n Object.defineProperty(Application.prototype, \"Client\", {\r\n get: function () {\r\n if (Application.IsFrontend) {\r\n return Object(_utils_message__WEBPACK_IMPORTED_MODULE_0__[\"NewChromeClientMessage\"])(AppName);\r\n }\r\n return Object(_utils_message__WEBPACK_IMPORTED_MODULE_0__[\"NewExtensionClientMessage\"])(AppName);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Application.CheckUpdate = function (callback) {\r\n if (Application.IsContent) {\r\n chrome.storage.local.get([\"version\", \"enforce\", \"hotversion\", \"url\"], function (item) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, callback((_App_config__WEBPACK_IMPORTED_MODULE_2__[\"SystemConfig\"].version < item.version), item)];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n });\r\n return;\r\n }\r\n _utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"HttpUtils\"].HttpGet(_App_config__WEBPACK_IMPORTED_MODULE_2__[\"SystemConfig\"].url + \"update?ver=\" + _App_config__WEBPACK_IMPORTED_MODULE_2__[\"SystemConfig\"].version, {\r\n json: true,\r\n success: function (json) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var data;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n data = {\r\n version: json.version,\r\n url: json.url,\r\n enforce: json.enforce,\r\n hotversion: json.hotversion,\r\n injection: json.injection,\r\n };\r\n chrome.storage.local.set(data);\r\n return [4 /*yield*/, callback((_App_config__WEBPACK_IMPORTED_MODULE_2__[\"SystemConfig\"].version < data.version), data)];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n }, error: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, callback(false, undefined)];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n }\r\n });\r\n };\r\n return Application;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/internal/application.ts?");
/***/ }),
/***/ "./src/internal/utils/config.ts":
/*!**************************************!*\
!*** ./src/internal/utils/config.ts ***!
\**************************************/
/*! exports provided: ChromeConfigItems, NewBackendConfig, NewFrontendGetConfig */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ChromeConfigItems\", function() { return ChromeConfigItems; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NewBackendConfig\", function() { return NewBackendConfig; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NewFrontendGetConfig\", function() { return NewFrontendGetConfig; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../application */ \"./src/internal/application.ts\");\n\r\n\r\nvar ChromeConfigItems = /** @class */ (function () {\r\n function ChromeConfigItems(getConfig) {\r\n this.getConfig = getConfig;\r\n }\r\n ChromeConfigItems.prototype.GetConfig = function (key) {\r\n return this.getConfig.GetConfig(key);\r\n };\r\n ChromeConfigItems.prototype.Watch = function (key, callback) {\r\n this.getConfig.Watch(key, callback);\r\n };\r\n ChromeConfigItems.prototype.bool = function (val) {\r\n if (typeof val == \"boolean\") {\r\n return val;\r\n }\r\n return val == \"true\";\r\n };\r\n Object.defineProperty(ChromeConfigItems.prototype, \"super_mode\", {\r\n get: function () {\r\n return this.bool(this.getConfig.GetConfig(\"super_mode\"));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"vtoken\", {\r\n get: function () {\r\n return this.getConfig.GetConfig(\"vtoken\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"rand_answer\", {\r\n get: function () {\r\n return this.bool(this.getConfig.GetConfig(\"rand_answer\"));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"auto\", {\r\n get: function () {\r\n return this.bool(this.getConfig.GetConfig(\"auto\"));\r\n },\r\n set: function (val) {\r\n localStorage[\"auto\"] = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"video_mute\", {\r\n get: function () {\r\n return this.bool(this.getConfig.GetConfig(\"video_mute\"));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"answer_ignore\", {\r\n get: function () {\r\n return this.bool(this.getConfig.GetConfig(\"answer_ignore\"));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"video_cdn\", {\r\n get: function () {\r\n return this.getConfig.GetConfig(\"video_cdn\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"video_multiple\", {\r\n get: function () {\r\n return this.getConfig.GetConfig(\"video_multiple\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ChromeConfigItems.prototype, \"interval\", {\r\n get: function () {\r\n var interval = (this.getConfig.GetConfig(\"interval\") || 0.1) * 100;\r\n return Math.floor(Object(_utils__WEBPACK_IMPORTED_MODULE_0__[\"randNumber\"])(interval - interval / 2, interval + interval / 2)) / 100;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ChromeConfigItems;\r\n}());\r\n\r\n// 后台环境中使用\r\nfunction NewBackendConfig() {\r\n return new backendConfig();\r\n}\r\nvar backendConfig = /** @class */ (function () {\r\n function backendConfig() {\r\n }\r\n backendConfig.prototype.GetConfig = function (key) {\r\n return new Promise(function (resolve) { return (chrome.storage.sync.get(key, function (value) {\r\n if (value.hasOwnProperty(key)) {\r\n resolve(value[key]);\r\n }\r\n else {\r\n resolve(undefined);\r\n }\r\n })); });\r\n };\r\n backendConfig.prototype.Watch = function (key, callback) {\r\n throw new Error(\"Method not implemented.\");\r\n };\r\n backendConfig.prototype.SetConfig = function (key, val) {\r\n return new Promise(function (resolve) {\r\n var info = {};\r\n info[key] = val;\r\n chrome.storage.sync.set(info, function () {\r\n chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {\r\n chrome.tabs.sendMessage(tabs[0].id, { type: \"cxconfig\", key: key, value: val });\r\n });\r\n resolve();\r\n });\r\n });\r\n };\r\n return backendConfig;\r\n}());\r\n// 前端环境使用\r\nfunction NewFrontendGetConfig() {\r\n return new frontendGetConfig();\r\n}\r\nvar frontendGetConfig = /** @class */ (function () {\r\n function frontendGetConfig() {\r\n window.addEventListener('message', function (event) {\r\n if (event.data.type && event.data.type == \"cxconfig\") {\r\n _application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].App.log.Info(\"配置更新:\" + event.data.key + \"=\" + event.data.value);\r\n localStorage[event.data.key] = event.data.value;\r\n }\r\n });\r\n }\r\n frontendGetConfig.prototype.GetConfig = function (key) {\r\n return localStorage[key];\r\n };\r\n frontendGetConfig.prototype.Watch = function (key, callback) {\r\n var _this = this;\r\n if (typeof key == \"string\") {\r\n this.setWatchMap(key, callback);\r\n return;\r\n }\r\n key.forEach(function (val, index) {\r\n _this.setWatchMap(val, callback);\r\n });\r\n };\r\n frontendGetConfig.prototype.setWatchMap = function (key, callback) {\r\n //TODO: 监控配置项更新\r\n };\r\n return frontendGetConfig;\r\n}());\r\n\n\n//# sourceURL=webpack:///./src/internal/utils/config.ts?");
/***/ }),
/***/ "./src/internal/utils/hook.ts":
/*!************************************!*\
!*** ./src/internal/utils/hook.ts ***!
\************************************/
/*! exports provided: Hook */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Hook\", function() { return Hook; });\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n\r\nvar Hook = /** @class */ (function () {\r\n function Hook(func, context) {\r\n this.context = context || window;\r\n this.func = func;\r\n }\r\n Hook.prototype.Middleware = function (call) {\r\n var name;\r\n if (typeof this.func == \"string\") {\r\n name = this.func;\r\n }\r\n else {\r\n name = this.func.name;\r\n }\r\n var old = this.context[name];\r\n this.context[name] = function () {\r\n var args = [old];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i + 1] = arguments[_i];\r\n }\r\n return call.apply(this, args);\r\n };\r\n };\r\n Hook.HookAjaxRespond = function (url, call) {\r\n var _this = this;\r\n if (!this.once) {\r\n this.match_list = new Map();\r\n var self_1 = this;\r\n var hookXMLHttpRequest = new Hook(\"open\", _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].GlobalContext.XMLHttpRequest.prototype);\r\n hookXMLHttpRequest.Middleware(function (next) {\r\n var _this = this;\r\n var args = [];\r\n for (var _a = 1; _a < arguments.length; _a++) {\r\n args[_a - 1] = arguments[_a];\r\n }\r\n self_1.match_list.forEach(function (val, key) {\r\n if (args[1].indexOf(key) != -1) {\r\n Object.defineProperty(_this, \"responseText\", {\r\n configurable: true,\r\n get: function () {\r\n return val.call(this, args[1], this.response);\r\n }\r\n });\r\n }\r\n });\r\n return next.apply(this, args);\r\n });\r\n this.once = true;\r\n }\r\n if (typeof url == \"string\") {\r\n this.match_list.set(url, call);\r\n }\r\n else {\r\n url.forEach(function (v) {\r\n _this.match_list.set(v, call);\r\n });\r\n }\r\n };\r\n return Hook;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/internal/utils/hook.ts?");
/***/ }),
/***/ "./src/internal/utils/log.ts":
/*!***********************************!*\
!*** ./src/internal/utils/log.ts ***!
\***********************************/
/*! exports provided: ConsoleLog, PageLog, EmptyLog */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConsoleLog\", function() { return ConsoleLog; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PageLog\", function() { return PageLog; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EmptyLog\", function() { return EmptyLog; });\n/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../application */ \"./src/internal/application.ts\");\n/* harmony import */ var _views_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../views/common */ \"./src/views/common.ts\");\n/* harmony import */ var _views_common__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_views_common__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\nvar __spreadArrays = (undefined && undefined.__spreadArrays) || function () {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\n\r\n\r\nvar ConsoleLog = /** @class */ (function () {\r\n function ConsoleLog() {\r\n }\r\n ConsoleLog.prototype.getNowTime = function () {\r\n var time = new Date();\r\n return time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds();\r\n };\r\n ConsoleLog.prototype.Debug = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.debug && console.info.apply(console, __spreadArrays([\"[debug\", this.getNowTime(), \"]\"], args));\r\n return this;\r\n };\r\n ConsoleLog.prototype.Info = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.debug && console.info.apply(console, __spreadArrays([\"[info\", this.getNowTime(), \"]\"], args));\r\n return this;\r\n };\r\n ConsoleLog.prototype.Warn = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n console.warn.apply(console, __spreadArrays([\"[warn\", this.getNowTime(), \"]\"], args));\r\n return this;\r\n };\r\n ConsoleLog.prototype.Error = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n console.error.apply(console, __spreadArrays([\"[error\", this.getNowTime(), \"]\"], args));\r\n return this;\r\n };\r\n ConsoleLog.prototype.Fatal = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n console.error.apply(console, __spreadArrays([\"[fatal\", this.getNowTime(), \"]\"], args));\r\n return this;\r\n };\r\n return ConsoleLog;\r\n}());\r\n\r\nvar PageLog = /** @class */ (function () {\r\n function PageLog() {\r\n var _this = this;\r\n this.el = undefined;\r\n window.addEventListener(\"load\", function () {\r\n _this.div = document.createElement(\"div\");\r\n // 主要布局\r\n _this.div.innerHTML = \"\\n \\n \\u5C0F\\u5DE5\\u5177\\u901A\\u77E5\\u6761 \\n \\n x\\n \\n \\n \\n \\n \";\r\n _this.div.className = \"tools-logger-panel\";\r\n document.body.appendChild(_this.div);\r\n _this.el = _this.div.querySelector(\".tools-notice-content\");\r\n _this.div.querySelector(\".close\").onclick = function () {\r\n _this.el = undefined;\r\n _this.div.remove();\r\n };\r\n var checkbox = _this.div.querySelector(\"#checkbox\");\r\n localStorage[\"is_notify\"] = localStorage[\"is_notify\"] || \"true\";\r\n checkbox.checked = localStorage[\"is_notify\"] == \"true\";\r\n if (!checkbox.checked) {\r\n checkbox.removeAttribute(\"checked\");\r\n }\r\n checkbox.addEventListener(\"change\", function () {\r\n localStorage[\"is_notify\"] = this.checked;\r\n });\r\n setTimeout(function () {\r\n _this.Info(\"233\");\r\n }, 1000);\r\n });\r\n }\r\n PageLog.prototype.getNowTime = function () {\r\n var time = new Date();\r\n return time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds();\r\n };\r\n PageLog.prototype.first = function (text, color, background) {\r\n var new_log = document.createElement(\"div\");\r\n new_log.innerHTML = \"\\n \\n \" + text + \"
\\n \\n \";\r\n //插入第一个元素前\r\n var first = document.getElementsByClassName(\"tools-notice-content\")[0].getElementsByTagName(\"div\");\r\n document.querySelector(\".tools-notice-content\").insertBefore(new_log, first[0]);\r\n };\r\n PageLog.prototype.toStr = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var text = \"\";\r\n for (var i = 0; i < args.length; i++) {\r\n if (typeof args[i] == \"object\") {\r\n text += JSON.stringify(args[i]) + \"\\n\";\r\n }\r\n else {\r\n text += args[i] + \"\\n\";\r\n }\r\n }\r\n return text.substring(0, text.length - 1);\r\n };\r\n PageLog.prototype.Debug = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n console.info.apply(console, __spreadArrays([\"[debug\", this.getNowTime(), \"]\"], args));\r\n return this;\r\n };\r\n PageLog.prototype.Info = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var text = this.toStr.apply(this, args);\r\n // 判断选中状态是否发送桌面通知\r\n if (this.el) {\r\n this.first(text, \"#409EFF\", \"rgba(121, 187, 255, 0.2)\");\r\n }\r\n else {\r\n console.info.apply(console, __spreadArrays([\"[info\", this.getNowTime(), \"]\"], args));\r\n }\r\n return this;\r\n };\r\n PageLog.prototype.Warn = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var text = this.toStr.apply(this, args);\r\n if (this.el) {\r\n this.first(text, \"#5C3C00\", \"rgba(250, 236, 216, 0.4)\");\r\n }\r\n else {\r\n console.warn.apply(console, __spreadArrays([\"[warn\", this.getNowTime(), \"]\"], args));\r\n }\r\n if (document.hidden && localStorage[\"is_notify\"] == \"true\") {\r\n Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_2__[\"Noifications\"])({\r\n title: \"超星慕课小工具\",\r\n text: text + \"\\n3秒后自动关闭\",\r\n timeout: 3000,\r\n });\r\n }\r\n return this;\r\n };\r\n PageLog.prototype.Error = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var text = this.toStr.apply(this, args);\r\n if (this.el) {\r\n this.first(text, \"#ff7879\", \"rgba(253, 226, 226, 0.5)\");\r\n }\r\n else {\r\n console.error.apply(console, __spreadArrays([\"[error\", this.getNowTime(), \"]\"], args));\r\n }\r\n if (localStorage[\"is_notify\"] == \"true\") {\r\n Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_2__[\"Noifications\"])({\r\n title: \"超星慕课小工具\",\r\n text: text,\r\n });\r\n }\r\n return this;\r\n };\r\n PageLog.prototype.Fatal = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var text = this.toStr.apply(this, args);\r\n if (this.el) {\r\n this.first(text, \"#ff0000\", \"rgba(253,162,169,0.5)\");\r\n }\r\n else {\r\n console.error.apply(console, __spreadArrays([\"[fatal\", this.getNowTime(), \"]\"], args));\r\n }\r\n Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_2__[\"Noifications\"])({\r\n title: \"超星慕课小工具\",\r\n text: text,\r\n });\r\n return this;\r\n };\r\n return PageLog;\r\n}());\r\n\r\nvar EmptyLog = /** @class */ (function () {\r\n function EmptyLog() {\r\n }\r\n EmptyLog.prototype.Debug = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this;\r\n };\r\n EmptyLog.prototype.Info = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this;\r\n };\r\n EmptyLog.prototype.Warn = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this;\r\n };\r\n EmptyLog.prototype.Error = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this;\r\n };\r\n EmptyLog.prototype.Fatal = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this;\r\n };\r\n return EmptyLog;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/internal/utils/log.ts?");
/***/ }),
/***/ "./src/internal/utils/message.ts":
/*!***************************************!*\
!*** ./src/internal/utils/message.ts ***!
\***************************************/
/*! exports provided: NewExtensionServerMessage, NewExtensionClientMessage, NewChromeServerMessage, NewChromeClientMessage */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NewExtensionServerMessage\", function() { return NewExtensionServerMessage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NewExtensionClientMessage\", function() { return NewExtensionClientMessage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NewChromeServerMessage\", function() { return NewChromeServerMessage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NewChromeClientMessage\", function() { return NewChromeClientMessage; });\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nfunction NewExtensionServerMessage(port) {\r\n return new extensionServerMessage(port);\r\n}\r\nvar extensionServerMessage = /** @class */ (function () {\r\n function extensionServerMessage(port) {\r\n this.port = port;\r\n this.recv();\r\n }\r\n extensionServerMessage.prototype.recv = function () {\r\n var _this = this;\r\n //监听消息\r\n chrome.runtime.onConnect.addListener(function (port) {\r\n if (port.name != _this.port) {\r\n return;\r\n }\r\n port.onMessage.addListener(function (request) {\r\n _this.acceptCallback(new extensionClientMessage(port), request);\r\n });\r\n });\r\n };\r\n extensionServerMessage.prototype.Accept = function (callback) {\r\n this.acceptCallback = callback;\r\n };\r\n return extensionServerMessage;\r\n}());\r\nvar msg = /** @class */ (function () {\r\n function msg(tag) {\r\n this.tag = tag;\r\n }\r\n msg.prototype.Recv = function (callback) {\r\n this.recvCallback = callback;\r\n };\r\n return msg;\r\n}());\r\n// 扩展中使用\r\nfunction NewExtensionClientMessage(tag) {\r\n return new extensionClientMessage(tag);\r\n}\r\nvar extensionClientMessage = /** @class */ (function (_super) {\r\n __extends(extensionClientMessage, _super);\r\n function extensionClientMessage(param) {\r\n var _this = this;\r\n if (typeof param === 'string') {\r\n _this = _super.call(this, param) || this;\r\n _this.connect();\r\n }\r\n else {\r\n _this.conn = param;\r\n }\r\n _this.recv();\r\n return _this;\r\n }\r\n extensionClientMessage.prototype.connect = function () {\r\n this.conn = chrome.runtime.connect({ name: this.tag });\r\n };\r\n extensionClientMessage.prototype.recv = function () {\r\n var _this = this;\r\n this.conn.onMessage.addListener(function (response) {\r\n _this.recvCallback(response);\r\n });\r\n };\r\n extensionClientMessage.prototype.Send = function (msg) {\r\n this.conn.postMessage(msg);\r\n };\r\n return extensionClientMessage;\r\n}(msg));\r\n// 浏览器中使用\r\nfunction NewChromeServerMessage(tag) {\r\n return new chromeServerMessage(tag);\r\n}\r\nvar chromeServerMessage = /** @class */ (function () {\r\n function chromeServerMessage(tag) {\r\n this.tag = tag;\r\n this.recv();\r\n }\r\n chromeServerMessage.prototype.recv = function () {\r\n var _this = this;\r\n window.addEventListener('message', function (event) {\r\n if (event.data.tag == _this.tag && event.data.conn_tag && event.data.source == \"client\") {\r\n _this.acceptCallback(new chromeClientMessage(_this.tag, event.data.conn_tag), event.data.msg);\r\n }\r\n });\r\n };\r\n chromeServerMessage.prototype.Accept = function (callback) {\r\n this.acceptCallback = callback;\r\n };\r\n return chromeServerMessage;\r\n}());\r\nfunction NewChromeClientMessage(tag) {\r\n return new chromeClientMessage(tag);\r\n}\r\nvar chromeClientMessage = /** @class */ (function (_super) {\r\n __extends(chromeClientMessage, _super);\r\n function chromeClientMessage(tag, conn) {\r\n var _this = this;\r\n if (conn !== undefined) {\r\n _this = _super.call(this, tag) || this;\r\n _this.connTag = conn;\r\n _this.source = \"server\";\r\n }\r\n else {\r\n _this = _super.call(this, tag) || this;\r\n _this.connect();\r\n _this.source = \"client\";\r\n }\r\n return _this;\r\n }\r\n chromeClientMessage.prototype.connect = function () {\r\n var _this = this;\r\n this.connTag = Math.random();\r\n window.addEventListener('message', function (event) {\r\n if (event.data.tag == _this.tag && event.data.conn_tag == _this.connTag && event.data.source == \"server\") {\r\n _this.recvCallback && _this.recvCallback(event.data.msg);\r\n }\r\n });\r\n };\r\n chromeClientMessage.prototype.Send = function (msg) {\r\n window.postMessage({ tag: this.tag, conn_tag: this.connTag, msg: msg, source: this.source }, '*');\r\n };\r\n return chromeClientMessage;\r\n}(msg));\r\n\n\n//# sourceURL=webpack:///./src/internal/utils/message.ts?");
/***/ }),
/***/ "./src/internal/utils/utils.ts":
/*!*************************************!*\
!*** ./src/internal/utils/utils.ts ***!
\*************************************/
/*! exports provided: HttpUtils, Injected, InjectedBySrc, syncGetChromeStorageLocal, syncSetChromeStorageLocal, RemoveInjected, randNumber, createBtn, get, post, removeHTMLTag, removeHTML, substrex, dealHotVersion, protocolPrompt, getImageBase64, isPhone, Noifications */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HttpUtils\", function() { return HttpUtils; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Injected\", function() { return Injected; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InjectedBySrc\", function() { return InjectedBySrc; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"syncGetChromeStorageLocal\", function() { return syncGetChromeStorageLocal; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"syncSetChromeStorageLocal\", function() { return syncSetChromeStorageLocal; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RemoveInjected\", function() { return RemoveInjected; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"randNumber\", function() { return randNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createBtn\", function() { return createBtn; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"get\", function() { return get; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"post\", function() { return post; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"removeHTMLTag\", function() { return removeHTMLTag; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"removeHTML\", function() { return removeHTML; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"substrex\", function() { return substrex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"dealHotVersion\", function() { return dealHotVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"protocolPrompt\", function() { return protocolPrompt; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getImageBase64\", function() { return getImageBase64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPhone\", function() { return isPhone; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Noifications\", function() { return Noifications; });\n/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/config */ \"./src/config.ts\");\n\r\n\r\nvar HttpUtils = /** @class */ (function () {\r\n function HttpUtils() {\r\n }\r\n HttpUtils.Request = function (info) {\r\n if (_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.IsBackend) {\r\n fetch(info.url, info).then(function (body) {\r\n if (info.json) {\r\n return body.json();\r\n }\r\n else {\r\n return body.text();\r\n }\r\n }).then(function (body) {\r\n info.success && info.success(body);\r\n }).catch(function () {\r\n info.error && info.error();\r\n });\r\n return;\r\n }\r\n HttpUtils.crossDomainRequest(info);\r\n };\r\n HttpUtils.errorCode = function (ret) {\r\n if (!ret.code) {\r\n return false;\r\n }\r\n switch (ret.code) {\r\n case -1: {\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(ret.msg);\r\n break;\r\n }\r\n case -2: {\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Warn(ret.msg);\r\n break;\r\n }\r\n default: {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n HttpUtils.crossDomainRequest = function (info) {\r\n if (window.hasOwnProperty('GM_xmlhttpRequest')) {\r\n //兼容油猴\r\n info.data = info.body;\r\n info.onreadystatechange = function (response) {\r\n if (response.readyState == 4) {\r\n if (response.status == 200) {\r\n if (info.json) {\r\n var ret = JSON.parse(response.responseText);\r\n if (HttpUtils.errorCode(ret)) {\r\n info.error && info.error();\r\n return;\r\n }\r\n info.success && info.success(ret);\r\n }\r\n else {\r\n info.success && info.success(response.responseText);\r\n }\r\n }\r\n else {\r\n info.error && info.error();\r\n }\r\n }\r\n };\r\n window.GM_xmlhttpRequest(info);\r\n }\r\n else {\r\n var client = _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.Client;\r\n client.Recv(function (data) {\r\n if (data.code == 0) {\r\n if (info.json) {\r\n if (HttpUtils.errorCode(data.body)) {\r\n info.error && info.error();\r\n return;\r\n }\r\n }\r\n info.success && info.success(data.body);\r\n }\r\n else {\r\n info.error && info.error();\r\n }\r\n });\r\n client.Send({\r\n type: \"GM_xmlhttpRequest\", info: {\r\n url: info.url,\r\n method: info.method,\r\n json: info.json,\r\n body: info.body,\r\n headers: info.headers,\r\n }\r\n });\r\n }\r\n };\r\n HttpUtils.HttpGet = function (url, info) {\r\n info.url = url;\r\n this.Request(info);\r\n };\r\n HttpUtils.HttpPost = function (url, body, info) {\r\n info.url = url;\r\n info.body = body;\r\n if (!info.headers) {\r\n info.headers = {};\r\n }\r\n info.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\r\n info.headers[\"Authorization\"] = _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.vtoken;\r\n info.headers[\"X-Version\"] = _App_config__WEBPACK_IMPORTED_MODULE_1__[\"SystemConfig\"].version + \"\";\r\n info.method = \"POST\";\r\n this.Request(info);\r\n };\r\n HttpUtils.SendRequest = function (client, data) {\r\n if (!data.info) {\r\n return;\r\n }\r\n var info = data.info;\r\n if (_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.IsBackend) {\r\n info.success = function (body) {\r\n client.Send({ body: body, code: 0 });\r\n };\r\n info.error = function () {\r\n client.Send({ code: -1 });\r\n };\r\n HttpUtils.Request(info);\r\n }\r\n else {\r\n // content 做转发\r\n var extClient = _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.Client;\r\n extClient.Send({ type: \"GM_xmlhttpRequest\", info: info });\r\n extClient.Recv(function (data) {\r\n client.Send(data);\r\n });\r\n }\r\n };\r\n return HttpUtils;\r\n}());\r\n\r\n/**\r\n * 通过源码注入js资源\r\n * @param doc\r\n * @param url\r\n * @constructor\r\n */\r\nfunction Injected(doc, source) {\r\n var temp = doc.createElement('script');\r\n temp.setAttribute('type', 'text/javascript');\r\n temp.innerHTML = source;\r\n temp.className = \"injected-js\";\r\n doc.documentElement.appendChild(temp);\r\n return temp;\r\n}\r\n/**\r\n * 通过源码注入js资源\r\n * @param doc\r\n * @param url\r\n * @constructor\r\n */\r\nfunction InjectedBySrc(doc, source) {\r\n var temp = doc.createElement('script');\r\n temp.setAttribute('type', 'text/javascript');\r\n temp.src = source;\r\n temp.className = \"injected-js\";\r\n doc.documentElement.appendChild(temp);\r\n return temp;\r\n}\r\nfunction syncGetChromeStorageLocal(key) {\r\n return new Promise(function (resolve) { return (chrome.storage.local.get(key, function (value) {\r\n resolve(value[key]);\r\n })); });\r\n}\r\nfunction syncSetChromeStorageLocal(key, value) {\r\n var tmp = {};\r\n tmp[key] = value;\r\n return new Promise(function (resolve) { return (chrome.storage.local.set(tmp, function () {\r\n resolve();\r\n })); });\r\n}\r\n/**\r\n * 移除注入js\r\n * @param doc\r\n */\r\nfunction RemoveInjected(doc) {\r\n var resource = doc.getElementsByClassName(\"injected-js\");\r\n for (var i = 0; i < resource.length; i++) {\r\n resource[i].remove();\r\n }\r\n}\r\nfunction randNumber(minNum, maxNum) {\r\n return Math.floor(Math.random() * (maxNum - minNum + 1) + minNum);\r\n}\r\n/**\r\n * 创建一个按钮\r\n * @param title\r\n * @param description\r\n * @param id\r\n */\r\nfunction createBtn(title, description, className, id) {\r\n if (description === void 0) { description = \"\"; }\r\n if (className === void 0) { className = \"\"; }\r\n if (id === void 0) { id = \"\"; }\r\n var btn = document.createElement('button');\r\n btn.innerText = title;\r\n btn.id = id;\r\n btn.title = description;\r\n btn.className = className;\r\n return btn;\r\n}\r\n/**\r\n * get请求\r\n * @param {*} url\r\n */\r\nfunction get(url, success) {\r\n var xmlhttp = createRequest();\r\n xmlhttp.open(\"GET\", url, true);\r\n xmlhttp.onreadystatechange = function () {\r\n if (this.readyState == 4) {\r\n if (this.status == 200) {\r\n success && success(this.responseText, this.resource);\r\n }\r\n else {\r\n xmlhttp.errorCallback && xmlhttp.errorCallback(this);\r\n }\r\n }\r\n };\r\n xmlhttp.send();\r\n return xmlhttp;\r\n}\r\n/**\r\n * post请求\r\n * @param {*} url\r\n * @param {*} data\r\n * @param {*} json\r\n */\r\nfunction post(url, data, json, success) {\r\n if (json === void 0) { json = true; }\r\n var xmlhttp = createRequest();\r\n xmlhttp.open(\"POST\", url, true);\r\n xmlhttp.setRequestHeader('Authorization', _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.vtoken || '');\r\n if (json) {\r\n xmlhttp.setRequestHeader(\"Content-Type\", \"application/json\");\r\n }\r\n else {\r\n xmlhttp.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\n }\r\n xmlhttp.onreadystatechange = function () {\r\n if (this.readyState == 4) {\r\n if (this.status == 200) {\r\n success && success(this.responseText);\r\n }\r\n else {\r\n xmlhttp.errorCallback && xmlhttp.errorCallback(this);\r\n }\r\n }\r\n };\r\n xmlhttp.send(data);\r\n return xmlhttp;\r\n}\r\n/**\r\n * 创建http请求\r\n */\r\nfunction createRequest() {\r\n var xmlhttp;\r\n if (window.XMLHttpRequest) {\r\n xmlhttp = new XMLHttpRequest();\r\n }\r\n else {\r\n xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n }\r\n xmlhttp.error = function (callback) {\r\n xmlhttp.errorCallback = callback;\r\n return xmlhttp;\r\n };\r\n xmlhttp.withCredentials = true;\r\n return xmlhttp;\r\n}\r\n// 移除html tag\r\nfunction removeHTMLTag(html) {\r\n var revHtml = /<.*?>/g;\r\n html = html.replace(revHtml, '');\r\n html = html.replace(/(^\\s+)|(\\s+$)/g, '');\r\n return html;\r\n}\r\n/**\r\n * 去除html标签和处理中文\r\n * @param {string} html\r\n */\r\nfunction removeHTML(html) {\r\n //先处理带src和href属性的标签\r\n var srcReplace = //g;\r\n html = html.replace(srcReplace, '$1');\r\n srcReplace = /()\\s+?(<\\/iframe>)/g;\r\n html = html.replace(srcReplace, '$1$2');\r\n srcReplace = /<(iframe|a).*?(src|href)=\"(.*?)\".*?>(.*?)<\\/(iframe|a)>/g;\r\n html = html.replace(srcReplace, '$3$4');\r\n var revHtml = /<.*?>/g;\r\n html = html.replace(revHtml, '');\r\n html = html.replace(/(^\\s+)|(\\s+$)/g, '');\r\n html = dealSymbol(html);\r\n //TODO:处理HTML符号\r\n return html.replace(/ /g, ' ').replace(/"/g, \"\\\"\").replace(/&/g, '&').trim();\r\n}\r\n/**\r\n * 处理符号\r\n * @param topic\r\n */\r\nfunction dealSymbol(topic) {\r\n topic = topic.replace(/,/g, ',');\r\n topic = topic.replace(/(/g, '(');\r\n topic = topic.replace(/)/g, ')');\r\n topic = topic.replace(/?/g, '?');\r\n topic = topic.replace(/:/g, ':');\r\n topic = topic.replace(/。/g, '.');\r\n topic = topic.replace(/[“”]/g, '\"');\r\n return topic;\r\n}\r\n/**\r\n * 取中间文本\r\n * @param str\r\n * @param left\r\n * @param right\r\n */\r\nfunction substrex(str, left, right) {\r\n var leftPos = str.indexOf(left) + left.length;\r\n var rightPos = str.indexOf(right, leftPos);\r\n return str.substring(leftPos, rightPos);\r\n}\r\nfunction dealHotVersion(hotversion) {\r\n hotversion = hotversion.substring(0, hotversion.indexOf(\".\") + 1) + hotversion.substring(hotversion.indexOf(\".\") + 1).replace(\".\", \"\");\r\n return Number(hotversion);\r\n}\r\nfunction protocolPrompt(content, key, keyword) {\r\n keyword = keyword || \"yes\";\r\n if (localStorage[key] == undefined || localStorage[key] != 1) {\r\n var msg = prompt(content + \"\\n如果以后不想再弹出本对话框并且同意请在下方填写\\\"\" + keyword + \"\\\"\");\r\n if (msg === null)\r\n return false;\r\n if (keyword != msg) {\r\n return false;\r\n }\r\n localStorage[key] = 1;\r\n }\r\n return true;\r\n}\r\nfunction getImageBase64(img, ext) {\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = img.width;\r\n canvas.height = img.height;\r\n var ctx = canvas.getContext(\"2d\");\r\n ctx.drawImage(img, 0, 0, img.width, img.height);\r\n var dataURL = canvas.toDataURL(\"image/\" + ext, 0.75); //节省可怜的流量>_<,虽然好像没有啥\r\n canvas = null;\r\n return dataURL;\r\n}\r\nfunction isPhone() {\r\n return /Android|iPhone/i.test(navigator.userAgent);\r\n}\r\nfunction Noifications(details) {\r\n if (window.hasOwnProperty(\"GM_notification\")) {\r\n window.GM_notification(details);\r\n }\r\n else {\r\n var client = _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.Client;\r\n client.Send({\r\n type: \"GM_notification\", details: details,\r\n });\r\n _application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.Client.Send(details);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack:///./src/internal/utils/utils.ts?" );
/***/ }),
/***/ "./src/mooc/chaoxing/course.ts":
/*!*************************************!*\
!*** ./src/mooc/chaoxing/course.ts ***!
\*************************************/
/*! exports provided: CxCourse, CxExamTopic, CxHomeWork */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxCourse\", function() { return CxCourse; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxExamTopic\", function() { return CxExamTopic; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxHomeWork\", function() { return CxHomeWork; });\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_mooc_chaoxing_factory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/mooc/chaoxing/factory */ \"./src/mooc/chaoxing/factory.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\n\r\n//课程任务\r\nvar CxCourse = /** @class */ (function () {\r\n function CxCourse() {\r\n }\r\n CxCourse.prototype.Start = function () {\r\n var _this = this;\r\n document.addEventListener(\"load\", function (ev) {\r\n var el = (ev.srcElement || ev.target);\r\n if (el.id == \"iframe\") {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(\"超星新窗口加载\");\r\n clearTimeout(_this.timer);\r\n _this.OperateCard(el);\r\n }\r\n }, true);\r\n };\r\n CxCourse.prototype.OperateCard = function (iframe) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var iframeWindow, match, margStr, _loop_1, this_1, index;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n iframeWindow = iframe.contentWindow;\r\n if (iframeWindow.mArg == undefined) {\r\n match = iframeWindow.document.body.innerHTML.match(/try{\\s+?mArg = (.*?);/);\r\n if (!match) {\r\n return [2 /*return*/];\r\n }\r\n margStr = \"mArg=\" + match[1];\r\n iframeWindow.mArg = eval(margStr);\r\n }\r\n this.attachments = iframeWindow.mArg.attachments;\r\n this.taskList = new Array();\r\n _loop_1 = function (index) {\r\n var value, task, taskIndex;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n value = this_1.attachments[index];\r\n value.defaults = iframeWindow.mArg.defaults;\r\n if (value.jobid == undefined) {\r\n _App_mooc_chaoxing_factory__WEBPACK_IMPORTED_MODULE_2__[\"TaskFactory\"].CreateCourseTask(iframeWindow, value);\r\n return [2 /*return*/, \"continue\"];\r\n }\r\n task = _App_mooc_chaoxing_factory__WEBPACK_IMPORTED_MODULE_2__[\"TaskFactory\"].CreateCourseTask(iframeWindow, value);\r\n if (!task) {\r\n return [2 /*return*/, \"continue\"];\r\n }\r\n task.jobIndex = index;\r\n this_1.taskList.push(task);\r\n taskIndex = this_1.taskList.length - 1;\r\n task.Load(function () {\r\n });\r\n task.Complete(function () { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n this.startTask(taskIndex + 1, task);\r\n return [2 /*return*/];\r\n });\r\n }); });\r\n return [4 /*yield*/, task.Init()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n };\r\n this_1 = this;\r\n index = 0;\r\n _a.label = 1;\r\n case 1:\r\n if (!(index < this.attachments.length)) return [3 /*break*/, 4];\r\n return [5 /*yield**/, _loop_1(index)];\r\n case 2:\r\n _a.sent();\r\n _a.label = 3;\r\n case 3:\r\n index++;\r\n return [3 /*break*/, 1];\r\n case 4:\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Debug(\"任务点参数\", this.attachments);\r\n this.startTask(0, null);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n CxCourse.prototype.startTask = function (index, nowtask) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var task_1, i;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n if (_App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.auto) {\r\n for (i = index; i < this.taskList.length; i++) {\r\n task_1 = this.taskList[i];\r\n if (this.attachments[task_1.jobIndex].job) {\r\n if (index == 0) {\r\n task_1.Start();\r\n }\r\n else {\r\n this.delay(function () { return __awaiter(_this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n _a = nowtask;\r\n if (!_a) return [3 /*break*/, 2];\r\n return [4 /*yield*/, nowtask.Submit()];\r\n case 1:\r\n _a = (_b.sent());\r\n _b.label = 2;\r\n case 2:\r\n _a;\r\n task_1.Start();\r\n return [2 /*return*/];\r\n }\r\n });\r\n }); });\r\n }\r\n return [2 /*return*/];\r\n }\r\n }\r\n this.nextPage(null, nowtask);\r\n }\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n CxCourse.prototype.delay = function (func) {\r\n var interval = _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.interval;\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(interval + \"分钟后自动切换下一个任务点\");\r\n this.timer = setTimeout(function () {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.auto && func();\r\n }, interval * 60000);\r\n };\r\n CxCourse.prototype.afterPage = function () {\r\n //感觉奇葩的方法...\r\n var els = document.querySelectorAll(\"div.ncells > *:not(.currents) > .orange01\");\r\n var now = document.querySelector(\"div.ncells > .currents\");\r\n for (var i = 0; i < els.length; i++) {\r\n if (now.getBoundingClientRect().top < els[i].getBoundingClientRect().top) {\r\n return els[i];\r\n }\r\n }\r\n return null;\r\n };\r\n CxCourse.prototype.nextPage = function (num, task) {\r\n var _this = this;\r\n if (num == null) {\r\n return this.delay(function () { return __awaiter(_this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n _a = task;\r\n if (!_a) return [3 /*break*/, 2];\r\n return [4 /*yield*/, task.Submit()];\r\n case 1:\r\n _a = (_b.sent());\r\n _b.label = 2;\r\n case 2:\r\n _a;\r\n this.nextPage(0, null);\r\n return [2 /*return*/];\r\n }\r\n });\r\n }); });\r\n }\r\n var el = document.querySelector(\"span.currents ~ span\");\r\n if (el != undefined) {\r\n return el.click();\r\n }\r\n //只往后执行\r\n el = this.afterPage();\r\n if (el == undefined) {\r\n //进行有锁任务查找\r\n if (document.querySelector(\"div.ncells > *:not(.currents) > .lock\") == undefined) {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Warn(\"任务结束了\");\r\n return alert(\"任务结束了\");\r\n }\r\n return setTimeout(function () {\r\n if (num > 5) {\r\n return _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Fatal(\"被锁卡住了,请手动处理\");\r\n }\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(\"等待解锁\");\r\n _this.nextPage(num + 1, null);\r\n }, 5000);\r\n }\r\n el.parentElement.querySelector(\"a>span\").click();\r\n };\r\n return CxCourse;\r\n}());\r\n\r\n//TODO: 考试和作业强制采集\r\nvar CxExamTopic = /** @class */ (function () {\r\n function CxExamTopic() {\r\n }\r\n CxExamTopic.prototype.Start = function () {\r\n window.addEventListener(\"load\", function () {\r\n var el = document.querySelector(\"#paperId\");\r\n var info = \"0\";\r\n if (el) {\r\n info = el.value;\r\n }\r\n var task = _App_mooc_chaoxing_factory__WEBPACK_IMPORTED_MODULE_2__[\"TaskFactory\"].CreateExamTopicTask(window, {\r\n refer: document.URL,\r\n id: \"exam-\" + info,\r\n info: info,\r\n });\r\n task.Init();\r\n if (document.URL.indexOf(\"exam/test/reVersionTestStartNew\") > 0) {\r\n if (_App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.auto) {\r\n task.Start();\r\n }\r\n }\r\n });\r\n };\r\n return CxExamTopic;\r\n}());\r\n\r\nvar CxHomeWork = /** @class */ (function () {\r\n function CxHomeWork() {\r\n }\r\n CxHomeWork.prototype.Start = function () {\r\n window.onload = function () {\r\n var el = document.querySelector(\"#workLibraryId\");\r\n var info = \"\";\r\n if (el) {\r\n info = el.value;\r\n }\r\n var task = _App_mooc_chaoxing_factory__WEBPACK_IMPORTED_MODULE_2__[\"TaskFactory\"].CreateHomeworkTopicTask(window, {\r\n refer: document.URL,\r\n id: Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"substrex\"])(document.URL, \"&workId=\", \"&\"),\r\n info: info,\r\n });\r\n task.Init();\r\n if (_App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.auto && document.querySelector(\"#workLibraryId\")) {\r\n task.Start();\r\n }\r\n };\r\n };\r\n return CxHomeWork;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/course.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/factory.ts":
/*!**************************************!*\
!*** ./src/mooc/chaoxing/factory.ts ***!
\**************************************/
/*! exports provided: TaskFactory */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TaskFactory\", function() { return TaskFactory; });\n/* harmony import */ var _App_mooc_chaoxing_video__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/mooc/chaoxing/video */ \"./src/mooc/chaoxing/video.ts\");\n/* harmony import */ var _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/mooc/chaoxing/topic */ \"./src/mooc/chaoxing/topic.ts\");\n/* harmony import */ var _App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/app/question */ \"./src/internal/app/question.ts\");\n/* harmony import */ var _App_mooc_chaoxing_question__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @App/mooc/chaoxing/question */ \"./src/mooc/chaoxing/question.ts\");\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @App/mooc/chaoxing/task */ \"./src/mooc/chaoxing/task.ts\");\n/* harmony import */ var _App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @App/mooc/chaoxing/utils */ \"./src/mooc/chaoxing/utils.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_mooc_chaoxing_special__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @App/mooc/chaoxing/special */ \"./src/mooc/chaoxing/special.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar TaskFactory = /** @class */ (function () {\r\n function TaskFactory() {\r\n }\r\n TaskFactory.CreateCourseTask = function (context, taskinfo) {\r\n if (taskinfo.property.module == \"insertaudio\") {\r\n taskinfo.type = \"audio\";\r\n }\r\n //TODO:优化\r\n if (taskinfo.type != \"video\" && taskinfo.type != \"workid\" && taskinfo.type != \"document\"\r\n && taskinfo.type != \"audio\") {\r\n return null;\r\n }\r\n var task;\r\n var taskIframe = context.document.querySelector(\"iframe[jobid='\" + taskinfo.jobid + \"']\");\r\n var prev;\r\n if (taskIframe == undefined) {\r\n taskIframe = context.document.querySelector(\"iframe[data*='\" + taskinfo.property.mid + \"'],iframe[objectid='\" + taskinfo.property.objectid + \"']\");\r\n prev = document.createElement(\"div\");\r\n taskIframe.parentElement.prepend(prev);\r\n }\r\n else {\r\n prev = taskIframe.previousElementSibling;\r\n }\r\n switch (taskinfo.type) {\r\n case \"video\": {\r\n var bar = new _App_mooc_chaoxing_video__WEBPACK_IMPORTED_MODULE_0__[\"CxVideoControlBar\"](prev, new _App_mooc_chaoxing_video__WEBPACK_IMPORTED_MODULE_0__[\"Video\"](taskIframe.contentWindow, taskinfo));\r\n task = bar.task;\r\n task.muted = _App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.video_mute;\r\n task.playbackRate = _App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.video_multiple;\r\n break;\r\n }\r\n case \"workid\": {\r\n var contentWindow = taskIframe.contentWindow.document.querySelector(\"#frame_content\").contentWindow;\r\n taskinfo.refer = context.document.URL;\r\n taskinfo.id = taskinfo.property.workid;\r\n taskinfo.info = taskinfo.property.workid;\r\n var topic = new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"CxCourseTopic\"](contentWindow, new _App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__[\"ToolsQuestionBankFacade\"](\"cx\", {\r\n refer: context.document.URL, id: taskinfo.property.workid, info: taskinfo.property.workid,\r\n }));\r\n topic.SetQueryQuestions(new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"CxCourseQueryQuestion\"](contentWindow, function (context, el) {\r\n return _App_mooc_chaoxing_question__WEBPACK_IMPORTED_MODULE_3__[\"CxQuestionFactory\"].CreateCourseQuestion(context, el);\r\n }));\r\n var bar = new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"CxTopicControlBar\"](prev, new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"TopicAdapter\"](context, taskinfo, topic));\r\n if (_App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.answer_ignore) {\r\n return null;\r\n }\r\n task = bar.task;\r\n break;\r\n }\r\n case \"document\": {\r\n var bar = new _App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_5__[\"CxTaskControlBar\"](prev, new _App_mooc_chaoxing_special__WEBPACK_IMPORTED_MODULE_8__[\"CxDocumentTask\"](taskIframe.contentWindow, taskinfo));\r\n bar.append(bar.download());\r\n task = bar.task;\r\n task.muted = _App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.video_mute;\r\n task.playbackRate = _App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.video_multiple;\r\n break;\r\n }\r\n case \"audio\": {\r\n var bar = new _App_mooc_chaoxing_special__WEBPACK_IMPORTED_MODULE_8__[\"CxAudioControlBar\"](prev, new _App_mooc_chaoxing_special__WEBPACK_IMPORTED_MODULE_8__[\"CxAudioTask\"](taskIframe.contentWindow, taskinfo));\r\n task = bar.task;\r\n task.muted = _App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.video_mute;\r\n task.playbackRate = _App_internal_application__WEBPACK_IMPORTED_MODULE_4__[\"Application\"].App.config.video_multiple;\r\n break;\r\n }\r\n default:\r\n return null;\r\n }\r\n return task;\r\n };\r\n TaskFactory.CreateExamTopicTask = function (context, taskinfo) {\r\n var topic = new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"ExamTopic\"](context, new _App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__[\"ToolsQuestionBankFacade\"](\"cx\", taskinfo));\r\n var task = new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"TopicAdapter\"](context, taskinfo, topic);\r\n if (document.URL.indexOf(\"exam/test/reVersionTestStartNew\") > 0) {\r\n topic.SetQueryQuestions(topic);\r\n var btn_1 = Object(_App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_6__[\"CssBtn\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_7__[\"createBtn\"])(\"搜索答案\", \"搜索题目答案\"));\r\n document.querySelector(\".Cy_ulBottom.clearfix.w-buttom,.Cy_ulTk,.Cy_ulBottom.clearfix\").append(btn_1);\r\n btn_1.onclick = function () {\r\n btn_1.innerText = \"答案搜索中...\";\r\n try {\r\n task.Start().then(function (ret) {\r\n ret = ret || \"搜索题目\";\r\n btn_1.innerText = Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__[\"QuestionStatusString\"])(ret);\r\n });\r\n }\r\n catch (e) {\r\n }\r\n return false;\r\n };\r\n }\r\n else {\r\n topic.SetQueryQuestions(new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"CxCourseQueryQuestion\"](context, function (context, el) {\r\n return _App_mooc_chaoxing_question__WEBPACK_IMPORTED_MODULE_3__[\"CxQuestionFactory\"].CreateExamCollectQuestion(context, el);\r\n }));\r\n }\r\n return task;\r\n };\r\n TaskFactory.CreateHomeworkTopicTask = function (context, taskinfo) {\r\n var _this = this;\r\n var bank = new _App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__[\"ToolsQuestionBankFacade\"](\"cx\", taskinfo);\r\n if (taskinfo.info != \"\") {\r\n bank.CheckCourse();\r\n }\r\n var topic = new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"HomeworkTopic\"](context, bank);\r\n topic.SetQueryQuestions(new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"CxCourseQueryQuestion\"](context, function (context, el) {\r\n return _App_mooc_chaoxing_question__WEBPACK_IMPORTED_MODULE_3__[\"CxQuestionFactory\"].CreateHomeWorkQuestion(context, el);\r\n }));\r\n var task = new _App_mooc_chaoxing_topic__WEBPACK_IMPORTED_MODULE_1__[\"TopicAdapter\"](context, taskinfo, topic);\r\n var btn = Object(_App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_6__[\"CssBtn\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_7__[\"createBtn\"])(\"搜索答案\", \"搜索题目答案\"));\r\n if (document.querySelector(\"input#workRelationId\")) {\r\n document.querySelector(\".CyTop\").append(btn);\r\n btn.onclick = function () { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n btn.innerText = \"答案搜索中...\";\r\n task.Start().then(function (ret) {\r\n ret = ret || \"搜索题目\";\r\n btn.innerText = Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__[\"QuestionStatusString\"])(ret);\r\n });\r\n return [2 /*return*/];\r\n });\r\n }); };\r\n }\r\n return task;\r\n };\r\n return TaskFactory;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/factory.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/platform.ts":
/*!***************************************!*\
!*** ./src/mooc/chaoxing/platform.ts ***!
\***************************************/
/*! exports provided: CxPlatform */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxPlatform\", function() { return CxPlatform; });\n/* harmony import */ var _App_internal_app_vcode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/app/vcode */ \"./src/internal/app/vcode.ts\");\n/* harmony import */ var _course__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./course */ \"./src/mooc/chaoxing/course.ts\");\n/* harmony import */ var _vcode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vcode */ \"./src/mooc/chaoxing/vcode.ts\");\n/* harmony import */ var _video__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./video */ \"./src/mooc/chaoxing/video.ts\");\n/* harmony import */ var _App_mooc_chaoxing_read__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @App/mooc/chaoxing/read */ \"./src/mooc/chaoxing/read.ts\");\n/* harmony import */ var _App_mooc_chaoxing_special__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @App/mooc/chaoxing/special */ \"./src/mooc/chaoxing/special.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar CxPlatform = /** @class */ (function () {\r\n function CxPlatform() {\r\n }\r\n CxPlatform.prototype.CreateMooc = function () {\r\n var url = document.URL;\r\n var mooc = null;\r\n if (url.indexOf(\"mycourse/studentstudy?\") > 0) {\r\n mooc = new _App_internal_app_vcode__WEBPACK_IMPORTED_MODULE_0__[\"VCode\"](new _course__WEBPACK_IMPORTED_MODULE_1__[\"CxCourse\"](), new _vcode__WEBPACK_IMPORTED_MODULE_2__[\"CxCourseVCode\"]());\r\n }\r\n else if (url.indexOf(\"ananas/modules/video/index.html\") > 0) {\r\n mooc = new _video__WEBPACK_IMPORTED_MODULE_3__[\"CxVideoOptimization\"]();\r\n }\r\n else if (url.indexOf(\"ananas/modules/audio/index.html\") > 0) {\r\n mooc = new _App_mooc_chaoxing_special__WEBPACK_IMPORTED_MODULE_5__[\"CxAudioOptimization\"]();\r\n }\r\n else if ((url.indexOf(\"work/doHomeWorkNew\") > 0 || url.indexOf(\"work/selectWorkQuestionYiPiYue\") > 0) && self == top) {\r\n mooc = new _course__WEBPACK_IMPORTED_MODULE_1__[\"CxHomeWork\"]();\r\n }\r\n else if (url.indexOf(\"exam/test/reVersionTestStartNew\") > 0 || url.indexOf(\"exam/test/reVersionPaperMarkContentNew\") > 0) {\r\n mooc = new _course__WEBPACK_IMPORTED_MODULE_1__[\"CxExamTopic\"]();\r\n }\r\n else if (url.indexOf(\"/course/\") > 0) {\r\n mooc = new _App_mooc_chaoxing_read__WEBPACK_IMPORTED_MODULE_4__[\"ReadStartPage\"]();\r\n }\r\n else if (url.indexOf(\"ztnodedetailcontroller/visitnodedetail\") > 0) {\r\n mooc = new _App_mooc_chaoxing_read__WEBPACK_IMPORTED_MODULE_4__[\"Read\"]();\r\n }\r\n else if (url.indexOf(\"exam/test?\") > 0) {\r\n mooc = new _App_mooc_chaoxing_read__WEBPACK_IMPORTED_MODULE_4__[\"Exam\"]();\r\n }\r\n return mooc;\r\n };\r\n return CxPlatform;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/platform.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/question.ts":
/*!***************************************!*\
!*** ./src/mooc/chaoxing/question.ts ***!
\***************************************/
/*! exports provided: CxQuestionFactory */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxQuestionFactory\", function() { return CxQuestionFactory; });\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_internal_app_question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/app/question */ \"./src/internal/app/question.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ \"./src/mooc/chaoxing/utils.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n\r\n//TODO: 优化\r\nvar CxQuestionFactory = /** @class */ (function () {\r\n function CxQuestionFactory() {\r\n }\r\n CxQuestionFactory.CreateCourseQuestion = function (context, el) {\r\n var ret = Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_1__[\"SwitchTopicType\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(el.innerText, '【', '】'));\r\n return this.CreateCourseQuestionByTopicType(context, ret, el);\r\n };\r\n CxQuestionFactory.CreateExamQuestion = function (context, type, el) {\r\n var processor = new ExamQuestionProcessor();\r\n var ret = null;\r\n this.RemoveNotice(el);\r\n switch (type) {\r\n case 1:\r\n case 2: {\r\n ret = new cxExamSelectQuestion(context, el, type, processor);\r\n break;\r\n }\r\n case 3: {\r\n ret = new cxExamJudgeQuestion(context, el, type, processor);\r\n break;\r\n }\r\n case 4: {\r\n ret = new cxExamFillQuestion(context, el, type, processor);\r\n break;\r\n }\r\n default: {\r\n this.AddNotice(el, \"不支持的类型\");\r\n return null;\r\n }\r\n }\r\n return ret;\r\n };\r\n CxQuestionFactory.CreateCourseQuestionByTopicType = function (context, type, el) {\r\n var ret = null;\r\n var processor = new CourseQuestionProcessor();\r\n this.RemoveNotice(el);\r\n switch (type) {\r\n case 1:\r\n case 2: {\r\n ret = new cxSelectQuestion(context, el, type, processor);\r\n break;\r\n }\r\n case 3: {\r\n ret = new cxJudgeQuestion(context, el, type, processor);\r\n break;\r\n }\r\n case 4: {\r\n ret = new cxFillQuestion(context, el, type, processor);\r\n break;\r\n }\r\n default: {\r\n this.AddNotice(el, \"不支持的类型\");\r\n return null;\r\n }\r\n }\r\n return ret;\r\n };\r\n CxQuestionFactory.getBeforeType = function (el) {\r\n var before = el.previousElementSibling;\r\n do {\r\n if (before.className == \"Cy_TItle1\") {\r\n return before;\r\n }\r\n before = before.previousElementSibling;\r\n } while (before != null);\r\n return null;\r\n };\r\n CxQuestionFactory.CreateHomeWorkQuestion = function (context, el) {\r\n var ret = CxQuestionFactory.getBeforeType(el);\r\n return this.CreateCourseQuestionByTopicType(context, Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_1__[\"SwitchTopicType\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(ret.innerText, \".\", \"(\")), el);\r\n };\r\n //TODO:写的什么玩意啊\r\n CxQuestionFactory.CreateExamCollectQuestion = function (context, el) {\r\n var ret = CxQuestionFactory.getBeforeType(el.parentElement);\r\n var txt = ret.innerText.match(/、(.*?)[\\s|(]/)[1];\r\n return this.CreateExamQuestionByTopicType(context, Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_1__[\"SwitchTopicType\"])(txt), el);\r\n };\r\n CxQuestionFactory.CreateExamQuestionByTopicType = function (context, type, el) {\r\n var ret = null;\r\n var processor = new CourseQuestionProcessor();\r\n this.RemoveNotice(el);\r\n switch (type) {\r\n case 1:\r\n case 2: {\r\n ret = new cxSelectQuestion(context, el, type, processor);\r\n break;\r\n }\r\n case 3: {\r\n ret = new cxJudgeQuestion(context, el, type, processor);\r\n break;\r\n }\r\n case 4: {\r\n ret = new cxExamFillQuestion(context, el, type, processor);\r\n break;\r\n }\r\n default: {\r\n this.AddNotice(el, \"不支持的类型\");\r\n return null;\r\n }\r\n }\r\n return ret;\r\n };\r\n CxQuestionFactory.RemoveNotice = function (el) {\r\n var tmpel = el.querySelector(\".clearfix > ul,.clearfix > .Py_tk,.Zy_ulTk\");\r\n if (tmpel == undefined) {\r\n tmpel = el;\r\n }\r\n tmpel.querySelectorAll(\".prompt-line-answer\").forEach(function (v) {\r\n v.remove();\r\n });\r\n };\r\n CxQuestionFactory.AddNotice = function (el, str) {\r\n var tmpel = el.querySelector(\".clearfix > ul,.clearfix > .Py_tk,.Zy_ulTk\");\r\n if (tmpel == undefined) {\r\n tmpel = el;\r\n }\r\n Object(_utils__WEBPACK_IMPORTED_MODULE_2__[\"CreateNoteLine\"])(str, \"answer\", tmpel);\r\n };\r\n return CxQuestionFactory;\r\n}());\r\n\r\nvar CourseQuestionProcessor = /** @class */ (function () {\r\n function CourseQuestionProcessor() {\r\n }\r\n CourseQuestionProcessor.prototype.GetTopic = function (el) {\r\n var ret = el.querySelector(\".Zy_TItle > .clearfix,.Cy_TItle > .clearfix\").innerHTML;\r\n ret = ret.substring(ret.indexOf('】') + 1);\r\n if (/((.+?)分)($|\\s)/.test(ret)) {\r\n ret = ret.substring(0, ret.lastIndexOf(\"(\"));\r\n }\r\n return ret;\r\n };\r\n return CourseQuestionProcessor;\r\n}());\r\nvar ExamQuestionProcessor = /** @class */ (function () {\r\n function ExamQuestionProcessor() {\r\n }\r\n ExamQuestionProcessor.prototype.GetTopic = function (el) {\r\n var ret = el.querySelector(\".Cy_TItle.clearfix .clearfix\").innerHTML;\r\n ret = ret.substr(0, ret.lastIndexOf('分)'));\r\n ret = ret.substr(0, ret.lastIndexOf('('));\r\n return ret;\r\n };\r\n return ExamQuestionProcessor;\r\n}());\r\nvar cxQuestion = /** @class */ (function () {\r\n function cxQuestion(context, el, type, processor) {\r\n this.context = context;\r\n this.el = el;\r\n this.type = type;\r\n this.processor = processor;\r\n }\r\n cxQuestion.prototype.SetStatus = function (status) {\r\n this.AddNotice(Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_1__[\"TopicStatusString\"])(status));\r\n };\r\n cxQuestion.prototype.GetTopic = function () {\r\n return this.processor.GetTopic(this.el);\r\n };\r\n cxQuestion.prototype.RemoveNotice = function () {\r\n CxQuestionFactory.RemoveNotice(this.el);\r\n };\r\n cxQuestion.prototype.AddNotice = function (str) {\r\n CxQuestionFactory.AddNotice(this.el, str);\r\n };\r\n cxQuestion.prototype.GetType = function () {\r\n return this.type;\r\n };\r\n cxQuestion.prototype.options = function () {\r\n var tmpel = this.el.querySelector(\".clearfix > ul,.clearfix ul.Zy_ulBottom.clearfix,ul.Zy_ulTk\");\r\n var list = tmpel.querySelectorAll(\"li\");\r\n return list;\r\n };\r\n cxQuestion.prototype.isCorrect = function () {\r\n var el = this.el.querySelector(\".Py_answer.clearfix,.Py_tk\");\r\n if (el.innerHTML.indexOf('正确答案') < 0) {\r\n if (el.querySelectorAll('.fr.dui').length <= 0 && el.querySelectorAll('.fr.bandui').length <= 0) {\r\n return null;\r\n }\r\n }\r\n return el;\r\n };\r\n cxQuestion.prototype.defaultAnswer = function () {\r\n var ret = new _App_internal_app_question__WEBPACK_IMPORTED_MODULE_1__[\"PushAnswer\"]();\r\n ret.topic = this.GetTopic();\r\n ret.type = this.GetType();\r\n ret.correct = new Array();\r\n ret.answers = new Array();\r\n return ret;\r\n };\r\n return cxQuestion;\r\n}());\r\nvar cxSelectQuestion = /** @class */ (function (_super) {\r\n __extends(cxSelectQuestion, _super);\r\n function cxSelectQuestion() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n cxSelectQuestion.prototype.getContent = function (el) {\r\n el = el.querySelector(\"a\");\r\n return el.innerHTML;\r\n };\r\n cxSelectQuestion.prototype.getOption = function (el) {\r\n return el.querySelector(\"input\").value;\r\n };\r\n cxSelectQuestion.prototype.click = function (el, content) {\r\n var ipt = el.querySelector(\"label > input\");\r\n if (!ipt.checked) {\r\n ipt.click();\r\n }\r\n this.AddNotice(this.getOption(el) + \":\" + content);\r\n };\r\n cxSelectQuestion.prototype.Random = function () {\r\n var options = this.options();\r\n var pos = Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"randNumber\"])(0, options.length - 1);\r\n this.click(options[pos], this.getContent(options[pos]));\r\n return \"random\";\r\n };\r\n cxSelectQuestion.prototype.Fill = function (s) {\r\n var options = this.options();\r\n var flag = false;\r\n for (var i = 0; i < s.correct.length; i++) {\r\n for (var j = 0; j < options.length; j++) {\r\n if (s.correct[i].content.trim() == \"\") {\r\n if (this.getOption(options[j]) == s.correct[i].option) {\r\n this.click(options[j], this.getContent(options[j]));\r\n flag = true;\r\n }\r\n }\r\n else if (s.Equal(this.getContent(options[j]), s.correct[i].content)) {\r\n this.click(options[j], s.correct[i].content);\r\n flag = true;\r\n }\r\n }\r\n }\r\n if (flag) {\r\n return \"ok\";\r\n }\r\n return \"no_match\";\r\n };\r\n cxSelectQuestion.prototype.Correct = function () {\r\n var correct = this.isCorrect();\r\n if (correct == null) {\r\n return null;\r\n }\r\n var ret = this.defaultAnswer();\r\n var options = this.el.querySelectorAll(\".Zy_ulTop > li.clearfix,.Cy_ulTop li\");\r\n var correctText = correct.querySelector(\"span\").innerText;\r\n for (var i = 0; i < options.length; i++) {\r\n var optionText = options[i].querySelector(\"i.fl\").innerText;\r\n var option = {\r\n option: optionText.substring(0, 1),\r\n content: options[i].querySelector(\"a.fl,a\").innerHTML,\r\n };\r\n ret.answers.push(option);\r\n if (correctText.indexOf(option.option) > 0) {\r\n ret.correct.push(option);\r\n }\r\n }\r\n return ret;\r\n };\r\n return cxSelectQuestion;\r\n}(cxQuestion));\r\nvar cxJudgeQuestion = /** @class */ (function (_super) {\r\n __extends(cxJudgeQuestion, _super);\r\n function cxJudgeQuestion() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n cxJudgeQuestion.prototype.getContent = function (el) {\r\n var tmpel = el.querySelector(\"label > input,input\");\r\n if (tmpel.value == \"true\") {\r\n return \"对√\";\r\n }\r\n return \"错×\";\r\n };\r\n cxJudgeQuestion.prototype.click = function (el) {\r\n var tmpel = el.querySelector(\"label > input,input\");\r\n if (!tmpel.checked) {\r\n tmpel.click();\r\n }\r\n this.AddNotice(this.getContent(el));\r\n };\r\n cxJudgeQuestion.prototype.Random = function () {\r\n var options = this.options();\r\n var pos = Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"randNumber\"])(0, 1);\r\n this.click(options[pos]);\r\n return \"random\";\r\n };\r\n cxJudgeQuestion.prototype.Fill = function (answer) {\r\n var options = this.options();\r\n this.click(options[answer.correct[0].content ? 0 : 1]);\r\n return \"ok\";\r\n };\r\n cxJudgeQuestion.prototype.Correct = function () {\r\n var el = this.el.querySelector(\".Py_answer.clearfix\");\r\n if (el.innerHTML.indexOf('正确答案') < 0) {\r\n if (el.querySelectorAll('.fr.dui').length <= 0 && el.querySelectorAll('.fr.cuo').length <= 0) {\r\n return null;\r\n }\r\n }\r\n var ret = this.defaultAnswer();\r\n var correctText = el.querySelector(\"span\").innerText;\r\n if (correctText.indexOf('×') >= 0) {\r\n ret.correct.push({ option: false, content: false });\r\n }\r\n else {\r\n ret.correct.push({ option: true, content: true });\r\n }\r\n return ret;\r\n };\r\n return cxJudgeQuestion;\r\n}(cxSelectQuestion));\r\nvar cxFillQuestion = /** @class */ (function (_super) {\r\n __extends(cxFillQuestion, _super);\r\n function cxFillQuestion() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n cxFillQuestion.prototype.getOption = function (el) {\r\n if (el.className == \"XztiHover1\") {\r\n return Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(el.previousElementSibling.innerHTML, \"第\", \"空\");\r\n }\r\n var tmpel = el.querySelector(\"span.fb\");\r\n return Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(tmpel.innerHTML, \"第\", \"空\");\r\n };\r\n cxFillQuestion.prototype.Random = function () {\r\n return \"no_support_random\";\r\n };\r\n cxFillQuestion.prototype.Correct = function () {\r\n var correct = this.isCorrect();\r\n if (correct == null) {\r\n return null;\r\n }\r\n var ret = this.defaultAnswer();\r\n var options = this.el.querySelectorAll(\".Py_tk span.font14\");\r\n var isMy = false;\r\n if (options.length <= 0) {\r\n isMy = true;\r\n options = this.el.querySelectorAll(\".Py_answer.clearfix .font14\");\r\n }\r\n for (var i = 0; i < options.length; i++) {\r\n if (isMy && options[i].querySelectorAll(\".fr.dui\").length <= 0) {\r\n continue;\r\n }\r\n var optionEl = options[i].querySelector(\"i.fl\");\r\n var option = {\r\n option: Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(optionEl.innerHTML, \"第\", \"空\"),\r\n content: options[i].querySelector(\".clearfix\").innerText,\r\n };\r\n ret.correct.push(option);\r\n }\r\n return ret;\r\n };\r\n cxFillQuestion.prototype.Fill = function (answer) {\r\n var options = this.options();\r\n if (!options.length) {\r\n options = this.el.querySelectorAll(\".XztiHover1\");\r\n }\r\n var flag = 0;\r\n for (var i = 0; i < answer.correct.length; i++) {\r\n for (var j = 0; j < options.length; j++) {\r\n if (this.getOption(options[j]) == answer.correct[i].option) {\r\n flag++;\r\n var el = options[j].querySelector(\"input.inp\");\r\n if (!el) {\r\n var uedit = this.context.$(options[j]).find('textarea');\r\n if (uedit.length <= 0) {\r\n this.AddNotice(this.getOption(options[j]) + \"空发生了一个错误\");\r\n continue;\r\n }\r\n this.context.UE.getEditor(uedit.attr('name')).setContent(answer.correct[i].content);\r\n this.AddNotice(this.getOption(options[j]) + \":\" + answer.correct[i].content);\r\n }\r\n else {\r\n el.value = Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"removeHTMLTag\"])(answer.correct[i].content);\r\n this.AddNotice(this.getOption(options[j]) + \":\" + answer.correct[i].content);\r\n }\r\n }\r\n }\r\n }\r\n if (flag == options.length) {\r\n return \"ok\";\r\n }\r\n return \"no_match\";\r\n };\r\n return cxFillQuestion;\r\n}(cxQuestion));\r\n//TODO: 优化\r\nvar cxExamSelectQuestion = /** @class */ (function (_super) {\r\n __extends(cxExamSelectQuestion, _super);\r\n function cxExamSelectQuestion() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n cxExamSelectQuestion.prototype.options = function () {\r\n return this.el.querySelectorAll(\".Cy_ulBottom.clearfix.w-buttom li input\");\r\n };\r\n cxExamSelectQuestion.prototype.getContent = function (el) {\r\n var textOption = this.el.querySelectorAll(\".Cy_ulTop.w-top li div.clearfix a\");\r\n var tmpli = el.parentElement.parentElement;\r\n var pos = -1;\r\n do {\r\n tmpli = tmpli.previousElementSibling;\r\n pos++;\r\n } while (tmpli != null);\r\n return textOption[pos].innerHTML;\r\n };\r\n cxExamSelectQuestion.prototype.getOption = function (el) {\r\n return el.parentElement.innerText;\r\n };\r\n cxExamSelectQuestion.prototype.click = function (el, content) {\r\n el.click();\r\n this.AddNotice(this.getOption(el) + \":\" + content);\r\n };\r\n return cxExamSelectQuestion;\r\n}(cxSelectQuestion));\r\nvar cxExamFillQuestion = /** @class */ (function (_super) {\r\n __extends(cxExamFillQuestion, _super);\r\n function cxExamFillQuestion() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n cxExamFillQuestion.prototype.options = function () {\r\n return this.el.querySelectorAll(\".Cy_ulTk .XztiHover1\");\r\n };\r\n cxExamFillQuestion.prototype.getOption = function (el) {\r\n var tmpel = el.querySelector(\".fb.font14\");\r\n return Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(tmpel.innerHTML, \"第\", \"空\");\r\n };\r\n cxExamFillQuestion.prototype.Fill = function (answer) {\r\n var options = this.options();\r\n var flag = 0;\r\n for (var i = 0; i < answer.correct.length; i++) {\r\n for (var j = 0; j < options.length; j++) {\r\n if (this.getOption(options[j]) == answer.correct[i].option) {\r\n flag++;\r\n var uedit = window.$(options[j]).find('textarea');\r\n if (uedit.length <= 0) {\r\n this.AddNotice(this.getOption(options[j]) + \"空发生了一个错误\");\r\n continue;\r\n }\r\n window.UE.getEditor(uedit.attr('name')).setContent(answer.correct[i].content);\r\n this.AddNotice(this.getOption(options[j]) + \":\" + answer.correct[i].content);\r\n }\r\n }\r\n }\r\n if (flag == options.length) {\r\n return \"ok\";\r\n }\r\n return \"no_match\";\r\n };\r\n cxExamFillQuestion.prototype.Correct = function () {\r\n var correct = this.isCorrect();\r\n if (correct == null) {\r\n return null;\r\n }\r\n var ret = this.defaultAnswer();\r\n var options = this.el.querySelectorAll(\".Py_tk div[id] span.font14\");\r\n var isMy = false;\r\n if (options.length <= 0) {\r\n isMy = true;\r\n options = this.el.querySelectorAll(\".Py_answer.clearfix .font14\");\r\n }\r\n for (var i = 0; i < options.length; i++) {\r\n if (isMy && options[i].querySelectorAll(\".fr.dui\").length <= 0) {\r\n continue;\r\n }\r\n var optionEl = options[i].querySelector(\"i\");\r\n var option = {\r\n option: Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_0__[\"substrex\"])(optionEl.innerHTML, \"第\", \"空\"),\r\n content: options[i].innerHTML.substr(options[i].innerHTML.indexOf(\"\") + 4),\r\n };\r\n ret.correct.push(option);\r\n }\r\n return ret;\r\n };\r\n return cxExamFillQuestion;\r\n}(cxFillQuestion));\r\nvar cxExamJudgeQuestion = /** @class */ (function (_super) {\r\n __extends(cxExamJudgeQuestion, _super);\r\n function cxExamJudgeQuestion() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n cxExamJudgeQuestion.prototype.options = function () {\r\n return this.el.querySelectorAll(\".Cy_ulBottom.clearfix li\");\r\n };\r\n return cxExamJudgeQuestion;\r\n}(cxJudgeQuestion));\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/question.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/read.ts":
/*!***********************************!*\
!*** ./src/mooc/chaoxing/read.ts ***!
\***********************************/
/*! exports provided: Read, ReadStartPage, Exam */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Read\", function() { return Read; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReadStartPage\", function() { return ReadStartPage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Exam\", function() { return Exam; });\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/app/question */ \"./src/internal/app/question.ts\");\n\r\n\r\n\r\nvar Read = /** @class */ (function () {\r\n function Read() {\r\n }\r\n Read.prototype.Start = function () {\r\n var timer;\r\n var slide = function () {\r\n if (window.getScrollHeight() - window.getHeight() <= window.getScrollTop() + 40) {\r\n var next = document.querySelectorAll('.mb15.course_section > a.wh.wh');\r\n var flag = false;\r\n for (var i = 0; i < next.length; i++) {\r\n if (flag) {\r\n next[i].click();\r\n return;\r\n }\r\n if (document.URL == next[i].href) {\r\n flag = true;\r\n }\r\n }\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Warn(\"阅读完成啦~\");\r\n clearTimeout(timer);\r\n return;\r\n }\r\n window.scrollTo(0, window.getScrollTop() + Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"randNumber\"])(60, 80));\r\n timer = setTimeout(slide, Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"randNumber\"])(10, 20) * 500);\r\n };\r\n window.addEventListener(\"load\", function () {\r\n slide();\r\n });\r\n };\r\n return Read;\r\n}());\r\n\r\nvar ReadStartPage = /** @class */ (function () {\r\n function ReadStartPage() {\r\n }\r\n ReadStartPage.prototype.Start = function () {\r\n window.addEventListener(\"load\", function () {\r\n if (!_App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.config.auto) {\r\n return _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(\"开启自动挂机能够自动阅读文章哦\");\r\n }\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].App.log.Info(\"请在10秒内选择章节,否则插件将从第一章自动开始\");\r\n setTimeout(function () {\r\n var el = document.querySelector(\".mb15.course_section.fix\");\r\n el.querySelector(\"a\").click();\r\n }, 10000);\r\n });\r\n };\r\n return ReadStartPage;\r\n}());\r\n\r\nvar Exam = /** @class */ (function () {\r\n function Exam() {\r\n }\r\n Exam.prototype.Start = function () {\r\n var bank = new _App_internal_app_question__WEBPACK_IMPORTED_MODULE_2__[\"ToolsQuestionBank\"](\"cx\");\r\n window.addEventListener(\"load\", function () {\r\n var str = _App_internal_application__WEBPACK_IMPORTED_MODULE_0__[\"Application\"].GlobalContext.document.documentElement.innerHTML;\r\n var m;\r\n var regex = new RegExp(/goTest\\(.*?,(\\d+),\\d+,.*?,(\\d+),false,/g);\r\n var info = new Array();\r\n while ((m = regex.exec(str)) !== null) {\r\n var tmp = { refer: document.URL, id: \"exam-\" + m[2], info: m[2] };\r\n info.push(tmp);\r\n }\r\n regex = new RegExp(/lookUpPaper\\('(\\d+)','\\d+','(\\d+)'/g);\r\n while ((m = regex.exec(str)) !== null) {\r\n var tmp = { refer: document.URL, id: \"exam-\" + m[2], info: m[2] };\r\n info.push(tmp);\r\n }\r\n bank.CheckCourse(info);\r\n });\r\n };\r\n return Exam;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/read.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/special.ts":
/*!**************************************!*\
!*** ./src/mooc/chaoxing/special.ts ***!
\**************************************/
/*! exports provided: CxDocumentTask, CxAudioOptimization, CxAudioTask, CxAudioControlBar */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxDocumentTask\", function() { return CxDocumentTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxAudioOptimization\", function() { return CxAudioOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxAudioTask\", function() { return CxAudioTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxAudioControlBar\", function() { return CxAudioControlBar; });\n/* harmony import */ var _App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/mooc/chaoxing/task */ \"./src/mooc/chaoxing/task.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_mooc_chaoxing_video__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @App/mooc/chaoxing/video */ \"./src/mooc/chaoxing/video.ts\");\n/* harmony import */ var _App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @App/mooc/chaoxing/utils */ \"./src/mooc/chaoxing/utils.ts\");\n/* harmony import */ var _App_internal_utils_hook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @App/internal/utils/hook */ \"./src/internal/utils/hook.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar CxDocumentTask = /** @class */ (function (_super) {\r\n __extends(CxDocumentTask, _super);\r\n function CxDocumentTask() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n CxDocumentTask.prototype.Start = function () {\r\n var _this = this;\r\n var next = function () {\r\n var el = _this.context.document.querySelector(\".imglook > .mkeRbtn\");\r\n if (el.style.visibility == \"hidden\") {\r\n _this.completeCallback && _this.completeCallback();\r\n return;\r\n }\r\n el.click();\r\n _this.time = _this.context.setTimeout(next, Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"randNumber\"])(1, 5) * 1000);\r\n };\r\n this.time = this.context.setTimeout(next, Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"randNumber\"])(1, 5) * 1000);\r\n };\r\n return CxDocumentTask;\r\n}(_App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_0__[\"CxTask\"]));\r\n\r\nvar CxAudioOptimization = /** @class */ (function (_super) {\r\n __extends(CxAudioOptimization, _super);\r\n function CxAudioOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n CxAudioOptimization.prototype.Start = function () {\r\n var _this = this;\r\n //对播放器进行优化\r\n window.addEventListener(\"load\", function () {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.config.super_mode && Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"isPhone\"])() && (_App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].GlobalContext.Ext.isChaoxing = true);\r\n });\r\n this.hook();\r\n document.addEventListener(\"readystatechange\", function () {\r\n _this.hook();\r\n });\r\n this.Api();\r\n };\r\n CxAudioOptimization.prototype.hook = function () {\r\n if (document.readyState != \"interactive\") {\r\n return;\r\n }\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(\"hook cx audio\");\r\n var self = this;\r\n var paramHook = new _App_internal_utils_hook__WEBPACK_IMPORTED_MODULE_5__[\"Hook\"](\"params2VideoOpt\", _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].GlobalContext.ans.AudioJs.prototype);\r\n paramHook.Middleware(function (next) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n self.param = args[0];\r\n return next.apply(this, args);\r\n });\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].GlobalContext.Ext.isSogou = false;\r\n };\r\n return CxAudioOptimization;\r\n}(_App_mooc_chaoxing_video__WEBPACK_IMPORTED_MODULE_3__[\"CxVideoOptimization\"]));\r\n\r\nvar CxAudioTask = /** @class */ (function (_super) {\r\n __extends(CxAudioTask, _super);\r\n function CxAudioTask() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n CxAudioTask.prototype.queryVideo = function () {\r\n return this.context.document.getElementById(\"audio_html5_api\");\r\n };\r\n return CxAudioTask;\r\n}(_App_mooc_chaoxing_video__WEBPACK_IMPORTED_MODULE_3__[\"Video\"]));\r\n\r\nvar CxAudioControlBar = /** @class */ (function (_super) {\r\n __extends(CxAudioControlBar, _super);\r\n function CxAudioControlBar() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n CxAudioControlBar.prototype.defaultBtn = function () {\r\n var _this = this;\r\n _super.prototype.defaultBtn.call(this);\r\n var pass = Object(_App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_4__[\"CssBtn\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"createBtn\"])(\"秒过嘤频\", \"秒过会被后台检测到\", \"cx-btn\"));\r\n pass.style.background = \"#F57C00\";\r\n pass.onclick = function () {\r\n if (!Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"protocolPrompt\"])(\"秒过会产生不良记录,是否继续?\", \"boom_audio_no_prompt\")) {\r\n return;\r\n }\r\n _this.task.sendEndTimePack(function (isPassed) {\r\n if (isPassed) {\r\n alert('秒过成功,刷新后查看效果');\r\n }\r\n else {\r\n alert('操作失败,错误');\r\n }\r\n });\r\n };\r\n this.prev.append(pass, this.download());\r\n };\r\n return CxAudioControlBar;\r\n}(_App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_0__[\"CxTaskControlBar\"]));\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/special.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/task.ts":
/*!***********************************!*\
!*** ./src/mooc/chaoxing/task.ts ***!
\***********************************/
/*! exports provided: CxTask, CxTaskControlBar */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxTask\", function() { return CxTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxTaskControlBar\", function() { return CxTaskControlBar; });\n/* harmony import */ var _App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/mooc/chaoxing/utils */ \"./src/mooc/chaoxing/utils.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n\r\n\r\n\r\nvar CxTask = /** @class */ (function () {\r\n function CxTask(context, taskinfo) {\r\n this.taskinfo = taskinfo;\r\n this.context = context;\r\n }\r\n CxTask.prototype.Complete = function (callback) {\r\n this.completeCallback = callback;\r\n };\r\n CxTask.prototype.Init = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.loadCallback && _this.loadCallback();\r\n resolve();\r\n });\r\n };\r\n CxTask.prototype.Load = function (callback) {\r\n this.loadCallback = callback;\r\n };\r\n CxTask.prototype.Submit = function () {\r\n return new Promise(function (resolve) {\r\n resolve();\r\n });\r\n };\r\n //TODO:停止\r\n CxTask.prototype.Stop = function () {\r\n return new Promise(function (resolve) {\r\n resolve();\r\n });\r\n };\r\n return CxTask;\r\n}());\r\n\r\nvar CxTaskControlBar = /** @class */ (function () {\r\n function CxTaskControlBar(prev, task) {\r\n this.task = task;\r\n this.prev = document.createElement(\"div\");\r\n prev.style.textAlign = \"center\";\r\n prev.style.width = \"100%\";\r\n prev.prepend(this.prev);\r\n this.defaultBtn();\r\n }\r\n CxTaskControlBar.prototype.defaultBtn = function () {\r\n var _this = this;\r\n var startBtn = Object(_App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_0__[\"CssBtn\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"createBtn\"])(_App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.config.auto ? \"暂停挂机\" : \"开始挂机\", \"点击开始自动挂机\", \"cx-btn\"));\r\n startBtn.onclick = function () {\r\n if (startBtn.innerText == '暂停挂机') {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.config.auto = false;\r\n startBtn.innerText = \"开始挂机\";\r\n startBtn.title = \"点击开始自动挂机\";\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Info(\"挂机停止了\");\r\n }\r\n else {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.config.auto = true;\r\n startBtn.innerText = '暂停挂机';\r\n startBtn.title = \"停止挂机,开始好好学习\";\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Info(\"挂机开始了\");\r\n _this.task.Start();\r\n }\r\n };\r\n this.prev.append(startBtn);\r\n };\r\n CxTaskControlBar.prototype.append = function (el) {\r\n this.prev.append(el);\r\n };\r\n CxTaskControlBar.prototype.download = function () {\r\n var _this = this;\r\n if (!this.task.taskinfo.property.objectid) {\r\n return;\r\n }\r\n var download = Object(_App_mooc_chaoxing_utils__WEBPACK_IMPORTED_MODULE_0__[\"CssBtn\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"createBtn\"])(\"下载资源\", \"我要下载下来好好学习\", \"cx-btn\"));\r\n download.style.background = \"#999999\";\r\n download.onclick = function () {\r\n window.open(\"http://d0.ananas.chaoxing.com/download/\" + _this.task.taskinfo.property.objectid);\r\n };\r\n return download;\r\n };\r\n return CxTaskControlBar;\r\n}());\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/task.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/topic.ts":
/*!************************************!*\
!*** ./src/mooc/chaoxing/topic.ts ***!
\************************************/
/*! exports provided: CxTopicControlBar, TopicAdapter, CxCourseQueryQuestion, CxCourseTopic, ExamTopic, HomeworkTopic */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxTopicControlBar\", function() { return CxTopicControlBar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TopicAdapter\", function() { return TopicAdapter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxCourseQueryQuestion\", function() { return CxCourseQueryQuestion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxCourseTopic\", function() { return CxCourseTopic; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExamTopic\", function() { return ExamTopic; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HomeworkTopic\", function() { return HomeworkTopic; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ \"./src/mooc/chaoxing/utils.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_internal_app_question__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @App/internal/app/question */ \"./src/internal/app/question.ts\");\n/* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ \"./src/mooc/chaoxing/question.ts\");\n/* harmony import */ var _App_internal_app_topic__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @App/internal/app/topic */ \"./src/internal/app/topic.ts\");\n/* harmony import */ var _App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @App/mooc/chaoxing/task */ \"./src/mooc/chaoxing/task.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar CxTopicControlBar = /** @class */ (function (_super) {\r\n __extends(CxTopicControlBar, _super);\r\n function CxTopicControlBar() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n CxTopicControlBar.prototype.defaultBtn = function () {\r\n var _this = this;\r\n _super.prototype.defaultBtn.call(this);\r\n var topic = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[\"CssBtn\"])(Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_1__[\"createBtn\"])(\"搜索题目\", \"点击搜索题目答案\", \"cx-btn\"));\r\n topic.style.background = \"#3fae93\";\r\n this.prev.append(topic);\r\n // 绑定事件\r\n topic.onclick = function () { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n topic.innerText = \"答案搜索中...\";\r\n this.task.Start().then(function (ret) {\r\n ret = ret || \"搜索题目\";\r\n topic.innerText = Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_3__[\"QuestionStatusString\"])(ret);\r\n });\r\n return [2 /*return*/];\r\n });\r\n }); };\r\n };\r\n return CxTopicControlBar;\r\n}(_App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_6__[\"CxTaskControlBar\"]));\r\n\r\nvar TopicAdapter = /** @class */ (function (_super) {\r\n __extends(TopicAdapter, _super);\r\n function TopicAdapter(context, taskinfo, topic) {\r\n var _this = _super.call(this, context, taskinfo) || this;\r\n _this.topic = topic;\r\n return _this;\r\n }\r\n TopicAdapter.prototype.Init = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Debug(\"题目信息\", _this.taskinfo);\r\n _this.topic.Init();\r\n _this.loadCallback && _this.loadCallback();\r\n resolve();\r\n });\r\n };\r\n TopicAdapter.prototype.Start = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {\r\n var ret;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (this.lock) {\r\n return [2 /*return*/, resolve(\"processing\")];\r\n }\r\n this.lock = true;\r\n return [4 /*yield*/, this.topic.QueryAnswer()];\r\n case 1:\r\n ret = _a.sent();\r\n this.status = ret;\r\n this.completeCallback && this.completeCallback();\r\n this.lock = false;\r\n return [2 /*return*/, resolve(ret)];\r\n }\r\n });\r\n }); });\r\n };\r\n TopicAdapter.prototype.Submit = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve) {\r\n if (_this.status == \"success\") {\r\n _this.topic.Submit().then(function () {\r\n resolve();\r\n });\r\n }\r\n else {\r\n resolve();\r\n }\r\n })];\r\n });\r\n });\r\n };\r\n return TopicAdapter;\r\n}(_App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_6__[\"CxTask\"]));\r\n\r\nvar CxCourseQueryQuestion = /** @class */ (function () {\r\n function CxCourseQueryQuestion(content, createQuestion) {\r\n this.context = content;\r\n this.createQuestion = createQuestion;\r\n }\r\n CxCourseQueryQuestion.prototype.QueryQuestions = function () {\r\n var _this = this;\r\n var timu = this.context.document.querySelectorAll(\".TiMu\");\r\n var ret = new Array();\r\n timu.forEach(function (val) {\r\n var question = _this.createQuestion(_this.context, val);\r\n if (question == null) {\r\n return;\r\n }\r\n ret.push(question);\r\n });\r\n return ret;\r\n };\r\n return CxCourseQueryQuestion;\r\n}());\r\n\r\nvar CxCourseTopic = /** @class */ (function (_super) {\r\n __extends(CxCourseTopic, _super);\r\n function CxCourseTopic(content, answer) {\r\n var _this = _super.call(this, content, answer) || this;\r\n answer.CheckCourse();\r\n return _this;\r\n }\r\n CxCourseTopic.prototype.Init = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n var timer = _this.context.setInterval(function () { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!(this.context.document.readyState == \"complete\")) return [3 /*break*/, 3];\r\n this.context.clearInterval(timer);\r\n if (!(this.context.document.URL.indexOf(\"selectWorkQuestionYiPiYue\") > 0)) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.CollectAnswer()];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n resolve();\r\n _a.label = 3;\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n }); }, 500);\r\n });\r\n };\r\n CxCourseTopic.prototype.QueryAnswer = function () {\r\n if (this.context.document.URL.indexOf(\"selectWorkQuestionYiPiYue\") > 0) {\r\n return null;\r\n }\r\n return _super.prototype.QueryAnswer.call(this);\r\n };\r\n CxCourseTopic.prototype.Submit = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Info(\"准备提交答案\");\r\n var self = _this;\r\n _this.context.setTimeout(function () {\r\n var submit = _this.context.document.querySelector(\".Btn_blue_1\");\r\n submit.click();\r\n _this.context.setTimeout(function () {\r\n var prompt = _this.context.document.querySelector(\"#tipContent\").innerHTML;\r\n if (prompt.indexOf(\"未做完\") > 0) {\r\n alert(\"提示:\" + prompt);\r\n resolve(\"未做完\");\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_2__[\"Application\"].App.log.Fatal(\"有题目未完成,请手动操作.提示:\" + prompt);\r\n return;\r\n }\r\n var timer = _this.context.setInterval(function () {\r\n prompt = document.getElementById(\"validate\");\r\n if (prompt.style.display != 'none') {\r\n //等待验证码接管\r\n return;\r\n }\r\n _this.context.clearInterval(timer);\r\n _this.context.parent.document.querySelector(\"#frame_content\")\r\n .addEventListener(\"load\", function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!(this.contentWindow.document.URL.indexOf('selectWorkQuestionYiPiYue') > 0)) return [3 /*break*/, 2];\r\n return [4 /*yield*/, self.CollectAnswer()];\r\n case 1:\r\n _a.sent();\r\n resolve();\r\n _a.label = 2;\r\n case 2: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n });\r\n //确定提交\r\n var submit = _this.context.document.querySelector(\".bluebtn\");\r\n submit.click();\r\n }, 2000);\r\n }, 2000);\r\n }, 2000);\r\n });\r\n };\r\n return CxCourseTopic;\r\n}(_App_internal_app_topic__WEBPACK_IMPORTED_MODULE_5__[\"Topic\"]));\r\n\r\nvar ExamTopic = /** @class */ (function (_super) {\r\n __extends(ExamTopic, _super);\r\n function ExamTopic() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ExamTopic.prototype.QueryQuestions = function () {\r\n var current = document.querySelector(\".current\");\r\n var topicType = Object(_App_internal_app_question__WEBPACK_IMPORTED_MODULE_3__[\"SwitchTopicType\"])(current.parentElement.previousElementSibling.innerText);\r\n var question = _question__WEBPACK_IMPORTED_MODULE_4__[\"CxQuestionFactory\"].CreateExamQuestion(window, topicType, document.querySelector(\".leftContent.TiMu\"));\r\n var ret = new Array();\r\n if (question == null) {\r\n return ret;\r\n }\r\n ret.push(question);\r\n return ret;\r\n };\r\n ExamTopic.prototype.Init = function () {\r\n if (document.URL.indexOf(\"exam/test/reVersionPaperMarkContentNew\") > 0) {\r\n this.CollectAnswer();\r\n }\r\n return null;\r\n };\r\n ExamTopic.prototype.Submit = function () {\r\n return new Promise(function (resolve) {\r\n resolve();\r\n });\r\n };\r\n return ExamTopic;\r\n}(_App_internal_app_topic__WEBPACK_IMPORTED_MODULE_5__[\"Topic\"]));\r\n\r\nvar HomeworkTopic = /** @class */ (function (_super) {\r\n __extends(HomeworkTopic, _super);\r\n function HomeworkTopic(content, answer) {\r\n return _super.call(this, content, answer) || this;\r\n }\r\n HomeworkTopic.prototype.Init = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n if (!document.querySelector(\"input#workRelationId\")) {\r\n _this.CollectAnswer();\r\n }\r\n resolve();\r\n });\r\n };\r\n HomeworkTopic.prototype.Submit = function () {\r\n return new Promise(function (resolve) {\r\n resolve();\r\n });\r\n };\r\n return HomeworkTopic;\r\n}(CxCourseTopic));\r\n\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/topic.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/utils.ts":
/*!************************************!*\
!*** ./src/mooc/chaoxing/utils.ts ***!
\************************************/
/*! exports provided: CssBtn, CreateNoteLine */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CssBtn\", function() { return CssBtn; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CreateNoteLine\", function() { return CreateNoteLine; });\n/**\r\n * 美化按钮\r\n */\r\nfunction CssBtn(btn) {\r\n btn.style.outline = 'none';\r\n btn.style.border = '0';\r\n btn.style.background = '#7d9d35';\r\n btn.style.color = '#fff';\r\n btn.style.borderRadius = '4px';\r\n btn.style.padding = '2px 8px';\r\n btn.style.cursor = 'pointer';\r\n btn.style.fontSize = '12px';\r\n btn.style.marginLeft = '4px';\r\n btn.onmousemove = function () {\r\n btn.style.boxShadow = '1px 1px 1px 1px #ccc';\r\n };\r\n btn.onmouseout = function () {\r\n btn.style.boxShadow = '';\r\n };\r\n return btn;\r\n}\r\nfunction CreateNoteLine(text, label, append, after) {\r\n var p = document.createElement(\"p\");\r\n p.style.color = \"red\";\r\n p.style.fontSize = \"14px\";\r\n p.className = \"prompt-line-\" + label;\r\n p.innerHTML = text;\r\n if (append != undefined) {\r\n append.append(p);\r\n }\r\n if (after != undefined) {\r\n after.after(p);\r\n }\r\n return p;\r\n}\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/utils.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/vcode.ts":
/*!************************************!*\
!*** ./src/mooc/chaoxing/vcode.ts ***!
\************************************/
/*! exports provided: CxCourseVCode */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxCourseVCode\", function() { return CxCourseVCode; });\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ \"./src/mooc/chaoxing/utils.ts\");\n\r\nvar CxCourseVCode = /** @class */ (function () {\r\n function CxCourseVCode() {\r\n }\r\n CxCourseVCode.prototype.Listen = function (callback) {\r\n var imgel;\r\n window.addEventListener(\"load\", function () {\r\n if (imgel = document.getElementById(\"imgVerCode\")) {\r\n imgel.addEventListener(\"load\", function () {\r\n if (imgel.getAttribute(\"src\").indexOf('?') < 0) {\r\n return;\r\n }\r\n var parent = document.querySelector('#sub').parentElement.parentElement;\r\n var old = parent.querySelector(\".prompt-line-dama\");\r\n if (old) {\r\n old.remove();\r\n }\r\n var notice = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[\"CreateNoteLine\"])('cxmooc自动打码中...', 'dama', parent);\r\n callback(new CxCourseFillVCode(imgel, notice));\r\n });\r\n }\r\n });\r\n };\r\n return CxCourseVCode;\r\n}());\r\n\r\nvar CxCourseFillVCode = /** @class */ (function () {\r\n function CxCourseFillVCode(img, notice) {\r\n this.img = img;\r\n this.notice = notice;\r\n }\r\n CxCourseFillVCode.prototype.GetImage = function () {\r\n return this.img;\r\n };\r\n CxCourseFillVCode.prototype.Fill = function (status, msg, code) {\r\n switch (status) {\r\n case \"ok\": {\r\n this.notice.innerText = \"cxmooc打码成功,准备提交\";\r\n document.querySelector('input#code').value = code;\r\n setTimeout(function () {\r\n document.querySelector('a#sub').click();\r\n }, 3000);\r\n break;\r\n }\r\n default: {\r\n alert(msg);\r\n this.notice.innerText = msg;\r\n }\r\n }\r\n };\r\n return CxCourseFillVCode;\r\n}());\r\n\n\n//# sourceURL=webpack:///./src/mooc/chaoxing/vcode.ts?");
/***/ }),
/***/ "./src/mooc/chaoxing/video.ts":
/*!************************************!*\
!*** ./src/mooc/chaoxing/video.ts ***!
\************************************/
/*! exports provided: CxVideoOptimization, CxVideoControlBar, Video */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxVideoOptimization\", function() { return CxVideoOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CxVideoControlBar\", function() { return CxVideoControlBar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Video\", function() { return Video; });\n/* harmony import */ var _App_internal_utils_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @App/internal/utils/hook */ \"./src/internal/utils/hook.ts\");\n/* harmony import */ var _App_internal_application__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @App/internal/application */ \"./src/internal/application.ts\");\n/* harmony import */ var _App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @App/internal/utils/utils */ \"./src/internal/utils/utils.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ \"./src/mooc/chaoxing/utils.ts\");\n/* harmony import */ var _App_mooc_chaoxing_task__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @App/mooc/chaoxing/task */ \"./src/mooc/chaoxing/task.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n\r\n\r\n\r\n// 优化播放器\r\nvar CxVideoOptimization = /** @class */ (function () {\r\n function CxVideoOptimization() {\r\n }\r\n CxVideoOptimization.prototype.Start = function () {\r\n var _this = this;\r\n //对播放器进行优化\r\n window.addEventListener(\"load\", function () {\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].App.config.super_mode && Object(_App_internal_utils_utils__WEBPACK_IMPORTED_MODULE_2__[\"isPhone\"])() && (_App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].GlobalContext.Ext.isChaoxing = true);\r\n });\r\n this.hook();\r\n document.addEventListener(\"readystatechange\", function () {\r\n _this.hook();\r\n });\r\n this.Api();\r\n };\r\n CxVideoOptimization.prototype.hook = function () {\r\n if (document.readyState != \"interactive\") {\r\n return;\r\n }\r\n _App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].App.log.Debug(\"hook cx video\");\r\n var dataHook = new _App_internal_utils_hook__WEBPACK_IMPORTED_MODULE_0__[\"Hook\"](\"decode\", _App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].GlobalContext.Ext);\r\n var self = this;\r\n dataHook.Middleware(function (next) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var ret = next.apply(this, args);\r\n if (_App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].App.config.super_mode && ret.danmaku == 1) {\r\n ret.danmaku = 0;\r\n }\r\n return ret;\r\n });\r\n window.frameElement.setAttribute(\"fastforward\", \"\");\r\n window.frameElement.setAttribute(\"switchwindow\", \"\");\r\n var paramHook = new _App_internal_utils_hook__WEBPACK_IMPORTED_MODULE_0__[\"Hook\"](\"params2VideoOpt\", _App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].GlobalContext.ans.VideoJs.prototype);\r\n paramHook.Middleware(function (next) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n self.param = args[0];\r\n var ret = next.apply(this, args);\r\n ret.plugins.timelineObjects.url = self.param.rootPath + \"/richvideo/initdatawithviewer\";\r\n var cdn = _App_internal_application__WEBPACK_IMPORTED_MODULE_1__[\"Application\"].App.config.video_cdn || localStorage[\"cdn\"] || \"公网1\";\r\n for (var i = 0; i < ret.playlines.length; i++) {\r\n if (ret.playlines[i].label == cdn) {\r\n var copy = ret.playlines[i];\r\n ret.playlines.splice(i, 1);\r\n ret.playlines.splice(0, 0, copy);\r\n }\r\n }\r\n localStorage[\"cdn\"] = ret.playlines[0].label;