// ==UserScript== // @name 华师网络教育学习助手 // @version 0.0.5 // @namespace http://tampermonkey.net/ // @description 华师网络教育学习助手,自动学习、获取题库 // @author 4Ark // @match *https://gdou.scnu.edu.cn/learnspace/learn/learn/blue/index.action* // @match *https://scnu-exam.webtrn.cn/platformwebapi/student/exam/studentExam_queryExamInfo.action* // @match *https://gdou.scnu.edu.cn/learnspace/learn/learn/blue/exam_checkPaperToexam.action* // @match *https://scnu-exam.webtrn.cn/student/exam/studentExam_studentInfo.action* // @match *https://scnu-exam.webtrn.cn/exam/examflow_index.action* // @run-at document-end // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @grant GM_info // @grant GM_setClipboard // @antifeature ads // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/444904/%E5%8D%8E%E5%B8%88%E7%BD%91%E7%BB%9C%E6%95%99%E8%82%B2%E5%AD%A6%E4%B9%A0%E5%8A%A9%E6%89%8B.user.js // @updateURL https://update.greasyfork.icu/scripts/444904/%E5%8D%8E%E5%B8%88%E7%BD%91%E7%BB%9C%E6%95%99%E8%82%B2%E5%AD%A6%E4%B9%A0%E5%8A%A9%E6%89%8B.meta.js // ==/UserScript== ;(function () { 'use strict' const DEFAULT_AUTO_GET_EXAM_COUNT = 15 const PLAY_SPEED_STRATEGY = { 25: 16, 15: 12, 10: 8, 3: 4, 2: 2, 1: 1 } const EXAM_IDS_KEY = 'huashi-exam-ids' const QUESTION_TYPE_SORT = { 单项选择题: 1, 多项选择题: 2, 判断题: 3, 填空题: 4 } const UTILS_TYPE = { LEARN: '自动学习', GET_EXAM: '获取题库' } let util_type = UTILS_TYPE.LEARN const CHAPTER_TYPE = { VIDEO: 'video', TEXT: 'text' } const GET_EXAM_BASE_URL = 'https://scnu-exam.webtrn.cn/platformwebapi/student/exam/studentExam_queryExamInfo.action' const GET_EXAM_BASE_URL_2 = 'https://gdou.scnu.edu.cn/learnspace/learn/learn/blue/exam_checkPaperToexam.action' const SURE_EXAM_BASE_URL = 'https://scnu-exam.webtrn.cn/student/exam/studentExam_studentInfo.action' const EXAM_BASE_URL = 'https://scnu-exam.webtrn.cn/exam/examflow_index.action' let currentPage let currentFrame const delay = (time) => new Promise((resolve) => { setTimeout(() => resolve(), time) }) function main() { const getType = function () { const module = getCurrentModule() if (module.includes('教学视频')) { return UTILS_TYPE.LEARN } if (module.includes('在线练习')) { return UTILS_TYPE.GET_EXAM } } $('.nav .nav_li').click(function () { var tab = $(this).find('a').text() if (tab === '课程内容') { initToolbar() awaitPageLoaded(function () { setMessage('准备中...') awaitFrameLoaded(() => { const type = getType() const actions = { [UTILS_TYPE.LEARN]: startLearn, [UTILS_TYPE.GET_EXAM]: getExam } setUtilType(type) actions[type] && actions[type]() }) }) return } $('#huashi-exam-toolbar').remove() }) if (location.href.includes(GET_EXAM_BASE_URL)) { openExam() } if (location.href.includes(GET_EXAM_BASE_URL_2)) { getExam() } if (location.href.includes(SURE_EXAM_BASE_URL)) { sureExam() } if (location.href.includes(EXAM_BASE_URL)) { submitExam() } } function initToolbar() { if ($('#huashi-exam-toolbar').length) return const messageBox = $( `
华师网络教育学习助手